11/** Implementation of `openclaw models status`. */
22import path from "node:path" ;
3+ import { findNormalizedProviderValue } from "@openclaw/model-catalog-core/provider-id" ;
34import { normalizeOptionalString } from "@openclaw/normalization-core/string-coerce" ;
45import { colorize , theme } from "../../../packages/terminal-core/src/theme.js" ;
56import {
@@ -572,21 +573,6 @@ export async function modelsStatusCommand(
572573 } ;
573574 const resolveProviderAuthHealthId = ( provider : string ) : string =>
574575 resolveProviderIdForAuth ( provider , envLookupParams ) ;
575- const resolveStatusAuthOrder = (
576- order : Record < string , string [ ] > | undefined ,
577- provider : string ,
578- ) : string [ ] | undefined => {
579- if ( ! order ) {
580- return undefined ;
581- }
582- const providerKey = normalizeProviderId ( provider ) ;
583- for ( const [ key , value ] of Object . entries ( order ) ) {
584- if ( normalizeProviderId ( key ) === providerKey ) {
585- return value ;
586- }
587- }
588- return undefined ;
589- } ;
590576 const listRuntimeAuthProviderCandidates = (
591577 provider : string ,
592578 options ?: { includeLegacyOpenAICodex ?: boolean } ,
@@ -613,10 +599,10 @@ export async function modelsStatusCommand(
613599 const providerKey = normalizeProviderId ( provider ) ;
614600 const providerAuthKey = resolveProviderAuthHealthId ( providerKey ) ;
615601 const explicitOrder =
616- resolveStatusAuthOrder ( store . order , providerAuthKey ) ??
617- resolveStatusAuthOrder ( store . order , providerKey ) ??
618- resolveStatusAuthOrder ( cfg . auth ?. order , providerAuthKey ) ??
619- resolveStatusAuthOrder ( cfg . auth ?. order , providerKey ) ;
602+ findNormalizedProviderValue ( store . order , providerAuthKey ) ??
603+ findNormalizedProviderValue ( store . order , providerKey ) ??
604+ findNormalizedProviderValue ( cfg . auth ?. order , providerAuthKey ) ??
605+ findNormalizedProviderValue ( cfg . auth ?. order , providerKey ) ;
620606 const isEligibleOrHealthRescued = ( profileId : string ) : boolean => {
621607 const credential = store . profiles [ profileId ] ;
622608 if ( ! credential ) {
0 commit comments