diff options
Diffstat (limited to 'makima/src/daemon/api')
| -rw-r--r-- | makima/src/daemon/api/supervisor.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/makima/src/daemon/api/supervisor.rs b/makima/src/daemon/api/supervisor.rs index b691cc4..a1e8682 100644 --- a/makima/src/daemon/api/supervisor.rs +++ b/makima/src/daemon/api/supervisor.rs @@ -62,6 +62,17 @@ pub struct CheckpointRequest { pub message: String, } +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +pub struct AskQuestionRequest { + pub question: String, + #[serde(skip_serializing_if = "Vec::is_empty")] + pub choices: Vec<String>, + #[serde(skip_serializing_if = "Option::is_none")] + pub context: Option<String>, + pub timeout_seconds: i32, +} + // Generic response type for JSON output #[derive(Deserialize, Serialize)] pub struct JsonValue(pub serde_json::Value); @@ -183,4 +194,21 @@ impl ApiClient { self.get(&format!("/api/v1/contracts/{}/daemon/status", contract_id)) .await } + + /// Ask a question and wait for user feedback. + pub async fn supervisor_ask( + &self, + question: &str, + choices: Vec<String>, + context: Option<String>, + timeout_seconds: i32, + ) -> Result<JsonValue, ApiError> { + let req = AskQuestionRequest { + question: question.to_string(), + choices, + context, + timeout_seconds, + }; + self.post("/api/v1/mesh/supervisor/questions", &req).await + } } |
