diff options
| author | soryu <soryu@soryu.co> | 2026-02-01 01:31:04 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-01 01:31:04 +0000 |
| commit | 65eebd078af712d004a5a9e28863a16df30792a6 (patch) | |
| tree | 3a9457f8e2bcfb0a85a7177d55686ec41bebcf89 /makima/src/daemon | |
| parent | 15d680a8a3c22be03a8faacd7bd43214e62a37f4 (diff) | |
| parent | 5055b3f06d8027870b64abd84d9d3875070372e0 (diff) | |
| download | soryu-65eebd078af712d004a5a9e28863a16df30792a6.tar.gz soryu-65eebd078af712d004a5a9e28863a16df30792a6.zip | |
Merge pull request #55 from soryu-co/makima/contract-management-phase3
feat: Implement Phase 3 - Supervisor Resilience and State Management
Diffstat (limited to 'makima/src/daemon')
| -rw-r--r-- | makima/src/daemon/ws/protocol.rs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/makima/src/daemon/ws/protocol.rs b/makima/src/daemon/ws/protocol.rs index bfe6326..5c88038 100644 --- a/makima/src/daemon/ws/protocol.rs +++ b/makima/src/daemon/ws/protocol.rs @@ -2,6 +2,7 @@ //! //! These types mirror the server's protocol exactly for compatibility. +use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; use uuid::Uuid; @@ -26,6 +27,29 @@ pub enum DaemonMessage { active_tasks: Vec<Uuid>, }, + /// Enhanced supervisor heartbeat with detailed state. + /// Sent periodically by supervisor tasks to report their current state. + SupervisorHeartbeat { + #[serde(rename = "taskId")] + task_id: Uuid, + #[serde(rename = "contractId")] + contract_id: Uuid, + /// Supervisor state: initializing, idle, working, waiting_for_user, waiting_for_tasks, blocked, completed, failed, interrupted + state: String, + /// Current contract phase + phase: String, + /// Description of current activity + #[serde(rename = "currentActivity")] + current_activity: Option<String>, + /// Progress percentage (0-100) + progress: u8, + /// Task IDs the supervisor is waiting on + #[serde(rename = "pendingTaskIds")] + pending_task_ids: Vec<Uuid>, + /// Timestamp of this heartbeat + timestamp: DateTime<Utc>, + }, + /// Task output streaming (stdout/stderr from Claude Code). TaskOutput { #[serde(rename = "taskId")] @@ -857,6 +881,28 @@ impl DaemonMessage { pub fn revoke_tool_key(task_id: Uuid) -> Self { Self::RevokeToolKey { task_id } } + + /// Create a supervisor heartbeat message. + pub fn supervisor_heartbeat( + task_id: Uuid, + contract_id: Uuid, + state: &str, + phase: &str, + current_activity: Option<String>, + progress: u8, + pending_task_ids: Vec<Uuid>, + ) -> Self { + Self::SupervisorHeartbeat { + task_id, + contract_id, + state: state.to_string(), + phase: phase.to_string(), + current_activity, + progress, + pending_task_ids, + timestamp: Utc::now(), + } + } } #[cfg(test)] |
