()
| 1021 | * Returns void to prevent misuse - use refreshAndGetAwsCredentials() to actually retrieve credentials. |
| 1022 | */ |
| 1023 | export function prefetchAwsCredentialsAndBedRockInfoIfSafe(): void { |
| 1024 | // Check if either AWS command is configured |
| 1025 | const awsAuthRefresh = getConfiguredAwsAuthRefresh() |
| 1026 | const awsCredentialExport = getConfiguredAwsCredentialExport() |
| 1027 | |
| 1028 | if (!awsAuthRefresh && !awsCredentialExport) { |
| 1029 | return |
| 1030 | } |
| 1031 | |
| 1032 | // Check if either command is from project settings |
| 1033 | if ( |
| 1034 | isAwsAuthRefreshFromProjectSettings() || |
| 1035 | isAwsCredentialExportFromProjectSettings() |
| 1036 | ) { |
| 1037 | // Only prefetch if trust has already been established |
| 1038 | const hasTrust = checkHasTrustDialogAccepted() |
| 1039 | if (!hasTrust && !getIsNonInteractiveSession()) { |
| 1040 | // Don't prefetch - wait for trust to be established first |
| 1041 | return |
| 1042 | } |
| 1043 | } |
| 1044 | |
| 1045 | // Safe to prefetch - either not from project settings or trust already established |
| 1046 | void refreshAndGetAwsCredentials() |
| 1047 | getModelStrings() |
| 1048 | } |
| 1049 | |
| 1050 | /** @private Use {@link getAnthropicApiKey} or {@link getAnthropicApiKeyWithSource} */ |
| 1051 | export const getApiKeyFromConfigOrMacOSKeychain = memoize( |
no test coverage detected