3.2 KiB
3.2 KiB
Implementation Plan: Expanded Hook API & Headless Orchestration
Phase 1: WebSocket Infrastructure & Event Streaming
- Task: Implement the WebSocket gateway.
- Integrate a lightweight WebSocket library (e.g.,
websocketsorsimple-websocket). - Create a dedicated
WebSocketServerclass insrc/api_hooks.pythat runs on a separate port (e.g., 9000). - Implement a basic subscription mechanism for different event channels.
- Integrate a lightweight WebSocket library (e.g.,
- Task: Connect the event queue to the WebSocket stream.
- Update
AsyncEventQueueto broadcast events to connected WebSocket clients. - Add high-frequency telemetry (FPS, CPU) to the event stream.
- Update
- Task: Write unit tests for WebSocket connection and event broadcasting.
- Task: Conductor - User Manual Verification 'Phase 1: WebSocket Infrastructure' (Protocol in workflow.md)
Phase 2: Expanded Read Endpoints (GET)
- Task: Implement detailed state exposure endpoints.
- Add
/api/mma/workersto return the status, logs, and traces of all active sub-agents. - Add
/api/context/stateto expose AST cache metadata and file aggregation status. - Add
/api/metrics/financialto return track-specific token usage and cost data. - Add
/api/system/telemetryto expose internal thread and queue metrics.
- Add
- Task: Enhance
/api/gui/stateto provide a truly exhaustive JSON dump of all internal managers. - Task: Update
api_hook_client.pywith corresponding methods for all new GET endpoints. - Task: Write integration tests for all new GET endpoints using
live_gui. - Task: Conductor - User Manual Verification 'Phase 2: Expanded Read Endpoints' (Protocol in workflow.md)
Phase 3: Comprehensive Control Endpoints (POST)
- Task: Implement worker and pipeline control.
- Add
/api/mma/workers/spawnto manually initiate sub-agent execution via the API. - Add
/api/mma/workers/killto programmatically abort running workers. - Add
/api/mma/pipeline/pauseand/api/mma/pipeline/resumeto control the global MMA loop.
- Add
- Task: Implement context and DAG mutation.
- Add
/api/context/injectto allow programmatic context injection (files/skeletons). - Add
/api/mma/dag/mutateto allow modifying task dependencies through the API.
- Add
- Task: Update
api_hook_client.pywith corresponding methods for all new POST endpoints. - Task: Write integration tests for all new control endpoints using
live_gui. - Task: Conductor - User Manual Verification 'Phase 3: Comprehensive Control Endpoints' (Protocol in workflow.md)
Phase 4: Headless Refinement & Verification
- Task: Improve error reporting.
- Refactor
HookHandlerto catch and wrap all internal exceptions in JSON error responses.
- Refactor
- Task: Conduct a full headless simulation.
- Create a specialized simulation script that replicates a full MMA track lifecycle (planning, worker spawn, DAG mutation, completion) using ONLY the Hook API.
- Task: Final performance audit.
- Ensure that active WebSocket clients and large state dumps do not cause GUI frame drops.
- Task: Conductor - User Manual Verification 'Phase 4: Headless Refinement & Verification' (Protocol in workflow.md)