/** * Lightweight, AI-free "stuck" detector — fires a callback when a written input * has not produced a completed turn within a timeout window. * * Scope (intentionally narrow): this PR targets the specific Codex PreToolUse * hook-review blocking state, where the CLI renders a review screen and waits * for t/Enter/Esc (level 1) or t/Esc (level 2). Generic [Y/n]/permission/ * Press-to-continue prompts are NOT handled here — they require semantic parsing * that cannot be safely inferred from a regex, and belong in a follow-up PR. * * The detector does NOT itself decide the CLI is stuck. It only tracks elapsed * time since the last write and asks the owner (worker) to confirm via the * `isActuallyStuck` callback — the worker knows whether inflight inputs exist, * whether a TUI prompt card is already posted, and whether the PTY has been * quiet. This avoids false positives from legitimately long turns. */ export declare function matchHookReviewScreen(snapshot: string): 'hook review level 1' | 'hook review level 2' | undefined; /** A Hook-review menu owns Enter/arrow keys instead of the normal Codex * composer. Queue BotMux-originated input until the operator resolves it: * otherwise a message submit can accidentally select "Trust all" or be lost * before it reaches the model. Kept pure so the worker wiring is testable. */ export declare function shouldHoldInputForHookReview(snapshot: string): boolean; export interface StuckDetectorCallbacks { /** Called when the timeout elapses. Return true to fire the warning; false * to silently re-arm (e.g. the CLI just finished a long turn). */ isActuallyStuck: () => boolean; /** Called once per armed window when isActuallyStuck returns true. * `matchedLabel` is set when the snapshot matches a known hook-review * pattern; undefined means the turn is stalled but the cause is unknown. */ onStuck: (elapsedMs: number, matchedLabel?: string) => void; /** Optional: return the current terminal snapshot for pattern matching. */ getSnapshot?: () => string; } export declare class StuckDetector { private readonly timeoutMs; private readonly callbacks; private timer; private armedAt; private firedThisWindow; private disposed; constructor(timeoutMs: number, callbacks: StuckDetectorCallbacks); /** Arm the detector — call right after writing input to the PTY. */ arm(): void; /** Disarm — call when the turn completes (prompt ready) or the CLI exits. */ disarm(): void; dispose(): void; private tick; private matchSnapshot; } //# sourceMappingURL=stuck-detector.d.ts.map