mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-02-01 22:48:03 +00:00
feat(plan): add 'communicate' tool kind (#17341)
This commit is contained in:
@@ -31,6 +31,7 @@ import {
|
||||
resolveModel,
|
||||
createWorkingStdio,
|
||||
startupProfiler,
|
||||
Kind,
|
||||
} from '@google/gemini-cli-core';
|
||||
import * as acp from '@agentclientprotocol/sdk';
|
||||
import { AcpFileSystemService } from './fileSystemService.js';
|
||||
@@ -463,7 +464,7 @@ export class Session {
|
||||
title: invocation.getDescription(),
|
||||
content,
|
||||
locations: invocation.toolLocations(),
|
||||
kind: tool.kind,
|
||||
kind: toAcpToolKind(tool.kind),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -502,7 +503,7 @@ export class Session {
|
||||
title: invocation.getDescription(),
|
||||
content: [],
|
||||
locations: invocation.toolLocations(),
|
||||
kind: tool.kind,
|
||||
kind: toAcpToolKind(tool.kind),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -798,7 +799,7 @@ export class Session {
|
||||
title: invocation.getDescription(),
|
||||
content: [],
|
||||
locations: invocation.toolLocations(),
|
||||
kind: readManyFilesTool.kind,
|
||||
kind: toAcpToolKind(readManyFilesTool.kind),
|
||||
});
|
||||
|
||||
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',
|
||||
'Ask the user one or more questions to gather preferences, clarify requirements, or make decisions.',
|
||||
Kind.Other,
|
||||
Kind.Communicate,
|
||||
{
|
||||
type: 'object',
|
||||
required: ['questions'],
|
||||
|
||||
@@ -745,6 +745,7 @@ export enum Kind {
|
||||
Execute = 'execute',
|
||||
Think = 'think',
|
||||
Fetch = 'fetch',
|
||||
Communicate = 'communicate',
|
||||
Other = 'other',
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user