agent_ui: Registry follow-ups (#50287)
Fixes a few things: - Don't filter out any agents from the registry - Sort the agents case-insensitively - Allow removing custom agents from the settings page as well Release Notes: - N/A
This commit is contained in:
1 parent
2f2917d00a
commit
30d584dbd8
2 files changed
+36
-13
No files matched your search
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user