Commit 8394362
committed
feat(web): add ghostty renderer behind query param
The browser terminal was previously hard-wired to xterm.js, which made it
impossible to compare renderer behavior without code changes. This adds a
runtime renderer switch so xterm and ghostty can be used in parallel.
Architecture decisions:
- Keep tmux websocket, pane routing, and input/output flow unchanged.
- Introduce a tiny terminal runtime adapter (createTerminal/createFitAddon)
so renderer-specific setup stays isolated from pane/session logic.
- Vendor ghostty-web JS and WASM assets into embedded web assets to avoid
introducing a frontend build pipeline.
- Default to xterm and gracefully fall back to xterm if ghostty init fails.
What was implemented:
- Added query-param renderer selection in app runtime (`?term=ghostty` or
`?term=xterm`, defaulting to xterm).
- Added async boot path that initializes the selected runtime before
processing tmux state updates.
- Added dynamic ghostty runtime loader using `Ghostty.load` with explicit
WASM path `/vendor/ghostty/ghostty-vt.wasm`.
- Refactored terminal creation to use the shared runtime adapter.
- Preserved active query parameters when rewriting fallback pane URLs so the
selected terminal backend remains active across pane rebinding.
- Added vendored assets:
- internal/assets/web/vendor/ghostty/ghostty-web.js
- internal/assets/web/vendor/ghostty/ghostty-vt.wasm
Current state:
Both renderers are now available at runtime with no server-side API changes.
`?term=ghostty` activates ghostty-web and `?term=xterm` (or no param) uses
xterm. Existing tmux control-mode behavior and tests continue to pass.
Next steps for colleague:
1. Add browser e2e coverage that exercises `?term=ghostty` end-to-end.
2. Consider showing the active renderer in the UI for easier debugging.
3. Benchmark render/input latency differences under high output volume.
Amp-Thread-Id: https://ampcode.com/threads/T-019c93d5-e152-767f-b73d-ae63c7b14e421 parent 038ff05 commit 8394362
3 files changed
Lines changed: 3023 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | | - | |
16 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
17 | 24 | | |
18 | 25 | | |
19 | 26 | | |
20 | 27 | | |
21 | 28 | | |
22 | 29 | | |
23 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
24 | 73 | | |
25 | 74 | | |
26 | 75 | | |
| |||
69 | 118 | | |
70 | 119 | | |
71 | 120 | | |
| 121 | + | |
72 | 122 | | |
73 | 123 | | |
74 | 124 | | |
| |||
128 | 178 | | |
129 | 179 | | |
130 | 180 | | |
131 | | - | |
| 181 | + | |
132 | 182 | | |
133 | 183 | | |
134 | 184 | | |
| |||
177 | 227 | | |
178 | 228 | | |
179 | 229 | | |
180 | | - | |
| 230 | + | |
181 | 231 | | |
182 | 232 | | |
183 | 233 | | |
184 | 234 | | |
185 | | - | |
186 | 235 | | |
187 | 236 | | |
188 | | - | |
| 237 | + | |
189 | 238 | | |
190 | 239 | | |
191 | 240 | | |
| |||
220 | 269 | | |
221 | 270 | | |
222 | 271 | | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
223 | 277 | | |
224 | 278 | | |
225 | 279 | | |
| |||
Binary file not shown.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments