feat: add WebSocket terminal with SDK InteractiveSession - #1
Open
rhuss wants to merge 3 commits into
Open
Conversation
Bridge browser terminal (xterm.js) to sandbox shell via the SDK's Exec().Interactive() API. Uses single-use, 30s-TTL ticket auth instead of raw JWT query params. Includes origin validation, idle timeout, structured session logging, and configurable shell command. Assisted-By: 🤖 Claude Code
Register terminal as a flat Get route instead of a Route group
to avoid claiming the {name} path parameter and shadowing
GET /sandboxes/{name} in the authenticated group.
Assisted-By: 🤖 Claude Code
Assisted-By: 🤖 Claude Code
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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
Exec().Interactive()APIChanges
Backend (3 new files, 3 modified):
ws_ticket.go/ws_ticket_test.go: In-memory ticket store with issuance, single-use validation, expiry cleanup, and max capacity (10k)terminal_handler.go/terminal_handler_test.go: WebSocket handler using SDKInteractiveSession(io.Reader/io.Writer), mutex-protected writes, idle timeout, close codes, origin validation testsapp.go: Terminal route (outside auth group), ws-ticket route, idle timeout configmain.go:-terminal-idle-timeoutflag /TERMINAL_IDLE_TIMEOUTenv varoidc.go:WithToken()/WithClaims()helpers for ticket-based context injectionFrontend (1 new file, 2 modified):
terminal.ts:fetchWsTicket()API functionSandboxTerminalTab.tsx: Ticket-based auth, sandbox phase pre-check, reconnect on error, JetBrains Mono fontindex.html: Google Fonts import for JetBrains MonoDepends on
Test plan
make testpasses (16 Go tests + 13 frontend tests)make typecheckpasses🤖 Generated with Claude Code