























@@ -5,7 +5,10 @@ import type { OpenClawConfig } from "../config/types.openclaw.js";
55import { createSubsystemLogger } from "../logging/subsystem.js";
66import { planManifestModelCatalogRows } from "../model-catalog/manifest-planner.js";
77import { getCurrentPluginMetadataSnapshot } from "../plugins/current-plugin-metadata-snapshot.js";
8-import { isManifestPluginAvailableForControlPlane } from "../plugins/manifest-contract-eligibility.js";
8+import {
9+isManifestPluginAvailableForControlPlane,
10+loadManifestMetadataSnapshot,
11+} from "../plugins/manifest-contract-eligibility.js";
912import { loadPluginMetadataSnapshot } from "../plugins/plugin-metadata-snapshot.js";
1013import { augmentModelCatalogWithProviderPlugins } from "../plugins/provider-runtime.runtime.js";
1114import { createLazyImportLoader } from "../shared/lazy-promise.js";
@@ -16,7 +19,10 @@ import {
1619import { resolveDefaultAgentDir } from "./agent-scope.js";
1720import { modelSupportsInput as modelCatalogEntrySupportsInput } from "./model-catalog-lookup.js";
1821import type { ModelCatalogEntry, ModelInputType } from "./model-catalog.types.js";
19-import { normalizeConfiguredProviderCatalogModelId } from "./model-ref-shared.js";
22+import {
23+normalizeConfiguredProviderCatalogModelId,
24+type ProviderModelIdNormalizationOptions,
25+} from "./model-ref-shared.js";
2026import { buildConfiguredModelCatalog } from "./model-selection-shared.js";
2127import { ensureOpenClawModelsJson } from "./models-config.js";
2228import { normalizeProviderId } from "./provider-id.js";
@@ -196,6 +202,9 @@ function normalizePersistedModelCatalogEntry(
196202contextWindow?: number;
197203contextTokens?: number;
198204},
205+options: {
206+manifestPlugins?: ProviderModelIdNormalizationOptions["manifestPlugins"];
207+} = {},
199208): ModelCatalogEntry | undefined {
200209const rawId = normalizeOptionalString(entry.id) ?? "";
201210if (!rawId) {
@@ -205,7 +214,7 @@ function normalizePersistedModelCatalogEntry(
205214if (!provider) {
206215return undefined;
207216}
208-const id = normalizeConfiguredProviderCatalogModelId(provider, rawId);
217+const id = normalizeConfiguredProviderCatalogModelId(provider, rawId, options);
209218const name = normalizeOptionalString(entry.name ?? id) || id;
210219const contextWindow =
211220typeof entry?.contextWindow === "number" && entry.contextWindow > 0
@@ -252,6 +261,14 @@ async function loadReadOnlyPersistedModelCatalog(params?: {
252261const models: ModelCatalogEntry[] = [];
253262const { buildShouldSuppressBuiltInModel } = await loadModelSuppression();
254263const shouldSuppressBuiltInModel = buildShouldSuppressBuiltInModel({ config: cfg });
264+let manifestPlugins: ProviderModelIdNormalizationOptions["manifestPlugins"];
265+const getManifestPlugins = () => {
266+manifestPlugins ??= loadManifestMetadataSnapshot({
267+config: cfg,
268+env: process.env,
269+}).plugins;
270+return manifestPlugins;
271+};
255272const providers =
256273parsed?.providers && typeof parsed.providers === "object"
257274 ? (parsed.providers as Record<string, Record<string, unknown>>)
@@ -269,10 +286,15 @@ async function loadReadOnlyPersistedModelCatalog(params?: {
269286 ? providerConfig.contextTokens
270287 : undefined;
271288for (const entry of providerConfig.models as Record<string, unknown>[]) {
272-const normalized = normalizePersistedModelCatalogEntry(providerRaw, entry, {
273-contextWindow: providerContextWindow,
274-contextTokens: providerContextTokens,
275-});
289+const normalized = normalizePersistedModelCatalogEntry(
290+providerRaw,
291+entry,
292+{
293+contextWindow: providerContextWindow,
294+contextTokens: providerContextTokens,
295+},
296+{ manifestPlugins: getManifestPlugins() },
297+);
276298if (normalized && !shouldSuppressBuiltInModel(normalized)) {
277299models.push(normalized);
278300}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。