diff options
Diffstat (limited to 'makima/src/daemon/api')
| -rw-r--r-- | makima/src/daemon/api/supervisor.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/makima/src/daemon/api/supervisor.rs b/makima/src/daemon/api/supervisor.rs index 9614cfc..bd3aefd 100644 --- a/makima/src/daemon/api/supervisor.rs +++ b/makima/src/daemon/api/supervisor.rs @@ -249,6 +249,41 @@ impl ApiClient { .await } + /// Mark a contract as complete. + /// This will update contract status to 'completed', stop the supervisor, and clean up worktrees. + pub async fn supervisor_complete(&self, contract_id: Uuid) -> Result<JsonValue, ApiError> { + #[derive(Serialize)] + #[serde(rename_all = "camelCase")] + struct CompleteContractRequest { + status: String, + } + let req = CompleteContractRequest { + status: "completed".to_string(), + }; + self.put(&format!("/api/v1/contracts/{}", contract_id), &req) + .await + } + + /// Resume a completed contract (reactivate it). + /// + /// This updates the contract status from 'completed' back to 'active' + /// and optionally respawns the supervisor task. + pub async fn supervisor_resume_contract( + &self, + contract_id: Uuid, + ) -> Result<JsonValue, ApiError> { + #[derive(Serialize)] + #[serde(rename_all = "camelCase")] + struct ResumeContractRequest { + status: String, + } + let req = ResumeContractRequest { + status: "active".to_string(), + }; + self.put(&format!("/api/v1/contracts/{}", contract_id), &req) + .await + } + /// Delete a task. pub async fn delete_task(&self, task_id: Uuid) -> Result<(), ApiError> { self.delete(&format!("/api/v1/mesh/tasks/{}", task_id)).await |
