Skip to content
2 min read · 327 words

Interface: AssembleCompactedTurnsOptions

Defined in: src/batteries/context/compact/summarizer.ts:176

Options for assembleCompactedTurns.

Properties

PropertyTypeDescriptionDefined in
encoding?stringThe encoding to measure under. Default: 'cl100k_base'.src/batteries/context/compact/summarizer.ts:183
estimateTokensEstimateTokensFnREQUIRED. Measures token costs (the older-region threshold check, and OnCostFn reporting).src/batteries/context/compact/summarizer.ts:181
keepVerbatim?numberHow many of the most recent turns stay verbatim. Default: DEFAULT_KEEP_VERBATIM.src/batteries/context/compact/summarizer.ts:185
onCost?OnCostFnFired once per summarization call that actually runs (never on the below-threshold pass-through path). See OnCostFn.src/batteries/context/compact/summarizer.ts:198
priorState?{ coveredOlder: number; summary: string | null; }The caller's own bookkeeping of prior state, threaded through explicitly (replacing the original #compactSummary/#compactCoveredOlder private fields on the flagship agent's class instance): the rolling summary text produced by a previous call, and how many older-region turns that summary already covers. Omit on the FIRST call for a fresh run (equivalent to the originals' null/0 initial values). This battery holds no state of its own between calls — see AssembleCompactedTurnsResult for what to persist and pass back in on the next call.src/batteries/context/compact/summarizer.ts:207
priorState.coveredOldernumber-src/batteries/context/compact/summarizer.ts:207
priorState.summarystring | null-src/batteries/context/compact/summarizer.ts:207
summariseAtTokens?numberThe older-region token threshold past which a (re)summarization fires. Default: DEFAULT_SUMMARISE_AT_TOKENS.src/batteries/context/compact/summarizer.ts:188
summarizeSummarizeFnREQUIRED. The model-call seam — see SummarizeFn.src/batteries/context/compact/summarizer.ts:178
summaryMessageId?stringThe id assigned to the synthetic summary message/turn. Default: DEFAULT_SUMMARY_MESSAGE_ID — see that constant's TSDoc for the cross-battery contract with Token Thrift's isSummaryMessage predicate before changing this.src/batteries/context/compact/summarizer.ts:195
systemPrompt?stringThe compaction instructions passed through to summariseTurns. Default: COMPACTION_SYSTEM_PROMPT.src/batteries/context/compact/summarizer.ts:191