Headless enhancement: add stream-json as input-format/output-format to support programmatically use (#926)

This commit is contained in:
Kdump
2025-11-21 09:26:05 +08:00
committed by GitHub
parent 442a9aed58
commit 9e5387f159
50 changed files with 14559 additions and 534 deletions

View File

@@ -9,6 +9,7 @@ import type {
ToolCallConfirmationDetails,
ToolConfirmationOutcome,
} from '../tools/tools.js';
import type { Part } from '@google/genai';
export type SubAgentEvent =
| 'start'
@@ -72,6 +73,7 @@ export interface SubAgentToolResultEvent {
name: string;
success: boolean;
error?: string;
responseParts?: Part[];
resultDisplay?: string;
durationMs?: number;
timestamp: number;

View File

@@ -619,6 +619,13 @@ export class SubAgentScope {
name: toolName,
success,
error: errorMessage,
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