Repository navigation
feat(terminal): real PTY with xterm.js, splits and persisted scrollback (#1493 F) - #1499
Conversation
@lydell/node-pty is an N-API prebuild per platform, so no Electron ABI rebuild. package-app.sh copies the darwin-arm64 binary (signed by the existing nested Mach-O walk); package-cross.sh fetches the linux-x64 and win32-x64 (ConPTY) packages with npm pack. verify-package.sh now forks a PTY under the packaged, signed binary. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… scrollback (#1493) electron/terminal.js now runs each shell in a PTY (pipe fallback with a small cooked-mode editor when the addon does not load), keyed by (thread, terminal) so a thread can have several. Output stays raw for xterm, is capped at 5k lines, pushed in ~16 ms batches on terminal:data, and flushed to <userData>/terminals so it replays after a restart. New IPC: terminal.resize and terminal.list; write is raw keystrokes. A live shell whose thread moved to another checkout is flagged staleRoot (#1183), and SSH projects get an explicit unsupported message instead of a local shell (#1184). TerminalPane lazy-loads xterm (fit, web links, theme from CSS tokens, Cmd/Ctrl+Shift+C copy) and renders up to four side-by-side splits. Co-Authored-By: Claude Opus 5.5 <[email protected]>
terminal:data joins the web wire push list (wireClient.on throws for unlisted channels, which would crash the pane on Solenta Web). A pending flush no longer recreates a closed terminal's log, and reopening an exited shell carries its scrollback over. Packaging comment no longer names the signing script before the speech step (ordering test). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 16dc49eb14
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| t.onData((data) => { | ||
| void api.write({ threadId, termId, data }).catch(() => {}); | ||
| }), |
There was a problem hiding this comment.
Prevent offline raw keystrokes from being deduplicated
In Solenta Web, each xterm input event is now a separate terminal:write invocation, but createWireCoder queues calls while disconnected and deduplicates identical channel/argument signatures when reconnecting (src/wireClient.ts:65-87). Consequently, repeated keystrokes entered during an outage are collapsed—for example, typing hello can replay as helo—and an Enter key may later execute the corrupted command. Terminal input needs ordered, non-deduplicated buffering or terminal:write must bypass the generic offline queue.
Useful? React with 👍 / 👎.
| const offPush = api.onData((p) => { | ||
| if (!live || p.threadId !== threadId || p.termId !== termId || cursor < 0) return; | ||
| setRunning(p.running); | ||
| if (p.cursor <= cursor || !term) return; | ||
| if (p.from > cursor) return resync(); |
There was a problem hiding this comment.
Resync terminal state after WebSocket reconnection
For Solenta Web, this pane now reads only when a later push exposes a cursor gap, while the reconnect path in src/wireClient.ts:156-163 resynchronizes threads only. If output is produced—or the shell exits—while the WebSocket is disconnected and the terminal is quiet afterward, no later push arrives to trigger resync(), so the pane permanently omits that output and can continue showing the shell as running. Reconnect should explicitly re-read active terminals or emit a terminal resync signal.
Useful? React with 👍 / 👎.
Item F of #1493. It covers part of #1183 (the "Restart to move" warning when the thread changes checkout) and #1184 (SSH projects show an explicit not-available message).
What changed
electron/terminal.jsnow runs each shell in a PTY via@lydell/node-pty(prebuilt binaries for each platform, so no Electron rebuild), with resize. Several terminals per thread are allowed, scrollback is capped at 5,000 lines, and output streams through a new batchedterminal:datapush instead of 250 ms polling. Scrollback is saved under<userData>/terminals/and replays after a restart.verify-package.shopens a PTY).pty.nodeandspawn-helperare signed by the existing per-file walk incodesign-app.sh(no--deep). I checked both: Developer ID, hardened runtime flag, andcodesign --verify --deep --stricton the bundle passes.package-cross.shdownloads the Linux and Windows prebuilds from npm at the pinned version.Verified independently, on main merged with this branch and #1498:
vite buildpasses.terminal:datato the push allowlist opens no new channel; it just makes the pane work in Solenta Web.Risks and follow-ups
@lydell/node-ptyis a beta (1.2.0-beta.15), pinned exactly.🤖 Generated with Claude Code