/** * Terminal key matching mirrored from host `@earendil-works/pi-tui` (0.80.10). * * The host passes RAW terminal bytes to `Component.handleInput(data)` — never * pre-normalised names like "up" / "space" / "enter". This module parses legacy * ANSI sequences, Kitty CSI-u, and xterm modifyOtherKeys so dashboard hotkeys * work. Do not import `@earendil-works/pi-tui` (AGENTS.md Mistake #4). * * Also accepts canonical keyIds as `data` (e.g. data === "enter") for tests and * defensive compatibility with any host that already normalised input. */ /** * Set the global Kitty keyboard protocol state. * Called by ProcessTerminal after detecting protocol support. */ export declare function setKittyProtocolActive(active: boolean): void; /** * Query whether Kitty keyboard protocol is currently active. */ export declare function isKittyProtocolActive(): boolean; /** * Helper object for creating typed key identifiers with autocomplete. * * Usage: * - Key.escape, Key.enter, Key.tab, etc. for special keys * - Key.backtick, Key.comma, Key.period, etc. for symbol keys * - Key.ctrl("c"), Key.alt("x"), Key.super("k") for single modifiers * - Key.ctrlShift("p"), Key.ctrlAlt("x"), Key.ctrlSuper("k") for combined modifiers */ export declare const Key: { escape: string; esc: string; enter: string; return: string; tab: string; space: string; backspace: string; delete: string; insert: string; clear: string; home: string; end: string; pageUp: string; pageDown: string; up: string; down: string; left: string; right: string; f1: string; f2: string; f3: string; f4: string; f5: string; f6: string; f7: string; f8: string; f9: string; f10: string; f11: string; f12: string; backtick: string; hyphen: string; equals: string; leftbracket: string; rightbracket: string; backslash: string; semicolon: string; quote: string; comma: string; period: string; slash: string; exclamation: string; at: string; hash: string; dollar: string; percent: string; caret: string; ampersand: string; asterisk: string; leftparen: string; rightparen: string; underscore: string; plus: string; pipe: string; tilde: string; leftbrace: string; rightbrace: string; colon: string; lessthan: string; greaterthan: string; question: string; ctrl: (key: string) => string; shift: (key: string) => string; alt: (key: string) => string; super: (key: string) => string; ctrlShift: (key: string) => string; shiftCtrl: (key: string) => string; ctrlAlt: (key: string) => string; altCtrl: (key: string) => string; shiftAlt: (key: string) => string; altShift: (key: string) => string; ctrlSuper: (key: string) => string; superCtrl: (key: string) => string; shiftSuper: (key: string) => string; superShift: (key: string) => string; altSuper: (key: string) => string; superAlt: (key: string) => string; ctrlShiftAlt: (key: string) => string; ctrlShiftSuper: (key: string) => string; }; /** * Check if the last parsed key event was a key release. * Only meaningful when Kitty keyboard protocol with flag 2 is active. */ export declare function isKeyRelease(data: string): boolean; /** * Check if the last parsed key event was a key repeat. * Only meaningful when Kitty keyboard protocol with flag 2 is active. */ export declare function isKeyRepeat(data: string): boolean; /** * Match input data against a key identifier string. * * Supported key identifiers: * - Single keys: "escape", "tab", "enter", "backspace", "delete", "home", "end", "space" * - Arrow keys: "up", "down", "left", "right" * - Ctrl combinations: "ctrl+c", "ctrl+z", etc. * - Shift combinations: "shift+tab", "shift+enter" * - Alt combinations: "alt+enter", "alt+backspace" * - Super combinations: "super+k", "super+enter" * - Combined modifiers: "shift+ctrl+p", "ctrl+alt+x", "ctrl+super+k" * * Use the Key helper for autocomplete: Key.ctrl("c"), Key.escape, Key.ctrlShift("p"), Key.super("k") * * @param data - Raw input data from terminal * @param keyId - Key identifier (e.g., "ctrl+c", "escape", Key.ctrl("c")) */ export declare function matchesKey(data: string, keyId: string): boolean; export declare function parseKey(data: string): string | undefined; /** * Decode a Kitty CSI-u sequence into a printable character, if applicable. * * When Kitty keyboard protocol flag 1 (disambiguate) is active, terminals send * CSI-u sequences for all keys, including plain printable characters. This * function extracts the printable character from such sequences. * * Only accepts plain or Shift-modified keys. Rejects Ctrl, Alt, and unsupported * modifier combinations (those are handled by keybinding matching instead). * Prefers the shifted keycode when Shift is held and a shifted key is reported. * * @param data - Raw input data from terminal * @returns The printable character, or undefined if not a printable CSI-u sequence */ export declare function decodeKittyPrintable(data: string): string | undefined; export declare function decodePrintableKey(data: string): string | undefined;