/** * OpenAI Codex Configuration Builder * * Utility for building ProcessConfig specific to OpenAI Codex CLI. * Provides type-safe configuration for Codex's flags and options. * * @module execution-engine/agents/codex */ import type { ProcessConfig } from '../../process/types.js'; /** * MCP server configuration * * Defines how to spawn an MCP server for Codex to connect to. */ export interface McpServerConfig { /** * The command to run (e.g., 'node', 'python', 'npx') */ command: string; /** * Arguments to pass to the command */ args?: string[]; /** * Environment variables to set for the server process */ env?: Record; } /** * Configuration options specific to OpenAI Codex CLI */ export interface CodexConfig { /** * Path to Codex CLI executable * @default 'codex' */ codexPath?: string; /** * Working directory for the process */ workDir: string; /** * Use 'codex exec' for non-interactive execution * @default true (for automation use cases) */ exec?: boolean; /** * Emit newline-delimited JSON events * @default false */ json?: boolean; /** * Use experimental JSON output format * @default false */ experimentalJson?: boolean; /** * Write final assistant message to file */ outputLastMessage?: string; /** * Override configured model (e.g., 'gpt-5-codex', 'gpt-5') */ model?: string; /** * Sandbox policy: read-only, workspace-write, or danger-full-access * @default 'workspace-write' */ sandbox?: 'read-only' | 'workspace-write' | 'danger-full-access'; /** * Approval policy: untrusted, on-failure, on-request, never * @default 'on-failure' */ askForApproval?: 'untrusted' | 'on-failure' | 'on-request' | 'never'; /** * Shortcut combining workspace-write sandbox + on-failure approvals * @default false */ fullAuto?: boolean; /** * Allow execution outside Git repositories * @default false */ skipGitRepoCheck?: boolean; /** * Control ANSI color output * @default 'auto' */ color?: 'always' | 'never' | 'auto'; /** * Enable web browsing capability * @default false */ search?: boolean; /** * Attach image files to the prompt */ image?: string[]; /** * Load configuration profile from config.toml */ profile?: string; /** * Additional directories to grant write access (repeatable) */ addDir?: string[]; /** * Disable all safety checks (isolated environments only) * @default false */ yolo?: boolean; /** * Environment variables to pass to the process */ env?: Record; /** * Maximum execution time in milliseconds */ timeout?: number; /** * Maximum idle time before cleanup (pool only) */ idleTimeout?: number; /** * Retry configuration for failed spawns */ retry?: { maxAttempts: number; backoffMs: number; }; /** * Prompt to send to Codex */ prompt?: string; /** * MCP servers to configure inline * * Maps to -c mcp_servers.{name}.{field}=value flags using TOML format. * Overrides values from ~/.codex/config.toml for this session. * * @example * ```typescript * mcpServers: { * 'my-server': { * command: 'node', * args: ['/path/to/server.js', '--port', '3000'], * env: { API_KEY: 'secret' } * } * } * ``` */ mcpServers?: Record; } /** * Build a generic ProcessConfig from Codex specific configuration * * @param config - Codex specific configuration * @returns Generic ProcessConfig that can be used with any ProcessManager * * @example * ```typescript * const config = buildCodexConfig({ * workDir: '/path/to/project', * exec: true, * json: true, * fullAuto: true, * }); * * const process = await manager.acquireProcess(config); * ``` */ export declare function buildCodexConfig(config: CodexConfig): ProcessConfig; //# sourceMappingURL=config-builder.d.ts.map