fix(web): preserve dynamic terminal background#37
Conversation
Greptile SummaryThis PR adds end-to-end dynamic terminal background tracking: a new Go streaming OSC parser (
Confidence Score: 4/5Safe to merge; changes are browser-local on the frontend and additive-only on the runner, with no mutations to daemon APIs, relay protocol, or session persistence. The Go tracker's mutex discipline and split-sequence handling are correct, the xterm fall-through handlers are properly disposed, and session-switch reset logic is in place. The only gap is a missing test branch for the resolvedTerminalBackground default-color path, which is inconsequential today but could silently regress if DEFAULT_THEME_COLORS is restructured. The test coverage gap in terminal-colors.test.ts (the DEFAULT_THEME_COLORS fallback branch of resolvedTerminalBackground) is the only area worth a second look before merge. Important Files Changed
Sequence DiagramsequenceDiagram
participant PTY as PTY App
participant Runner as PTY Server Go
participant WS as WebSocket
participant XTerm as xterm.js
participant CSS as CSS --terminal-bg
PTY->>Runner: OSC 11 rgb set BEL via stdout
Note over Runner: readPTY acquires s.mu<br/>terminalColors.write(data)<br/>bgSeq stored
Note over Runner: New browser connects<br/>handleWS acquires s.mu<br/>colorSeq = backgroundReplaySeq()
Runner->>WS: BSU + modeSeq + resetSeq + colorSeq + snapshot + ESU
WS->>XTerm: frame bytes
XTerm->>XTerm: parse OSC 11 payload
XTerm->>CSS: oscBackgroundDisposable fires
CSS->>CSS: --terminal-bg set to dynamic color
PTY->>Runner: OSC 111 BEL restore via stdout
Note over Runner: terminalColors.write()<br/>bgSeq cleared
Runner->>WS: live OSC 111 forwarded
WS->>XTerm: parse OSC 111
XTerm->>CSS: oscBackgroundRestoreDisposable fires
CSS->>CSS: --terminal-bg reset to fallback
Note over CSS: Session switch also calls<br/>applyTerminalBackground to reset
Reviews (1): Last reviewed commit: "fix(web): preserve dynamic terminal back..." | Re-trigger Greptile |
Summary
Validation
corepack pnpm --filter @jump/web test -- terminal-colors.test.ts(Vitest full @jump/web suite: 26 files, 409 tests)TMPDIR=/tmp GOWORK=$PWD/go.work go test -v ./cli/jump/internal/ptyserver -run 'TestTerminalColorTracker|TestPTYServerReconnectSnapshotReplaysTerminalBackground'TMPDIR=/tmp GOWORK=$PWD/go.work go test ./cli/jump/internal/ptyserver ./services/jumpd/internal/wsproxy ./services/jumpd/cmd/jumpdcorepack pnpm --filter @jump/web lintcorepack pnpm --filter @jump/web buildgit diff --checkjumpd 1.15.0 (ready).terminal-shell --terminal-bgas#123456without live injection.