feat: add web search and background process tools (Phases 4-5)

Phase 4 - Web search tool:
- Brave Search API + SearXNG fallback
- Configurable provider, max results
- 14 tests

Phase 5 - Background process management:
- ProcessManager with start/status/output/kill/list tools
- Configurable max concurrent, max runtime, buffer size
- 28 tests
This commit is contained in:
William Valentin
2026-02-06 14:24:23 -08:00
parent eeaec53893
commit 6af26f407c
10 changed files with 1265 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
import type { Tool, ToolResult } from '../../types.js';
import type { ProcessManager } from './manager.js';
interface ProcessStatusArgs {
id: string;
}
export function createProcessStatusTool(manager: ProcessManager): Tool {
return {
name: 'process.status',
description: 'Check the status of a background process by its ID.',
inputSchema: {
type: 'object',
properties: {
id: { type: 'string', description: 'Process ID (e.g. "proc_1")' },
},
required: ['id'],
},
execute: async (rawArgs: unknown): Promise<ToolResult> => {
const args = rawArgs as ProcessStatusArgs;
const proc = manager.get(args.id);
if (!proc) {
return { success: false, output: '', error: `Process ${args.id} not found` };
}
const uptime = proc.status === 'running'
? `${Math.round((Date.now() - proc.startedAt) / 1000)}s`
: 'N/A';
let info = `Process: ${proc.id}\n`;
info += `Command: ${proc.command}\n`;
info += `PID: ${proc.pid}\n`;
info += `Status: ${proc.status}\n`;
info += `Uptime: ${uptime}\n`;
if (proc.exitCode !== undefined) info += `Exit code: ${proc.exitCode}\n`;
if (proc.errorMessage) info += `Error: ${proc.errorMessage}\n`;
if (proc.cwd) info += `CWD: ${proc.cwd}\n`;
return { success: true, output: info.trimEnd() };
},
};
}