The pre-emptive truncation, tool result pruning, and summary fallback only checked for Anthropic-style `role: "user"` messages with `type: "tool_result"` blocks. The actual runtime uses pi-agent-core format with `role: "toolResult"`, `toolCallId`, and `toolName` on the message itself. This caused truncation and pruning to silently skip all tool results in real agent runs. Add handlers for the pi-agent-core format in all four affected modules: - session-manager.ts: check both "user" and "toolResult" roles - tool-result-truncation.ts: new handler for toolResult format - tool-result-pruning.ts: new processToolResultMessage() + updated loops - summary-fallback.ts: include "toolResult" in artifact ref extraction Verified via agent-driven E2E tests (5 test sessions, 6 artifacts). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| src | ||
| package.json | ||
| tsconfig.json | ||
| tsup.config.ts | ||