/** * Canonical terminal sequences for xterm.js / VT100-style hosts (Pear stdio, SSH PTY). * Keep {@link XTERM_CLEAR_SCROLLBACK_AND_VIEWPORT} in sync with * `packages/bare-os-coreutils/src/clear.js` (kernel /bin scripts cannot import this module). */ /** SGR reset */ export const SGR_RESET = '\x1b[0m' /** Cursor to home (1,1) */ export const CURSOR_HOME = '\x1b[H' /** Erase saved lines (scrollback) then full display — xterm.js honors CSI 3 J */ export const CSI_ERASE_SCROLLBACK = '\x1b[3J' /** Erase entire display (viewport) */ export const CSI_ERASE_DISPLAY = '\x1b[2J' /** * Clear scrollback and visible screen, home cursor, reset attributes. * Order: home first so erase targets a stable origin; 3J then 2J matches common xterm expectations. */ export const XTERM_CLEAR_SCROLLBACK_AND_VIEWPORT = CURSOR_HOME + CSI_ERASE_SCROLLBACK + CSI_ERASE_DISPLAY + SGR_RESET