mirror of
https://github.com/openai/codex.git
synced 2026-11-16 22:00:36 +00:00
Add marketplace update check RPC
This commit is contained in:
@@ -1551,6 +1551,17 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"MarketplaceCheckUpdatesParams": {
|
||||
"properties": {
|
||||
"marketplaceName": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
},
|
||||
"MarketplaceRemoveParams": {
|
||||
"properties": {
|
||||
"marketplaceName": {
|
||||
@@ -5382,6 +5393,30 @@
|
||||
"title": "Marketplace/removeRequest",
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"id": {
|
||||
"$ref": "#/definitions/RequestId"
|
||||
},
|
||||
"method": {
|
||||
"enum": [
|
||||
"marketplace/checkUpdates"
|
||||
],
|
||||
"title": "Marketplace/checkUpdatesRequestMethod",
|
||||
"type": "string"
|
||||
},
|
||||
"params": {
|
||||
"$ref": "#/definitions/MarketplaceCheckUpdatesParams"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"method",
|
||||
"params"
|
||||
],
|
||||
"title": "Marketplace/checkUpdatesRequest",
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"id": {
|
||||
|
||||
+115
@@ -829,6 +829,30 @@
|
||||
"title": "Marketplace/removeRequest",
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"id": {
|
||||
"$ref": "#/definitions/v2/RequestId"
|
||||
},
|
||||
"method": {
|
||||
"enum": [
|
||||
"marketplace/checkUpdates"
|
||||
],
|
||||
"title": "Marketplace/checkUpdatesRequestMethod",
|
||||
"type": "string"
|
||||
},
|
||||
"params": {
|
||||
"$ref": "#/definitions/v2/MarketplaceCheckUpdatesParams"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"method",
|
||||
"params"
|
||||
],
|
||||
"title": "Marketplace/checkUpdatesRequest",
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"id": {
|
||||
@@ -11773,6 +11797,35 @@
|
||||
"title": "MarketplaceAddResponse",
|
||||
"type": "object"
|
||||
},
|
||||
"MarketplaceCheckUpdatesParams": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"properties": {
|
||||
"marketplaceName": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"title": "MarketplaceCheckUpdatesParams",
|
||||
"type": "object"
|
||||
},
|
||||
"MarketplaceCheckUpdatesResponse": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"properties": {
|
||||
"results": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/v2/MarketplaceUpdateCheckResult"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"results"
|
||||
],
|
||||
"title": "MarketplaceCheckUpdatesResponse",
|
||||
"type": "object"
|
||||
},
|
||||
"MarketplaceInterface": {
|
||||
"properties": {
|
||||
"displayName": {
|
||||
@@ -11835,6 +11888,68 @@
|
||||
"title": "MarketplaceRemoveResponse",
|
||||
"type": "object"
|
||||
},
|
||||
"MarketplaceUpdateCheckResult": {
|
||||
"oneOf": [
|
||||
{
|
||||
"properties": {
|
||||
"marketplaceName": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"enum": [
|
||||
"upToDate"
|
||||
],
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"marketplaceName",
|
||||
"status"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"marketplaceName": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"enum": [
|
||||
"updateAvailable"
|
||||
],
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"marketplaceName",
|
||||
"status"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"marketplaceName": {
|
||||
"type": "string"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"enum": [
|
||||
"error"
|
||||
],
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"marketplaceName",
|
||||
"message",
|
||||
"status"
|
||||
],
|
||||
"type": "object"
|
||||
}
|
||||
]
|
||||
},
|
||||
"MarketplaceUpgradeErrorInfo": {
|
||||
"properties": {
|
||||
"marketplaceName": {
|
||||
|
||||
+115
@@ -1841,6 +1841,30 @@
|
||||
"title": "Marketplace/removeRequest",
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"id": {
|
||||
"$ref": "#/definitions/RequestId"
|
||||
},
|
||||
"method": {
|
||||
"enum": [
|
||||
"marketplace/checkUpdates"
|
||||
],
|
||||
"title": "Marketplace/checkUpdatesRequestMethod",
|
||||
"type": "string"
|
||||
},
|
||||
"params": {
|
||||
"$ref": "#/definitions/MarketplaceCheckUpdatesParams"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"method",
|
||||
"params"
|
||||
],
|
||||
"title": "Marketplace/checkUpdatesRequest",
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"id": {
|
||||
@@ -8177,6 +8201,35 @@
|
||||
"title": "MarketplaceAddResponse",
|
||||
"type": "object"
|
||||
},
|
||||
"MarketplaceCheckUpdatesParams": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"properties": {
|
||||
"marketplaceName": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"title": "MarketplaceCheckUpdatesParams",
|
||||
"type": "object"
|
||||
},
|
||||
"MarketplaceCheckUpdatesResponse": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"properties": {
|
||||
"results": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/MarketplaceUpdateCheckResult"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"results"
|
||||
],
|
||||
"title": "MarketplaceCheckUpdatesResponse",
|
||||
"type": "object"
|
||||
},
|
||||
"MarketplaceInterface": {
|
||||
"properties": {
|
||||
"displayName": {
|
||||
@@ -8239,6 +8292,68 @@
|
||||
"title": "MarketplaceRemoveResponse",
|
||||
"type": "object"
|
||||
},
|
||||
"MarketplaceUpdateCheckResult": {
|
||||
"oneOf": [
|
||||
{
|
||||
"properties": {
|
||||
"marketplaceName": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"enum": [
|
||||
"upToDate"
|
||||
],
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"marketplaceName",
|
||||
"status"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"marketplaceName": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"enum": [
|
||||
"updateAvailable"
|
||||
],
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"marketplaceName",
|
||||
"status"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"marketplaceName": {
|
||||
"type": "string"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"enum": [
|
||||
"error"
|
||||
],
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"marketplaceName",
|
||||
"message",
|
||||
"status"
|
||||
],
|
||||
"type": "object"
|
||||
}
|
||||
]
|
||||
},
|
||||
"MarketplaceUpgradeErrorInfo": {
|
||||
"properties": {
|
||||
"marketplaceName": {
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"properties": {
|
||||
"marketplaceName": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"title": "MarketplaceCheckUpdatesParams",
|
||||
"type": "object"
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"definitions": {
|
||||
"MarketplaceUpdateCheckResult": {
|
||||
"oneOf": [
|
||||
{
|
||||
"properties": {
|
||||
"marketplaceName": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"enum": [
|
||||
"upToDate"
|
||||
],
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"marketplaceName",
|
||||
"status"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"marketplaceName": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"enum": [
|
||||
"updateAvailable"
|
||||
],
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"marketplaceName",
|
||||
"status"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"properties": {
|
||||
"marketplaceName": {
|
||||
"type": "string"
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"enum": [
|
||||
"error"
|
||||
],
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"marketplaceName",
|
||||
"message",
|
||||
"status"
|
||||
],
|
||||
"type": "object"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"results": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/MarketplaceUpdateCheckResult"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"results"
|
||||
],
|
||||
"title": "MarketplaceCheckUpdatesResponse",
|
||||
"type": "object"
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
+5
@@ -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 MarketplaceCheckUpdatesParams = { marketplaceName?: string | null, };
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// 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.
|
||||
import type { MarketplaceUpdateCheckResult } from "./MarketplaceUpdateCheckResult";
|
||||
|
||||
export type MarketplaceCheckUpdatesResponse = { results: Array<MarketplaceUpdateCheckResult>, };
|
||||
+5
@@ -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 MarketplaceUpdateCheckResult = { "status": "upToDate", marketplaceName: string, } | { "status": "updateAvailable", marketplaceName: string, } | { "status": "error", marketplaceName: string, message: string, };
|
||||
@@ -198,10 +198,13 @@ export type { LogoutAccountResponse } from "./LogoutAccountResponse";
|
||||
export type { ManagedHooksRequirements } from "./ManagedHooksRequirements";
|
||||
export type { MarketplaceAddParams } from "./MarketplaceAddParams";
|
||||
export type { MarketplaceAddResponse } from "./MarketplaceAddResponse";
|
||||
export type { MarketplaceCheckUpdatesParams } from "./MarketplaceCheckUpdatesParams";
|
||||
export type { MarketplaceCheckUpdatesResponse } from "./MarketplaceCheckUpdatesResponse";
|
||||
export type { MarketplaceInterface } from "./MarketplaceInterface";
|
||||
export type { MarketplaceLoadErrorInfo } from "./MarketplaceLoadErrorInfo";
|
||||
export type { MarketplaceRemoveParams } from "./MarketplaceRemoveParams";
|
||||
export type { MarketplaceRemoveResponse } from "./MarketplaceRemoveResponse";
|
||||
export type { MarketplaceUpdateCheckResult } from "./MarketplaceUpdateCheckResult";
|
||||
export type { MarketplaceUpgradeErrorInfo } from "./MarketplaceUpgradeErrorInfo";
|
||||
export type { MarketplaceUpgradeParams } from "./MarketplaceUpgradeParams";
|
||||
export type { MarketplaceUpgradeResponse } from "./MarketplaceUpgradeResponse";
|
||||
|
||||
@@ -679,6 +679,11 @@ client_request_definitions! {
|
||||
serialization: global("config"),
|
||||
response: v2::MarketplaceRemoveResponse,
|
||||
},
|
||||
MarketplaceCheckUpdates => "marketplace/checkUpdates" {
|
||||
params: v2::MarketplaceCheckUpdatesParams,
|
||||
serialization: global("config"),
|
||||
response: v2::MarketplaceCheckUpdatesResponse,
|
||||
},
|
||||
MarketplaceUpgrade => "marketplace/upgrade" {
|
||||
params: v2::MarketplaceUpgradeParams,
|
||||
serialization: global("config"),
|
||||
|
||||
@@ -98,6 +98,40 @@ pub struct MarketplaceRemoveResponse {
|
||||
pub installed_root: Option<AbsolutePathBuf>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct MarketplaceCheckUpdatesParams {
|
||||
#[ts(optional = nullable)]
|
||||
pub marketplace_name: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct MarketplaceCheckUpdatesResponse {
|
||||
pub results: Vec<MarketplaceUpdateCheckResult>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(tag = "status", rename_all = "camelCase")]
|
||||
#[ts(tag = "status", rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub enum MarketplaceUpdateCheckResult {
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(rename_all = "camelCase")]
|
||||
UpToDate { marketplace_name: String },
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(rename_all = "camelCase")]
|
||||
UpdateAvailable { marketplace_name: String },
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(rename_all = "camelCase")]
|
||||
Error {
|
||||
marketplace_name: String,
|
||||
message: String,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
|
||||
@@ -2806,6 +2806,58 @@ fn skills_extra_roots_set_params_rejects_relative_roots() {
|
||||
assert!(result.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn marketplace_check_updates_payloads_use_tagged_results() {
|
||||
assert_eq!(
|
||||
serde_json::to_value(MarketplaceCheckUpdatesParams {
|
||||
marketplace_name: None,
|
||||
})
|
||||
.unwrap(),
|
||||
json!({ "marketplaceName": null }),
|
||||
);
|
||||
assert_eq!(
|
||||
serde_json::to_value(MarketplaceCheckUpdatesParams {
|
||||
marketplace_name: Some("tools".to_string()),
|
||||
})
|
||||
.unwrap(),
|
||||
json!({ "marketplaceName": "tools" }),
|
||||
);
|
||||
assert_eq!(
|
||||
serde_json::to_value(MarketplaceCheckUpdatesResponse {
|
||||
results: vec![
|
||||
MarketplaceUpdateCheckResult::UpToDate {
|
||||
marketplace_name: "current".to_string(),
|
||||
},
|
||||
MarketplaceUpdateCheckResult::UpdateAvailable {
|
||||
marketplace_name: "changed".to_string(),
|
||||
},
|
||||
MarketplaceUpdateCheckResult::Error {
|
||||
marketplace_name: "broken".to_string(),
|
||||
message: "unable to resolve remote revision".to_string(),
|
||||
},
|
||||
],
|
||||
})
|
||||
.unwrap(),
|
||||
json!({
|
||||
"results": [
|
||||
{
|
||||
"status": "upToDate",
|
||||
"marketplaceName": "current",
|
||||
},
|
||||
{
|
||||
"status": "updateAvailable",
|
||||
"marketplaceName": "changed",
|
||||
},
|
||||
{
|
||||
"status": "error",
|
||||
"marketplaceName": "broken",
|
||||
"message": "unable to resolve remote revision",
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn plugin_source_serializes_local_git_and_remote_variants() {
|
||||
let local_path = if cfg!(windows) {
|
||||
|
||||
@@ -211,6 +211,7 @@ Example with notification opt-out:
|
||||
- `hooks/list` — list discovered hooks for one or more `cwd` values.
|
||||
- `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/checkUpdates` — check all configured Git plugin marketplaces, or one named marketplace when `marketplaceName` is provided, without changing config or installed marketplace snapshots. Returns an `upToDate`, `updateAvailable`, or `error` result for each selected marketplace.
|
||||
- `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. Clients can explicitly request the remote `workspace-directory`, `shared-with-me`, or `created-by-me-remote` marketplace kinds. `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**).
|
||||
|
||||
@@ -1254,6 +1254,11 @@ impl MessageProcessor {
|
||||
ClientRequest::MarketplaceRemove { params, .. } => {
|
||||
self.marketplace_processor.marketplace_remove(params).await
|
||||
}
|
||||
ClientRequest::MarketplaceCheckUpdates { params, .. } => {
|
||||
self.marketplace_processor
|
||||
.marketplace_check_updates(params)
|
||||
.await
|
||||
}
|
||||
ClientRequest::MarketplaceUpgrade { params, .. } => {
|
||||
self.marketplace_processor.marketplace_upgrade(params).await
|
||||
}
|
||||
|
||||
@@ -94,9 +94,12 @@ use codex_app_server_protocol::LoginApiKeyParams;
|
||||
use codex_app_server_protocol::LogoutAccountResponse;
|
||||
use codex_app_server_protocol::MarketplaceAddParams;
|
||||
use codex_app_server_protocol::MarketplaceAddResponse;
|
||||
use codex_app_server_protocol::MarketplaceCheckUpdatesParams;
|
||||
use codex_app_server_protocol::MarketplaceCheckUpdatesResponse;
|
||||
use codex_app_server_protocol::MarketplaceInterface;
|
||||
use codex_app_server_protocol::MarketplaceRemoveParams;
|
||||
use codex_app_server_protocol::MarketplaceRemoveResponse;
|
||||
use codex_app_server_protocol::MarketplaceUpdateCheckResult;
|
||||
use codex_app_server_protocol::MarketplaceUpgradeErrorInfo;
|
||||
use codex_app_server_protocol::MarketplaceUpgradeParams;
|
||||
use codex_app_server_protocol::MarketplaceUpgradeResponse;
|
||||
@@ -332,6 +335,7 @@ use codex_core::windows_sandbox::WindowsSandboxSetupRequest;
|
||||
use codex_core::windows_sandbox::sandbox_setup_is_complete;
|
||||
use codex_core_plugins::PluginInstallError as CorePluginInstallError;
|
||||
use codex_core_plugins::PluginInstallRequest;
|
||||
use codex_core_plugins::PluginMarketplaceUpdateStatus;
|
||||
use codex_core_plugins::PluginReadRequest;
|
||||
use codex_core_plugins::PluginUninstallError as CorePluginUninstallError;
|
||||
use codex_core_plugins::PluginsManager;
|
||||
|
||||
@@ -38,6 +38,15 @@ impl MarketplaceRequestProcessor {
|
||||
.map(|response| Some(response.into()))
|
||||
}
|
||||
|
||||
pub(crate) async fn marketplace_check_updates(
|
||||
&self,
|
||||
params: MarketplaceCheckUpdatesParams,
|
||||
) -> Result<Option<ClientResponsePayload>, JSONRPCErrorError> {
|
||||
self.marketplace_check_updates_inner(params)
|
||||
.await
|
||||
.map(|response| Some(response.into()))
|
||||
}
|
||||
|
||||
pub(crate) async fn marketplace_upgrade(
|
||||
&self,
|
||||
params: MarketplaceUpgradeParams,
|
||||
@@ -68,6 +77,51 @@ impl MarketplaceRequestProcessor {
|
||||
})
|
||||
}
|
||||
|
||||
async fn marketplace_check_updates_inner(
|
||||
&self,
|
||||
params: MarketplaceCheckUpdatesParams,
|
||||
) -> Result<MarketplaceCheckUpdatesResponse, JSONRPCErrorError> {
|
||||
let config = self.load_latest_config(/*fallback_cwd*/ None).await?;
|
||||
let plugins_manager = self.thread_manager.plugins_manager();
|
||||
let MarketplaceCheckUpdatesParams { marketplace_name } = params;
|
||||
let plugins_input = config.plugins_config_input();
|
||||
|
||||
let outcome = tokio::task::spawn_blocking(move || {
|
||||
plugins_manager.check_configured_marketplace_updates_for_config(
|
||||
&plugins_input,
|
||||
marketplace_name.as_deref(),
|
||||
)
|
||||
})
|
||||
.await
|
||||
.map_err(|err| internal_error(format!("failed to check marketplace updates: {err}")))?
|
||||
.map_err(invalid_request)?;
|
||||
|
||||
Ok(MarketplaceCheckUpdatesResponse {
|
||||
results: outcome
|
||||
.results
|
||||
.into_iter()
|
||||
.map(|result| match result.status {
|
||||
PluginMarketplaceUpdateStatus::UpToDate => {
|
||||
MarketplaceUpdateCheckResult::UpToDate {
|
||||
marketplace_name: result.marketplace_name,
|
||||
}
|
||||
}
|
||||
PluginMarketplaceUpdateStatus::UpdateAvailable => {
|
||||
MarketplaceUpdateCheckResult::UpdateAvailable {
|
||||
marketplace_name: result.marketplace_name,
|
||||
}
|
||||
}
|
||||
PluginMarketplaceUpdateStatus::Error { message } => {
|
||||
MarketplaceUpdateCheckResult::Error {
|
||||
marketplace_name: result.marketplace_name,
|
||||
message,
|
||||
}
|
||||
}
|
||||
})
|
||||
.collect(),
|
||||
})
|
||||
}
|
||||
|
||||
async fn marketplace_upgrade_response_inner(
|
||||
&self,
|
||||
params: MarketplaceUpgradeParams,
|
||||
|
||||
@@ -51,6 +51,7 @@ use codex_app_server_protocol::JSONRPCResponse;
|
||||
use codex_app_server_protocol::ListMcpServerStatusParams;
|
||||
use codex_app_server_protocol::LoginAccountParams;
|
||||
use codex_app_server_protocol::MarketplaceAddParams;
|
||||
use codex_app_server_protocol::MarketplaceCheckUpdatesParams;
|
||||
use codex_app_server_protocol::MarketplaceRemoveParams;
|
||||
use codex_app_server_protocol::MarketplaceUpgradeParams;
|
||||
use codex_app_server_protocol::McpResourceReadParams;
|
||||
@@ -802,6 +803,15 @@ impl TestAppServer {
|
||||
self.send_request("marketplace/remove", params).await
|
||||
}
|
||||
|
||||
/// Send a `marketplace/checkUpdates` JSON-RPC request.
|
||||
pub async fn send_marketplace_check_updates_request(
|
||||
&mut self,
|
||||
params: MarketplaceCheckUpdatesParams,
|
||||
) -> anyhow::Result<i64> {
|
||||
let params = Some(serde_json::to_value(params)?);
|
||||
self.send_request("marketplace/checkUpdates", params).await
|
||||
}
|
||||
|
||||
/// Send a `marketplace/upgrade` JSON-RPC request.
|
||||
pub async fn send_marketplace_upgrade_request(
|
||||
&mut self,
|
||||
|
||||
@@ -0,0 +1,302 @@
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
use std::time::Duration;
|
||||
|
||||
use anyhow::Result;
|
||||
use app_test_support::TestAppServer;
|
||||
use app_test_support::to_response;
|
||||
use codex_app_server_protocol::JSONRPCResponse;
|
||||
use codex_app_server_protocol::MarketplaceCheckUpdatesParams;
|
||||
use codex_app_server_protocol::MarketplaceCheckUpdatesResponse;
|
||||
use codex_app_server_protocol::MarketplaceUpdateCheckResult;
|
||||
use codex_app_server_protocol::MarketplaceUpgradeParams;
|
||||
use codex_app_server_protocol::RequestId;
|
||||
use codex_config::MarketplaceConfigUpdate;
|
||||
use codex_config::record_user_marketplace;
|
||||
use pretty_assertions::assert_eq;
|
||||
use tempfile::TempDir;
|
||||
use tokio::time::timeout;
|
||||
|
||||
#[cfg(windows)]
|
||||
const DEFAULT_TIMEOUT: Duration = Duration::from_secs(25);
|
||||
#[cfg(not(windows))]
|
||||
const DEFAULT_TIMEOUT: Duration = Duration::from_secs(10);
|
||||
|
||||
fn run_git(cwd: &Path, args: &[&str]) -> Result<String> {
|
||||
let output = Command::new("git").current_dir(cwd).args(args).output()?;
|
||||
if !output.status.success() {
|
||||
anyhow::bail!(
|
||||
"git {} failed in {}: {}",
|
||||
args.join(" "),
|
||||
cwd.display(),
|
||||
String::from_utf8_lossy(&output.stderr)
|
||||
);
|
||||
}
|
||||
Ok(String::from_utf8_lossy(&output.stdout).trim().to_string())
|
||||
}
|
||||
|
||||
fn init_marketplace_repo(root: &Path, marketplace_name: &str) -> Result<String> {
|
||||
run_git(root, &["init"])?;
|
||||
run_git(root, &["config", "user.email", "codex@example.com"])?;
|
||||
run_git(root, &["config", "user.name", "Codex Tests"])?;
|
||||
std::fs::create_dir_all(root.join(".agents/plugins"))?;
|
||||
std::fs::write(
|
||||
root.join(".agents/plugins/marketplace.json"),
|
||||
format!(r#"{{"name":"{marketplace_name}","plugins":[]}}"#),
|
||||
)?;
|
||||
std::fs::write(root.join("marker.txt"), "initial")?;
|
||||
run_git(root, &["add", "."])?;
|
||||
run_git(root, &["commit", "-m", "initial marketplace"])?;
|
||||
run_git(root, &["rev-parse", "HEAD"])
|
||||
}
|
||||
|
||||
fn commit_marketplace_update(root: &Path) -> Result<String> {
|
||||
std::fs::write(root.join("marker.txt"), "updated")?;
|
||||
run_git(root, &["add", "marker.txt"])?;
|
||||
run_git(root, &["commit", "-m", "update marketplace"])?;
|
||||
run_git(root, &["rev-parse", "HEAD"])
|
||||
}
|
||||
|
||||
fn record_git_marketplace(
|
||||
codex_home: &Path,
|
||||
marketplace_name: &str,
|
||||
source: &Path,
|
||||
last_revision: Option<&str>,
|
||||
) -> Result<()> {
|
||||
let source = source.display().to_string();
|
||||
record_user_marketplace(
|
||||
codex_home,
|
||||
marketplace_name,
|
||||
&MarketplaceConfigUpdate {
|
||||
last_updated: "2026-04-13T00:00:00Z",
|
||||
last_revision,
|
||||
source_type: "git",
|
||||
source: &source,
|
||||
ref_name: None,
|
||||
sparse_paths: &[],
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn record_local_marketplace(
|
||||
codex_home: &Path,
|
||||
marketplace_name: &str,
|
||||
source: &Path,
|
||||
) -> Result<()> {
|
||||
let source = source.display().to_string();
|
||||
record_user_marketplace(
|
||||
codex_home,
|
||||
marketplace_name,
|
||||
&MarketplaceConfigUpdate {
|
||||
last_updated: "2026-04-13T00:00:00Z",
|
||||
last_revision: None,
|
||||
source_type: "local",
|
||||
source: &source,
|
||||
ref_name: None,
|
||||
sparse_paths: &[],
|
||||
},
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn disable_plugin_startup_tasks(codex_home: &Path) -> Result<()> {
|
||||
let config_path = codex_home.join("config.toml");
|
||||
let config = std::fs::read_to_string(&config_path)?;
|
||||
std::fs::write(
|
||||
config_path,
|
||||
format!("{config}\n[features]\nplugins = false\n"),
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn send_marketplace_check_updates(
|
||||
mcp: &mut TestAppServer,
|
||||
marketplace_name: Option<&str>,
|
||||
) -> Result<MarketplaceCheckUpdatesResponse> {
|
||||
let request_id = mcp
|
||||
.send_marketplace_check_updates_request(MarketplaceCheckUpdatesParams {
|
||||
marketplace_name: marketplace_name.map(str::to_string),
|
||||
})
|
||||
.await?;
|
||||
let response: JSONRPCResponse = timeout(
|
||||
DEFAULT_TIMEOUT,
|
||||
mcp.read_stream_until_response_message(RequestId::Integer(request_id)),
|
||||
)
|
||||
.await??;
|
||||
to_response(response)
|
||||
}
|
||||
|
||||
async fn install_marketplace(mcp: &mut TestAppServer, marketplace_name: &str) -> Result<()> {
|
||||
let request_id = mcp
|
||||
.send_marketplace_upgrade_request(MarketplaceUpgradeParams {
|
||||
marketplace_name: Some(marketplace_name.to_string()),
|
||||
})
|
||||
.await?;
|
||||
let _: JSONRPCResponse = timeout(
|
||||
DEFAULT_TIMEOUT,
|
||||
mcp.read_stream_until_response_message(RequestId::Integer(request_id)),
|
||||
)
|
||||
.await??;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn marketplace_check_updates_reports_each_status_without_mutating_state() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
let current_source = TempDir::new()?;
|
||||
let changed_source = TempDir::new()?;
|
||||
let broken_source = TempDir::new()?;
|
||||
let current_revision = init_marketplace_repo(current_source.path(), "current")?;
|
||||
let changed_revision = init_marketplace_repo(changed_source.path(), "changed")?;
|
||||
commit_marketplace_update(changed_source.path())?;
|
||||
record_git_marketplace(
|
||||
codex_home.path(),
|
||||
"current",
|
||||
current_source.path(),
|
||||
Some(¤t_revision),
|
||||
)?;
|
||||
record_git_marketplace(
|
||||
codex_home.path(),
|
||||
"changed",
|
||||
changed_source.path(),
|
||||
Some(&changed_revision),
|
||||
)?;
|
||||
record_git_marketplace(
|
||||
codex_home.path(),
|
||||
"broken",
|
||||
broken_source.path(),
|
||||
Some("0000000000000000000000000000000000000000"),
|
||||
)?;
|
||||
disable_plugin_startup_tasks(codex_home.path())?;
|
||||
|
||||
let mut mcp = TestAppServer::new(codex_home.path()).await?;
|
||||
timeout(DEFAULT_TIMEOUT, mcp.initialize()).await??;
|
||||
install_marketplace(&mut mcp, "current").await?;
|
||||
let config_before = std::fs::read_to_string(codex_home.path().join("config.toml"))?;
|
||||
|
||||
let response = send_marketplace_check_updates(&mut mcp, None).await?;
|
||||
|
||||
let [broken, changed, current] = response.results.as_slice() else {
|
||||
anyhow::bail!("expected three marketplace update results");
|
||||
};
|
||||
assert!(matches!(
|
||||
broken,
|
||||
MarketplaceUpdateCheckResult::Error {
|
||||
marketplace_name,
|
||||
message,
|
||||
} if marketplace_name == "broken" && !message.is_empty()
|
||||
));
|
||||
assert_eq!(
|
||||
[changed.clone(), current.clone()],
|
||||
[
|
||||
MarketplaceUpdateCheckResult::UpdateAvailable {
|
||||
marketplace_name: "changed".to_string(),
|
||||
},
|
||||
MarketplaceUpdateCheckResult::UpToDate {
|
||||
marketplace_name: "current".to_string(),
|
||||
},
|
||||
]
|
||||
);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(codex_home.path().join("config.toml"))?,
|
||||
config_before
|
||||
);
|
||||
assert!(!codex_home.path().join(".tmp/marketplaces/changed").exists());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn marketplace_check_updates_reports_missing_or_damaged_snapshots() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
let damaged_source = TempDir::new()?;
|
||||
let missing_source = TempDir::new()?;
|
||||
let damaged_revision = init_marketplace_repo(damaged_source.path(), "damaged")?;
|
||||
let missing_revision = init_marketplace_repo(missing_source.path(), "missing")?;
|
||||
record_git_marketplace(
|
||||
codex_home.path(),
|
||||
"damaged",
|
||||
damaged_source.path(),
|
||||
Some(&damaged_revision),
|
||||
)?;
|
||||
record_git_marketplace(
|
||||
codex_home.path(),
|
||||
"missing",
|
||||
missing_source.path(),
|
||||
Some(&missing_revision),
|
||||
)?;
|
||||
disable_plugin_startup_tasks(codex_home.path())?;
|
||||
|
||||
let mut mcp = TestAppServer::new(codex_home.path()).await?;
|
||||
timeout(DEFAULT_TIMEOUT, mcp.initialize()).await??;
|
||||
install_marketplace(&mut mcp, "damaged").await?;
|
||||
std::fs::write(
|
||||
codex_home
|
||||
.path()
|
||||
.join(".tmp/marketplaces/damaged/.codex-marketplace-install.json"),
|
||||
"{}",
|
||||
)?;
|
||||
|
||||
assert_eq!(
|
||||
send_marketplace_check_updates(&mut mcp, None).await?,
|
||||
MarketplaceCheckUpdatesResponse {
|
||||
results: vec![
|
||||
MarketplaceUpdateCheckResult::UpdateAvailable {
|
||||
marketplace_name: "damaged".to_string(),
|
||||
},
|
||||
MarketplaceUpdateCheckResult::UpdateAvailable {
|
||||
marketplace_name: "missing".to_string(),
|
||||
},
|
||||
],
|
||||
}
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn marketplace_check_updates_supports_named_selection_and_rejects_non_git_names() -> Result<()>
|
||||
{
|
||||
let codex_home = TempDir::new()?;
|
||||
let git_source = TempDir::new()?;
|
||||
let local_source = TempDir::new()?;
|
||||
let revision = init_marketplace_repo(git_source.path(), "git-marketplace")?;
|
||||
record_git_marketplace(
|
||||
codex_home.path(),
|
||||
"git-marketplace",
|
||||
git_source.path(),
|
||||
Some(&revision),
|
||||
)?;
|
||||
record_local_marketplace(codex_home.path(), "local-only", local_source.path())?;
|
||||
disable_plugin_startup_tasks(codex_home.path())?;
|
||||
|
||||
let mut mcp = TestAppServer::new(codex_home.path()).await?;
|
||||
timeout(DEFAULT_TIMEOUT, mcp.initialize()).await??;
|
||||
|
||||
assert_eq!(
|
||||
send_marketplace_check_updates(&mut mcp, Some("git-marketplace")).await?,
|
||||
MarketplaceCheckUpdatesResponse {
|
||||
results: vec![MarketplaceUpdateCheckResult::UpdateAvailable {
|
||||
marketplace_name: "git-marketplace".to_string(),
|
||||
}],
|
||||
}
|
||||
);
|
||||
|
||||
for marketplace_name in ["local-only", "missing"] {
|
||||
let request_id = mcp
|
||||
.send_marketplace_check_updates_request(MarketplaceCheckUpdatesParams {
|
||||
marketplace_name: Some(marketplace_name.to_string()),
|
||||
})
|
||||
.await?;
|
||||
let err = timeout(
|
||||
DEFAULT_TIMEOUT,
|
||||
mcp.read_stream_until_error_message(RequestId::Integer(request_id)),
|
||||
)
|
||||
.await??;
|
||||
assert_eq!(err.error.code, -32600);
|
||||
assert_eq!(
|
||||
err.error.message,
|
||||
format!("marketplace `{marketplace_name}` is not configured as a Git marketplace"),
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -25,6 +25,7 @@ mod hooks_list;
|
||||
mod imagegen_extension;
|
||||
mod initialize;
|
||||
mod marketplace_add;
|
||||
mod marketplace_check_updates;
|
||||
mod marketplace_remove;
|
||||
mod marketplace_upgrade;
|
||||
mod mcp_resource;
|
||||
|
||||
@@ -51,6 +51,9 @@ pub use manager::PluginUninstallError;
|
||||
pub use manager::PluginsConfigInput;
|
||||
pub use manager::PluginsManager;
|
||||
pub use manager::RecommendedPluginCandidatesInput;
|
||||
pub use marketplace_upgrade::ConfiguredMarketplaceUpdateCheck as PluginMarketplaceUpdateCheck;
|
||||
pub use marketplace_upgrade::ConfiguredMarketplaceUpdateCheckOutcome as PluginMarketplaceUpdateCheckOutcome;
|
||||
pub use marketplace_upgrade::ConfiguredMarketplaceUpdateStatus as PluginMarketplaceUpdateStatus;
|
||||
pub use marketplace_upgrade::ConfiguredMarketplaceUpgradeError as PluginMarketplaceUpgradeError;
|
||||
pub use marketplace_upgrade::ConfiguredMarketplaceUpgradeOutcome as PluginMarketplaceUpgradeOutcome;
|
||||
pub use provider::ExecutorPluginProvider;
|
||||
|
||||
@@ -34,8 +34,10 @@ use crate::marketplace::find_installable_marketplace_plugin;
|
||||
use crate::marketplace::find_marketplace_plugin;
|
||||
use crate::marketplace::list_marketplaces;
|
||||
use crate::marketplace::plugin_interface_with_marketplace_category;
|
||||
use crate::marketplace_upgrade::ConfiguredMarketplaceUpdateCheckOutcome;
|
||||
use crate::marketplace_upgrade::ConfiguredMarketplaceUpgradeError;
|
||||
use crate::marketplace_upgrade::ConfiguredMarketplaceUpgradeOutcome;
|
||||
use crate::marketplace_upgrade::check_configured_git_marketplace_updates;
|
||||
use crate::marketplace_upgrade::configured_git_marketplace_names;
|
||||
use crate::marketplace_upgrade::upgrade_configured_git_marketplaces;
|
||||
use crate::remote::REMOTE_GLOBAL_MARKETPLACE_NAME;
|
||||
@@ -1958,15 +1960,7 @@ impl PluginsManager {
|
||||
config: &PluginsConfigInput,
|
||||
marketplace_name: Option<&str>,
|
||||
) -> Result<ConfiguredMarketplaceUpgradeOutcome, String> {
|
||||
if let Some(marketplace_name) = marketplace_name
|
||||
&& !configured_git_marketplace_names(&config.config_layer_stack)
|
||||
.iter()
|
||||
.any(|name| name == marketplace_name)
|
||||
{
|
||||
return Err(format!(
|
||||
"marketplace `{marketplace_name}` is not configured as a Git marketplace"
|
||||
));
|
||||
}
|
||||
validate_configured_git_marketplace_selection(config, marketplace_name)?;
|
||||
|
||||
let mut outcome = upgrade_configured_git_marketplaces(
|
||||
self.codex_home.as_path(),
|
||||
@@ -1997,6 +1991,19 @@ impl PluginsManager {
|
||||
Ok(outcome)
|
||||
}
|
||||
|
||||
pub fn check_configured_marketplace_updates_for_config(
|
||||
&self,
|
||||
config: &PluginsConfigInput,
|
||||
marketplace_name: Option<&str>,
|
||||
) -> Result<ConfiguredMarketplaceUpdateCheckOutcome, String> {
|
||||
validate_configured_git_marketplace_selection(config, marketplace_name)?;
|
||||
Ok(check_configured_git_marketplace_updates(
|
||||
self.codex_home.as_path(),
|
||||
&config.config_layer_stack,
|
||||
marketplace_name,
|
||||
))
|
||||
}
|
||||
|
||||
pub fn maybe_start_non_curated_plugin_cache_refresh(
|
||||
self: &Arc<Self>,
|
||||
roots: &[AbsolutePathBuf],
|
||||
@@ -2401,6 +2408,22 @@ impl PluginsManager {
|
||||
}
|
||||
}
|
||||
|
||||
fn validate_configured_git_marketplace_selection(
|
||||
config: &PluginsConfigInput,
|
||||
marketplace_name: Option<&str>,
|
||||
) -> Result<(), String> {
|
||||
if let Some(marketplace_name) = marketplace_name
|
||||
&& !configured_git_marketplace_names(&config.config_layer_stack)
|
||||
.iter()
|
||||
.any(|name| name == marketplace_name)
|
||||
{
|
||||
return Err(format!(
|
||||
"marketplace `{marketplace_name}` is not configured as a Git marketplace"
|
||||
));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn remote_plugin_install_required_description(
|
||||
source: &MarketplacePluginSource,
|
||||
) -> String {
|
||||
|
||||
@@ -38,6 +38,24 @@ pub struct ConfiguredMarketplaceUpgradeOutcome {
|
||||
pub errors: Vec<ConfiguredMarketplaceUpgradeError>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||
pub struct ConfiguredMarketplaceUpdateCheckOutcome {
|
||||
pub results: Vec<ConfiguredMarketplaceUpdateCheck>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct ConfiguredMarketplaceUpdateCheck {
|
||||
pub marketplace_name: String,
|
||||
pub status: ConfiguredMarketplaceUpdateStatus,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum ConfiguredMarketplaceUpdateStatus {
|
||||
UpToDate,
|
||||
UpdateAvailable,
|
||||
Error { message: String },
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
struct ConfiguredGitMarketplace {
|
||||
name: String,
|
||||
@@ -62,6 +80,39 @@ pub fn configured_git_marketplace_names(config_layer_stack: &ConfigLayerStack) -
|
||||
names
|
||||
}
|
||||
|
||||
pub fn check_configured_git_marketplace_updates(
|
||||
codex_home: &Path,
|
||||
config_layer_stack: &ConfigLayerStack,
|
||||
marketplace_name: Option<&str>,
|
||||
) -> ConfiguredMarketplaceUpdateCheckOutcome {
|
||||
let install_root = marketplace_install_root(codex_home);
|
||||
let results = configured_git_marketplaces(config_layer_stack)
|
||||
.into_iter()
|
||||
.filter(|marketplace| marketplace_name.is_none_or(|name| marketplace.name == name))
|
||||
.map(|marketplace| {
|
||||
let status = match configured_git_marketplace_remote_revision(&marketplace) {
|
||||
Ok(remote_revision)
|
||||
if configured_git_marketplace_is_up_to_date(
|
||||
&install_root,
|
||||
&marketplace,
|
||||
&remote_revision,
|
||||
) =>
|
||||
{
|
||||
ConfiguredMarketplaceUpdateStatus::UpToDate
|
||||
}
|
||||
Ok(_) => ConfiguredMarketplaceUpdateStatus::UpdateAvailable,
|
||||
Err(message) => ConfiguredMarketplaceUpdateStatus::Error { message },
|
||||
};
|
||||
ConfiguredMarketplaceUpdateCheck {
|
||||
marketplace_name: marketplace.name,
|
||||
status,
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
ConfiguredMarketplaceUpdateCheckOutcome { results }
|
||||
}
|
||||
|
||||
pub fn upgrade_configured_git_marketplaces(
|
||||
codex_home: &Path,
|
||||
config_layer_stack: &ConfigLayerStack,
|
||||
@@ -170,20 +221,13 @@ fn upgrade_configured_git_marketplace(
|
||||
install_root: &Path,
|
||||
marketplace: &ConfiguredGitMarketplace,
|
||||
) -> Result<Option<AbsolutePathBuf>, String> {
|
||||
validate_plugin_segment(&marketplace.name, "marketplace name")?;
|
||||
let remote_revision = git_remote_revision(
|
||||
&marketplace.source,
|
||||
marketplace.ref_name.as_deref(),
|
||||
MARKETPLACE_UPGRADE_GIT_TIMEOUT,
|
||||
)?;
|
||||
let destination = install_root.join(&marketplace.name);
|
||||
if find_marketplace_manifest_path(&destination).is_some()
|
||||
&& marketplace.last_revision.as_deref() == Some(remote_revision.as_str())
|
||||
&& installed_marketplace_metadata_matches(&destination, marketplace, &remote_revision)
|
||||
{
|
||||
let remote_revision = configured_git_marketplace_remote_revision(marketplace)?;
|
||||
if configured_git_marketplace_is_up_to_date(install_root, marketplace, &remote_revision) {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
let destination = install_root.join(&marketplace.name);
|
||||
|
||||
let staging_parent = install_root.join(".staging");
|
||||
std::fs::create_dir_all(&staging_parent).map_err(|err| {
|
||||
format!(
|
||||
@@ -241,6 +285,28 @@ fn upgrade_configured_git_marketplace(
|
||||
.map(Some)
|
||||
.map_err(|err| format!("upgraded marketplace path is not absolute: {err}"))
|
||||
}
|
||||
|
||||
fn configured_git_marketplace_remote_revision(
|
||||
marketplace: &ConfiguredGitMarketplace,
|
||||
) -> Result<String, String> {
|
||||
validate_plugin_segment(&marketplace.name, "marketplace name")?;
|
||||
git_remote_revision(
|
||||
&marketplace.source,
|
||||
marketplace.ref_name.as_deref(),
|
||||
MARKETPLACE_UPGRADE_GIT_TIMEOUT,
|
||||
)
|
||||
}
|
||||
|
||||
fn configured_git_marketplace_is_up_to_date(
|
||||
install_root: &Path,
|
||||
marketplace: &ConfiguredGitMarketplace,
|
||||
remote_revision: &str,
|
||||
) -> bool {
|
||||
let destination = install_root.join(&marketplace.name);
|
||||
find_marketplace_manifest_path(&destination).is_some()
|
||||
&& marketplace.last_revision.as_deref() == Some(remote_revision)
|
||||
&& installed_marketplace_metadata_matches(&destination, marketplace, remote_revision)
|
||||
}
|
||||
fn ensure_configured_git_marketplace_unchanged(
|
||||
codex_home: &Path,
|
||||
expected: &ConfiguredGitMarketplace,
|
||||
|
||||
Reference in New Issue
Block a user