mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 10:30:44 +00:00
fix(agents): scope Claude JSON unwrapping
This commit is contained in:
@@ -267,14 +267,10 @@ function pickCliSessionId(
|
||||
}
|
||||
|
||||
function shouldUnwrapNestedCliResultText(params: {
|
||||
backend: CliBackendConfig;
|
||||
providerId?: string;
|
||||
parsed: Record<string, unknown>;
|
||||
}): 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();
|
||||
|
||||
Reference in New Issue
Block a user