/**
 * Codex CLI Executor Service
 *
 * Infrastructure implementation of IAgentExecutor for the OpenAI Codex CLI agent.
 * Executes prompts via the `codex` CLI subprocess with JSONL output format.
 *
 * Uses constructor dependency injection for the spawn function
 * to enable testability without mocking node:child_process directly.
 */
import type { AgentType, AgentFeature, AgentConfig } from '../../../../../domain/generated/output.js';
import type { IAgentExecutor, AgentExecutionOptions, AgentExecutionResult, AgentExecutionStreamEvent } from '../../../../../application/ports/output/agents/agent-executor.interface.js';
import type { SpawnFunction } from '../types.js';
/**
 * Executor service for OpenAI Codex CLI agent.
 * Uses subprocess spawning to interact with the `codex` CLI.
 */
export declare class CodexCliExecutorService implements IAgentExecutor {
    private readonly spawn;
    private readonly authConfig?;
    readonly agentType: AgentType;
    /** When true, suppresses debug logging (set per-call via options.silent) */
    private silent;
    constructor(spawn: SpawnFunction, authConfig?: AgentConfig | undefined);
    /** Debug logging — writes to stdout so it appears in the worker log file */
    private log;
    supportsFeature(feature: AgentFeature): boolean;
    execute(prompt: string, options?: AgentExecutionOptions): Promise<AgentExecutionResult>;
    executeStream(prompt: string, options?: AgentExecutionOptions): AsyncIterable<AgentExecutionStreamEvent>;
    /**
     * Log a JSONL stream line as a human-readable event in the worker log.
     * Extracts tool calls (function_call), assistant text, command executions,
     * and result summaries for verbose debugging.
     */
    /** Item types that represent assistant text messages */
    private static readonly MESSAGE_ITEM_TYPES;
    private logStreamEvent;
    /**
     * Build CLI arguments for codex exec.
     *
     * For initial execution: `codex exec - --json --sandbox danger-full-access ...`
     * For resume: `codex exec resume <threadId> "prompt" --json --sandbox danger-full-access ...`
     */
    private buildArgs;
    private buildSpawnOptions;
    /**
     * Extract token usage from Codex CLI turn.completed usage object.
     */
    private extractUsage;
    /**
     * Extract delta text from an item.updated event.
     * Codex CLI uses `item.text` directly, while other formats use content blocks or `item.delta`.
     */
    private extractDeltaText;
    /**
     * Extract final text from an item.completed event.
     * Codex CLI uses `item.text` directly, while other formats use `item.content` blocks.
     */
    private extractItemText;
    /**
     * Check stderr for patterns indicating fatal API errors.
     * Returns an error message if fatal patterns are found, null otherwise.
     */
    private detectFatalStderrError;
}
//# sourceMappingURL=codex-cli-executor.service.d.ts.map