fix: subagent tool call messages

This commit is contained in:
mingholy.lmh
2025-11-04 20:29:38 +08:00
parent 14ad26f27e
commit a962e10406
14 changed files with 2011 additions and 1079 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,7 +73,7 @@ export interface SubAgentToolResultEvent {
name: string;
success: boolean;
error?: string;
resultDisplay?: string;
responseParts?: Part[];
durationMs?: number;
timestamp: number;
}

View File

@@ -619,11 +619,7 @@ export class SubAgentScope {
name: toolName,
success,
error: errorMessage,
resultDisplay: call.response.resultDisplay
? typeof call.response.resultDisplay === 'string'
? call.response.resultDisplay
: JSON.stringify(call.response.resultDisplay)
: undefined,
responseParts: call.response.responseParts,
durationMs: duration,
timestamp: Date.now(),
} as SubAgentToolResultEvent);

View File

@@ -332,7 +332,7 @@ class TaskToolInvocation extends BaseToolInvocation<TaskParams, ToolResult> {
...this.currentToolCalls![toolCallIndex],
status: event.success ? 'success' : 'failed',
error: event.error,
resultDisplay: event.resultDisplay,
responseParts: event.responseParts,
};
this.updateDisplay(

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import type { FunctionDeclaration, PartListUnion } from '@google/genai';
import type { FunctionDeclaration, Part, PartListUnion } from '@google/genai';
import { ToolErrorType } from './tool-error.js';
import type { DiffUpdateResult } from '../ide/ide-client.js';
import type { ShellExecutionConfig } from '../services/shellExecutionService.js';
@@ -461,6 +461,7 @@ export interface TaskResultDisplay {
args?: Record<string, unknown>;
result?: string;
resultDisplay?: string;
responseParts?: Part[];
description?: string;
}>;
}