diff options
| author | Conrad Irwin <[email protected]> | 2025-07-17 16:25:23 -0600 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-17 22:25:23 +0000 |
| commit | 761ffc63388201373e5d16f36c2af09be71b5933 (patch) | |
| tree | 3012681d84b27034ed9ceaa5df2eae6aeb753779 /packages/core/src/tools/tools.ts | |
| parent | 12401898f1f541a8a7919c94b4616fb0263dcce5 (diff) | |
Zed integration (#4266)
Co-authored-by: Agus Zubiaga <[email protected]>
Co-authored-by: Ben Brandt <[email protected]>
Co-authored-by: mkorwel <[email protected]>
Diffstat (limited to 'packages/core/src/tools/tools.ts')
| -rw-r--r-- | packages/core/src/tools/tools.ts | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/packages/core/src/tools/tools.ts b/packages/core/src/tools/tools.ts index 6f6d3f58..0d7b402a 100644 --- a/packages/core/src/tools/tools.ts +++ b/packages/core/src/tools/tools.ts @@ -29,6 +29,11 @@ export interface Tool< description: string; /** + * The icon to display when interacting via ACP + */ + icon: Icon; + + /** * Function declaration schema from @google/genai */ schema: FunctionDeclaration; @@ -61,6 +66,13 @@ export interface Tool< getDescription(params: TParams): string; /** + * Determines what file system paths the tool will affect + * @param params Parameters for the tool execution + * @returns A list of such paths + */ + toolLocations(params: TParams): ToolLocation[]; + + /** * Determines if the tool should prompt for confirmation before execution * @param params Parameters for the tool execution * @returns Whether execute should be confirmed. @@ -103,6 +115,7 @@ export abstract class BaseTool< readonly name: string, readonly displayName: string, readonly description: string, + readonly icon: Icon, readonly parameterSchema: Schema, readonly isOutputMarkdown: boolean = true, readonly canUpdateOutput: boolean = false, @@ -159,6 +172,18 @@ export abstract class BaseTool< } /** + * Determines what file system paths the tool will affect + * @param params Parameters for the tool execution + * @returns A list of such paths + */ + toolLocations( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + params: TParams, + ): ToolLocation[] { + return []; + } + + /** * Abstract method to execute the tool with the given parameters * Must be implemented by derived classes * @param params Parameters for the tool execution @@ -199,6 +224,8 @@ export type ToolResultDisplay = string | FileDiff; export interface FileDiff { fileDiff: string; fileName: string; + originalContent: string | null; + newContent: string; } export interface ToolEditConfirmationDetails { @@ -210,6 +237,8 @@ export interface ToolEditConfirmationDetails { ) => Promise<void>; fileName: string; fileDiff: string; + originalContent: string | null; + newContent: string; isModifying?: boolean; } @@ -258,3 +287,21 @@ export enum ToolConfirmationOutcome { ModifyWithEditor = 'modify_with_editor', Cancel = 'cancel', } + +export enum Icon { + FileSearch = 'fileSearch', + Folder = 'folder', + Globe = 'globe', + Hammer = 'hammer', + LightBulb = 'lightBulb', + Pencil = 'pencil', + Regex = 'regex', + Terminal = 'terminal', +} + +export interface ToolLocation { + // Absolute path to the file + path: string; + // Which line (if known) + line?: number; +} |
