export type DetachReason = "local" | "takeover" | "exit" | "request" | "closed" | "error"; export interface AttachIO { stdin: NodeJS.ReadStream; stdout: NodeJS.WriteStream; } export declare const TERMINAL_RESET = "\u001B[4;0m\u001B[?2026l\u001B[?7h\u001B[?25h"; /** M14: a worker writes this before it repaints on attach (for hosts before M21); a host strips it. */ export declare const REPAINT_MARKER = "\u001B]7700;pi-roost-repaint\u0007"; /** Whether `chunk` leaves the alternate screen on (true), off (false) or as it was. */ export declare function altScreenAfter(chunk: string, was: boolean): boolean; export declare function isLocalDetach(chunk: Buffer): boolean; /** * M22: where the local detach key is in a chunk of input, if anywhere. Keys typed fast, * a terminal or multiplexer that batches input, or a lock key held on can put Ctrl+Z * among other bytes or in another encoding; sent on, it would reach the session's pi, * which suspends itself, and nothing in the background would ever continue it. * `pasting` carries a bracketed paste across chunks. Offsets are bytes (latin1). */ export declare function localDetachAt(s: string, pasting?: boolean): { at: number; end: number; pasting: boolean; }; /** * Pass the terminal through to a job's PTY host until detach. The caller owns * the terminal before and after: this only toggles raw mode while attached. */ export declare function attachToHost(socketPath: string, io: AttachIO): Promise;