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

推荐订阅源

MongoDB | Blog
MongoDB | Blog
大猫的无限游戏
大猫的无限游戏
H
Help Net Security
V
Visual Studio Blog
G
Google Developers Blog
Blog — PlanetScale
Blog — PlanetScale
Last Week in AI
Last Week in AI
C
Check Point Blog
D
Docker
M
MIT News - Artificial intelligence
P
Proofpoint News Feed
博客园 - 叶小钗
博客园 - 聂微东
The Cloudflare Blog
云风的 BLOG
云风的 BLOG
Martin Fowler
Martin Fowler
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
酷 壳 – CoolShell
酷 壳 – CoolShell
MyScale Blog
MyScale Blog
WordPress大学
WordPress大学
Engineering at Meta
Engineering at Meta
腾讯CDC
S
SegmentFault 最新的问题
博客园 - 【当耐特】

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(plugins): reuse workspace metadata for session model ...
rolandrschee · 2026-05-03 · via Recent Commits to openclaw:main

@@ -1,6 +1,7 @@

11

import { resolveAgentModelPrimaryValue } from "../config/model-input.js";

22

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

33

import { createSubsystemLogger } from "../logging/subsystem.js";

4+

import type { PluginManifestRecord } from "../plugins/manifest-registry.js";

45

import {

56

normalizeLowercaseStringOrEmpty,

67

normalizeOptionalString,

@@ -35,6 +36,10 @@ export type ModelAliasIndex = {

3536

byKey: Map<string, string[]>;

3637

};

373839+

type ManifestNormalizationContext = {

40+

manifestPlugins?: readonly Pick<PluginManifestRecord, "modelIdNormalization">[];

41+

};

42+3843

function sanitizeModelWarningValue(value: string): string {

3944

const stripped = value ? stripAnsi(value) : "";

4045

let controlBoundary = -1;

@@ -179,12 +184,14 @@ function isConcreteOpenRouterFreeModelRef(ref: ModelRef): boolean {

179184

return ref.provider === "openrouter" && ref.model.includes("/") && ref.model.endsWith(":free");

180185

}

181186182-

function resolveConfiguredOpenRouterCompatFreeRef(params: {

183-

cfg: OpenClawConfig;

184-

defaultProvider: string;

185-

allowManifestNormalization?: boolean;

186-

allowPluginNormalization?: boolean;

187-

}): ModelRef | null {

187+

function resolveConfiguredOpenRouterCompatFreeRef(

188+

params: {

189+

cfg: OpenClawConfig;

190+

defaultProvider: string;

191+

allowManifestNormalization?: boolean;

192+

allowPluginNormalization?: boolean;

193+

} & ManifestNormalizationContext,

194+

): ModelRef | null {

188195

const configuredModels = params.cfg.agents?.defaults?.models ?? {};

189196

for (const raw of Object.keys(configuredModels)) {

190197

if (!raw.includes("/")) {

@@ -193,6 +200,7 @@ function resolveConfiguredOpenRouterCompatFreeRef(params: {

193200

const parsed = parseModelRef(raw, params.defaultProvider, {

194201

allowManifestNormalization: params.allowManifestNormalization,

195202

allowPluginNormalization: params.allowPluginNormalization,

203+

manifestPlugins: params.manifestPlugins,

196204

});

197205

if (parsed && isConcreteOpenRouterFreeModelRef(parsed)) {

198206

return parsed;

@@ -211,24 +219,28 @@ function resolveConfiguredOpenRouterCompatFreeRef(params: {

211219

return normalizeModelRef("openrouter", modelId, {

212220

allowManifestNormalization: params.allowManifestNormalization,

213221

allowPluginNormalization: params.allowPluginNormalization,

222+

manifestPlugins: params.manifestPlugins,

214223

});

215224

}

216225217226

return null;

218227

}

219228220-

export function resolveConfiguredOpenRouterCompatAlias(params: {

221-

cfg?: OpenClawConfig;

222-

raw: string;

223-

defaultProvider: string;

224-

allowManifestNormalization?: boolean;

225-

allowPluginNormalization?: boolean;

226-

}): ModelRef | null {

229+

export function resolveConfiguredOpenRouterCompatAlias(

230+

params: {

231+

cfg?: OpenClawConfig;

232+

raw: string;

233+

defaultProvider: string;

234+

allowManifestNormalization?: boolean;

235+

allowPluginNormalization?: boolean;

236+

} & ManifestNormalizationContext,

237+

): ModelRef | null {

227238

const normalized = normalizeLowercaseStringOrEmpty(params.raw);

228239

if (normalized === "openrouter:auto") {

229240

return normalizeModelRef("openrouter", "auto", {

230241

allowManifestNormalization: params.allowManifestNormalization,

231242

allowPluginNormalization: params.allowPluginNormalization,

243+

manifestPlugins: params.manifestPlugins,

232244

});

233245

}

234246

if (normalized !== OPENROUTER_COMPAT_FREE_ALIAS || !params.cfg) {

@@ -239,32 +251,38 @@ export function resolveConfiguredOpenRouterCompatAlias(params: {

239251

defaultProvider: params.defaultProvider,

240252

allowManifestNormalization: params.allowManifestNormalization,

241253

allowPluginNormalization: params.allowPluginNormalization,

254+

manifestPlugins: params.manifestPlugins,

242255

});

243256

}

244257245-

function parseModelRefWithCompatAlias(params: {

246-

cfg?: OpenClawConfig;

247-

raw: string;

248-

defaultProvider: string;

249-

allowManifestNormalization?: boolean;

250-

allowPluginNormalization?: boolean;

251-

}): ModelRef | null {

258+

function parseModelRefWithCompatAlias(

259+

params: {

260+

cfg?: OpenClawConfig;

261+

raw: string;

262+

defaultProvider: string;

263+

allowManifestNormalization?: boolean;

264+

allowPluginNormalization?: boolean;

265+

} & ManifestNormalizationContext,

266+

): ModelRef | null {

252267

return (

253268

resolveConfiguredOpenRouterCompatAlias(params) ??

254269

resolveExactConfiguredProviderRef(params) ??

255270

parseModelRef(params.raw, params.defaultProvider, {

256271

allowManifestNormalization: params.allowManifestNormalization,

257272

allowPluginNormalization: params.allowPluginNormalization,

273+

manifestPlugins: params.manifestPlugins,

258274

})

259275

);

260276

}

261277262-

function resolveExactConfiguredProviderRef(params: {

263-

cfg?: OpenClawConfig;

264-

raw: string;

265-

allowManifestNormalization?: boolean;

266-

allowPluginNormalization?: boolean;

267-

}): ModelRef | null {

278+

function resolveExactConfiguredProviderRef(

279+

params: {

280+

cfg?: OpenClawConfig;

281+

raw: string;

282+

allowManifestNormalization?: boolean;

283+

allowPluginNormalization?: boolean;

284+

} & ManifestNormalizationContext,

285+

): ModelRef | null {

268286

const slash = params.raw.indexOf("/");

269287

if (slash <= 0 || !params.cfg?.models?.providers) {

270288

return null;

@@ -293,6 +311,7 @@ function resolveExactConfiguredProviderRef(params: {

293311

provider,

294312

model: normalizeStaticProviderModelId(provider, modelRaw.trim(), {

295313

allowManifestNormalization: params.allowManifestNormalization,

314+

manifestPlugins: params.manifestPlugins,

296315

}),

297316

};

298317

}

@@ -336,12 +355,14 @@ export function buildConfiguredAllowlistKeys(params: {

336355

return keys.size > 0 ? keys : null;

337356

}

338357339-

export function buildModelAliasIndex(params: {

340-

cfg: OpenClawConfig;

341-

defaultProvider: string;

342-

allowManifestNormalization?: boolean;

343-

allowPluginNormalization?: boolean;

344-

}): ModelAliasIndex {

358+

export function buildModelAliasIndex(

359+

params: {

360+

cfg: OpenClawConfig;

361+

defaultProvider: string;

362+

allowManifestNormalization?: boolean;

363+

allowPluginNormalization?: boolean;

364+

} & ManifestNormalizationContext,

365+

): ModelAliasIndex {

345366

const byAlias = new Map<string, { alias: string; ref: ModelRef }>();

346367

const byKey = new Map<string, string[]>();

347368

@@ -353,6 +374,7 @@ export function buildModelAliasIndex(params: {

353374

defaultProvider: params.defaultProvider,

354375

allowManifestNormalization: params.allowManifestNormalization,

355376

allowPluginNormalization: params.allowPluginNormalization,

377+

manifestPlugins: params.manifestPlugins,

356378

});

357379

if (!parsed) {

358380

continue;

@@ -459,14 +481,16 @@ function buildSyntheticAllowedCatalogEntry(params: {

459481

};

460482

}

461483462-

export function resolveModelRefFromString(params: {

463-

cfg?: OpenClawConfig;

464-

raw: string;

465-

defaultProvider: string;

466-

aliasIndex?: ModelAliasIndex;

467-

allowManifestNormalization?: boolean;

468-

allowPluginNormalization?: boolean;

469-

}): { ref: ModelRef; alias?: string } | null {

484+

export function resolveModelRefFromString(

485+

params: {

486+

cfg?: OpenClawConfig;

487+

raw: string;

488+

defaultProvider: string;

489+

aliasIndex?: ModelAliasIndex;

490+

allowManifestNormalization?: boolean;

491+

allowPluginNormalization?: boolean;

492+

} & ManifestNormalizationContext,

493+

): { ref: ModelRef; alias?: string } | null {

470494

const { model } = splitTrailingAuthProfile(params.raw);

471495

if (!model) {

472496

return null;

@@ -482,6 +506,7 @@ export function resolveModelRefFromString(params: {

482506

defaultProvider: params.defaultProvider,

483507

allowManifestNormalization: params.allowManifestNormalization,

484508

allowPluginNormalization: params.allowPluginNormalization,

509+

manifestPlugins: params.manifestPlugins,

485510

});

486511

if (!parsed) {

487512

return null;