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

推荐订阅源

S
SegmentFault 最新的问题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
B
Blog RSS Feed
Y
Y Combinator Blog
T
Tailwind CSS Blog
博客园 - 三生石上(FineUI控件)
J
Java Code Geeks
Stack Overflow Blog
Stack Overflow Blog
aimingoo的专栏
aimingoo的专栏
Jina AI
Jina AI
The GitHub Blog
The GitHub Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
A
About on SuperTechFans
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
Docker
酷 壳 – CoolShell
酷 壳 – CoolShell
C
Check Point Blog
M
MIT News - Artificial intelligence
Last Week in AI
Last Week in AI
V
V2EX
腾讯CDC
F
Fortinet All Blogs
博客园 - 叶小钗
T
The Blog of Author Tim Ferriss

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: reuse plugin manifests for model pricing refresh · o...
shakkernerd · 2026-04-27 · via Recent Commits to openclaw:main

@@ -12,14 +12,18 @@ import type { ModelDefinitionConfig } from "../config/types.models.js";

1212

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

1313

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

1414

import { planManifestModelCatalogRows, type ModelCatalogCost } from "../model-catalog/index.js";

15+

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

16+

import { loadPluginManifestRegistryForInstalledIndex } from "../plugins/manifest-registry-installed.js";

17+

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

1518

import type {

1619

PluginManifestModelPricingModelIdTransform,

1720

PluginManifestModelPricingProvider,

1821

PluginManifestModelPricingSource,

1922

} from "../plugins/manifest.js";

23+

import type { PluginLookUpTable } from "../plugins/plugin-lookup-table.js";

2024

import {

21-

loadPluginManifestRegistryForPluginRegistry,

22-

resolveManifestContractPluginIds,

25+

loadPluginRegistrySnapshot,

26+

type PluginRegistrySnapshot,

2327

} from "../plugins/plugin-registry.js";

2428

import { normalizeProviderModelIdWithPlugin } from "../plugins/provider-runtime.js";

2529

import { normalizeOptionalString, resolvePrimaryStringValue } from "../shared/string-coerce.js";

@@ -39,6 +43,11 @@ type OpenRouterPricingEntry = {

39434044

type ModelListLike = string | { primary?: string; fallbacks?: string[] } | undefined;

414546+

type ModelPricingManifestMetadata = {

47+

allRegistry: PluginManifestRegistry;

48+

activeRegistry: PluginManifestRegistry;

49+

};

50+4251

type OpenRouterModelPayload = {

4352

id?: unknown;

4453

pricing?: unknown;

@@ -361,11 +370,60 @@ function normalizeExternalPricingPolicy(

361370

};

362371

}

363372364-

function loadManifestPricingContext(config: OpenClawConfig): {

373+

function filterActiveManifestRegistry(params: {

374+

registry: PluginManifestRegistry;

375+

index: PluginRegistrySnapshot;

376+

config: OpenClawConfig;

377+

}): PluginManifestRegistry {

378+

return {

379+

diagnostics: params.registry.diagnostics,

380+

plugins: params.registry.plugins.filter((plugin) =>

381+

isInstalledPluginEnabled(params.index, plugin.id, params.config),

382+

),

383+

};

384+

}

385+386+

function resolveModelPricingManifestMetadata(params: {

387+

config: OpenClawConfig;

388+

pluginLookUpTable?: Pick<PluginLookUpTable, "index" | "manifestRegistry">;

389+

manifestRegistry?: PluginManifestRegistry;

390+

}): ModelPricingManifestMetadata {

391+

if (params.pluginLookUpTable) {

392+

return {

393+

allRegistry: params.pluginLookUpTable.manifestRegistry,

394+

activeRegistry: filterActiveManifestRegistry({

395+

registry: params.pluginLookUpTable.manifestRegistry,

396+

index: params.pluginLookUpTable.index,

397+

config: params.config,

398+

}),

399+

};

400+

}

401+

if (params.manifestRegistry) {

402+

return {

403+

allRegistry: params.manifestRegistry,

404+

activeRegistry: params.manifestRegistry,

405+

};

406+

}

407+

const index = loadPluginRegistrySnapshot({ config: params.config });

408+

const allRegistry = loadPluginManifestRegistryForInstalledIndex({

409+

index,

410+

config: params.config,

411+

includeDisabled: true,

412+

});

413+

return {

414+

allRegistry,

415+

activeRegistry: filterActiveManifestRegistry({

416+

registry: allRegistry,

417+

index,

418+

config: params.config,

419+

}),

420+

};

421+

}

422+423+

function loadManifestPricingContext(registry: PluginManifestRegistry): {

365424

policies: Map<string, ExternalPricingPolicy>;

366425

catalogPricing: Map<string, CachedModelPricing>;

367426

} {

368-

const registry = loadPluginManifestRegistryForPluginRegistry({ config });

369427

const policies = new Map<string, ExternalPricingPolicy>();

370428

for (const plugin of registry.plugins) {

371429

for (const [provider, rawPolicy] of Object.entries(plugin.modelPricing?.providers ?? {})) {

@@ -549,11 +607,12 @@ function addConfiguredWebSearchPluginModels(params: {

549607

config: OpenClawConfig;

550608

aliasIndex: ReturnType<typeof buildModelAliasIndex>;

551609

refs: Map<string, ModelRef>;

610+

manifestRegistry: PluginManifestRegistry;

552611

}): void {

553-

for (const pluginId of resolveManifestContractPluginIds({

554-

contract: "webSearchProviders",

555-

config: params.config,

556-

})) {

612+

for (const pluginId of params.manifestRegistry.plugins

613+

.filter((plugin) => (plugin.contracts?.webSearchProviders ?? []).length > 0)

614+

.map((plugin) => plugin.id)

615+

.toSorted((left, right) => left.localeCompare(right))) {

557616

addResolvedModelRef({

558617

raw: resolvePluginWebSearchConfig(params.config, pluginId)?.model as string | undefined,

559618

aliasIndex: params.aliasIndex,

@@ -659,7 +718,12 @@ function filterExternalPricingRefs(params: {

659718

);

660719

}

661720662-

export function collectConfiguredModelPricingRefs(config: OpenClawConfig): ModelRef[] {

721+

export function collectConfiguredModelPricingRefs(

722+

config: OpenClawConfig,

723+

options: { manifestRegistry?: PluginManifestRegistry } = {},

724+

): ModelRef[] {

725+

const manifestRegistry =

726+

options.manifestRegistry ?? resolveModelPricingManifestMetadata({ config }).allRegistry;

663727

const refs = new Map<string, ModelRef>();

664728

const aliasIndex = buildModelAliasIndex({

665729

cfg: config,

@@ -698,7 +762,7 @@ export function collectConfiguredModelPricingRefs(config: OpenClawConfig): Model

698762

}

699763

}

700764701-

addConfiguredWebSearchPluginModels({ config, aliasIndex, refs });

765+

addConfiguredWebSearchPluginModels({ config, aliasIndex, refs, manifestRegistry });

702766703767

for (const entry of config.tools?.media?.models ?? []) {

704768

addProviderModelPair({ provider: entry.provider, model: entry.model, refs });

@@ -823,14 +887,23 @@ function collectSeededPricing(params: {

823887

export async function refreshGatewayModelPricingCache(params: {

824888

config: OpenClawConfig;

825889

fetchImpl?: typeof fetch;

890+

pluginLookUpTable?: Pick<PluginLookUpTable, "index" | "manifestRegistry">;

891+

manifestRegistry?: PluginManifestRegistry;

826892

}): Promise<void> {

827893

if (inFlightRefresh) {

828894

return await inFlightRefresh;

829895

}

830896

const fetchImpl = params.fetchImpl ?? fetch;

831897

inFlightRefresh = (async () => {

832-

const pricingContext = loadManifestPricingContext(params.config);

833-

const allRefs = collectConfiguredModelPricingRefs(params.config);

898+

const manifestMetadata = resolveModelPricingManifestMetadata({

899+

config: params.config,

900+

pluginLookUpTable: params.pluginLookUpTable,

901+

manifestRegistry: params.manifestRegistry,

902+

});

903+

const pricingContext = loadManifestPricingContext(manifestMetadata.activeRegistry);

904+

const allRefs = collectConfiguredModelPricingRefs(params.config, {

905+

manifestRegistry: manifestMetadata.allRegistry,

906+

});

834907

const seededPricing = collectSeededPricing({

835908

config: params.config,

836909

refs: allRefs,

@@ -950,6 +1023,8 @@ export async function refreshGatewayModelPricingCache(params: {

9501023

export function startGatewayModelPricingRefresh(params: {

9511024

config: OpenClawConfig;

9521025

fetchImpl?: typeof fetch;

1026+

pluginLookUpTable?: Pick<PluginLookUpTable, "index" | "manifestRegistry">;

1027+

manifestRegistry?: PluginManifestRegistry;

9531028

}): () => void {

9541029

let stopped = false;

9551030

queueMicrotask(() => {