/** * adapters/codex/hooks — Codex CLI hook definitions. * * Codex CLI hooks run behind the current `hooks` feature flag surface. * Prefer `[features].hooks`; the legacy `[features].codex_hooks` alias is still * accepted in current Codex builds. * 6 hook events: PreToolUse, PostToolUse, PreCompact, SessionStart, * UserPromptSubmit, Stop. PreCompact is runtime-gated on Codex builds that emit * the event. * Same JSON stdin/stdout wire protocol as Claude Code. * * Config: $CODEX_HOME/hooks.json or ~/.codex/hooks.json. * MCP: full support via [mcp_servers] in $CODEX_HOME/config.toml. * * Known limitations: * - PreToolUse: deny works on all builds. permissionDecision:"allow" + * updatedInput (command rewrite) and additionalContext are honored on * codex-cli >= 0.141.0 (#845), detected at runtime by * hooks/core/codex-caps.mjs; older builds fail closed (redirect → deny). * `ask` remains unsupported. * - PostToolUse: updatedMCPToolOutput parsed but logged as unsupported * - PostToolUse does not fire on failing Bash calls (upstream bug) */ /** Codex CLI hook types — mirrors Claude Code's continuity events. */ export declare const HOOK_TYPES: { readonly PRE_TOOL_USE: "PreToolUse"; readonly POST_TOOL_USE: "PostToolUse"; readonly PRE_COMPACT: "PreCompact"; readonly SESSION_START: "SessionStart"; readonly USER_PROMPT_SUBMIT: "UserPromptSubmit"; readonly STOP: "Stop"; }; /** * External MCP catch-all matcher for Codex CLI (#529, #547 hotfix). * * Codex CLI's hook `tool_name` payload uses `mcp____` for any * MCP-namespaced tool. Originally this constant used a negative lookahead * `mcp__(?!.*context-mode)` to exclude context-mode's own MCP tools at the * matcher layer. v1.0.124 shipped that pattern and Codex (Rust `regex` crate) * rejected the matcher at boot with "look-around not supported", breaking * every Codex user (#547). * * Fix: drop the lookaround. The matcher is now a charset-clean literal * (`[A-Za-z0-9_|]` only), satisfying Codex's `is_exact_matcher` * (refs/platforms/codex/codex-rs/hooks/src/events/common.rs:152) which * short-circuits the regex engine entirely. context-mode's own MCP tools are * already filtered in the hook BODY by `isExternalMcpTool()` in * hooks/core/routing.mjs — semantics preserved. */ export declare const EXTERNAL_MCP_MATCHER_PATTERN = "mcp__"; /** * Path to the routing instructions file for Codex CLI. * Used as fallback routing awareness alongside hook-based enforcement. */ export declare const ROUTING_INSTRUCTIONS_PATH = "configs/codex/AGENTS.md";