multica/packages
Jiayuan Zhang 0bce493e10 fix(compaction): handle pi-agent-core toolResult format in truncation and pruning
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>
2026-02-15 23:39:52 +08:00
..
core fix(compaction): handle pi-agent-core toolResult format in truncation and pruning 2026-02-15 23:39:52 +08:00
hooks feat(utils): unify encrypted Device ID across all platforms 2026-02-13 17:34:23 +08:00
sdk fix(agent): report accurate compaction metrics and add run-log observability 2026-02-15 15:42:04 +08:00
store feat(core): add message source tracking and persistence 2026-02-12 18:45:15 +08:00
types feat(types): add AuthUser type for auth integration 2026-02-13 12:24:43 +08:00
ui fix(ui): remove Cmd+B sidebar toggle shortcut 2026-02-15 14:18:49 +08:00
utils feat(utils): add SMC_DATA_DIR env var to override root data directory 2026-02-15 00:39:13 +08:00