mirror of
https://github.com/openai/codex.git
synced 2026-06-01 19:02:59 +00:00
feat: Expose plugin versions and gate plugin sharing (#22397)
- Adds localVersion to plugin summaries and remoteVersion to share
context, including generated API schemas.
- Hydrates local and remote plugin versions from manifests and remote
release metadata.
- Adds default-on plugin_sharing gate for shared-with-me listing and
plugin/share/save, with disabled-path errors
and focused coverage.
This commit is contained in:
@@ -111,6 +111,7 @@ fn share_context_for_source(
|
||||
.cloned()
|
||||
.map(|remote_plugin_id| PluginShareContext {
|
||||
remote_plugin_id,
|
||||
remote_version: None,
|
||||
discoverability: None,
|
||||
share_url: None,
|
||||
creator_account_user_id: None,
|
||||
@@ -483,6 +484,7 @@ impl PluginRequestProcessor {
|
||||
PluginSummary {
|
||||
id: plugin.id,
|
||||
remote_plugin_id: None,
|
||||
local_version: plugin.local_version,
|
||||
installed: plugin.installed,
|
||||
enabled: plugin.enabled,
|
||||
name: plugin.name,
|
||||
@@ -533,7 +535,9 @@ impl PluginRequestProcessor {
|
||||
if marketplace_kinds.contains(&PluginListMarketplaceKind::WorkspaceDirectory) {
|
||||
remote_sources.push(RemoteMarketplaceSource::WorkspaceDirectory);
|
||||
}
|
||||
if marketplace_kinds.contains(&PluginListMarketplaceKind::SharedWithMe) {
|
||||
if marketplace_kinds.contains(&PluginListMarketplaceKind::SharedWithMe)
|
||||
&& config.features.enabled(Feature::PluginSharing)
|
||||
{
|
||||
remote_sources.push(RemoteMarketplaceSource::SharedWithMe);
|
||||
}
|
||||
if !remote_sources.is_empty() {
|
||||
@@ -673,17 +677,21 @@ impl PluginRequestProcessor {
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(Some(remote_share_context))
|
||||
if remote_share_context.share_principals.is_some() =>
|
||||
{
|
||||
Some(remote_plugin_share_context_to_info(remote_share_context))
|
||||
}
|
||||
Ok(Some(_)) => {
|
||||
warn!(
|
||||
remote_plugin_id = %context.remote_plugin_id,
|
||||
"remote shared plugin detail did not include share principals; returning local share mapping context"
|
||||
);
|
||||
Some(context)
|
||||
Ok(Some(remote_share_context)) => {
|
||||
if remote_share_context.share_principals.is_some() {
|
||||
Some(remote_plugin_share_context_to_info(remote_share_context))
|
||||
} else {
|
||||
let remote_version = remote_share_context.remote_version;
|
||||
let remote_plugin_id = context.remote_plugin_id.clone();
|
||||
warn!(
|
||||
remote_plugin_id = %remote_plugin_id,
|
||||
"remote shared plugin detail did not include share principals; returning local share mapping context with remote version"
|
||||
);
|
||||
Some(PluginShareContext {
|
||||
remote_version,
|
||||
..context
|
||||
})
|
||||
}
|
||||
}
|
||||
Ok(None) => {
|
||||
warn!(
|
||||
@@ -725,6 +733,7 @@ impl PluginRequestProcessor {
|
||||
summary: PluginSummary {
|
||||
id: outcome.plugin.id,
|
||||
remote_plugin_id: None,
|
||||
local_version: outcome.plugin.local_version,
|
||||
name: outcome.plugin.name,
|
||||
share_context,
|
||||
source: marketplace_plugin_source_to_info(outcome.plugin.source),
|
||||
@@ -840,6 +849,9 @@ impl PluginRequestProcessor {
|
||||
params: PluginShareSaveParams,
|
||||
) -> Result<PluginShareSaveResponse, JSONRPCErrorError> {
|
||||
let (config, auth) = self.load_plugin_share_config_and_auth().await?;
|
||||
if !config.features.enabled(Feature::PluginSharing) {
|
||||
return Err(invalid_request("plugin sharing is disabled"));
|
||||
}
|
||||
let PluginShareSaveParams {
|
||||
plugin_path,
|
||||
remote_plugin_id,
|
||||
@@ -1589,6 +1601,7 @@ fn remote_plugin_summary_to_info(summary: RemoteCatalogPluginSummary) -> PluginS
|
||||
PluginSummary {
|
||||
id: summary.id,
|
||||
remote_plugin_id: Some(summary.remote_plugin_id),
|
||||
local_version: None,
|
||||
name: summary.name,
|
||||
share_context: summary
|
||||
.share_context
|
||||
@@ -1609,6 +1622,7 @@ fn remote_plugin_share_context_to_info(
|
||||
) -> PluginShareContext {
|
||||
PluginShareContext {
|
||||
remote_plugin_id: context.remote_plugin_id,
|
||||
remote_version: context.remote_version,
|
||||
discoverability: Some(remote_plugin_share_discoverability_to_info(
|
||||
context.discoverability,
|
||||
)),
|
||||
|
||||
Reference in New Issue
Block a user