Compare commits

...

1 Commits

Author SHA1 Message Date
Nathan Sobo
257d10f324 This commit is locking up diagnostics on Zed eccdfed32b 2025-11-05 20:15:59 -07:00
5 changed files with 25 additions and 20 deletions

6
Cargo.lock generated
View File

@@ -211,8 +211,6 @@ dependencies = [
[[package]] [[package]]
name = "agent-client-protocol" name = "agent-client-protocol"
version = "0.7.0" version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "525705e39c11cd73f7bc784e3681a9386aa30c8d0630808d3dc2237eb4f9cb1b"
dependencies = [ dependencies = [
"agent-client-protocol-schema", "agent-client-protocol-schema",
"anyhow", "anyhow",
@@ -228,9 +226,7 @@ dependencies = [
[[package]] [[package]]
name = "agent-client-protocol-schema" name = "agent-client-protocol-schema"
version = "0.6.2" version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ecf16c18fea41282d6bbadd1549a06be6836bddb1893f44a6235f340fa24e2af"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"derive_more 2.0.1", "derive_more 2.0.1",

View File

@@ -440,7 +440,7 @@ zlog_settings = { path = "crates/zlog_settings" }
# External crates # External crates
# #
agent-client-protocol = { version = "0.7.0", features = ["unstable"] } agent-client-protocol = { path = "../agent-client-protocol", features = ["unstable"] }
aho-corasick = "1.1" aho-corasick = "1.1"
alacritty_terminal = "0.25.1-rc1" alacritty_terminal = "0.25.1-rc1"
any_vec = "0.14" any_vec = "0.14"

View File

@@ -38,10 +38,10 @@ use util::{ResultExt, get_default_system_shell_preferring_bash, paths::PathStyle
use uuid::Uuid; use uuid::Uuid;
#[derive(Debug)] #[derive(Debug)]
pub struct UserMessage { pub struct UserMessage<T> {
pub id: Option<UserMessageId>, pub id: Option<UserMessageId>,
pub content: ContentBlock, pub content: ContentBlock,
pub chunks: Vec<acp::ContentBlock>, pub chunks: Vec<acp::ContentBlock<T>>,
pub checkpoint: Option<Checkpoint>, pub checkpoint: Option<Checkpoint>,
} }
@@ -51,7 +51,7 @@ pub struct Checkpoint {
pub show: bool, pub show: bool,
} }
impl UserMessage { impl<T> UserMessage<T> {
fn to_markdown(&self, cx: &App) -> String { fn to_markdown(&self, cx: &App) -> String {
let mut markdown = String::new(); let mut markdown = String::new();
if self if self
@@ -116,13 +116,13 @@ impl AssistantMessageChunk {
} }
#[derive(Debug)] #[derive(Debug)]
pub enum AgentThreadEntry { pub enum AgentThreadEntry<T> {
UserMessage(UserMessage), UserMessage(UserMessage<T>),
AssistantMessage(AssistantMessage), AssistantMessage(AssistantMessage),
ToolCall(ToolCall), ToolCall(ToolCall),
} }
impl AgentThreadEntry { impl<T> AgentThreadEntry<T> {
pub fn to_markdown(&self, cx: &App) -> String { pub fn to_markdown(&self, cx: &App) -> String {
match self { match self {
Self::UserMessage(message) => message.to_markdown(cx), 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<T>> {
if let AgentThreadEntry::UserMessage(message) = self { if let AgentThreadEntry::UserMessage(message) = self {
Some(message) Some(message)
} else { } else {
@@ -802,9 +802,11 @@ pub struct RetryStatus {
pub duration: Duration, pub duration: Duration,
} }
pub struct AcpThread { pub struct AnchoredText;
title: SharedString,
entries: Vec<AgentThreadEntry>, pub struct AcpThread<T = SharedString> {
title: T,
entries: Vec<AgentThreadEntry<AnchoredText>>,
plan: Plan, plan: Plan,
project: Entity<Project>, project: Entity<Project>,
action_log: Entity<ActionLog>, action_log: Entity<ActionLog>,
@@ -1002,7 +1004,7 @@ impl Display for LoadError {
impl Error for LoadError {} impl Error for LoadError {}
impl AcpThread { impl<T> AcpThread<T> {
pub fn new( pub fn new(
title: impl Into<SharedString>, title: impl Into<SharedString>,
connection: Rc<dyn AgentConnection>, connection: Rc<dyn AgentConnection>,
@@ -1152,7 +1154,7 @@ impl AcpThread {
pub fn push_user_content_block( pub fn push_user_content_block(
&mut self, &mut self,
message_id: Option<UserMessageId>, message_id: Option<UserMessageId>,
chunk: acp::ContentBlock, chunk: acp::ContentBlock<T>,
cx: &mut Context<Self>, cx: &mut Context<Self>,
) { ) {
let language_registry = self.project.read(cx).languages().clone(); 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<Self>) { fn push_entry(&mut self, entry: AgentThreadEntry<T>, cx: &mut Context<Self>) {
self.entries.push(entry); self.entries.push(entry);
cx.emit(AcpThreadEvent::NewEntry); 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<T>)> {
self.entries self.entries
.iter_mut() .iter_mut()
.enumerate() .enumerate()

View File

@@ -4,6 +4,7 @@ mod message_editor;
mod mode_selector; mod mode_selector;
mod model_selector; mod model_selector;
mod model_selector_popover; mod model_selector_popover;
mod thread_editor;
mod thread_history; mod thread_history;
mod thread_view; mod thread_view;

View File

@@ -0,0 +1,6 @@
use acp_thread::AcpThread;
use gpui::Entity;
pub struct ThreadEditor {
thread: Entity<AcpThread>,
}