aboutsummaryrefslogtreecommitdiff
path: root/src/api/schema.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-06-10 15:24:24 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-06-10 15:33:45 +0300
commit36a1b7f86444871f0c38ff36510a6e3c2eec48c6 (patch)
tree4a2d100eef7f26af7feaa93ce661423c3994c54e /src/api/schema.rs
parent8d13492926829c5cf0ea42c8613344cd65ff59fa (diff)
feat: distribute agent detection manifests
Diffstat (limited to 'src/api/schema.rs')
-rw-r--r--src/api/schema.rs87
1 files changed, 87 insertions, 0 deletions
diff --git a/src/api/schema.rs b/src/api/schema.rs
index 33040248..0eb2d8e2 100644
--- a/src/api/schema.rs
+++ b/src/api/schema.rs
@@ -6,6 +6,10 @@ pub mod panes;
pub use panes::*;
+fn is_false(value: &bool) -> bool {
+ !*value
+}
+
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Request {
pub id: String,
@@ -24,6 +28,10 @@ pub enum Method {
ServerLiveHandoff(ServerLiveHandoffParams),
#[serde(rename = "server.reload_config")]
ServerReloadConfig(EmptyParams),
+ #[serde(rename = "server.agent_manifests")]
+ ServerAgentManifests(EmptyParams),
+ #[serde(rename = "server.reload_agent_manifests")]
+ ServerReloadAgentManifests(EmptyParams),
#[serde(rename = "notification.show")]
NotificationShow(NotificationShowParams),
#[serde(rename = "workspace.create")]
@@ -64,6 +72,8 @@ pub enum Method {
AgentGet(AgentTarget),
#[serde(rename = "agent.read")]
AgentRead(AgentReadParams),
+ #[serde(rename = "agent.explain")]
+ AgentExplain(AgentTarget),
#[serde(rename = "agent.send")]
AgentSend(AgentSendParams),
#[serde(rename = "agent.rename")]
@@ -342,6 +352,7 @@ pub enum ReadSource {
Visible,
Recent,
RecentUnwrapped,
+ Detection,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
@@ -665,6 +676,9 @@ pub enum ResponseResult {
PaneRead {
read: PaneReadResult,
},
+ AgentExplain {
+ explain: serde_json::Value,
+ },
SubscriptionStarted {},
WaitMatched {
event: EventEnvelope,
@@ -687,6 +701,16 @@ pub enum ResponseResult {
target: IntegrationTarget,
details: IntegrationUninstallResult,
},
+ AgentManifestReload {
+ manifests: Vec<AgentManifestInfo>,
+ },
+ AgentManifestStatus {
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ last_check_unix: Option<u64>,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ last_result: Option<String>,
+ manifests: Vec<AgentManifestInfo>,
+ },
ConfigReload {
status: crate::config::ConfigReloadStatus,
diagnostics: Vec<String>,
@@ -695,6 +719,26 @@ pub enum ResponseResult {
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+pub struct AgentManifestInfo {
+ pub agent: String,
+ pub source: String,
+ pub source_kind: String,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub active_version: Option<String>,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub cached_remote_version: Option<String>,
+ pub local_override_shadowing_remote: bool,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub remote_update_result: Option<String>,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub remote_update_error: Option<String>,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub remote_last_checked_unix: Option<u64>,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub warning: Option<String>,
+}
+
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct WorkspaceInfo {
pub workspace_id: String,
pub number: usize,
@@ -764,6 +808,8 @@ pub struct AgentInfo {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub display_agent: Option<String>,
pub agent_status: AgentStatus,
+ #[serde(default, skip_serializing_if = "is_false")]
+ pub screen_detection_skipped: bool,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub custom_status: Option<String>,
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
@@ -1116,6 +1162,47 @@ mod tests {
}
#[test]
+ fn request_round_trips_for_server_reload_agent_manifests() {
+ let request = Request {
+ id: "req_reload_agent_manifests".into(),
+ method: Method::ServerReloadAgentManifests(EmptyParams::default()),
+ };
+
+ let json = serde_json::to_value(&request).unwrap();
+ assert_eq!(json["method"], "server.reload_agent_manifests");
+ let restored: Request = serde_json::from_value(json).unwrap();
+ assert_eq!(restored, request);
+ }
+
+ #[test]
+ fn request_round_trips_for_server_agent_manifests() {
+ let request = Request {
+ id: "req_agent_manifests".into(),
+ method: Method::ServerAgentManifests(EmptyParams::default()),
+ };
+
+ let json = serde_json::to_value(&request).unwrap();
+ assert_eq!(json["method"], "server.agent_manifests");
+ let restored: Request = serde_json::from_value(json).unwrap();
+ assert_eq!(restored, request);
+ }
+
+ #[test]
+ fn request_round_trips_for_agent_explain() {
+ let request = Request {
+ id: "req_agent_explain".into(),
+ method: Method::AgentExplain(AgentTarget {
+ target: "agent-1".into(),
+ }),
+ };
+
+ let json = serde_json::to_value(&request).unwrap();
+ assert_eq!(json["method"], "agent.explain");
+ let restored: Request = serde_json::from_value(json).unwrap();
+ assert_eq!(restored, request);
+ }
+
+ #[test]
fn notification_show_request_parses() {
let json = r#"{"id":"req_1","method":"notification.show","params":{"title":"build failed","body":"api workspace","position":"top-left","sound":"request"}}"#;
let request: Request = serde_json::from_str(json).unwrap();