From 055a1dff0c9166f30347d5a7a05531487344910b Mon Sep 17 00:00:00 2001 From: Roo Code Date: Tue, 17 Feb 2026 17:51:24 +0000 Subject: [PATCH] fix: handle array-format ToolResultBlockParam.content in PostToolUse hook --- .../assistant-message/presentAssistantMessage.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/core/assistant-message/presentAssistantMessage.ts b/src/core/assistant-message/presentAssistantMessage.ts index f1cb9daf61..06b91eec28 100644 --- a/src/core/assistant-message/presentAssistantMessage.ts +++ b/src/core/assistant-message/presentAssistantMessage.ts @@ -957,7 +957,18 @@ export async function presentAssistantMessage(cline: Task) { b.type === "tool_result", ) .pop() - const resultText = typeof lastResult?.content === "string" ? lastResult.content : "" + const resultText = + typeof lastResult?.content === "string" + ? lastResult.content + : Array.isArray(lastResult?.content) + ? lastResult.content + .filter( + (b): b is import("@anthropic-ai/sdk").Anthropic.TextBlockParam => + b.type === "text", + ) + .map((b) => b.text) + .join("\n") + : "" const hookContext: HookContext = { event: "PostToolUse", toolName: block.name,