





























@@ -1849,6 +1849,29 @@ export const syntheticRuntimeMarker = {
18491849}
18501850});
185118511852+it("prefers startup argv runtime candidates over cache ancestor fallbacks", () => {
1853+const root = makeTempDir();
1854+const distFile = path.join(root, "dist", "plugins", "runtime", "index.js");
1855+const loaderCacheRoot = makeTempDir();
1856+const cacheDistFile = path.join(loaderCacheRoot, "dist", "plugins", "runtime", "index.js");
1857+const loaderCachePath = path.join(loaderCacheRoot, "tsx", "openclaw-loader.js");
1858+mkdirSafeDir(path.dirname(distFile));
1859+mkdirSafeDir(path.dirname(cacheDistFile));
1860+mkdirSafeDir(path.dirname(loaderCachePath));
1861+mkdirSafeDir(path.join(root, "bin"));
1862+fs.writeFileSync(distFile, "export const runtime = 'startup';\n", "utf-8");
1863+fs.writeFileSync(cacheDistFile, "export const runtime = 'cache';\n", "utf-8");
1864+fs.writeFileSync(loaderCachePath, "export {};\n", "utf-8");
1865+1866+expect(
1867+resolvePluginRuntimeModulePath({
1868+modulePath: loaderCachePath,
1869+argv1: path.join(root, "bin", "openclaw"),
1870+pluginSdkResolution: "dist",
1871+}),
1872+).toBe(distFile);
1873+});
1874+18521875it("reports loader, package root, and candidate paths when runtime resolution fails", () => {
18531876const root = makeTempDir();
18541877const modulePath = path.join(root, "dist", "plugins", "loader.js");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。