Replace xterm.js with Ghostty libghostty-vt in the workspace terminal - #81
Draft
sambitcreate wants to merge 6 commits into
Draft
Replace xterm.js with Ghostty libghostty-vt in the workspace terminal#81sambitcreate wants to merge 6 commits into
sambitcreate wants to merge 6 commits into
Conversation
Keep node-pty sessions, snapshots, and TERM=xterm-256color, and parse VT output with Ghostty's WASM engine plus an Aiden canvas surface. Co-authored-by: Sambit Biswas <sambitcreate@users.noreply.github.com>
Replace the incomplete custom VT canvas with T3's MIT runtime, write-pty trampoline, core snapshots, and surface (IME, scrollback, selection). Load WASM through fetch so packaged Electron file: builds work, and fail the production build if the wasm/font assets are missing. Co-authored-by: Sambit Biswas <sambitcreate@users.noreply.github.com>
T3's adapter uses replaceAll, Array.at, and toSorted, which fail tsc here. Co-authored-by: Sambit Biswas <sambitcreate@users.noreply.github.com>
Vite only copies new URL(..., import.meta.url) when the path is a compile-time literal. The runtime string argument never emitted ghostty-vt.wasm, so production verify and Electron E2E failed. Keep the 112-byte write-pty trampoline as a real file with ?no-inline. Co-authored-by: Sambit Biswas <sambitcreate@users.noreply.github.com>
Vite still needs compile-time new URL() to emit hashed wasm, but tsx rewrites those literals and ?no-inline made npm test fail after the production emit fix. Load vendor files from disk in Node, and keep the Vite URLs in wasm-assets.ts. Co-authored-by: Sambit Biswas <sambitcreate@users.noreply.github.com>
tsx rewrites static new URL(..., import.meta.url) to a cache directory that does not contain vendor/, so GhosttyRuntime.load() failed after the wasm-assets split. Keep Vite literals in wasm-assets.ts only. Co-authored-by: Sambit Biswas <sambitcreate@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The first revision’s custom
get_linecanvas host did not match T3 Code’s officiallibghostty-vtABI and loaded WASM vianode:fsonfile:URLs, which fails in the sandboxed Electron renderer.This update vendors T3 Code’s MIT browser adapter:
ghostty-vt.wasmpinned at9f62873bf195e4d8a762d768a1405a5f2f7b1697ghostty-write-pty.wasmtrampoline for terminal-generated PTY repliesnew URL()literals inwasm-assets.tsso Vite emits hashed wasm files./vendor/${filename}through a dynamic URL sotsxdoes not rewrite it to a cache path withoutvendor/assetsInlineLimitkeeps the 112-byte trampoline as a real file instead of adata:URLreplaceAll/Array.at/toSorted)PTY ownership in
main/services/terminal.tsis unchanged.Test plan
npm run type-check/npm run lint/npm run test:ghostty-terminalnpm run build(must emit hashedghostty-vt*.wasmandghostty-write-pty*.wasm)tests/e2e/terminal.spec.ts)