From cbba8007b242f7212ff5bcce618c569b25235024 Mon Sep 17 00:00:00 2001 From: Olcan Date: Thu, 24 Apr 2025 18:03:33 -0700 Subject: shell bones (#160) * shell bones * Merge remote-tracking branch 'origin/main' into shell_bones * add line break * another line break * drop the log to avoid breaking terminals * rename tool to be consistent with terminal * fix build --- packages/server/src/config/config.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'packages/server/src/config/config.ts') diff --git a/packages/server/src/config/config.ts b/packages/server/src/config/config.ts index 06092b84..8a49380c 100644 --- a/packages/server/src/config/config.ts +++ b/packages/server/src/config/config.ts @@ -15,9 +15,11 @@ import { GrepTool } from '../tools/grep.js'; import { GlobTool } from '../tools/glob.js'; import { EditTool } from '../tools/edit.js'; import { TerminalTool } from '../tools/terminal.js'; +import { ShellTool } from '../tools/shell.js'; import { WriteFileTool } from '../tools/write-file.js'; import { WebFetchTool } from '../tools/web-fetch.js'; import { ReadManyFilesTool } from '../tools/read-many-files.js'; +import { BaseTool, ToolResult } from '../tools/tools.js'; const DEFAULT_PASSTHROUGH_COMMANDS = ['ls', 'git', 'npm']; @@ -132,17 +134,24 @@ function createToolRegistry(config: Config): ToolRegistry { const registry = new ToolRegistry(); const targetDir = config.getTargetDir(); - const tools = [ + const tools: Array> = [ new LSTool(targetDir), new ReadFileTool(targetDir), new GrepTool(targetDir), new GlobTool(targetDir), new EditTool(targetDir), - new TerminalTool(targetDir, config), new WriteFileTool(targetDir), new WebFetchTool(), // Note: WebFetchTool takes no arguments new ReadManyFilesTool(targetDir), ]; + + // use ShellTool (next-gen TerminalTool) if environment variable is set + if (process.env.SHELL_TOOL) { + tools.push(new ShellTool(targetDir, config)); + } else { + tools.push(new TerminalTool(targetDir, config)); + } + for (const tool of tools) { registry.registerTool(tool); } -- cgit v1.2.3