/** * Terminal identity and background detection. * * Covers cavekit-terminal-blend R1 (background luminance detection via OSC 11, * COLORFGBG, and CAVE_TERM_BG override) and R2 (terminal program identity). */ import type { ProcessTerminal } from "./terminal.js"; export type TerminalProgram = "ghostty" | "iterm2" | "apple-terminal" | "kitty" | "wezterm" | "alacritty" | "vte" | "tmux" | "screen" | "linux-console" | "cmux" | "windows-terminal" | "vscode" | "unknown"; export type Multiplexer = "tmux" | "screen" | "none"; export type BackgroundClassification = "dark" | "light"; export interface TerminalIdentity { program: TerminalProgram; /** Outer host terminal when running under a multiplexer. */ hostProgram?: TerminalProgram; version?: string; multiplexer: Multiplexer; isSsh: boolean; raw: Record; } export interface TerminalBackground { r: number; g: number; b: number; /** Relative luminance per WCAG 2.x (0-1). */ luminance: number; classification: BackgroundClassification; source: "osc11" | "colorfgbg" | "override"; } export interface ProbeResult { identity: TerminalIdentity; background: TerminalBackground | null; /** Final classification — always a concrete value (falls back to "dark"). */ classification: BackgroundClassification; } export declare function detectTerminalIdentity(env?: NodeJS.ProcessEnv): TerminalIdentity; /** WCAG 2.x relative luminance from sRGB 0-255 components. */ export declare function relativeLuminance(r: number, g: number, b: number): number; /** * Query the terminal's background color. Tries CAVE_TERM_BG override, then OSC 11, * then COLORFGBG. Returns null when no signal is available. Total wall time capped * by timeoutMs (default 200ms for the OSC 11 part; env lookups are instant). */ export declare function queryTerminalBackground(terminal: ProcessTerminal | null, timeoutMs?: number, env?: NodeJS.ProcessEnv): Promise; /** * Standalone OSC 11 query that works before the TUI has started. * * Briefly installs its own stdin listener in raw mode, writes the OSC 11 * query, waits up to `timeoutMs` for the response, then restores stdin. * Returns null on timeout / non-TTY / parse failure. * * Use this during startup when we need the background classification before * theme init but haven't yet constructed a ProcessTerminal. */ export declare function queryOsc11Standalone(timeoutMs?: number): Promise; /** * One-call probe: identity + background + final classification (with "dark" fallback). * The classification field is always concrete per R1. */ export declare function probeTerminal(options: { terminal?: ProcessTerminal | null; timeoutMs?: number; env?: NodeJS.ProcessEnv; /** Whether to run the standalone OSC 11 query (needs raw stdin). Default: true when no terminal is supplied. */ useStandaloneOsc?: boolean; }): Promise; //# sourceMappingURL=terminal-detect.d.ts.map