1- import axios from 'axios'
21import React , { useEffect , useState } from 'react'
3- import { logEvent } from 'src/services/analytics/index.js'
4- import { Spinner } from '../components/Spinner.js'
5- import { getOauthConfig } from '../constants/oauth.js'
62import { useTimeout } from '../hooks/useTimeout.js'
73import { Box , Text } from '@anthropic/ink'
8- import { getSSLErrorHint } from '../services/api/errorUtils.js'
9- import { getUserAgent } from './http.js'
10- import { logError } from './log.js'
4+ import { Spinner } from '../components/Spinner.js'
115
126export interface PreflightCheckResult {
137 success : boolean
@@ -16,66 +10,9 @@ export interface PreflightCheckResult {
1610}
1711
1812async function checkEndpoints ( ) : Promise < PreflightCheckResult > {
19- try {
20- const oauthConfig = getOauthConfig ( )
21- const tokenUrl = new URL ( oauthConfig . TOKEN_URL )
22- const endpoints = [
23- `${ oauthConfig . BASE_API_URL } /api/hello` ,
24- `${ tokenUrl . origin } /v1/oauth/hello` ,
25- ]
26-
27- const checkEndpoint = async (
28- url : string ,
29- ) : Promise < PreflightCheckResult > => {
30- try {
31- const response = await axios . get ( url , {
32- headers : { 'User-Agent' : getUserAgent ( ) } ,
33- } )
34- if ( response . status !== 200 ) {
35- const hostname = new URL ( url ) . hostname
36- return {
37- success : false ,
38- error : `Failed to connect to ${ hostname } : Status ${ response . status } ` ,
39- }
40- }
41- return { success : true }
42- } catch ( error ) {
43- const hostname = new URL ( url ) . hostname
44- const sslHint = getSSLErrorHint ( error )
45- return {
46- success : false ,
47- error : `Failed to connect to ${ hostname } : ${ error instanceof Error ? ( error as ErrnoException ) . code || error . message : String ( error ) } ` ,
48- sslHint : sslHint ?? undefined ,
49- }
50- }
51- }
52-
53- const results = await Promise . all ( endpoints . map ( checkEndpoint ) )
54- const failedResult = results . find ( result => ! result . success )
55-
56- if ( failedResult ) {
57- // Log failure to Statsig
58- logEvent ( 'tengu_preflight_check_failed' , {
59- isConnectivityError : false ,
60- hasErrorMessage : ! ! failedResult . error ,
61- isSSLError : ! ! failedResult . sslHint ,
62- } )
63- }
64-
65- return failedResult || { success : true }
66- } catch ( error ) {
67- logError ( error as Error )
68-
69- // Log to Statsig
70- logEvent ( 'tengu_preflight_check_failed' , {
71- isConnectivityError : true ,
72- } )
73-
74- return {
75- success : false ,
76- error : `Connectivity check error: ${ error instanceof Error ? ( error as ErrnoException ) . code || error . message : String ( error ) } ` ,
77- }
78- }
13+ // Skip connectivity check — users may use third-party API providers
14+ // (OpenAI, Gemini, Grok, etc.) or be behind restricted networks.
15+ return { success : true }
7916}
8017
8118interface PreflightStepProps {
@@ -104,10 +41,8 @@ export function PreflightStep({
10441 useEffect ( ( ) => {
10542 if ( result ?. success ) {
10643 onSuccess ( )
107- } else if ( result && ! result . success ) {
108- const timer = setTimeout ( ( ) => process . exit ( 1 ) , 100 )
109- return ( ) => clearTimeout ( timer )
11044 }
45+ // Failure branch removed — preflight check always succeeds
11146 } , [ result , onSuccess ] )
11247
11348 return (
@@ -123,27 +58,6 @@ export function PreflightStep({
12358 < Box flexDirection = "column" gap = { 1 } >
12459 < Text color = "error" > Unable to connect to Anthropic services</ Text >
12560 < Text color = "error" > { result ?. error } </ Text >
126- { result ?. sslHint ? (
127- < Box flexDirection = "column" gap = { 1 } >
128- < Text > { result . sslHint } </ Text >
129- < Text color = "suggestion" >
130- See https://code.claude.com/docs/en/network-config
131- </ Text >
132- </ Box >
133- ) : (
134- < Box flexDirection = "column" gap = { 1 } >
135- < Text >
136- Please check your internet connection and network settings.
137- </ Text >
138- < Text >
139- Note: Claude Code might not be available in your country.
140- Check supported countries at{ ' ' }
141- < Text color = "suggestion" >
142- https://anthropic.com/supported-countries
143- </ Text >
144- </ Text >
145- </ Box >
146- ) }
14761 </ Box >
14862 )
14963 ) }
0 commit comments