This commit is contained in:
alexsong-oai
2026-04-16 01:19:11 -07:00
parent b22947dfdf
commit 6929f0cf5b
2 changed files with 31 additions and 37 deletions

View File

@@ -289,15 +289,16 @@ impl ExternalAgentConfigService {
&config,
&PluginsManager::new(self.codex_home.clone()),
)?;
self.detect_plugin_migration(
if let Some(item) = self.detect_plugin_migration(
source_settings.as_path(),
repo_root.unwrap_or(self.external_agent_home.as_path()),
cwd.clone(),
Some(settings),
settings,
&configured_plugin_ids,
&configured_marketplace_plugins,
items,
);
) {
items.push(item);
}
}
Err(err) => {
tracing::warn!(
@@ -324,33 +325,28 @@ impl ExternalAgentConfigService {
source_settings: &Path,
source_root: &Path,
cwd: Option<PathBuf>,
settings: Option<&JsonValue>,
settings: &JsonValue,
configured_plugin_ids: &HashSet<String>,
configured_marketplace_plugins: &BTreeMap<String, HashSet<String>>,
items: &mut Vec<ExternalAgentConfigMigrationItem>,
) {
let Some(plugin_details) = settings.and_then(|settings| {
extract_plugin_migration_details(
settings,
source_root,
configured_plugin_ids,
configured_marketplace_plugins,
)
}) else {
return;
};
items.push(ExternalAgentConfigMigrationItem {
item_type: ExternalAgentConfigMigrationItemType::Plugins,
description: format!("Import enabled plugins from {}", source_settings.display()),
cwd,
details: Some(plugin_details),
});
) -> Option<ExternalAgentConfigMigrationItem> {
let plugin_details = extract_plugin_migration_details(
settings,
source_root,
configured_plugin_ids,
configured_marketplace_plugins,
)?;
emit_migration_metric(
EXTERNAL_AGENT_CONFIG_DETECT_METRIC,
ExternalAgentConfigMigrationItemType::Plugins,
/*skills_count*/ None,
);
Some(ExternalAgentConfigMigrationItem {
item_type: ExternalAgentConfigMigrationItemType::Plugins,
description: format!("Import enabled plugins from {}", source_settings.display()),
cwd,
details: Some(plugin_details),
})
}
async fn import_plugins(

View File

@@ -1037,20 +1037,18 @@ async fn import_plugins_supports_external_agent_plugin_marketplace_layout() {
fs::write(
external_agent_home.join("settings.json"),
format!(
r#"{{
"enabledPlugins": {{
serde_json::to_string_pretty(&serde_json::json!({
"enabledPlugins": {
"cloudflare@my-plugins": true
}},
"extraKnownMarketplaces": {{
"my-plugins": {{
"source": "local",
"path": "{}"
}}
}}
}}"#,
marketplace_root.display()
),
},
"extraKnownMarketplaces": {
"my-plugins": {
"source": "local",
"path": marketplace_root
}
}
}))
.expect("serialize settings"),
)
.expect("write settings");
fs::write(