同步上游主仓库最新代码,整合以下新功能: - feat: 工具层及 mcp 大重构 (#252) - feat: 远程群控 (#243) - feat: 添加对 langfuse 监控的支持 (#242) - feat: 完成第一个 mcp-chrome 接入版本 - feat: 添加模型 1M 上下文切换 - feat: langfuse 工具调用显示为嵌套结构 - feat: 加上 userId 的传递 - feat: Add Ultraplan Feature for Advanced Multi-Agent Planning (#232) - feat: Add brave as alternative WebSearchTool - fix: 修复 Bun.hash 不存在问题 - fix: 修复缓存 - fix: 修复 interrupt 日志不上传 - fix: 修复 chrome 链接版本 - fix: 使用简化版本的 chrome 桥接器 - fix: 修复 node 环境没有 bun 的问题 - fix: 修复穷鬼模式的写入问题 - fix: 修复对穷鬼模式的 auto dream 和 session memory 越过 - fix: 修复初次登陆的校验问题 - fix(openai): fix stop_reason null, zero usage fields and max_tokens forwarding - chore: 1.3.3 版本 - docs: 添加浏览器说明支持 冲突解决策略: - 保留 CoStrict 品牌、4.0.x 版本号、csc bin 命令 - 保留 CoStrict 企业认证体系和 Agent 编排 - 采用上游的 1M context、langfuse、chrome mcp、远程群控等新功能 - 采用上游的 getDialogConfig/promptIdentifier 模式 - 采用上游的 FORCE_INTERACTIVE TTY 修复 - 合并两者:保留 CoStrict 品牌名 + 上游新代码模式
75 lines
2.1 KiB
TypeScript
75 lines
2.1 KiB
TypeScript
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<PreflightCheckResult> {
|
|
// 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<PreflightCheckResult | null>(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 (
|
|
<Box flexDirection="column" gap={1} paddingLeft={1}>
|
|
{isChecking && showSpinner ? (
|
|
<Box paddingLeft={1}>
|
|
<Spinner />
|
|
<Text>Checking connectivity...</Text>
|
|
</Box>
|
|
) : (
|
|
!result?.success &&
|
|
!isChecking && (
|
|
<Box flexDirection="column" gap={1}>
|
|
<Text color="error">Unable to connect to Anthropic services</Text>
|
|
<Text color="error">{result?.error}</Text>
|
|
{result?.sslHint ? (
|
|
<Box flexDirection="column" gap={1}>
|
|
<Text>{result.sslHint}</Text>
|
|
<Text color="suggestion">
|
|
See https://costrict.ai/docs/en/network-config
|
|
</Text>
|
|
</Box>
|
|
) : null}
|
|
</Box>
|
|
)
|
|
)}
|
|
</Box>
|
|
)
|
|
}
|