import { spawnSync } from "node:child_process"; /** One half of the terminal: it can be handed to a child process and taken * back. Both `TerminalInput` and `TerminalOutput` are one. */ export type Releasable = { release: () => void; reclaim: () => void; }; /** The two halves of the terminal the form owns. */ export type ReleasableTerminal = { input: Releasable; output: Releasable; }; export type EditorCommand = { command: string; args: string[]; }; /** `$EDITOR`, split on spaces so `code --wait` works. A quoted path with a * space in it is not supported. Null when the variable is unset or blank. */ export declare function editorCommand(env: Record): EditorCommand | null; /** Run `fn` with the terminal handed to a child process, then take it back. * The output leaves the alternate screen and stops answering the signals * the child's keys send; the input stops reading stdin, so the child is the * only reader of the terminal while it runs. */ export declare function withTerminalReleased(terminal: ReleasableTerminal, fn: () => T): T; /** Open `text` in the editor and return what was saved, or null when the * editor exited with a non-zero status. Editors end a file with a newline; * that one is dropped, so the value matches what typing it in place gives. */ export declare function openInEditor(text: string, editor: EditorCommand, terminal: ReleasableTerminal, spawn?: typeof spawnSync): string | null;