@@ -13,7 +13,7 @@ import {
1313import type { ProviderRuntimeModel } from "../plugins/provider-runtime-model.types.js" ;
1414import { resolveAgentEntry } from "./agent-scope-config.js" ;
1515import { buildInlineProviderModels } from "./embedded-agent-runner/model.inline-provider.js" ;
16- import { staticModelIdMatches } from "./embedded-agent-runner/model.static-id.js" ;
16+ import type { StaticModelIdMatcher } from "./embedded-agent-runner/model.static-id.js" ;
1717import type { ModelCatalogEntry } from "./model-catalog.js" ;
1818import type { AuthStorageData } from "./sessions/auth-storage.js" ;
1919
@@ -98,12 +98,13 @@ function hasConfiguredInlineProviderModel(
9898 config : OpenClawConfig ,
9999 provider : string ,
100100 modelId : string ,
101+ matchesStaticModelId : StaticModelIdMatcher ,
101102) : boolean {
102103 return Object . entries ( config . models ?. providers ?? { } ) . some (
103104 ( [ providerId , providerConfig ] ) =>
104105 normalizeProviderId ( providerId ) === provider &&
105106 ( providerConfig . models ?? [ ] ) . some ( ( model ) =>
106- staticModelIdMatches ( {
107+ matchesStaticModelId ( {
107108 candidateId : model . id ,
108109 rowProvider : providerId ,
109110 provider,
@@ -120,6 +121,7 @@ export function collectConfiguredProviderIdsNeedingStaticCatalog(params: {
120121 provider : string ;
121122 modelId : string ;
122123 } ) => ProviderRuntimeModel | undefined ;
124+ matchesStaticModelId : StaticModelIdMatcher ;
123125} ) : string [ ] {
124126 const providerIds = new Set < string > ( ) ;
125127 for ( const { value } of params . configuredModelRefs ?? collectConfiguredModelRefs ( params . config ) ) {
@@ -132,7 +134,12 @@ export function collectConfiguredProviderIdsNeedingStaticCatalog(params: {
132134 if (
133135 ! provider ||
134136 ! modelId ||
135- hasConfiguredInlineProviderModel ( params . config , provider , modelId ) ||
137+ hasConfiguredInlineProviderModel (
138+ params . config ,
139+ provider ,
140+ modelId ,
141+ params . matchesStaticModelId ,
142+ ) ||
136143 params . resolveStaticCatalogModel ( { provider, modelId } )
137144 ) {
138145 continue ;
@@ -152,6 +159,7 @@ export function prepareConfiguredRuntimeModels(params: {
152159 provider : string ;
153160 modelId : string ;
154161 } ) => ProviderRuntimeModel | undefined ;
162+ matchesStaticModelId : StaticModelIdMatcher ;
155163} ) : PreparedConfiguredRuntimeModel [ ] {
156164 const prepared : PreparedConfiguredRuntimeModel [ ] = [ ] ;
157165 const seen = new Set < string > ( ) ;
@@ -179,9 +187,10 @@ export function prepareConfiguredRuntimeModels(params: {
179187 metadataSnapshot : params . metadataSnapshot ,
180188 provider,
181189 modelId,
190+ matchesStaticModelId : params . matchesStaticModelId ,
182191 } ) ??
183192 params . providerStaticModels . find ( ( candidate ) =>
184- staticModelIdMatches ( {
193+ params . matchesStaticModelId ( {
185194 candidateId : candidate . id ,
186195 rowProvider : candidate . provider ,
187196 provider,
@@ -200,6 +209,7 @@ function findPreparedProviderStaticCatalogModel(params: {
200209 metadataSnapshot : PluginMetadataSnapshot ;
201210 provider : string ;
202211 modelId : string ;
212+ matchesStaticModelId : StaticModelIdMatcher ;
203213} ) : ProviderRuntimeModel | undefined {
204214 if ( ! params . prepared ) {
205215 return undefined ;
@@ -209,7 +219,7 @@ function findPreparedProviderStaticCatalogModel(params: {
209219 normalizePluginDiscoveryResult ( { provider, result } ) ,
210220 ) ) {
211221 const model = ( providerConfig . models ?? [ ] ) . find ( ( candidate ) =>
212- staticModelIdMatches ( {
222+ params . matchesStaticModelId ( {
213223 candidateId : candidate . id ,
214224 rowProvider : providerId ,
215225 provider : params . provider ,
0 commit comments