


























@@ -637,6 +637,56 @@ describe("bundled plugin metadata", () => {
637637);
638638});
639639640+it("keeps generated entry path resolution inside bundled plugin roots", () => {
641+const tempRoot = createGeneratedPluginTempRoot("openclaw-bundled-plugin-path-contained-");
642+const sourcePluginRoot = path.join(tempRoot, "extensions", "alpha");
643+const distPluginRoot = path.join(tempRoot, "dist", "extensions", "alpha");
644+const absoluteEscape = path.join(tempRoot, "absolute.js");
645+const absolutePluginEntry = path.join(sourcePluginRoot, "index.ts");
646+647+fs.mkdirSync(sourcePluginRoot, { recursive: true });
648+fs.mkdirSync(distPluginRoot, { recursive: true });
649+fs.writeFileSync(absolutePluginEntry, "export {};\n", "utf8");
650+fs.writeFileSync(path.join(tempRoot, "extensions", "escape.ts"), "export {};\n", "utf8");
651+fs.writeFileSync(
652+path.join(tempRoot, "dist", "extensions", "escape.js"),
653+"export {};\n",
654+"utf8",
655+);
656+fs.writeFileSync(absoluteEscape, "export {};\n", "utf8");
657+658+expect(
659+resolveBundledPluginGeneratedPath(
660+tempRoot,
661+{
662+source: absolutePluginEntry,
663+built: absolutePluginEntry,
664+},
665+"alpha",
666+),
667+).toBe(absolutePluginEntry);
668+expect(
669+resolveBundledPluginGeneratedPath(
670+tempRoot,
671+{
672+source: "../escape.ts",
673+built: "../escape.js",
674+},
675+"alpha",
676+),
677+).toBeNull();
678+expect(
679+resolveBundledPluginGeneratedPath(
680+tempRoot,
681+{
682+source: absoluteEscape,
683+built: absoluteEscape,
684+},
685+"alpha",
686+),
687+).toBeNull();
688+});
689+640690it("scans direct plugin-tree overrides and resolves generated paths from that scan dir", () => {
641691const tempRoot = createGeneratedPluginTempRoot("openclaw-bundled-plugin-direct-tree-");
642692const pluginsDir = path.join(tempRoot, "bundled-plugins");
@@ -767,6 +817,38 @@ describe("bundled plugin metadata", () => {
767817).toBe(path.join(distPluginRoot, "index.js"));
768818});
769819820+it("keeps bundled repo entry path resolution inside the plugin directory", () => {
821+const tempRoot = createGeneratedPluginTempRoot("openclaw-bundled-plugin-repo-contained-");
822+const pluginRoot = path.join(tempRoot, "extensions", "alpha");
823+824+writeJson(path.join(pluginRoot, "package.json"), {
825+name: "@openclaw/alpha",
826+version: "0.0.1",
827+openclaw: {
828+extensions: ["../escape.ts"],
829+},
830+});
831+writeJson(path.join(pluginRoot, "openclaw.plugin.json"), {
832+id: "alpha",
833+configSchema: { type: "object" },
834+});
835+fs.writeFileSync(path.join(tempRoot, "extensions", "escape.ts"), "export {};\n", "utf8");
836+fs.mkdirSync(path.join(tempRoot, "dist", "extensions"), { recursive: true });
837+fs.writeFileSync(
838+path.join(tempRoot, "dist", "extensions", "escape.js"),
839+"export {};\n",
840+"utf8",
841+);
842+843+expect(
844+resolveBundledPluginRepoEntryPath({
845+rootDir: tempRoot,
846+pluginId: "alpha",
847+preferBuilt: true,
848+}),
849+).toBeNull();
850+});
851+770852it("merges runtime channel schema metadata with manifest-owned channel config fields", () => {
771853const tempRoot = createGeneratedPluginTempRoot("openclaw-bundled-plugin-channel-configs-");
772854此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。