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
This commit is contained in:
Nathan Sobo 2025-08-02 08:59:16 -06:00
parent 604a88f6e3
commit 4f2d6a9ea9
3 changed files with 9 additions and 9 deletions

2
Cargo.lock generated
View file

@ -138,7 +138,7 @@ dependencies = [
[[package]]
name = "agent-client-protocol"
version = "0.0.13"
version = "0.0.14"
dependencies = [
"anyhow",
"futures 0.3.31",

View file

@ -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)

View file

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