063a839790
- Add clone_mode and branch fields to tool_instances - Add ssh_key_id to git_repositories for per-repo SSH key assignment - Implement host-side git cloning with branch selection (default: main) - Mount SSH keys into containers for git operations in clone mode - Add dirty state check on clone-mode instance deletion with confirmation - Update SessionsPage with mount/clone selector, branch input, SSH key display - Add SSH key selector to repository creation form - Add dirty delete confirmation modal with changed files list - Update API schemas and endpoints for new fields - Sync delta specs to main specs (git-repo, tool-instances, repo-clone-mode) - Archive completed OpenSpec change: repo-clone-mode-with-ssh - Document git requirement for custom tool types Quality gates: Frontend typecheck and build passed OpenSpec: repo-clone-mode-with-ssh archived with all tasks complete
116 lines
3.5 KiB
Markdown
116 lines
3.5 KiB
Markdown
# Sessions Hub Specification
|
|
|
|
## Requirements
|
|
|
|
### Functional Requirements
|
|
|
|
1. **Sessions Tab**: Navigation item between Dashboard and Projects
|
|
2. **Active Sessions Display**: Show all running sessions with actions
|
|
3. **Last Session**: Prominently show last created/accessed session
|
|
4. **Quick Create**: Create sessions for any project from Sessions page
|
|
5. **Session Persistence**: Save last_session_id in user config
|
|
6. **Badge**: Show active session count in navigation
|
|
|
|
### Non-Functional Requirements
|
|
|
|
1. **Performance**: Load sessions in < 500ms
|
|
2. **Real-time**: Badge updates with active count
|
|
3. **Responsive**: Works on mobile and desktop
|
|
|
|
## API Specification
|
|
|
|
### Existing Endpoints Used
|
|
|
|
- `GET /users/me/sessions` - List all user sessions
|
|
- `POST /projects/{id}/repositories/{id}/instances` - Create instance
|
|
- `GET /projects` - List projects for selector
|
|
- `GET /projects/{id}/repositories` - List repos for selector
|
|
- `GET /tool-types` - List tool types for selector
|
|
- `GET /users/me/config` - Get user config (with last_session_id)
|
|
- `PATCH /users/me/config` - Update user config (last_session_id)
|
|
|
|
### User Config Schema Update
|
|
|
|
```python
|
|
class UserConfigUpdate(BaseModel):
|
|
theme: Optional[str] = None
|
|
default_editor: Optional[str] = None
|
|
git_user_name: Optional[str] = None
|
|
git_user_email: Optional[str] = None
|
|
last_session_id: Optional[str] = None # NEW
|
|
```
|
|
|
|
## UI Specification
|
|
|
|
### Sessions Page Layout
|
|
|
|
```
|
|
+------------------------------------------+
|
|
| Sessions [New Session]|
|
|
+------------------------------------------+
|
|
| |
|
|
| Last Session |
|
|
| +--------------------------------------+ |
|
|
| | VS Code Server - My Project [Open] | |
|
|
| | Running on port 8080 | |
|
|
| +--------------------------------------+ |
|
|
| |
|
|
| Active Sessions (3) |
|
|
| +----------+ +----------+ +----------+ |
|
|
| | Session 1| | Session 2| | Session 3| |
|
|
| | Running | | Running | | Running | |
|
|
| | [Open] | | [Open] | | [Open] | |
|
|
| +----------+ +----------+ +----------+ |
|
|
| |
|
|
| Recent Sessions |
|
|
| - Session 4 (stopped) |
|
|
| - Session 5 (stopped) |
|
|
| |
|
|
+------------------------------------------+
|
|
```
|
|
|
|
### Navigation Badge
|
|
|
|
```
|
|
[Dashboard] [Sessions (3)] [Projects] ...
|
|
```
|
|
|
|
Badge shows count of sessions with status === "running".
|
|
|
|
### Create Session Dialog
|
|
|
|
```
|
|
+------------------------------------------+
|
|
| Create New Session |
|
|
+------------------------------------------+
|
|
| Project: [Dropdown] |
|
|
| Repository: [Dropdown] |
|
|
| Tool Type: [Dropdown] |
|
|
| Name: [Input] |
|
|
| |
|
|
| [Cancel] [Create] |
|
|
+------------------------------------------+
|
|
```
|
|
|
|
## State Management
|
|
|
|
### Sessions Context (existing)
|
|
Already polls `/users/me/sessions` every 10s. Use this for:
|
|
- Active session count (badge)
|
|
- Active sessions list
|
|
- Recent sessions list
|
|
|
|
### User Config (existing)
|
|
Add `last_session_id` field. Update:
|
|
- On session creation
|
|
- On session open/resume
|
|
|
|
## Quality Gates
|
|
|
|
- TypeScript compilation passes
|
|
- ESLint passes
|
|
- All sessions load correctly
|
|
- Badge updates with active count
|
|
- Last session persists across reloads
|
|
- Create session works from Sessions page
|