Repository navigation
Terminal
Toshon edited this page Jun 20, 2026
·
1 revision
Perci includes a built-in terminal — a full shell running in a PTY, accessible without leaving the workspace.
-
terminal-server.cjsspawns a PTY (pseudo-terminal) session - Output is broadcast over WebSocket to connected clients
- The renderer (
src/components/Terminal.jsx) connects viasrc/lib/terminalBridge.js - Terminal sessions are managed by
src/lib/terminalBridge.js
| Port | Purpose |
|---|---|
| 3001 | Primary terminal server (WebSocket) |
| 3002 | Fallback terminal server |
The active port is remembered in localStorage (perci_terminal_port).
Hermes mode includes a multitab terminal (src/components/TerminalTabs.jsx):
- Up to 6 PTY sessions
- Each tab has a unique
sessionId - Inactive tabs stay mounted so shells survive tab switches
- Per-tab connection status dots
- Reset/Reconnect per active tab
- Open the global terminal from the top bar (Terminal icon)
- Open Hermes terminal tabs from the Hermes window → Terminal tab
- Type any shell command — it runs in a real PTY
- Output is streamed in real-time
- Command history is recorded in Mission Control (for audit trails)
Garbled output / doubled echo: This was caused by React StrictMode mounting the terminal component twice, creating two WebSocket sessions writing to the same PTY. Fixed in Terminal.jsx by detaching the previous socket before opening a new one.
Port conflicts: If port 3001 is in use, Perci tries 3002. Check with:
lsof -iTCP:3001 -sTCP:LISTEN
lsof -iTCP:3002 -sTCP:LISTEN