WindowStrategyResult
Interface: WindowStrategyResult
Defined in: src/core/agent/window/strategy.ts:127
What the stage should do next.
Properties
budgetPressure?
readonlyoptionalbudgetPressure?:object
Defined in: src/core/agent/window/strategy.ts:175
The budget reading to report on agentfootprint.context.budget_pressure.
OMIT IT when the strategy has no token budget. slidingWindow does: it
triggers on turn count, and filling capTokens with a number nobody
configured would be the invented figure this family refuses. No budget,
no budget_pressure event.
unit says what the two numbers count, because the context SLOTS emit
this same event name with the same slot: 'messages' and count in CHARS.
It defaults to 'tokens' — every shipped strategy compares against a
thresholdTokens, so that is what all three already mean. Set it to
'chars' if yours measures characters, and the event will say so.
capTokens
readonlycapTokens:number
planAction
readonlyplanAction:"evict"|"summarize"|"none"
projectedTokens
readonlyprojectedTokens:number
unit?
readonlyoptionalunit?:"chars"|"tokens"
evictions
readonlyevictions: readonlyWindowEviction[]
Defined in: src/core/agent/window/strategy.ts:145
Messages that left the window, for context.evicted.
folded?
readonlyoptionalfolded?: readonlyFoldedSpan[]
Defined in: src/core/agent/window/strategy.ts:160
Spans this visit removed, in the form that OUTLIVES the process: appended
to the conversation checkpoint, so a restart can still say what a summary
stands for — and, under retain: 'conversation', produce it verbatim.
OMIT IT unless your strategy replaced messages with something that stands
for them. summarizeOldest fills it because a summary is a claim that
needs its evidence; the drop strategies do not, because a drop replaces
nothing and its authored notice claims nothing.
The stage writes these in the SAME commit as the window change, so there is no state in which messages left the window and the record of what they were did not follow them.
rebase?
readonlyoptionalrebase?:object
Defined in: src/core/agent/window/strategy.ts:137
How the meter must re-align its provenance to the new window, which is
[...head, (one new message)?, ...tail]. Present exactly when window
is. insertedAtMs is the birth of the message the strategy put in the
span's place — omit it when the strategy removed messages and inserted
nothing.
headCount
readonlyheadCount:number
insertedAtMs?
readonlyoptionalinsertedAtMs?:number
keptTailCount
readonlykeptTailCount:number
record
readonlyrecord:WindowRecord
Defined in: src/core/agent/window/strategy.ts:143
What the ledger is told. Always present — an engaged visit explains itself.
spend?
readonlyoptionalspend?:object
Defined in: src/core/agent/window/strategy.ts:182
A billed call the strategy made, for the cost channel.
model
readonlymodel:string
usage
readonlyusage:object
usage.input
readonlyinput:number
usage.output
readonlyoutput:number
warning?
readonlyoptionalwarning?:string
Defined in: src/core/agent/window/strategy.ts:187
A one-per-run dev warning the stage should print.
window?
readonlyoptionalwindow?: readonlyLLMMessage[]
Defined in: src/core/agent/window/strategy.ts:129
The new window. Absent = leave the window alone.
