From 8f144f3a811ab40e26514fe60fafbbdd35bad23d Mon Sep 17 00:00:00 2001 From: soryu Date: Sun, 1 Feb 2026 01:07:13 +0000 Subject: feat: Add Supervisor Status API endpoints (Phase 3 Task 3.5) Implement REST API endpoints for querying supervisor status: - GET /api/v1/contracts/{id}/supervisor/status Returns current supervisor status including task_id, state, phase, current_activity, progress, last_heartbeat, and pending_task_ids - GET /api/v1/contracts/{id}/supervisor/heartbeats?limit=10 Returns paginated supervisor activity history from history_events - POST /api/v1/contracts/{id}/supervisor/sync Triggers a sync to refresh the supervisor's last_activity timestamp New types added: - SupervisorStatusResponse - Status endpoint response - SupervisorHeartbeatEntry - Individual heartbeat history entry - SupervisorHeartbeatHistoryResponse - Heartbeat history with pagination - SupervisorSyncResponse - Sync endpoint response - HeartbeatHistoryQuery - Query params for heartbeats endpoint Repository helpers: - get_supervisor_status() - Combined info from supervisor_states and tasks - get_supervisor_activity_history() - Activity timeline from history_events - count_supervisor_activity_history() - Total count for pagination - sync_supervisor_state() - Refresh last_activity timestamp Error handling: - 404 for contract not found (CONTRACT_NOT_FOUND) - 404 for no supervisor (SUPERVISOR_NOT_FOUND) - Proper fallback when supervisor_state record doesn't exist but task does Co-Authored-By: Claude Opus 4.5 --- makima/src/server/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'makima/src/server/mod.rs') diff --git a/makima/src/server/mod.rs b/makima/src/server/mod.rs index 8456006..e5415ae 100644 --- a/makima/src/server/mod.rs +++ b/makima/src/server/mod.rs @@ -175,6 +175,10 @@ pub fn make_router(state: SharedState) -> Router { // Contract supervisor resume endpoints .route("/contracts/{id}/supervisor/resume", post(mesh_supervisor::resume_supervisor)) .route("/contracts/{id}/supervisor/conversation/rewind", post(mesh_supervisor::rewind_conversation)) + // Contract supervisor status endpoints + .route("/contracts/{id}/supervisor/status", get(contracts::get_supervisor_status)) + .route("/contracts/{id}/supervisor/heartbeats", get(contracts::get_supervisor_heartbeats)) + .route("/contracts/{id}/supervisor/sync", post(contracts::sync_supervisor)) // History endpoints .route("/contracts/{id}/history", get(history::get_contract_history)) .route("/contracts/{id}/supervisor/conversation", get(history::get_supervisor_conversation)) -- cgit v1.2.3