e7819bfc82
- Add docker-compose.yml with postgres, redis, api, and web services - Add multi-stage Dockerfile for API (Python 3.11) - Add multi-stage Dockerfile for web (Node.js 20 + nginx) - Add Makefile with common development commands - Add .env.example with all required environment variables - Add placeholder pyproject.toml and package.json for builds - Configure health checks for all services - Setup persistent volumes for postgres, redis, and repos - Run services as non-root users
1.9 KiB
1.9 KiB
Web Terminal Specification
Purpose
Provide browser-based terminal access to running tool containers.
Requirements
Requirement: WebSocket Terminal
The system SHALL provide terminal sessions via WebSocket.
Scenario: Open terminal
- GIVEN a running tool instance
- WHEN the user opens the terminal
- THEN a WebSocket connection is established
- AND a shell is spawned in the container via
docker exec
Requirement: Terminal I/O
The system SHALL stream terminal I/O via WebSocket.
Scenario: Command execution
- GIVEN an active terminal session
- WHEN the user types a command
- THEN stdin is forwarded to the container shell
- AND stdout/stderr is streamed back to the browser
Requirement: Terminal Resize
The system SHALL support terminal resize events.
Scenario: Resize terminal
- GIVEN an active terminal session
- WHEN the browser window is resized
- THEN the terminal dimensions (COLS, ROWS) are updated
- AND the shell receives the new size
Requirement: Session Management
The system SHALL manage terminal sessions.
Scenario: Multiple sessions
- GIVEN a running tool instance
- WHEN multiple terminals are opened
- THEN each has an independent session
Scenario: Cleanup
- GIVEN an active terminal session
- WHEN the user disconnects
- THEN the session is cleaned up
- AND the shell process is terminated
Requirement: Access Control
The system SHALL restrict terminal access.
Scenario: Unauthorized access
- GIVEN a tool instance owned by user A
- WHEN user B tries to access the terminal
- THEN the connection is rejected with 403
Dependencies
- tool-instances (running containers)
- auth-oauth (authentication)
- xterm.js frontend library
- ptyprocess for pseudo-TTY
Quality Gates
pytestmust passmypy .must passruff check .must passnpm run typecheckmust passnpm run lintmust pass