diff options
Diffstat (limited to 'src/api/schema')
| -rw-r--r-- | src/api/schema/agents.rs | 23 | ||||
| -rw-r--r-- | src/api/schema/events.rs | 4 | ||||
| -rw-r--r-- | src/api/schema/integrations.rs | 19 | ||||
| -rw-r--r-- | src/api/schema/response.rs | 1 | ||||
| -rw-r--r-- | src/api/schema/tests.rs | 26 |
5 files changed, 70 insertions, 3 deletions
diff --git a/src/api/schema/agents.rs b/src/api/schema/agents.rs index 8592e56b..59949293 100644 --- a/src/api/schema/agents.rs +++ b/src/api/schema/agents.rs @@ -17,9 +17,26 @@ pub struct AgentReadParams { } #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)] -pub struct AgentSendParams { +pub struct AgentSendKeysParams { pub target: String, - pub text: String, + pub keys: Vec<String>, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)] +pub struct AgentWaitParams { + pub target: String, + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub until: Vec<AgentStatus>, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout_ms: Option<u64>, +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)] +pub struct AgentPromptWaitOptions { + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub until: Vec<AgentStatus>, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub timeout_ms: Option<u64>, } #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)] @@ -45,6 +62,8 @@ pub struct AgentStartParams { pub struct AgentPromptParams { pub target: String, pub text: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub wait: Option<AgentPromptWaitOptions>, } #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)] diff --git a/src/api/schema/events.rs b/src/api/schema/events.rs index 25ccc8ec..50b5d522 100644 --- a/src/api/schema/events.rs +++ b/src/api/schema/events.rs @@ -520,6 +520,10 @@ pub enum EventData { workspace_id: String, #[serde(default, skip_serializing_if = "Option::is_none")] agent: Option<String>, + #[serde(default, skip_serializing_if = "std::ops::Not::not")] + released: bool, + #[serde(default, skip_serializing_if = "Option::is_none")] + final_status: Option<AgentStatus>, }, PaneAgentStatusChanged { pane_id: String, diff --git a/src/api/schema/integrations.rs b/src/api/schema/integrations.rs index f20b9095..5a267ff1 100644 --- a/src/api/schema/integrations.rs +++ b/src/api/schema/integrations.rs @@ -29,6 +29,25 @@ pub enum IntegrationTarget { Mastracode, } +impl IntegrationTarget { + pub(crate) const ALL: [Self; 14] = [ + Self::Pi, + Self::Omp, + Self::Claude, + Self::Codex, + Self::Copilot, + Self::Devin, + Self::Droid, + Self::Kimi, + Self::Opencode, + Self::Kilo, + Self::Hermes, + Self::Qodercli, + Self::Cursor, + Self::Mastracode, + ]; +} + #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)] pub struct IntegrationInstallResult { pub messages: Vec<String>, diff --git a/src/api/schema/response.rs b/src/api/schema/response.rs index ad058191..e1f47efd 100644 --- a/src/api/schema/response.rs +++ b/src/api/schema/response.rs @@ -103,7 +103,6 @@ pub enum ResponseResult { }, AgentPrompted { agent: AgentInfo, - baseline_state_change_seq: u64, }, AgentList { agents: Vec<AgentInfo>, diff --git a/src/api/schema/tests.rs b/src/api/schema/tests.rs index 232c2b73..236d4f12 100644 --- a/src/api/schema/tests.rs +++ b/src/api/schema/tests.rs @@ -86,6 +86,7 @@ fn agent_start_and_prompt_requests_round_trip() { method: Method::AgentPrompt(AgentPromptParams { target: "reviewer".into(), text: "review this".into(), + wait: None, }), }; let prompt_json = serde_json::to_value(&prompt).unwrap(); @@ -94,6 +95,31 @@ fn agent_start_and_prompt_requests_round_trip() { serde_json::from_value::<Request>(prompt_json).unwrap(), prompt ); + + let prompt_and_wait = Request { + id: "prompt-and-wait".into(), + method: Method::AgentPrompt(AgentPromptParams { + target: "reviewer".into(), + text: "review this".into(), + wait: Some(AgentPromptWaitOptions { + until: vec![AgentStatus::Idle, AgentStatus::Done], + timeout_ms: Some(120_000), + }), + }), + }; + let prompt_and_wait_json = serde_json::to_value(&prompt_and_wait).unwrap(); + assert_eq!( + prompt_and_wait_json["params"]["wait"]["until"], + serde_json::json!(["idle", "done"]) + ); + assert_eq!( + prompt_and_wait_json["params"]["wait"]["timeout_ms"], + 120_000 + ); + assert_eq!( + serde_json::from_value::<Request>(prompt_and_wait_json).unwrap(), + prompt_and_wait + ); } #[test] |
