Files
vercel-labs--zero-native/build.zig.zon
Chris Tate 2209f022ee Live <terminal> sessions, and examples/workbench: a terminal beside a browser (#198)
* Bring libghostty-vt back behind a consumer-safe terminal_vt seam

- The framework module imports terminal_vt everywhere: a ghostty-vt wrapper where the dependency is safe to traverse, a stub (enabled=false) elsewhere
- Root builds resolve a lazy ghostty pin gated on being the build root, so consumers running this build script as a dependency never touch ghostty's graph
- Apps opt in via addAppArtifacts .ghostty_vt with their own pin; scaffolded builds keep the stub and stay free of harfbuzz/translate_c

* Live <terminal> sessions: the runtime-owned emulator behind a bound pty key

- terminal_session.zig: per-pty-key libghostty-vt sessions publishing resolved TerminalGrid snapshots, with the example tier's lossless outbound ring, query-answer write-back, key encoding, and theme-derived palette promoted into the runtime
- The effects engine grows a pty delivery tap (live drain and replay feed alike), so emulator state derives from exactly the journaled stream; outbound bytes ride the journaled ptyWrite verdict path
- The app loop installs the builder's terminal grid lookup, reconciles cols/rows from each element's laid-out frame into ptyResize, applies the scrollback source-wins echo, routes focused keys/IME text and wheel scrollback to the session, and dispatches on-terminal states

* Terminal session store tests: the element contract at the store seam

- Lookup-driven session creation, fed output as resolved cells, stdin-ordered write-back (keys, text, DSR answers), retained-ring flush, resize reconcile, scrollback source-wins, respawn reset, and wide-cell spacer backgrounds
- Fix the snapshot sizing multiply: @min against a comptime bound refines its result type, so the product needed explicit widening

* The terminal emulator is an app-owned pin, opted into per app

- Replace AppOptions.ghostty_vt with terminal_sessions: bool; the framework resolves the app's own lazy ghostty pin with the app module's target/optimize and the safe flags, so an app asks for live <terminal> sessions with one field instead of threading a module
- Drop the ghostty pin from this package's build.zig.zon: a pin here materializes into every consumer's package directory even when lazy and unused (measured 27 packages / 585 MB in a scaffolded app's package dir, now zero), so the toolkit's own builds always carry the terminal_vt stub
- Add src/terminal_session_tests_root.zig so an emulator-wired app build can run the session store's tests, which skip in this package's own suite

* examples/workbench: a live terminal beside a browser in one split

- Add the workbench example: a <split> with a <terminal pty={key}> pane and a browser pane (back, forward, reload, address bar), app-owned navigation history, and a hidden-inset titlebar with per-pane drag bands
- The app spawns a shell with fx.ptySpawn and binds the key in markup; no emulator wiring, key encoding, or grid plumbing lives in the app
- Register test-example-workbench, whose build also runs the runtime session store's tests since this build wires the emulator

* Document live terminal sessions and how a build opts in

- Terminal docs: the runtime owns the emulator behind a bound pty key, plus an "Enabling live sessions" section covering the app-owned lazy pin, terminal_sessions = true, and the terminal_sessions_enabled flag apps can gate tests on
- Add the changelog fragment for the live sessions, the opt-in emulator, and the workbench example

* Workbench: the shell owns the keyboard when the window opens

- Mark the terminal element autofocus, so typing lands in the live session without a click first — a terminal window's keyboard belongs to its shell

* Terminal runs measure the face they actually ink with

- Derive the cell width from a 16-glyph mono probe divided by its length — the advance a merged run walks — and leave it unrounded, so glyphs stay on the cells the painter's backgrounds, cursor, and selection draw from
- Carry the measurement seam on each run: a command's raster extent is its own declared bounds, and the estimator's 0.6 em mono pitch falls short of a wider host face (macOS resolves the mono id to the system monospaced face at 0.618 em when Geist Mono is absent), which sheared a full-width row's last cell to a two-pixel sliver
- Cover both with a painter test that paints a full-width row against a wide-pitch provider and asserts every run's bounds hold its ink

* Workbench README: what the divider drag does to focus

- `stty size` named as the visible proof that the pty re-grids with the pane

- the divider keeps the keyboard after a drag; clicking the terminal returns it
2026-07-24 23:17:56 -05:00

33 lines
947 B
Zig

.{
.name = .native_sdk,
.fingerprint = 0xc309966142f33087,
.version = "0.1.0",
.minimum_zig_version = "0.16.0",
// No dependencies. The terminal emulator (libghostty-vt) is
// deliberately NOT pinned here: a pin in this file is materialized
// into every consumer's package directory even when lazy and
// unused. Apps that want live `<terminal>` sessions pin it in their
// own build.zig.zon and ask for it with
// `addAppArtifacts(.{ .terminal_sessions = true })` — see
// examples/workbench, which also owns that path's test coverage.
.dependencies = .{},
.paths = .{
"README.md",
"CHANGELOG.md",
"LICENSE",
"SECURITY.md",
"app.zon",
"assets",
"build",
"build.zig",
"build.zig.zon",
"docs",
"examples",
"packages",
"src",
"templates",
"tests",
"tools",
},
}