/** * Chord-aware keybinding matcher. * * A chord is a sequence of single key presses separated by ` ` in the KeyId * (e.g. `"ctrl+x ctrl+s"` means: press Ctrl+X, then Ctrl+S). The plain * single-key matcher in `keybindings.ts` does not understand chords; this * module adds a stateful matcher that the consumer drives one input event at * a time. * * Reference: claude-code keybindings/parser.ts:1 + match.ts state machine. * * Usage: * ``` * const session = new ChordSession(); * for (const data of inputStream) { * const result = session.feed(data, keys); * if (result.match) handle(result.match); * } * ``` */ import type { Keybinding, KeybindingsManager } from "./keybindings.js"; export type ChordSegment = string; /** Split a chord notation into its single-press segments. */ export declare function parseChord(keyId: string): ChordSegment[]; export interface ChordResult { /** True when the just-fed input completes one of the supplied chords. */ match?: { keybinding: Keybinding; key: string; }; /** True when at least one chord is still mid-sequence (consumer should suppress default handling). */ partial: boolean; } /** * Stateful chord matcher. One instance per input focus context. Call * `feed(data, keybindings)` once per input event; the session decides * whether the event advances any in-flight chord, completes one, or resets. */ export declare class ChordSession { private pending; private timeoutMs; private lastFedAt; constructor(opts?: { timeoutMs?: number; }); /** Drop any in-flight chord state. */ reset(): void; /** True while at least one chord is mid-sequence. */ hasPartial(): boolean; /** * Advance the matcher with one terminal-input event. Returns * `{match, partial}`. `match` is set only when the input completes a * chord; partial=true while the consumer should hold its default action. */ feed(data: string, manager: KeybindingsManager, candidates: Iterable): ChordResult; } //# sourceMappingURL=chord.d.ts.map