Download codex-rs/core/src/plugins/discoverable.rs from SaylorTwift/codex: direct link, hf CLI and curl.
- Browser
- Download file 2.17 kB
-
https://huggingface.co/SaylorTwift/codex/resolve/main/codex-rs/core/src/plugins/discoverable.rs
- Command line
-
hf download hf://SaylorTwift/codex/codex-rs/core/src/plugins/discoverable.rs
-
curl -L -o discoverable.rs https://huggingface.co/SaylorTwift/codex/resolve/main/codex-rs/core/src/plugins/discoverable.rs
2.17 kB
| use crate::config::Config; | |
| use codex_config::types::ToolSuggestDiscoverableType; | |
| use codex_core_plugins::PluginsManager; | |
| use codex_core_plugins::ToolSuggestPluginDiscoveryInput; | |
| use codex_login::CodexAuth; | |
| use codex_tools::DiscoverablePluginInfo; | |
| use std::collections::HashSet; | |
| use tracing::instrument; | |
| pub(crate) async fn list_tool_suggest_discoverable_plugins( | |
| config: &Config, | |
| plugins_manager: &PluginsManager, | |
| auth: Option<&CodexAuth>, | |
| loaded_plugin_app_connector_ids: &[String], | |
| ) -> anyhow::Result<Vec<DiscoverablePluginInfo>> { | |
| let input = ToolSuggestPluginDiscoveryInput { | |
| plugins: config.plugins_config_input(), | |
| configured_plugin_ids: config | |
| .tool_suggest | |
| .discoverables | |
| .iter() | |
| .filter(|discoverable| discoverable.kind == ToolSuggestDiscoverableType::Plugin) | |
| .map(|discoverable| discoverable.id.clone()) | |
| .collect::<HashSet<_>>(), | |
| disabled_plugin_ids: config | |
| .tool_suggest | |
| .disabled_tools | |
| .iter() | |
| .filter(|disabled_tool| disabled_tool.kind == ToolSuggestDiscoverableType::Plugin) | |
| .map(|disabled_tool| disabled_tool.id.clone()) | |
| .collect::<HashSet<_>>(), | |
| loaded_plugin_app_connector_ids: loaded_plugin_app_connector_ids | |
| .iter() | |
| .cloned() | |
| .collect::<HashSet<_>>(), | |
| }; | |
| plugins_manager | |
| .list_tool_suggest_discoverable_plugins(&input, auth) | |
| .await | |
| .map(|plugins| { | |
| plugins | |
| .into_iter() | |
| .map(|plugin| DiscoverablePluginInfo { | |
| id: plugin.id, | |
| remote_plugin_id: plugin.remote_plugin_id, | |
| name: plugin.name, | |
| description: plugin.description, | |
| has_skills: plugin.has_skills, | |
| mcp_server_names: plugin.mcp_server_names, | |
| app_connector_ids: plugin.app_connector_ids, | |
| }) | |
| .collect() | |
| }) | |
| } | |
| mod tests; | |