MCPcopy Create free account
hub / github.com/arctic-cli/interface / isOverflow

Function isOverflow

packages/arctic/src/session/compaction.ts:33–41  ·  view source on GitHub ↗
(input: { tokens: MessageV2.Assistant["tokens"]; model: Provider.Model })

Source from the content-addressed store, hash-verified

31 }
32
33 export function isOverflow(input: { tokens: MessageV2.Assistant["tokens"]; model: Provider.Model }) {
34 if (Flag.ARCTIC_DISABLE_AUTOCOMPACT) return false
35 const context = input.model.limit.context
36 if (context === 0) return false
37 const count = input.tokens.input + input.tokens.cache.read + input.tokens.output
38 const output = Math.min(input.model.limit.output, SessionPrompt.OUTPUT_TOKEN_MAX) || SessionPrompt.OUTPUT_TOKEN_MAX
39 const usable = context - output
40 return count > usable
41 }
42
43 export const PRUNE_MINIMUM = 20_000
44 export const PRUNE_PROTECT = 40_000

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected