mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-14 19:30:45 +00:00
feat(plugins): move install records to managed ledger
This commit is contained in:
@@ -42,6 +42,13 @@ import {
|
||||
resolveGlobalInstallSpec,
|
||||
} from "../../infra/update-global.js";
|
||||
import { runGatewayUpdate, type UpdateRunResult } from "../../infra/update-runner.js";
|
||||
import {
|
||||
loadPluginInstallRecords,
|
||||
PLUGIN_INSTALLS_CONFIG_PATH,
|
||||
withoutPluginInstallRecords,
|
||||
writePersistedPluginInstallLedger,
|
||||
withPluginInstallRecords,
|
||||
} from "../../plugins/install-ledger-store.js";
|
||||
import { syncPluginsForUpdateChannel, updateNpmInstalledPlugins } from "../../plugins/update.js";
|
||||
import { runCommandWithTimeout } from "../../process/exec.js";
|
||||
import { defaultRuntime } from "../../runtime.js";
|
||||
@@ -577,8 +584,11 @@ async function updatePluginsAfterCoreUpdate(params: {
|
||||
defaultRuntime.log(theme.heading("Updating plugins..."));
|
||||
}
|
||||
|
||||
const syncResult = await syncPluginsForUpdateChannel({
|
||||
const pluginInstallRecords = await loadPluginInstallRecords({
|
||||
config: params.configSnapshot.sourceConfig,
|
||||
});
|
||||
const syncResult = await syncPluginsForUpdateChannel({
|
||||
config: withPluginInstallRecords(params.configSnapshot.sourceConfig, pluginInstallRecords),
|
||||
channel: params.channel,
|
||||
workspaceDir: params.root,
|
||||
externalizedBundledPluginBridges: await listPersistedBundledPluginLocationBridges({
|
||||
@@ -620,12 +630,15 @@ async function updatePluginsAfterCoreUpdate(params: {
|
||||
pluginConfig = npmResult.config;
|
||||
|
||||
if (syncResult.changed || npmResult.changed) {
|
||||
await writePersistedPluginInstallLedger(pluginConfig.plugins?.installs ?? {});
|
||||
const nextConfig = withoutPluginInstallRecords(pluginConfig);
|
||||
await replaceConfigFile({
|
||||
nextConfig: pluginConfig,
|
||||
nextConfig,
|
||||
baseHash: params.configSnapshot.hash,
|
||||
writeOptions: { unsetPaths: [Array.from(PLUGIN_INSTALLS_CONFIG_PATH)] },
|
||||
});
|
||||
await refreshPluginRegistryAfterConfigMutation({
|
||||
config: pluginConfig,
|
||||
config: nextConfig,
|
||||
reason: "source-changed",
|
||||
workspaceDir: params.root,
|
||||
logger: pluginLogger,
|
||||
|
||||
Reference in New Issue
Block a user