


























@@ -1,6 +1,7 @@
11import fs from "node:fs";
22import path from "node:path";
33import { resolveBundledInstallPlanForCatalogEntry } from "../cli/plugin-install-plan.js";
4+import { refreshPluginRegistryAfterConfigMutation } from "../cli/plugins-registry-refresh.js";
45import type { OpenClawConfig } from "../config/types.openclaw.js";
56import { parseRegistryNpmSpec } from "../infra/npm-registry-spec.js";
67import {
@@ -149,6 +150,23 @@ async function persistOnboardingPluginInstallRecord(params: {
149150await writePersistedPluginInstallLedger(recordPluginInstallInRecords(records, params.install));
150151}
151152153+async function refreshRegistryAfterOnboardingPluginInstall(params: {
154+cfg: OpenClawConfig;
155+refreshRegistry?: boolean;
156+runtime: RuntimeEnv;
157+workspaceDir?: string;
158+}) {
159+if (params.refreshRegistry === false) {
160+return;
161+}
162+await refreshPluginRegistryAfterConfigMutation({
163+config: params.cfg,
164+reason: "source-changed",
165+ ...(params.workspaceDir ? { workspaceDir: params.workspaceDir } : {}),
166+logger: { warn: (message) => params.runtime.log(message) },
167+});
168+}
169+152170async function recordLocalPluginInstall(params: {
153171cfg: OpenClawConfig;
154172entry: OnboardingPluginInstallEntry;
@@ -438,6 +456,7 @@ export async function ensureOnboardingPluginInstalled(params: {
438456cfg: OpenClawConfig;
439457entry: OnboardingPluginInstallEntry;
440458prompter: WizardPrompter;
459+refreshRegistry?: boolean;
441460runtime: RuntimeEnv;
442461workspaceDir?: string;
443462}): Promise<OnboardingPluginInstallResult> {
@@ -494,6 +513,12 @@ export async function ensureOnboardingPluginInstalled(params: {
494513}
495514next = addPluginLoadPath(enableResult.config, localPath);
496515next = await recordLocalPluginInstall({ cfg: next, entry, localPath, npmSpec, workspaceDir });
516+await refreshRegistryAfterOnboardingPluginInstall({
517+cfg: next,
518+refreshRegistry: params.refreshRegistry,
519+ runtime,
520+ workspaceDir,
521+});
497522return {
498523cfg: next,
499524installed: true,
@@ -576,6 +601,12 @@ export async function ensureOnboardingPluginInstalled(params: {
576601 install,
577602});
578603next = withoutPluginInstallRecords(recordPluginInstall(next, install));
604+await refreshRegistryAfterOnboardingPluginInstall({
605+cfg: next,
606+refreshRegistry: params.refreshRegistry,
607+ runtime,
608+ workspaceDir,
609+});
579610return {
580611cfg: next,
581612installed: true,
@@ -615,6 +646,12 @@ export async function ensureOnboardingPluginInstalled(params: {
615646}
616647next = addPluginLoadPath(enableResult.config, localPath);
617648next = await recordLocalPluginInstall({ cfg: next, entry, localPath, npmSpec, workspaceDir });
649+await refreshRegistryAfterOnboardingPluginInstall({
650+cfg: next,
651+refreshRegistry: params.refreshRegistry,
652+ runtime,
653+ workspaceDir,
654+});
618655return {
619656cfg: next,
620657installed: true,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。