


















@@ -90,6 +90,24 @@ function createBundledPluginFixture(params: {
9090return { bundledPluginsDir, pluginId, pluginRoot };
9191}
929293+function createPackageSourcePluginFixture(params: {
94+prefix: string;
95+marker: string;
96+}): TrustedBundledPluginFixture {
97+const bundledPluginsDir = path.join(packageRoot, "extensions");
98+const pluginId = nextTrustedPluginId(params.prefix);
99+const pluginRoot = path.join(bundledPluginsDir, pluginId);
100+fs.mkdirSync(pluginRoot, { recursive: true });
101+trustedBundledPluginFixtureRoots.push(pluginRoot);
102+writeFixturePackageJson(pluginRoot, pluginId);
103+fs.writeFileSync(
104+path.join(pluginRoot, "api.ts"),
105+`export const marker = ${JSON.stringify(params.marker)};\n`,
106+"utf8",
107+);
108+return { bundledPluginsDir, pluginId, pluginRoot };
109+}
110+93111function createThrowingPluginFixture(prefix: string): TrustedBundledPluginFixture {
94112const bundledPluginsDir = createTrustedBundledPluginsRoot();
95113const pluginId = nextTrustedPluginId(prefix);
@@ -286,16 +304,20 @@ describe("plugin-sdk facade loader", () => {
286304});
287305288306it("falls back to package source surfaces when an override dir lacks a bundled plugin", () => {
307+const fixture = createPackageSourcePluginFixture({
308+prefix: "openclaw-facade-loader-source-fallback-",
309+marker: "source-fallback",
310+});
289311process.env.OPENCLAW_BUNDLED_PLUGINS_DIR = createTempDirSync("openclaw-facade-loader-empty-");
290312291313const loaded = loadBundledPluginPublicSurfaceModuleSync<{
292-emptyPluginConfigSchema: unknown;
314+marker: string;
293315}>({
294-dirName: "diagnostics-prometheus",
316+dirName: fixture.pluginId,
295317artifactBasename: "api.js",
296318});
297319298-expect(loaded.emptyPluginConfigSchema).toEqual(expect.any(Function));
320+expect(loaded.marker).toBe("source-fallback");
299321});
300322301323it("keeps bundled facade loads disabled when bundled plugins are disabled", () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。