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

推荐订阅源

人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
MyScale Blog
MyScale Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
WordPress大学
WordPress大学
Vercel News
Vercel News
D
Docker
博客园 - 聂微东
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏
云风的 BLOG
云风的 BLOG
D
DataBreaches.Net
B
Blog RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - Franky
Microsoft Security Blog
Microsoft Security Blog
美团技术团队
F
Fortinet All Blogs
MongoDB | Blog
MongoDB | Blog
T
The Blog of Author Tim Ferriss
GbyAI
GbyAI
N
Netflix TechBlog - Medium
G
Google Developers Blog
腾讯CDC

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): keep runtime wrapper native-only · open...
steipete · 2026-05-02 · via Recent Commits to openclaw:main

@@ -2,33 +2,12 @@

22

// while packaged dist builds resolve a distinct runtime entry that cannot loop

33

// back into this wrapper through the stable root runtime alias.

44

import fs from "node:fs";

5-

import { createRequire } from "node:module";

65

import path from "node:path";

76

import { fileURLToPath, pathToFileURL } from "node:url";

879-

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

10-118

const PLUGIN_ID = "matrix";

12-

const OPENCLAW_PLUGIN_SDK_PACKAGE_NAMES = [

13-

["openclaw", "plugin-sdk"].join("/"),

14-

["@openclaw", "plugin-sdk"].join("/"),

15-

];

16-

const PLUGIN_SDK_EXPORT_PREFIX = "./plugin-sdk/";

17-

const PLUGIN_SDK_SOURCE_EXTENSIONS = [".ts", ".mts", ".js", ".mjs", ".cts", ".cjs"];

189

const PLUGIN_ENTRY_RUNTIME_BASENAME = "plugin-entry.handlers.runtime";

1910

const NATIVE_RUNTIME_EXTENSIONS = [".js", ".mjs", ".cjs"];

20-

const JITI_EXTENSIONS = [

21-

".ts",

22-

".tsx",

23-

".mts",

24-

".cts",

25-

".mtsx",

26-

".ctsx",

27-

".js",

28-

".mjs",

29-

".cjs",

30-

".json",

31-

];

32113312

function readPackageJson(packageRoot) {

3413

try {

@@ -84,55 +63,6 @@ function resolveExistingFile(basePath, extensions) {

8463

return null;

8564

}

866587-

function buildPluginSdkAliasMap(moduleUrl) {

88-

const location = findOpenClawPackageRoot(path.dirname(fileURLToPath(moduleUrl)));

89-

if (!location) {

90-

return {};

91-

}

92-93-

const { packageRoot, packageJson } = location;

94-

const sourcePluginSdkDir = path.join(packageRoot, "src", "plugin-sdk");

95-

const distPluginSdkDir = path.join(packageRoot, "dist", "plugin-sdk");

96-

const aliasMap = {};

97-

const rootAlias =

98-

resolveExistingFile(path.join(sourcePluginSdkDir, "root-alias"), [".cjs"]) ??

99-

resolveExistingFile(path.join(distPluginSdkDir, "root-alias"), [".cjs"]);

100-

if (rootAlias) {

101-

for (const packageName of OPENCLAW_PLUGIN_SDK_PACKAGE_NAMES) {

102-

aliasMap[packageName] = rootAlias;

103-

}

104-

}

105-106-

for (const exportKey of Object.keys(packageJson.exports ?? {}).toSorted()) {

107-

if (!exportKey.startsWith(PLUGIN_SDK_EXPORT_PREFIX)) {

108-

continue;

109-

}

110-

const subpath = exportKey.slice(PLUGIN_SDK_EXPORT_PREFIX.length);

111-

if (!/^[A-Za-z0-9][A-Za-z0-9_-]*$/.test(subpath)) {

112-

continue;

113-

}

114-

const resolvedPath =

115-

resolveExistingFile(path.join(sourcePluginSdkDir, subpath), PLUGIN_SDK_SOURCE_EXTENSIONS) ??

116-

resolveExistingFile(path.join(distPluginSdkDir, subpath), [".js"]);

117-

if (resolvedPath) {

118-

for (const packageName of OPENCLAW_PLUGIN_SDK_PACKAGE_NAMES) {

119-

aliasMap[`${packageName}/${subpath}`] = resolvedPath;

120-

}

121-

}

122-

}

123-124-

const extensionApi =

125-

resolveExistingFile(

126-

path.join(packageRoot, "src", "extensionAPI"),

127-

PLUGIN_SDK_SOURCE_EXTENSIONS,

128-

) ?? resolveExistingFile(path.join(packageRoot, "dist", "extensionAPI"), [".js"]);

129-

if (extensionApi) {

130-

aliasMap["openclaw/extension-api"] = extensionApi;

131-

}

132-133-

return aliasMap;

134-

}

135-13666

function resolveBundledPluginRuntimeModulePath(moduleUrl, params) {

13767

const modulePath = fileURLToPath(moduleUrl);

13868

const moduleDir = path.dirname(modulePath);

@@ -142,7 +72,7 @@ function resolveBundledPluginRuntimeModulePath(moduleUrl, params) {

14272

];

1437314474

for (const candidate of localCandidates) {

145-

const resolved = resolveExistingFile(candidate, PLUGIN_SDK_SOURCE_EXTENSIONS);

75+

const resolved = resolveExistingFile(candidate, NATIVE_RUNTIME_EXTENSIONS);

14676

if (resolved) {

14777

return resolved;

14878

}

@@ -157,7 +87,7 @@ function resolveBundledPluginRuntimeModulePath(moduleUrl, params) {

15787

];

1588815989

for (const candidate of packageCandidates) {

160-

const resolved = resolveExistingFile(candidate, PLUGIN_SDK_SOURCE_EXTENSIONS);

90+

const resolved = resolveExistingFile(candidate, NATIVE_RUNTIME_EXTENSIONS);

16191

if (resolved) {

16292

return resolved;

16393

}

@@ -170,17 +100,7 @@ function resolveBundledPluginRuntimeModulePath(moduleUrl, params) {

170100

}

171101172102

async function loadRuntimeModule(modulePath) {

173-

if (NATIVE_RUNTIME_EXTENSIONS.includes(path.extname(modulePath))) {

174-

return import(pathToFileURL(modulePath).href);

175-

}

176-

const { createJiti } = require("jiti");

177-

const jiti = createJiti(import.meta.url, {

178-

alias: buildPluginSdkAliasMap(import.meta.url),

179-

interopDefault: true,

180-

tryNative: false,

181-

extensions: JITI_EXTENSIONS,

182-

});

183-

return jiti(modulePath);

103+

return import(pathToFileURL(modulePath).href);

184104

}

185105186106

const mod = await loadRuntimeModule(