diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rs index c5c1c345318b6f88c59ba2886507324e83d36ad3..7e3dc5cb07bd8c777c8edb8edac9472d1bb81acb 100644 --- a/crates/agent_ui/src/agent_panel.rs +++ b/crates/agent_ui/src/agent_panel.rs @@ -3300,13 +3300,12 @@ impl AgentPanel { .filter(|id| { !agent_server_store.external_agents.contains_key(*id) }) - .map(|name| { + .filter_map(|name| { let display_name = registry_store_ref .as_ref() .and_then(|store| store.agent(name.0.as_ref())) - .map(|a| a.name().clone()) - .unwrap_or_else(|| name.0.clone()); - (name.clone(), display_name) + .map(|a| a.name().clone())?; + Some((name.clone(), display_name)) }) .sorted_unstable_by_key(|(_, display_name)| display_name.to_lowercase()) .collect::>(); diff --git a/crates/project/src/agent_registry_store.rs b/crates/project/src/agent_registry_store.rs index a6fc56b7dadaeb0e89443479c108d999d70b37bd..155badc4ac7da22921b121428cc34a0d46f5b982 100644 --- a/crates/project/src/agent_registry_store.rs +++ b/crates/project/src/agent_registry_store.rs @@ -11,7 +11,7 @@ use http_client::{AsyncBody, HttpClient}; use serde::Deserialize; use settings::Settings as _; -use crate::agent_server_store::AllAgentServersSettings; +use crate::DisableAiSettings; const REGISTRY_URL: &str = "https://cdn.agentclientprotocol.com/registry/v1/latest/registry.json"; const REFRESH_THROTTLE_DURATION: Duration = Duration::from_secs(60 * 60); @@ -129,13 +129,11 @@ impl AgentRegistryStore { let store = cx.new(|cx| Self::new(fs, http_client, cx)); cx.set_global(GlobalAgentRegistryStore(store.clone())); - if AllAgentServersSettings::get_global(cx).has_registry_agents() { - store.update(cx, |store, cx| { - if store.agents.is_empty() { - store.refresh(cx); - } - }); - } + store.update(cx, |store, cx| { + if store.agents.is_empty() { + store.refresh(cx); + } + }); store } @@ -173,6 +171,10 @@ impl AgentRegistryStore { return; } + if DisableAiSettings::get_global(cx).disable_ai { + return; + } + self.is_fetching = true; self.fetch_error = None; self.last_refresh = Some(Instant::now()); @@ -249,6 +251,10 @@ impl AgentRegistryStore { http_client: Arc, cx: &mut Context, ) { + if DisableAiSettings::get_global(cx).disable_ai { + return; + } + cx.spawn(async move |this, cx| -> Result<()> { let cache_path = registry_cache_path(); if !fs.is_file(&cache_path).await {