






















@@ -5,7 +5,9 @@ import type { OpenClawConfig } from "../config/types.openclaw.js";
55import type { PluginEnableResult } from "../plugins/enable.js";
66import { withTempDir } from "../test-helpers/temp-dir.js";
778-const resolveBundledInstallPlanForCatalogEntry = vi.hoisted(() => vi.fn(() => undefined));
8+const resolveBundledInstallPlanForCatalogEntry = vi.hoisted(() =>
9+vi.fn<(...args: unknown[]) => unknown>(() => undefined),
10+);
911vi.mock("../cli/plugin-install-plan.js", () => ({
1012 resolveBundledInstallPlanForCatalogEntry,
1113}));
@@ -479,6 +481,51 @@ describe("ensureOnboardingPluginInstalled", () => {
479481});
480482});
481483484+it("enables bundled plugins without adding their bundled directory as a local install", async () => {
485+await withTempDir({ prefix: "openclaw-onboarding-install-bundled-record-" }, async (temp) => {
486+const bundledDir = path.join(temp, "dist", "extensions", "discord");
487+await fs.mkdir(bundledDir, { recursive: true });
488+const realBundledDir = await fs.realpath(bundledDir);
489+resolveBundledInstallPlanForCatalogEntry.mockReturnValueOnce({
490+bundledSource: {
491+localPath: realBundledDir,
492+},
493+});
494+enablePluginInConfig.mockReturnValueOnce({
495+config: {
496+plugins: {
497+entries: {
498+discord: { enabled: true },
499+},
500+},
501+},
502+enabled: true,
503+});
504+505+const result = await ensureOnboardingPluginInstalled({
506+cfg: {},
507+entry: {
508+pluginId: "discord",
509+label: "Discord",
510+install: {
511+npmSpec: "@openclaw/discord",
512+},
513+},
514+prompter: {
515+select: vi.fn(async () => "local"),
516+} as never,
517+runtime: {} as never,
518+promptInstall: false,
519+});
520+521+expect(result.installed).toBe(true);
522+expect(result.cfg.plugins?.entries?.discord?.enabled).toBe(true);
523+expect(result.cfg.plugins?.load?.paths).toBeUndefined();
524+expect(result.cfg.plugins?.installs).toBeUndefined();
525+expect(recordPluginInstall).not.toHaveBeenCalled();
526+});
527+});
528+482529it("records local install source metadata when npm install falls back to local", async () => {
483530await withTempDir(
484531{ prefix: "openclaw-onboarding-install-npm-fallback-record-" },
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。