From 1c7751539694a6476be5a487c8ce6c2367c5cae3 Mon Sep 17 00:00:00 2001 From: Ayaan Zaidi Date: Sun, 26 Apr 2026 08:14:46 +0530 Subject: [PATCH] fix(agents): scope Claude JSON unwrapping --- src/agents/cli-output.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/agents/cli-output.ts b/src/agents/cli-output.ts index 109335ad500..b3b7e585369 100644 --- a/src/agents/cli-output.ts +++ b/src/agents/cli-output.ts @@ -267,14 +267,10 @@ function pickCliSessionId( } function shouldUnwrapNestedCliResultText(params: { - backend: CliBackendConfig; providerId?: string; parsed: Record; }): boolean { - const isClaudeBackend = - (params.providerId && isClaudeCliProvider(params.providerId)) || - /^claude(?:$|[\\/-])/i.test(params.backend.command.trim()); - if (!isClaudeBackend) { + if (!params.providerId || !isClaudeCliProvider(params.providerId)) { return false; } return !Object.hasOwn(params.parsed, "type") || params.parsed.type === "result"; @@ -304,7 +300,7 @@ export function parseCliJson( collectCliText(parsed.response) || collectCliText(parsed); const trimmedText = ( - shouldUnwrapNestedCliResultText({ backend, providerId, parsed }) + shouldUnwrapNestedCliResultText({ providerId, parsed }) ? unwrapNestedCliResultText(nextText) : nextText ).trim();