mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07:00
feat(plan): add 'communicate' tool kind (#17341)
This commit is contained in:
@@ -31,6 +31,7 @@ import {
|
|||||||
resolveModel,
|
resolveModel,
|
||||||
createWorkingStdio,
|
createWorkingStdio,
|
||||||
startupProfiler,
|
startupProfiler,
|
||||||
|
Kind,
|
||||||
} from '@google/gemini-cli-core';
|
} from '@google/gemini-cli-core';
|
||||||
import * as acp from '@agentclientprotocol/sdk';
|
import * as acp from '@agentclientprotocol/sdk';
|
||||||
import { AcpFileSystemService } from './fileSystemService.js';
|
import { AcpFileSystemService } from './fileSystemService.js';
|
||||||
@@ -463,7 +464,7 @@ export class Session {
|
|||||||
title: invocation.getDescription(),
|
title: invocation.getDescription(),
|
||||||
content,
|
content,
|
||||||
locations: invocation.toolLocations(),
|
locations: invocation.toolLocations(),
|
||||||
kind: tool.kind,
|
kind: toAcpToolKind(tool.kind),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -502,7 +503,7 @@ export class Session {
|
|||||||
title: invocation.getDescription(),
|
title: invocation.getDescription(),
|
||||||
content: [],
|
content: [],
|
||||||
locations: invocation.toolLocations(),
|
locations: invocation.toolLocations(),
|
||||||
kind: tool.kind,
|
kind: toAcpToolKind(tool.kind),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -798,7 +799,7 @@ export class Session {
|
|||||||
title: invocation.getDescription(),
|
title: invocation.getDescription(),
|
||||||
content: [],
|
content: [],
|
||||||
locations: invocation.toolLocations(),
|
locations: invocation.toolLocations(),
|
||||||
kind: readManyFilesTool.kind,
|
kind: toAcpToolKind(readManyFilesTool.kind),
|
||||||
});
|
});
|
||||||
|
|
||||||
const result = await invocation.execute(abortSignal);
|
const result = await invocation.execute(abortSignal);
|
||||||
@@ -988,3 +989,25 @@ function toPermissionOptions(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maps our internal tool kind to the ACP ToolKind.
|
||||||
|
* Fallback to 'other' for kinds that are not supported by the ACP protocol.
|
||||||
|
*/
|
||||||
|
function toAcpToolKind(kind: Kind): acp.ToolKind {
|
||||||
|
switch (kind) {
|
||||||
|
case Kind.Read:
|
||||||
|
case Kind.Edit:
|
||||||
|
case Kind.Delete:
|
||||||
|
case Kind.Move:
|
||||||
|
case Kind.Search:
|
||||||
|
case Kind.Execute:
|
||||||
|
case Kind.Think:
|
||||||
|
case Kind.Fetch:
|
||||||
|
case Kind.Other:
|
||||||
|
return kind as acp.ToolKind;
|
||||||
|
case Kind.Communicate:
|
||||||
|
default:
|
||||||
|
return 'other';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export class AskUserTool extends BaseDeclarativeTool<
|
|||||||
ASK_USER_TOOL_NAME,
|
ASK_USER_TOOL_NAME,
|
||||||
'Ask User',
|
'Ask User',
|
||||||
'Ask the user one or more questions to gather preferences, clarify requirements, or make decisions.',
|
'Ask the user one or more questions to gather preferences, clarify requirements, or make decisions.',
|
||||||
Kind.Other,
|
Kind.Communicate,
|
||||||
{
|
{
|
||||||
type: 'object',
|
type: 'object',
|
||||||
required: ['questions'],
|
required: ['questions'],
|
||||||
|
|||||||
@@ -745,6 +745,7 @@ export enum Kind {
|
|||||||
Execute = 'execute',
|
Execute = 'execute',
|
||||||
Think = 'think',
|
Think = 'think',
|
||||||
Fetch = 'fetch',
|
Fetch = 'fetch',
|
||||||
|
Communicate = 'communicate',
|
||||||
Other = 'other',
|
Other = 'other',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user