惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
Martin Fowler
Martin Fowler
爱范儿
爱范儿
IT之家
IT之家
Last Week in AI
Last Week in AI
A
About on SuperTechFans
Google DeepMind News
Google DeepMind News
阮一峰的网络日志
阮一峰的网络日志
V
V2EX
aimingoo的专栏
aimingoo的专栏
G
Google Developers Blog
J
Java Code Geeks
Microsoft Azure Blog
Microsoft Azure Blog
美团技术团队
The Cloudflare Blog
MyScale Blog
MyScale Blog
T
The Blog of Author Tim Ferriss
Hugging Face - Blog
Hugging Face - Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
云风的 BLOG
云风的 BLOG
Y
Y Combinator Blog
The GitHub Blog
The GitHub Blog
腾讯CDC
Microsoft Security Blog
Microsoft Security Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(onboarding): surface official plugin installs · openc...
vincentkoc · 2026-05-03 · via Recent Commits to openclaw:main

@@ -0,0 +1,140 @@

1+

import { beforeEach, describe, expect, it, vi } from "vitest";

2+

import { createWizardPrompter } from "../../test/helpers/wizard-prompter.js";

3+

import { createNonExitingRuntime } from "../runtime.js";

4+

import type { WizardPrompter } from "./prompts.js";

5+6+

const ensureOnboardingPluginInstalled = vi.hoisted(() =>

7+

vi.fn(async ({ cfg }: { cfg: Record<string, unknown> }) => ({

8+

cfg,

9+

installed: true,

10+

status: "installed",

11+

})),

12+

);

13+

vi.mock("../commands/onboarding-plugin-install.js", () => ({

14+

ensureOnboardingPluginInstalled,

15+

}));

16+17+

import {

18+

__testing,

19+

resolveOfficialPluginOnboardingInstallEntries,

20+

setupOfficialPluginInstalls,

21+

} from "./setup.official-plugins.js";

22+23+

describe("resolveOfficialPluginOnboardingInstallEntries", () => {

24+

it("lists optional generic official plugins without channel, provider, or search-owned entries", () => {

25+

const entries = resolveOfficialPluginOnboardingInstallEntries({ config: {} });

26+

const pluginIds = entries.map((entry) => entry.pluginId);

27+28+

expect(pluginIds).toContain("diagnostics-otel");

29+

expect(pluginIds).toContain("diagnostics-prometheus");

30+

expect(pluginIds).toContain("acpx");

31+

expect(pluginIds).not.toContain("brave");

32+

expect(pluginIds).not.toContain("codex");

33+

expect(pluginIds).not.toContain("discord");

34+

});

35+36+

it("hides already configured official plugins", () => {

37+

const entries = resolveOfficialPluginOnboardingInstallEntries({

38+

config: {

39+

plugins: {

40+

entries: {

41+

acpx: { enabled: true },

42+

},

43+

installs: {

44+

"diagnostics-otel": {

45+

source: "npm",

46+

spec: "@openclaw/diagnostics-otel",

47+

installPath: "/tmp/diagnostics-otel",

48+

},

49+

},

50+

},

51+

},

52+

});

53+

const pluginIds = entries.map((entry) => entry.pluginId);

54+55+

expect(pluginIds).not.toContain("acpx");

56+

expect(pluginIds).not.toContain("diagnostics-otel");

57+

expect(pluginIds).toContain("diagnostics-prometheus");

58+

});

59+

});

60+61+

describe("formatInstallHint", () => {

62+

it("describes dual-source npm-default installs as npm first", () => {

63+

expect(

64+

__testing.formatInstallHint({

65+

clawhubSpec: "clawhub:@openclaw/diagnostics-otel",

66+

npmSpec: "@openclaw/diagnostics-otel",

67+

defaultChoice: "npm",

68+

}),

69+

).toBe("npm, with ClawHub fallback");

70+

});

71+72+

it("keeps dual-source clawhub-default installs ClawHub first", () => {

73+

expect(

74+

__testing.formatInstallHint({

75+

clawhubSpec: "clawhub:@openclaw/diagnostics-otel",

76+

npmSpec: "@openclaw/diagnostics-otel",

77+

defaultChoice: "clawhub",

78+

}),

79+

).toBe("ClawHub, with npm fallback");

80+

});

81+

});

82+83+

describe("setupOfficialPluginInstalls", () => {

84+

beforeEach(() => {

85+

vi.clearAllMocks();

86+

ensureOnboardingPluginInstalled.mockImplementation(async ({ cfg }) => ({

87+

cfg,

88+

installed: true,

89+

status: "installed",

90+

}));

91+

});

92+93+

it("installs selected optional official plugins through the shared onboarding installer", async () => {

94+

const multiselect = vi.fn(async () => ["diagnostics-otel"]);

95+

const prompter = createWizardPrompter({

96+

multiselect: multiselect as WizardPrompter["multiselect"],

97+

});

98+99+

await setupOfficialPluginInstalls({

100+

config: {},

101+

prompter,

102+

runtime: createNonExitingRuntime(),

103+

workspaceDir: "/tmp/workspace",

104+

});

105+106+

expect(multiselect).toHaveBeenCalledWith(

107+

expect.objectContaining({

108+

message: "Install optional plugins",

109+

}),

110+

);

111+

expect(ensureOnboardingPluginInstalled).toHaveBeenCalledWith(

112+

expect.objectContaining({

113+

entry: expect.objectContaining({

114+

pluginId: "diagnostics-otel",

115+

install: expect.objectContaining({

116+

clawhubSpec: "clawhub:@openclaw/diagnostics-otel",

117+

npmSpec: "@openclaw/diagnostics-otel",

118+

defaultChoice: "npm",

119+

}),

120+

}),

121+

promptInstall: false,

122+

workspaceDir: "/tmp/workspace",

123+

}),

124+

);

125+

});

126+127+

it("does not install when the user skips optional plugins", async () => {

128+

const prompter = createWizardPrompter({

129+

multiselect: vi.fn(async () => ["__skip__"]) as WizardPrompter["multiselect"],

130+

});

131+132+

await setupOfficialPluginInstalls({

133+

config: {},

134+

prompter,

135+

runtime: createNonExitingRuntime(),

136+

});

137+138+

expect(ensureOnboardingPluginInstalled).not.toHaveBeenCalled();

139+

});

140+

});