export interface PermissionOption { /** The real leading number shown on screen (NOT a 1-based array index). */ index: number; label: string; /** * Literal keystroke bytes that answer this option, when the number alone * isn't the answer (e.g. a y/N shell prompt answers "y\r"/"n\r", not "1\r"). * Additive: OSC-777 gates omit it and the client answers via `index`; the * unstructured shell-prompt path (detectShellPrompt) populates it. */ answerKeys?: string; } export interface PermissionGate { /** Prompt text above the options, e.g. "Claude needs your permission to use Bash". */ prompt?: string; /** * The descriptive block above the prompt — the tool title, the command, and any * action description Claude paints inside the gate box (newline-joined). Lets the * client show WHAT is being permitted, not just "Do you want to proceed?". */ detail?: string; options: PermissionOption[]; /** Index value (the on-screen number) of the `❯`-highlighted option, if any. */ cursor?: number; } /** * Stable content key for de-duping repeated broadcasts of the same gate across * PTY repaint ticks. Includes cursor — moving the on-screen selection is a * real update the client needs, so it must produce a new key. */ export declare function permissionContentKey(gate: { prompt?: string; detail?: string; options: PermissionOption[]; cursor?: number; }): string; /** * The gate's IDENTITY key: the content key with the cursor stripped. * * Cursor belongs in the broadcast dedupe key (moving the highlight is a real * update) but never in identity — the same gate with a different highlight is * the same gate. `closedGateKey` in pty-manager.ts already draws exactly this * line; this names it so the answer route and the client agree on one spelling. * * Content-derived, not instance-derived: it distinguishes gates with different * prompt/detail/options, NOT two consecutive gates whose content is identical. */ export declare function permissionGateKey(gate: { prompt?: string; detail?: string; options: PermissionOption[]; }): string; /** True if a raw PTY chunk contains the Claude Code OSC 777 permission notify. */ export declare function hasPermissionOsc(rawData: string): boolean; /** * True if a raw PTY chunk contains the OSC 777 "waiting for your input" notify — * Claude finished its turn. Not a gate: it is the positive signal that any gate * we were tracking is over, which is what lets a stuck card close without * waiting for a prompt marker that will never come. */ export declare function hasWaitingForInputOsc(rawData: string): boolean; /** * Scrape the permission gate's options + prompt from rendered screen lines. * Scrapes the LAST option block on screen, scanning bottom-up: a stale * numbered list sitting in scrollback above the real gate (e.g. Claude's own * prose) matches the same option shape and must not be vacuumed in with it. * Returns null when no numbered options are present (not a gate, or not painted * yet). Pure — no I/O. */ export declare function scrapePermissionGate(lines: string[]): PermissionGate | null; /** * Claim a permission gate from rendered screen lines without an OSC 777. * Returns the scraped gate when the full gate signature is present: * ≥2 numbered options, the gate footer, no Ask-menu footer, and at least one * Yes/No-family option label. Pure — no I/O. */ export declare function detectGateScreen(lines: string[]): PermissionGate | null; /** * Claim an unboxed numbered picker from rendered screen lines — one that prints * no gate footer, so detectGateScreen never sees it (Claude Code's first-run * theme picker, which follows its options with a preview and a "Syntax theme" * line; #863). The ❯ selection cursor is what separates a live picker from a * numbered list in prose (#821). It is not enough on its own: ❯ is also the * composer's prompt glyph, so typed or pasted "1. …" text renders as a * cursor-marked numbered block between the composer's rules, and an answered * menu stays painted above a live composer (#724). Both leave a composer rule * below the cursor row; a live picker does not. Boxed blocks stay * detectGateScreen's. Pure — no I/O. */ export declare function detectPickerScreen(lines: string[]): PermissionGate | null; //# sourceMappingURL=detectPermissionGate.d.ts.map