Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Architecture

The core problem

A terminal has three parts:

  1. a renderer that draws the screen,
  2. a VT engine that turns bytes like ESC[31m into screen state, and
  3. 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.

LayerChoiceDecision
Application languageRust, stable. Every crate shipped on Windows is no_std plus alloc.ADR 0002, ADR 0004
VT enginelibghostty-vt, built with Zig for a win7 target floor, linked as a static library through its C APIstep 1
Text Enginecosmic-text on every platform, as a no_std crate; our own font discovery feeds itADR 0001
RendererOne portable frame builder and glyph atlas; Direct3D 11 at feature level 10_0+ with WARP fallback on Windows; wgpu on Linux and macOS laterADR 0003
Window and platformWin32 directly, our own platform layer; no C runtime at all: our own entry point, heap allocator and memory routinesADR 0004
Backends on Windows 7The Hook (in-process, forwards VT bytes) with the Scraper underneath as a fallbackstep 7, 8
Backend on 1809+ConPTYstep 5
InspectorA native Win32 window showing live Surface, Backend, mode, input, I/O and cell diagnosticsstep 6
MemoryAllocate at initialization and reconfiguration only; every buffer cappedADR 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.