fix(plugins): derive bundled relocation from registry · openclaw/openclaw@0abb2a5
vincentkoc
·
2026-04-25
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +import type { ExternalizedBundledPluginBridge } from "../plugins/externalized-bundled-plugins.js"; |
| 2 | +import { readPersistedInstalledPluginIndex } from "../plugins/installed-plugin-index-store.js"; |
| 3 | +import type { InstalledPluginIndexRecord } from "../plugins/installed-plugin-index.js"; |
| 4 | + |
| 5 | +function buildBridgeFromPersistedBundledRecord( |
| 6 | +record: InstalledPluginIndexRecord, |
| 7 | +): ExternalizedBundledPluginBridge | null { |
| 8 | +if (record.origin !== "bundled" || record.enabled === false) { |
| 9 | +return null; |
| 10 | +} |
| 11 | +const npmSpec = record.packageInstall?.npm?.spec; |
| 12 | +if (!npmSpec) { |
| 13 | +return null; |
| 14 | +} |
| 15 | +return { |
| 16 | +bundledPluginId: record.pluginId, |
| 17 | +pluginId: record.pluginId, |
| 18 | + npmSpec, |
| 19 | +channelIds: record.contributions.channels, |
| 20 | +}; |
| 21 | +} |
| 22 | + |
| 23 | +export async function listPersistedBundledPluginLocationBridges(options: { |
| 24 | +workspaceDir?: string; |
| 25 | +env?: NodeJS.ProcessEnv; |
| 26 | +}): Promise<readonly ExternalizedBundledPluginBridge[]> { |
| 27 | +const index = await readPersistedInstalledPluginIndex(options); |
| 28 | +if (!index) { |
| 29 | +return []; |
| 30 | +} |
| 31 | +return index.plugins.flatMap((record) => { |
| 32 | +const bridge = buildBridgeFromPersistedBundledRecord(record); |
| 33 | +return bridge ? [bridge] : []; |
| 34 | +}); |
| 35 | +} |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -57,6 +57,7 @@ import {
|
57 | 57 | terminateStaleGatewayPids, |
58 | 58 | waitForGatewayHealthyRestart, |
59 | 59 | } from "../daemon-cli/restart-health.js"; |
| 60 | +import { listPersistedBundledPluginLocationBridges } from "../plugins-location-bridges.js"; |
60 | 61 | import { refreshPluginRegistryAfterConfigMutation } from "../plugins-registry-refresh.js"; |
61 | 62 | import { createUpdateProgress, printResult } from "./progress.js"; |
62 | 63 | import { prepareRestartScript, runRestartScript } from "./restart-helper.js"; |
@@ -580,6 +581,9 @@ async function updatePluginsAfterCoreUpdate(params: {
|
580 | 581 | config: params.configSnapshot.sourceConfig, |
581 | 582 | channel: params.channel, |
582 | 583 | workspaceDir: params.root, |
| 584 | +externalizedBundledPluginBridges: await listPersistedBundledPluginLocationBridges({ |
| 585 | +workspaceDir: params.root, |
| 586 | +}), |
583 | 587 | logger: pluginLogger, |
584 | 588 | }); |
585 | 589 | let pluginConfig = syncResult.config; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -15,25 +15,6 @@ export type ExternalizedBundledPluginBridge = {
|
15 | 15 | preferOver?: readonly string[]; |
16 | 16 | }; |
17 | 17 | |
18 | | -const EXTERNALIZED_BUNDLED_PLUGIN_BRIDGES: readonly ExternalizedBundledPluginBridge[] = [ |
19 | | -{ |
20 | | -bundledPluginId: "tlon", |
21 | | -npmSpec: "@openclaw/tlon", |
22 | | -channelIds: ["tlon"], |
23 | | -}, |
24 | | -{ |
25 | | -bundledPluginId: "twitch", |
26 | | -npmSpec: "@openclaw/twitch", |
27 | | -channelIds: ["twitch", "twitch-chat"], |
28 | | -legacyPluginIds: ["twitch-chat"], |
29 | | -}, |
30 | | -{ |
31 | | -bundledPluginId: "synology-chat", |
32 | | -npmSpec: "@openclaw/synology-chat", |
33 | | -channelIds: ["synology-chat"], |
34 | | -}, |
35 | | -]; |
36 | | - |
37 | 18 | function normalizePluginId(value: string | undefined): string { |
38 | 19 | return value?.trim() ?? ""; |
39 | 20 | } |
@@ -60,7 +41,3 @@ export function getExternalizedBundledPluginLookupIds(
|
60 | 41 | ), |
61 | 42 | ); |
62 | 43 | } |
63 | | - |
64 | | -export function listExternalizedBundledPluginBridges(): readonly ExternalizedBundledPluginBridge[] { |
65 | | -return EXTERNALIZED_BUNDLED_PLUGIN_BRIDGES; |
66 | | -} |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -14,7 +14,6 @@ import { normalizePluginsConfig, resolveEffectiveEnableState } from "./config-st
|
14 | 14 | import { |
15 | 15 | getExternalizedBundledPluginLookupIds, |
16 | 16 | getExternalizedBundledPluginTargetId, |
17 | | -listExternalizedBundledPluginBridges, |
18 | 17 | type ExternalizedBundledPluginBridge, |
19 | 18 | } from "./externalized-bundled-plugins.js"; |
20 | 19 | import { |
@@ -863,8 +862,7 @@ export async function syncPluginsForUpdateChannel(params: {
|
863 | 862 | changed = true; |
864 | 863 | } |
865 | 864 | } else { |
866 | | -const bridges = |
867 | | -params.externalizedBundledPluginBridges ?? listExternalizedBundledPluginBridges(); |
| 865 | +const bridges = params.externalizedBundledPluginBridges ?? []; |
868 | 866 | for (const bridge of bridges) { |
869 | 867 | const targetPluginId = getExternalizedBundledPluginTargetId(bridge); |
870 | 868 | const bundledInfo = bundled.get(bridge.bundledPluginId); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。