Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/mobile/modules/t3-terminal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fails, run `xcodebuild -downloadComponent MetalToolchain`.
## Rebuilding libghostty-vt for Android

The checked-in Android shared libraries and headers are pinned to the revision recorded in
`Vendor/libghostty-vt/VERSION`. Set `ANDROID_NDK_HOME` and run:
`native/libghostty-vt/VERSION` at the repository root. Set `ANDROID_NDK_HOME` and run:

```bash
apps/mobile/modules/t3-terminal/scripts/build-libghostty-android.sh
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/modules/t3-terminal/THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The web terminal vendors a WebAssembly build from the same revision and uses the
- License: MIT

Ghostty's MIT license applies to the vendored Android and web libraries. Keep this notice and both
artifacts in sync when updating `Vendor/libghostty-vt`.
artifacts in sync when updating the repository-root `native/libghostty-vt`.

## MesloLGS NF (Android terminal font)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ add_library(t3terminal SHARED t3_terminal_jni.cpp)

target_include_directories(
t3terminal
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../../../Vendor/libghostty-vt/include"
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../../../native/libghostty-vt/include"
)

target_link_options(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MODULE_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
VENDOR_DIR="${MODULE_DIR}/Vendor/libghostty-vt"
VENDOR_DIR="${MODULE_DIR}/../../../../native/libghostty-vt"
PATCH_DIR="${SCRIPT_DIR}/libghostty-android-patches"

GHOSTTY_REVISION="${GHOSTTY_REVISION:-9f62873bf195e4d8a762d768a1405a5f2f7b1697}"
Expand Down
4 changes: 2 additions & 2 deletions apps/web/scripts/build-libghostty-wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
WEB_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
REPO_DIR="$(cd "${WEB_DIR}/../.." && pwd)"
MOBILE_VENDOR_DIR="${REPO_DIR}/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt"
CANONICAL_VENDOR_DIR="${REPO_DIR}/native/libghostty-vt"
VENDOR_DIR="${WEB_DIR}/src/terminal/ghostty/vendor"

GHOSTTY_REVISION="$(tr -d '[:space:]' < "${MOBILE_VENDOR_DIR}/VERSION")"
GHOSTTY_REVISION="$(tr -d '[:space:]' < "${CANONICAL_VENDOR_DIR}/VERSION")"
GHOSTTY_SOURCE_DIR="${GHOSTTY_SOURCE_DIR:-${HOME}/.cache/t3code/ghostty-${GHOSTTY_REVISION:0:8}}"
GHOSTTY_ZIG_VERSION="${GHOSTTY_ZIG_VERSION:-0.15.2}"
GHOSTTY_ZIG="${GHOSTTY_ZIG:-}"
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/terminal/ghostty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ It is intentionally not an xterm compatibility layer.
prompt glyphs render without a locally installed Nerd Font.
- `vendor/` holds only the artifacts, reproducibly generated by
`apps/web/scripts/build-libghostty-wasm.sh`. The upstream pin and license live once, at
`apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/`; the wasm embeds the pinned revision
`native/libghostty-vt/` at the repository root; the wasm embeds the pinned revision
in its build info and the ABI test verifies it against mobile's `VERSION`.

Keep browser behavior here and terminal transport in the existing client runtime. Do not add React
Expand Down
10 changes: 5 additions & 5 deletions apps/web/src/terminal/ghostty/runtimeAbi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, expect, it } from "vite-plus/test";

import wasmDataUrl from "./vendor/ghostty-vt.wasm?inline";
import writePtyWasmDataUrl from "./vendor/ghostty-write-pty.wasm?inline";
import mobileVersion from "../../../../mobile/modules/t3-terminal/Vendor/libghostty-vt/VERSION?raw";
import pinnedVersion from "../../../../../native/libghostty-vt/VERSION?raw";
import { ghosttyKeyForCode } from "./keyCodes";

type WasmFunction = (...args: number[]) => number;
Expand All @@ -14,13 +14,13 @@ function decodeWasmDataUrl(dataUrl: string): Uint8Array {
}

describe("vendored libghostty-vt WebAssembly", () => {
it("stays pinned to mobile's canonical revision and size budget", async () => {
it("stays pinned to the canonical revision and size budget", async () => {
const wasm = decodeWasmDataUrl(wasmDataUrl);
expect(wasm.byteLength).toBeLessThan(750_000);

// The artifact carries its own provenance: the build embeds the pinned
// revision as semver build metadata, so mobile's VERSION file is the
// single source of truth and drift is caught here without a copy.
// revision as semver build metadata, so the repository's canonical VERSION
// file is the single source of truth and drift is caught here without a copy.
const result = await WebAssembly.instantiate(wasm.buffer as ArrayBuffer, {
env: { log: () => {} },
});
Expand All @@ -35,7 +35,7 @@ describe("vendored libghostty-vt WebAssembly", () => {
new Uint8Array(memory.buffer, view.getUint32(0, true), view.getUint32(4, true)),
);
call("ghostty_wasm_free_u8_array", out, 8);
expect(embeddedRevision).toBe(mobileVersion.trim());
expect(embeddedRevision).toBe(pinnedVersion.trim());
});

it("creates, writes multi-codepoint graphemes, and frees repeated terminals", async () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/terminal-renderers.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ boundaries, keyboard encoding, selection, and scrollback:
- Android links the native shared library and converts render state into a compact JNI snapshot.
- Web loads a separately cached WebAssembly build and reads render state into a Canvas 2D surface.
- Both artifacts are built from the revision in
`apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/VERSION`.
`native/libghostty-vt/VERSION`.

The platform adapters deliberately own only platform behavior. Android owns its Kotlin Canvas and
touch integration. Web owns browser font shaping, the hidden IME textarea, clipboard and DOM input,
Expand Down
Loading