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

推荐订阅源

Y
Y Combinator Blog
The GitHub Blog
The GitHub Blog
Vercel News
Vercel News
D
DataBreaches.Net
MongoDB | Blog
MongoDB | Blog
H
Help Net Security
小众软件
小众软件
美团技术团队
T
The Blog of Author Tim Ferriss
爱范儿
爱范儿
D
Docker
Martin Fowler
Martin Fowler
大猫的无限游戏
大猫的无限游戏
博客园 - 聂微东
Blog — PlanetScale
Blog — PlanetScale
H
Hackread – Cybersecurity News, Data Breaches, AI and More
罗磊的独立博客
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
S
SegmentFault 最新的问题
云风的 BLOG
云风的 BLOG
B
Blog
雷峰网
雷峰网
The Cloudflare Blog

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: discover symlinked plugin directories · openclaw/ope...
steipete · 2026-04-27 · via Recent Commits to openclaw:main

@@ -18,13 +18,17 @@ function makeTempDir() {

18181919

const mkdirSafe = mkdirSafeDir;

202021+

function symlinkDirectory(target: string, linkPath: string): void {

22+

fs.symlinkSync(target, linkPath, process.platform === "win32" ? "junction" : "dir");

23+

}

24+2125

const canCreateDirectorySymlinks = (() => {

2226

const probeDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-symlink-probe-"));

2327

const targetDir = path.join(probeDir, "target");

2428

const linkDir = path.join(probeDir, "link");

2529

try {

2630

fs.mkdirSync(targetDir);

27-

fs.symlinkSync(targetDir, linkDir, process.platform === "win32" ? "junction" : "dir");

31+

symlinkDirectory(targetDir, linkDir);

2832

return true;

2933

} catch {

3034

return false;

@@ -318,6 +322,72 @@ describe("discoverOpenClawPlugins", () => {

318322

expectCandidateIds(candidates, { includes: ["alpha", "beta"] });

319323

});

320324325+

it.skipIf(!canCreateDirectorySymlinks)(

326+

"discovers symlinked plugin directories in global roots",

327+

async () => {

328+

const stateDir = makeTempDir();

329+

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

330+

mkdirSafe(globalExt);

331+332+

const linkedPluginDir = path.join(stateDir, "linked-plugin-src");

333+

createPackagePluginWithEntry({

334+

packageDir: linkedPluginDir,

335+

packageName: "@openclaw/linked-plugin",

336+

pluginId: "linked-plugin",

337+

});

338+339+

symlinkDirectory(linkedPluginDir, path.join(globalExt, "linked-plugin"));

340+341+

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

342+

expectCandidateIds(candidates, { includes: ["linked-plugin"] });

343+

expect(findCandidateById(candidates, "linked-plugin")?.rootDir).toBe(

344+

fs.realpathSync(linkedPluginDir),

345+

);

346+

expect(diagnostics).toEqual([]);

347+

},

348+

);

349+350+

it.skipIf(!canCreateDirectorySymlinks)(

351+

"discovers symlinked plugin directories in workspace roots",

352+

async () => {

353+

const stateDir = makeTempDir();

354+

const workspaceDir = path.join(stateDir, "workspace");

355+

const workspaceExt = path.join(workspaceDir, ".openclaw", "extensions");

356+

mkdirSafe(workspaceExt);

357+358+

const linkedPluginDir = path.join(stateDir, "workspace-linked-plugin-src");

359+

createPackagePluginWithEntry({

360+

packageDir: linkedPluginDir,

361+

packageName: "@openclaw/workspace-linked-plugin",

362+

pluginId: "workspace-linked-plugin",

363+

});

364+365+

symlinkDirectory(linkedPluginDir, path.join(workspaceExt, "workspace-linked-plugin"));

366+367+

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

368+

expectCandidateIds(candidates, { includes: ["workspace-linked-plugin"] });

369+

expect(findCandidateById(candidates, "workspace-linked-plugin")?.rootDir).toBe(

370+

fs.realpathSync(linkedPluginDir),

371+

);

372+

expect(diagnostics).toEqual([]);

373+

},

374+

);

375+376+

it.skipIf(process.platform === "win32" || !canCreateDirectorySymlinks)(

377+

"ignores broken symlinked plugin directories in scanned roots",

378+

async () => {

379+

const stateDir = makeTempDir();

380+

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

381+

mkdirSafe(globalExt);

382+383+

symlinkDirectory(path.join(stateDir, "missing-plugin-src"), path.join(globalExt, "missing"));

384+385+

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

386+

expectCandidateIds(candidates, { excludes: ["missing"] });

387+

expect(diagnostics).toEqual([]);

388+

},

389+

);

390+321391

it("does not recurse arbitrary workspace directories for plugin auto-discovery", () => {

322392

const stateDir = makeTempDir();

323393

const workspaceDir = path.join(stateDir, "workspace");

@@ -631,11 +701,7 @@ describe("discoverOpenClawPlugins", () => {

631701

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

632702633703

const linkedPackageDir = path.join(stateDir, "linked-pack");

634-

fs.symlinkSync(

635-

realPackageDir,

636-

linkedPackageDir,

637-

process.platform === "win32" ? "junction" : "dir",

638-

);

704+

symlinkDirectory(realPackageDir, linkedPackageDir);

639705

const canonicalPackageDir = fs.realpathSync(realPackageDir);

640706641707

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

@@ -1100,7 +1166,7 @@ describe("discoverOpenClawPlugins", () => {

11001166

mkdirSafe(outsideDir);

11011167

fs.writeFileSync(path.join(outsideDir, "escape.ts"), "export default {}", "utf-8");

11021168

try {

1103-

fs.symlinkSync(outsideDir, linkedDir, process.platform === "win32" ? "junction" : "dir");

1169+

symlinkDirectory(outsideDir, linkedDir);

11041170

} catch {

11051171

return false;

11061172

}