mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07:00
feat(core): introduce Kind.Agent for sub-agent classification (#20369)
This commit is contained in:
@@ -1335,6 +1335,8 @@ function toAcpToolKind(kind: Kind): acp.ToolKind {
|
|||||||
case Kind.SwitchMode:
|
case Kind.SwitchMode:
|
||||||
case Kind.Other:
|
case Kind.Other:
|
||||||
return kind as acp.ToolKind;
|
return kind as acp.ToolKind;
|
||||||
|
case Kind.Agent:
|
||||||
|
return 'think';
|
||||||
case Kind.Plan:
|
case Kind.Plan:
|
||||||
case Kind.Communicate:
|
case Kind.Communicate:
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ describe('SubagentToolWrapper', () => {
|
|||||||
expect(wrapper.name).toBe(mockDefinition.name);
|
expect(wrapper.name).toBe(mockDefinition.name);
|
||||||
expect(wrapper.displayName).toBe(mockDefinition.displayName);
|
expect(wrapper.displayName).toBe(mockDefinition.displayName);
|
||||||
expect(wrapper.description).toBe(mockDefinition.description);
|
expect(wrapper.description).toBe(mockDefinition.description);
|
||||||
expect(wrapper.kind).toBe(Kind.Think);
|
expect(wrapper.kind).toBe(Kind.Agent);
|
||||||
expect(wrapper.isOutputMarkdown).toBe(true);
|
expect(wrapper.isOutputMarkdown).toBe(true);
|
||||||
expect(wrapper.canUpdateOutput).toBe(true);
|
expect(wrapper.canUpdateOutput).toBe(true);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export class SubagentToolWrapper extends BaseDeclarativeTool<
|
|||||||
definition.name,
|
definition.name,
|
||||||
definition.displayName ?? definition.name,
|
definition.displayName ?? definition.name,
|
||||||
definition.description,
|
definition.description,
|
||||||
Kind.Think,
|
Kind.Agent,
|
||||||
definition.inputConfig.inputSchema,
|
definition.inputConfig.inputSchema,
|
||||||
messageBus,
|
messageBus,
|
||||||
/* isOutputMarkdown */ true,
|
/* isOutputMarkdown */ true,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||||
import { SubagentTool } from './subagent-tool.js';
|
import { SubagentTool } from './subagent-tool.js';
|
||||||
import { SubagentToolWrapper } from './subagent-tool-wrapper.js';
|
import { SubagentToolWrapper } from './subagent-tool-wrapper.js';
|
||||||
|
import { Kind } from '../tools/tools.js';
|
||||||
import type {
|
import type {
|
||||||
LocalAgentDefinition,
|
LocalAgentDefinition,
|
||||||
RemoteAgentDefinition,
|
RemoteAgentDefinition,
|
||||||
@@ -70,6 +71,11 @@ describe('SubAgentInvocation', () => {
|
|||||||
.mockReturnValue(mockInnerInvocation);
|
.mockReturnValue(mockInnerInvocation);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should have Kind.Agent', () => {
|
||||||
|
const tool = new SubagentTool(testDefinition, mockConfig, mockMessageBus);
|
||||||
|
expect(tool.kind).toBe(Kind.Agent);
|
||||||
|
});
|
||||||
|
|
||||||
it('should delegate shouldConfirmExecute to the inner sub-invocation (local)', async () => {
|
it('should delegate shouldConfirmExecute to the inner sub-invocation (local)', async () => {
|
||||||
const tool = new SubagentTool(testDefinition, mockConfig, mockMessageBus);
|
const tool = new SubagentTool(testDefinition, mockConfig, mockMessageBus);
|
||||||
const params = {};
|
const params = {};
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export class SubagentTool extends BaseDeclarativeTool<AgentInputs, ToolResult> {
|
|||||||
definition.name,
|
definition.name,
|
||||||
definition.displayName ?? definition.name,
|
definition.displayName ?? definition.name,
|
||||||
definition.description,
|
definition.description,
|
||||||
Kind.Think,
|
Kind.Agent,
|
||||||
inputSchema,
|
inputSchema,
|
||||||
messageBus,
|
messageBus,
|
||||||
/* isOutputMarkdown */ true,
|
/* isOutputMarkdown */ true,
|
||||||
|
|||||||
@@ -832,6 +832,7 @@ export enum Kind {
|
|||||||
Search = 'search',
|
Search = 'search',
|
||||||
Execute = 'execute',
|
Execute = 'execute',
|
||||||
Think = 'think',
|
Think = 'think',
|
||||||
|
Agent = 'agent',
|
||||||
Fetch = 'fetch',
|
Fetch = 'fetch',
|
||||||
Communicate = 'communicate',
|
Communicate = 'communicate',
|
||||||
Plan = 'plan',
|
Plan = 'plan',
|
||||||
|
|||||||
Reference in New Issue
Block a user