mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
fix: subagent tool result parsing
This commit is contained in:
11
.vscode/launch.json
vendored
11
.vscode/launch.json
vendored
@@ -73,7 +73,16 @@
|
|||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "Launch CLI Non-Interactive",
|
"name": "Launch CLI Non-Interactive",
|
||||||
"runtimeExecutable": "npm",
|
"runtimeExecutable": "npm",
|
||||||
"runtimeArgs": ["run", "start", "--", "-p", "${input:prompt}", "-y"],
|
"runtimeArgs": [
|
||||||
|
"run",
|
||||||
|
"start",
|
||||||
|
"--",
|
||||||
|
"-p",
|
||||||
|
"${input:prompt}",
|
||||||
|
"-y",
|
||||||
|
"--output-format",
|
||||||
|
"stream-json"
|
||||||
|
],
|
||||||
"skipFiles": ["<node_internals>/**"],
|
"skipFiles": ["<node_internals>/**"],
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ export interface SubAgentToolResultEvent {
|
|||||||
success: boolean;
|
success: boolean;
|
||||||
error?: string;
|
error?: string;
|
||||||
responseParts?: Part[];
|
responseParts?: Part[];
|
||||||
|
resultDisplay?: string;
|
||||||
durationMs?: number;
|
durationMs?: number;
|
||||||
timestamp: number;
|
timestamp: number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -620,6 +620,17 @@ export class SubAgentScope {
|
|||||||
success,
|
success,
|
||||||
error: errorMessage,
|
error: errorMessage,
|
||||||
responseParts: call.response.responseParts,
|
responseParts: call.response.responseParts,
|
||||||
|
/**
|
||||||
|
* Tools like todoWrite will add some extra contents to the result,
|
||||||
|
* making it unable to deserialize the `responseParts` to a JSON object.
|
||||||
|
* While `resultDisplay` is normally a string, if not we stringify it,
|
||||||
|
* so that we can deserialize it to a JSON object when needed.
|
||||||
|
*/
|
||||||
|
resultDisplay: call.response.resultDisplay
|
||||||
|
? typeof call.response.resultDisplay === 'string'
|
||||||
|
? call.response.resultDisplay
|
||||||
|
: JSON.stringify(call.response.resultDisplay)
|
||||||
|
: undefined,
|
||||||
durationMs: duration,
|
durationMs: duration,
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
} as SubAgentToolResultEvent);
|
} as SubAgentToolResultEvent);
|
||||||
|
|||||||
Reference in New Issue
Block a user