惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hugging Face - Blog
Hugging Face - Blog
V
Visual Studio Blog
Last Week in AI
Last Week in AI
Stack Overflow Blog
Stack Overflow Blog
The GitHub Blog
The GitHub Blog
Recent Announcements
Recent Announcements
博客园 - Franky
D
DataBreaches.Net
B
Blog
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
Microsoft Azure Blog
Microsoft Azure Blog
人人都是产品经理
人人都是产品经理
WordPress大学
WordPress大学
P
Proofpoint News Feed
J
Java Code Geeks
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Martin Fowler
Martin Fowler
月光博客
月光博客
宝玉的分享
宝玉的分享
Engineering at Meta
Engineering at Meta
阮一峰的网络日志
阮一峰的网络日志
F
Fortinet All Blogs
博客园 - 【当耐特】

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
perf(plugins): memoize packaged runtime dist mirrors · op...
steipete · 2026-04-29 · via Recent Commits to openclaw:main

@@ -198,14 +198,26 @@ describe("prepareBundledPluginRuntimeRoot", () => {

198198

}

199199200200

const realReadFileSync = fs.readFileSync.bind(fs);

201+

const realReaddirSync = fs.readdirSync.bind(fs);

201202

const readPaths: string[] = [];

203+

const readdirPaths: string[] = [];

202204

vi.spyOn(fs, "readFileSync").mockImplementation(((target, options) => {

203205

const targetPath = target.toString();

204206

if (targetPath === rootChunk || targetPath === externalChunk) {

205207

readPaths.push(targetPath);

206208

}

207209

return realReadFileSync(target, options as never);

208210

}) as typeof fs.readFileSync);

211+

vi.spyOn(fs, "readdirSync").mockImplementation(((target, options) => {

212+

const targetPath = target.toString();

213+

if (

214+

targetPath === path.join(packageRoot, "dist") &&

215+

new Error().stack?.includes("mirrorBundledRuntimeDistRootEntries")

216+

) {

217+

readdirPaths.push(targetPath);

218+

}

219+

return realReaddirSync(target, options as never);

220+

}) as typeof fs.readdirSync);

209221210222

for (const pluginId of ["alpha", "beta"]) {

211223

const pluginRoot = path.join(packageRoot, "dist", "extensions", pluginId);

@@ -219,6 +231,75 @@ describe("prepareBundledPluginRuntimeRoot", () => {

219231220232

expect(readPaths.filter((entry) => entry === rootChunk)).toHaveLength(1);

221233

expect(readPaths.filter((entry) => entry === externalChunk)).toHaveLength(1);

234+

expect(readdirPaths).toHaveLength(1);

235+

});

236+237+

it("does not memoize source-checkout dist mirrors", () => {

238+

const packageRoot = makeTempRoot();

239+

const stageDir = makeTempRoot();

240+

const env = { ...process.env, OPENCLAW_PLUGIN_STAGE_DIR: stageDir };

241+

fs.mkdirSync(path.join(packageRoot, ".git"), { recursive: true });

242+

fs.mkdirSync(path.join(packageRoot, "src"), { recursive: true });

243+

fs.mkdirSync(path.join(packageRoot, "extensions"), { recursive: true });

244+

const pluginRoot = path.join(packageRoot, "dist", "extensions", "alpha");

245+

fs.mkdirSync(pluginRoot, { recursive: true });

246+

fs.writeFileSync(

247+

path.join(packageRoot, "package.json"),

248+

JSON.stringify({ name: "openclaw", version: "2026.4.27", type: "module" }),

249+

"utf8",

250+

);

251+

fs.writeFileSync(path.join(packageRoot, "dist", "shared-runtime.js"), "export {};\n", "utf8");

252+

fs.writeFileSync(

253+

path.join(pluginRoot, "index.js"),

254+

`import "../../shared-runtime.js"; export default { id: "alpha" };\n`,

255+

"utf8",

256+

);

257+

fs.writeFileSync(

258+

path.join(pluginRoot, "package.json"),

259+

JSON.stringify(

260+

{

261+

name: "@openclaw/alpha",

262+

version: "1.0.0",

263+

type: "module",

264+

dependencies: { "alpha-runtime": "1.0.0" },

265+

openclaw: { extensions: ["./index.js"] },

266+

},

267+

null,

268+

2,

269+

),

270+

"utf8",

271+

);

272+

const installRoot = resolveBundledRuntimeDependencyInstallRoot(pluginRoot, { env });

273+

fs.mkdirSync(path.join(installRoot, "node_modules", "alpha-runtime"), { recursive: true });

274+

fs.writeFileSync(

275+

path.join(installRoot, "node_modules", "alpha-runtime", "package.json"),

276+

JSON.stringify({ name: "alpha-runtime", version: "1.0.0", type: "module" }),

277+

"utf8",

278+

);

279+280+

const realReaddirSync = fs.readdirSync.bind(fs);

281+

const readdirPaths: string[] = [];

282+

vi.spyOn(fs, "readdirSync").mockImplementation(((target, options) => {

283+

const targetPath = target.toString();

284+

if (

285+

targetPath === path.join(packageRoot, "dist") &&

286+

new Error().stack?.includes("mirrorBundledRuntimeDistRootEntries")

287+

) {

288+

readdirPaths.push(targetPath);

289+

}

290+

return realReaddirSync(target, options as never);

291+

}) as typeof fs.readdirSync);

292+293+

for (let index = 0; index < 2; index += 1) {

294+

prepareBundledPluginRuntimeRoot({

295+

pluginId: "alpha",

296+

pluginRoot,

297+

modulePath: path.join(pluginRoot, "index.js"),

298+

env,

299+

});

300+

}

301+302+

expect(readdirPaths).toHaveLength(2);

222303

});

223304224305

it("does not copy staged runtime mirror dist files onto themselves", () => {