| ... | @@ -480,9 +480,19 @@ function claudeAuthMetadata(input: { | ... | @@ -480,9 +480,19 @@ function claudeAuthMetadata(input: { |
| 480 | return undefined; | 480 | return undefined; |
| 481 | } | 481 | } |
| 482 | | 482 | |
| | 483 | function apiProviderAuthMetadata( |
| | 484 | apiProvider: string | undefined, |
| | 485 | ): { readonly type: string; readonly label: string } | undefined { |
| | 486 | return apiProvider === "bedrock" ? { type: "bedrock", label: "Amazon Bedrock" } : undefined; |
| | 487 | } |
| | 488 | |
| 483 | // ── SDK capability probe ──────────────────────────────────────────── | 489 | // ── SDK capability probe ──────────────────────────────────────────── |
| 484 | | 490 | |
| 485 | const CAPABILITIES_PROBE_TIMEOUT_MS = 8_000; | 491 | // Amazon Bedrock initializes far slower than first-party auth: the SDK boots the |
| | 492 | // Bedrock backend and runs the `awsAuthRefresh` credential hook before returning |
| | 493 | // account info. The previous 8s budget expired mid-init, so the probe returned |
| | 494 | // `undefined` and left the provider unverified and unselectable in the picker. |
| | 495 | const CAPABILITIES_PROBE_TIMEOUT_MS = 25_000; |
| 486 | | 496 | |
| 487 | function nonEmptyProbeString(value: string): string | undefined { | 497 | function nonEmptyProbeString(value: string): string | undefined { |
| 488 | const candidate = value.trim(); | 498 | const candidate = value.trim(); |
| ... | @@ -493,6 +503,12 @@ type ClaudeCapabilitiesProbe = { | ... | @@ -493,6 +503,12 @@ type ClaudeCapabilitiesProbe = { |
| 493 | readonly email: string | undefined; | 503 | readonly email: string | undefined; |
| 494 | readonly subscriptionType: string | undefined; | 504 | readonly subscriptionType: string | undefined; |
| 495 | readonly tokenSource: string | undefined; | 505 | readonly tokenSource: string | undefined; |
| | 506 | /** |
| | 507 | * Active API backend reported by the SDK's `AccountInfo`. Anthropic OAuth |
| | 508 | * login only applies when `"firstParty"`; for Amazon Bedrock (`"bedrock"`) |
| | 509 | * the subscription/token fields are absent and auth is external AWS creds. |
| | 510 | */ |
| | 511 | readonly apiProvider: string | undefined; |
| 496 | readonly slashCommands: ReadonlyArray<ServerProviderSlashCommand>; | 512 | readonly slashCommands: ReadonlyArray<ServerProviderSlashCommand>; |
| 497 | }; | 513 | }; |
| 498 | | 514 | |
| ... | @@ -618,12 +634,14 @@ const probeClaudeCapabilities = ( | ... | @@ -618,12 +634,14 @@ const probeClaudeCapabilities = ( |
| 618 | readonly email?: string; | 634 | readonly email?: string; |
| 619 | readonly subscriptionType?: string; | 635 | readonly subscriptionType?: string; |
| 620 | readonly tokenSource?: string; | 636 | readonly tokenSource?: string; |
| | 637 | readonly apiProvider?: string; |
| 621 | } | 638 | } |
| 622 | | undefined; | 639 | | undefined; |
| 623 | return { | 640 | return { |
| 624 | email: account?.email, | 641 | email: account?.email, |
| 625 | subscriptionType: account?.subscriptionType, | 642 | subscriptionType: account?.subscriptionType, |
| 626 | tokenSource: account?.tokenSource, | 643 | tokenSource: account?.tokenSource, |
| | 644 | apiProvider: account?.apiProvider, |
| 627 | slashCommands: parseClaudeInitializationCommands(init.commands), | 645 | slashCommands: parseClaudeInitializationCommands(init.commands), |
| 628 | } satisfies ClaudeCapabilitiesProbe; | 646 | } satisfies ClaudeCapabilitiesProbe; |
| 629 | }); | 647 | }); |
| ... | @@ -799,10 +817,11 @@ export const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")( | ... | @@ -799,10 +817,11 @@ export const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")( |
| 799 | }); | 817 | }); |
| 800 | } | 818 | } |
| 801 | | 819 | |
| 802 | const authMetadata = claudeAuthMetadata({ | 820 | const authMetadata = |
| 803 | subscriptionType: capabilities.subscriptionType, | 821 | claudeAuthMetadata({ |
| 804 | authMethod: capabilities.tokenSource, | 822 | subscriptionType: capabilities.subscriptionType, |
| 805 | }); | 823 | authMethod: capabilities.tokenSource, |
| | 824 | }) ?? apiProviderAuthMetadata(capabilities.apiProvider); |
| 806 | return buildServerProvider({ | 825 | return buildServerProvider({ |
| 807 | presentation: CLAUDE_PRESENTATION, | 826 | presentation: CLAUDE_PRESENTATION, |
| 808 | enabled: claudeSettings.enabled, | 827 | enabled: claudeSettings.enabled, |