- settings.json: opencode enabled true (binary already installed; was disabled)
- terminal.js: point WebSocket at /ws/terminal on the main server (was dead 8082),
switch message protocol action:/type: -> type: to match PtySession backend
The previous Terminal ran one command at a time via subprocess.run
and returned its output - it couldn't run interactive programs
(colors, live input, TUIs like gemini's chat/auth flow), which is
what a terminal actually needs to do.
Backend: new /ws/terminal WebSocket endpoint spawns a real shell
attached to a pseudo-terminal (stdlib pty on POSIX, pywinpty/ConPTY
on Windows) and streams raw I/O bidirectionally, with resize support.
Replaces the old POST /api/terminal/run and GET /api/terminal/session
endpoints entirely.
Frontend: terminal.js now loads xterm.js + the fit addon from CDN
and renders a real terminal emulator wired to the WebSocket, instead
of a scrollback div with a single input line.
Verified on this Linux sandbox via raw WebSocket tests: shell spawns
correctly, commands execute and echo real output, resize propagates
to the PTY (confirmed via ), and closing the connection
cleanly kills the shell process with no orphans (interactive bash
ignores SIGTERM by default, so cleanup uses SIGKILL). Could not
visually verify the xterm.js browser rendering in this sandbox since
its egress policy blocks the CDN (cdn.jsdelivr.net) outright - same
CDN this app already uses for chart.js, so expected to work on a
normal machine; please confirm on Windows.
Adds a real shell terminal to the dashboard sidebar: POST
/api/terminal/run executes a command via subprocess in a
server-tracked working directory (with cd support), and GET
/api/terminal/session returns the current cwd. The frontend renders
a scrollback panel with command history (up/down arrows) styled to
match the existing chat UI.
Local-only power feature: it executes arbitrary shell commands, same
trust model as the existing agent CLIs the dashboard already shells
out to.