/** * Cleaning for text that did not come from chassis: tool arguments and results, widget values, session * names, directory names. A terminal acts on escape sequences in anything it is sent, so text that * can be influenced from outside (a file's contents, a branch name, a model's tool call) must not * reach it as it is: an OSC 52 sequence writes to the clipboard, OSC 0 and OSC 2 set the window * title, OSC 8 draws a link, a cursor-move CSI overdraws other rows, and bidi overrides reorder * what the reader sees. * * No imports, so every module (api.ts included) can use it without an import cycle. palette.ts * re-exports it. */ /** * `text` without escape sequences (CSI, OSC, DCS, APC and the rest) and without bidi controls. * Other characters, newlines and tabs included, stay. A stray ESC left where removing one sequence * joined the pieces of another is for the caller's control-character pass to remove. */ export declare function stripEscapes(text: string): string; /** * One line of plain text: escape sequences and bidi controls removed, every control character * (newline and tab included) turned into a space, runs of spaces collapsed, ends trimmed. */ export declare function sanitize(text: unknown): string; /** Like `sanitize`, but SGR colour and style sequences are kept (and followed by a reset). */ export declare function sanitizeKeepColor(text: unknown): string; /** * One line like `sanitize`, but spacing is left alone: for text where the spaces carry meaning * (aligned columns, indentation, a directory name). SGR sequences are kept with `keepColor`. */ export declare function scrubText(text: unknown, keepColor?: boolean): string; /** * Several lines of plain text: escape sequences, bidi controls and control characters removed, * carriage returns and line separators turned into line breaks. Tabs and line breaks stay, so * callers split on "\n" and decide what to do with a tab. */ export declare function sanitizeLines(text: unknown): string; /** * The URL to put in a link, or undefined if it is not safe to. Only a plain https URL passes: a host, * no user name or password, no whitespace, control character, bidi control or backslash anywhere in * it, at most 2048 characters. It comes back in the form `URL` writes it (scheme and host in lower * case), so what is checked is what is sent. */ export declare function safeLinkUrl(url: unknown): string | undefined;