cyberine
UsageRun recipes

TUI stdout shim — synchronized output, and how to smoke it

Ink repaints the whole frame every tick. makeSyncStdout() (src/tui/syncOutput.ts) proxies the render stream and wraps each write in the DEC 2026 begin/end synchronized-update markers, so a terminal that understands them composites one atomic frame instead of flickering. Terminals that do not understand the sequence ignore it, so it is always safe to leave on.

# Byte-level contract for every write() overload — no TTY needed
npm run selftest:sync-output

Known limitations and deferred work. The shim re-implements Node's own write() argument normalisation by hand — (chunk), (chunk, cb), (chunk, encoding), (chunk, encoding, cb) — so a future Node overload would need mirroring here. Only string and Buffer chunks get wrapped; any other chunk type (a bare Uint8Array, say) passes through unwrapped rather than being converted. Whether a given terminal actually honours DEC 2026 is not detected or reported; the smoke proves the bytes are emitted, not that they had an effect.