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

推荐订阅源

爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
WordPress大学
WordPress大学
Y
Y Combinator Blog
I
InfoQ
美团技术团队
罗磊的独立博客
B
Blog RSS Feed
GbyAI
GbyAI
小众软件
小众软件
IT之家
IT之家
Engineering at Meta
Engineering at Meta
Blog — PlanetScale
Blog — PlanetScale
V
V2EX
Last Week in AI
Last Week in AI
酷 壳 – CoolShell
酷 壳 – CoolShell
Jina AI
Jina AI
MyScale Blog
MyScale Blog
博客园 - 聂微东
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
Apple Machine Learning Research
Apple Machine Learning Research
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss

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
refactor(matrix): avoid jiti on packaged runtime path · o...
steipete · 2026-05-02 · via Recent Commits to openclaw:main

@@ -1,14 +1,11 @@

11

import fs from "node:fs";

2-

import { createRequire } from "node:module";

32

import os from "node:os";

43

import path from "node:path";

54

import { pathToFileURL } from "node:url";

65

import { afterEach, expect, it } from "vitest";

7687

const tempDirs: string[] = [];

98

const REPO_ROOT = process.cwd();

10-

const require = createRequire(import.meta.url);

11-

const JITI_ENTRY_PATH = require.resolve("jiti");

129

const matrixWrapperGlobal = globalThis as typeof globalThis & {

1310

__openclawMatrixWrapperJitiOptions?: unknown;

1411

};

@@ -40,14 +37,6 @@ function writeFixtureFile(fixtureRoot: string, relativePath: string, value: stri

4037

fs.writeFileSync(fullPath, value, "utf8");

4138

}

423943-

function writeJitiFixture(fixtureRoot: string) {

44-

writeFixtureFile(

45-

fixtureRoot,

46-

"node_modules/jiti/index.js",

47-

`module.exports = require(${JSON.stringify(JITI_ENTRY_PATH)});\n`,

48-

);

49-

}

50-5140

function writeCapturingJitiFixture(fixtureRoot: string) {

5241

writeFixtureFile(

5342

fixtureRoot,

@@ -143,15 +132,19 @@ function writeTrustedOpenClawBinFixture(

143132

writeFixtureFile(fixtureRoot, "dist/plugin-sdk/group-access.js", "export {};\n");

144133

}

145134146-

function writeSourceRuntimeWrapperFixture(fixtureRoot: string) {

135+

function writeSourceRuntimeWrapperFixture(

136+

fixtureRoot: string,

137+

options: { runtimeExtension?: ".js" | ".ts" } = {},

138+

) {

139+

const runtimeExtension = options.runtimeExtension ?? ".js";

147140

writeFixtureFile(

148141

fixtureRoot,

149142

"extensions/matrix/src/plugin-entry.runtime.js",

150143

MATRIX_RUNTIME_WRAPPER_SOURCE,

151144

);

152145

writeFixtureFile(

153146

fixtureRoot,

154-

"extensions/matrix/plugin-entry.handlers.runtime.js",

147+

`extensions/matrix/plugin-entry.handlers.runtime${runtimeExtension}`,

155148

PACKAGED_RUNTIME_STUB,

156149

);

157150

}

@@ -174,7 +167,7 @@ function writeCapturingSourceRuntimeWrapperFixture(fixtureRoot: string) {

174167

delete matrixWrapperGlobal.__openclawMatrixWrapperJitiOptions;

175168

writeOpenClawAliasFixture(fixtureRoot);

176169

writeCapturingJitiFixture(fixtureRoot);

177-

writeSourceRuntimeWrapperFixture(fixtureRoot);

170+

writeSourceRuntimeWrapperFixture(fixtureRoot, { runtimeExtension: ".ts" });

178171

}

179172180173

function expectSourcePluginSdkAliases(fixtureRoot: string) {

@@ -198,7 +191,6 @@ it("loads the source-checkout runtime wrapper through native ESM import", async

198191

const fixtureRoot = makeFixtureRoot(".tmp-matrix-source-runtime-");

199192200193

writeOpenClawPackageFixture(fixtureRoot);

201-

writeJitiFixture(fixtureRoot);

202194

writeSourceRuntimeWrapperFixture(fixtureRoot);

203195204196

expectRuntimeWrapperExports(

@@ -210,7 +202,6 @@ it("loads the packaged runtime wrapper without recursing through the stable root

210202

const fixtureRoot = makeFixtureRoot(".tmp-matrix-runtime-");

211203212204

writeOpenClawPackageFixture(fixtureRoot);

213-

writeJitiFixture(fixtureRoot);

214205

writeFixtureFile(

215206

fixtureRoot,

216207

"dist/plugin-entry.runtime-C88YIa_v.js",

@@ -267,7 +258,7 @@ it("keeps wrapper plugin-sdk aliases deterministic and ignores unsafe subpaths",

267258

writeFixtureFile(fixtureRoot, "src/plugin-sdk/alpha.ts", "export {};\n");

268259

writeFixtureFile(fixtureRoot, "src/plugin-sdk/zeta.ts", "export {};\n");

269260

writeCapturingJitiFixture(fixtureRoot);

270-

writeSourceRuntimeWrapperFixture(fixtureRoot);

261+

writeSourceRuntimeWrapperFixture(fixtureRoot, { runtimeExtension: ".ts" });

271262

await importFixtureModule(fixtureRoot, "extensions/matrix/src/plugin-entry.runtime.js");

272263273264

const aliasKeys = Object.keys(

@@ -317,7 +308,7 @@ it("ignores nearby untrusted openclaw package stubs when resolving the wrapper r

317308

);

318309

writeFixtureFile(fixtureRoot, "extensions/src/plugin-sdk/group-access.ts", "export {};\n");

319310

writeCapturingJitiFixture(fixtureRoot);

320-

writeSourceRuntimeWrapperFixture(fixtureRoot);

311+

writeSourceRuntimeWrapperFixture(fixtureRoot, { runtimeExtension: ".ts" });

321312

await importFixtureModule(fixtureRoot, "extensions/matrix/src/plugin-entry.runtime.js");

322313323314

expectSourcePluginSdkAliases(fixtureRoot);

@@ -329,7 +320,7 @@ it("treats string bin hints case-insensitively when trusting wrapper package roo

329320

delete matrixWrapperGlobal.__openclawMatrixWrapperJitiOptions;

330321

writeTrustedOpenClawBinFixture(fixtureRoot, "OpenClaw.MJS");

331322

writeCapturingJitiFixture(fixtureRoot);

332-

writeSourceRuntimeWrapperFixture(fixtureRoot);

323+

writeSourceRuntimeWrapperFixture(fixtureRoot, { runtimeExtension: ".ts" });

333324

await importFixtureModule(fixtureRoot, "extensions/matrix/src/plugin-entry.runtime.js");

334325335326

expect(matrixWrapperGlobal.__openclawMatrixWrapperJitiOptions).toMatchObject({