Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
fix(auth): type recovered state helpers
Kfir Amar8fd944ccf77c
diff --git a/src/sse/services/auth.ts b/src/sse/services/auth.tsindex eb5a0224f3..1e3214af1f 100644--- a/src/sse/services/auth.ts+++ b/src/sse/services/auth.ts@@ -41,6 +41,16 @@ interface ProviderConnectionView {backoffLevel: number;}+interface RecoverableConnectionState {+ connectionId: string;+ testStatus?: string | null;+ lastError?: string | null;+ rateLimitedUntil?: string | null;+ errorCode?: string | number | null;+ lastErrorType?: string | null;+ lastErrorSource?: string | null;+}+const CODEX_QUOTA_THRESHOLD_PERCENT = 90;function asRecord(value: unknown): JsonRecord {@@ -576,7 +586,10 @@ export async function markAccountUnavailable(* Clear account error status (only if currently has error)* Optimized to avoid unnecessary DB updates*/-export async function clearAccountError(connectionId: string, currentConnection: any) {+export async function clearAccountError(+ connectionId: string,+ currentConnection: Partial<RecoverableConnectionState>+) {// Only update if currently has error statusconst hasError =(currentConnection.testStatus && currentConnection.testStatus !== "active") ||@@ -601,7 +614,9 @@ export async function clearAccountError(connectionId: string, currentConnection:log.info("AUTH", `Account ${connectionId.slice(0, 8)} error cleared`);}-export async function clearRecoveredProviderState(credentials: any) {+export async function clearRecoveredProviderState(+ credentials: Partial<RecoverableConnectionState> | null+) {if (!credentials?.connectionId) return;await clearAccountError(credentials.connectionId, credentials);}