Commit Graph

2 Commits

Author SHA1 Message Date
JackChen 696269c924
fix: guard against re-compression of already compressed tool result markers (#118)
When minChars is set low, compressed markers could be re-compressed
with incorrect char counts. Skip blocks whose content already starts
with the compression prefix.
2026-04-16 18:25:48 +08:00
JackChen a6b5181c74
feat: post-consumption tool result compression (#116) (#117)
Replace consumed tool results with compact markers before each LLM call,
freeing context budget in multi-turn agent runs. A tool result is
"consumed" once the assistant has produced a response after seeing it.

- Add `compressToolResults` option to AgentConfig / RunnerOptions
- Runs before contextStrategy (lightweight, no LLM calls)
- Error results and short results (< minChars, default 500) are skipped
- 9 test cases covering default off, compression, parallel tools,
  4+ turn compounding, error exemption, custom threshold, and
  contextStrategy coexistence
2026-04-16 18:22:42 +08:00