* Resolves the Chrome bridge URL based on environment and feature flag. * Bridge is used when the feature flag is enabled; ant users always get * bridge. API key / 3P users fall back to native messaging.
()
| 49 | * bridge. API key / 3P users fall back to native messaging. |
| 50 | */ |
| 51 | function getChromeBridgeUrl(): string | undefined { |
| 52 | const bridgeEnabled = |
| 53 | process.env.USER_TYPE === 'ant' || |
| 54 | getFeatureValue_CACHED_MAY_BE_STALE('tengu_copper_bridge', false) |
| 55 | |
| 56 | if (!bridgeEnabled) { |
| 57 | return undefined |
| 58 | } |
| 59 | |
| 60 | if ( |
| 61 | isEnvTruthy(process.env.USE_LOCAL_OAUTH) || |
| 62 | isEnvTruthy(process.env.LOCAL_BRIDGE) |
| 63 | ) { |
| 64 | return 'ws://localhost:8765' |
| 65 | } |
| 66 | |
| 67 | if (isEnvTruthy(process.env.USE_STAGING_OAUTH)) { |
| 68 | return 'wss://bridge-staging.claudeusercontent.com' |
| 69 | } |
| 70 | |
| 71 | return 'wss://bridge.claudeusercontent.com' |
| 72 | } |
| 73 | |
| 74 | function isLocalBridge(): boolean { |
| 75 | return ( |
no test coverage detected