feat(headless): Implement Phase 2 - Core API Routes & Authentication

This commit is contained in:
2026-02-25 13:09:22 -05:00
parent d5f056c3d1
commit 4e0bcd5188
6 changed files with 152 additions and 28 deletions

View File

@@ -1,27 +1,27 @@
# Implementation Plan: Manual Slop Headless Backend
## Phase 1: Project Setup & Headless Scaffold
## Phase 1: Project Setup & Headless Scaffold [checkpoint: d5f056c]
- [x] Task: Update dependencies (02fc847)
- [x] Add `fastapi` and `uvicorn` to `pyproject.toml` (and sync `requirements.txt` via `uv`).
- [x] Task: Implement headless startup
- [x] Modify `gui_2.py` (or create `headless.py`) to parse a `--headless` CLI flag.
- [x] Update config parsing in `config.toml` to support headless configuration sections.
- [x] Bypass Dear PyGui initialization if headless mode is active.
- [~] Task: Create foundational API application
- [ ] Set up the core FastAPI application instance.
- [ ] Implement `/health` and `/status` endpoints for Docker lifecycle checks.
- [ ] Task: Conductor - User Manual Verification 'Project Setup & Headless Scaffold' (Protocol in workflow.md)
- [x] Task: Create foundational API application
- [x] Set up the core FastAPI application instance.
- [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
- [ ] Task: Implement API Key Security
- [ ] Create a dependency/middleware in FastAPI to validate `X-API-KEY`.
- [ ] Configure the API key validator to read from environment variables or `manual_slop.toml` (supporting Unraid template secrets).
- [ ] Add tests for authorized and unauthorized API access.
- [ ] Task: Implement AI Generation Endpoint
- [ ] Create a `/api/v1/generate` POST endpoint.
- [ ] Map request payloads to `ai_client.py` unified wrappers.
- [ ] 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: 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).
- [x] Add tests for authorized and unauthorized API access.
- [x] Task: Implement AI Generation Endpoint
- [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)
## Phase 3: Remote Tool Confirmation Mechanism
- [ ] Task: Refactor Execution Engine for Async Wait