aKode fase 2b-1: rimossi plugin remoti e share, bundle download, UI usage/crediti/banner/workspace ChatGPT; fix argomenti MCP (inviati vuoti dopo e4209e2) e overlay TUI; test analytics-upload rimossi; test sicurezza MCP adattati
Some checks failed
blocking-ci / Bazel (push) Has been cancelled
blocking-ci / Blob size policy (push) Has been cancelled
blocking-ci / cargo-deny (push) Has been cancelled
blocking-ci / Codespell (push) Has been cancelled
blocking-ci / repo-checks (push) Has been cancelled
blocking-ci / rust-ci (push) Has been cancelled
blocking-ci / sdk (push) Has been cancelled
blocking-ci / CI required (push) Has been cancelled
postmerge-ci / rust-ci-full (push) Has been cancelled
postmerge-ci / v8-canary (push) Has been cancelled
postmerge-ci / Postmerge CI results (push) Has been cancelled

This commit is contained in:
Andrea
2026-11-09 16:24:36 +01:00
parent 0de669e9ce
commit 981745ccc8
190 changed files with 313 additions and 9756 deletions

View File

@@ -137,12 +137,10 @@ pub(crate) async fn sync_remote_installed_plugin_bundles_once_with_snapshot(
) -> Result<RemoteInstalledPluginBundleSyncResult, RemoteInstalledPluginBundleSyncError> {
let auth = ensure_chatgpt_auth(auth)?;
let config = &config.for_current_account();
let authenticated_account_id = auth.get_account_id();
let fetched_installed_plugins = fetch_installed_plugins(
config,
auth,
RemoteInstalledPluginScope::All,
/*include_download_urls*/ true,
InstalledPluginDisplayAssets::Include,
)
.await?;
@@ -213,7 +211,6 @@ pub(crate) async fn sync_remote_installed_plugin_bundles_once_with_snapshot(
BTreeSet::new(),
),
]);
let mut materialized_remote_plugins = BTreeMap::new();
let mut failed_remote_plugin_ids = BTreeSet::new();
let mut failed_materialization_remote_plugin_ids = BTreeSet::new();
let mut installed_plugins = Vec::new();
@@ -221,8 +218,6 @@ pub(crate) async fn sync_remote_installed_plugin_bundles_once_with_snapshot(
for (installed_plugin, cached_plugin, plugin_id) in validated_installed_plugins {
let marketplace_name = cached_plugin.marketplace_name.clone();
let plugin = installed_plugin.plugin;
let scope = plugin.scope;
let discoverability = plugin.discoverability;
installed_plugin_names_by_marketplace
.entry(marketplace_name.clone())
.or_default()
@@ -250,73 +245,15 @@ pub(crate) async fn sync_remote_installed_plugin_bundles_once_with_snapshot(
continue;
}
let bundle = match crate::remote_bundle::validate_remote_plugin_bundle(
&plugin.id,
&marketplace_name,
&plugin.name,
release_version,
plugin.release.bundle_download_url.as_deref(),
plugin.release.app_manifest.clone(),
) {
Ok(bundle) => bundle,
Err(err) => {
warn!(
remote_plugin_id = %plugin.id,
plugin = %plugin.name,
marketplace = %marketplace_name,
error = %err,
"skipping remote installed plugin bundle download"
);
failed_remote_plugin_ids.insert(plugin.id.clone());
failed_materialization_remote_plugin_ids.insert(plugin.id);
installed_plugins.push(cached_plugin);
continue;
}
};
// Read the old bundle before installation replaces it, including capabilities removed
// by the new version. Unchanged bundles never reach this metadata-loading path.
let mut capabilities = RemotePluginCapabilities::default();
capabilities.include_active_bundle(&store, &plugin_id).await;
match crate::remote_bundle::download_and_install_remote_plugin_bundle(
config,
codex_home.clone(),
bundle,
)
.await
{
Ok(result) => {
let plugin_id = result.plugin_id;
capabilities.include_active_bundle(&store, &plugin_id).await;
changed_plugins.insert(
plugin_id.as_key(),
RemotePluginChange {
plugin_id: plugin_id.as_key(),
capabilities,
},
);
materialized_remote_plugins.insert(
plugin_id.as_key(),
RemotePluginMaterialization {
plugin_id,
scope,
discoverability,
authenticated_account_id: authenticated_account_id.clone(),
},
);
}
Err(err) => {
warn!(
remote_plugin_id = %plugin.id,
plugin = %plugin.name,
marketplace = %marketplace_name,
error = %err,
"failed to download remote installed plugin bundle"
);
failed_remote_plugin_ids.insert(plugin.id.clone());
failed_materialization_remote_plugin_ids.insert(plugin.id);
}
}
// aKode never downloads plugin bundles from backend-provided URLs.
warn!(
remote_plugin_id = %plugin.id,
plugin = %plugin.name,
marketplace = %marketplace_name,
"remote plugin bundle downloads are not supported"
);
failed_remote_plugin_ids.insert(plugin.id.clone());
failed_materialization_remote_plugin_ids.insert(plugin.id);
installed_plugins.push(cached_plugin);
}
@@ -343,7 +280,7 @@ pub(crate) async fn sync_remote_installed_plugin_bundles_once_with_snapshot(
Ok(RemoteInstalledPluginBundleSyncResult {
outcome: RemoteInstalledPluginBundleSyncOutcome {
materialized_remote_plugins: materialized_remote_plugins.into_values().collect(),
materialized_remote_plugins: Vec::new(),
changed_plugins: changed_plugins.into_values().collect(),
failed_remote_plugin_ids: failed_remote_plugin_ids.into_iter().collect(),
failed_materialization_remote_plugin_ids: failed_materialization_remote_plugin_ids

View File

@@ -35,4 +35,3 @@ pub async fn search_remote_plugins(
let _ = (config, auth, search);
Err(RemotePluginCatalogError::Unavailable)
}

View File

@@ -1,5 +1,4 @@
use super::*;
use codex_login::CodexAuth;
use codex_utils_absolute_path::AbsolutePathBuf;
use serde::Deserialize;
use serde::Serialize;
@@ -7,24 +6,8 @@ use std::collections::BTreeMap;
use std::io;
use std::path::Path;
mod checkout;
mod local_paths;
pub use checkout::checkout_remote_plugin_share;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct RemotePluginShareSaveResult {
pub remote_plugin_id: String,
pub share_url: Option<String>,
pub can_publish_to_workspace: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub struct RemotePluginShareAccessPolicy {
pub discoverability: Option<RemotePluginShareDiscoverability>,
pub share_targets: Option<Vec<RemotePluginShareTarget>>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum RemotePluginShareDiscoverability {
@@ -33,14 +16,6 @@ pub enum RemotePluginShareDiscoverability {
Private,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub enum RemotePluginShareUpdateDiscoverability {
Listed,
Unlisted,
Private,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum RemotePluginSharePrincipalType {
@@ -49,13 +24,6 @@ pub enum RemotePluginSharePrincipalType {
Workspace,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RemotePluginShareTarget {
pub principal_type: RemotePluginSharePrincipalType,
pub principal_id: String,
pub role: RemotePluginShareTargetRole,
}
#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
pub struct RemotePluginSharePrincipal {
pub principal_type: RemotePluginSharePrincipalType,
@@ -64,13 +32,6 @@ pub struct RemotePluginSharePrincipal {
pub name: String,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum RemotePluginShareTargetRole {
Reader,
Editor,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum RemotePluginSharePrincipalRole {
@@ -79,33 +40,6 @@ pub enum RemotePluginSharePrincipalRole {
Owner,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct RemotePluginShareUpdateTargetsResult {
pub principals: Vec<RemotePluginSharePrincipal>,
pub discoverability: RemotePluginShareDiscoverability,
}
pub async fn save_remote_plugin_share(
config: &RemotePluginServiceConfig,
auth: Option<&CodexAuth>,
codex_home: &Path,
plugin_path: &AbsolutePathBuf,
remote_plugin_id: Option<&str>,
access_policy: RemotePluginShareAccessPolicy,
) -> Result<RemotePluginShareSaveResult, RemotePluginCatalogError> {
let _ = (config, auth, codex_home, plugin_path, remote_plugin_id, access_policy);
Err(RemotePluginCatalogError::Unavailable)
}
pub async fn list_remote_plugin_shares(
config: &RemotePluginServiceConfig,
auth: Option<&CodexAuth>,
codex_home: &Path,
) -> Result<Vec<RemotePluginShareSummary>, RemotePluginCatalogError> {
let _ = (config, auth, codex_home);
Err(RemotePluginCatalogError::Unavailable)
}
pub fn load_plugin_share_remote_ids_by_local_path(
codex_home: &Path,
) -> io::Result<BTreeMap<AbsolutePathBuf, String>> {
@@ -125,25 +59,3 @@ pub fn load_plugin_share_remote_ids_by_local_path(
})
.collect()
}
pub async fn delete_remote_plugin_share(
config: &RemotePluginServiceConfig,
auth: Option<&CodexAuth>,
codex_home: &Path,
remote_plugin_id: &str,
) -> Result<(), RemotePluginCatalogError> {
let _ = (config, auth, codex_home, remote_plugin_id);
Err(RemotePluginCatalogError::Unavailable)
}
pub async fn update_remote_plugin_share_targets(
config: &RemotePluginServiceConfig,
auth: Option<&CodexAuth>,
remote_plugin_id: &str,
targets: Vec<RemotePluginShareTarget>,
discoverability: RemotePluginShareUpdateDiscoverability,
) -> Result<RemotePluginShareUpdateTargetsResult, RemotePluginCatalogError> {
let _ = (config, auth, remote_plugin_id, targets, discoverability);
Err(RemotePluginCatalogError::Unavailable)
}

View File

@@ -1,16 +1,14 @@
use codex_utils_absolute_path::AbsolutePathBuf;
use serde::Deserialize;
use serde::Serialize;
use std::collections::BTreeMap;
use std::io;
use std::io::Write;
use std::path::Path;
use std::sync::Mutex;
const PLUGIN_SHARE_LOCAL_PATHS_FILE: &str = ".tmp/plugin-share-local-paths-v1.json";
static PLUGIN_SHARE_LOCAL_PATHS_LOCK: Mutex<()> = Mutex::new(());
#[derive(Debug, Default, Deserialize, Serialize)]
#[derive(Debug, Default, Deserialize)]
#[serde(rename_all = "camelCase")]
struct PluginShareLocalPaths {
#[serde(default)]
@@ -24,17 +22,6 @@ pub(crate) fn load_plugin_share_local_paths(
read_plugin_share_local_paths(codex_home)
}
pub(crate) fn record_plugin_share_local_path(
codex_home: &Path,
remote_plugin_id: &str,
plugin_path: AbsolutePathBuf,
) -> io::Result<()> {
let _guard = lock_plugin_share_local_paths()?;
let mut mapping = read_plugin_share_local_paths_for_update(codex_home)?;
mapping.insert(remote_plugin_id.to_string(), plugin_path);
write_plugin_share_local_paths(codex_home, mapping)
}
fn lock_plugin_share_local_paths() -> io::Result<std::sync::MutexGuard<'static, ()>> {
PLUGIN_SHARE_LOCAL_PATHS_LOCK
.lock()
@@ -63,52 +50,6 @@ fn read_plugin_share_local_paths(
Ok(mapping.local_plugin_paths_by_remote_plugin_id)
}
fn read_plugin_share_local_paths_for_update(
codex_home: &Path,
) -> io::Result<BTreeMap<String, AbsolutePathBuf>> {
match read_plugin_share_local_paths(codex_home) {
Ok(mapping) => Ok(mapping),
// This is a best-effort cache under .tmp, so malformed state should not
// permanently block future share saves or deletes.
Err(err) if err.kind() == io::ErrorKind::InvalidData => Ok(BTreeMap::new()),
Err(err) => Err(err),
}
}
fn write_plugin_share_local_paths(
codex_home: &Path,
mapping: BTreeMap<String, AbsolutePathBuf>,
) -> io::Result<()> {
let path = plugin_share_local_paths_path(codex_home);
if mapping.is_empty() {
match std::fs::remove_file(&path) {
Ok(()) => return Ok(()),
Err(err) if err.kind() == io::ErrorKind::NotFound => return Ok(()),
Err(err) => return Err(err),
}
}
let contents = serde_json::to_string_pretty(&PluginShareLocalPaths {
local_plugin_paths_by_remote_plugin_id: mapping,
})
.map_err(io::Error::other)?;
write_atomically(&path, &format!("{contents}\n"))
}
fn write_atomically(write_path: &Path, contents: &str) -> io::Result<()> {
let parent = write_path.parent().ok_or_else(|| {
io::Error::new(
io::ErrorKind::InvalidInput,
format!("path {} has no parent directory", write_path.display()),
)
})?;
std::fs::create_dir_all(parent)?;
let mut tmp = tempfile::NamedTempFile::new_in(parent)?;
tmp.write_all(contents.as_bytes())?;
tmp.persist(write_path).map_err(|err| err.error)?;
Ok(())
}
fn plugin_share_local_paths_path(codex_home: &Path) -> std::path::PathBuf {
codex_home.join(PLUGIN_SHARE_LOCAL_PATHS_FILE)
}