diff --git a/crates/agent_ui/src/agent_configuration.rs b/crates/agent_ui/src/agent_configuration.rs index 9126d289c94563e99d9bda2212bda5259e9e4fa3..aa316ba7c5efe5f679764cd7d4626a1f1310e4c6 100644 --- a/crates/agent_ui/src/agent_configuration.rs +++ b/crates/agent_ui/src/agent_configuration.rs @@ -1140,7 +1140,34 @@ impl AgentConfiguration { })), ) } - ExternalAgentSource::Custom => None, + ExternalAgentSource::Custom => { + let fs = self.fs.clone(); + Some( + IconButton::new( + SharedString::from(format!("uninstall-{}", id)), + IconName::Trash, + ) + .icon_color(Color::Muted) + .icon_size(IconSize::Small) + .tooltip(Tooltip::text("Remove Custom Agent")) + .on_click(cx.listener(move |_, _, _window, cx| { + let agent_name = agent_server_name.clone(); + update_settings_file(fs.clone(), cx, move |settings, _| { + let Some(agent_servers) = settings.agent_servers.as_mut() else { + return; + }; + if let Some(entry) = agent_servers.get(agent_name.0.as_ref()) + && matches!( + entry, + settings::CustomAgentServerSettings::Custom { .. } + ) + { + agent_servers.remove(agent_name.0.as_ref()); + } + }); + })), + ) + } }; h_flex() diff --git a/crates/agent_ui/src/agent_registry_ui.rs b/crates/agent_ui/src/agent_registry_ui.rs index 45361b9ee26d287a233c02c25f7fba8fd0de37f6..44d5bb20fb77c18447afbe985695cee08a646558 100644 --- a/crates/agent_ui/src/agent_registry_ui.rs +++ b/crates/agent_ui/src/agent_registry_ui.rs @@ -24,10 +24,6 @@ use workspace::{ item::{Item, ItemEvent}, }; -/// Registry IDs for built-in agents that Zed already provides first-class support for. -/// These are filtered out of the ACP Agent Registry UI to avoid showing duplicates. -const BUILT_IN_REGISTRY_IDS: [&str; 4] = ["claude-acp", "claude-code-acp", "codex-acp", "gemini"]; - #[derive(Clone, Copy, Debug, PartialEq, Eq)] enum RegistryFilter { All, @@ -162,8 +158,14 @@ impl AgentRegistryPage { self.registry_agents.sort_by(|left, right| { left.name() .as_ref() - .cmp(right.name().as_ref()) - .then_with(|| left.id().as_ref().cmp(right.id().as_ref())) + .to_lowercase() + .cmp(&right.name().as_ref().to_lowercase()) + .then_with(|| { + left.id() + .as_ref() + .to_lowercase() + .cmp(&right.id().as_ref().to_lowercase()) + }) }); self.filter_registry_agents(cx); } @@ -215,12 +217,6 @@ impl AgentRegistryPage { .iter() .enumerate() .filter(|(_, agent)| { - // Filter out built-in agents since they already appear in the main - // agent configuration UI and don't need to be installed from the registry. - if BUILT_IN_REGISTRY_IDS.contains(&agent.id().as_ref()) { - return false; - } - let matches_search = search.as_ref().is_none_or(|query| { let query = query.as_str(); agent.id().as_ref().to_lowercase().contains(query)