UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

49 lines (48 loc) 2.21 kB
/** * Alternate-screen mode for temporary full-screen terminal ownership. * * The dev TUI's transcript deliberately streams into native scrollback (see * `live-region.ts`), but a modal viewer wants the whole terminal without * fighting the transcript's repaint cycle. Entering the alternate buffer * gives the viewer a blank screen it fully owns; leaving restores the * transcript exactly where the user left it. * * Like {@link LiveRegion}, writes go through the terminal's original `write` * captured at construction so foreign-output capture never sees the paints. */ export interface AltScreenOutput { write(chunk: string): boolean; } export interface AltScreenEnterOptions { /** Interactive subprocesses need the terminal cursor; rendered views do not. */ cursor?: "hidden" | "visible"; /** Rendered views use mouse events; inherited subprocesses retain native selection. */ mouse?: boolean; } export declare class AltScreen { #private; constructor(output: AltScreenOutput); get active(): boolean; /** Switches to the alternate buffer with view-friendly defaults. */ enter(options?: AltScreenEnterOptions): void; /** * Paints a full-screen frame. Each row must already be styled and fit * within the terminal width (one row == one screen line); rows beyond the * terminal height are dropped. The screen is erased before the rows are * written — terminals only erase via explicit sequences, so a shrinking * frame would otherwise leave stale text behind. * * Rows are placed with absolute cursor positions rather than `\n`: a row * filling the last column leaves terminals in an autowrap-pending state * whose interaction with `\n` varies (immediate-wrap terminals insert a * phantom line). Absolute positioning is immune to all of it. */ paint(rows: readonly string[], height: number): void; /** * Writes an out-of-band sequence (e.g. an OSC 52 clipboard write) through * the same captured write the paints use, bypassing foreign-output capture. */ writeRaw(chunk: string): void; /** Restores the main screen, cursor, and mouse reporting. */ exit(): void; }