e344e961d6
- Add TerminalSession backend service for docker exec subprocess management
- Add TerminalManager for WebSocket session lifecycle management
- Create WebSocket endpoint at /ws/tool-instances/{id}/terminal
- Add session cookie authentication and instance ownership verification
- Install xterm.js with fit and web-links addons
- Create TerminalComponent with xterm.js integration
- Create TerminalPage with full-screen terminal view
- Add terminal route at /instances/:id/terminal
- Add terminal button to InstanceList for running instances
- Add terminal and arrow-left icons to icon registry
- Add comprehensive terminal CSS styles (dark theme, responsive)
Quality gates: typecheck ✓, lint ✓, build ✓, Python syntax ✓
1.9 KiB
1.9 KiB
Tool Instances with Sessions
Problem
Users currently have no way to launch development tools (code-server, Jupyter, etc.) directly from their repositories. The tool-types system exists but cannot create running container instances. Additionally, there's no concept of a "session" - a running tool linked to a specific repo that appears in navigation for quick access.
Solution
Implement a complete tool instance management system with sessions:
- ToolInstance Model - Links a ToolType to a GitRepository with status tracking
- Session Concept - A running ToolInstance that gets a top-level navigation entry
- Docker Integration - Render compose templates and execute docker compose commands
- Lifecycle Management - Start, stop, restart, and delete instances
- Navigation Integration - Active sessions appear in the app shell for quick access
Key Features
Tool Instance Creation
- Select a tool type and repository
- Generate unique instance name
- Render Docker Compose template with variables
- Execute
docker compose up -d - Store container metadata
Session Management
- Sessions are active/running instances
- Each session gets a top-level nav entry with the tool icon
- Session dropdown in app shell shows active sessions
- Clicking a session opens the tool in a new tab/window
Lifecycle Operations
- Start:
docker compose start - Stop:
docker compose stop - Restart:
docker compose restart - Delete:
docker compose down -v+ remove DB record
Status Monitoring
- pending, building, running, stopped, error
- Real-time status via Docker API
- Last accessed timestamp
Success Criteria
- Create tool instances from repository page
- Sessions appear in top-level navigation
- Start/stop/restart/delete instances
- Status monitoring works
- Docker Compose templates render correctly
- Navigation updates when sessions change