28. A solid terminal: the line discipline as a component
In brief. Line editing, history, ANSI in/out, control characters, and a written terminal contract,
as a swappable userspace component between the input/console drivers and applications; Ctrl-C as a
capability-routed interrupt to the foreground process, not a Unix signal. Built, §21 (the terminal
is a userspace component): line_editor
on both ISAs, a sans-IO engine (20 host tests), the contract in notes/terminal-contract.md,
shell_service retired for userspace init. Ctrl-C routing built (two-tier, DECISIONS §24
(interrupting the foreground process)
amendment): a shared-flag cooperative tier and an Untyped::DESTROY forcible tier. They are
shell-held, proven on both ISAs with heeder/spinner. The shell learns of ^C through
line_editor's OP_INTRCOUNT
Why it matters. a terminal with real behavior is a far better "instance one" for milestone 23's live component replacement than the raw echo loop, and 27's stdio semantics need a terminal that has semantics. Serial, deliberately; the display terminal is 29, and they must not be confused
Built 2026-07-28; see DECISIONS §21, notes/line-discipline.md, notes/terminal-contract.md, and design/interrupt-routing.md (the Ctrl-C fork, decided in DECISIONS §24 and now built per its implementation amendment: shell-held two-tier routing, proven on both ISAs).
Deliverable. The layer Unix calls the tty line discipline, as a swappable userspace component between the input/console drivers and applications. It does line editing (backspace, cursor keys, kill/yank), history, ANSI escape parsing in and out, and control characters. It writes a contract for what a terminal owes a program. The interesting design is Ctrl-C: interrupting the foreground process is a capability-routing question (who holds the right to interrupt whom). This project's answer will not be Unix signals, and that answer is the milestone's kernel-adjacent substance. Serial, deliberately: the terminal emulator stays on the host end of the wire.
Why. Milestone 23's flagship line ("the console hot-swap is instance one") deserves a
component with real behavior, and 27's stdio semantics (line buffering, read_line) need a
terminal that has semantics. Pure userspace on machinery that all exists; could land any time.
Prior art and reuse. Userspace, outside the TCB: the rule says actively prefer porting.
noline (a no_std readline) and embedded-cli are live candidates for the editing core; the
component contract and the interrupt routing are ours. Read the Unix tty layer as the
mistake-catalog (its tangle is famous) and Plan 9 (editing pushed to the client) as the
counter-design. Effort: 1 lane (measured: it took one).
Follow-on
- Milestone 29. The display terminal. This block is serial on purpose and says the two must not be confused: the terminal emulator stays on the host end of the wire here, and framebuffer output is 29's work.
Index row
a terminal with real behavior, which 27's stdio semantics need