

























@@ -5,13 +5,10 @@ import { moveSingleAccountChannelSectionToDefaultAccount } from "../../channels/
55import type { ChannelSetupPlugin } from "../../channels/plugins/setup-wizard-types.js";
66import type { ChannelPlugin } from "../../channels/plugins/types.plugin.js";
77import type { ChannelId, ChannelSetupInput } from "../../channels/plugins/types.public.js";
8+import { commitPluginInstallRecordsWithConfig } from "../../cli/plugins-install-record-commit.js";
89import { refreshPluginRegistryAfterConfigMutation } from "../../cli/plugins-registry-refresh.js";
910import { replaceConfigFile, type OpenClawConfig } from "../../config/config.js";
10-import {
11-PLUGIN_INSTALLS_CONFIG_PATH,
12-withoutPluginInstallRecords,
13-writePersistedInstalledPluginIndexInstallRecords,
14-} from "../../plugins/installed-plugin-index-records.js";
11+import { withoutPluginInstallRecords } from "../../plugins/installed-plugin-index-records.js";
1512import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../../routing/session-key.js";
1613import { defaultRuntime, type RuntimeEnv } from "../../runtime.js";
1714import { normalizeOptionalLowercaseString } from "../../shared/string-coerce.js";
@@ -251,19 +248,22 @@ export async function channelsAddCommand(
251248 ? withoutPluginInstallRecords(nextConfig)
252249 : nextConfig;
253250if (shouldMovePluginInstalls) {
254-await writePersistedInstalledPluginIndexInstallRecords(nextConfig.plugins?.installs ?? {});
251+await commitPluginInstallRecordsWithConfig({
252+nextInstallRecords: nextConfig.plugins?.installs ?? {},
253+nextConfig: writtenConfig,
254+ ...(baseHash !== undefined ? { baseHash } : {}),
255+});
256+} else {
257+await replaceConfigFile({
258+nextConfig: writtenConfig,
259+ ...(baseHash !== undefined ? { baseHash } : {}),
260+});
255261}
256-await replaceConfigFile({
257-nextConfig: writtenConfig,
258- ...(baseHash !== undefined ? { baseHash } : {}),
259- ...(shouldMovePluginInstalls
260- ? { writeOptions: { unsetPaths: [Array.from(PLUGIN_INSTALLS_CONFIG_PATH)] } }
261- : {}),
262-});
263262if (shouldMovePluginInstalls) {
264263await refreshPluginRegistryAfterConfigMutation({
265264config: writtenConfig,
266265reason: "source-changed",
266+installRecords: nextConfig.plugins?.installs ?? {},
267267logger: { warn: (message) => runtime.log(message) },
268268});
269269}
@@ -402,19 +402,22 @@ export async function channelsAddCommand(
402402 ? withoutPluginInstallRecords(nextConfig)
403403 : nextConfig;
404404if (shouldMovePluginInstalls) {
405-await writePersistedInstalledPluginIndexInstallRecords(nextConfig.plugins?.installs ?? {});
405+await commitPluginInstallRecordsWithConfig({
406+nextInstallRecords: nextConfig.plugins?.installs ?? {},
407+nextConfig: writtenConfig,
408+ ...(baseHash !== undefined ? { baseHash } : {}),
409+});
410+} else {
411+await replaceConfigFile({
412+nextConfig: writtenConfig,
413+ ...(baseHash !== undefined ? { baseHash } : {}),
414+});
406415}
407-await replaceConfigFile({
408-nextConfig: writtenConfig,
409- ...(baseHash !== undefined ? { baseHash } : {}),
410- ...(shouldMovePluginInstalls
411- ? { writeOptions: { unsetPaths: [Array.from(PLUGIN_INSTALLS_CONFIG_PATH)] } }
412- : {}),
413-});
414416if (shouldMovePluginInstalls || pluginRegistrySourceChanged) {
415417await refreshPluginRegistryAfterConfigMutation({
416418config: writtenConfig,
417419reason: "source-changed",
420+ ...(shouldMovePluginInstalls ? { installRecords: nextConfig.plugins?.installs ?? {} } : {}),
418421logger: { warn: (message) => runtime.log(message) },
419422});
420423}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。