feat(desktop): add headless terminal for backend PTY state persistence#66
Merged
feat(desktop): add headless terminal for backend PTY state persistence#66
Conversation
29a609d to
9e6fd45
Compare
- Add HeadlessTerminal class wrapping @xterm/headless with mode tracking (DECSET/DECRST), OSC-7 CWD parsing, and snapshot serialization - Integrate headless terminal into TerminalManager for state mirroring - Add terminal.snapshot RPC endpoint for frontend state sync - Add @xterm/headless and @xterm/addon-serialize dependencies - Add planning docs for PTY persistence approaches Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019c3ba0-841a-74ee-bc0f-57c5e59fda40
9e6fd45 to
2a23eda
Compare
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
Add backend PTY state persistence using
@xterm/headlessand@xterm/addon-serialize. This enables seamless terminal state restoration during tab switching.Changes
New Files
apps/desktop/src/main/terminal/headless-terminal.ts— HeadlessTerminal class with mode tracking (DECSET/DECRST), OSC-7 CWD parsing, and snapshot serializationapps/desktop/src/main/terminal/types.ts— TerminalModes and TerminalSnapshot type definitionsdocs/plans/2026-02-05-feat-backend-pty-persistence-plan.mddocs/plans/2026-02-05-feat-rust-pty-daemon-plan.mdModified Files
apps/desktop/src/main/terminal/terminal-manager.ts— Integrate HeadlessTerminal into TerminalInstance, mirror PTY output to headless for state trackingapps/desktop/src/shared/contract/terminal.ts— Add TerminalSnapshotSchema andterminal.snapshotRPC endpointapps/desktop/src/main/ipc/router/terminal.ts— Add snapshot handlerapps/desktop/src/main/terminal/index.ts— Export new typesapps/desktop/package.json— Add@xterm/headless,@xterm/addon-serializedepsHow It Works
Note
typecheck:webfailures are pre-existing on main (store naming mismatch:currentTaskIdvsselectedTaskId), unrelated to this PR.