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

推荐订阅源

月光博客
月光博客
小众软件
小众软件
爱范儿
爱范儿
Y
Y Combinator Blog
博客园 - Franky
美团技术团队
博客园 - 【当耐特】
The Cloudflare Blog
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
Jina AI
Jina AI
IT之家
IT之家
人人都是产品经理
人人都是产品经理
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
大猫的无限游戏
大猫的无限游戏
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 聂微东
WordPress大学
WordPress大学
V
Visual Studio Blog
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
有赞技术团队
有赞技术团队

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: preserve disabled plugin registry migration · opencl...
shakkernerd · 2026-04-26 · via Recent Commits to openclaw:main

@@ -1,4 +1,5 @@

11

import fs from "node:fs";

2+

import { normalizeProviderId } from "../../../agents/provider-id.js";

23

import type { OpenClawConfig } from "../../../config/types.openclaw.js";

34

import {

45

loadPluginInstallRecords,

@@ -13,9 +14,9 @@ import {

1314

type InstalledPluginIndexStoreOptions,

1415

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

1516

import {

16-

listEnabledInstalledPluginRecords,

1717

loadInstalledPluginIndex,

1818

type InstalledPluginIndex,

19+

type InstalledPluginIndexRecord,

1920

type LoadInstalledPluginIndexParams,

2021

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

2122

@@ -111,6 +112,134 @@ async function readMigrationConfig(

111112

return await configModule.readBestEffortConfig();

112113

}

113114115+

function normalizeRegistryReference(value: unknown): string | undefined {

116+

if (typeof value !== "string") {

117+

return undefined;

118+

}

119+

const trimmed = value.trim();

120+

return trimmed ? trimmed.toLowerCase() : undefined;

121+

}

122+123+

function createMigrationPluginIdNormalizer(

124+

index: InstalledPluginIndex,

125+

): (pluginId: string) => string {

126+

const aliases = new Map<string, string>();

127+

for (const plugin of index.plugins) {

128+

const pluginId = normalizeRegistryReference(plugin.pluginId);

129+

if (!pluginId) {

130+

continue;

131+

}

132+

aliases.set(pluginId, plugin.pluginId);

133+

for (const alias of [

134+

...plugin.contributions.providers,

135+

...plugin.contributions.channels,

136+

...plugin.contributions.setupProviders,

137+

...plugin.contributions.cliBackends,

138+

...plugin.contributions.modelCatalogProviders,

139+

]) {

140+

const normalizedAlias = normalizeRegistryReference(alias);

141+

if (normalizedAlias && !aliases.has(normalizedAlias)) {

142+

aliases.set(normalizedAlias, plugin.pluginId);

143+

}

144+

}

145+

}

146+

return (pluginId: string) => {

147+

const normalized = normalizeRegistryReference(pluginId);

148+

return normalized ? (aliases.get(normalized) ?? pluginId.trim()) : pluginId.trim();

149+

};

150+

}

151+152+

function addPluginReference(

153+

references: Set<string>,

154+

normalizePluginId: (pluginId: string) => string,

155+

value: unknown,

156+

): void {

157+

if (typeof value !== "string") {

158+

return;

159+

}

160+

const normalized = normalizePluginId(value);

161+

if (normalized) {

162+

references.add(normalized);

163+

}

164+

}

165+166+

function listConfiguredChannelIds(config: OpenClawConfig): Set<string> {

167+

const channels = config.channels;

168+

if (!channels || typeof channels !== "object" || Array.isArray(channels)) {

169+

return new Set();

170+

}

171+

return new Set(

172+

Object.keys(channels)

173+

.map((channelId) => normalizeRegistryReference(channelId))

174+

.filter((channelId): channelId is string => Boolean(channelId)),

175+

);

176+

}

177+178+

function listConfiguredModelProviderIds(config: OpenClawConfig): Set<string> {

179+

const providers = config.models?.providers;

180+

if (!providers || typeof providers !== "object" || Array.isArray(providers)) {

181+

return new Set();

182+

}

183+

return new Set(

184+

Object.keys(providers)

185+

.map((providerId) => normalizeProviderId(providerId))

186+

.filter(Boolean),

187+

);

188+

}

189+190+

export function listMigrationRelevantPluginRecords(params: {

191+

index: InstalledPluginIndex;

192+

config: OpenClawConfig;

193+

installRecords: Record<string, unknown>;

194+

}): readonly InstalledPluginIndexRecord[] {

195+

const normalizePluginId = createMigrationPluginIdNormalizer(params.index);

196+

const referencedPluginIds = new Set<string>();

197+

const installedPluginIds = new Set<string>();

198+199+

for (const pluginId of Object.keys(params.installRecords)) {

200+

addPluginReference(installedPluginIds, normalizePluginId, pluginId);

201+

}

202+203+

const plugins = params.config.plugins;

204+

for (const pluginId of plugins?.allow ?? []) {

205+

addPluginReference(referencedPluginIds, normalizePluginId, pluginId);

206+

}

207+

for (const pluginId of plugins?.deny ?? []) {

208+

addPluginReference(referencedPluginIds, normalizePluginId, pluginId);

209+

}

210+

for (const pluginId of Object.keys(plugins?.entries ?? {})) {

211+

addPluginReference(referencedPluginIds, normalizePluginId, pluginId);

212+

}

213+

for (const pluginId of Object.values(plugins?.slots ?? {})) {

214+

if (normalizeRegistryReference(pluginId) === "none") {

215+

continue;

216+

}

217+

addPluginReference(referencedPluginIds, normalizePluginId, pluginId);

218+

}

219+220+

const configuredChannelIds = listConfiguredChannelIds(params.config);

221+

const configuredModelProviderIds = listConfiguredModelProviderIds(params.config);

222+223+

return params.index.plugins.filter((plugin) => {

224+

if (plugin.origin !== "bundled") {

225+

return true;

226+

}

227+

if (installedPluginIds.has(plugin.pluginId) || referencedPluginIds.has(plugin.pluginId)) {

228+

return true;

229+

}

230+

if (

231+

plugin.contributions.channels.some((channelId) =>

232+

configuredChannelIds.has(normalizeRegistryReference(channelId) ?? ""),

233+

)

234+

) {

235+

return true;

236+

}

237+

return plugin.contributions.providers.some((providerId) =>

238+

configuredModelProviderIds.has(normalizeProviderId(providerId)),

239+

);

240+

});

241+

}

242+114243

export async function migratePluginRegistryForInstall(

115244

params: PluginRegistryInstallMigrationParams = {},

116245

): Promise<PluginRegistryInstallMigrationResult> {

@@ -139,7 +268,11 @@ export async function migratePluginRegistryForInstall(

139268

const current: InstalledPluginIndex = {

140269

...candidateIndex,

141270

refreshReason: "migration",

142-

plugins: listEnabledInstalledPluginRecords(candidateIndex, config),

271+

plugins: listMigrationRelevantPluginRecords({

272+

index: candidateIndex,

273+

config,

274+

installRecords,

275+

}),

143276

};

144277

if (Object.keys(installRecords).length > 0) {

145278

await writePersistedPluginInstallLedger(installRecords, params);