/** Begin Synchronized Update (DEC private mode 2026 set). */ export declare const BSU = "\u001B[?2026h"; /** End Synchronized Update (DEC private mode 2026 reset). */ export declare const ESU = "\u001B[?2026l"; /** * Wrap a frame string in synchronized-update markers so the terminal presents it atomically. * Pure + side-effect free so it is unit-testable. When `sync` is false it returns the chunk * unchanged (escape hatch via CORTEX_TUI_NO_SYNC). */ export declare function wrapFrame(chunk: string, sync: boolean): string; export interface RenderStats { /** Number of write() calls intercepted. */ writes: number; /** Total bytes (string length) written, excluding the BSU/ESU markers we add. */ bytes: number; /** How many of those writes carried a full-screen clear (the flicker-prone path). */ clears: number; /** epoch ms of the first and last intercepted write (for a writes/sec estimate). */ firstAt: number; lastAt: number; } export declare function newRenderStats(): RenderStats; /** Fold one write into the running stats (exported for testing). */ export declare function recordWrite(stats: RenderStats, chunk: string, now: number): void; /** Derived writes-per-second over the observed window (0 when fewer than 2 writes). */ export declare function writesPerSecond(stats: RenderStats): number; export interface RenderStdoutOptions { /** Wrap frames in BSU/ESU (default true; disabled by CORTEX_TUI_NO_SYNC). */ sync?: boolean; /** Collect render stats; the returned object is exposed on `__renderStats`. */ stats?: RenderStats | null; /** Clock injection for tests. */ now?: () => number; } /** A stdout proxy that also surfaces the stats object it accumulates into. */ export type RenderStdout = NodeJS.WriteStream & { __renderStats?: RenderStats | null; }; /** * Build a proxy over `base` (typically process.stdout) that intercepts only `write` — wrapping * string frames in synchronized-update markers and folding them into `stats` — while delegating * every other property (columns/rows getters, on/off, isTTY, …) to the real stream, with `this` * bound to the real stream so the getters report the real terminal geometry. Ink, log-update, and * App's useStdout all share this one object, so they stay consistent. */ export declare function makeRenderStdout(base: NodeJS.WriteStream, options?: RenderStdoutOptions): RenderStdout;