From e0758c32118f2aa006db3d8fa4b41833fe6e7ead Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Fri, 17 Jul 2026 23:55:08 +0300 Subject: feat: harden named agent cli workflows refs #1525 --- src/api/schema/tests.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/api/schema/tests.rs') diff --git a/src/api/schema/tests.rs b/src/api/schema/tests.rs index bc044ee9..232c2b73 100644 --- a/src/api/schema/tests.rs +++ b/src/api/schema/tests.rs @@ -61,6 +61,41 @@ fn request_uses_dot_method_names() { assert_eq!(json["method"], "workspace.create"); } +#[test] +fn agent_start_and_prompt_requests_round_trip() { + let start = Request { + id: "start".into(), + method: Method::AgentStart(AgentStartParams { + name: "reviewer".into(), + kind: "pi".into(), + pane_id: "w1:p2".into(), + args: vec!["--no-session".into()], + timeout_ms: Some(30_000), + }), + }; + let start_json = serde_json::to_value(&start).unwrap(); + assert_eq!(start_json["method"], "agent.start"); + assert_eq!(start_json["params"]["pane_id"], "w1:p2"); + assert_eq!( + serde_json::from_value::(start_json).unwrap(), + start + ); + + let prompt = Request { + id: "prompt".into(), + method: Method::AgentPrompt(AgentPromptParams { + target: "reviewer".into(), + text: "review this".into(), + }), + }; + let prompt_json = serde_json::to_value(&prompt).unwrap(); + assert_eq!(prompt_json["method"], "agent.prompt"); + assert_eq!( + serde_json::from_value::(prompt_json).unwrap(), + prompt + ); +} + #[test] fn bundled_protocol_schema_refs_resolve_inside_bundle() { fn assert_no_standalone_refs(value: &serde_json::Value) { -- cgit v1.2.3