Rename Agent to NativeAgent and AgentConnection to NativeAgentConnection

Nathan Sobo created

- 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

Change summary

Cargo.lock                     |  2 +-
crates/agent2/src/agent.rs     | 12 ++++++------
crates/agent2/src/tests/mod.rs |  4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)

Detailed changes

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",

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<acp::SessionId, Entity<Thread>>,
     /// Shared templates for all threads
     templates: Arc<Templates>,
 }
 
-impl Agent {
+impl NativeAgent {
     pub fn new(templates: Arc<Templates>) -> 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<Agent>);
+pub struct NativeAgentConnection(pub Entity<NativeAgent>);
 
-impl ModelSelector for AgentConnection {
+impl ModelSelector for NativeAgentConnection {
     fn list_models(&self, cx: &mut AsyncApp) -> Task<Result<Vec<Arc<dyn LanguageModel>>>> {
         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<Self>,
         project: Entity<Project>,
@@ -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>| {
+                agent.update(cx, |agent, cx: &mut gpui::Context<NativeAgent>| {
                     // Fetch default model
                     let default_model = LanguageModelRegistry::read_global(cx)
                         .available_models(cx)

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();