Add plugin reconciliation app-server API (#41949)

## What changed

- Add the `plugin/reconcile` JSON-RPC method to synchronize installed remote plugin bundles and wait for required hook updates.
- Return affected plugin IDs with MCP, Apps, hooks, and skills refresh hints, plus remote update and materialization failures.
- Refresh loaded hook runtimes after relevant updates and return an empty result when plugins or backend authentication are unavailable.

## Testing

- Cover workspace and global bundle installs, unchanged passes, enablement changes, updates, removals, materialization failures, hook refreshes, and disabled plugins.

GitOrigin-RevId: 45c02518d71990d13eb09d56ed51505c91c66956
This commit is contained in:
Matthew Zeng authored and copyberry committed 2026-09-01 00:50:11 +00:00
1 parent c2e5692e2c
commit bfa9646787
21 files changed
+854 -2

No files matched your search

@@ -852,6 +852,11 @@ client_request_definitions! {
serialization: None,
response: v2::PluginInstalledResponse,
},
PluginReconcile => "plugin/reconcile" {
params: v2::PluginReconcileParams,
serialization: None,
response: v2::PluginReconcileResponse,
},
PluginRead => "plugin/read" {
params: v2::PluginReadParams,
serialization: None,
@@ -192,6 +192,50 @@ pub struct PluginInstalledResponse {
pub marketplace_load_errors: Vec<MarketplaceLoadErrorInfo>,
}
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct PluginReconcileParams {
/// Optional client-provided reason recorded with the reconciliation attempt.
#[ts(optional = nullable)]
pub reason: Option<String>,
}
/// Bundle and installed-state changes observed by this pass, not a runtime-readiness
/// acknowledgement or a cumulative diff since the client's last request. Other metadata-only
/// changes are not listed.
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct PluginReconcileResponse {
/// Plugins affected by bundle changes, enablement changes, or removals.
/// Installed-state changes compare against the previous cached snapshot, including
/// cached reinstalls. Removal hints survive cache cleanup failures; unchanged plugins are omitted.
pub changed_plugins: Vec<PluginReconcileChangedPlugin>,
/// Backend remote plugin IDs whose bundle or identity update failed.
pub failed_remote_plugin_ids: Vec<String>,
/// Subset of failures for which the requested bundle could not be materialized.
/// A previously cached version may still be available.
pub failed_materialization_remote_plugin_ids: Vec<String>,
}
/// Runtime categories affected by this change, not just capabilities currently present.
/// Flags describe declarations before runtime policy filtering. Updates OR the old and new
/// bundle flags; enablement changes and cached reinstalls use the cached bundle; removals retain
/// the old bundle's flags.
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct PluginReconcileChangedPlugin {
/// Local plugin ID (`name@marketplace`), matching `PluginSummary.id`.
pub id: String,
pub has_mcps: bool,
pub has_apps: bool,
pub has_hooks: bool,
/// Whether either bundle declares skill roots; not a validated inventory of enabled skills.
pub has_skills: bool,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]