- [Weekly Quota "Pedal Mode" with Auto Circuit-Breaker Recovery] (Fixes #3795, PR #3796, Thanks to @cubelikeplayDaniel):
- Expiring Quota Detection & Prompt: Independently monitors weekly quotas for Gemini and Claude in the account pool, prompting a reminder dialog when remaining quota exceeds 5% with less than 24 hours until the official reset; supports a persistent "Don't remind me again" choice per model family, plus a 2-hour silent cooldown after "Not now" to avoid repeated interruptions. (Fixes #3795, PR #3796, Thanks to @cubelikeplayDaniel)
- Snapshot-Based Suspension & Precise Restoration: Creates a pre-activation state snapshot and temporarily suspends all non-target accounts (
pedal_mode_locked) so traffic concentrates on the expiring accounts; on exit, only the accounts suspended by this session are restored, while accounts the user had manually disabled remain untouched, preventing pool state corruption. (Fixes #3795, PR #3796, Thanks to @cubelikeplayDaniel) - Exhaustion-Only Safe Exit & Deadlock Guards: Exits automatically only when every target account drops to 0% or the official reset time has passed; fixed a deadlock where the negative countdown after the reset time blocked exit, excluded user-disabled accounts from being selected as targets, added fallback restoration when a target account is deleted, and applied conservative guards against quota-loading fluctuation to prevent a premature exit. (Fixes #3795, PR #3796, Thanks to @cubelikeplayDaniel)
- Top Banner & Manual Exit: Added a contextual status banner to the main UI header showing the active model, suspended account count, and accounts pending consumption, with manual exit and restore at any time; fully localized in Chinese and English with 9 automated edge-case unit tests. (Fixes #3795, PR #3796, Thanks to @cubelikeplayDaniel)
- [Claude Code 2.1.312 New-Generation Model Mapping and Pool-Adaptive Dark Routing] (Fixes #2065, Ref #1724, Ref #3731, Ref #3751, PR #3787, Thanks to @cubelikeplayDaniel):
- Static Hardcoded Mapping Removed: Deleted the
CLAUDE_TO_GEMINIstatic hardcoded mapping, eliminating the deadlock risk of the entire Claude chain collapsing when a target model is retired or renamed. (Fixes #2065, PR #3787, Thanks to @cubelikeplayDaniel) - Adaptive Dark Routing (
auto:*): Addedauto:gemini-flash-low,auto:claude-opus, andauto:claude-opus-4-7pool-adaptive targets that choose the best available model among Opus 5.5 / 4.6 / 4.7 and other Claude thinking models based on real-time positive quota, preventing 502 when the whole pool is exhausted;claude-haiku-*now reusespick_background_model_from_poolto dynamically select a lightweight shared pool with zero Claude coding quota drain. (Ref #1724, Ref #3731, PR #3787, Thanks to @cubelikeplayDaniel) - Public/Dark Exposure Toggle & Anti-Resurrection Migration: Decoupled
custom_mappingfromcustom_mapping_expose, keeping the three built-in compatibility rules hidden by default; introducedbuiltin_mapping_versionfor seamless migration so built-in rules survive a one-click reset; the mapping panel now supports public/dark state toggling and one-click reset to built-in adaptive routes. (Fixes #2065, PR #3787, Thanks to @cubelikeplayDaniel) - Gate Baseline & Thinking-Tier Passthrough: Extracted the shared
parse_claude_version_tuplehelper to remove fragile duplicate version parsing; the Claude hard gate remains 4.6 (Fable / Mythos require ≥ 5.0, Haiku ≥ 4.5), and adaptive targets are resolved before the gate so dark routes are not falsely rejected as retired; the router now passes client thinking tiers through when a custom mapping target is a bare model. (Ref #3751, PR #3787, Thanks to @cubelikeplayDaniel)
- Static Hardcoded Mapping Removed: Deleted the
- [Graceful Finalization for Abnormal Stream Drops with Zero Body Tampering] (PR #3794, Thanks to @cubelikeplayDaniel):
- No Content Loss on Mid-Stream Drops: Refactored the shared
stream_lifecyclestate machine to distinguish "interruption after content/tool calls were emitted" from "first-packet or pure-thinking failure"; network jitter, connection resets, and idle timeouts now trigger graceful finalization with protocol-specific truncation terminals (Claudemax_tokens/ OpenAIlength/ GeminiMAX_TOKENS), preventing clients from throwingStreamTruncatedErrorand discarding tens of thousands of already-generated tokens. (PR #3794, Thanks to @cubelikeplayDaniel) - Zero Body Tampering & Tool-Call Priority: Removed fabricated Markdown banners and unclosed code-fence injection to keep model output untouched, eliminating non-streaming and thinking-store contamination; tool-call semantics take absolute priority, so abnormal finalization strictly preserves
tool_use/tool_callsand never rewrites them into truncation reasons that deadlock the next turn with HTTP 400. (PR #3794, Thanks to @cubelikeplayDaniel) - Terminal & Empty-Content Guards: Interruptions during pure thinking or before any content/tool call was emitted still propagate errors downstream, never faking a finish or an empty answer; protocol handlers now expose
has_emitted_doneand other terminal awareness to prevent double-finalization frames from poisoning the client. (PR #3794, Thanks to @cubelikeplayDaniel) - Gemini Normal-EOF and Null-Upstream Fixes: Removed the
GeminiStreamHandler::is_terminaloverride so normal EOF streams no longer skip image-generation success accounting and model rate-limit cleanup; strengthenedfinishReasonnull checks so occasional upstreamnullfields do not cause misjudgment, with a new unit test asserting a normal EOF reachesemit_finalize. (Ref #3794, Thanks to @cubelikeplayDaniel)
- No Content Loss on Mid-Stream Drops: Refactored the shared
- [账号周配额临期「蹬额度模式」与自动熔断恢复] (Fixes #3795, PR #3796, Thanks to @cubelikeplayDaniel):
- 临期智能识别与提醒: 独立监测账号池中 Gemini 与 Claude 的周配额状态,当剩余配额 > 5% 且距官方重置不足 24 小时主动弹出提醒窗口;支持按模型家族持久化「不再提示 Gemini / Claude」,点击「暂不启动」后进入 2 小时静默冷却,避免高频打扰。(Fixes #3795, PR #3796, Thanks to @cubelikeplayDaniel)
- 快照式挂起与精准恢复: 启动蹬额度模式时自动创建前置状态快照,临时挂起其余非目标账号(
pedal_mode_locked)将流量全力集中至临期账号;退出时仅恢复本次挂起的账号,严格保留用户原本主动禁用的账号,杜绝号池状态错乱。(Fixes #3795, PR #3796, Thanks to @cubelikeplayDaniel) - 全量耗尽安全退出与边界防死锁: 当且仅当全部目标账号配额降至 0% 或到达官方重置时间刷新后才自动退出;修复到达重置时间后负倒计时判定导致无法退出的死锁,并排除已被主动禁用账号被误选为目标、目标账号被删除时兜底恢复挂起账号,配额加载波动时保守防穿透避免误判提前退出。(Fixes #3795, PR #3796, Thanks to @cubelikeplayDaniel)
- 顶部运行横条与手动退出: 主界面顶部新增微交互状态 Banner,实时展示当前运行模型、已挂起账号数与待消耗账号数,并支持随时手动退出并恢复;配套中英双语 i18n 与 9 项边界场景自动化单测全覆盖。(Fixes #3795, PR #3796, Thanks to @cubelikeplayDaniel)
- [Claude Code 2.1.312 新一代模型映射与号池自适应暗路由] (Fixes #2065, Ref #1724, Ref #3731, Ref #3751, PR #3787, Thanks to @cubelikeplayDaniel):
- 移除静态硬编码映射: 删除
CLAUDE_TO_GEMINI静态硬编码映射,彻底消除目标模型下线或改名导致整条 Claude 链路瘫痪的死锁风险。(Fixes #2065, PR #3787, Thanks to @cubelikeplayDaniel) - 自适应暗路由 (
auto:*): 新增auto:gemini-flash-low、auto:claude-opus与auto:claude-opus-4-7号池自适应目标,依据实时正配额在 Opus 5.5 / 4.6 / 4.7 及池内其他 Claude 思考模型间自动择优与降级,防止全池耗尽后直接 502;claude-haiku-*复用pick_background_model_from_pool动态挑选轻量共享池,零 Claude 编程配额损耗。(Ref #1724, Ref #3731, PR #3787, Thanks to @cubelikeplayDaniel) - 公开/暗访双态与防复活迁移: 解耦
custom_mapping与custom_mapping_expose,内置三条兼容规则默认不对外暴露;引入builtin_mapping_version无感迁移,保障内置规则不被一键重置抹除;前端映射面板新增公开/暗访状态切换与一键重置恢复内置自适应映射。(Fixes #2065, PR #3787, Thanks to @cubelikeplayDaniel) - 门禁基准与思考档位穿透: 抽取通用
parse_claude_version_tuple消除脆弱重复版本解析,Claude 硬防线维持 4.6(Fable / Mythos 需 ≥ 5.0、Haiku ≥ 4.5),门禁前置阶段先解析自适应目标避免暗路由被已下线判定误杀;路由层支持自定义映射目标为裸模型时继续按客户端思考档位穿透。(Ref #3751, PR #3787, Thanks to @cubelikeplayDaniel)
- 移除静态硬编码映射: 删除
- [流式异常断流优雅收尾与零正文篡改保全] (PR #3794, Thanks to @cubelikeplayDaniel):
- 中途断流不丢已生成内容: 重构通用
stream_lifecycle状态机,精准区分「已产生正文/工具调用后中断」与「首包或纯思维链失败」;上游网络抖动、连接重置或空闲超时时执行优雅收尾并下发协议专属截断终态(Claudemax_tokens/ OpenAIlength/ GeminiMAX_TOKENS),彻底避免客户端抛出StreamTruncatedError丢弃已生成的上万 token 并反复重思考重置当前轮次。(PR #3794, Thanks to @cubelikeplayDaniel) - 零正文篡改与工具调用优先: 剔除伪造 Markdown 提示横幅与未闭合代码围栏注入,保持模型原样输出,根除非流式响应与思维库污染;工具调用语义优先级全局最高,断流收尾严格保持
tool_use/tool_calls,杜绝篡改为截断语义导致下一轮 400 死锁。(PR #3794, Thanks to @cubelikeplayDaniel) - 终态与空内容防护: 纯思维链或未产生任何正文/工具调用的中断严格保持错误向下透传,绝不伪造假收尾与空回答;为各协议补齐
has_emitted_done等终态感知,防止二次终结帧向客户端投毒多余数据帧。(PR #3794, Thanks to @cubelikeplayDaniel) - Gemini 正常流与上游空值修正: 移除
GeminiStreamHandler::is_terminal覆写,避免正常 EOF 流因提前终结跳过图片生成成功统计与模型限流清理;增强finishReason非空判定,防止上游偶发null字段导致误判,并补充正常 EOF 到达emit_finalize的单元测试。(Ref #3794, Thanks to @cubelikeplayDaniel)
- 中途断流不丢已生成内容: 重构通用
What's Changed
- feat(proxy,models): 支持 Claude Code 2.1.312 新一代模型映射与门禁放行 (Fixes #2065, Ref #1724, Ref #3731, Ref #3751) by @cubelikeplayDaniel in #3787
- fix(proxy): 修复流式长文本中途异常截断丢弃与代码块破坏 by @cubelikeplayDaniel in #3794
- feat(accounts,quota): 支持账号周配额临期“蹬额度模式”与自动熔断恢复机制 (Fixes #3795) by @cubelikeplayDaniel in #3796
Full Changelog: v5.0.2-beta.2...v5.0.2-beta.3