Update to acp 0.0.18 (#35595)

Agus Zubiaga created

Release Notes:

- N/A

Change summary

Cargo.lock                                    |  4 ++--
Cargo.toml                                    |  2 +-
crates/acp_thread/src/acp_thread.rs           | 12 ++++++------
crates/agent_servers/src/acp/v0.rs            |  4 ++--
crates/agent_servers/src/acp/v1.rs            | 18 ++++++++++++------
crates/agent_servers/src/claude/mcp_server.rs |  4 ++--
crates/agent_servers/src/claude/tools.rs      |  2 +-
crates/agent_ui/src/acp/thread_view.rs        |  8 ++++----
8 files changed, 30 insertions(+), 24 deletions(-)

Detailed changes

Cargo.lock 🔗

@@ -137,9 +137,9 @@ dependencies = [
 
 [[package]]
 name = "agent-client-protocol"
-version = "0.0.17"
+version = "0.0.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22c5180e40d31a9998ffa5f8eb067667f0870908a4aeed65a6a299e2d1d95443"
+checksum = "f8e4c1dccb35e69d32566f0d11948d902f9942fc3f038821816c1150cf5925f4"
 dependencies = [
  "anyhow",
  "futures 0.3.31",

Cargo.toml 🔗

@@ -421,7 +421,7 @@ zlog_settings = { path = "crates/zlog_settings" }
 #
 
 agentic-coding-protocol = "0.0.10"
-agent-client-protocol = "0.0.17"
+agent-client-protocol = "0.0.18"
 aho-corasick = "1.1"
 alacritty_terminal = { git = "https://github.com/zed-industries/alacritty.git", branch = "add-hush-login-flag" }
 any_vec = "0.14"

crates/acp_thread/src/acp_thread.rs 🔗

@@ -178,7 +178,7 @@ impl ToolCall {
             id: tool_call.id,
             label: cx.new(|cx| {
                 Markdown::new(
-                    tool_call.label.into(),
+                    tool_call.title.into(),
                     Some(language_registry.clone()),
                     None,
                     cx,
@@ -205,7 +205,7 @@ impl ToolCall {
         let acp::ToolCallUpdateFields {
             kind,
             status,
-            label,
+            title,
             content,
             locations,
             raw_input,
@@ -219,8 +219,8 @@ impl ToolCall {
             self.status = ToolCallStatus::Allowed { status };
         }
 
-        if let Some(label) = label {
-            self.label = cx.new(|cx| Markdown::new_text(label.into(), cx));
+        if let Some(title) = title {
+            self.label = cx.new(|cx| Markdown::new_text(title.into(), cx));
         }
 
         if let Some(content) = content {
@@ -1504,7 +1504,7 @@ mod tests {
                             thread.handle_session_update(
                                 acp::SessionUpdate::ToolCall(acp::ToolCall {
                                     id: id.clone(),
-                                    label: "Label".into(),
+                                    title: "Label".into(),
                                     kind: acp::ToolKind::Fetch,
                                     status: acp::ToolCallStatus::InProgress,
                                     content: vec![],
@@ -1608,7 +1608,7 @@ mod tests {
                             thread.handle_session_update(
                                 acp::SessionUpdate::ToolCall(acp::ToolCall {
                                     id: acp::ToolCallId("test".into()),
-                                    label: "Label".into(),
+                                    title: "Label".into(),
                                     kind: acp::ToolKind::Edit,
                                     status: acp::ToolCallStatus::Completed,
                                     content: vec![acp::ToolCallContent::Diff {

crates/agent_servers/src/acp/v0.rs 🔗

@@ -127,7 +127,7 @@ impl acp_old::Client for OldAcpClientDelegate {
             outcomes.push(outcome);
             acp_options.push(acp::PermissionOption {
                 id: acp::PermissionOptionId(index.to_string().into()),
-                label,
+                name: label,
                 kind,
             })
         }
@@ -266,7 +266,7 @@ impl acp_old::Client for OldAcpClientDelegate {
 fn into_new_tool_call(id: acp::ToolCallId, request: acp_old::PushToolCallParams) -> acp::ToolCall {
     acp::ToolCall {
         id: id,
-        label: request.label,
+        title: request.label,
         kind: acp_kind_from_old_icon(request.icon),
         status: acp::ToolCallStatus::InProgress,
         content: request

crates/agent_servers/src/acp/v1.rs 🔗

@@ -1,4 +1,5 @@
 use agent_client_protocol::{self as acp, Agent as _};
+use anyhow::anyhow;
 use collections::HashMap;
 use futures::channel::oneshot;
 use project::Project;
@@ -105,11 +106,16 @@ impl AgentConnection for AcpConnection {
                     mcp_servers: vec![],
                     cwd,
                 })
-                .await?;
+                .await
+                .map_err(|err| {
+                    if err.code == acp::ErrorCode::AUTH_REQUIRED.code {
+                        anyhow!(AuthRequired)
+                    } else {
+                        anyhow!(err)
+                    }
+                })?;
 
-            let Some(session_id) = response.session_id else {
-                anyhow::bail!(AuthRequired);
-            };
+            let session_id = response.session_id;
 
             let thread = cx.new(|cx| {
                 AcpThread::new(
@@ -155,11 +161,11 @@ impl AgentConnection for AcpConnection {
 
     fn cancel(&self, session_id: &acp::SessionId, cx: &mut App) {
         let conn = self.connection.clone();
-        let params = acp::CancelledNotification {
+        let params = acp::CancelNotification {
             session_id: session_id.clone(),
         };
         cx.foreground_executor()
-            .spawn(async move { conn.cancelled(params).await })
+            .spawn(async move { conn.cancel(params).await })
             .detach();
     }
 }

crates/agent_servers/src/claude/mcp_server.rs 🔗

@@ -158,12 +158,12 @@ impl McpServerTool for PermissionTool {
                     vec![
                         acp::PermissionOption {
                             id: allow_option_id.clone(),
-                            label: "Allow".into(),
+                            name: "Allow".into(),
                             kind: acp::PermissionOptionKind::AllowOnce,
                         },
                         acp::PermissionOption {
                             id: reject_option_id.clone(),
-                            label: "Reject".into(),
+                            name: "Reject".into(),
                             kind: acp::PermissionOptionKind::RejectOnce,
                         },
                     ],

crates/agent_servers/src/claude/tools.rs 🔗

@@ -308,7 +308,7 @@ impl ClaudeTool {
             id,
             kind: self.kind(),
             status: acp::ToolCallStatus::InProgress,
-            label: self.label(),
+            title: self.label(),
             content: self.content(),
             locations: self.locations(),
             raw_input: None,

crates/agent_ui/src/acp/thread_view.rs 🔗

@@ -1233,7 +1233,7 @@ impl AcpThreadView {
             })
             .children(options.iter().map(|option| {
                 let option_id = SharedString::from(option.id.0.clone());
-                Button::new((option_id, entry_ix), option.label.clone())
+                Button::new((option_id, entry_ix), option.name.clone())
                     .map(|this| match option.kind {
                         acp::PermissionOptionKind::AllowOnce => {
                             this.icon(IconName::Check).icon_color(Color::Success)
@@ -2465,7 +2465,7 @@ impl Render for AcpThreadView {
                         connection.auth_methods().into_iter().map(|method| {
                             Button::new(
                                 SharedString::from(method.id.0.clone()),
-                                method.label.clone(),
+                                method.name.clone(),
                             )
                             .on_click({
                                 let method_id = method.id.clone();
@@ -2773,7 +2773,7 @@ mod tests {
         let tool_call_id = acp::ToolCallId("1".into());
         let tool_call = acp::ToolCall {
             id: tool_call_id.clone(),
-            label: "Label".into(),
+            title: "Label".into(),
             kind: acp::ToolKind::Edit,
             status: acp::ToolCallStatus::Pending,
             content: vec!["hi".into()],
@@ -2785,7 +2785,7 @@ mod tests {
                 tool_call_id,
                 vec![acp::PermissionOption {
                     id: acp::PermissionOptionId("1".into()),
-                    label: "Allow".into(),
+                    name: "Allow".into(),
                     kind: acp::PermissionOptionKind::AllowOnce,
                 }],
             )]));