mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-12 02:50:41 -07:00
fix(cli,core): resolve lint and type errors in agent stream and core types
This commit is contained in:
@@ -211,7 +211,9 @@ class LegacyAgentProtocol implements AgentProtocol {
|
||||
this._emit(toolUpdates);
|
||||
};
|
||||
|
||||
this._config.getMessageBus().subscribe(MessageBusType.TOOL_CALLS_UPDATE, handleToolCallsUpdate);
|
||||
this._config
|
||||
.getMessageBus()
|
||||
.subscribe(MessageBusType.TOOL_CALLS_UPDATE, handleToolCallsUpdate);
|
||||
|
||||
try {
|
||||
while (true) {
|
||||
@@ -246,17 +248,23 @@ class LegacyAgentProtocol implements AgentProtocol {
|
||||
toolCallRequests.push(event.value);
|
||||
}
|
||||
|
||||
const translatedEvents = translateEvent(event, this._translationState);
|
||||
const translatedEvents = translateEvent(
|
||||
event,
|
||||
this._translationState,
|
||||
);
|
||||
|
||||
for (const ev of translatedEvents) {
|
||||
if (ev.type === 'tool_request') {
|
||||
const tool = this._config.getToolRegistry().getTool(ev.name);
|
||||
const invocation = tool?.build(ev.args);
|
||||
ev._meta = {
|
||||
displayName: tool?.displayName ?? ev.name,
|
||||
description: invocation?.getDescription() ?? tool?.description ?? '',
|
||||
isOutputMarkdown: tool?.isOutputMarkdown ?? false,
|
||||
kind: tool?.kind,
|
||||
legacyState: {
|
||||
displayName: tool?.displayName ?? ev.name,
|
||||
description:
|
||||
invocation?.getDescription() ?? tool?.description ?? '',
|
||||
isOutputMarkdown: tool?.isOutputMarkdown ?? false,
|
||||
kind: tool?.kind,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -371,7 +379,9 @@ class LegacyAgentProtocol implements AgentProtocol {
|
||||
currentParts = toolResponseParts;
|
||||
}
|
||||
} finally {
|
||||
this._config.getMessageBus().unsubscribe(MessageBusType.TOOL_CALLS_UPDATE, handleToolCallsUpdate);
|
||||
this._config
|
||||
.getMessageBus()
|
||||
.unsubscribe(MessageBusType.TOOL_CALLS_UPDATE, handleToolCallsUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -182,6 +182,16 @@ export interface ToolRequest {
|
||||
name: string;
|
||||
/** The arguments for the tool. */
|
||||
args: Record<string, unknown>;
|
||||
/** UI specific metadata */
|
||||
_meta?: {
|
||||
legacyState?: {
|
||||
displayName?: string;
|
||||
isOutputMarkdown?: boolean;
|
||||
description?: string;
|
||||
kind?: string;
|
||||
};
|
||||
[key: string]: unknown;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -194,6 +204,18 @@ export interface ToolUpdate {
|
||||
displayContent?: ContentPart[];
|
||||
content?: ContentPart[];
|
||||
data?: Record<string, unknown>;
|
||||
/** UI specific metadata */
|
||||
_meta?: {
|
||||
legacyState?: {
|
||||
status?: string;
|
||||
progressMessage?: string;
|
||||
progress?: number;
|
||||
progressTotal?: number;
|
||||
pid?: number;
|
||||
description?: string;
|
||||
};
|
||||
[key: string]: unknown;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ToolResponse {
|
||||
@@ -207,6 +229,13 @@ export interface ToolResponse {
|
||||
data?: Record<string, unknown>;
|
||||
/** When true, the tool call encountered an error that will be sent to the model. */
|
||||
isError?: boolean;
|
||||
/** UI specific metadata */
|
||||
_meta?: {
|
||||
legacyState?: {
|
||||
outputFile?: string;
|
||||
};
|
||||
[key: string]: unknown;
|
||||
};
|
||||
}
|
||||
|
||||
export type ElicitationRequest = {
|
||||
|
||||
Reference in New Issue
Block a user