* Get the full providers config with safe info (no actual API keys)
()
| 288 | * Get the full providers config with safe info (no actual API keys) |
| 289 | */ |
| 290 | public getConfig(): ProvidersConfigMap { |
| 291 | const providersConfig = this.config.loadProvidersConfig() ?? {}; |
| 292 | const mainConfig = this.config.loadConfigOrDefault(); |
| 293 | const result: ProvidersConfigMap = {}; |
| 294 | const shadowedCustomProviderIds = this.detectAndLogShadowedProviders(providersConfig); |
| 295 | |
| 296 | for (const provider of this.listBuiltInProviders()) { |
| 297 | if (shadowedCustomProviderIds.has(provider)) { |
| 298 | continue; |
| 299 | } |
| 300 | const config = (providersConfig[provider] ?? {}) as { |
| 301 | apiKey?: string; |
| 302 | apiKeyFile?: string; |
| 303 | apiKeyOpLabel?: string; |
| 304 | baseUrl?: string; |
| 305 | baseURL?: string; |
| 306 | models?: unknown[]; |
| 307 | serviceTier?: string; |
| 308 | wireFormat?: string; |
| 309 | store?: unknown; |
| 310 | webSocketTransportEnabled?: unknown; |
| 311 | cacheTtl?: unknown; |
| 312 | disableBetaFeatures?: unknown; |
| 313 | /** OpenAI-only: default auth precedence for Codex-OAuth-allowed models. */ |
| 314 | codexOauthDefaultAuth?: unknown; |
| 315 | region?: string; |
| 316 | /** Optional AWS shared config profile name (equivalent to AWS_PROFILE). */ |
| 317 | profile?: string; |
| 318 | bearerToken?: string; |
| 319 | accessKeyId?: string; |
| 320 | secretAccessKey?: string; |
| 321 | /** Persisted provider toggle: only `false` is stored; missing means enabled. */ |
| 322 | enabled?: unknown; |
| 323 | /** OpenAI-only: stored Codex OAuth tokens (never sent to frontend). */ |
| 324 | codexOauth?: unknown; |
| 325 | }; |
| 326 | |
| 327 | const forcedBaseUrl = this.policyService?.isEnforced() |
| 328 | ? this.policyService.getForcedBaseUrl(provider) |
| 329 | : undefined; |
| 330 | |
| 331 | const allowedModels = this.policyService?.isEnforced() |
| 332 | ? (this.policyService.getEffectivePolicy()?.providerAccess?.find((p) => p.id === provider) |
| 333 | ?.allowedModels ?? null) |
| 334 | : null; |
| 335 | |
| 336 | const normalizedModels = |
| 337 | config.models === undefined ? undefined : normalizeProviderModelEntries(config.models); |
| 338 | const filteredModels = filterProviderModelsByPolicy(normalizedModels, allowedModels); |
| 339 | |
| 340 | const codexOauthSet = |
| 341 | provider === "openai" && parseCodexOauthAuth(config.codexOauth) !== null; |
| 342 | const apiKeyIsOpRef = isOpReference(config.apiKey); |
| 343 | let isEnabled = !isProviderDisabledInConfig(config); |
| 344 | if (provider === "mux-gateway" && mainConfig.muxGatewayEnabled === false) { |
| 345 | isEnabled = false; |
| 346 | } |
| 347 |
no test coverage detected