Separate plugin catalog listing from package resolution (#46567)

## What changed

- Move catalog types and the `PluginProvider` listing interface into `codex-core-plugins`, with a concrete `PluginListQuery` carrying thread, turn, and MCP resource context.
- Remove root resolution from `PluginProvider`; keep executor package access in `ExecutorPluginProvider::resolve_bound`, which retains the filesystem used to resolve the package.
- Add shared provider result and error types, and re-export the listing API from `codex-mcp-extension`.

## Testing

Update executor and manifest tests to use `resolve_bound`, and assert that malformed manifest errors preserve the underlying `serde_json::Error` as their source.

GitOrigin-RevId: c6cd5a0269ed3b8ac9b93f306a70821e63e3671e
This commit is contained in:
Anthony Tafoya
2026-09-19 01:49:01 +00:00
committed by copyberry
parent ef9f3d022a
commit a7e069dc3a
10 changed files with 311 additions and 321 deletions
+1 -36
View File
@@ -1,12 +1,7 @@
//! Shared APIs for catalog discovery and root-at-a-time plugin resolution.
//! Authority-bound plugin descriptors and resource locations.
use crate::PluginCatalog;
use crate::manifest::PluginManifest;
use codex_protocol::capabilities::SelectedCapabilityRoot;
use codex_utils_path_uri::PathUri;
use std::error::Error as StdError;
use std::future::Future;
use std::pin::Pin;
use thiserror::Error;
/// A plugin resource paired with the environment that owns its filesystem.
@@ -108,36 +103,6 @@ fn environment_resource(
})
}
/// Error returned when a provider cannot produce a complete catalog snapshot.
#[derive(Clone, Debug, Error, PartialEq, Eq)]
#[error("{0}")]
pub struct PluginProviderError(pub String);
pub type PluginProviderFuture<'a, T> =
Pin<Box<dyn Future<Output = Result<T, PluginProviderError>> + Send + 'a>>;
/// Discovers plugin metadata through batch listing or single-root resolution.
///
/// Cloud providers implement `list`; executor providers continue implementing `resolve`.
/// Each contributor invokes its provider's supported operation; the other is a no-op.
pub trait PluginProvider<ListQuery = ()>: Send + Sync {
/// Error returned by root-at-a-time resolution.
type Error: StdError + Send + Sync + 'static;
/// Returns a complete snapshot.
fn list(&self, _query: ListQuery) -> PluginProviderFuture<'_, PluginCatalog> {
Box::pin(async { Ok(PluginCatalog::default()) })
}
/// Resolves one selected root using the filesystem authority named by that root.
fn resolve(
&self,
_root: &SelectedCapabilityRoot,
) -> impl Future<Output = Result<Option<ResolvedPlugin>, Self::Error>> + Send {
async { Ok(None) }
}
}
#[cfg(test)]
#[path = "provider_tests.rs"]
mod tests;