( principalSource: PrincipalSource, rawAuthTokenSource: string | null, rawApiKeySource: string | null, )
| 185 | } |
| 186 | |
| 187 | function buildSourceDetails( |
| 188 | principalSource: PrincipalSource, |
| 189 | rawAuthTokenSource: string | null, |
| 190 | rawApiKeySource: string | null, |
| 191 | ): SourceDetails { |
| 192 | const rawSources = [rawAuthTokenSource, rawApiKeySource].filter( |
| 193 | (value): value is string => Boolean(value), |
| 194 | ) |
| 195 | |
| 196 | return { |
| 197 | usedLegacyCompat: |
| 198 | principalSource === 'external_bearer_compat' || |
| 199 | rawSources.some(source => |
| 200 | source.startsWith('CLAUDE_') || |
| 201 | source.startsWith('ANTHROPIC_') || |
| 202 | source.startsWith('CCR_'), |
| 203 | ), |
| 204 | usedEnvVar: |
| 205 | principalSource === 'service_oauth_env' || |
| 206 | principalSource === 'direct_api_key_env' || |
| 207 | principalSource === 'external_bearer_compat', |
| 208 | usedFileDescriptor: |
| 209 | principalSource === 'service_oauth_fd' || |
| 210 | principalSource === 'service_api_key_fd', |
| 211 | usedHelper: principalSource === 'api_key_helper', |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | function buildRecovery(params: { |
| 216 | principalSource: PrincipalSource |
no outgoing calls
no test coverage detected