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

推荐订阅源

N
Netflix TechBlog - Medium
IT之家
IT之家
博客园_首页
Hugging Face - Blog
Hugging Face - Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
美团技术团队
小众软件
小众软件
博客园 - 叶小钗
WordPress大学
WordPress大学
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 三生石上(FineUI控件)
罗磊的独立博客
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Last Week in AI
Last Week in AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
宝玉的分享
宝玉的分享
博客园 - 【当耐特】
月光博客
月光博客
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
人人都是产品经理
人人都是产品经理

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
fix: reject source-only plugin package installs · opencla...
steipete · 2026-05-03 · via Recent Commits to openclaw:main

@@ -4,6 +4,7 @@ import path from "node:path";

44

import { bundledDistPluginFile } from "openclaw/plugin-sdk/test-fixtures";

55

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

66

import { discoverOpenClawPlugins } from "./discovery.js";

7+

import { listBuiltRuntimeEntryCandidates } from "./package-entrypoints.js";

78

import {

89

cleanupTrackedTempDirs,

910

makeTrackedTempDir,

@@ -198,6 +199,7 @@ function createPackagePluginWithEntry(params: {

198199

packageName: string;

199200

pluginId?: string;

200201

entryPath?: string;

202+

writeBuiltRuntime?: boolean;

201203

}) {

202204

const entryPath = params.entryPath ?? "src/index.ts";

203205

mkdirSafe(path.dirname(path.join(params.packageDir, entryPath)));

@@ -208,6 +210,14 @@ function createPackagePluginWithEntry(params: {

208210

...(params.pluginId ? { pluginId: params.pluginId } : {}),

209211

});

210212

writePluginEntry(path.join(params.packageDir, entryPath));

213+

if (params.writeBuiltRuntime ?? listBuiltRuntimeEntryCandidates(entryPath).length > 0) {

214+

const runtimeEntry = listBuiltRuntimeEntryCandidates(entryPath)[0];

215+

if (runtimeEntry) {

216+

const runtimePath = path.join(params.packageDir, runtimeEntry.replace(/^\.\//u, ""));

217+

mkdirSafe(path.dirname(runtimePath));

218+

writePluginEntry(runtimePath);

219+

}

220+

}

211221

}

212222213223

function createBundleRoot(bundleDir: string, markerPath: string, manifest?: unknown) {

@@ -303,7 +313,7 @@ function expectBundleCandidateMatch(params: {

303313

async function expectRejectedPackageExtensionEntry(params: {

304314

stateDir: string;

305315

setup: (stateDir: string) => boolean | void;

306-

expectedDiagnostic?: "escapes" | "none";

316+

expectedDiagnostic?: "escapes" | "none" | "runtime";

307317

expectedId?: string;

308318

}) {

309319

if (params.setup(params.stateDir) === false) {

@@ -320,6 +330,14 @@ async function expectRejectedPackageExtensionEntry(params: {

320330

expectEscapesPackageDiagnostic(result.diagnostics);

321331

return;

322332

}

333+

if (params.expectedDiagnostic === "runtime") {

334+

expect(

335+

result.diagnostics.some(

336+

(entry) => entry.level === "error" && entry.message.includes("compiled runtime output"),

337+

),

338+

).toBe(true);

339+

return;

340+

}

323341

expect(result.diagnostics).toEqual([]);

324342

}

325343

@@ -714,6 +732,7 @@ describe("discoverOpenClawPlugins", () => {

714732

const stateDir = makeTempDir();

715733

const globalExt = path.join(stateDir, "extensions", "pack");

716734

mkdirSafe(path.join(globalExt, "src"));

735+

mkdirSafe(path.join(globalExt, "dist"));

717736718737

writePluginPackageManifest({

719738

packageDir: globalExt,

@@ -722,15 +741,43 @@ describe("discoverOpenClawPlugins", () => {

722741

});

723742

writePluginEntry(path.join(globalExt, "src", "one.ts"));

724743

writePluginEntry(path.join(globalExt, "src", "two.ts"));

744+

writePluginEntry(path.join(globalExt, "dist", "one.js"));

745+

writePluginEntry(path.join(globalExt, "dist", "two.js"));

725746726747

const { candidates } = await discoverWithStateDir(stateDir, {});

727748

expectCandidateIds(candidates, { includes: ["pack/one", "pack/two"] });

728749

});

729750751+

it("rejects source-only TypeScript entries for installed package plugins", async () => {

752+

const stateDir = makeTempDir();

753+

const pluginDir = path.join(stateDir, "extensions", "source-only-pack");

754+

mkdirSafe(path.join(pluginDir, "src"));

755+756+

writePluginPackageManifest({

757+

packageDir: pluginDir,

758+

packageName: "@openclaw/source-only-pack",

759+

extensions: ["./src/index.ts"],

760+

});

761+

writePluginEntry(path.join(pluginDir, "src", "index.ts"));

762+763+

const result = await discoverWithStateDir(stateDir, {});

764+765+

expectCandidatePresence(result, { absent: ["source-only-pack"] });

766+

expect(

767+

result.diagnostics.some(

768+

(entry) =>

769+

entry.level === "error" &&

770+

entry.message.includes("requires compiled runtime output") &&

771+

entry.message.includes("./dist/index.js"),

772+

),

773+

).toBe(true);

774+

});

775+730776

it("reuses one filesystem realpath lookup per package root within a discovery run", () => {

731777

const stateDir = makeTempDir();

732778

const packageDir = path.join(stateDir, "extensions", "pack");

733779

mkdirSafe(path.join(packageDir, "src"));

780+

mkdirSafe(path.join(packageDir, "dist"));

734781735782

writePluginPackageManifest({

736783

packageDir,

@@ -739,6 +786,8 @@ describe("discoverOpenClawPlugins", () => {

739786

});

740787

writePluginEntry(path.join(packageDir, "src", "one.ts"));

741788

writePluginEntry(path.join(packageDir, "src", "two.ts"));

789+

writePluginEntry(path.join(packageDir, "dist", "one.js"));

790+

writePluginEntry(path.join(packageDir, "dist", "two.js"));

742791743792

const realpathSync = vi.spyOn(fs, "realpathSync");

744793

const { candidates } = discoverOpenClawPlugins({

@@ -1049,6 +1098,7 @@ describe("discoverOpenClawPlugins", () => {

10491098

"diffs",

10501099

);

10511100

mkdirSafe(path.join(pluginDir, "src"));

1101+

mkdirSafe(path.join(pluginDir, "dist"));

10521102

mkdirSafe(nestedDiffsDir);

1053110310541104

writePluginPackageManifest({

@@ -1062,6 +1112,11 @@ describe("discoverOpenClawPlugins", () => {

10621112

"export default function () {}",

10631113

"utf-8",

10641114

);

1115+

fs.writeFileSync(

1116+

path.join(pluginDir, "dist", "index.js"),

1117+

"export default function () {}",

1118+

"utf-8",

1119+

);

1065112010661121

writePluginPackageManifest({

10671122

packageDir: path.join(pluginDir, "node_modules", "openclaw"),

@@ -1322,8 +1377,8 @@ describe("discoverOpenClawPlugins", () => {

13221377

},

13231378

},

13241379

{

1325-

name: "skips missing package extension entries without escape diagnostics",

1326-

expectedDiagnostic: "none" as const,

1380+

name: "rejects missing TypeScript package runtime entries without escape diagnostics",

1381+

expectedDiagnostic: "runtime" as const,

13271382

setup: (stateDir: string) => {

13281383

const globalExt = path.join(stateDir, "extensions", "missing-entry-pack");

13291384

mkdirSafe(globalExt);