UNPKG

mcp-subagents

Version:

Multi-Agent AI Orchestration via Model Context Protocol - Access specialized CLI AI agents (Aider, Qwen, Gemini, Goose, etc.) with intelligent fallback and configuration

39 lines 1.43 kB
import { BaseAgent } from './base.js'; export class CodexAgent extends BaseAgent { buildCommand(_task, taskConfig) { const cmd = ['codex']; // Automation flags cmd.push('--full-auto'); // Model selection with proper priority: // 1. Task config model (highest priority) // 2. CODEX_MODEL from task env (config file/MCP config) // 3. CODEX_MODEL from process env (system environment) // 4. Config file model (from this.config.defaults) // 5. Built-in default (lowest priority, handled in registry) const model = taskConfig.model || taskConfig.env?.['CODEX_MODEL'] || process.env['CODEX_MODEL'] || this.config.defaults['model']; if (model) { cmd.push('-m', String(model)); } // Sandbox mode if (taskConfig.sandbox) { cmd.push('-s', 'workspace-write'); } // Working directory if (taskConfig.workingDirectory) { cmd.push('-C', taskConfig.workingDirectory); } // Use stdin instead of positional argument // Add custom flags (overrides defaults) if (taskConfig.flags && taskConfig.flags.length > 0) { cmd.push(...taskConfig.flags); } return this.validateCommand(cmd); } getInputMethod() { return 'stdin'; } } //# sourceMappingURL=codex.js.map