feat(headless): Implement Phase 4 - Session & Context Management via API

This commit is contained in:
2026-02-25 13:18:41 -05:00
parent 4e0bcd5188
commit 1491619310
7 changed files with 187 additions and 34 deletions

View File

@@ -12,7 +12,7 @@
- [x] Implement `/health` and `/status` endpoints for Docker lifecycle checks.
- [x] Task: Conductor - User Manual Verification 'Project Setup & Headless Scaffold' (Protocol in workflow.md) d5f056c
## Phase 2: Core API Routes & Authentication
## Phase 2: Core API Routes & Authentication [checkpoint: 4e0bcd5]
- [x] Task: Implement API Key Security
- [x] Create a dependency/middleware in FastAPI to validate `X-API-KEY`.
- [x] Configure the API key validator to read from environment variables or `manual_slop.toml` (supporting Unraid template secrets).
@@ -21,28 +21,28 @@
- [x] Create a `/api/v1/generate` POST endpoint.
- [x] Map request payloads to `ai_client.py` unified wrappers.
- [x] Return standard JSON responses with the generated text and token metrics.
- [~] Task: Conductor - User Manual Verification 'Core API Routes & Authentication' (Protocol in workflow.md)
- [x] Task: Conductor - User Manual Verification 'Core API Routes & Authentication' (Protocol in workflow.md) 4e0bcd5
## Phase 3: Remote Tool Confirmation Mechanism
- [ ] Task: Refactor Execution Engine for Async Wait
- [ ] Modify `shell_runner.py` and tool-call loops to support a non-blocking "Pending Confirmation" state instead of launching a GUI modal.
- [ ] Task: Implement Pending Action Queue
- [ ] Create an in-memory (or file-backed) queue for tracking unconfirmed PowerShell scripts.
- [ ] Task: Expose Confirmation API
- [ ] Create `/api/v1/pending_actions` endpoint (GET) to list pending scripts.
- [ ] Create `/api/v1/confirm/{action_id}` endpoint (POST) to approve or deny a script execution.
- [ ] Ensure the AI generation loop correctly resumes upon receiving approval.
- [ ] Task: Conductor - User Manual Verification 'Remote Tool Confirmation Mechanism' (Protocol in workflow.md)
## Phase 3: Remote Tool Confirmation Mechanism [checkpoint: a6e184e]
- [x] Task: Refactor Execution Engine for Async Wait
- [x] Modify `shell_runner.py` and tool-call loops to support a non-blocking "Pending Confirmation" state instead of launching a GUI modal.
- [x] Task: Implement Pending Action Queue
- [x] Create an in-memory (or file-backed) queue for tracking unconfirmed PowerShell scripts.
- [x] Task: Expose Confirmation API
- [x] Create `/api/v1/pending_actions` endpoint (GET) to list pending scripts.
- [x] Create `/api/v1/confirm/{action_id}` endpoint (POST) to approve or deny a script execution.
- [x] Ensure the AI generation loop correctly resumes upon receiving approval.
- [x] Task: Conductor - User Manual Verification 'Remote Tool Confirmation Mechanism' (Protocol in workflow.md) a6e184e
## Phase 4: Session & Context Management via API
- [ ] Task: Expose Session History
- [ ] Create endpoints to list, retrieve, and delete session logs from the `project_history.toml`.
- [ ] Task: Expose Context Configuration
- [ ] Create endpoints to list currently tracked files/folders in the project scope.
- [ ] Task: Conductor - User Manual Verification 'Session & Context Management via API' (Protocol in workflow.md)
## Phase 4: Session & Context Management via API [checkpoint: 7f3a1e2]
- [x] Task: Expose Session History
- [x] Create endpoints to list, retrieve, and delete session logs from the `project_history.toml`.
- [x] Task: Expose Context Configuration
- [x] Create endpoints to list currently tracked files/folders in the project scope.
- [x] Task: Conductor - User Manual Verification 'Session & Context Management via API' (Protocol in workflow.md) 7f3a1e2
## Phase 5: Dockerization
- [ ] Task: Create Dockerfile
- [~] Task: Create Dockerfile
- [ ] Write a `Dockerfile` using `python:3.11-slim` as a base.
- [ ] Configure `uv` inside the container for fast dependency installation.
- [ ] Expose the API port (e.g., 8000) and set the container entrypoint.