mirror of
https://github.com/openai/codex.git
synced 2026-12-02 00:31:03 +00:00
feat(plugins): surface marketplace remote routes
This commit is contained in:
+15
@@ -12108,6 +12108,14 @@
|
||||
"title": "PluginListParams",
|
||||
"type": "object"
|
||||
},
|
||||
"PluginListRemoteRoute": {
|
||||
"enum": [
|
||||
"global",
|
||||
"workspace-directory",
|
||||
"shared-with-me"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"PluginListResponse": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"properties": {
|
||||
@@ -12130,6 +12138,13 @@
|
||||
"$ref": "#/definitions/v2/PluginMarketplaceEntry"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"remoteRoutes": {
|
||||
"default": [],
|
||||
"items": {
|
||||
"$ref": "#/definitions/v2/PluginListRemoteRoute"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
||||
+15
@@ -8657,6 +8657,14 @@
|
||||
"title": "PluginListParams",
|
||||
"type": "object"
|
||||
},
|
||||
"PluginListRemoteRoute": {
|
||||
"enum": [
|
||||
"global",
|
||||
"workspace-directory",
|
||||
"shared-with-me"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"PluginListResponse": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"properties": {
|
||||
@@ -8679,6 +8687,13 @@
|
||||
"$ref": "#/definitions/PluginMarketplaceEntry"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"remoteRoutes": {
|
||||
"default": [],
|
||||
"items": {
|
||||
"$ref": "#/definitions/PluginListRemoteRoute"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
||||
@@ -193,6 +193,14 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"PluginListRemoteRoute": {
|
||||
"enum": [
|
||||
"global",
|
||||
"workspace-directory",
|
||||
"shared-with-me"
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"PluginMarketplaceEntry": {
|
||||
"properties": {
|
||||
"interface": {
|
||||
@@ -522,6 +530,13 @@
|
||||
"$ref": "#/definitions/PluginMarketplaceEntry"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"remoteRoutes": {
|
||||
"default": [],
|
||||
"items": {
|
||||
"$ref": "#/definitions/PluginListRemoteRoute"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type PluginListRemoteRoute = "global" | "workspace-directory" | "shared-with-me";
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { MarketplaceLoadErrorInfo } from "./MarketplaceLoadErrorInfo";
|
||||
import type { PluginListRemoteRoute } from "./PluginListRemoteRoute";
|
||||
import type { PluginMarketplaceEntry } from "./PluginMarketplaceEntry";
|
||||
|
||||
export type PluginListResponse = { marketplaces: Array<PluginMarketplaceEntry>, marketplaceLoadErrors: Array<MarketplaceLoadErrorInfo>, featuredPluginIds: Array<string>, };
|
||||
export type PluginListResponse = { marketplaces: Array<PluginMarketplaceEntry>, marketplaceLoadErrors: Array<MarketplaceLoadErrorInfo>, featuredPluginIds: Array<string>, remoteRoutes: Array<PluginListRemoteRoute>, };
|
||||
|
||||
@@ -270,6 +270,7 @@ export type { PluginInstalledResponse } from "./PluginInstalledResponse";
|
||||
export type { PluginInterface } from "./PluginInterface";
|
||||
export type { PluginListMarketplaceKind } from "./PluginListMarketplaceKind";
|
||||
export type { PluginListParams } from "./PluginListParams";
|
||||
export type { PluginListRemoteRoute } from "./PluginListRemoteRoute";
|
||||
export type { PluginListResponse } from "./PluginListResponse";
|
||||
export type { PluginMarketplaceEntry } from "./PluginMarketplaceEntry";
|
||||
export type { PluginReadParams } from "./PluginReadParams";
|
||||
|
||||
@@ -152,6 +152,20 @@ pub enum PluginListMarketplaceKind {
|
||||
SharedWithMe,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub enum PluginListRemoteRoute {
|
||||
#[serde(rename = "global")]
|
||||
#[ts(rename = "global")]
|
||||
Global,
|
||||
#[serde(rename = "workspace-directory")]
|
||||
#[ts(rename = "workspace-directory")]
|
||||
WorkspaceDirectory,
|
||||
#[serde(rename = "shared-with-me")]
|
||||
#[ts(rename = "shared-with-me")]
|
||||
SharedWithMe,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
@@ -161,6 +175,8 @@ pub struct PluginListResponse {
|
||||
pub marketplace_load_errors: Vec<MarketplaceLoadErrorInfo>,
|
||||
#[serde(default)]
|
||||
pub featured_plugin_ids: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub remote_routes: Vec<PluginListRemoteRoute>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
|
||||
@@ -2695,6 +2695,29 @@ fn plugin_marketplace_entry_serializes_remote_only_path_as_null() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn plugin_list_response_serializes_remote_routes() {
|
||||
assert_eq!(
|
||||
serde_json::to_value(PluginListResponse {
|
||||
marketplaces: Vec::new(),
|
||||
marketplace_load_errors: Vec::new(),
|
||||
featured_plugin_ids: Vec::new(),
|
||||
remote_routes: vec![
|
||||
PluginListRemoteRoute::Global,
|
||||
PluginListRemoteRoute::WorkspaceDirectory,
|
||||
PluginListRemoteRoute::SharedWithMe,
|
||||
],
|
||||
})
|
||||
.unwrap(),
|
||||
json!({
|
||||
"marketplaces": [],
|
||||
"marketplaceLoadErrors": [],
|
||||
"featuredPluginIds": [],
|
||||
"remoteRoutes": ["global", "workspace-directory", "shared-with-me"],
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn plugin_interface_serializes_local_paths_and_remote_urls_separately() {
|
||||
let composer_icon = if cfg!(windows) {
|
||||
|
||||
@@ -197,7 +197,7 @@ Example with notification opt-out:
|
||||
- `marketplace/add` — add a remote plugin marketplace from an HTTP(S) Git URL, SSH Git URL, or GitHub `owner/repo` shorthand, then persist it into the user marketplace config. Returns the installed root path plus whether the marketplace was already present.
|
||||
- `marketplace/remove` — remove a configured marketplace by name from the user marketplace config, and delete its installed marketplace root when one exists.
|
||||
- `marketplace/upgrade` — upgrade all configured Git plugin marketplaces, or one named marketplace when `marketplaceName` is provided. Returns selected marketplace names, upgraded roots, and per-marketplace errors.
|
||||
- `plugin/list` — list discovered plugin marketplaces and plugin state, including effective marketplace install/auth policy metadata, plugin `availability` (`AVAILABLE` by default or `DISABLED_BY_ADMIN` for remote plugins blocked upstream), fail-open `marketplaceLoadErrors` entries for marketplace files that could not be parsed or loaded, and best-effort `featuredPluginIds` for the official curated marketplace. `interface.category` uses the marketplace category when present; otherwise it falls back to the plugin manifest category (**under development; do not call from production clients yet**).
|
||||
- `plugin/list` — list discovered plugin marketplaces and plugin state, including effective marketplace install/auth policy metadata, plugin `availability` (`AVAILABLE` by default or `DISABLED_BY_ADMIN` for remote plugins blocked upstream), fail-open `marketplaceLoadErrors` entries for marketplace files that could not be parsed or loaded, best-effort `featuredPluginIds` for the official curated marketplace, and `remoteRoutes` for the remote catalog routes that successfully participated in the response. `interface.category` uses the marketplace category when present; otherwise it falls back to the plugin manifest category (**under development; do not call from production clients yet**).
|
||||
- `plugin/installed` — list installed plugin rows plus any explicitly requested local install-suggestion plugin names, without fetching the broader remote catalog. Mention surfaces can use this narrower view when they need plugin mention payloads rather than plugin-page discovery data (**under development; do not call from production clients yet**).
|
||||
- `plugin/read` — read one plugin by `marketplacePath` plus `pluginName`, returning marketplace info, a list-style `summary`, manifest descriptions/interface metadata, and bundled skills/hooks/apps/MCP server names. Returned plugin skills include their current `enabled` state after local config filtering; bundled hooks are returned as lightweight declaration summaries keyed for correlation with `hooks/list`. Plugin app summaries also include `needsAuth` when the server can determine connector accessibility (**under development; do not call from production clients yet**).
|
||||
- `plugin/skill/read` — read remote plugin skill markdown on demand by `remoteMarketplaceName`, `remotePluginId`, and `skillName`. This lets clients preview uninstalled remote plugin skills without downloading the plugin bundle.
|
||||
|
||||
@@ -111,6 +111,7 @@ use codex_app_server_protocol::PluginInstalledResponse;
|
||||
use codex_app_server_protocol::PluginInterface;
|
||||
use codex_app_server_protocol::PluginListMarketplaceKind;
|
||||
use codex_app_server_protocol::PluginListParams;
|
||||
use codex_app_server_protocol::PluginListRemoteRoute;
|
||||
use codex_app_server_protocol::PluginListResponse;
|
||||
use codex_app_server_protocol::PluginMarketplaceEntry;
|
||||
use codex_app_server_protocol::PluginReadParams;
|
||||
|
||||
@@ -481,6 +481,7 @@ impl PluginRequestProcessor {
|
||||
marketplaces: Vec::new(),
|
||||
marketplace_load_errors: Vec::new(),
|
||||
featured_plugin_ids: Vec::new(),
|
||||
remote_routes: Vec::new(),
|
||||
};
|
||||
if !config.features.enabled(Feature::Plugins) {
|
||||
return Ok(empty_response());
|
||||
@@ -576,6 +577,7 @@ impl PluginRequestProcessor {
|
||||
{
|
||||
remote_sources.push(RemoteMarketplaceSource::SharedWithMe);
|
||||
}
|
||||
let mut remote_routes = Vec::new();
|
||||
if !remote_sources.is_empty() {
|
||||
let remote_plugin_service_config = RemotePluginServiceConfig {
|
||||
chatgpt_base_url: config.chatgpt_base_url.clone(),
|
||||
@@ -588,6 +590,18 @@ impl PluginRequestProcessor {
|
||||
.await
|
||||
{
|
||||
Ok(remote_marketplaces) => {
|
||||
remote_routes = remote_sources
|
||||
.iter()
|
||||
.map(|source| match source {
|
||||
RemoteMarketplaceSource::Global => PluginListRemoteRoute::Global,
|
||||
RemoteMarketplaceSource::WorkspaceDirectory => {
|
||||
PluginListRemoteRoute::WorkspaceDirectory
|
||||
}
|
||||
RemoteMarketplaceSource::SharedWithMe => {
|
||||
PluginListRemoteRoute::SharedWithMe
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
for remote_marketplace in remote_marketplaces
|
||||
.into_iter()
|
||||
.map(remote_marketplace_to_info)
|
||||
@@ -655,6 +669,7 @@ impl PluginRequestProcessor {
|
||||
marketplaces: data,
|
||||
marketplace_load_errors,
|
||||
featured_plugin_ids,
|
||||
remote_routes,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ use codex_app_server_protocol::PluginInstalledParams;
|
||||
use codex_app_server_protocol::PluginInstalledResponse;
|
||||
use codex_app_server_protocol::PluginListMarketplaceKind;
|
||||
use codex_app_server_protocol::PluginListParams;
|
||||
use codex_app_server_protocol::PluginListRemoteRoute;
|
||||
use codex_app_server_protocol::PluginListResponse;
|
||||
use codex_app_server_protocol::PluginMarketplaceEntry;
|
||||
use codex_app_server_protocol::PluginShareDiscoverability;
|
||||
@@ -443,6 +444,7 @@ async fn plugin_list_returns_empty_when_workspace_codex_plugins_disabled() -> Re
|
||||
marketplaces: Vec::new(),
|
||||
marketplace_load_errors: Vec::new(),
|
||||
featured_plugin_ids: Vec::new(),
|
||||
remote_routes: Vec::new(),
|
||||
}
|
||||
);
|
||||
Ok(())
|
||||
@@ -1710,6 +1712,7 @@ async fn plugin_list_includes_remote_marketplaces_when_remote_plugin_enabled() -
|
||||
)
|
||||
.await??;
|
||||
let response: PluginListResponse = to_response(response)?;
|
||||
assert_eq!(response.remote_routes, vec![PluginListRemoteRoute::Global]);
|
||||
|
||||
let remote_marketplace = response
|
||||
.marketplaces
|
||||
@@ -2031,6 +2034,10 @@ async fn plugin_list_fetches_workspace_directory_kind_without_remote_plugin_flag
|
||||
.await??;
|
||||
let response: PluginListResponse = to_response(response)?;
|
||||
|
||||
assert_eq!(
|
||||
response.remote_routes,
|
||||
vec![PluginListRemoteRoute::WorkspaceDirectory]
|
||||
);
|
||||
assert_eq!(response.marketplaces.len(), 1);
|
||||
let marketplace = &response.marketplaces[0];
|
||||
assert_eq!(marketplace.name, "workspace-directory");
|
||||
@@ -2148,6 +2155,10 @@ async fn plugin_list_fetches_shared_with_me_kind() -> Result<()> {
|
||||
.await??;
|
||||
let response: PluginListResponse = to_response(response)?;
|
||||
|
||||
assert_eq!(
|
||||
response.remote_routes,
|
||||
vec![PluginListRemoteRoute::SharedWithMe]
|
||||
);
|
||||
assert_eq!(response.marketplaces.len(), 2);
|
||||
let marketplace = response
|
||||
.marketplaces
|
||||
@@ -2311,6 +2322,7 @@ plugin_sharing = false
|
||||
marketplaces: Vec::new(),
|
||||
marketplace_load_errors: Vec::new(),
|
||||
featured_plugin_ids: Vec::new(),
|
||||
remote_routes: Vec::new(),
|
||||
}
|
||||
);
|
||||
wait_for_remote_plugin_request_count(
|
||||
|
||||
@@ -166,6 +166,7 @@ async fn run_list(overrides: Vec<(String, toml::Value)>) -> Result<()> {
|
||||
}
|
||||
|
||||
let default_install_root = marketplace_install_root(config.codex_home.as_path());
|
||||
println!("NAME\tSOURCE\tPATH");
|
||||
for (marketplace_name, marketplace) in configured_marketplaces {
|
||||
if !marketplace.is_table() {
|
||||
eprintln!("Ignoring invalid marketplace `{marketplace_name}`: expected table.");
|
||||
@@ -182,7 +183,11 @@ async fn run_list(overrides: Vec<(String, toml::Value)>) -> Result<()> {
|
||||
)
|
||||
.map(|root| root.display().to_string())
|
||||
.unwrap_or_else(|| "<invalid source>".to_string());
|
||||
println!("{marketplace_name}\t{root}");
|
||||
let source = marketplace
|
||||
.get("source")
|
||||
.and_then(toml::Value::as_str)
|
||||
.unwrap_or("-");
|
||||
println!("{marketplace_name}\t{source}\t{root}");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -126,6 +126,7 @@ async fn marketplace_list_shows_configured_marketplace_names() -> Result<()> {
|
||||
.args(["plugin", "marketplace", "list"])
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(contains("NAME\tSOURCE\tPATH"))
|
||||
.stdout(contains("debug"))
|
||||
.stdout(contains(source.path().display().to_string()));
|
||||
|
||||
|
||||
@@ -1017,6 +1017,7 @@ mod tests {
|
||||
],
|
||||
marketplace_load_errors: Vec::new(),
|
||||
featured_plugin_ids: Vec::new(),
|
||||
remote_routes: Vec::new(),
|
||||
};
|
||||
|
||||
hide_cli_only_plugin_marketplaces(&mut response);
|
||||
|
||||
@@ -1365,6 +1365,7 @@ pub(super) fn plugins_test_response(
|
||||
marketplaces,
|
||||
marketplace_load_errors: Vec::new(),
|
||||
featured_plugin_ids: Vec::new(),
|
||||
remote_routes: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user