@@ -5,6 +5,7 @@ import { normalizeOptionalString } from "@openclaw/normalization-core/string-coe
55import type { OpenClawConfig } from "../config/types.openclaw.js" ;
66import { coerceSecretRef , resolveSecretInputRef } from "../config/types.secrets.js" ;
77import { normalizeOptionalSecretInput } from "../utils/normalize-secret-input.js" ;
8+ import { listProfilesForProvider } from "./auth-profiles/profile-list.js" ;
89import type { AuthProfileStore } from "./auth-profiles/types.js" ;
910import { resolveEnvApiKey , type EnvApiKeyLookupOptions } from "./model-auth-env.js" ;
1011import {
@@ -14,7 +15,6 @@ import {
1415 resolveNonEnvSecretRefHeaderValueMarker ,
1516} from "./model-auth-markers.js" ;
1617import { resolveAwsSdkEnvVarName } from "./model-auth-runtime-shared.js" ;
17- import { resolveProviderIdForAuth } from "./provider-auth-aliases.js" ;
1818
1919/**
2020 * Secret-aware provider config helpers.
@@ -201,21 +201,13 @@ export function resolveApiKeyFromCredential(
201201 return undefined ;
202202}
203203
204- /** Lists auth profile ids whose provider aliases match the requested provider. */
205- export function listAuthProfilesForProvider ( store : AuthProfileStore , provider : string ) : string [ ] {
206- const providerKey = resolveProviderIdForAuth ( provider ) ;
207- return Object . entries ( store . profiles )
208- . filter ( ( [ , cred ] ) => resolveProviderIdForAuth ( cred . provider ) === providerKey )
209- . map ( ( [ id ] ) => id ) ;
210- }
211-
212204/** Resolves the first usable API key from matching auth profiles. */
213205export function resolveApiKeyFromProfiles ( params : {
214206 provider : string ;
215207 store : AuthProfileStore ;
216208 env ?: NodeJS . ProcessEnv ;
217209} ) : ProfileApiKeyResolution | undefined {
218- const ids = listAuthProfilesForProvider ( params . store , params . provider ) ;
210+ const ids = listProfilesForProvider ( params . store , params . provider ) ;
219211 for ( const id of ids ) {
220212 const resolved = resolveApiKeyFromCredential ( params . store . profiles [ id ] , params . env ) ;
221213 if ( resolved ) {
0 commit comments