mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-27 13:34:15 -07:00
feat(core): Standardize Tool and Agent Invocation constructors (Phase 2) (#15775)
This commit is contained in:
@@ -100,6 +100,8 @@ describe('DelegateToAgentTool', () => {
|
||||
config,
|
||||
{ arg1: 'valid' },
|
||||
messageBus,
|
||||
mockAgentDef.name,
|
||||
mockAgentDef.name,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -127,12 +127,17 @@ export class DelegateToAgentTool extends BaseDeclarativeTool<
|
||||
|
||||
protected createInvocation(
|
||||
params: DelegateParams,
|
||||
messageBus?: MessageBus,
|
||||
_toolName?: string,
|
||||
_toolDisplayName?: string,
|
||||
): ToolInvocation<DelegateParams, ToolResult> {
|
||||
return new DelegateInvocation(
|
||||
params,
|
||||
this.registry,
|
||||
this.config,
|
||||
this.messageBus,
|
||||
messageBus ?? this.messageBus,
|
||||
_toolName,
|
||||
_toolDisplayName,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -146,8 +151,15 @@ class DelegateInvocation extends BaseToolInvocation<
|
||||
private readonly registry: AgentRegistry,
|
||||
private readonly config: Config,
|
||||
messageBus?: MessageBus,
|
||||
_toolName?: string,
|
||||
_toolDisplayName?: string,
|
||||
) {
|
||||
super(params, messageBus, DELEGATE_TO_AGENT_TOOL_NAME);
|
||||
super(
|
||||
params,
|
||||
messageBus,
|
||||
_toolName ?? DELEGATE_TO_AGENT_TOOL_NAME,
|
||||
_toolDisplayName,
|
||||
);
|
||||
}
|
||||
|
||||
getDescription(): string {
|
||||
|
||||
@@ -44,8 +44,15 @@ export class LocalSubagentInvocation extends BaseToolInvocation<
|
||||
private readonly config: Config,
|
||||
params: AgentInputs,
|
||||
messageBus?: MessageBus,
|
||||
_toolName?: string,
|
||||
_toolDisplayName?: string,
|
||||
) {
|
||||
super(params, messageBus, definition.name, definition.displayName);
|
||||
super(
|
||||
params,
|
||||
messageBus,
|
||||
_toolName ?? definition.name,
|
||||
_toolDisplayName ?? definition.displayName,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,8 +26,15 @@ export class RemoteAgentInvocation extends BaseToolInvocation<
|
||||
private readonly definition: RemoteAgentDefinition,
|
||||
params: AgentInputs,
|
||||
messageBus?: MessageBus,
|
||||
_toolName?: string,
|
||||
_toolDisplayName?: string,
|
||||
) {
|
||||
super(params, messageBus, definition.name, definition.displayName);
|
||||
super(
|
||||
params,
|
||||
messageBus,
|
||||
_toolName ?? definition.name,
|
||||
_toolDisplayName ?? definition.displayName,
|
||||
);
|
||||
}
|
||||
|
||||
getDescription(): string {
|
||||
|
||||
@@ -120,6 +120,8 @@ describe('SubagentToolWrapper', () => {
|
||||
mockConfig,
|
||||
params,
|
||||
undefined,
|
||||
mockDefinition.name,
|
||||
mockDefinition.displayName,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -139,6 +141,8 @@ describe('SubagentToolWrapper', () => {
|
||||
mockConfig,
|
||||
params,
|
||||
mockMessageBus,
|
||||
mockDefinition.name,
|
||||
mockDefinition.displayName,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -67,17 +67,30 @@ export class SubagentToolWrapper extends BaseDeclarativeTool<
|
||||
*/
|
||||
protected createInvocation(
|
||||
params: AgentInputs,
|
||||
messageBus?: MessageBus,
|
||||
_toolName?: string,
|
||||
_toolDisplayName?: string,
|
||||
): ToolInvocation<AgentInputs, ToolResult> {
|
||||
const definition = this.definition;
|
||||
const effectiveMessageBus = messageBus ?? this.messageBus;
|
||||
|
||||
if (definition.kind === 'remote') {
|
||||
return new RemoteAgentInvocation(definition, params, this.messageBus);
|
||||
return new RemoteAgentInvocation(
|
||||
definition,
|
||||
params,
|
||||
effectiveMessageBus,
|
||||
_toolName,
|
||||
_toolDisplayName,
|
||||
);
|
||||
}
|
||||
|
||||
return new LocalSubagentInvocation(
|
||||
definition,
|
||||
this.config,
|
||||
params,
|
||||
this.messageBus,
|
||||
effectiveMessageBus,
|
||||
_toolName,
|
||||
_toolDisplayName,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user