This repository has been archived on 2026-03-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
openclaw-extensions/wecom/node_modules/@mariozechner/pi-tui/dist/terminal.d.ts
T

71 lines
2.5 KiB
TypeScript

/**
* Minimal terminal interface for TUI
*/
export interface Terminal {
start(onInput: (data: string) => void, onResize: () => void): void;
stop(): 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<void>;
write(data: string): void;
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;
}
/**
* Real terminal using process.stdin/stdout
*/
export declare class ProcessTerminal implements Terminal {
private wasRaw;
private inputHandler?;
private resizeHandler?;
private _kittyProtocolActive;
private stdinBuffer?;
private stdinDataHandler?;
private writeLogPath;
get kittyProtocolActive(): boolean;
start(onInput: (data: string) => void, onResize: () => void): void;
/**
* Set up StdinBuffer to split batched input into individual sequences.
* This ensures components receive single events, making matchesKey/isKeyRelease work correctly.
*
* Also watches for Kitty protocol response and enables it when detected.
* This is done here (after stdinBuffer parsing) rather than on raw stdin
* to handle the case where the response arrives split across multiple events.
*/
private setupStdinBuffer;
/**
* Query terminal for Kitty keyboard protocol support and enable if available.
*
* Sends CSI ? u to query current flags. If terminal responds with CSI ? <flags> u,
* it supports the protocol and we enable it with CSI > 1 u.
*
* The response is detected in setupStdinBuffer's data handler, which properly
* handles the case where the response arrives split across multiple stdin events.
*/
private queryAndEnableKittyProtocol;
drainInput(maxMs?: number, idleMs?: number): Promise<void>;
stop(): void;
write(data: string): void;
get columns(): number;
get rows(): number;
moveBy(lines: number): void;
hideCursor(): void;
showCursor(): void;
clearLine(): void;
clearFromCursor(): void;
clearScreen(): void;
setTitle(title: string): void;
}
//# sourceMappingURL=terminal.d.ts.map