rename command tool

This commit is contained in:
Andrew Pareles 2025-04-16 20:23:52 -07:00
parent 664428c8f0
commit 5fffd2fe0f
4 changed files with 14 additions and 14 deletions

View file

@ -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<ToolName, { done: any, proposed: any, running: any }>
@ -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<T>,
return <ToolHeaderWrapper {...componentParams} />
}
},
'run_terminal_command': {
'command_tool': {
resultWrapper: ({ toolMessage }) => {
const accessor = useAccessor()
const commandService = accessor.get('ICommandService')

View file

@ -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,

View file

@ -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.' },
},

View file

@ -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<ToolName>(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; },
}