



























@@ -1872,6 +1872,53 @@ export const syntheticRuntimeMarker = {
18721872).toBe(distFile);
18731873});
187418741875+it("resolves runtime fallback through symlinked startup argv", () => {
1876+const root = makeTempDir();
1877+const distFile = path.join(root, "dist", "plugins", "runtime", "index.js");
1878+const binFile = path.join(root, "bin", "openclaw");
1879+const shimRoot = makeTempDir();
1880+const shimFile = path.join(shimRoot, "bin", "openclaw");
1881+const loaderCachePath = path.join(makeTempDir(), "tsx", "openclaw-loader.js");
1882+mkdirSafeDir(path.dirname(distFile));
1883+mkdirSafeDir(path.dirname(binFile));
1884+mkdirSafeDir(path.dirname(shimFile));
1885+mkdirSafeDir(path.dirname(loaderCachePath));
1886+fs.writeFileSync(distFile, "export const runtime = 'startup';\n", "utf-8");
1887+fs.writeFileSync(binFile, "#!/usr/bin/env node\n", "utf-8");
1888+fs.symlinkSync(binFile, shimFile);
1889+fs.writeFileSync(loaderCachePath, "export {};\n", "utf-8");
1890+1891+expect(
1892+resolvePluginRuntimeModulePath({
1893+modulePath: loaderCachePath,
1894+argv1: shimFile,
1895+pluginSdkResolution: "dist",
1896+}),
1897+).toBe(fs.realpathSync(distFile));
1898+});
1899+1900+it("resolves runtime fallback through npm .bin startup argv", () => {
1901+const root = makeTempDir();
1902+const packageRoot = path.join(root, "node_modules", "openclaw");
1903+const distFile = path.join(packageRoot, "dist", "plugins", "runtime", "index.js");
1904+const binFile = path.join(root, "node_modules", ".bin", "openclaw");
1905+const loaderCachePath = path.join(makeTempDir(), "tsx", "openclaw-loader.js");
1906+mkdirSafeDir(path.dirname(distFile));
1907+mkdirSafeDir(path.dirname(binFile));
1908+mkdirSafeDir(path.dirname(loaderCachePath));
1909+fs.writeFileSync(distFile, "export const runtime = 'startup';\n", "utf-8");
1910+fs.writeFileSync(binFile, "#!/usr/bin/env node\n", "utf-8");
1911+fs.writeFileSync(loaderCachePath, "export {};\n", "utf-8");
1912+1913+expect(
1914+resolvePluginRuntimeModulePath({
1915+modulePath: loaderCachePath,
1916+argv1: binFile,
1917+pluginSdkResolution: "dist",
1918+}),
1919+).toBe(distFile);
1920+});
1921+18751922it("reports loader, package root, and candidate paths when runtime resolution fails", () => {
18761923const root = makeTempDir();
18771924const modulePath = path.join(root, "dist", "plugins", "loader.js");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。