Repository navigation
feat(terminal): host Claude PTY terminal behind a flag - #414
Merged
Merged
Conversation
Add handleClaudeHostWS: a browser terminal bridged to an interactive
`claude` TUI running on the host in the project's workspace, mirroring
handleHostWS's persistent per-project tmux session (isolated host socket,
create-on-first-open, reattach thereafter) but with `claude` as the
session's pane command instead of a shell. This gives slash commands,
/login, permission prompts, plan mode and the status line natively — the
groundwork for replacing the bespoke ChatDock host chat with a real
terminal.
Gated behind CORRAL_HOST_CLAUDE_TERMINAL=1 while it's brought up
alongside the existing chat; the flag is removed once it replaces the
chat UI. Route: /p/{id}/claude/ws. Session name is a distinct "-claude"
suffix so its sizing/pane stay independent of the dev + host-shell
sessions.
Reuses the existing bridgePTY byte pump, resize hook, and
resolveClaudeBin locator unchanged. NOT sandboxed (same trust terms as
the host shell: loopback-only, token-gated, same-origin WS).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Sep 24, 2026
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.
What
Adds
handleClaudeHostWS— a browser terminal bridged to an interactiveclaudeTUI running on the host in the project's workspace directory. It mirrorshandleHostWS(persistent per-project tmux session on the isolated host socket, created on first open and reattached thereafter) but the session's pane runs the realclaudeTUI instead of a shell.This is branch 1 of 4 in replacing the bespoke ChatDock host chat with a real terminal. With a real PTY, slash commands,
/login, permission prompts, plan mode, and the status line all work natively — no chat rendering to keep at parity (and the401 OAuth revoked→/loginflow Just Works).Details
/p/{id}/claude/ws-claudesuffix so window sizing/pane stay independent of the dev + host-shell sessionsbridgePTYbyte pump, resize hook, andresolveClaudeBinunchangedCORRAL_HOST_CLAUDE_TERMINAL=1while brought up alongside the existing chat; flag removed once it replaces the chat UI (branch 4)Security
NOT sandboxed — same trust terms as the existing host shell (
handleHostWS): dashboard is loopback-only + token-gated, WebSocket is same-origin only (terminalUpgrader.CheckOrigin). The claude permission gate (interactive prompts here) remains the real guardrail. A loudened trust banner lands with the frontend branch.Follow-ups (later branches)
handleTerminalActionsplit/clear right-click wiring for the new terminal (frontend branch); the"claude"kind name currently overloads the container dev sessionTest
terminal_claude_test.go— session-name distinctness/stability + flag gate.go build,go vet, tests green.🤖 Generated with Claude Code