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

推荐订阅源

Martin Fowler
Martin Fowler
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
博客园_首页
宝玉的分享
宝玉的分享
S
SegmentFault 最新的问题
Jina AI
Jina AI
Hugging Face - Blog
Hugging Face - Blog
V
Visual Studio Blog
美团技术团队
IT之家
IT之家
罗磊的独立博客
Blog — PlanetScale
Blog — PlanetScale
Google DeepMind News
Google DeepMind News
月光博客
月光博客
Microsoft Azure Blog
Microsoft Azure Blog
H
Help Net Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Last Week in AI
Last Week in AI
博客园 - 叶小钗
M
MIT News - Artificial intelligence
B
Blog RSS Feed
有赞技术团队
有赞技术团队
Y
Y Combinator 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(doctor): repair managed plugin peer links · openclaw/...
TheCrazyLex · 2026-05-12 · via Recent Commits to openclaw:main

@@ -10,6 +10,10 @@ import {

1010

type InstalledPluginIndexRecordStoreOptions,

1111

} from "../plugins/installed-plugin-index-records.js";

1212

import { loadInstalledPluginIndex } from "../plugins/installed-plugin-index.js";

13+

import {

14+

auditOpenClawPeerDependenciesInManagedNpmRoot,

15+

relinkOpenClawPeerDependenciesInManagedNpmRoot,

16+

} from "../plugins/plugin-peer-link.js";

1317

import { refreshPluginRegistry } from "../plugins/plugin-registry.js";

1418

import { note } from "../terminal/note.js";

1519

import { shortenHomePath } from "../utils.js";

@@ -35,6 +39,11 @@ type StaleManagedNpmBundledPlugin = {

3539

version?: string;

3640

};

374142+

type PluginRegistryDoctorNoteLogger = {

43+

info: (message: string) => void;

44+

warn: (message: string) => void;

45+

};

46+3847

function isRecord(value: unknown): value is Record<string, unknown> {

3948

return typeof value === "object" && value !== null && !Array.isArray(value);

4049

}

@@ -57,6 +66,12 @@ function readStringMap(value: unknown): Record<string, string> {

5766

return result;

5867

}

596869+

function resolveManagedPluginNpmRoot(params: PluginRegistryDoctorRepairParams): string {

70+

return params.stateDir

71+

? path.join(params.stateDir, "npm")

72+

: resolveDefaultPluginNpmDir(params.env);

73+

}

74+6075

function deleteObjectKey(record: Record<string, unknown>, key: string): boolean {

6176

if (!Object.prototype.hasOwnProperty.call(record, key)) {

6277

return false;

@@ -87,9 +102,7 @@ function listStaleManagedNpmBundledPlugins(

87102

const bundledByPackage = new Map(

88103

currentBundled.map((plugin) => [plugin.packageName, plugin] as const),

89104

);

90-

const npmRoot = params.stateDir

91-

? path.join(params.stateDir, "npm")

92-

: resolveDefaultPluginNpmDir(params.env);

105+

const npmRoot = resolveManagedPluginNpmRoot(params);

93106

const npmPackageJsonPath = path.join(npmRoot, "package.json");

94107

const dependencies = readStringMap(readJsonObject(npmPackageJsonPath)?.dependencies);

95108

const stale: StaleManagedNpmBundledPlugin[] = [];

@@ -228,6 +241,54 @@ export function maybeRepairStaleManagedNpmBundledPlugins(

228241

return true;

229242

}

230243244+

export async function maybeRepairManagedNpmOpenClawPeerLinks(

245+

params: PluginRegistryDoctorRepairParams,

246+

): Promise<boolean> {

247+

const npmRoot = resolveManagedPluginNpmRoot(params);

248+

if (!params.prompter.shouldRepair) {

249+

const audit = await auditOpenClawPeerDependenciesInManagedNpmRoot({ npmRoot });

250+

if (audit.broken > 0) {

251+

note(

252+

[

253+

"Managed npm OpenClaw host peer links need repair:",

254+

...audit.issues.map((issue) => `- ${issue.packageName}: ${issue.reason}`),

255+

`Repair with ${formatCliCommand("openclaw doctor --fix")} to relink managed npm plugin packages.`,

256+

].join("\n"),

257+

"Plugin registry",

258+

);

259+

}

260+

return false;

261+

}

262+263+

const messages: { level: "info" | "warn"; message: string }[] = [];

264+

const logger: PluginRegistryDoctorNoteLogger = {

265+

info: (message) => messages.push({ level: "info", message }),

266+

warn: (message) => messages.push({ level: "warn", message }),

267+

};

268+

const result = await relinkOpenClawPeerDependenciesInManagedNpmRoot({

269+

npmRoot,

270+

logger,

271+

});

272+273+

if (result.repaired > 0) {

274+

note(

275+

`Repaired OpenClaw host peer link(s) for ${result.repaired} managed npm plugin package(s).`,

276+

"Plugin registry",

277+

);

278+

}

279+

const warnings = messages

280+

.filter((message) => message.level === "warn")

281+

.map((message) => `- ${message.message}`);

282+

if (warnings.length > 0) {

283+

note(

284+

["Could not repair all managed npm OpenClaw host peer links:", ...warnings].join("\n"),

285+

"Plugin registry",

286+

);

287+

}

288+289+

return result.repaired > 0;

290+

}

291+231292

async function loadInstallRecordsWithoutPluginIds(

232293

params: PluginRegistryDoctorRepairParams,

233294

pluginIds: readonly string[],

@@ -262,6 +323,7 @@ export async function maybeRepairPluginRegistryState(

262323

(plugin) => plugin.pluginId,

263324

);

264325

const removedStaleManagedNpmBundledPlugins = maybeRepairStaleManagedNpmBundledPlugins(params);

326+

const repairedManagedNpmOpenClawPeerLinks = await maybeRepairManagedNpmOpenClawPeerLinks(params);

265327

if (!params.prompter.shouldRepair) {

266328

if (preflight.action === "migrate") {

267329

note(

@@ -288,7 +350,11 @@ export async function maybeRepairPluginRegistryState(

288350

return params.config;

289351

}

290352291-

if (preflight.action === "skip-existing" || removedStaleManagedNpmBundledPlugins) {

353+

if (

354+

preflight.action === "skip-existing" ||

355+

removedStaleManagedNpmBundledPlugins ||

356+

repairedManagedNpmOpenClawPeerLinks

357+

) {

292358

const index = await refreshPluginRegistry({

293359

...migrationParams,

294360

reason: "migration",