The best way to control Claude Code, Codex and more from any computer or phone

main
md 53 lines 2.35 KB
Rendered Raw
1 # T3 Mobile Terminal Native Module
2
3 This local Expo module owns the native terminal surface for the mobile app.
4
5 The JavaScript contract is intentionally small:
6
7 - input from the native surface is emitted as `{ data: string }`
8 - resize from the native surface is emitted as `{ cols: number, rows: number }`
9 - remote PTY output is delivered by the existing `WsRpcClient.terminal` RPC stream
10
11 The iOS implementation uses the vendored `GhosttyKit.xcframework` built from VVTerm's Ghostty
12 custom-I/O and live-padding branch. `T3TerminalView` owns a `libghostty` surface and uses that
13 callback I/O model:
14
15 1. initialize libghostty once for the process
16 2. create one Ghostty app and surface per native view
17 3. feed remote output into the surface with `ghostty_surface_feed_data`
18 4. send user input back to JS with the write callback
19 5. emit Ghostty's measured terminal size through `onResize`
20
21 Android implements the same view contract with upstream `libghostty-vt` for terminal state, parsing,
22 reflow, and scrollback. An Android Canvas view renders compact snapshots produced by the JNI bridge,
23 so the React Native screen and RPC code stay platform-neutral.
24
25 Vendored Ghostty revision and license details are in `THIRD_PARTY_NOTICES.md`.
26
27 ## Rebuilding GhosttyKit
28
29 The checked-in `GhosttyKit.xcframework` is built from Yash Singh's Ghostty fork at revision
30 `cf8edc23f3a6a87a96e41a90013e89e987d34980`. Set `GHOSTTY_SOURCE_DIR` to a clone of
31 https://github.com/Yash-Singh1/ghostty checked out at that revision (the
32 `t3code/custom-io-ordered-feed` branch when vendored, based on VVTerm's
33 `vvterm/custom-io-padding` branch).
34
35 ```bash
36 apps/mobile/modules/t3-terminal/scripts/build-libghostty-ios16.sh
37 ```
38
39 The script builds Ghostty with Zig 0.16.0, strips the iOS archives, and replaces only the
40 `ios-arm64` and `ios-arm64-simulator` slices. Xcode's Metal toolchain must be installed; if `metal`
41 fails, run `xcodebuild -downloadComponent MetalToolchain`.
42
43 ## Rebuilding libghostty-vt for Android
44
45 The checked-in Android shared libraries and headers are pinned to the revision recorded in
46 `native/libghostty-vt/VERSION` at the repository root. Set `ANDROID_NDK_HOME` and run:
47
48 ```bash
49 apps/mobile/modules/t3-terminal/scripts/build-libghostty-android.sh
50 ```
51
52 The script downloads Zig 0.15.2 when needed, checks out the pinned upstream Ghostty revision, and
53 rebuilds all four Android ABIs with 16 KB page-size support.