diff --git a/crates/acp_thread/src/acp_thread.rs b/crates/acp_thread/src/acp_thread.rs index b981370fe6..f476941b2e 100644 --- a/crates/acp_thread/src/acp_thread.rs +++ b/crates/acp_thread/src/acp_thread.rs @@ -572,8 +572,6 @@ impl Error for LoadError {} impl AcpThread { pub fn new( connection: Rc, - // todo! remove me - title: SharedString, project: Entity, session_id: acp::SessionId, cx: &mut Context, @@ -585,7 +583,7 @@ impl AcpThread { shared_buffers: Default::default(), entries: Default::default(), plan: Default::default(), - title, + title: connection.name().into(), project, send_task: None, connection, @@ -1783,13 +1781,13 @@ mod tests { } }); let connection = OldAcpAgentConnection { + name: "test", connection, child_status: io_task, }; AcpThread::new( Rc::new(connection), - "Test".into(), project, acp::SessionId("test".into()), cx, diff --git a/crates/acp_thread/src/connection.rs b/crates/acp_thread/src/connection.rs index 3ecedcc753..a1c623906a 100644 --- a/crates/acp_thread/src/connection.rs +++ b/crates/acp_thread/src/connection.rs @@ -10,6 +10,8 @@ use ui::App; use crate::AcpThread; pub trait AgentConnection { + fn name(&self) -> &'static str; + fn new_thread( self: Rc, project: Entity, @@ -35,11 +37,16 @@ impl fmt::Display for Unauthenticated { } pub struct OldAcpAgentConnection { + pub name: &'static str, pub connection: acp_old::AgentConnection, pub child_status: Task>, } impl AgentConnection for OldAcpAgentConnection { + fn name(&self) -> &'static str { + self.name + } + fn new_thread( self: Rc, project: Entity, @@ -63,7 +70,7 @@ impl AgentConnection for OldAcpAgentConnection { cx.update(|cx| { let thread = cx.new(|cx| { let session_id = acp::SessionId("acp-old-no-id".into()); - AcpThread::new(self.clone(), "Gemini".into(), project, session_id, cx) + AcpThread::new(self.clone(), project, session_id, cx) }); thread }) diff --git a/crates/agent_servers/src/claude.rs b/crates/agent_servers/src/claude.rs index 5706b44384..f908487c88 100644 --- a/crates/agent_servers/src/claude.rs +++ b/crates/agent_servers/src/claude.rs @@ -197,6 +197,10 @@ fn send_interrupt(_pid: i32) -> anyhow::Result<()> { } impl AgentConnection for ClaudeAgentConnection { + fn name(&self) -> &'static str { + ClaudeCode.name() + } + fn new_thread( self: Rc, project: Entity, @@ -204,15 +208,8 @@ impl AgentConnection for ClaudeAgentConnection { cx: &mut AsyncApp, ) -> Task>> { let session_id = self.session_id.clone(); - let thread_result = cx.new(|cx| { - AcpThread::new( - self.clone(), - "Claude".into(), - project, - session_id.clone(), - cx, - ) - }); + let thread_result = + cx.new(|cx| AcpThread::new(self.clone(), project, session_id.clone(), cx)); if let Ok(thread) = &thread_result { self.threads_map diff --git a/crates/agent_servers/src/stdio_agent_server.rs b/crates/agent_servers/src/stdio_agent_server.rs index c3cb5ef1a6..0e10f6ba66 100644 --- a/crates/agent_servers/src/stdio_agent_server.rs +++ b/crates/agent_servers/src/stdio_agent_server.rs @@ -51,6 +51,7 @@ impl AgentServer for T { let root_dir = root_dir.to_path_buf(); let project = project.clone(); let this = self.clone(); + let name = self.name(); cx.spawn(async move |cx| { let command = this.command(&project, cx).await?; @@ -108,6 +109,7 @@ impl AgentServer for T { }); let connection: Rc = Rc::new(OldAcpAgentConnection { + name, connection, child_status, });