WIP fase 2b-3: rimozione sottosistemi solo-ChatGPT (plugin remoti, image gen, daybreak, cyber, attestation, cloud config, app/connettori) - test in corso
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,11 +15,6 @@ enum BundledHookTarget {
|
||||
server: &'static str,
|
||||
tool: &'static str,
|
||||
},
|
||||
App {
|
||||
server: &'static str,
|
||||
connector_id: &'static str,
|
||||
tool: &'static str,
|
||||
},
|
||||
}
|
||||
|
||||
// Keep unsigned plugin exceptions together so they can be removed as signing lands.
|
||||
@@ -96,38 +91,16 @@ const ALLOWLISTED_BUNDLED_HOOKS: &[BundledHook] = &[
|
||||
tool: "turn_ended",
|
||||
},
|
||||
},
|
||||
BundledHook {
|
||||
plugin_id: "browser@openai-curated-remote",
|
||||
events: &[
|
||||
HookEventName::Stop,
|
||||
HookEventName::Interrupt,
|
||||
HookEventName::SubagentStop,
|
||||
],
|
||||
target: BundledHookTarget::App {
|
||||
server: "codex_apps",
|
||||
connector_id: "connector_openai_browser",
|
||||
tool: "browser.turn_ended",
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
/// Matches a temporary unsigned cleanup exception. App targets additionally require the
|
||||
/// connector identity for this handler's server and tool from the caller's enabled tool
|
||||
/// catalog; callers without that catalog must pass `None`.
|
||||
/// Matches a temporary unsigned cleanup exception.
|
||||
pub fn is_allowlisted_bundled_cleanup_hook(
|
||||
plugin_id: &str,
|
||||
event: HookEventName,
|
||||
matcher: Option<&str>,
|
||||
handler: &HookHandlerConfig,
|
||||
app_connector_id: Option<&str>,
|
||||
) -> bool {
|
||||
let HookHandlerConfig::McpTool {
|
||||
server,
|
||||
tool,
|
||||
input,
|
||||
..
|
||||
} = handler
|
||||
else {
|
||||
let HookHandlerConfig::McpTool { server, tool, .. } = handler else {
|
||||
return false;
|
||||
};
|
||||
|
||||
@@ -140,17 +113,6 @@ pub fn is_allowlisted_bundled_cleanup_hook(
|
||||
server: expected_server,
|
||||
tool: expected_tool,
|
||||
} => server == expected_server && tool == expected_tool,
|
||||
BundledHookTarget::App {
|
||||
server: expected_server,
|
||||
connector_id,
|
||||
tool: expected_tool,
|
||||
} => {
|
||||
// Raw Apps tool names can collide; require the registered connector.
|
||||
server == expected_server
|
||||
&& tool == expected_tool
|
||||
&& input.is_empty()
|
||||
&& app_connector_id == Some(connector_id)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
//! Shared plugin package models, identifiers, and telemetry summaries.
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
||||
pub use codex_utils_plugins::mention_syntax;
|
||||
|
||||
@@ -27,29 +26,6 @@ pub use provider::ResolvedPluginLocation;
|
||||
use serde_json::Map;
|
||||
use serde_json::Value;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct AppConnectorId(pub String);
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct AppDeclaration {
|
||||
pub name: String,
|
||||
pub connector_id: AppConnectorId,
|
||||
pub category: Option<String>,
|
||||
}
|
||||
|
||||
pub fn app_connector_ids_from_declarations<'a>(
|
||||
app_declarations: impl IntoIterator<Item = &'a AppDeclaration>,
|
||||
) -> Vec<AppConnectorId> {
|
||||
let mut connector_ids = Vec::new();
|
||||
let mut seen_connector_ids = HashSet::new();
|
||||
for app in app_declarations {
|
||||
if seen_connector_ids.insert(&app.connector_id) {
|
||||
connector_ids.push(app.connector_id.clone());
|
||||
}
|
||||
}
|
||||
connector_ids
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq)]
|
||||
pub struct PluginCapabilitySummary {
|
||||
pub config_name: String,
|
||||
@@ -58,7 +34,6 @@ pub struct PluginCapabilitySummary {
|
||||
pub description: Option<String>,
|
||||
pub has_skills: bool,
|
||||
pub mcp_server_names: Vec<String>,
|
||||
pub app_connector_ids: Vec<AppConnectorId>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
@@ -91,7 +66,5 @@ pub struct PluginTelemetryMetadata {
|
||||
/// Local plugin identifier used by Codex configuration and the plugin cache,
|
||||
/// when it has been resolved.
|
||||
pub plugin_id: Option<PluginId>,
|
||||
/// Optional backend identifier for remote plugins.
|
||||
pub remote_plugin_id: Option<String>,
|
||||
pub capability_summary: Option<PluginCapabilitySummary>,
|
||||
}
|
||||
|
||||
@@ -7,11 +7,8 @@ use codex_utils_plugins::PluginIdentity;
|
||||
use codex_utils_plugins::PluginSkillRoot;
|
||||
use codex_utils_plugins::SkillDiscoveryMode;
|
||||
|
||||
use crate::AppConnectorId;
|
||||
use crate::AppDeclaration;
|
||||
use crate::PluginCapabilitySummary;
|
||||
use crate::PluginHookSource;
|
||||
use crate::app_connector_ids_from_declarations;
|
||||
|
||||
const MAX_CAPABILITY_SUMMARY_DESCRIPTION_LEN: usize = 1024;
|
||||
|
||||
@@ -19,7 +16,6 @@ const MAX_CAPABILITY_SUMMARY_DESCRIPTION_LEN: usize = 1024;
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct LoadedPlugin<M> {
|
||||
pub config_name: String,
|
||||
pub remote_plugin_id: Option<String>,
|
||||
pub manifest_name: Option<String>,
|
||||
pub plugin_namespace: Option<String>,
|
||||
pub manifest_description: Option<String>,
|
||||
@@ -30,7 +26,6 @@ pub struct LoadedPlugin<M> {
|
||||
pub disabled_skill_paths: HashSet<PathUri>,
|
||||
pub has_enabled_skills: bool,
|
||||
pub mcp_servers: HashMap<String, M>,
|
||||
pub apps: Vec<AppDeclaration>,
|
||||
pub hook_sources: Vec<PluginHookSource>,
|
||||
pub hook_load_warnings: Vec<String>,
|
||||
pub error: Option<String>,
|
||||
@@ -67,13 +62,9 @@ fn plugin_capability_summary_from_loaded<M>(
|
||||
description: prompt_safe_plugin_description(plugin.manifest_description.as_deref()),
|
||||
has_skills: plugin.has_enabled_skills,
|
||||
mcp_server_names,
|
||||
app_connector_ids: app_connector_ids_from_declarations(&plugin.apps),
|
||||
};
|
||||
|
||||
(summary.has_skills
|
||||
|| !summary.mcp_server_names.is_empty()
|
||||
|| !summary.app_connector_ids.is_empty())
|
||||
.then_some(summary)
|
||||
(summary.has_skills || !summary.mcp_server_names.is_empty()).then_some(summary)
|
||||
}
|
||||
|
||||
/// Normalizes plugin descriptions for inclusion in model-facing capability summaries.
|
||||
@@ -147,7 +138,6 @@ impl<M: Clone> PluginLoadOutcome<M> {
|
||||
path: path.clone(),
|
||||
plugin_identity: PluginIdentity {
|
||||
plugin_id: plugin.config_name.clone(),
|
||||
remote_plugin_id: plugin.remote_plugin_id.clone(),
|
||||
},
|
||||
plugin_namespace: plugin_namespace.clone(),
|
||||
plugin_root: plugin.root.clone(),
|
||||
@@ -173,15 +163,6 @@ impl<M: Clone> PluginLoadOutcome<M> {
|
||||
mcp_servers
|
||||
}
|
||||
|
||||
pub fn effective_apps(&self) -> Vec<AppConnectorId> {
|
||||
app_connector_ids_from_declarations(
|
||||
self.plugins
|
||||
.iter()
|
||||
.filter(|plugin| plugin.is_active())
|
||||
.flat_map(|plugin| plugin.apps.iter()),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn effective_plugin_hook_sources(&self) -> Vec<PluginHookSource> {
|
||||
self.iter_effective_plugin_hook_sources().cloned().collect()
|
||||
}
|
||||
@@ -227,7 +208,6 @@ mod tests {
|
||||
fn loaded_plugin(config_name: &str, skill_roots: Vec<AbsolutePathBuf>) -> LoadedPlugin<()> {
|
||||
LoadedPlugin {
|
||||
config_name: config_name.to_string(),
|
||||
remote_plugin_id: None,
|
||||
manifest_name: None,
|
||||
plugin_namespace: Some(
|
||||
config_name
|
||||
@@ -243,7 +223,6 @@ mod tests {
|
||||
disabled_skill_paths: HashSet::new(),
|
||||
has_enabled_skills: true,
|
||||
mcp_servers: HashMap::new(),
|
||||
apps: Vec::new(),
|
||||
hook_sources: Vec::new(),
|
||||
hook_load_warnings: Vec::new(),
|
||||
error: None,
|
||||
@@ -253,8 +232,7 @@ mod tests {
|
||||
#[test]
|
||||
fn effective_plugin_skill_roots_preserves_first_plugin_for_shared_root() {
|
||||
let shared_root = test_path("shared-skills");
|
||||
let mut first_plugin = loaded_plugin("zeta@test", vec![shared_root.clone()]);
|
||||
first_plugin.remote_plugin_id = Some("plugins~Plugin_zeta".to_string());
|
||||
let first_plugin = loaded_plugin("zeta@test", vec![shared_root.clone()]);
|
||||
let outcome = PluginLoadOutcome::from_plugins(vec![
|
||||
first_plugin,
|
||||
loaded_plugin("alpha@test", vec![shared_root.clone()]),
|
||||
@@ -266,7 +244,6 @@ mod tests {
|
||||
path: shared_root,
|
||||
plugin_identity: PluginIdentity {
|
||||
plugin_id: "zeta@test".to_string(),
|
||||
remote_plugin_id: Some("plugins~Plugin_zeta".to_string()),
|
||||
},
|
||||
plugin_namespace: "zeta".to_string(),
|
||||
plugin_root: test_path("zeta@test"),
|
||||
|
||||
@@ -20,7 +20,6 @@ pub struct PluginManifestPaths<Resource> {
|
||||
pub skills: Vec<Resource>,
|
||||
pub onboarding_skill: Option<Resource>,
|
||||
pub mcp_servers: Option<PluginManifestMcpServers<Resource>>,
|
||||
pub apps: Option<Resource>,
|
||||
pub hooks: Option<PluginManifestHooks<Resource>>,
|
||||
}
|
||||
|
||||
@@ -108,7 +107,6 @@ impl<Resource> PluginManifest<Resource> {
|
||||
skills,
|
||||
onboarding_skill,
|
||||
mcp_servers,
|
||||
apps,
|
||||
hooks,
|
||||
} = paths;
|
||||
let hooks = match hooks {
|
||||
@@ -185,7 +183,6 @@ impl<Resource> PluginManifest<Resource> {
|
||||
.collect::<Result<Vec<_>, _>>()?,
|
||||
onboarding_skill: onboarding_skill.map(&mut map).transpose()?,
|
||||
mcp_servers,
|
||||
apps: apps.map(&mut map).transpose()?,
|
||||
hooks,
|
||||
},
|
||||
interface,
|
||||
|
||||
@@ -32,7 +32,6 @@ fn environment_descriptor_binds_every_manifest_resource() {
|
||||
let manifest_path = root.join(".codex-plugin/plugin.json");
|
||||
let skills = root.join("skills");
|
||||
let mcp_servers = root.join(".mcp.json");
|
||||
let apps = root.join(".app.json");
|
||||
let hooks = root.join("hooks/hooks.json");
|
||||
let composer_icon = root.join("assets/composer.svg");
|
||||
let logo = root.join("assets/logo.svg");
|
||||
@@ -46,7 +45,6 @@ fn environment_descriptor_binds_every_manifest_resource() {
|
||||
onboarding_skill: None,
|
||||
skills: vec![path_uri(&skills)],
|
||||
mcp_servers: Some(PluginManifestMcpServers::Path(path_uri(&mcp_servers))),
|
||||
apps: Some(path_uri(&apps)),
|
||||
hooks: Some(PluginManifestHooks::Paths(vec![path_uri(&hooks)])),
|
||||
},
|
||||
interface: Some(PluginManifestInterface {
|
||||
@@ -84,7 +82,6 @@ fn environment_descriptor_binds_every_manifest_resource() {
|
||||
"executor-1",
|
||||
&mcp_servers,
|
||||
))),
|
||||
apps: Some(resource("executor-1", &apps)),
|
||||
hooks: Some(PluginManifestHooks::Paths(vec![resource(
|
||||
"executor-1",
|
||||
&hooks
|
||||
@@ -114,7 +111,6 @@ fn environment_descriptor_rejects_resources_outside_package_root() {
|
||||
onboarding_skill: None,
|
||||
skills: Vec::new(),
|
||||
mcp_servers: Some(PluginManifestMcpServers::Path(path_uri(&outside))),
|
||||
apps: None,
|
||||
hooks: None,
|
||||
},
|
||||
interface: None,
|
||||
|
||||
Reference in New Issue
Block a user