@@ -607,6 +607,7 @@ export function applyConfigHintsToCachedModels(name: string, prov: OcxProviderCo
607607 return models . map ( model => applyProviderConfigHints ( name , prov , model , contextCap ) ) ;
608608}
609609
610+
610611/**
611612 * Last-resort context window for combo member synthesis when discovery and
612613 * provider config both omit one. Matches the catalog entry default in
@@ -619,9 +620,9 @@ const COMBO_MEMBER_CONTEXT_FALLBACK = 128_000;
619620 * Prefer discovery metadata; when the target is missing from the gather map or
620621 * lacks a positive contextWindow, synthesize from the (registry-enriched)
621622 * provider config so combos remain catalogued when targets are configured but
622- * discovery metadata is incomplete. Disabled/missing providers stay unresolved.
623- * When hints still omit contextWindow, apply COMBO_MEMBER_CONTEXT_FALLBACK so a
624- * live row without ctx (common for LiteLLM / custom xai ids) does not drop the
623+ * discovery metadata is incomplete. Disabled providers stay unresolved.
624+ * When hints still omit contextWindow, prefer known maxInputTokens, else
625+ * COMBO_MEMBER_CONTEXT_FALLBACK so a live row without ctx does not drop the
625626 * whole combo from the public catalog.
626627 */
627628export function resolveComboCatalogMember (
@@ -661,8 +662,6 @@ export function resolveComboCatalogMember(
661662 id : target . model ,
662663 provider : target . provider ,
663664 } ;
664- // Reuse the same hint path configured/static catalog rows use when a provider
665- // config exists; otherwise keep the base (possibly incomplete) discovery row.
666665 const hinted = prov
667666 ? applyProviderConfigHints ( target . provider , prov , base , contextCap )
668667 : base ;
@@ -676,16 +675,10 @@ export function resolveComboCatalogMember(
676675 : ( typeof base . maxInputTokens === "number" && base . maxInputTokens > 0
677676 ? base . maxInputTokens
678677 : undefined ) ;
679- // Prefer config/discovery; fall back so incomplete live rows still catalog.
680- // Pure ghosts (no discovery row) on a known provider still synthesize: live
681- // discovery is often incomplete for LiteLLM/custom relays, and dropping the
682- // whole combo solely for a missing /v1/models row is worse than a stub window.
683678 const uncappedContext = hintedContext
684679 ?? knownMaxInput
685680 ?? ( existing || prov ? COMBO_MEMBER_CONTEXT_FALLBACK : undefined ) ;
686681 if ( uncappedContext === undefined ) return undefined ;
687- // Fallback bypasses applyProviderConfigHints' cap path — clamp here so a
688- // providerContextCaps value below 128k still wins (same semantics as hints).
689682 const usedFallback = hintedContext === undefined ;
690683 const cappedContext = applyProviderContextCap ( uncappedContext , contextCap ) ;
691684 const contextWindow = cappedContext ?? uncappedContext ;
@@ -695,8 +688,6 @@ export function resolveComboCatalogMember(
695688 && cappedContext !== uncappedContext ;
696689
697690 const inputModalities = hinted . inputModalities ?? base . inputModalities ?? [ "text" ] ;
698- // applyProviderConfigHints already folds configuredReasoningEfforts; keep an
699- // explicit fallback for stubs that only had base fields.
700691 const reasoningEfforts = hinted . reasoningEfforts
701692 ?? ( prov ? configuredReasoningEfforts ( prov , target . model ) : undefined )
702693 ?? base . reasoningEfforts ;
@@ -843,6 +834,17 @@ function modelInputModalities(
843834 value === "text" || value === "image" || value === "audio"
844835 ) ) ;
845836 if ( explicit && explicit . length > 0 ) return explicit ;
837+ const architecture = plainRecord ( item . architecture ) ;
838+ const architectureModality = typeof architecture ?. modality === "string"
839+ ? normalizedMetadataString ( architecture . modality , 64 )
840+ : undefined ;
841+ if ( architectureModality ?. includes ( "->" ) ) {
842+ const [ rawInput = "" ] = architectureModality . split ( "->" ) ;
843+ const inferred = rawInput
844+ . split ( "+" )
845+ . filter ( value => value === "text" || value === "image" || value === "audio" ) ;
846+ if ( inferred . length > 0 ) return [ ...new Set ( inferred ) ] ;
847+ }
846848 if ( capabilityRecord ?. vision === false ) return [ "text" ] ;
847849 if ( capabilityRecord ?. vision === true || capabilities ?. some ( value => value === "vision" || value === "image-input" ) ) {
848850 return [ "text" , "image" ] ;
0 commit comments