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

推荐订阅源

J
Java Code Geeks
G
Google Developers Blog
Blog — PlanetScale
Blog — PlanetScale
U
Unit 42
A
About on SuperTechFans
Vercel News
Vercel News
B
Blog
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
腾讯CDC
D
Docker
V
Visual Studio Blog
博客园 - 叶小钗
The Cloudflare Blog
Jina AI
Jina AI
B
Blog RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
WordPress大学
WordPress大学
T
Tailwind CSS Blog
MongoDB | Blog
MongoDB | Blog
D
DataBreaches.Net
月光博客
月光博客
大猫的无限游戏
大猫的无限游戏

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): align bundled runtime surface roots · openc...
vincentkoc · 2026-05-17 · via Recent Commits to openclaw:main

@@ -1,11 +1,15 @@

1-

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

1+

import fs from "node:fs";

2+

import os from "node:os";

3+

import path from "node:path";

4+

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

25

import type { PluginChannelCatalogEntry } from "../../plugins/channel-catalog-registry.js";

36

import {

47

hasBundledChannelPackageState,

58

listBundledChannelIdsForPackageState,

69

} from "./package-state-probes.js";

710811

const listChannelCatalogEntriesMock = vi.hoisted(() => vi.fn());

12+

const tempDirs: string[] = [];

9131014

vi.mock("../../plugins/channel-catalog-registry.js", () => ({

1115

listChannelCatalogEntries: listChannelCatalogEntriesMock,

@@ -30,10 +34,21 @@ function makeBundledChannelCatalogEntry(params: {

3034

};

3135

}

323637+

function removeTempDirs() {

38+

for (const tempDir of tempDirs.splice(0)) {

39+

fs.rmSync(tempDir, { recursive: true, force: true });

40+

}

41+

}

42+3343

beforeEach(() => {

44+

removeTempDirs();

3445

listChannelCatalogEntriesMock.mockReset();

3546

});

364748+

afterEach(() => {

49+

removeTempDirs();

50+

});

51+3752

describe("channel package-state probes", () => {

3853

it("uses channel ids when manifest plugin ids differ", () => {

3954

listChannelCatalogEntriesMock.mockReturnValue([

@@ -61,4 +76,88 @@ describe("channel package-state probes", () => {

6176

}),

6277

).toBe(false);

6378

});

79+80+

it("prefers built bundled package-state probes when the catalog root is source", () => {

81+

const root = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-package-state-probe-"));

82+

tempDirs.push(root);

83+

const sourceRoot = path.join(root, "extensions", "matrix");

84+

const builtRoot = path.join(root, "dist", "extensions", "matrix");

85+

fs.mkdirSync(sourceRoot, { recursive: true });

86+

fs.mkdirSync(builtRoot, { recursive: true });

87+

fs.writeFileSync(

88+

path.join(sourceRoot, "auth-presence.ts"),

89+

"throw new Error('source probe should not load');\n",

90+

"utf8",

91+

);

92+

fs.writeFileSync(

93+

path.join(builtRoot, "auth-presence.js"),

94+

"module.exports.hasAnyMatrixAuth = () => true;\n",

95+

"utf8",

96+

);

97+98+

listChannelCatalogEntriesMock.mockReturnValue([

99+

{

100+

pluginId: "matrix",

101+

origin: "bundled",

102+

rootDir: sourceRoot,

103+

channel: {

104+

id: "matrix",

105+

persistedAuthState: {

106+

specifier: "./auth-presence",

107+

exportName: "hasAnyMatrixAuth",

108+

},

109+

},

110+

} satisfies PluginChannelCatalogEntry,

111+

]);

112+113+

expect(

114+

hasBundledChannelPackageState({

115+

metadataKey: "persistedAuthState",

116+

channelId: "matrix",

117+

cfg: {},

118+

}),

119+

).toBe(true);

120+

});

121+122+

it("falls back to source package-state probes when built artifacts are stale", () => {

123+

const root = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-package-state-fallback-"));

124+

tempDirs.push(root);

125+

const sourceRoot = path.join(root, "extensions", "whatsapp");

126+

const builtRoot = path.join(root, "dist", "extensions", "whatsapp");

127+

fs.mkdirSync(sourceRoot, { recursive: true });

128+

fs.mkdirSync(builtRoot, { recursive: true });

129+

fs.writeFileSync(

130+

path.join(sourceRoot, "auth-presence.js"),

131+

"module.exports.hasAnyWhatsAppAuth = () => true;\n",

132+

"utf8",

133+

);

134+

fs.writeFileSync(

135+

path.join(builtRoot, "auth-presence.js"),

136+

"module.exports.stale = () => false;\n",

137+

"utf8",

138+

);

139+140+

listChannelCatalogEntriesMock.mockReturnValue([

141+

{

142+

pluginId: "whatsapp",

143+

origin: "bundled",

144+

rootDir: sourceRoot,

145+

channel: {

146+

id: "whatsapp",

147+

persistedAuthState: {

148+

specifier: "./auth-presence",

149+

exportName: "hasAnyWhatsAppAuth",

150+

},

151+

},

152+

} satisfies PluginChannelCatalogEntry,

153+

]);

154+155+

expect(

156+

hasBundledChannelPackageState({

157+

metadataKey: "persistedAuthState",

158+

channelId: "whatsapp",

159+

cfg: {},

160+

}),

161+

).toBe(true);

162+

});

64163

});