mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
Zed integration (#4266)
Co-authored-by: Agus Zubiaga <agus@zed.dev> Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com> Co-authored-by: mkorwel <matt.korwel@gmail.com>
This commit is contained in:
@@ -28,6 +28,11 @@ export interface Tool<
|
||||
*/
|
||||
description: string;
|
||||
|
||||
/**
|
||||
* The icon to display when interacting via ACP
|
||||
*/
|
||||
icon: Icon;
|
||||
|
||||
/**
|
||||
* Function declaration schema from @google/genai
|
||||
*/
|
||||
@@ -60,6 +65,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
|
||||
@@ -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,
|
||||
@@ -158,6 +171,18 @@ export abstract class BaseTool<
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user