Preserve interrupted post-tool context

This commit is contained in:
Hypatia May
2026-07-15 12:49:50 +08:00
parent c3d5568efd
commit edfc4dc4ac
8 changed files with 113 additions and 32 deletions

View File

@@ -151,10 +151,11 @@ interface ToolExecutionResult {
* NEXT request (Claude Code's PostToolUse `additionalContext`). It is NOT part
* of this call's `content` — `content`/`feedback` shape the tool RESULT, but
* `additionalContext` is a SEPARATE `context/message`. A step can carry
* multiple tool calls, so the loop BUFFERS every call's `additionalContext`
* and appends them only AFTER all `tool/result`s for the step, keeping
* tool-call/result adjacency intact. Carried on the result purely to ferry it
* from `execute()` up to the loop's per-step buffer.
* multiple tool calls, so the loop accepts every call's `additionalContext`
* into the active-batch FIFO and appends it only when that batch settles. A
* successful batch places context AFTER all its `tool/result`s; an interrupted
* batch places it after every recorded result and before turn close. Carried
* on the result purely to ferry it from `execute()` up to that FIFO.
*/
additionalContext?: HookContext
/**