mirror of
https://github.com/openai/codex.git
synced 2026-10-23 18:08:45 +00:00
Summary - Propagate cached remote plugin IDs through Codex plugin discovery. - Inject `remote_plugin_id` and connector IDs into `request_plugin_install` elicitation `_meta` from the resolved plugin. - Keep the remote plugin ID out of the model-facing tool schema, arguments, and result. Validation - `just test -p codex-tools` - `just test -p codex-core-plugins` - `just test -p codex-core list_tool_suggest_discoverable_plugins_includes_cached_remote_global_plugins` - `just fix -p codex-tools` - `just fix -p codex-core-plugins` - `just fix -p codex-core` - `git diff --check` - `just test -p codex-core` was also attempted: 2,581 passed, 55 failed, and 1 timed out across unrelated sandbox/environment-sensitive integration tests.
58 lines
2.0 KiB
Rust
58 lines
2.0 KiB
Rust
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;
|
|
|
|
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()
|
|
})
|
|
}
|
|
|
|
#[cfg(test)]
|
|
#[path = "discoverable_tests.rs"]
|
|
mod tests;
|