/** * adapters/codex — Codex CLI platform adapter. * * Implements HookAdapter for Codex CLI's JSON stdin/stdout paradigm. * * Codex CLI hook specifics: * - 5 hook events: PreToolUse, PostToolUse, SessionStart, UserPromptSubmit, Stop * - Same wire protocol as Claude Code (JSON stdin → stdout) * - Config: ~/.codex/hooks.json + ~/.codex/config.toml (TOML for MCP/features) * - Session dir: ~/.codex/context-mode/sessions/ * * IMPORTANT: Hook dispatch is NOT yet active in Codex CLI (v0.118.0). * codex_hooks feature flag is Stage::UnderDevelopment — hooks are implemented * in codex-rs/hooks/ but not wired into the tool execution pipeline. * Our adapter is ready; it will work once Codex enables dispatch. * Track: https://github.com/openai/codex/issues/16685 */ import type { HookAdapter, HookParadigm, PlatformCapabilities, DiagnosticResult, PreToolUseEvent, PostToolUseEvent, PreCompactEvent, SessionStartEvent, PreToolUseResponse, PostToolUseResponse, PreCompactResponse, SessionStartResponse, HookRegistration } from "../types.js"; export declare class CodexAdapter implements HookAdapter { readonly name = "Codex CLI"; readonly paradigm: HookParadigm; readonly capabilities: PlatformCapabilities; parsePreToolUseInput(raw: unknown): PreToolUseEvent; parsePostToolUseInput(raw: unknown): PostToolUseEvent; parsePreCompactInput(raw: unknown): PreCompactEvent; parseSessionStartInput(raw: unknown): SessionStartEvent; formatPreToolUseResponse(response: PreToolUseResponse): unknown; formatPostToolUseResponse(response: PostToolUseResponse): unknown; formatPreCompactResponse(response: PreCompactResponse): unknown; formatSessionStartResponse(response: SessionStartResponse): unknown; getSettingsPath(): string; getSessionDir(): string; getSessionDBPath(projectDir: string): string; getSessionEventsPath(projectDir: string): string; generateHookConfig(pluginRoot: string): HookRegistration; readSettings(): Record | null; writeSettings(_settings: Record): void; validateHooks(_pluginRoot: string): DiagnosticResult[]; checkPluginRegistration(): DiagnosticResult; getInstalledVersion(): string; configureAllHooks(_pluginRoot: string): string[]; backupSettings(): string | null; setHookPermissions(_pluginRoot: string): string[]; updatePluginRegistry(_pluginRoot: string, _version: string): void; getRoutingInstructions(): string; /** * Extract session ID from Codex CLI hook input. * Priority: session_id field > fallback to ppid. */ private extractSessionId; }