extension.rs

 1use collections::HashMap;
 2use std::sync::LazyLock;
 3
 4/// Maps built-in provider IDs to their corresponding extension IDs.
 5/// When an extension with this ID is installed, the built-in provider should be hidden.
 6static BUILTIN_TO_EXTENSION_MAP: LazyLock<HashMap<&'static str, &'static str>> =
 7    LazyLock::new(|| {
 8        let mut map = HashMap::default();
 9        map.insert("anthropic", "anthropic");
10        map.insert("openai", "openai");
11        map.insert("google", "google-ai");
12        map.insert("open_router", "open-router");
13        map.insert("copilot_chat", "copilot-chat");
14        map
15    });
16
17/// Returns the extension ID that should hide the given built-in provider.
18pub fn extension_for_builtin_provider(provider_id: &str) -> Option<&'static str> {
19    BUILTIN_TO_EXTENSION_MAP.get(provider_id).copied()
20}