From 5fffd2fe0ff4d80b3250f3e12638bbaa5f7f6339 Mon Sep 17 00:00:00 2001 From: Andrew Pareles Date: Wed, 16 Apr 2025 20:23:52 -0700 Subject: [PATCH] rename command tool --- .../void/browser/react/src/sidebar-tsx/SidebarChat.tsx | 8 ++++---- src/vs/workbench/contrib/void/browser/toolsService.ts | 6 +++--- src/vs/workbench/contrib/void/common/prompt/prompts.ts | 8 ++++---- src/vs/workbench/contrib/void/common/toolsServiceTypes.ts | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx index 7eeacb64..029e0717 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx @@ -1177,7 +1177,7 @@ const titleOfToolName = { 'create_file_or_folder': { done: `Created`, proposed: `Create`, running: loadingTitleWrapper(`Creating`) }, 'delete_file_or_folder': { done: `Deleted`, proposed: `Delete`, running: loadingTitleWrapper(`Deleting`) }, 'edit_file': { done: `Edited file`, proposed: 'Edit file', running: loadingTitleWrapper('Editing file') }, - 'run_terminal_command': { done: `Ran terminal`, proposed: 'Run terminal', running: loadingTitleWrapper('Running terminal') }, + 'command_tool': { done: `Ran terminal`, proposed: 'Run terminal', running: loadingTitleWrapper('Running terminal') }, 'read_lint_errors': { done: `Read lint errors`, proposed: 'Read lint errors', running: loadingTitleWrapper('Reading lint errors') }, } as const satisfies Record @@ -1219,8 +1219,8 @@ const toolNameToDesc = (toolName: ToolName, _toolParams: ToolCallParams[ToolName } else if (toolName === 'edit_file') { const toolParams = _toolParams as ToolCallParams['edit_file'] return getBasename(toolParams.uri.fsPath); - } else if (toolName === 'run_terminal_command') { - const toolParams = _toolParams as ToolCallParams['run_terminal_command'] + } else if (toolName === 'command_tool') { + const toolParams = _toolParams as ToolCallParams['command_tool'] return `"${toolParams.command}"`; } else { return '' @@ -1858,7 +1858,7 @@ const toolNameToComponent: { [T in ToolName]: { resultWrapper: ResultWrapper, return } }, - 'run_terminal_command': { + 'command_tool': { resultWrapper: ({ toolMessage }) => { const accessor = useAccessor() const commandService = accessor.get('ICommandService') diff --git a/src/vs/workbench/contrib/void/browser/toolsService.ts b/src/vs/workbench/contrib/void/browser/toolsService.ts index b2288476..2ddeccb7 100644 --- a/src/vs/workbench/contrib/void/browser/toolsService.ts +++ b/src/vs/workbench/contrib/void/browser/toolsService.ts @@ -248,7 +248,7 @@ export class ToolsService implements IToolsService { return { uri, changeDescription } }, - run_terminal_command: (params: RawToolParamsObj) => { + command_tool: (params: RawToolParamsObj) => { const { command: commandUnknown, terminal_id: terminalIdUnknown, wait_for_completion: waitForCompletionUnknown } = params const command = validateStr('command', commandUnknown) const proposedTerminalId = validateProposedTerminalId(terminalIdUnknown) @@ -385,7 +385,7 @@ export class ToolsService implements IToolsService { return { result: lintErrorsPromise, interruptTool } }, - run_terminal_command: async ({ command, proposedTerminalId, waitForCompletion }) => { + command_tool: async ({ command, proposedTerminalId, waitForCompletion }) => { const { terminalId, didCreateTerminal, result, resolveReason } = await this.terminalToolService.runCommand(command, proposedTerminalId, waitForCompletion) return { result: { terminalId, didCreateTerminal, result, resolveReason } } }, @@ -439,7 +439,7 @@ export class ToolsService implements IToolsService { return `Change successfully made to ${params.uri.fsPath}.${lintErrsString}` }, - run_terminal_command: (params, result) => { + command_tool: (params, result) => { const { terminalId, didCreateTerminal, diff --git a/src/vs/workbench/contrib/void/common/prompt/prompts.ts b/src/vs/workbench/contrib/void/common/prompt/prompts.ts index 4955400b..312521cb 100644 --- a/src/vs/workbench/contrib/void/common/prompt/prompts.ts +++ b/src/vs/workbench/contrib/void/common/prompt/prompts.ts @@ -166,11 +166,11 @@ Here's an example of a good description:\n${editToolDescriptionExample}` }, }, - run_terminal_command: { - name: 'run_terminal_command', - description: `Executes a terminal command.`, + command_tool: { + name: 'command_tool', + description: `Runs a terminal command. You can use this tool to run any command: sed, grep, etc. We just prefer you edit with the edit tool, not this tool if possible.`, params: { - command: { description: 'The terminal command to execute. If working with tools like git that can paginate, you should pipe to cat so results are not truncated.' }, + command: { description: 'The terminal command to run.' }, wait_for_completion: { description: `Optional. Default is true. Make this value false when you want a command to run without waiting for it to complete.` }, terminal_id: { description: 'Optional. The ID of the terminal instance that should execute the command (if not provided, defaults to the preferred terminal ID). The primary purpose of this is to let you open a new terminal for testing or background processes (e.g. running a dev server for the user in a separate terminal). Must be an integer >= 1.' }, }, diff --git a/src/vs/workbench/contrib/void/common/toolsServiceTypes.ts b/src/vs/workbench/contrib/void/common/toolsServiceTypes.ts index 22941826..2fd919fa 100644 --- a/src/vs/workbench/contrib/void/common/toolsServiceTypes.ts +++ b/src/vs/workbench/contrib/void/common/toolsServiceTypes.ts @@ -17,7 +17,7 @@ export type ShallowDirectoryItem = { -const toolNamesWithApproval = ['create_file_or_folder', 'delete_file_or_folder', 'edit_file', 'run_terminal_command'] as const satisfies readonly ToolName[] +const toolNamesWithApproval = ['create_file_or_folder', 'delete_file_or_folder', 'edit_file', 'command_tool'] as const satisfies readonly ToolName[] export type ToolNameWithApproval = typeof toolNamesWithApproval[number] export const toolNamesThatRequireApproval = new Set(toolNamesWithApproval) @@ -33,7 +33,7 @@ export type ToolCallParams = { 'edit_file': { uri: URI, changeDescription: string }, 'create_file_or_folder': { uri: URI, isFolder: boolean }, 'delete_file_or_folder': { uri: URI, isRecursive: boolean, isFolder: boolean }, - 'run_terminal_command': { command: string, proposedTerminalId: string, waitForCompletion: boolean }, + 'command_tool': { command: string, proposedTerminalId: string, waitForCompletion: boolean }, } @@ -49,6 +49,6 @@ export type ToolResultType = { 'edit_file': Promise<{ lintErrors: LintErrorItem[] | null }>, 'create_file_or_folder': {}, 'delete_file_or_folder': {}, - 'run_terminal_command': { terminalId: string, didCreateTerminal: boolean, result: string; resolveReason: TerminalResolveReason; }, + 'command_tool': { terminalId: string, didCreateTerminal: boolean, result: string; resolveReason: TerminalResolveReason; }, }