feat(terminal): add bounded snapshot and history streaming - #189
Draft
Lint111 wants to merge 3 commits into
Draft
Conversation
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
Adds the server-side contracts for lossless, bounded terminal restoration and live delivery without loading an entire conversation into the browser.
Commit Structure
fix(stream): distinguish empty terminal subscriptionsfeat(terminal): add bounded snapshot and history streamingfix(terminal): preserve cursor boundaries across websocket framesDesign Notes
GET /api/sessions/:id/terminal?format=streamreturns terminal text outside the JSON envelope and places stream, generation, range, source, truncation, and status metadata in headers.historyPage=1captures one physical-row page from tmux. Capture uses asynchronousexecFilecalls, bounded output buffers, and argument arrays rather than a shell, so a history request does not block other sessions or accept shell interpolation.Live SSE and WebSocket batches use the same UTF-16 cursor units as JavaScript string slicing. Clients can queue output during a snapshot and deterministically discard overlap instead of relying on empty-buffer heuristics.
This PR is server/transport infrastructure. It intentionally excludes browser frame covers, lazy history rendering, session restoration metadata, repository browsing, Codex animation settings, and mobile controls; those are reviewed separately.
Validation
npm run buildnpm run typechecknpm run lintThe repository-wide integration suite was not run in this active clone: its current cleanup path can delete the checkout itself. That isolation issue is tracked separately in #175; focused tests here use mocks/injected runners and cannot access the user's tmux server.