| 1 | # vendor/ |
| 2 | |
| 3 | `ghostty-vt.wasm` is libghostty-vt built from the Ghostty source tree (MIT, `GHOSTTY-LICENSE`) at the commit pinned in `COMMIT`. `include/` is the matching C API header set, vendored for reference and as the source of truth for `gen-constants.mjs`. |
| 4 | |
| 5 | The vendored artifact is **pinned to the commit in `COMMIT`**. Do not update without running the full bump checklist — libghostty-vt has no tagged release, and every bump is a potential silent ABI break. |
| 6 | |
| 7 | ## Rebuild recipe |
| 8 | |
| 9 | ```sh |
| 10 | git clone https://github.com/ghostty-org/ghostty.git # mirror; upstream is migrating forges |
| 11 | cd ghostty && git checkout $(cat ../COMMIT) |
| 12 | patch -p1 < <terminal-package>/vendor/patches/wasm-batched-vt.patch |
| 13 | patch -p1 < <terminal-package>/vendor/patches/wasm-ascii-row.patch |
| 14 | zig build -Demit-lib-vt -Dtarget=wasm32-freestanding -Doptimize=ReleaseSmall |
| 15 | cp zig-out/bin/ghostty-vt.wasm <here> |
| 16 | node <terminal-package>/vendor/verify.mjs <ghostty-source> |
| 17 | ``` |
| 18 | |
| 19 | The local patch keeps Ghostty's existing scalar `print_slice` batching enabled |
| 20 | for wasm. Upstream's `simd=false` disables native SIMD dependencies, but the |
| 21 | unpatched stream also falls back to one parser action per byte even though the |
| 22 | batched path has a scalar decoder. |
| 23 | |
| 24 | The ASCII-row patch adds a fail-closed bulk export for narrow printable cells |
| 25 | with default presentation or an explicit foreground. Unsupported rows return |
| 26 | `GHOSTTY_NO_VALUE` and continue through the canonical per-cell API. |
| 27 | |
| 28 | Zig version must match `.minimum_zig_version` in `build.zig.zon` (0.16.0 at the pinned commit). If zig's fetcher fails with `TlsInitializationFailed` against `deps.files.ghostty.org`, curl the tarball it names and `zig fetch <file>` manually, then retry. |
| 29 | |
| 30 | ## Bump checklist |
| 31 | |
| 32 | 1. New commit into `COMMIT`, rebuild wasm, re-vendor `include/`, and replace `SHA256` with the rebuilt wasm's lowercase SHA-256. |
| 33 | 2. `node vendor/gen-constants.mjs` — regenerates `src/ghostty/constants.ts`; a changed enum value or struct layout is an API break to review, not noise. |
| 34 | 3. `node vendor/verify.mjs <ghostty-source>` verifies the checked-in wasm hash, required exports and type metadata, patched source metadata, and the upstream wasm-allocator page-zeroing guard. The source argument is mandatory during a bump; `pnpm verify:vendor` performs the artifact-only checks on every package check. |
| 35 | 4. Run the package test suite; `test/lifecycle.vi.ts` re-proves the grapheme create/free cycle against the new artifact. |