fix(acp): surface tool call output in CLI and Desktop (#10654)

This commit is contained in:
Abhijay Jain
2026-07-24 08:09:28 +05:30
committed by GitHub
parent a3c20531e5
commit 11e6915cda
+25 -13
View File
@@ -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<String> = 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(