Date: 2026-06-29 Status: Draft v2 (revised after review; pending user review + plan) Scope: ZCode plugin management page — (1) allow uninstalling built-in (official/bundled) plugins, (2) surface per-plugin update in the UI.
The plugin management page currently lets users install/uninstall marketplace plugins and enable/disable any plugin, but:
source: "official")
plugins are seeded from the app bundle and only have an enable/disable toggle.
The uninstall button is hidden for them, and uninstall no-ops because built-ins
are not in the installed-records state file.pluginsUpdate) but is unwired to the agent service, store,
and UI, and there is no "update available" detection.This design adds both, end to end.
seedBundledOfficialPlugins (bootstrap/src/app/bundled-plugins.ts) runs on every
resolveZCodePlugins via resolveOfficialPluginRoots, writing each bundled plugin
into storageRoot/cache/<marketplace>/<name>/<version> (skipped only when a content-
hash marker matches). Deleting cache files is futile — the next resolve re-creates
them.
Critically, more than one reader materializes or scans official plugins, so a suppression mechanism must thread through all of them or a built-in keeps showing up / running:
bootstrap/src/plugins.ts resolveZCodePlugins → resolveOfficialPluginRoots → seedBundledOfficialPlugins.bootstrap/src/app/startup-marks.ts:24 resolveStartupPlugins → resolveOfficialPluginRoots (independent call).bootstrap/src/app/plugin-facade.ts in-session facade (caches enabledPlugins).packages/services/src/skills/skillsService.ts:818 resolvePluginSkillRootDescriptors — directly calls scanOfficialPluginCacheRoots(pluginStorageRoot) and force-default-enables official ids via DEFAULT_ENABLED_OFFICIAL_PLUGIN_IDS.packages/services/src/commands/commandsService.ts:406 resolvePluginCommandRootDescriptors — same pattern.plugins/list, not the overviewPluginsSection.tsx selects the detail plugin from plugins (ZCodePluginInfo,
from plugins/list). Extra per-plugin fields are join-patched by id (see
installedAt at PluginsSection.tsx:118). So any new updateAvailable field must
either be added to ZCodePluginInfo or join-patched the same way — putting it only
on the overview's installedPlugins will not reach the detail panel.
| Question | Decision |
|---|---|
| "Uninstall built-in" semantics | Permanent + reversible hide; full purge of plugin user state on uninstall. Persistent suppression survives restart and app upgrades; cache files deleted; enabledPlugins[id], options[id], and the plugin data/ dir are removed. Restore re-seeds a clean plugin (config/data NOT restored — uninstall fully clears). |
| Update detection | Detect & badge — show only when newer. |
| Update scope | Marketplace (cache) plugins only. |
| Update freshness | Cached manifest; a "Check for updates" action re-pulls on demand. |
| Restore an uninstalled built-in | Restore via catalog — but through a dedicated restore action, not the marketplace install path (see Restore below). |
| Non-semver version diff | Show "version changed", not "update available" (only semver.gt shows "update available"). |
| Official marketplace name | Locked — user-added marketplaces may not claim zcode-plugins-official / claude-plugins-official. |
| Installed record vs built-in classification | installed_plugins.json wins. An exact installed record is always uninstalled through the marketplace path, even when its cache lives under zcode-plugins-official; only ids without an installed record may enter built-in suppression. Marketplace uninstall also removes a stale suppression marker left by older buggy versions. |
| Update vs running session | Next session only — update applies to future sessions; UI shows a "takes effect in new sessions" note. |
| Concurrency safety | Lightweight lock — in-process per-storageRoot serialization (async mutex) around install/update/uninstall/restore. Cross-process file lock is a non-goal. |
Add plugins.suppressedBuiltins: string[] to user config (beside
enabledPlugins/options; same file + atomic-write helpers). User config is never
overwritten by app upgrades, so suppression survives upgrades.
A shared resolver exposes the suppression set + the resolved official roots so the CLI bootstrap AND the desktop services layer apply identical logic (no duplicated suppression code). Concretely:
resolveOfficialPluginRoots({ storageRoot, suppressedBuiltins }) skips seeding for
suppressed ids and removes any leftover cache root for them.writeOfficialMarketplace() omits suppressed plugins from the synthetic manifest.skillsService/commandsService filter scanOfficialPluginCacheRoots results
through the same suppressedBuiltins set (read from CLI config they already load),
so suppressed built-ins contribute no skills/commands.
uninstall(built-in id) [under storageRoot lock]
→ add id to plugins.suppressedBuiltins (user config, atomic patch)
→ rm -rf cache dir + data dir
→ drop enabledPlugins[id], options[id] (full purge)
every reader (resolve / startup / skills / commands)
→ reads plugins.suppressedBuiltins
→ official roots exclude suppressed; suppressed contribute nothing
restore(built-in id) [under storageRoot lock]
→ remove id from plugins.suppressedBuiltins
→ next resolve re-seeds a CLEAN plugin (existing seeding machinery)
uninstall(marketplace id) [under storageRoot lock]
→ exact id exists in installed_plugins.json
→ remove installed record + cache/data
→ remove enabledPlugins[id], options[id]
→ remove stale suppressedBuiltins[id] if present
A suppressed built-in's cache is deleted and it is omitted from the synthetic
official manifest, so the normal install/describe flow would throw "Bundled plugin
cache directory missing" (marketplace.ts:764 requires an existing cache dir for
filesystem/sea sources). Therefore:
restoreBuiltinPlugin(id) = remove id from suppressedBuiltins
(the seeder re-materializes on next resolve). No marketplace fetch.restorableBuiltins list (suppressed official plugins, derived
from OFFICIAL_PLUGIN_DEFINITIONS ∩ suppressedBuiltins) so the catalog tab can
render a Restore button wired to restoreBuiltinPlugin, distinct from Install.The backend pluginsUpdate handler (zcode-protocol/plugins.ts:235 updatePlugin)
reinstalls the latest closure from the cached manifest. Changes:
installZCodeMarketplacePlugin call; if any target returns error diagnostics, the
op fails and the UI keeps the badge until the installed record's version actually
changes.getZCodePluginsOverview, for each
installed (cache) plugin, build a "latest pin" from its manifest entry — a semver
version if present, else the commit sha from entry.source (readPluginSourceSha).
comparePluginUpdate picks the axis: version present → semver compare; else sha
present → identity (differs ⇒ update-available, installed has no sha ⇒
version-changed); neither ⇒ none. Why sha matters: the Claude official
marketplace pins per-plugin versions almost entirely via source.sha (实测 243 个
插件中仅 14 个带顶层 version,192 个用 sha),so a version-only check left ~229/243
官方插件永远 none. Local-path entries (no version/sha) are Phase 2 — see
docs/plugin-marketplace-update-detection-handoff.md.updateStatus + latestVersion? (version, or short 7-char sha label) and
join them into the UI's installed view model (per C2).semver lives in adapters; comparePluginVersions falls back to !== when
unparseable. comparePluginUpdate wraps it for the version axis.
"Check for updates" (installed tab) → updateMarketplace(null) (existing git re-pull, sequential)
→ reload overview → badges refresh
update click → store.updatePlugin(id) → agentService.updatePlugin() → RPC pluginsUpdate
→ on success reload overview; on diagnostics show error, keep badge
→ note: effect applies to NEW sessions
addMarketplace (marketplace.ts:254) sets id: loaded.manifest.name with no
guard, letting a user-added marketplace overwrite the official synthetic manifest.
Add a guard: reject (or namespace) any added/updated marketplace whose resolved
manifest.name is zcode-plugins-official or claude-plugins-official unless it is
the built-in seeding path. Surface a clear error in the add popover.
The desktop talks to a single app-server process, so an in-process async mutex
keyed by storageRoot is sufficient to serialize install / update / uninstall /
restore (each does read-modify-write across installed_plugins.json, cache dirs, and
config). Wrap these mutating bootstrap ops in withPluginStorageLock(storageRoot, fn).
Cross-process locking and version-rollback journaling are explicit non-goals for this
iteration (tracked in Known limitations).
apps/zcode-cli)adapters/src/config/schema.ts (pluginsSchema): add
suppressedBuiltins: z.array(z.string().min(1)).optional().contracts/src/plugins/index.ts (PluginConfig): add
suppressedBuiltins: string[] (normalize to []).adapters/src/config/file-config.adapter.ts: add
addSuppressedBuiltinInFileConfig / removeSuppressedBuiltinInFileConfig
(atomic, idempotent).bootstrap/src/app/bundled-plugins.ts: seedBundledOfficialPlugins /
resolveOfficialPluginRoots accept suppressedBuiltins; skip + rm suppressed;
writeOfficialMarketplace omits suppressed.bootstrap/src/plugins.ts:
resolveZCodePlugins passes config.plugins.suppressedBuiltins through.uninstallZCodeMarketplacePlugin: when source !== "cache", suppress + purge
(bypassing the current installed-records return null); under storage lock.restoreBuiltinPlugin.getZCodePluginsOverview: compute update status + restorableBuiltins; add
semver + compareVersions.updatePlugin aggregates diagnostics and fails on error.withPluginStorageLock and wrap mutating ops.adapters/src/plugins/marketplace.ts addMarketplace/updateMarketplace: guard
official names.packages/services)skills/skillsService.ts + commands/commandsService.ts: filter official cache
roots through suppressedBuiltins (from the CLI config they already read).
Prefer a shared helper so suppression logic is not duplicated.packages/shared/src/zcode-protocol/index.ts)zcodeInstalledPluginSummarySchema: add updateAvailable?, latestVersion?.
Consider adding the same to ZCodePluginInfo (or join in UI per C2).restorableBuiltins (array of available-plugin summaries).pluginsRestoreBuiltin method (params: workspace + pluginId). pluginsUpdate
schema already present.packages/services/src/zcode-agent/)zcodeAgent.ts (IZCodeAgentService): add updatePlugin, restoreBuiltinPlugin.zcodeAgentService.ts: implement both via client.request(...) with the 5-min
plugin timeout.packages/ui/src/store/pluginManagementStore.ts)updatePlugin(id) and restoreBuiltin(id) actions (mirror installPlugin).packages/ui/src/settings/)plugins/list with overview
update fields (C2).InstalledPluginManagement.tsx: Update badge + button when updateAvailable
(cache only) with "version changed" variant; "takes effect in new sessions" note;
built-in detail now shows Uninstall.PluginsSection.tsx uninstallable (~L398): broaden so official built-ins
are uninstallable (inline stays non-uninstallable).restorableBuiltins with a Restore button → restoreBuiltin.updateMarketplace(null).writeOfficialMarketplace omits suppressed.update-available only when manifest version strictly
greater; version-changed on non-semver; none on equal.zcode-plugins-official is
rejected.installed_plugins.json.updatePlugin / restoreBuiltinPlugin issue correct RPCs.npm run lint && npm test in apps/zcode-cli; UI/services package tests.installed_plugins.json is out of
scope to repair transactionally here.