From 257d10f324d187b48529d79908eb8a1a6b0387b9 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 5 Nov 2025 20:15:59 -0700 Subject: [PATCH] This commit is locking up diagnostics on Zed eccdfed32b6cfd3d7bb687e32f2c1de7665afb31 --- Cargo.lock | 6 +---- Cargo.toml | 2 +- crates/acp_thread/src/acp_thread.rs | 30 +++++++++++++----------- crates/agent_ui/src/acp.rs | 1 + crates/agent_ui/src/acp/thread_editor.rs | 6 +++++ 5 files changed, 25 insertions(+), 20 deletions(-) create mode 100644 crates/agent_ui/src/acp/thread_editor.rs diff --git a/Cargo.lock b/Cargo.lock index 03a710c6dd02aa12c3cbf2a2a7e158962c4d49c8..0926ac2b29780106f625643c8144b975391da770 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -211,8 +211,6 @@ dependencies = [ [[package]] name = "agent-client-protocol" version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525705e39c11cd73f7bc784e3681a9386aa30c8d0630808d3dc2237eb4f9cb1b" dependencies = [ "agent-client-protocol-schema", "anyhow", @@ -228,9 +226,7 @@ dependencies = [ [[package]] name = "agent-client-protocol-schema" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecf16c18fea41282d6bbadd1549a06be6836bddb1893f44a6235f340fa24e2af" +version = "0.6.3" dependencies = [ "anyhow", "derive_more 2.0.1", diff --git a/Cargo.toml b/Cargo.toml index ac6e310fe7d899486c5b5287f4ac07762751d9a1..c4889769ec282cfd9d06cf4db1f028398c0ca59d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -440,7 +440,7 @@ zlog_settings = { path = "crates/zlog_settings" } # External crates # -agent-client-protocol = { version = "0.7.0", features = ["unstable"] } +agent-client-protocol = { path = "../agent-client-protocol", features = ["unstable"] } aho-corasick = "1.1" alacritty_terminal = "0.25.1-rc1" any_vec = "0.14" diff --git a/crates/acp_thread/src/acp_thread.rs b/crates/acp_thread/src/acp_thread.rs index 37622d004a2e9cd27a3686263ffd1aa98979104f..d401d982689de3be8e49214d6228af0a0c8b119c 100644 --- a/crates/acp_thread/src/acp_thread.rs +++ b/crates/acp_thread/src/acp_thread.rs @@ -38,10 +38,10 @@ use util::{ResultExt, get_default_system_shell_preferring_bash, paths::PathStyle use uuid::Uuid; #[derive(Debug)] -pub struct UserMessage { +pub struct UserMessage { pub id: Option, pub content: ContentBlock, - pub chunks: Vec, + pub chunks: Vec>, pub checkpoint: Option, } @@ -51,7 +51,7 @@ pub struct Checkpoint { pub show: bool, } -impl UserMessage { +impl UserMessage { fn to_markdown(&self, cx: &App) -> String { let mut markdown = String::new(); if self @@ -116,13 +116,13 @@ impl AssistantMessageChunk { } #[derive(Debug)] -pub enum AgentThreadEntry { - UserMessage(UserMessage), +pub enum AgentThreadEntry { + UserMessage(UserMessage), AssistantMessage(AssistantMessage), ToolCall(ToolCall), } -impl AgentThreadEntry { +impl AgentThreadEntry { pub fn to_markdown(&self, cx: &App) -> String { match self { Self::UserMessage(message) => message.to_markdown(cx), @@ -131,7 +131,7 @@ impl AgentThreadEntry { } } - pub fn user_message(&self) -> Option<&UserMessage> { + pub fn user_message(&self) -> Option<&UserMessage> { if let AgentThreadEntry::UserMessage(message) = self { Some(message) } else { @@ -802,9 +802,11 @@ pub struct RetryStatus { pub duration: Duration, } -pub struct AcpThread { - title: SharedString, - entries: Vec, +pub struct AnchoredText; + +pub struct AcpThread { + title: T, + entries: Vec>, plan: Plan, project: Entity, action_log: Entity, @@ -1002,7 +1004,7 @@ impl Display for LoadError { impl Error for LoadError {} -impl AcpThread { +impl AcpThread { pub fn new( title: impl Into, connection: Rc, @@ -1152,7 +1154,7 @@ impl AcpThread { pub fn push_user_content_block( &mut self, message_id: Option, - chunk: acp::ContentBlock, + chunk: acp::ContentBlock, cx: &mut Context, ) { let language_registry = self.project.read(cx).languages().clone(); @@ -1231,7 +1233,7 @@ impl AcpThread { } } - fn push_entry(&mut self, entry: AgentThreadEntry, cx: &mut Context) { + fn push_entry(&mut self, entry: AgentThreadEntry, cx: &mut Context) { self.entries.push(entry); cx.emit(AcpThreadEvent::NewEntry); } @@ -1924,7 +1926,7 @@ impl AcpThread { }) } - fn last_user_message(&mut self) -> Option<(usize, &mut UserMessage)> { + fn last_user_message(&mut self) -> Option<(usize, &mut UserMessage)> { self.entries .iter_mut() .enumerate() diff --git a/crates/agent_ui/src/acp.rs b/crates/agent_ui/src/acp.rs index 2e15cd424d6313d981ff8c000f5eeb958aec9370..ec57c154bb41ad7b8ff41713926f8f24a83814ee 100644 --- a/crates/agent_ui/src/acp.rs +++ b/crates/agent_ui/src/acp.rs @@ -4,6 +4,7 @@ mod message_editor; mod mode_selector; mod model_selector; mod model_selector_popover; +mod thread_editor; mod thread_history; mod thread_view; diff --git a/crates/agent_ui/src/acp/thread_editor.rs b/crates/agent_ui/src/acp/thread_editor.rs new file mode 100644 index 0000000000000000000000000000000000000000..8df659fd6801709e3796b41982e20850ce7d7b7c --- /dev/null +++ b/crates/agent_ui/src/acp/thread_editor.rs @@ -0,0 +1,6 @@ +use acp_thread::AcpThread; +use gpui::Entity; + +pub struct ThreadEditor { + thread: Entity, +}