The terminal adapter of the credential port (commons headless 0011-credential-promptFR-007): it draws a prompt on a terminal, reads the answer with no echo and gives it as a Secret, and is the same for every system because the terminal is a port of its own (TtyPort): what differs between Linux, macOS and Windows is how echo is turned off and which device is read, which is the port's, not the adapter's. Also here, the pure reader that turns the bytes of a terminal into a line (readerStep): backspace, enter, Ctrl-C and Ctrl-D.
The adapter never writes the value anywhere: the prompt goes to the terminal, the answer is read into a string held by the Secret, and a visible answer (confirm) is echoed by the terminal's own rules, not written by the adapter. A person who ends the input (Ctrl-C, Ctrl-D, the end of the stream) has cancelled, and so has an aborted signal.
type TtyHandle = {
/** Writes text to the terminal (the prompt, and the line break after an answer that was not echoed…(473 characters)
typeTtyHandle= {
/** Writes text to the terminal (the prompt, and the line break after an answer that was not echoed). */readonlywrite: (text:string) =>void;
/** Reads one line, with the echo off for a secret; `undefined` where the person ended the input or the signal was aborted. */readonlyreadLine: (echo:boolean, signal:AbortSignal) =>Promise<string|undefined>;
/** Gives the terminal back (the echo on again). */readonlyclose: () =>void;
};
What a terminal is, for the adapter: draw text, read an answer (with the echo on or off), and let go.
The line of a terminal that sends characters as they are typed (raw mode, where the echo is off because nobody writes it): a character is added, backspace (\b, DEL) takes one away, enter (\r, \n) ends the line, and Ctrl-C and Ctrl-D end the input. Pure: the same state and chunk give the same step.
typeTtyDevices= {
/** What is read from when standard input is not a terminal (the controlling terminal). */readonlyinput:string;
readonlyoutput:string;
/** How the echo is turned off: by the program `stty` run on the terminal, or by the console's own input mode. */readonlyecho:"stty"|"console-mode";
};
The devices of a system's terminal and how its echo is turned off: data the system adapter reads, so that the Windows variant is a row and not a branch of the adapter.