Files
codex/codex-rs/core-plugins/src/provider.rs
T
Anthony Tafoya a7e069dc3a 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
2026-09-19 01:49:01 +00:00

43 lines
1.4 KiB
Rust

//! Plugin catalog listing interface and the MCP context used to request snapshots.
use crate::ExecutorPluginProviderError;
use crate::PluginCatalog;
use codex_mcp::McpResourceClient;
use std::future::Future;
use std::pin::Pin;
use std::sync::Arc;
use thiserror::Error;
/// Turn identifiers and MCP client used to request one catalog snapshot.
#[derive(Clone, Debug)]
pub struct PluginListQuery {
pub thread_id: String,
pub turn_id: String,
pub mcp_resources: Option<Arc<McpResourceClient>>,
}
/// Failure to list plugin metadata.
#[derive(Debug, Error)]
pub enum PluginProviderError {
#[error(transparent)]
Executor(#[from] ExecutorPluginProviderError),
#[error("{0}")]
Message(String),
}
pub type PluginProviderResult<T> = Result<T, PluginProviderError>;
pub type PluginProviderFuture<'a, T> =
Pin<Box<dyn Future<Output = PluginProviderResult<T>> + Send + 'a>>;
/// Lists plugin metadata without resolving packages or binding filesystems.
///
/// Cloud providers implement `list`; executor listing is not yet supported.
/// Package access uses [`crate::ExecutorPluginProvider::resolve_bound`] directly.
pub trait PluginProvider: Send + Sync {
/// Returns a complete snapshot; on error, callers retain the previous snapshot.
fn list(&self, _query: PluginListQuery) -> PluginProviderFuture<'_, PluginCatalog> {
Box::pin(async { Ok(PluginCatalog::default()) })
}
}