feat(api): add terminal WebSocket gateway with PTY session management
Some checks failed
ci/woodpecker/push/orchestrator Pipeline failed
ci/woodpecker/push/web Pipeline failed
ci/woodpecker/push/api Pipeline failed

Implements CT-TERM-001: WebSocket-based terminal service that spawns real
shell sessions via node-pty and streams I/O to connected clients.

- Add node-pty dependency and configure pnpm build permissions
- Create TerminalModule with Gateway, Service, and DTOs
- TerminalGateway: /terminal namespace, auth via handshake token,
  workspace-scoped rooms, handles terminal:create/input/resize/close events
- TerminalService: manages IPty sessions per workspace with max 10 session
  limit, cleanup on disconnect
- DTOs: CreateTerminalDto, TerminalInputDto, TerminalResizeDto, CloseTerminalDto
  with class-validator decorators
- Unit tests: 25 gateway tests + 23 service tests (all passing)
- Register TerminalModule in AppModule

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-25 20:24:19 -06:00
parent 9f4de1682f
commit fd38fc94d0
9 changed files with 1637 additions and 4 deletions

View File

@@ -66,6 +66,7 @@
"marked-gfm-heading-id": "^4.1.3",
"marked-highlight": "^2.2.3",
"matrix-bot-sdk": "^0.8.0",
"node-pty": "^1.0.0",
"ollama": "^0.6.3",
"openai": "^6.17.0",
"reflect-metadata": "^0.2.2",