VAPP-5: Browser terminal for devices over the agent relay #12
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/browser-terminal-vapp-5"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements VAPP-5: a browser terminal for devices over the agent relay.
What this does
Adds an in-page interactive shell to the device detail page. A new Terminal tab appears for online devices; clicking it opens a live shell rendered with xterm.js, with keystrokes round-tripping to the device agent's PTY.
How it works
open_terminal_tunnel(device_id)(src/server_fns/mod.rs): over the authenticated control channel it requestsauthcookie(mints the per-user logincookieand relayrcookie), generates a rendezvousid, and sends amsg/type:tunnel(usage 1 = Terminal) instructing the agent to dial vervain-server's relay (/api/v1/relay?id=...&rauth=<rcookie>&usage=1&agent_id=...). It awaits the routing ack so offline / missing-rights cases surface as a friendly error rather than a hung pane, then returns{relay_ws_url, tunnel_id, auth}. The browser connects DIRECTLY to vervain-server's relay (no apps-server hop), per the parity-review decision.assets/vendor/xterm/and served from the app's own assets (no CDN / external fetch). Pinned:@xterm/xterm6.0.0,@xterm/addon-fit0.11.0.TerminalPanecomponent (src/components/pages/terminal.rs) drives xterm.js and the relay WebSocket through thin wasm-bindgen bindings (Terminal,open,write,onData,onResize). It completes the relay rendezvous (waits for the'c'frame, replies with the protocol byte"1"), then pipes PTY output (Binary frames ->term.write), keystrokes (onData-> Binary frames), and resize (onResizeand a ResizeObserver -> the agent's{ctrlChannel:102938,type:"termsize",cols,rows}envelope, so resizing the pane resizes the PTY). Full-screen programs (vim, htop) render via xterm's VT100 engine.use_dropcloses the WebSocket, which the agent observes and uses to kill the PTY.Acceptance criteria
Verification
just checkmirror is green locally:cargo fmt --check,cargo clippy --all-targets --features server -- -D warnings(and clippy on the wasm target),cargo check --features server,cargo check --target wasm32-unknown-unknown,cargo test --features server --bin vervain-app. The wire protocol was matched against the vervain-servermeshrelay/user_sessionand vervain-agenthost::tunnelsources; runtime round-trip against a live agent is the reviewer's integration check.🤖 Generated with Claude Code