From ef8b38899a60884cd3b4ffe5ada49811434f7f87 Mon Sep 17 00:00:00 2001 From: Jiayuan Zhang Date: Sat, 14 Feb 2026 03:32:16 +0800 Subject: [PATCH] fix(core): check for "toolCall" type in hasToolUse() to match pi-ai types The hasToolUse() function was checking for "tool_use" (raw Anthropic format) but pi-ai normalizes tool call blocks to type "toolCall". This made tool narration non-functional in the ChannelManager (Desktop/embedded) path. Co-Authored-By: Claude Opus 4.6 --- packages/core/src/agent/extract-text.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/agent/extract-text.ts b/packages/core/src/agent/extract-text.ts index 4a2e8afe..5eb0ca38 100644 --- a/packages/core/src/agent/extract-text.ts +++ b/packages/core/src/agent/extract-text.ts @@ -16,7 +16,7 @@ export function hasToolUse(message: AgentMessage | undefined): boolean { if (!message || typeof message !== "object" || !("content" in message)) return false; const content = (message as { content?: Array<{ type: string }> }).content; if (!Array.isArray(content)) return false; - return content.some((c) => c.type === "tool_use"); + return content.some((c) => c.type === "toolCall" || c.type === "tool_use"); } /** Extract thinking/reasoning content from an AgentMessage */