revert: keep xterm.js for the terminal

ghostty-web 0.4.0 corrupts cell positions after the pane resizes or remounts. In testing, seq output became a diagonal staircase and reopening at a new width mixed the prompt with old output. The release also has open bugs for Alt-key input and idle repainting. Keep xterm.js until those are fixed.
This commit is contained in:
vhaudiquet committed 2026-11-28 10:37:57 +01:00
1 parent 3f61dd4db8
commit 05660a244b
7 files changed
+58 -58

No files matched your search

+1 -1
View File
@@ -13,7 +13,7 @@ The room is a browser workspace:
- **Files** pane: the tree, a read-only file view, `git status`, and - **Files** pane: the tree, a read-only file view, `git status`, and
`git diff`. `git diff`.
- **Terminal**: a real PTY in the sandbox, same target and key as the - **Terminal**: a real PTY in the sandbox, same target and key as the
agent, rendered with ghostty-web (Ghostty's VT parser in WebAssembly). agent, rendered with xterm.js.
- **Presence**: who is online, who is typing. - **Presence**: who is online, who is typing.
Accounts own rooms, plans, and providers. Friends join by a single-use Accounts own rooms, plans, and providers. Friends join by a single-use
+6 -7
View File
@@ -386,12 +386,11 @@ when the shell ends. There is no server-side ring buffer; a reconnect
starts a fresh shell. Closing the socket closes the channel, which starts a fresh shell. Closing the socket closes the channel, which
hangs up the remote shell. hangs up the remote shell.
The emulator is ghostty-web in the browser, which runs Ghostty's VT The emulator is xterm.js in the browser. The server parses no escape
parser as WebAssembly behind an xterm.js-compatible API. The server sequences. A server-side libghostty-vt is a later option: it gives screen
parses no escape sequences. A server-side libghostty-vt is a later snapshots on reconnect and a way to let the model read the terminal, and
option: it gives screen snapshots on reconnect and a way to let the it costs an FFI crate that allows `unsafe`. That crate would live in this
model read the terminal, and it costs an FFI crate that allows `unsafe`. project, not in the framework.
That crate would live in this project, not in the framework.
### Editor (read-only) ### Editor (read-only)
@@ -665,7 +664,7 @@ This repository, as committed:
- SSE event feed with durable replay (`?since=`) and transient deltas; - SSE event feed with durable replay (`?since=`) and transient deltas;
a WS presence socket with online and typing state. a WS presence socket with online and typing state.
- Read-only files tree and file view, `git status` and `git diff`. - Read-only files tree and file view, `git status` and `git diff`.
- ghostty-web terminal over a WebSocket PTY. - xterm.js terminal over a WebSocket PTY.
- Preview proxy over ssh `direct-tcpip`, signed wildcard hosts, no - Preview proxy over ssh `direct-tcpip`, signed wildcard hosts, no
rewriting. rewriting.
- No approval prompts: the sandbox is the boundary, so `AllowAll`. - No approval prompts: the sandbox is the boundary, so `AllowAll`.
+1 -3
View File
@@ -171,11 +171,9 @@ async fn headers(State(state): State<Shared>, request: Request, next: Next) -> R
Some(source) => format!("'self' {source}"), Some(source) => format!("'self' {source}"),
None => "'self'".to_owned(), None => "'self'".to_owned(),
}; };
// ghostty-web compiles its inlined WASM in the browser. Keep the
// narrow wasm-unsafe-eval allowance and let it fetch the data: module.
let csp = format!( let csp = format!(
"default-src 'self'; img-src 'self' data: blob:; style-src 'self' 'unsafe-inline'; \ "default-src 'self'; img-src 'self' data: blob:; style-src 'self' 'unsafe-inline'; \
script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval'; connect-src 'self' data: ws: wss:; frame-src {frame_src}; \ script-src 'self' 'unsafe-inline'; connect-src 'self' ws: wss:; frame-src {frame_src}; \
frame-ancestors 'self'; base-uri 'self'; form-action 'self'" frame-ancestors 'self'; base-uri 'self'; form-action 'self'"
); );
if let Ok(value) = HeaderValue::from_str(&csp) { if let Ok(value) = HeaderValue::from_str(&csp) {
+2 -6
View File
@@ -1387,12 +1387,8 @@ button {
overflow: hidden; overflow: hidden;
} }
.terminal-host:focus { .terminal-host .xterm {
outline: none; height: 100%;
}
.terminal-host canvas {
display: block;
} }
.preview-wrap { .preview-wrap {
+30 -32
View File
@@ -1,6 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, nextTick, onBeforeUnmount, onMounted, ref } from 'vue' import { computed, nextTick, onBeforeUnmount, onMounted, ref } from 'vue'
import type { FitAddon as FitAddonInstance, Terminal as TerminalInstance } from 'ghostty-web' import '@xterm/xterm/css/xterm.css'
import type { FitAddon as FitAddonInstance } from '@xterm/addon-fit'
import type { Terminal as TerminalInstance } from '@xterm/xterm'
const props = defineProps<{ roomId: string }>() const props = defineProps<{ roomId: string }>()
@@ -164,40 +166,36 @@ function reconnect() {
onMounted(async () => { onMounted(async () => {
await nextTick() await nextTick()
try { const [{ Terminal }, { FitAddon }] = await Promise.all([
const { init, Terminal, FitAddon } = await import('ghostty-web') import('@xterm/xterm'),
await init() import('@xterm/addon-fit'),
if (disposed || !host.value) return ])
if (!host.value) return
term = new Terminal({ term = new Terminal({
convertEol: false, convertEol: false,
cursorBlink: true, cursorBlink: true,
fontFamily: getComputedStyle(document.documentElement).getPropertyValue('--font-mono').trim(), fontFamily: getComputedStyle(document.documentElement).getPropertyValue('--font-mono').trim(),
fontSize: Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--fs-code')) || 13, fontSize: Number.parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--fs-code')) || 13,
scrollback: 3000, scrollback: 3000,
theme: terminalTheme(), theme: terminalTheme(),
}) })
fit = new FitAddon() fit = new FitAddon()
term.loadAddon(fit) term.loadAddon(fit)
term.open(host.value) term.open(host.value)
term.onData((data) => { term.onData((data) => {
if (!socket || socket.readyState !== WebSocket.OPEN) return if (!socket || socket.readyState !== WebSocket.OPEN) return
socket.send(new TextEncoder().encode(data)) socket.send(new TextEncoder().encode(data))
}) })
observer = new ResizeObserver(() => { observer = new ResizeObserver(() => {
scheduleFit()
})
observer.observe(host.value)
term.focus()
scheduleFit() scheduleFit()
connect() })
} catch (error) { observer.observe(host.value)
status.value = 'disconnected'
detail.value = 'The terminal emulator could not start.' term.focus()
console.error('terminal emulator failed to start', error) scheduleFit()
} connect()
}) })
onBeforeUnmount(() => { onBeforeUnmount(() => {
+2 -1
View File
@@ -10,7 +10,8 @@
"typecheck": "nuxt typecheck" "typecheck": "nuxt typecheck"
}, },
"dependencies": { "dependencies": {
"ghostty-web": "0.4.0", "@xterm/addon-fit": "^0.11.0",
"@xterm/xterm": "^6.0.0",
"lucide-vue-next": "^1.0.0", "lucide-vue-next": "^1.0.0",
"nuxt": "^4.7.0", "nuxt": "^4.7.0",
"vue": "^3.5.0" "vue": "^3.5.0"
+16 -8
View File
@@ -8,9 +8,12 @@ importers:
.: .:
dependencies: dependencies:
ghostty-web: '@xterm/addon-fit':
specifier: 0.4.0 specifier: ^0.11.0
version: 0.4.0 version: 0.11.0
'@xterm/xterm':
specifier: ^6.0.0
version: 6.0.0
lucide-vue-next: lucide-vue-next:
specifier: ^1.0.0 specifier: ^1.0.0
version: 1.0.0(vue@3.5.46(typescript@5.9.3)) version: 1.0.0(vue@3.5.46(typescript@5.9.3))
@@ -1160,6 +1163,12 @@ packages:
'@vue/shared@3.5.46': '@vue/shared@3.5.46':
resolution: {integrity: sha512-P1WePbdzHrcIciWtmY2Im9EFhdakd3rZxYqvalOa3SfoxtF35Q8Uhmj1tKn6bWP4utcOpN8ao6BoJUItq0Uf+g==} resolution: {integrity: sha512-P1WePbdzHrcIciWtmY2Im9EFhdakd3rZxYqvalOa3SfoxtF35Q8Uhmj1tKn6bWP4utcOpN8ao6BoJUItq0Uf+g==}
'@xterm/addon-fit@0.11.0':
resolution: {integrity: sha512-jYcgT6xtVYhnhgxh3QgYDnnNMYTcf8ElbxxFzX0IZo+vabQqSPAjC3c1wJrKB5E19VwQei89QCiZZP86DCPF7g==}
'@xterm/xterm@6.0.0':
resolution: {integrity: sha512-TQwDdQGtwwDt+2cgKDLn0IRaSxYu1tSUjgKarSDkUM0ZNiSRXFpjxEsvc/Zgc5kq5omJ+V0a8/kIM2WD3sMOYg==}
abbrev@3.0.1: abbrev@3.0.1:
resolution: {integrity: sha512-AO2ac6pjRB3SJmGJo+v5/aK6Omggp6fsLrs6wN9bd35ulu4cCwaAU9+7ZhXjeqHVkaHThLuzH0nZr0YpCDhygg==} resolution: {integrity: sha512-AO2ac6pjRB3SJmGJo+v5/aK6Omggp6fsLrs6wN9bd35ulu4cCwaAU9+7ZhXjeqHVkaHThLuzH0nZr0YpCDhygg==}
engines: {node: ^18.17.0 || >=20.5.0} engines: {node: ^18.17.0 || >=20.5.0}
@@ -1678,9 +1687,6 @@ packages:
get-port-please@3.2.0: get-port-please@3.2.0:
resolution: {integrity: sha512-I9QVvBw5U/hw3RmWpYKRumUeaDgxTPd401x364rLmWBJcOQ753eov1eTgzDqRG9bqFIfDc7gfzcQEWrUri3o1A==} resolution: {integrity: sha512-I9QVvBw5U/hw3RmWpYKRumUeaDgxTPd401x364rLmWBJcOQ753eov1eTgzDqRG9bqFIfDc7gfzcQEWrUri3o1A==}
ghostty-web@0.4.0:
resolution: {integrity: sha512-0puDBik2qapbD/QQBW9o5ZHfXnZBqZWx/ctBiVtKZ6ZLds4NYb+wZuw1cRLXZk9zYovIQ908z3rvFhexAvc5Hg==}
giget@3.3.1: giget@3.3.1:
resolution: {integrity: sha512-r+mvuDjrjMpsdw46Kmeydb8bdHm7wOKw8wNBtTndkjbPjgAp5oUJUxRE76wZFknxIPokfWvep2qSXK37aXE6zg==} resolution: {integrity: sha512-r+mvuDjrjMpsdw46Kmeydb8bdHm7wOKw8wNBtTndkjbPjgAp5oUJUxRE76wZFknxIPokfWvep2qSXK37aXE6zg==}
hasBin: true hasBin: true
@@ -4135,6 +4141,10 @@ snapshots:
'@vue/shared@3.5.46': {} '@vue/shared@3.5.46': {}
'@xterm/addon-fit@0.11.0': {}
'@xterm/xterm@6.0.0': {}
abbrev@3.0.1: {} abbrev@3.0.1: {}
abort-controller@3.0.0: abort-controller@3.0.0:
@@ -4577,8 +4587,6 @@ snapshots:
get-port-please@3.2.0: {} get-port-please@3.2.0: {}
ghostty-web@0.4.0: {}
giget@3.3.1: {} giget@3.3.1: {}
glob-parent@5.1.2: glob-parent@5.1.2: