MCPcopy Create free account
hub / github.com/Noumena-Network/code / snipCompactIfNeeded

Function snipCompactIfNeeded

src/services/compact/snipCompact.ts:37–64  ·  view source on GitHub ↗
(
  messages: T[],
  options?: SnipCompactOptions,
)

Source from the content-addressed store, hash-verified

35}
36
37export function snipCompactIfNeeded<T extends MessageLike>(
38 messages: T[],
39 options?: SnipCompactOptions,
40): SnipCompactResult<T> {
41 if (!options?.force && !isSnipRuntimeEnabled()) {
42 return {
43 messages,
44 tokensFreed: 0,
45 executed: false,
46 }
47 }
48
49 if (!options?.force) {
50 return {
51 messages,
52 tokensFreed: 0,
53 executed: false,
54 }
55 }
56
57 const projected = projectSnippedView(messages)
58
59 return {
60 messages: projected,
61 tokensFreed: 0,
62 executed: projected.length !== messages.length,
63 }
64}

Callers

nothing calls this directly

Calls 2

isSnipRuntimeEnabledFunction · 0.85
projectSnippedViewFunction · 0.85

Tested by

no test coverage detected