aboutsummaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/api')
-rw-r--r--src/api/schema.rs2
-rw-r--r--src/api/schema/tests.rs28
-rw-r--r--src/api/schema/workspaces.rs7
3 files changed, 36 insertions, 1 deletions
diff --git a/src/api/schema.rs b/src/api/schema.rs
index 6f76e3d3..e06b701c 100644
--- a/src/api/schema.rs
+++ b/src/api/schema.rs
@@ -80,7 +80,7 @@ pub enum Method {
#[serde(rename = "workspace.report_metadata")]
WorkspaceReportMetadata(WorkspaceReportMetadataParams),
#[serde(rename = "workspace.close")]
- WorkspaceClose(WorkspaceTarget),
+ WorkspaceClose(WorkspaceCloseParams),
#[serde(rename = "worktree.list")]
WorktreeList(WorktreeListParams),
#[serde(rename = "worktree.create")]
diff --git a/src/api/schema/tests.rs b/src/api/schema/tests.rs
index 5fe6dd27..5199038d 100644
--- a/src/api/schema/tests.rs
+++ b/src/api/schema/tests.rs
@@ -62,6 +62,34 @@ fn request_uses_dot_method_names() {
}
#[test]
+fn workspace_close_group_intent_defaults_false_and_round_trips() {
+ let request: Request = serde_json::from_value(serde_json::json!({
+ "id": "close",
+ "method": "workspace.close",
+ "params": { "workspace_id": "w1" }
+ }))
+ .unwrap();
+ assert!(matches!(
+ request.method,
+ Method::WorkspaceClose(WorkspaceCloseParams {
+ close_group: false,
+ ..
+ })
+ ));
+
+ let explicit = Request {
+ id: "close-group".into(),
+ method: Method::WorkspaceClose(WorkspaceCloseParams {
+ workspace_id: "w1".into(),
+ close_group: true,
+ }),
+ };
+ let json = serde_json::to_value(&explicit).unwrap();
+ assert_eq!(json["params"]["close_group"], true);
+ assert_eq!(serde_json::from_value::<Request>(json).unwrap(), explicit);
+}
+
+#[test]
fn agent_start_and_prompt_requests_round_trip() {
let start = Request {
id: "start".into(),
diff --git a/src/api/schema/workspaces.rs b/src/api/schema/workspaces.rs
index f9ad4ced..bfc63252 100644
--- a/src/api/schema/workspaces.rs
+++ b/src/api/schema/workspaces.rs
@@ -17,6 +17,13 @@ pub struct WorkspaceCreateParams {
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)]
+pub struct WorkspaceCloseParams {
+ pub workspace_id: String,
+ #[serde(default, skip_serializing_if = "super::is_false")]
+ pub close_group: bool,
+}
+
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, schemars::JsonSchema)]
pub struct WorkspaceRenameParams {
pub workspace_id: String,
pub label: String,