diff options
| author | t <t@tjp.lol> | 2026-06-05 12:13:11 -0600 |
|---|---|---|
| committer | t <t@tjp.lol> | 2026-06-05 12:13:23 -0600 |
| commit | f4a3b704aece421d2b21be2209ff19d82bf71676 (patch) | |
| tree | 25b4244a21646d2bb2b79cfc64f25e196f077ce3 /build/gen_luarocks_embed.zig | |
| parent | ccdaef8e682960ecadf73d3b2df70559a0baaf56 (diff) | |
Recompute restated-suffix usage after compaction
The kept-verbatim suffix is no longer copied with stale usage. After
compaction the conversation begins [summary(user), kept_user,
kept_assistant, ...]; we rewrite each kept assistant's usage so the window
reads as a fresh conversation anchored at the summary.
- runSingleCompactionTurn returns the summary text plus its size (the
provider-reported output token count for the summary turn, falling back
to the word-count heuristic when usage is absent).
- rewriteWithSummary takes summary_size and forward-walks the kept suffix
maintaining a synthetic cumulative input: non-assistant messages add
their messageTokenEstimate; each assistant gets input = running
cumulative total, with the full prompt (input+cache_read+cache_write
worth) collapsed into input and cache buckets zeroed (a rewrite busts the
provider prefix cache). output/reasoning are copied verbatim; assistants
without prior usage stay null.
This keeps the cumulative-delta sizing (computeSplit/turnTokenEstimate) and
any future TUI context-window readout correct without special-casing
compaction. Tests cover the single- and multi-turn restated chains
(including cache-bucket collapse).
Test stub ScriptedTurn gains an optional usage stamp.
Diffstat (limited to 'build/gen_luarocks_embed.zig')
0 files changed, 0 insertions, 0 deletions
