import React, { useEffect, useState } from 'react' import { useTimeout } from '../hooks/useTimeout.js' import { Box, Text } from '@anthropic/ink' import { Spinner } from '../components/Spinner.js' export interface PreflightCheckResult { success: boolean error?: string sslHint?: string } async function checkEndpoints(): Promise { // Skip connectivity check — users may use third-party API providers // (OpenAI, Gemini, Grok, etc.) or be behind restricted networks. return { success: true } } interface PreflightStepProps { onSuccess: () => void } export function PreflightStep({ onSuccess, }: PreflightStepProps): React.ReactNode { const [result, setResult] = useState(null) const [isChecking, setIsChecking] = useState(true) // delay showing the check since it's so fast that we normally // want to just immediately show the next step without a flash const showSpinner = useTimeout(1000) && isChecking useEffect(() => { async function run() { const checkResult = await checkEndpoints() setResult(checkResult) setIsChecking(false) } void run() }, []) useEffect(() => { if (result?.success) { onSuccess() } // Failure branch removed — preflight check always succeeds }, [result, onSuccess]) return ( {isChecking && showSpinner ? ( Checking connectivity... ) : ( !result?.success && !isChecking && ( Unable to connect to Anthropic services {result?.error} ) )} ) }