Skip to content

feat: add live terminal with xterm.js and WebSocket (#310)#337

Merged
OneStepAt4time merged 2 commits intomainfrom
feat-310-live-terminal
Mar 27, 2026
Merged

feat: add live terminal with xterm.js and WebSocket (#310)#337
OneStepAt4time merged 2 commits intomainfrom
feat-310-live-terminal

Conversation

@OneStepAt4time
Copy link
Copy Markdown
Owner

Summary

  • Replace static PanePreview with interactive LiveTerminal component using xterm.js
  • Connect to backend WebSocket endpoint /v1/sessions/:id/terminal for real-time pane streaming
  • Add ResilientWebSocket utility with exponential backoff reconnection (mirrors ResilientEventSource pattern)
  • Enable WebSocket proxy (ws: true) in Vite dev server config

Changes

  • dashboard/src/components/session/LiveTerminal.tsx β€” New component: xterm.js terminal with WS connection, auto-fit via ResizeObserver, input forwarding, connection state indicator
  • dashboard/src/api/resilient-websocket.ts β€” New utility: WebSocket wrapper with exponential backoff (1sβ†’30s), 5min give-up timeout, reconnection callbacks
  • dashboard/src/types/index.ts β€” Add WS message types (WsPaneMessage, WsStatusMessage, WsErrorMessage, WsInputMessage, WsResizeMessage)
  • dashboard/vite.config.ts β€” Add ws: true to proxy config for WebSocket support
  • dashboard/src/pages/SessionDetailPage.tsx β€” Swap PanePreview for LiveTerminal in Terminal tab

Test plan

  • npx tsc --noEmit passes (dashboard)
  • npm run build passes (dashboard)
  • All 16 existing tests pass
  • Manual: open session detail β†’ Terminal tab β†’ verify live pane streaming
  • Manual: resize browser window β†’ verify terminal auto-fits
  • Manual: type in terminal β†’ verify input forwarded to Claude session
  • Manual: kill server β†’ verify reconnection with backoff
  • Manual: verify connection state indicator (connecting/reconnecting/ws live/disconnected)

Closes #310

Generated by Hephaestus (Aegis dev agent)

Replace static PanePreview with interactive LiveTerminal component
using xterm.js connected to the backend WebSocket endpoint. Includes
exponential backoff reconnection, auto-fit on resize, and input
forwarding to the Claude Code session.

Generated by Hephaestus (Aegis dev agent)
Extract a MockWebSocket interface extending WebSocket with the
test-only properties (_sent, _setReadyState, _emit) so the mock
factory has proper typing without relying on `as unknown as WebSocket`.

Generated by Hephaestus (Aegis dev agent)
@OneStepAt4time OneStepAt4time merged commit 46625d5 into main Mar 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Live terminal view via WebSocket

1 participant