diff --git a/apps/mobile/modules/t3-terminal/README.md b/apps/mobile/modules/t3-terminal/README.md index 768e3c0704c..32670b893c7 100644 --- a/apps/mobile/modules/t3-terminal/README.md +++ b/apps/mobile/modules/t3-terminal/README.md @@ -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 diff --git a/apps/mobile/modules/t3-terminal/THIRD_PARTY_NOTICES.md b/apps/mobile/modules/t3-terminal/THIRD_PARTY_NOTICES.md index 0af582c5900..b06f18eadce 100644 --- a/apps/mobile/modules/t3-terminal/THIRD_PARTY_NOTICES.md +++ b/apps/mobile/modules/t3-terminal/THIRD_PARTY_NOTICES.md @@ -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) diff --git a/apps/mobile/modules/t3-terminal/android/src/main/cpp/CMakeLists.txt b/apps/mobile/modules/t3-terminal/android/src/main/cpp/CMakeLists.txt index 0273ff6c864..a43a2981b67 100644 --- a/apps/mobile/modules/t3-terminal/android/src/main/cpp/CMakeLists.txt +++ b/apps/mobile/modules/t3-terminal/android/src/main/cpp/CMakeLists.txt @@ -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( diff --git a/apps/mobile/modules/t3-terminal/scripts/build-libghostty-android.sh b/apps/mobile/modules/t3-terminal/scripts/build-libghostty-android.sh index 7b9aa9b6dc6..55d994d3b36 100755 --- a/apps/mobile/modules/t3-terminal/scripts/build-libghostty-android.sh +++ b/apps/mobile/modules/t3-terminal/scripts/build-libghostty-android.sh @@ -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}" diff --git a/apps/web/scripts/build-libghostty-wasm.sh b/apps/web/scripts/build-libghostty-wasm.sh index bceb1218c05..d4b1238bbfc 100755 --- a/apps/web/scripts/build-libghostty-wasm.sh +++ b/apps/web/scripts/build-libghostty-wasm.sh @@ -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:-}" diff --git a/apps/web/src/terminal/ghostty/README.md b/apps/web/src/terminal/ghostty/README.md index b563c6e833b..37e1c52fb0c 100644 --- a/apps/web/src/terminal/ghostty/README.md +++ b/apps/web/src/terminal/ghostty/README.md @@ -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 diff --git a/apps/web/src/terminal/ghostty/runtimeAbi.test.ts b/apps/web/src/terminal/ghostty/runtimeAbi.test.ts index 0b3eac7f1ed..b77cfd32bdd 100644 --- a/apps/web/src/terminal/ghostty/runtimeAbi.test.ts +++ b/apps/web/src/terminal/ghostty/runtimeAbi.test.ts @@ -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; @@ -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: () => {} }, }); @@ -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 () => { diff --git a/docs/architecture/terminal-renderers.md b/docs/architecture/terminal-renderers.md index 483dd164403..4b66a13f68c 100644 --- a/docs/architecture/terminal-renderers.md +++ b/docs/architecture/terminal-renderers.md @@ -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, diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/LICENSE b/native/libghostty-vt/LICENSE similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/LICENSE rename to native/libghostty-vt/LICENSE diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/VERSION b/native/libghostty-vt/VERSION similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/VERSION rename to native/libghostty-vt/VERSION diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt.h b/native/libghostty-vt/include/ghostty/vt.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt.h rename to native/libghostty-vt/include/ghostty/vt.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/allocator.h b/native/libghostty-vt/include/ghostty/vt/allocator.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/allocator.h rename to native/libghostty-vt/include/ghostty/vt/allocator.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/build_info.h b/native/libghostty-vt/include/ghostty/vt/build_info.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/build_info.h rename to native/libghostty-vt/include/ghostty/vt/build_info.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/color.h b/native/libghostty-vt/include/ghostty/vt/color.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/color.h rename to native/libghostty-vt/include/ghostty/vt/color.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/device.h b/native/libghostty-vt/include/ghostty/vt/device.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/device.h rename to native/libghostty-vt/include/ghostty/vt/device.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/focus.h b/native/libghostty-vt/include/ghostty/vt/focus.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/focus.h rename to native/libghostty-vt/include/ghostty/vt/focus.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/formatter.h b/native/libghostty-vt/include/ghostty/vt/formatter.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/formatter.h rename to native/libghostty-vt/include/ghostty/vt/formatter.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/grid_ref.h b/native/libghostty-vt/include/ghostty/vt/grid_ref.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/grid_ref.h rename to native/libghostty-vt/include/ghostty/vt/grid_ref.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/grid_ref_tracked.h b/native/libghostty-vt/include/ghostty/vt/grid_ref_tracked.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/grid_ref_tracked.h rename to native/libghostty-vt/include/ghostty/vt/grid_ref_tracked.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/key.h b/native/libghostty-vt/include/ghostty/vt/key.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/key.h rename to native/libghostty-vt/include/ghostty/vt/key.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/key/encoder.h b/native/libghostty-vt/include/ghostty/vt/key/encoder.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/key/encoder.h rename to native/libghostty-vt/include/ghostty/vt/key/encoder.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/key/event.h b/native/libghostty-vt/include/ghostty/vt/key/event.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/key/event.h rename to native/libghostty-vt/include/ghostty/vt/key/event.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/kitty_graphics.h b/native/libghostty-vt/include/ghostty/vt/kitty_graphics.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/kitty_graphics.h rename to native/libghostty-vt/include/ghostty/vt/kitty_graphics.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/modes.h b/native/libghostty-vt/include/ghostty/vt/modes.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/modes.h rename to native/libghostty-vt/include/ghostty/vt/modes.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/mouse.h b/native/libghostty-vt/include/ghostty/vt/mouse.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/mouse.h rename to native/libghostty-vt/include/ghostty/vt/mouse.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/mouse/encoder.h b/native/libghostty-vt/include/ghostty/vt/mouse/encoder.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/mouse/encoder.h rename to native/libghostty-vt/include/ghostty/vt/mouse/encoder.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/mouse/event.h b/native/libghostty-vt/include/ghostty/vt/mouse/event.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/mouse/event.h rename to native/libghostty-vt/include/ghostty/vt/mouse/event.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/osc.h b/native/libghostty-vt/include/ghostty/vt/osc.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/osc.h rename to native/libghostty-vt/include/ghostty/vt/osc.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/paste.h b/native/libghostty-vt/include/ghostty/vt/paste.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/paste.h rename to native/libghostty-vt/include/ghostty/vt/paste.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/point.h b/native/libghostty-vt/include/ghostty/vt/point.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/point.h rename to native/libghostty-vt/include/ghostty/vt/point.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/render.h b/native/libghostty-vt/include/ghostty/vt/render.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/render.h rename to native/libghostty-vt/include/ghostty/vt/render.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/screen.h b/native/libghostty-vt/include/ghostty/vt/screen.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/screen.h rename to native/libghostty-vt/include/ghostty/vt/screen.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/selection.h b/native/libghostty-vt/include/ghostty/vt/selection.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/selection.h rename to native/libghostty-vt/include/ghostty/vt/selection.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/sgr.h b/native/libghostty-vt/include/ghostty/vt/sgr.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/sgr.h rename to native/libghostty-vt/include/ghostty/vt/sgr.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/size_report.h b/native/libghostty-vt/include/ghostty/vt/size_report.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/size_report.h rename to native/libghostty-vt/include/ghostty/vt/size_report.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/style.h b/native/libghostty-vt/include/ghostty/vt/style.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/style.h rename to native/libghostty-vt/include/ghostty/vt/style.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/sys.h b/native/libghostty-vt/include/ghostty/vt/sys.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/sys.h rename to native/libghostty-vt/include/ghostty/vt/sys.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/terminal.h b/native/libghostty-vt/include/ghostty/vt/terminal.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/terminal.h rename to native/libghostty-vt/include/ghostty/vt/terminal.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/types.h b/native/libghostty-vt/include/ghostty/vt/types.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/types.h rename to native/libghostty-vt/include/ghostty/vt/types.h diff --git a/apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/wasm.h b/native/libghostty-vt/include/ghostty/vt/wasm.h similarity index 100% rename from apps/mobile/modules/t3-terminal/Vendor/libghostty-vt/include/ghostty/vt/wasm.h rename to native/libghostty-vt/include/ghostty/vt/wasm.h