import { type WriteStream } from "../types/io.js"; import { type CellBuffer } from "./cell-buffer.js"; /** * Run-diff renderer for interactive terminal output. * * Compared with line-diff mode, this renderer diffs cell buffers and emits * minimal cursor movement + text writes for changed runs. It entirely skips * terminal writes when consecutive frames are identical. */ export interface CellLogUpdateRunOptions { /** Enables diff updates. Set `false` to force full-frame redraws. */ incremental?: boolean; /** Keeps the terminal cursor visible during updates. */ showCursor?: boolean; /** Gap merge threshold used by `mergeStrategy: "threshold"`. */ mergeThreshold?: number; /** Segment merge policy. `cost` chooses cheapest bytes, `threshold` uses gap. */ mergeStrategy?: "cost" | "threshold"; /** Fallback to full-row writes when too many segments are present. */ maxSegmentsBeforeFullRow?: number; /** Penalty when overwriting unchanged gaps in `cost` mode. */ overwriteGapPenaltyBytes?: number; } export interface RenderOptions { /** Forces full redraw for the current frame. */ forceFull?: boolean; } export type CellLogUpdateRender = ((prevBuffer: CellBuffer, nextBuffer: CellBuffer, options?: RenderOptions) => void) & { /** Erases currently rendered interactive frame. */ clear: () => void; /** Resets internal frame state without writing to stream. */ reset: () => void; /** Synchronizes internal state after an external full redraw. */ sync: (buffer: CellBuffer) => void; /** Finalizes renderer and restores cursor visibility. */ done: () => void; }; export declare const cellLogUpdateRun: { create: (stream: WriteStream, options?: CellLogUpdateRunOptions) => CellLogUpdateRender; };