MCPcopy Index your code
hub / github.com/anomalyco/opencode / preserveRecentBudget

Function preserveRecentBudget

packages/opencode/src/session/compaction.ts:80–85  ·  view source on GitHub ↗
(input: { cfg: ConfigV1.Info; model: Provider.Model })

Source from the content-addressed store, hash-verified

78}
79
80function preserveRecentBudget(input: { cfg: ConfigV1.Info; model: Provider.Model }) {
81 return (
82 input.cfg.compaction?.preserve_recent_tokens ??
83 Math.min(MAX_PRESERVE_RECENT_TOKENS, Math.max(MIN_PRESERVE_RECENT_TOKENS, Math.floor(usable(input) * 0.25)))
84 )
85}
86
87function turns(messages: SessionV1.WithParts[]) {
88 const result: Turn[] = []

Callers 1

compaction.tsFile · 0.85

Calls 1

usableFunction · 0.90

Tested by

no test coverage detected