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:
@@ -0,0 +1,36 @@
|
||||
import type { Tool, ToolResult } from '../../types.js';
|
||||
import type { ProcessManager } from './manager.js';
|
||||
|
||||
interface ProcessOutputArgs {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export function createProcessOutputTool(manager: ProcessManager): Tool {
|
||||
return {
|
||||
name: 'process.output',
|
||||
description: 'Read recent stdout/stderr output from a background process. Returns the last ~64KB of output.',
|
||||
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 ProcessOutputArgs;
|
||||
try {
|
||||
const output = manager.getOutput(args.id);
|
||||
if (!output) {
|
||||
return { success: true, output: '(no output yet)' };
|
||||
}
|
||||
return { success: true, output };
|
||||
} catch (error) {
|
||||
return {
|
||||
success: false,
|
||||
output: '',
|
||||
error: error instanceof Error ? error.message : 'Failed to get process output',
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user