acp: Support launching custom agent servers (#36805)

It's enough to add this to your settings:

```json
{
    "agent_servers": {
        "Name Of Your Agent": {
            "command": "/path/to/custom/agent",
            "args": ["arguments", "that", "you", "want"],
        }
    }
}
```

Release Notes:

- N/A
This commit is contained in:
Antonio Scandurra 2025-08-23 16:30:54 +02:00 committed by GitHub
parent 70575d1115
commit 61bc1cc441
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 238 additions and 91 deletions

View file

@ -46,7 +46,7 @@ pub struct AcpConnectionRegistry {
}
struct ActiveConnection {
server_name: &'static str,
server_name: SharedString,
connection: Weak<acp::ClientSideConnection>,
}
@ -63,12 +63,12 @@ impl AcpConnectionRegistry {
pub fn set_active_connection(
&self,
server_name: &'static str,
server_name: impl Into<SharedString>,
connection: &Rc<acp::ClientSideConnection>,
cx: &mut Context<Self>,
) {
self.active_connection.replace(Some(ActiveConnection {
server_name,
server_name: server_name.into(),
connection: Rc::downgrade(connection),
}));
cx.notify();
@ -85,7 +85,7 @@ struct AcpTools {
}
struct WatchedConnection {
server_name: &'static str,
server_name: SharedString,
messages: Vec<WatchedConnectionMessage>,
list_state: ListState,
connection: Weak<acp::ClientSideConnection>,
@ -142,7 +142,7 @@ impl AcpTools {
});
self.watched_connection = Some(WatchedConnection {
server_name: active_connection.server_name,
server_name: active_connection.server_name.clone(),
messages: vec![],
list_state: ListState::new(0, ListAlignment::Bottom, px(2048.)),
connection: active_connection.connection.clone(),
@ -442,7 +442,7 @@ impl Item for AcpTools {
"ACP: {}",
self.watched_connection
.as_ref()
.map_or("Disconnected", |connection| connection.server_name)
.map_or("Disconnected", |connection| &connection.server_name)
)
.into()
}