From 11e6915cda68afc47bd8fcb9a2253b6b99aac66c Mon Sep 17 00:00:00 2001 From: Abhijay Jain Date: Fri, 24 Jul 2026 08:09:28 +0530 Subject: [PATCH] fix(acp): surface tool call output in CLI and Desktop (#10654) --- crates/goose/src/acp/provider.rs | 38 +++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/crates/goose/src/acp/provider.rs b/crates/goose/src/acp/provider.rs index d053d4680..b46927eae 100644 --- a/crates/goose/src/acp/provider.rs +++ b/crates/goose/src/acp/provider.rs @@ -1509,12 +1509,7 @@ fn acp_tool_call_content_to_rmcp( }; out.push(RmcpContent::text(body)); } - ToolCallContent::Terminal(terminal) => { - out.push(RmcpContent::text(format!( - "[terminal {}]", - terminal.terminal_id.0 - ))); - } + ToolCallContent::Terminal(_) => {} _ => {} } } @@ -1525,7 +1520,13 @@ fn acp_tool_call_content_to_rmcp( serde_json::Value::String(s) => s, other => other.to_string(), }; - out.push(RmcpContent::text(text)); + out.push(RmcpContent::text(text).with_priority(0.0)); + } + } else { + for item in &mut out { + if item.priority().is_none() { + *item = item.clone().with_priority(0.0); + } } } out @@ -2501,7 +2502,7 @@ mod tests { None, ); - assert_eq!(out.len(), 4, "all four block kinds should produce output"); + assert_eq!(out.len(), 3, "terminal blocks produce no output"); let serialized: Vec = out .iter() .map(|c| serde_json::to_string(c).unwrap()) @@ -2519,15 +2520,26 @@ mod tests { "diff body lost: {serialized:?}" ); assert!( - serialized[2].contains("term-7"), - "terminal id lost: {serialized:?}" - ); - assert!( - serialized[3].contains("base64data"), + serialized[2].contains("base64data"), "image data lost: {serialized:?}" ); } + #[test] + fn acp_tool_call_terminal_falls_back_to_raw_output() { + use agent_client_protocol::schema::v1::{Terminal, TerminalId}; + + let terminal_block = ToolCallContent::Terminal(Terminal::new(TerminalId::new("term-1"))); + let raw_output = serde_json::Value::String("hello from shell".to_string()); + + let out = acp_tool_call_content_to_rmcp(Some(vec![terminal_block]), Some(raw_output)); + + assert_eq!(out.len(), 1); + let text = out[0].as_text().unwrap(); + assert_eq!(text.text, "hello from shell"); + assert_eq!(out[0].priority(), Some(0.0)); + } + #[test] fn acp_tool_call_content_preserves_audience_annotations() { let text_block = ToolCallContent::Content(agent_client_protocol::schema::v1::Content::new(