

























@@ -809,6 +809,49 @@ describe("ensureOnboardingPluginInstalled", () => {
809809expect(result.installed).toBe(true);
810810});
811811812+it("does not fall back from ClawHub to non-OpenClaw npm packages", async () => {
813+const confirm = vi.fn(async () => true);
814+const runtimeError = vi.fn();
815+installPluginFromClawHub.mockResolvedValueOnce({
816+ok: false,
817+code: "artifact_download_unavailable",
818+error: "ClawHub ClawPack artifact is unavailable.",
819+});
820+821+const result = await ensureOnboardingPluginInstalled({
822+cfg: {},
823+entry: {
824+pluginId: "demo-plugin",
825+label: "Demo Plugin",
826+install: {
827+clawhubSpec: "clawhub:demo-plugin@2026.5.2",
828+npmSpec: "@someone-else/demo-plugin@2026.5.2",
829+defaultChoice: "clawhub",
830+},
831+},
832+prompter: {
833+select: vi.fn(async () => "clawhub"),
834+ confirm,
835+note: vi.fn(async () => {}),
836+progress: vi.fn(() => ({ update: vi.fn(), stop: vi.fn() })),
837+} as never,
838+runtime: { error: runtimeError } as never,
839+promptInstall: false,
840+});
841+842+expect(confirm).not.toHaveBeenCalled();
843+expect(installPluginFromNpmSpec).not.toHaveBeenCalled();
844+expect(runtimeError).toHaveBeenCalledWith(
845+"Plugin install failed: ClawHub ClawPack artifact is unavailable.",
846+);
847+expect(result).toStrictEqual({
848+cfg: {},
849+installed: false,
850+pluginId: "demo-plugin",
851+status: "failed",
852+});
853+});
854+812855it("does not fall back from ClawHub to npm when ClawHub verification fails", async () => {
813856const confirm = vi.fn(async () => true);
814857const runtimeError = vi.fn();
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。