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
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:
@@ -27,7 +27,6 @@ mod plugin_metrics_sidecar;
|
||||
mod provider;
|
||||
mod recommended_plugin_install;
|
||||
pub mod remote;
|
||||
pub mod remote_bundle;
|
||||
pub mod remote_legacy;
|
||||
mod remote_metadata;
|
||||
mod remote_plugin_id_resolver;
|
||||
|
||||
@@ -162,4 +162,3 @@ fn enforce_total_extracted_size(
|
||||
*extracted_bytes = next_total;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
use crate::app_mcp_routing::apply_app_mcp_routing_policy;
|
||||
use crate::error_subtype::http_status_sub_error_type;
|
||||
use crate::http_client_selector::HttpClientSelector;
|
||||
@@ -27,7 +26,6 @@ use codex_plugin::PluginId;
|
||||
use codex_plugin::app_connector_ids_from_declarations;
|
||||
use codex_plugin::prompt_safe_plugin_description;
|
||||
use codex_runtime_agent_instance::RuntimeAuthSlot;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use http::StatusCode;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
@@ -61,22 +59,11 @@ pub(crate) use remote_installed_plugin_sync::sync_remote_installed_plugin_bundle
|
||||
pub use search::RemotePluginSearchPage;
|
||||
pub use search::RemotePluginSearchRequest;
|
||||
pub use search::search_remote_plugins;
|
||||
pub use share::RemotePluginShareAccessPolicy;
|
||||
pub use share::RemotePluginShareDiscoverability;
|
||||
pub use share::RemotePluginSharePrincipal;
|
||||
pub use share::RemotePluginSharePrincipalRole;
|
||||
pub use share::RemotePluginSharePrincipalType;
|
||||
pub use share::RemotePluginShareSaveResult;
|
||||
pub use share::RemotePluginShareTarget;
|
||||
pub use share::RemotePluginShareTargetRole;
|
||||
pub use share::RemotePluginShareUpdateDiscoverability;
|
||||
pub use share::RemotePluginShareUpdateTargetsResult;
|
||||
pub use share::checkout_remote_plugin_share;
|
||||
pub use share::delete_remote_plugin_share;
|
||||
pub use share::list_remote_plugin_shares;
|
||||
pub use share::load_plugin_share_remote_ids_by_local_path;
|
||||
pub use share::save_remote_plugin_share;
|
||||
pub use share::update_remote_plugin_share_targets;
|
||||
|
||||
pub const REMOTE_GLOBAL_MARKETPLACE_NAME: &str = "openai-curated-remote";
|
||||
pub const REMOTE_CREATED_BY_ME_MARKETPLACE_NAME: &str = "created-by-me-remote";
|
||||
@@ -168,7 +155,6 @@ impl RemotePluginServiceConfig {
|
||||
runtime_auth: None,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl PartialEq for RemotePluginServiceConfig {
|
||||
@@ -287,12 +273,6 @@ pub struct RemotePluginShareContext {
|
||||
pub can_publish_to_workspace: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct RemotePluginShareSummary {
|
||||
pub summary: RemotePluginSummary,
|
||||
pub local_plugin_path: Option<AbsolutePathBuf>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct RemotePluginDetail {
|
||||
pub marketplace_name: String,
|
||||
@@ -301,7 +281,6 @@ pub struct RemotePluginDetail {
|
||||
pub share_url: Option<String>,
|
||||
pub description: Option<String>,
|
||||
pub release_version: Option<String>,
|
||||
pub bundle_download_url: Option<String>,
|
||||
pub app_manifest: Option<JsonValue>,
|
||||
pub skills: Vec<RemotePluginSkill>,
|
||||
pub onboarding_skill_name: Option<String>,
|
||||
@@ -459,27 +438,6 @@ pub enum RemotePluginCatalogError {
|
||||
#[error("invalid plugin path `{path}`: {reason}")]
|
||||
InvalidPluginPath { path: PathBuf, reason: String },
|
||||
|
||||
#[error("remote plugin `{remote_plugin_id}` is not available for plugin/share/checkout")]
|
||||
PluginShareCheckoutNotAvailable { remote_plugin_id: String },
|
||||
|
||||
#[error("failed to archive plugin at `{path}`: {source}")]
|
||||
Archive {
|
||||
path: PathBuf,
|
||||
#[source]
|
||||
source: std::io::Error,
|
||||
},
|
||||
|
||||
#[error("failed to join plugin archive task: {0}")]
|
||||
ArchiveJoin(#[source] tokio::task::JoinError),
|
||||
|
||||
#[error(
|
||||
"plugin archive would be {bytes} bytes, exceeding the maximum upload size of {max_bytes} bytes"
|
||||
)]
|
||||
ArchiveTooLarge { bytes: usize, max_bytes: usize },
|
||||
|
||||
#[error("workspace plugin upload response did not include an etag")]
|
||||
MissingUploadEtag,
|
||||
|
||||
#[error("{0}")]
|
||||
UnexpectedResponse(String),
|
||||
|
||||
@@ -510,11 +468,6 @@ impl RemotePluginCatalogError {
|
||||
| Self::UnexpectedSkillName { .. }
|
||||
| Self::UnexpectedEnabledState { .. }
|
||||
| Self::InvalidPluginPath { .. }
|
||||
| Self::PluginShareCheckoutNotAvailable { .. }
|
||||
| Self::Archive { .. }
|
||||
| Self::ArchiveJoin(_)
|
||||
| Self::ArchiveTooLarge { .. }
|
||||
| Self::MissingUploadEtag
|
||||
| Self::UnexpectedResponse(_)
|
||||
| Self::InstalledPluginsFetchTimeout
|
||||
| Self::CacheRemove(_) => None,
|
||||
@@ -626,8 +579,6 @@ struct RemotePluginReleaseResponse {
|
||||
display_name: String,
|
||||
description: String,
|
||||
#[serde(default)]
|
||||
bundle_download_url: Option<String>,
|
||||
#[serde(default)]
|
||||
app_ids: Vec<String>,
|
||||
#[serde(default)]
|
||||
app_manifest: Option<JsonValue>,
|
||||
@@ -1025,7 +976,6 @@ pub(crate) async fn fetch_recommended_plugin_install_metadata(
|
||||
config,
|
||||
auth,
|
||||
plugin_id,
|
||||
/*include_download_urls*/ false,
|
||||
RECOMMENDED_PLUGINS_TIMEOUT,
|
||||
)
|
||||
.await
|
||||
@@ -1202,7 +1152,6 @@ pub(crate) async fn fetch_remote_installed_plugins_with_display_assets(
|
||||
config,
|
||||
auth,
|
||||
RemoteInstalledPluginScope::All,
|
||||
/*include_download_urls*/ false,
|
||||
display_assets,
|
||||
)
|
||||
.await?
|
||||
@@ -1277,14 +1226,16 @@ pub async fn fetch_remote_plugin_detail(
|
||||
marketplace_name: &str,
|
||||
plugin_id: &str,
|
||||
) -> Result<RemotePluginDetail, RemotePluginCatalogError> {
|
||||
fetch_remote_plugin_detail_with_download_url_option(
|
||||
config,
|
||||
auth,
|
||||
marketplace_name,
|
||||
plugin_id,
|
||||
/*include_download_urls*/ false,
|
||||
)
|
||||
.await
|
||||
let auth = ensure_chatgpt_auth(auth)?;
|
||||
let _ = marketplace_name;
|
||||
let plugin = fetch_plugin_detail(config, auth, plugin_id).await?;
|
||||
let scope = plugin.scope;
|
||||
let marketplace_name = remote_plugin_canonical_marketplace_name(&plugin)?.to_string();
|
||||
// Remote plugin IDs uniquely identify remote plugins, so the caller-provided
|
||||
// marketplace name is not validated here. The backend detail response is the
|
||||
// source of truth for the plugin's actual scope/marketplace.
|
||||
|
||||
build_remote_plugin_detail(config, auth, scope, marketplace_name, plugin_id, plugin).await
|
||||
}
|
||||
|
||||
pub async fn fetch_remote_plugin_share_context(
|
||||
@@ -1293,29 +1244,10 @@ pub async fn fetch_remote_plugin_share_context(
|
||||
plugin_id: &str,
|
||||
) -> Result<Option<RemotePluginShareContext>, RemotePluginCatalogError> {
|
||||
let auth = ensure_chatgpt_auth(auth)?;
|
||||
let plugin = fetch_plugin_detail(
|
||||
config, auth, plugin_id, /*include_download_urls*/ false,
|
||||
)
|
||||
.await?;
|
||||
let plugin = fetch_plugin_detail(config, auth, plugin_id).await?;
|
||||
remote_plugin_share_context(&plugin)
|
||||
}
|
||||
|
||||
pub async fn fetch_remote_plugin_detail_with_download_urls(
|
||||
config: &RemotePluginServiceConfig,
|
||||
auth: Option<&CodexAuth>,
|
||||
marketplace_name: &str,
|
||||
plugin_id: &str,
|
||||
) -> Result<RemotePluginDetail, RemotePluginCatalogError> {
|
||||
fetch_remote_plugin_detail_with_download_url_option(
|
||||
config,
|
||||
auth,
|
||||
marketplace_name,
|
||||
plugin_id,
|
||||
/*include_download_urls*/ true,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn fetch_remote_plugin_skill_detail(
|
||||
config: &RemotePluginServiceConfig,
|
||||
auth: Option<&CodexAuth>,
|
||||
@@ -1327,24 +1259,6 @@ pub async fn fetch_remote_plugin_skill_detail(
|
||||
Err(RemotePluginCatalogError::Unavailable)
|
||||
}
|
||||
|
||||
async fn fetch_remote_plugin_detail_with_download_url_option(
|
||||
config: &RemotePluginServiceConfig,
|
||||
auth: Option<&CodexAuth>,
|
||||
_marketplace_name: &str,
|
||||
plugin_id: &str,
|
||||
include_download_urls: bool,
|
||||
) -> Result<RemotePluginDetail, RemotePluginCatalogError> {
|
||||
let auth = ensure_chatgpt_auth(auth)?;
|
||||
let plugin = fetch_plugin_detail(config, auth, plugin_id, include_download_urls).await?;
|
||||
let scope = plugin.scope;
|
||||
let marketplace_name = remote_plugin_canonical_marketplace_name(&plugin)?.to_string();
|
||||
// Remote plugin IDs uniquely identify remote plugins, so the caller-provided
|
||||
// marketplace name is not validated here. The backend detail response is the
|
||||
// source of truth for the plugin's actual scope/marketplace.
|
||||
|
||||
build_remote_plugin_detail(config, auth, scope, marketplace_name, plugin_id, plugin).await
|
||||
}
|
||||
|
||||
async fn build_remote_plugin_detail(
|
||||
config: &RemotePluginServiceConfig,
|
||||
auth: &CodexAuth,
|
||||
@@ -1392,7 +1306,6 @@ async fn build_remote_plugin_detail(
|
||||
share_url: plugin.share_url,
|
||||
description: non_empty_string(Some(&plugin.release.description)),
|
||||
release_version: plugin.release.version,
|
||||
bundle_download_url: plugin.release.bundle_download_url,
|
||||
app_manifest: plugin.release.app_manifest,
|
||||
skills,
|
||||
onboarding_skill_name: plugin.release.onboarding_skill_name,
|
||||
@@ -1509,13 +1422,7 @@ pub async fn resolve_remote_plugin_uninstall_target(
|
||||
remote_plugin_id: &str,
|
||||
) -> Result<RemotePluginUninstallTarget, RemotePluginCatalogError> {
|
||||
let auth = ensure_chatgpt_auth(auth)?;
|
||||
let plugin = fetch_plugin_detail(
|
||||
config,
|
||||
auth,
|
||||
remote_plugin_id,
|
||||
/*include_download_urls*/ false,
|
||||
)
|
||||
.await?;
|
||||
let plugin = fetch_plugin_detail(config, auth, remote_plugin_id).await?;
|
||||
let marketplace_name = remote_plugin_canonical_marketplace_name(&plugin)?.to_string();
|
||||
let plugin_id = PluginId::new(plugin.name.clone(), marketplace_name).map_err(|err| {
|
||||
RemotePluginCatalogError::UnexpectedResponse(format!(
|
||||
@@ -1928,7 +1835,6 @@ async fn fetch_installed_plugins_for_scope(
|
||||
config,
|
||||
auth,
|
||||
RemoteInstalledPluginScope::Single(scope),
|
||||
/*include_download_urls*/ false,
|
||||
InstalledPluginDisplayAssets::Include,
|
||||
)
|
||||
.await
|
||||
@@ -1938,7 +1844,6 @@ async fn fetch_installed_plugins(
|
||||
config: &RemotePluginServiceConfig,
|
||||
auth: &CodexAuth,
|
||||
scope: RemoteInstalledPluginScope,
|
||||
include_download_urls: bool,
|
||||
display_assets: InstalledPluginDisplayAssets,
|
||||
) -> Result<Vec<RemotePluginInstalledItem>, RemotePluginCatalogError> {
|
||||
// Only a complete inventory is authoritative: every failure discards all fetched pages
|
||||
@@ -1953,7 +1858,6 @@ async fn fetch_installed_plugins(
|
||||
auth,
|
||||
scope,
|
||||
page_token.as_deref(),
|
||||
include_download_urls,
|
||||
display_assets,
|
||||
)
|
||||
.await?;
|
||||
@@ -2001,10 +1905,9 @@ async fn get_remote_plugin_installed_page(
|
||||
auth: &CodexAuth,
|
||||
scope: RemoteInstalledPluginScope,
|
||||
page_token: Option<&str>,
|
||||
include_download_urls: bool,
|
||||
display_assets: InstalledPluginDisplayAssets,
|
||||
) -> Result<RemotePluginInstalledResponse, RemotePluginCatalogError> {
|
||||
let _ = (config, auth, scope, page_token, include_download_urls, display_assets);
|
||||
let _ = (config, auth, scope, page_token, display_assets);
|
||||
Err(RemotePluginCatalogError::Unavailable)
|
||||
}
|
||||
|
||||
@@ -2012,26 +1915,17 @@ async fn fetch_plugin_detail(
|
||||
config: &RemotePluginServiceConfig,
|
||||
auth: &CodexAuth,
|
||||
plugin_id: &str,
|
||||
include_download_urls: bool,
|
||||
) -> Result<RemotePluginDirectoryItem, RemotePluginCatalogError> {
|
||||
fetch_plugin_detail_with_timeout(
|
||||
config,
|
||||
auth,
|
||||
plugin_id,
|
||||
include_download_urls,
|
||||
REMOTE_PLUGIN_CATALOG_TIMEOUT,
|
||||
)
|
||||
.await
|
||||
fetch_plugin_detail_with_timeout(config, auth, plugin_id, REMOTE_PLUGIN_CATALOG_TIMEOUT).await
|
||||
}
|
||||
|
||||
async fn fetch_plugin_detail_with_timeout(
|
||||
config: &RemotePluginServiceConfig,
|
||||
auth: &CodexAuth,
|
||||
plugin_id: &str,
|
||||
include_download_urls: bool,
|
||||
timeout: Duration,
|
||||
) -> Result<RemotePluginDirectoryItem, RemotePluginCatalogError> {
|
||||
let _ = (config, auth, plugin_id, include_download_urls, timeout);
|
||||
let _ = (config, auth, plugin_id, timeout);
|
||||
Err(RemotePluginCatalogError::Unavailable)
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -35,4 +35,3 @@ pub async fn search_remote_plugins(
|
||||
let _ = (config, auth, search);
|
||||
Err(RemotePluginCatalogError::Unavailable)
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -6,23 +6,16 @@ use super::EffectivePluginsChangedCallback;
|
||||
use super::PluginInstallOutcome;
|
||||
use super::PluginsConfigInput;
|
||||
use super::PluginsManager;
|
||||
use crate::marketplace::MarketplacePluginAuthPolicy;
|
||||
use crate::remote;
|
||||
use crate::remote::RemoteInstalledPluginBundleSyncError;
|
||||
use crate::remote::RemotePluginCacheMutationGuard;
|
||||
use crate::remote::RemotePluginCatalogError;
|
||||
use crate::remote::RemotePluginDetail;
|
||||
use crate::remote_bundle;
|
||||
use crate::remote_bundle::RemotePluginBundleInstallError;
|
||||
use codex_app_server_protocol::PluginAuthPolicy;
|
||||
use codex_app_server_protocol::PluginAvailability;
|
||||
use codex_app_server_protocol::PluginInstallPolicy;
|
||||
use codex_login::CodexAuth;
|
||||
use codex_plugin::PluginId;
|
||||
use codex_plugin::PluginTelemetryMetadata;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
pub struct RemotePluginInstallRequest {
|
||||
pub marketplace_name: String,
|
||||
pub remote_plugin_id: String,
|
||||
@@ -60,8 +53,6 @@ pub enum RemotePluginOperationErrorKind {
|
||||
context: &'static str,
|
||||
source: RemotePluginCatalogError,
|
||||
},
|
||||
#[error("install remote plugin bundle: {0}")]
|
||||
Bundle(#[source] RemotePluginBundleInstallError),
|
||||
#[error("{context}: {source}")]
|
||||
Sync {
|
||||
context: &'static str,
|
||||
@@ -103,112 +94,12 @@ impl PluginsManager {
|
||||
}
|
||||
remote::validate_remote_plugin_id(&remote_plugin_id)
|
||||
.map_err(|err| unresolved(Error::InvalidRequest(err.message)))?;
|
||||
let service = self
|
||||
.remote_plugin_service_config(config)
|
||||
.for_current_account();
|
||||
let detail = remote::fetch_remote_plugin_detail_with_download_urls(
|
||||
&service,
|
||||
auth,
|
||||
&marketplace_name,
|
||||
&remote_plugin_id,
|
||||
)
|
||||
.await
|
||||
.map_err(|source| {
|
||||
unresolved(Error::Catalog {
|
||||
context: "read remote plugin details before install",
|
||||
source,
|
||||
})
|
||||
})?;
|
||||
let plugin_id = PluginId::parse(&detail.summary.id).map_err(|err| {
|
||||
unresolved(Error::Internal(format!(
|
||||
"invalid resolved plugin id `{}`: {err}",
|
||||
detail.summary.id
|
||||
)))
|
||||
})?;
|
||||
let resolved = |kind| RemotePluginOperationError {
|
||||
plugin_id: Some(plugin_id.clone()),
|
||||
kind: Box::new(kind),
|
||||
};
|
||||
if detail.summary.availability == PluginAvailability::DisabledByAdmin {
|
||||
return Err(resolved(Error::DisabledByAdmin(remote_plugin_id)));
|
||||
}
|
||||
if detail.summary.install_policy == PluginInstallPolicy::NotAvailable {
|
||||
return Err(resolved(Error::NotAvailable(remote_plugin_id)));
|
||||
}
|
||||
let bundle = remote_bundle::validate_remote_plugin_bundle(
|
||||
&remote_plugin_id,
|
||||
&detail.marketplace_name,
|
||||
&detail.summary.name,
|
||||
detail.release_version.as_deref(),
|
||||
detail.bundle_download_url.as_deref(),
|
||||
detail.app_manifest.clone(),
|
||||
)
|
||||
.map_err(|err| resolved(Error::Bundle(err)))?;
|
||||
let _sync_guard = self
|
||||
.acquire_remote_installed_plugin_sync_guard()
|
||||
.await
|
||||
.map_err(|source| {
|
||||
resolved(Error::Sync {
|
||||
context: "failed to coordinate remote plugin install",
|
||||
source,
|
||||
})
|
||||
})?;
|
||||
let cache_mutation = remote::mark_remote_plugin_cache_mutation_in_flight(
|
||||
&self.codex_home,
|
||||
&detail.marketplace_name,
|
||||
&detail.summary.name,
|
||||
);
|
||||
// Materialize first: a failed download must never leave a backend installation behind.
|
||||
let installed = remote_bundle::download_and_install_remote_plugin_bundle(
|
||||
&service,
|
||||
self.codex_home.clone(),
|
||||
bundle,
|
||||
)
|
||||
.await
|
||||
.map_err(|err| resolved(Error::Bundle(err)))?;
|
||||
let install_result = if let Some(install_attempt_id) = install_attempt_id.as_deref() {
|
||||
remote::install_remote_plugin_with_install_attempt_id(
|
||||
&service,
|
||||
auth,
|
||||
&detail.marketplace_name,
|
||||
&remote_plugin_id,
|
||||
install_attempt_id,
|
||||
)
|
||||
.await
|
||||
} else {
|
||||
remote::install_remote_plugin(
|
||||
&service,
|
||||
auth,
|
||||
&detail.marketplace_name,
|
||||
&remote_plugin_id,
|
||||
)
|
||||
.await
|
||||
}
|
||||
.map_err(|source| {
|
||||
resolved(Error::Catalog {
|
||||
context: "install remote plugin",
|
||||
source,
|
||||
})
|
||||
})?;
|
||||
self.maybe_start_remote_installed_plugins_cache_refresh_after_mutation(
|
||||
config,
|
||||
auth.cloned(),
|
||||
on_effective_plugins_changed,
|
||||
);
|
||||
Ok(RemotePluginInstallOutcome {
|
||||
installed: PluginInstallOutcome {
|
||||
plugin_id: installed.plugin_id,
|
||||
plugin_version: installed.plugin_version,
|
||||
installed_path: installed.installed_path,
|
||||
auth_policy: match detail.summary.auth_policy {
|
||||
PluginAuthPolicy::OnInstall => MarketplacePluginAuthPolicy::OnInstall,
|
||||
PluginAuthPolicy::OnUse => MarketplacePluginAuthPolicy::OnUse,
|
||||
},
|
||||
},
|
||||
detail,
|
||||
app_ids_needing_auth: install_result.app_ids_needing_auth,
|
||||
_cache_mutation: cache_mutation,
|
||||
})
|
||||
// aKode never downloads plugin bundles from backend-provided URLs.
|
||||
let _ = (auth, install_attempt_id, on_effective_plugins_changed);
|
||||
Err(unresolved(Error::Catalog {
|
||||
context: "install remote plugin",
|
||||
source: RemotePluginCatalogError::Unavailable,
|
||||
}))
|
||||
}
|
||||
|
||||
/// Remove the backend installation and local cache, then schedule an installed-state refresh.
|
||||
|
||||
@@ -124,7 +124,6 @@ impl PluginMeasurementTarget {
|
||||
}
|
||||
|
||||
impl TrustedPluginRoots {
|
||||
|
||||
/// Adds already-trusted roots, preserving the existing root for each plugin and version.
|
||||
/// Distinct versions remain eligible for exact executor-version matching.
|
||||
pub fn extend(&mut self, other: &Self) {
|
||||
|
||||
Reference in New Issue
Block a user