/** * Capability-probe reply shapes that only this layer solicits (OSC 11 background * color, the Mode 2031 appearance DSR, and the Kitty keyboard-flags report). * These are terminal-to-host replies and are NEVER legitimate user input, so a * reply that arrives outside its pending-query window is dropped defensively. * * DA1 is deliberately absent: `Tui` issues its own DA1 request for the sixel * probe and consumes that reply downstream. */ export declare const PROBE_REPLY_PATTERNS: ReadonlyArray<{ name: string; issuedProbe: string; pattern: RegExp; }>; /** True when `sequence` is one of the probe replies above. */ export declare function isUnsolicitedProbeReply(sequence: string): boolean; /** * Whether Vibrato may reprogram the keyboard with enhanced input protocols * (the Kitty keyboard protocol and the xterm modifyOtherKeys fallback). * * Enabled by default. Set `VIB_TUI_KEYBOARD_PROTOCOL=0` to leave the keyboard in * its default mode. Some terminals — notably Android Termius — break IME * composition (e.g. Korean/Hangul syllable composition) while these enhanced * modes are active, committing every intermediate composing jamo/syllable * instead of only the final character. Disabling the protocol restores normal * IME behavior, matching how other TUIs that leave the keyboard untouched render * Korean correctly. */ export declare function keyboardEnhancementEnabled(): boolean; /** * Emergency terminal restore - call this from signal/crash handlers * Resets terminal state without requiring access to the ProcessTerminal instance */ export declare function emergencyTerminalRestore(): void; /** Terminal-reported appearance (dark/light mode). */ export type TerminalAppearance = "dark" | "light"; export interface Terminal { start(onInput: (data: string) => void, onResize: () => void): void; stop(): void; setMouseEnabled?(enabled: boolean): void; /** * Drain stdin before exiting to prevent Kitty key release events from * leaking to the parent shell over slow SSH connections. * @param maxMs - Maximum time to drain (default: 1000ms) * @param idleMs - Exit early if no input arrives within this time (default: 50ms) */ drainInput(maxMs?: number, idleMs?: number): Promise; /** * Wait for pending stdin to go quiet without changing terminal protocols or * the active input handler. Capability probes use this non-destructive drain; * shutdown paths must continue using drainInput(). * @param maxMs - Maximum time to wait (default: 1000ms) * @param idleMs - Exit early if no input arrives within this time (default: 50ms) */ drainPendingInput?(maxMs?: number, idleMs?: number): Promise; write(data: string): void; get available(): boolean; readonly isProcessTerminal?: boolean; get columns(): number; get rows(): number; get kittyProtocolActive(): boolean; moveBy(lines: number): void; hideCursor(): void; showCursor(): void; clearLine(): void; clearFromCursor(): void; clearScreen(): void; setTitle(title: string): void; setProgress(active: boolean): void; /** * Register a callback for terminal appearance (dark/light) changes. * Detection uses OSC 11 background color query with Mode 2031 as a change trigger. * Fires when the detected appearance changes, including the initial detection. */ onAppearanceChange(callback: (appearance: TerminalAppearance) => void): void; /** The last detected terminal appearance, or undefined if not yet known. */ get appearance(): TerminalAppearance | undefined; } interface TerminalSizeStream { columns?: number; rows?: number; getWindowSize?: () => [number, number] | number[]; } export declare function resolveTerminalColumns(stream?: TerminalSizeStream, envColumns?: string | undefined): number; export declare function resolveTerminalRows(stream?: TerminalSizeStream, envRows?: string | undefined): number; export declare function __stdoutErrorSubscriberCountForTests(): number; export declare function __stdoutErrorDispatcherInstalledForTests(): boolean; export declare function __stdinErrorSubscriberCountForTests(): number; export declare function __stdinErrorDispatcherInstalledForTests(): boolean; /** * Real terminal using process.stdin/stdout */ export declare class ProcessTerminal implements Terminal { #private; get isProcessTerminal(): boolean; get kittyProtocolActive(): boolean; get appearance(): TerminalAppearance | undefined; onAppearanceChange(callback: (appearance: TerminalAppearance) => void): void; setMouseEnabled(enabled: boolean): void; start(onInput: (data: string) => void, onResize: () => void): void; drainPendingInput(maxMs?: number, idleMs?: number): Promise; drainInput(maxMs?: number, idleMs?: number): Promise; stop(): void; write(data: string): void; get available(): boolean; get columns(): number; get rows(): number; moveBy(lines: number): void; hideCursor(): void; showCursor(): void; clearLine(): void; clearFromCursor(): void; clearScreen(): void; setTitle(title: string): void; setProgress(active: boolean): void; } export {};