feat: server-first terminal creation, broadcast-only WS clients

- Add POST /create-terminal endpoint with MAX_TERMINALS=5 limit
- Server creates PTY, runs command, registers and broadcasts atomically
- Frontend startTerminal() calls server first, connects in reconnect mode
- Remove registerTerminalOnServer() — server handles registration
- Separate broadcast-only WS clients from PTY clients (no phantom "main" PTY)
- All broadcast functions use broadcastToAll() helper
- Fix resume existing flow to create terminal with --resume flag
This commit is contained in:
2026-02-21 00:17:24 -06:00
parent a6c68f1b9e
commit 2aec892f62
4 changed files with 171 additions and 125 deletions

View File

@@ -9,6 +9,7 @@ export const SHELL = process.platform === 'win32' ? 'powershell.exe' : 'bash'
export const SHELL_ARGS = process.platform === 'win32' ? ['-NoLogo', '-NoProfile'] : []
export const DEFAULT_SESSION_ID = 'main'
export const MAX_BUFFER_LINES = 10000
export const MAX_TERMINALS = 5
// Database
export const DB_PATH = 'agent-ui.db'