/**
 * buildDetectStatusFromTui
 *
 * Turns a manifest's declarative TUI block into a runtime
 * `(input: CliStatusInput) => CliStatus | null` function.
 *
 * Inputs handled (all optional except spinner):
 *   - tui/spinner@1          → contributes `generating`
 *   - tui/settled-prompt@1   → contributes `idle`
 *   - tui/modal@1            → contributes `waiting_approval`
 *
 * Dispatch order (sprint-2026-06 contract):
 *   1. Active generation cues win over idle prompt — checked first.
 *      Reason: codex/claude keep model footer visible during `Working` and
 *      `hasReadyPrompt` falsely fired idle. Audit §4.2 introduces
 *      `tui/cue-ordering` as the named primitive for this rule.
 *   2. Modal cue (if present) is checked next — `waiting_approval`.
 *   3. Settled-prompt cue — `idle`.
 *   4. Default: `null` (no change).
 */
import type { CliStatusInput, CliDetectStatusFn } from '../../types/cli/index.js';
import { type VisibleRegionSpec } from './visible-region.js';
interface RegexLikeSpec {
    regex: string;
    flags?: string;
}
interface SpinnerPatternSpec extends RegexLikeSpec {
    description?: string;
}
interface SpinnerSpec {
    $schema: 'adhdev:tui/spinner@1';
    patterns: SpinnerPatternSpec[];
    scope?: 'live-frame-tail' | 'whole-screen' | 'recent-buffer';
    scopeWindowLines?: number;
}
interface SettledPromptFooterSpec {
    pattern: string;
    kind?: 'substring' | 'regex';
    flags?: string;
}
interface SettledPromptSpec {
    $schema: 'adhdev:tui/settled-prompt@1';
    regex: string;
    flags?: string;
    withFooter?: SettledPromptFooterSpec[];
    scope?: 'last-n-lines' | 'whole-screen';
    scopeWindowLines?: number;
}
interface ModalSpec {
    $schema: 'adhdev:tui/modal@1';
    questionPattern: string;
    questionFlags?: string;
    questionVariants?: Array<{
        regex: string;
        flags?: string;
        label?: string;
    }>;
    buttonPattern: string;
    buttonFlags?: string;
    buttonLabelGroup?: number;
}
export type DispatchGroup = 'spinner' | 'modal' | 'settled-prompt' | 'cue-ordering' | 'error-detection' | 'approval-stitching';
export interface DispatchOrderSpec {
    $schema: 'adhdev:tui/dispatch-order@1';
    order: DispatchGroup[];
    onNoMatch?: 'idle' | 'unknown' | 'preserve-last';
}
export interface DetectStatusTuiSpec {
    spinner?: SpinnerSpec;
    settledPrompt?: SettledPromptSpec;
    modal?: ModalSpec;
    dispatchOrder?: DispatchOrderSpec;
    visibleRegion?: VisibleRegionSpec;
}
declare function scopeText(input: CliStatusInput, scope: SpinnerSpec['scope'] | SettledPromptSpec['scope'], windowLines: number | undefined): string;
declare function spinnerMatches(spec: SpinnerSpec, input: CliStatusInput): boolean;
declare function settledPromptMatches(spec: SettledPromptSpec, input: CliStatusInput): boolean;
declare function modalMatches(spec: ModalSpec, input: CliStatusInput): boolean;
export declare function buildDetectStatusFromTui(spec: DetectStatusTuiSpec): CliDetectStatusFn;
export declare const __internal: {
    scopeText: typeof scopeText;
    spinnerMatches: typeof spinnerMatches;
    settledPromptMatches: typeof settledPromptMatches;
    modalMatches: typeof modalMatches;
};
export {};
