UNPKG

@every-env/cli

Version:

Multi-agent orchestrator for AI-powered development workflows

91 lines (72 loc) 2.4 kB
# Research Command Timeout Support Patch This patch shows how to add timeout support to the research command following the same pattern as the plan command. ## 1. Add timeout option to the research command definition In your `cli.ts` file, find where the research command is defined and add the timeout option: ```typescript program .command('research [query...]') .description('Research codebase or features') // ... other options ... .option('--timeout <ms>', 'Process timeout in milliseconds (default: 300000)', parseInt) .action(async (query: string[], options) => { await runResearchCommand(query, options); }); ``` ## 2. Update runResearchCommand to use the timeout In the `runResearchCommand` function, add the timeout to the agent configuration: ```typescript async function runResearchCommand(args: string[], options: any) { // ... existing code ... const task = { pattern: { name: 'research', description: 'Research codebase or feature', agents: [] }, agent: { id: 'research-agent', command: claudeCommand, promptFile: promptPath, output: outputFile, promptMode: 'stdin' as const, workingDir: process.cwd(), flags: [], timeout: options.timeout // Add this line }, variables: { // ... your variables ... }, outputPath: outputFile }; // ... rest of the function ... } ``` ## 3. Environment Variable Support The timeout can also be set via environment variable `EVERY_ENV_TIMEOUT`: ```bash export EVERY_ENV_TIMEOUT=600000 # 10 minutes every-env research "your query" ``` ## 4. Usage Examples ```bash # Use custom timeout of 10 minutes (600000ms) every-env research "complex feature analysis" --timeout 600000 # Use environment variable export EVERY_ENV_TIMEOUT=600000 every-env research "analyze authentication system" # Set timeout in agent config (config.json) { "agents": [{ "id": "research-agent", "timeout": 600000, // ... other config ... }] } ``` ## How the Timeout Works The timeout is applied in this priority order: 1. CLI option (`--timeout`) 2. Agent config (`agent.timeout` in config.json) 3. Environment variable (`EVERY_ENV_TIMEOUT`) 4. Default (5 minutes / 300000ms) The timeout infrastructure is already in place in the base agent class, so you just need to pass the timeout value through the agent configuration.