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

@@ -40,6 +40,9 @@ const {
switchAgent,
selectSession,
createNewSession,
startTerminal,
parkCurrentTerminal,
fetchSessionContent,
switchToTerminal,
closeTerminal,
disconnectRealtime,
@@ -468,7 +471,11 @@ async function handleModalResume(sessionId: string, agent: AgentName) {
if (agent !== selectedAgent.value) {
await switchAgent(agent)
}
selectSession(sessionId)
// Load transcript + create terminal with --resume
parkCurrentTerminal()
selectedSessionId.value = sessionId
await fetchSessionContent(sessionId)
await startTerminal(sessionId)
}
// ============================================================================