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

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Vercel News
Vercel News
F
Fortinet All Blogs
月光博客
月光博客
G
Google Developers Blog
博客园 - Franky
GbyAI
GbyAI
The Cloudflare Blog
I
InfoQ
雷峰网
雷峰网
WordPress大学
WordPress大学
罗磊的独立博客
大猫的无限游戏
大猫的无限游戏
T
The Blog of Author Tim Ferriss
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 聂微东
小众软件
小众软件
腾讯CDC
B
Blog
量子位
V
V2EX
S
SegmentFault 最新的问题
Google DeepMind News
Google DeepMind News

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(plugins): keep externalized launch installs on npm · ...
vincentkoc · 2026-05-03 · via Recent Commits to openclaw:main

@@ -0,0 +1,145 @@

1+

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

2+

import type { InstalledPluginIndex } from "../plugins/installed-plugin-index.js";

3+

import type { PluginManifestRegistry } from "../plugins/manifest-registry.js";

4+5+

const readPersistedInstalledPluginIndexMock = vi.fn();

6+

const loadPluginManifestRegistryForInstalledIndexMock = vi.fn();

7+8+

vi.mock("../plugins/installed-plugin-index-store.js", () => ({

9+

readPersistedInstalledPluginIndex: (...args: unknown[]) =>

10+

readPersistedInstalledPluginIndexMock(...args),

11+

}));

12+13+

vi.mock("../plugins/manifest-registry-installed.js", () => ({

14+

loadPluginManifestRegistryForInstalledIndex: (...args: unknown[]) =>

15+

loadPluginManifestRegistryForInstalledIndexMock(...args),

16+

}));

17+18+

const { listPersistedBundledPluginLocationBridges } = await import("./plugins-location-bridges.js");

19+20+

function makeIndex(record: InstalledPluginIndex["plugins"][number]): InstalledPluginIndex {

21+

return {

22+

version: 1,

23+

hostContractVersion: "2026.5.2",

24+

compatRegistryVersion: "test",

25+

migrationVersion: 1,

26+

policyHash: "test",

27+

generatedAtMs: 1,

28+

refreshReason: "test",

29+

installRecords: {},

30+

plugins: [record],

31+

};

32+

}

33+34+

function makeRegistry(pluginId: string): PluginManifestRegistry {

35+

return {

36+

plugins: [

37+

{

38+

id: pluginId,

39+

name: pluginId,

40+

rootDir: `/app/dist/extensions/${pluginId}`,

41+

source: `/app/dist/extensions/${pluginId}/index.js`,

42+

origin: "bundled",

43+

channels: [pluginId],

44+

providers: [],

45+

cliBackends: [],

46+

syntheticAuthRefs: [],

47+

nonSecretAuthMarkers: [],

48+

skills: [],

49+

settingsFiles: [],

50+

hooks: [],

51+

configContracts: [],

52+

activation: {},

53+

startup: {},

54+

packageInstall: {

55+

clawhubSpec: `clawhub:@openclaw/${pluginId}`,

56+

npmSpec: `@openclaw/${pluginId}`,

57+

defaultChoice: "clawhub",

58+

},

59+

},

60+

],

61+

diagnostics: [],

62+

} as unknown as PluginManifestRegistry;

63+

}

64+65+

describe("listPersistedBundledPluginLocationBridges", () => {

66+

beforeEach(() => {

67+

readPersistedInstalledPluginIndexMock.mockReset();

68+

loadPluginManifestRegistryForInstalledIndexMock.mockReset();

69+

});

70+71+

it("keeps persisted bundled relocations npm-first for launch", async () => {

72+

readPersistedInstalledPluginIndexMock.mockResolvedValue(

73+

makeIndex({

74+

pluginId: "diagnostics-otel",

75+

manifestPath: "/app/dist/extensions/diagnostics-otel/openclaw.plugin.json",

76+

manifestHash: "hash",

77+

source: "/app/dist/extensions/diagnostics-otel/index.js",

78+

rootDir: "/app/dist/extensions/diagnostics-otel",

79+

origin: "bundled",

80+

enabled: true,

81+

startup: {},

82+

compat: [],

83+

packageInstall: {

84+

defaultChoice: "clawhub",

85+

clawhub: {

86+

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

87+

packageName: "@openclaw/diagnostics-otel",

88+

exactVersion: false,

89+

},

90+

npm: {

91+

spec: "@openclaw/diagnostics-otel",

92+

packageName: "@openclaw/diagnostics-otel",

93+

selectorKind: "none",

94+

exactVersion: false,

95+

pinState: "floating-without-integrity",

96+

},

97+

warnings: [],

98+

},

99+

}),

100+

);

101+

loadPluginManifestRegistryForInstalledIndexMock.mockReturnValue(

102+

makeRegistry("diagnostics-otel"),

103+

);

104+105+

await expect(listPersistedBundledPluginLocationBridges({})).resolves.toEqual([

106+

{

107+

bundledPluginId: "diagnostics-otel",

108+

pluginId: "diagnostics-otel",

109+

preferredSource: "npm",

110+

npmSpec: "@openclaw/diagnostics-otel",

111+

channelIds: ["diagnostics-otel"],

112+

},

113+

]);

114+

});

115+116+

it("does not create a relocation bridge without npm metadata", async () => {

117+

readPersistedInstalledPluginIndexMock.mockResolvedValue(

118+

makeIndex({

119+

pluginId: "diagnostics-otel",

120+

manifestPath: "/app/dist/extensions/diagnostics-otel/openclaw.plugin.json",

121+

manifestHash: "hash",

122+

source: "/app/dist/extensions/diagnostics-otel/index.js",

123+

rootDir: "/app/dist/extensions/diagnostics-otel",

124+

origin: "bundled",

125+

enabled: true,

126+

startup: {},

127+

compat: [],

128+

packageInstall: {

129+

defaultChoice: "clawhub",

130+

clawhub: {

131+

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

132+

packageName: "@openclaw/diagnostics-otel",

133+

exactVersion: false,

134+

},

135+

warnings: [],

136+

},

137+

}),

138+

);

139+

loadPluginManifestRegistryForInstalledIndexMock.mockReturnValue(

140+

makeRegistry("diagnostics-otel"),

141+

);

142+143+

await expect(listPersistedBundledPluginLocationBridges({})).resolves.toEqual([]);

144+

});

145+

});