From 4876bad9abb833f83865050e89ed3ce1fa713875 Mon Sep 17 00:00:00 2001 From: William Valentin Date: Sat, 7 Feb 2026 13:54:17 -0800 Subject: [PATCH] feat: register web search and process tools in TUI mode Previously these tools were only available in daemon mode. Now TUI mode also registers web search tools (when credentials are configured) and process management tools with proper cleanup on exit. --- src/cli/tui.ts | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/cli/tui.ts b/src/cli/tui.ts index 8141bac..de513af 100644 --- a/src/cli/tui.ts +++ b/src/cli/tui.ts @@ -46,7 +46,7 @@ export function registerTuiCommand(program: Command): void { const { AnthropicClient, OpenAIClient, OllamaClient, LlamaCppClient, GitHubModelsClient, GeminiClient, BedrockClient, ModelRouter } = await import('../models/index.js'); const { MinimalTui, startFullscreenTui } = await import('../frontends/tui/index.js'); const { NativeAgent } = await import('../backends/index.js'); - const { ToolRegistry, ToolExecutor, allBuiltinTools } = await import('../tools/index.js'); + const { ToolRegistry, ToolExecutor, allBuiltinTools, createWebSearchTools, createProcessTools, ProcessManager } = await import('../tools/index.js'); const { HookEngine } = await import('../hooks/index.js'); const dataDir = resolve(homedir(), '.local/share/flynn'); @@ -122,6 +122,30 @@ export function registerTuiCommand(program: Command): void { for (const tool of allBuiltinTools) { toolRegistry.register(tool); } + + // Register web search tools if configured with credentials + if (config.web_search.api_key || config.web_search.endpoint) { + for (const tool of createWebSearchTools({ + provider: config.web_search.provider, + apiKey: config.web_search.api_key, + endpoint: config.web_search.endpoint, + maxResults: config.web_search.max_results, + })) { + toolRegistry.register(tool); + } + } + + // Initialize process manager and register process tools + const processManager = new ProcessManager({ + maxConcurrent: config.process.max_concurrent, + maxRuntimeMinutes: config.process.max_runtime_minutes, + bufferSize: config.process.buffer_size, + }); + + for (const tool of createProcessTools(processManager)) { + toolRegistry.register(tool); + } + const toolExecutor = new ToolExecutor(toolRegistry, hookEngine); const session = sessionManager.getSession('tui', 'local'); @@ -147,6 +171,7 @@ export function registerTuiCommand(program: Command): void { }); const cleanup = () => { + processManager.shutdown(); sessionStore.close(); };