(messages: Message[])
| 2657 | // head + "[N chars spilled — full output: <path>]" + tail, so the model |
| 2658 | // keeps status lines and tail errors AND knows how to read the rest |
| 2659 | // (read_file with offset/limit). isError and metadata pass through |
| 2660 | // untouched. Runs BEFORE the read-only cache store so a cache hit can |
| 2661 | // never resurrect the full-size copy. Best-effort: a failed spill must |
| 2662 | // never eat the result. |
| 2663 | const spillMax = this.config.tools?.maxResultChars ?? 16_000; |
| 2664 | if (spillMax > 0 && typeof result.content === 'string' && result.content.length > spillMax) { |
| 2665 | try { |
| 2666 | const spill = await applySpillGuard(tc.function.name, sessionId, result.content, { |
| 2667 | maxResultChars: spillMax, |
| 2668 | }); |
| 2669 | if (spill.spilled) { |
| 2670 | logger.info('Tool result spilled to disk', { |
| 2671 | tool: tc.function.name, |
| 2672 | chars: result.content.length, |
| 2673 | spillPath: spill.spillPath, |
no outgoing calls
no test coverage detected