Surface unavailable remote plugin details

This commit is contained in:
xli-oai
2026-04-16 17:08:16 -07:00
parent c21015683d
commit c67dac89d2
10 changed files with 258 additions and 2 deletions
@@ -10102,6 +10102,16 @@
"null"
]
},
"detailsUnavailableReason": {
"anyOf": [
{
"$ref": "#/definitions/v2/PluginDetailsUnavailableReason"
},
{
"type": "null"
}
]
},
"marketplaceName": {
"type": "string"
},
@@ -10134,6 +10144,12 @@
],
"type": "object"
},
"PluginDetailsUnavailableReason": {
"enum": [
"installRequiredForRemoteSource"
],
"type": "string"
},
"PluginInstallParams": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
@@ -6874,6 +6874,16 @@
"null"
]
},
"detailsUnavailableReason": {
"anyOf": [
{
"$ref": "#/definitions/PluginDetailsUnavailableReason"
},
{
"type": "null"
}
]
},
"marketplaceName": {
"type": "string"
},
@@ -6906,6 +6916,12 @@
],
"type": "object"
},
"PluginDetailsUnavailableReason": {
"enum": [
"installRequiredForRemoteSource"
],
"type": "string"
},
"PluginInstallParams": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
@@ -58,6 +58,16 @@
"null"
]
},
"detailsUnavailableReason": {
"anyOf": [
{
"$ref": "#/definitions/PluginDetailsUnavailableReason"
},
{
"type": "null"
}
]
},
"marketplaceName": {
"type": "string"
},
@@ -90,6 +100,12 @@
],
"type": "object"
},
"PluginDetailsUnavailableReason": {
"enum": [
"installRequiredForRemoteSource"
],
"type": "string"
},
"PluginInstallPolicy": {
"enum": [
"NOT_AVAILABLE",
@@ -3,7 +3,8 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AbsolutePathBuf } from "../AbsolutePathBuf";
import type { AppSummary } from "./AppSummary";
import type { PluginDetailsUnavailableReason } from "./PluginDetailsUnavailableReason";
import type { PluginSummary } from "./PluginSummary";
import type { SkillSummary } from "./SkillSummary";
export type PluginDetail = { marketplaceName: string, marketplacePath: AbsolutePathBuf, summary: PluginSummary, description: string | null, skills: Array<SkillSummary>, apps: Array<AppSummary>, mcpServers: Array<string>, };
export type PluginDetail = { marketplaceName: string, marketplacePath: AbsolutePathBuf, summary: PluginSummary, description: string | null, skills: Array<SkillSummary>, apps: Array<AppSummary>, mcpServers: Array<string>, detailsUnavailableReason: PluginDetailsUnavailableReason | null, };
@@ -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 PluginDetailsUnavailableReason = "installRequiredForRemoteSource";
@@ -224,6 +224,7 @@ export type { PermissionsRequestApprovalResponse } from "./PermissionsRequestApp
export type { PlanDeltaNotification } from "./PlanDeltaNotification";
export type { PluginAuthPolicy } from "./PluginAuthPolicy";
export type { PluginDetail } from "./PluginDetail";
export type { PluginDetailsUnavailableReason } from "./PluginDetailsUnavailableReason";
export type { PluginInstallParams } from "./PluginInstallParams";
export type { PluginInstallPolicy } from "./PluginInstallPolicy";
export type { PluginInstallResponse } from "./PluginInstallResponse";
@@ -3589,6 +3589,14 @@ pub struct PluginDetail {
pub skills: Vec<SkillSummary>,
pub apps: Vec<AppSummary>,
pub mcp_servers: Vec<String>,
pub details_unavailable_reason: Option<PluginDetailsUnavailableReason>,
}
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub enum PluginDetailsUnavailableReason {
InstallRequiredForRemoteSource,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
+1 -1
View File
@@ -185,7 +185,7 @@ Example with notification opt-out:
- `skills/list` — list skills for one or more `cwd` values (optional `forceReload`).
- `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.
- `plugin/list` — list discovered plugin marketplaces and plugin state, including effective marketplace install/auth policy metadata, 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. Pass `forceRemoteSync: true` to refresh curated plugin state before listing (**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/apps/MCP server names. Returned plugin skills include their current `enabled` state after local config filtering. Plugin app summaries also include `needsAuth` when the server can determine connector accessibility (**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/apps/MCP server names. For uninstalled remote Git plugin sources, `detailsUnavailableReason` is `installRequiredForRemoteSource` and bundled skills/apps/MCP servers are empty so browsing does not clone remote content. Returned plugin skills include their current `enabled` state after local config filtering. Plugin app summaries also include `needsAuth` when the server can determine connector accessibility (**under development; do not call from production clients yet**).
- `skills/changed` — notification emitted when watched local skill files change.
- `app/list` — list available apps.
- `skills/config/write` — write user-level skill config by name or absolute path.
@@ -98,6 +98,7 @@ use codex_app_server_protocol::MockExperimentalMethodResponse;
use codex_app_server_protocol::ModelListParams;
use codex_app_server_protocol::ModelListResponse;
use codex_app_server_protocol::PluginDetail;
use codex_app_server_protocol::PluginDetailsUnavailableReason;
use codex_app_server_protocol::PluginInstallParams;
use codex_app_server_protocol::PluginInstallResponse;
use codex_app_server_protocol::PluginInterface;
@@ -235,6 +236,7 @@ use codex_core::find_thread_path_by_id_str;
use codex_core::path_utils;
use codex_core::plugins::MarketplaceAddError;
use codex_core::plugins::OPENAI_CURATED_MARKETPLACE_NAME;
use codex_core::plugins::PluginDetailsUnavailableReason as CorePluginDetailsUnavailableReason;
use codex_core::plugins::PluginInstallError as CorePluginInstallError;
use codex_core::plugins::PluginInstallRequest;
use codex_core::plugins::PluginReadRequest;
@@ -6407,6 +6409,13 @@ impl CodexMessageProcessor {
skills: plugin_skills_to_info(&visible_skills, &outcome.plugin.disabled_skill_paths),
apps: app_summaries,
mcp_servers: outcome.plugin.mcp_server_names,
details_unavailable_reason: outcome.plugin.details_unavailable_reason.map(|reason| {
match reason {
CorePluginDetailsUnavailableReason::InstallRequiredForRemoteSource => {
PluginDetailsUnavailableReason::InstallRequiredForRemoteSource
}
}
}),
};
self.outgoing
@@ -19,6 +19,8 @@ use axum::routing::get;
use codex_app_server_protocol::AppInfo;
use codex_app_server_protocol::JSONRPCResponse;
use codex_app_server_protocol::PluginAuthPolicy;
use codex_app_server_protocol::PluginDetailsUnavailableReason;
use codex_app_server_protocol::PluginInstallParams;
use codex_app_server_protocol::PluginInstallPolicy;
use codex_app_server_protocol::PluginReadParams;
use codex_app_server_protocol::PluginReadResponse;
@@ -262,6 +264,163 @@ enabled = true
Ok(())
}
#[tokio::test]
async fn plugin_read_returns_install_required_for_uninstalled_git_source() -> Result<()> {
let codex_home = TempDir::new()?;
write_plugins_enabled_config(&codex_home)?;
let repo_root = TempDir::new()?;
let missing_remote_repo = repo_root.path().join("missing-remote-plugin-repo");
let missing_remote_repo_url = url::Url::from_directory_path(&missing_remote_repo)
.unwrap()
.to_string();
std::fs::create_dir_all(repo_root.path().join(".git"))?;
std::fs::create_dir_all(repo_root.path().join(".agents/plugins"))?;
std::fs::write(
repo_root.path().join(".agents/plugins/marketplace.json"),
format!(
r#"{{
"name": "debug",
"plugins": [
{{
"name": "toolkit",
"source": {{
"source": "git-subdir",
"url": "{missing_remote_repo_url}",
"path": "plugins/toolkit"
}}
}}
]
}}"#
),
)?;
let mut mcp = McpProcess::new(codex_home.path()).await?;
timeout(DEFAULT_TIMEOUT, mcp.initialize()).await??;
let request_id = mcp
.send_plugin_read_request(PluginReadParams {
marketplace_path: AbsolutePathBuf::try_from(
repo_root.path().join(".agents/plugins/marketplace.json"),
)?,
plugin_name: "toolkit".to_string(),
})
.await?;
let response: JSONRPCResponse = timeout(
DEFAULT_TIMEOUT,
mcp.read_stream_until_response_message(RequestId::Integer(request_id)),
)
.await??;
let response: PluginReadResponse = to_response(response)?;
assert_eq!(
response.plugin.details_unavailable_reason,
Some(PluginDetailsUnavailableReason::InstallRequiredForRemoteSource)
);
assert!(!response.plugin.summary.installed);
assert!(response.plugin.skills.is_empty());
assert!(response.plugin.apps.is_empty());
assert!(response.plugin.mcp_servers.is_empty());
assert!(
!codex_home
.path()
.join("plugins/.marketplace-plugin-source-staging")
.exists()
);
Ok(())
}
#[tokio::test]
async fn plugin_read_returns_full_details_after_git_source_install() -> Result<()> {
let codex_home = TempDir::new()?;
write_plugins_enabled_config(&codex_home)?;
let repo_root = TempDir::new()?;
let remote_repo = TempDir::new()?;
let remote_repo_url = url::Url::from_directory_path(remote_repo.path())
.unwrap()
.to_string();
let remote_plugin_root = remote_repo.path().join("plugins/toolkit");
std::fs::create_dir_all(remote_plugin_root.join(".codex-plugin"))?;
std::fs::create_dir_all(remote_plugin_root.join("skills/search"))?;
std::fs::write(
remote_plugin_root.join(".codex-plugin/plugin.json"),
r#"{
"name": "toolkit",
"description": "Remote toolkit plugin"
}"#,
)?;
std::fs::write(
remote_plugin_root.join("skills/search/SKILL.md"),
"---\nname: search\ndescription: search remote data\n---\n",
)?;
std::fs::write(
remote_plugin_root.join(".mcp.json"),
r#"{"mcpServers":{"toolkit":{"command":"toolkit-mcp"}}}"#,
)?;
init_git_repo(remote_repo.path());
std::fs::create_dir_all(repo_root.path().join(".git"))?;
std::fs::create_dir_all(repo_root.path().join(".agents/plugins"))?;
std::fs::write(
repo_root.path().join(".agents/plugins/marketplace.json"),
format!(
r#"{{
"name": "debug",
"plugins": [
{{
"name": "toolkit",
"source": {{
"source": "git-subdir",
"url": "{remote_repo_url}",
"path": "plugins/toolkit"
}}
}}
]
}}"#
),
)?;
let mut mcp = McpProcess::new(codex_home.path()).await?;
timeout(DEFAULT_TIMEOUT, mcp.initialize()).await??;
let marketplace_path =
AbsolutePathBuf::try_from(repo_root.path().join(".agents/plugins/marketplace.json"))?;
let install_request_id = mcp
.send_plugin_install_request(PluginInstallParams {
marketplace_path: marketplace_path.clone(),
plugin_name: "toolkit".to_string(),
force_remote_sync: false,
})
.await?;
timeout(
DEFAULT_TIMEOUT,
mcp.read_stream_until_response_message(RequestId::Integer(install_request_id)),
)
.await??;
let read_request_id = mcp
.send_plugin_read_request(PluginReadParams {
marketplace_path,
plugin_name: "toolkit".to_string(),
})
.await?;
let response: JSONRPCResponse = timeout(
DEFAULT_TIMEOUT,
mcp.read_stream_until_response_message(RequestId::Integer(read_request_id)),
)
.await??;
let response: PluginReadResponse = to_response(response)?;
assert_eq!(response.plugin.details_unavailable_reason, None);
assert!(response.plugin.summary.installed);
assert_eq!(
response.plugin.description.as_deref(),
Some("Remote toolkit plugin")
);
assert_eq!(response.plugin.skills.len(), 1);
assert_eq!(response.plugin.skills[0].name, "toolkit:search");
assert_eq!(response.plugin.mcp_servers, vec!["toolkit".to_string()]);
Ok(())
}
#[tokio::test]
async fn plugin_read_returns_app_needs_auth() -> Result<()> {
let connectors = vec![
@@ -549,6 +708,31 @@ plugins = true
Ok(())
}
fn init_git_repo(repo: &std::path::Path) {
run_git(repo, &["init"]);
run_git(repo, &["config", "user.email", "codex-test@example.com"]);
run_git(repo, &["config", "user.name", "Codex Test"]);
run_git(repo, &["add", "."]);
run_git(repo, &["commit", "-m", "initial"]);
}
fn run_git(repo: &std::path::Path, args: &[&str]) {
let output = std::process::Command::new("git")
.arg("-C")
.arg(repo)
.args(args)
.output()
.unwrap_or_else(|err| panic!("git should run: {err}"));
assert!(
output.status.success(),
"git -C {} {} failed\nstdout:\n{}\nstderr:\n{}",
repo.display(),
args.join(" "),
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr)
);
}
#[derive(Clone)]
struct AppsServerState {
response: Arc<StdMutex<serde_json::Value>>,