Architecture
The core problem
A terminal has three parts:
- a renderer that draws the screen,
- a VT engine that turns bytes like
ESC[31minto screen state, and - a source of that byte stream.
On Unix the kernel pty supplies part 3 for free. On Windows, native programs such as cmd.exe
and PowerShell do not write bytes. They call the Console API (SetConsoleCursorPosition,
WriteConsoleOutput, ReadConsoleInput) against a cell grid inside conhost.exe. Something has
to translate grid activity into bytes and keystrokes into console input events.
On Windows 10 1809 and later, ConPTY is that Backend. Windows 7 has no ConPTY and cannot
get one: ConPTY depends on the condrv.sys driver and on kernelbase routing that Windows 7 lacks.
Voyager7 therefore supplies its own Backends. libghostty-vt sits downstream of the Backend and
cannot replace it.
Overview
child (cmd, pwsh, tools)
│ Console API calls, WriteFile/WriteConsole bytes
▼
[Hook, in the child] ── raw VT bytes ─────────────┐
│ unhooked / unknown calls │
▼ │
hidden Win7 console ── Scraper (diff → VT) ───────┤
▼
libghostty-vt ──snapshot──▶ frame builder ──▶ D3D11 / WARP
▲ ▲
keystrokes ── encoded by libghostty-vt ─────────────┘ cosmic-text glyph atlas
→ KEY_EVENT records into hidden console / Hook
On Windows 10 1809+, ConPTY replaces the whole left side. Voyager7 loads it at runtime with
GetProcAddress("CreatePseudoConsole"), or uses a bundled conpty.dll and OpenConsole.exe.
| Layer | Choice | Decision |
|---|---|---|
| Application language | Rust, stable. Every crate shipped on Windows is no_std plus alloc. | ADR 0002, ADR 0004 |
| VT engine | libghostty-vt, built with Zig for a win7 target floor, linked as a static library through its C API | step 1 |
| Text Engine | cosmic-text on every platform, as a no_std crate; our own font discovery feeds it | ADR 0001 |
| Renderer | One portable frame builder and glyph atlas; Direct3D 11 at feature level 10_0+ with WARP fallback on Windows; wgpu on Linux and macOS later | ADR 0003 |
| Window and platform | Win32 directly, our own platform layer; no C runtime at all: our own entry point, heap allocator and memory routines | ADR 0004 |
| Backends on Windows 7 | The Hook (in-process, forwards VT bytes) with the Scraper underneath as a fallback | step 7, 8 |
| Backend on 1809+ | ConPTY | step 5 |
| Inspector | A native Win32 window showing live Surface, Backend, mode, input, I/O and cell diagnostics | step 6 |
| Memory | Allocate at initialization and reconfiguration only; every buffer capped | ADR 0005 |
Engineering notes
- Decisions: one short ADR per hard-to-reverse choice.
- Style: TigerStyle adapted for Voyager7, enforced by lints.
- Testing: the seams, the golden rules, and the budgets.
- Dependencies: the allowlist with a reason per crate.
- Terminal rendering gotchas: lessons from the COSMIC border, Powerline, and emoji fixes, with Windows 7 constraints and renderer acceptance checks.
- File Pilot: native rendering and performance observations.
- Reference checkouts: the local clones we read and what each is for.