A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode,DeepSeek Harness and more. Only official website: ccswitch.io
Rust ai-toolsclaude-codecodexdeepseek-harnessdesktop-appgrokgrokbuildhermeskimi-codemcpopen-sourceopencodepiprovider-managementrustskillsskills-managementtauriwsl-support
import { invoke } from "@tauri-apps/api/core";
import type { AppId } from "./types";
// ===== 连通性检查类型 =====
// 注意:本检查只探测 base_url 是否可达,不发真实大模型请求,也不触碰故障转移熔断器。
export type HealthStatus = "operational" | "degraded" | "failed";
/** 连不上的原因(后端 `proxy::error::NetworkErrorKind`) */
export type NetworkErrorKind =
| "blocked"
| "refused"
| "timeout"
| "dns"
| "tls"
| "other";
export interface StreamCheckResult {
status: HealthStatus;
success: boolean;
message: string;
responseTimeMs?: number;
httpStatus?: number;
testedAt: number;
retryCount: number;
errorKind?: NetworkErrorKind;
}
// ===== 连通性检查 API =====
/**
* 连通性检查(单个供应商)
*/
export async function streamCheckProvider(
appType: AppId,
providerId: string,
): Promise<StreamCheckResult> {
return invoke("stream_check_provider", { appType, providerId });
}