import type { PermissionOption } from "../../types"; import type { CodexGateType } from "./codexGateAnswers"; /** * Codex's rendered-screen regexes and predicates: readiness, busy/boot state, * blocking prompts (trust gate, hooks review, usage limits) and the cards built * from them. Pure functions of the rendered lines — no PTY, no session state. * * Lives here rather than in codex-pty-runner.ts for symmetry with the Claude * side, whose equivalents are already in this directory (detectPermissionGate, * detectQuestionFromScreen, detectShellPrompt, parseStatusLine). */ export declare const CODEX_PROMPT_READY_TEXT = "Ready"; export declare const CODEX_BUSY_STATUS_RE: RegExp; export declare const CODEX_WORKING_STATUS_RE: RegExp; export declare const CODEX_MCP_BOOT_RE: RegExp; export declare const CODEX_TRUST_GATE_REGEX: RegExp; export declare const CODEX_HOOKS_GATE_REGEX: RegExp; export declare const CODEX_ACTIVE_WRITER_RE: RegExp; /** `failureCode` set on a session killed by the writer-lock detection above. */ export declare const CODEX_ACTIVE_WRITER_CODE = "codex_active_writer"; export declare const CODEX_USAGE_LIMIT_RE: RegExp; export declare const CODEX_USAGE_RESET_TIP_RE: RegExp; export declare const CODEX_RATE_LIMIT_MENU_RE: RegExp; export interface CodexBlockingPrompt { prompt: string; detail?: string; options: PermissionOption[]; /** Tip-only (not a hard limit / rate-limit menu). Surfaced after a failed turn. */ soft?: boolean; } /** * Detect Codex's rendered command-approval card. This deliberately does not * reuse parseCodexNumberedOptions: the visible 1/2 rows do not answer this * dialog, while `y` and Escape do. */ export declare function detectCodexCommandApproval(lines: string[]): CodexBlockingPrompt | null; /** * Claim Codex's own numbered picker — the sign-in screen shown before login * ("1. Sign in with ChatGPT / 2. Sign in with Device Code / 3. Provide your own * API key"), and any menu of that shape (#868). Codex's other dialogs have * their own detectors and are checked before this one. * * Rows may be separated by one indented description line each, which is what * defeats the Claude-side readers: scrapePermissionGate stops at the first * non-option line, and detectShellPrompt's bare-confirmation branch turns the * trailing "Press enter to continue" into a single Continue option whose Enter * silently picks the highlighted row — signing the user in on one tap. * * Answer keys are the bare digit: verified live on codex-cli 0.154.0, a digit * selects AND confirms, the same as Codex's trust and hooks gates. */ export declare function detectCodexPicker(lines: string[]): CodexBlockingPrompt | null; /** Parse Codex's numbered TUI menus (`1. …`, `› 2. …`). */ export declare function parseCodexNumberedOptions(lines: string[]): PermissionOption[]; /** * Usage-limit errors, the soft "reset available" tip, and the "Approaching * rate limits" model-picker menu. Surfaced over the permission transport so * mobile shows a card instead of spinning forever in `running`. */ export declare function detectCodexBlockingPrompt(lines: string[]): CodexBlockingPrompt | null; /** Last non-blank rendered line — Codex paints the status bar there. */ export declare function codexStatusBarLine(lines: string[]): string; /** * The status bar with its path-shaped `·` fields (containing `/` or `\`, or * starting with `~`) dropped, for every status-word test. The bar carries * the cwd at no fixed position — the field count varies — so filtering by shape * is the only position-independent way to keep a project path out of the match. */ export declare function codexStatusBarWords(lines: string[]): string; /** * True while the screen shows something that precedes a turn rather than being * one: a blocking gate dialog, or MCP boot progress. Both keep the composer * shut, but neither is the agent doing work — the status-bar half of * codexScreenBlocksComposer cannot tell them apart on its own, and reading * only that half is how the agent phase reported "working" during boot. */ export declare function codexScreenPreTurn(lines: string[]): boolean; /** * True while Codex must not receive composer keystrokes: gate dialogs, MCP * boot progress, or a Starting/Working status bar. Shared by boot detection, * the flat fallback, and mid-session idle re-detect. */ export declare function codexScreenBlocksComposer(lines: string[]): boolean; /** Authoritative Ready: status-bar word present and screen not otherwise busy. */ export declare function codexScreenShowsReady(lines: string[]): boolean; /** * Soft idle for a truncated Ready bar: compose `›` / `>` is up and nothing * busy is on screen. Not used as a sole boot-ready signal on quiet — `›` * appears during Starting — but the flat fallback requires it (or Ready) * before settling so a model-only status line is not mistaken for usable. */ export declare function codexScreenLooksIdle(lines: string[]): boolean; export declare function gateCard(gate: CodexGateType, lines: string[]): { prompt: string; options: PermissionOption[]; }; //# sourceMappingURL=codexScreen.d.ts.map