parent
f3f2dba606
commit
1325bf1420
8 changed files with 30 additions and 24 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -137,9 +137,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "agent-client-protocol"
|
name = "agent-client-protocol"
|
||||||
version = "0.0.17"
|
version = "0.0.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "22c5180e40d31a9998ffa5f8eb067667f0870908a4aeed65a6a299e2d1d95443"
|
checksum = "f8e4c1dccb35e69d32566f0d11948d902f9942fc3f038821816c1150cf5925f4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"futures 0.3.31",
|
"futures 0.3.31",
|
||||||
|
|
|
@ -421,7 +421,7 @@ zlog_settings = { path = "crates/zlog_settings" }
|
||||||
#
|
#
|
||||||
|
|
||||||
agentic-coding-protocol = "0.0.10"
|
agentic-coding-protocol = "0.0.10"
|
||||||
agent-client-protocol = "0.0.17"
|
agent-client-protocol = "0.0.18"
|
||||||
aho-corasick = "1.1"
|
aho-corasick = "1.1"
|
||||||
alacritty_terminal = { git = "https://github.com/zed-industries/alacritty.git", branch = "add-hush-login-flag" }
|
alacritty_terminal = { git = "https://github.com/zed-industries/alacritty.git", branch = "add-hush-login-flag" }
|
||||||
any_vec = "0.14"
|
any_vec = "0.14"
|
||||||
|
|
|
@ -178,7 +178,7 @@ impl ToolCall {
|
||||||
id: tool_call.id,
|
id: tool_call.id,
|
||||||
label: cx.new(|cx| {
|
label: cx.new(|cx| {
|
||||||
Markdown::new(
|
Markdown::new(
|
||||||
tool_call.label.into(),
|
tool_call.title.into(),
|
||||||
Some(language_registry.clone()),
|
Some(language_registry.clone()),
|
||||||
None,
|
None,
|
||||||
cx,
|
cx,
|
||||||
|
@ -205,7 +205,7 @@ impl ToolCall {
|
||||||
let acp::ToolCallUpdateFields {
|
let acp::ToolCallUpdateFields {
|
||||||
kind,
|
kind,
|
||||||
status,
|
status,
|
||||||
label,
|
title,
|
||||||
content,
|
content,
|
||||||
locations,
|
locations,
|
||||||
raw_input,
|
raw_input,
|
||||||
|
@ -219,8 +219,8 @@ impl ToolCall {
|
||||||
self.status = ToolCallStatus::Allowed { status };
|
self.status = ToolCallStatus::Allowed { status };
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(label) = label {
|
if let Some(title) = title {
|
||||||
self.label = cx.new(|cx| Markdown::new_text(label.into(), cx));
|
self.label = cx.new(|cx| Markdown::new_text(title.into(), cx));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(content) = content {
|
if let Some(content) = content {
|
||||||
|
@ -1504,7 +1504,7 @@ mod tests {
|
||||||
thread.handle_session_update(
|
thread.handle_session_update(
|
||||||
acp::SessionUpdate::ToolCall(acp::ToolCall {
|
acp::SessionUpdate::ToolCall(acp::ToolCall {
|
||||||
id: id.clone(),
|
id: id.clone(),
|
||||||
label: "Label".into(),
|
title: "Label".into(),
|
||||||
kind: acp::ToolKind::Fetch,
|
kind: acp::ToolKind::Fetch,
|
||||||
status: acp::ToolCallStatus::InProgress,
|
status: acp::ToolCallStatus::InProgress,
|
||||||
content: vec![],
|
content: vec![],
|
||||||
|
@ -1608,7 +1608,7 @@ mod tests {
|
||||||
thread.handle_session_update(
|
thread.handle_session_update(
|
||||||
acp::SessionUpdate::ToolCall(acp::ToolCall {
|
acp::SessionUpdate::ToolCall(acp::ToolCall {
|
||||||
id: acp::ToolCallId("test".into()),
|
id: acp::ToolCallId("test".into()),
|
||||||
label: "Label".into(),
|
title: "Label".into(),
|
||||||
kind: acp::ToolKind::Edit,
|
kind: acp::ToolKind::Edit,
|
||||||
status: acp::ToolCallStatus::Completed,
|
status: acp::ToolCallStatus::Completed,
|
||||||
content: vec![acp::ToolCallContent::Diff {
|
content: vec![acp::ToolCallContent::Diff {
|
||||||
|
|
|
@ -127,7 +127,7 @@ impl acp_old::Client for OldAcpClientDelegate {
|
||||||
outcomes.push(outcome);
|
outcomes.push(outcome);
|
||||||
acp_options.push(acp::PermissionOption {
|
acp_options.push(acp::PermissionOption {
|
||||||
id: acp::PermissionOptionId(index.to_string().into()),
|
id: acp::PermissionOptionId(index.to_string().into()),
|
||||||
label,
|
name: label,
|
||||||
kind,
|
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 {
|
fn into_new_tool_call(id: acp::ToolCallId, request: acp_old::PushToolCallParams) -> acp::ToolCall {
|
||||||
acp::ToolCall {
|
acp::ToolCall {
|
||||||
id: id,
|
id: id,
|
||||||
label: request.label,
|
title: request.label,
|
||||||
kind: acp_kind_from_old_icon(request.icon),
|
kind: acp_kind_from_old_icon(request.icon),
|
||||||
status: acp::ToolCallStatus::InProgress,
|
status: acp::ToolCallStatus::InProgress,
|
||||||
content: request
|
content: request
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use agent_client_protocol::{self as acp, Agent as _};
|
use agent_client_protocol::{self as acp, Agent as _};
|
||||||
|
use anyhow::anyhow;
|
||||||
use collections::HashMap;
|
use collections::HashMap;
|
||||||
use futures::channel::oneshot;
|
use futures::channel::oneshot;
|
||||||
use project::Project;
|
use project::Project;
|
||||||
|
@ -105,11 +106,16 @@ impl AgentConnection for AcpConnection {
|
||||||
mcp_servers: vec![],
|
mcp_servers: vec![],
|
||||||
cwd,
|
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 {
|
let session_id = response.session_id;
|
||||||
anyhow::bail!(AuthRequired);
|
|
||||||
};
|
|
||||||
|
|
||||||
let thread = cx.new(|cx| {
|
let thread = cx.new(|cx| {
|
||||||
AcpThread::new(
|
AcpThread::new(
|
||||||
|
@ -155,11 +161,11 @@ impl AgentConnection for AcpConnection {
|
||||||
|
|
||||||
fn cancel(&self, session_id: &acp::SessionId, cx: &mut App) {
|
fn cancel(&self, session_id: &acp::SessionId, cx: &mut App) {
|
||||||
let conn = self.connection.clone();
|
let conn = self.connection.clone();
|
||||||
let params = acp::CancelledNotification {
|
let params = acp::CancelNotification {
|
||||||
session_id: session_id.clone(),
|
session_id: session_id.clone(),
|
||||||
};
|
};
|
||||||
cx.foreground_executor()
|
cx.foreground_executor()
|
||||||
.spawn(async move { conn.cancelled(params).await })
|
.spawn(async move { conn.cancel(params).await })
|
||||||
.detach();
|
.detach();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,12 +158,12 @@ impl McpServerTool for PermissionTool {
|
||||||
vec![
|
vec![
|
||||||
acp::PermissionOption {
|
acp::PermissionOption {
|
||||||
id: allow_option_id.clone(),
|
id: allow_option_id.clone(),
|
||||||
label: "Allow".into(),
|
name: "Allow".into(),
|
||||||
kind: acp::PermissionOptionKind::AllowOnce,
|
kind: acp::PermissionOptionKind::AllowOnce,
|
||||||
},
|
},
|
||||||
acp::PermissionOption {
|
acp::PermissionOption {
|
||||||
id: reject_option_id.clone(),
|
id: reject_option_id.clone(),
|
||||||
label: "Reject".into(),
|
name: "Reject".into(),
|
||||||
kind: acp::PermissionOptionKind::RejectOnce,
|
kind: acp::PermissionOptionKind::RejectOnce,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -308,7 +308,7 @@ impl ClaudeTool {
|
||||||
id,
|
id,
|
||||||
kind: self.kind(),
|
kind: self.kind(),
|
||||||
status: acp::ToolCallStatus::InProgress,
|
status: acp::ToolCallStatus::InProgress,
|
||||||
label: self.label(),
|
title: self.label(),
|
||||||
content: self.content(),
|
content: self.content(),
|
||||||
locations: self.locations(),
|
locations: self.locations(),
|
||||||
raw_input: None,
|
raw_input: None,
|
||||||
|
|
|
@ -1233,7 +1233,7 @@ impl AcpThreadView {
|
||||||
})
|
})
|
||||||
.children(options.iter().map(|option| {
|
.children(options.iter().map(|option| {
|
||||||
let option_id = SharedString::from(option.id.0.clone());
|
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 {
|
.map(|this| match option.kind {
|
||||||
acp::PermissionOptionKind::AllowOnce => {
|
acp::PermissionOptionKind::AllowOnce => {
|
||||||
this.icon(IconName::Check).icon_color(Color::Success)
|
this.icon(IconName::Check).icon_color(Color::Success)
|
||||||
|
@ -2465,7 +2465,7 @@ impl Render for AcpThreadView {
|
||||||
connection.auth_methods().into_iter().map(|method| {
|
connection.auth_methods().into_iter().map(|method| {
|
||||||
Button::new(
|
Button::new(
|
||||||
SharedString::from(method.id.0.clone()),
|
SharedString::from(method.id.0.clone()),
|
||||||
method.label.clone(),
|
method.name.clone(),
|
||||||
)
|
)
|
||||||
.on_click({
|
.on_click({
|
||||||
let method_id = method.id.clone();
|
let method_id = method.id.clone();
|
||||||
|
@ -2773,7 +2773,7 @@ mod tests {
|
||||||
let tool_call_id = acp::ToolCallId("1".into());
|
let tool_call_id = acp::ToolCallId("1".into());
|
||||||
let tool_call = acp::ToolCall {
|
let tool_call = acp::ToolCall {
|
||||||
id: tool_call_id.clone(),
|
id: tool_call_id.clone(),
|
||||||
label: "Label".into(),
|
title: "Label".into(),
|
||||||
kind: acp::ToolKind::Edit,
|
kind: acp::ToolKind::Edit,
|
||||||
status: acp::ToolCallStatus::Pending,
|
status: acp::ToolCallStatus::Pending,
|
||||||
content: vec!["hi".into()],
|
content: vec!["hi".into()],
|
||||||
|
@ -2785,7 +2785,7 @@ mod tests {
|
||||||
tool_call_id,
|
tool_call_id,
|
||||||
vec![acp::PermissionOption {
|
vec![acp::PermissionOption {
|
||||||
id: acp::PermissionOptionId("1".into()),
|
id: acp::PermissionOptionId("1".into()),
|
||||||
label: "Allow".into(),
|
name: "Allow".into(),
|
||||||
kind: acp::PermissionOptionKind::AllowOnce,
|
kind: acp::PermissionOptionKind::AllowOnce,
|
||||||
}],
|
}],
|
||||||
)]));
|
)]));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue