From 4f2d6a9ea97ba9ba9c460166e4f4ee7dc08e7b64 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Sat, 2 Aug 2025 08:59:16 -0600 Subject: [PATCH] Rename Agent to NativeAgent and AgentConnection to NativeAgentConnection - Renamed Agent struct to NativeAgent to better reflect its native implementation - Renamed AgentConnection to NativeAgentConnection for consistency - Updated all references and implementations - Bumped agent-client-protocol version to 0.0.14 --- Cargo.lock | 2 +- crates/agent2/src/agent.rs | 12 ++++++------ crates/agent2/src/tests/mod.rs | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d81effe7a2..494e8cd744 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -138,7 +138,7 @@ dependencies = [ [[package]] name = "agent-client-protocol" -version = "0.0.13" +version = "0.0.14" dependencies = [ "anyhow", "futures 0.3.31", diff --git a/crates/agent2/src/agent.rs b/crates/agent2/src/agent.rs index abd23de375..60c154971b 100644 --- a/crates/agent2/src/agent.rs +++ b/crates/agent2/src/agent.rs @@ -11,14 +11,14 @@ use std::sync::Arc; use crate::{templates::Templates, Thread}; -pub struct Agent { +pub struct NativeAgent { /// Session ID -> Thread entity mapping sessions: HashMap>, /// Shared templates for all threads templates: Arc, } -impl Agent { +impl NativeAgent { pub fn new(templates: Arc) -> Self { Self { sessions: HashMap::new(), @@ -29,9 +29,9 @@ impl Agent { /// Wrapper struct that implements the AgentConnection trait #[derive(Clone)] -pub struct AgentConnection(pub Entity); +pub struct NativeAgentConnection(pub Entity); -impl ModelSelector for AgentConnection { +impl ModelSelector for NativeAgentConnection { fn list_models(&self, cx: &mut AsyncApp) -> Task>>> { cx.spawn(async move |cx| { cx.update(|cx| { @@ -85,7 +85,7 @@ impl ModelSelector for AgentConnection { } } -impl acp_thread::AgentConnection for AgentConnection { +impl acp_thread::AgentConnection for NativeAgentConnection { fn new_thread( self: Rc, project: Entity, @@ -98,7 +98,7 @@ impl acp_thread::AgentConnection for AgentConnection { cx.spawn(async move |cx| { // Create Thread and store in Agent let (session_id, _thread) = - agent.update(cx, |agent, cx: &mut gpui::Context| { + agent.update(cx, |agent, cx: &mut gpui::Context| { // Fetch default model let default_model = LanguageModelRegistry::read_global(cx) .available_models(cx) diff --git a/crates/agent2/src/tests/mod.rs b/crates/agent2/src/tests/mod.rs index a628658b22..ced3c239f0 100644 --- a/crates/agent2/src/tests/mod.rs +++ b/crates/agent2/src/tests/mod.rs @@ -216,8 +216,8 @@ async fn test_agent_connection(cx: &mut TestAppContext) { }); // Create agent and connection - let agent = cx.new(|_| Agent::new(templates.clone())); - let connection = AgentConnection(agent.clone()); + let agent = cx.new(|_| NativeAgent::new(templates.clone())); + let connection = NativeAgentConnection(agent.clone()); // Test model_selector returns Some let selector_opt = connection.model_selector();