























@@ -160,4 +160,53 @@ describe("channel package-state probes", () => {
160160}),
161161).toBe(true);
162162});
163+164+it("tries dist-runtime package-state probes before falling back to source", () => {
165+const root = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-package-state-runtime-"));
166+tempDirs.push(root);
167+const sourceRoot = path.join(root, "extensions", "matrix");
168+const builtRoot = path.join(root, "dist", "extensions", "matrix");
169+const runtimeRoot = path.join(root, "dist-runtime", "extensions", "matrix");
170+fs.mkdirSync(sourceRoot, { recursive: true });
171+fs.mkdirSync(builtRoot, { recursive: true });
172+fs.mkdirSync(runtimeRoot, { recursive: true });
173+fs.writeFileSync(
174+path.join(sourceRoot, "auth-presence.js"),
175+"throw new Error('source probe should not load');\n",
176+"utf8",
177+);
178+fs.writeFileSync(
179+path.join(builtRoot, "auth-presence.js"),
180+"module.exports.stale = () => false;\n",
181+"utf8",
182+);
183+fs.writeFileSync(
184+path.join(runtimeRoot, "auth-presence.js"),
185+"module.exports.hasAnyMatrixAuth = () => true;\n",
186+"utf8",
187+);
188+189+listChannelCatalogEntriesMock.mockReturnValue([
190+{
191+pluginId: "matrix",
192+origin: "bundled",
193+rootDir: sourceRoot,
194+channel: {
195+id: "matrix",
196+persistedAuthState: {
197+specifier: "./auth-presence",
198+exportName: "hasAnyMatrixAuth",
199+},
200+},
201+} satisfies PluginChannelCatalogEntry,
202+]);
203+204+expect(
205+hasBundledChannelPackageState({
206+metadataKey: "persistedAuthState",
207+channelId: "matrix",
208+cfg: {},
209+}),
210+).toBe(true);
211+});
163212});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。