Commit Graph

1450 Commits

Author SHA1 Message Date
fawney19
f52220a8ec Clean up planner candidate modules 2026-04-27 17:24:31 +08:00
fawney19
1d23bf4ecb Isolate standalone key wallet handling 2026-04-27 17:24:31 +08:00
fawney19
3b542434a2 Unify candidate ranking pipeline 2026-04-27 17:24:31 +08:00
Kayphoon
9b866a6d17 fix(auth): 修复独立密钥继承用户访问限制 (#347) 2026-04-27 12:32:21 +08:00
Entropy.Xu
d8f66b14a8 Handle Codex image stream rate limits (#346) 2026-04-27 12:23:48 +08:00
Entropy.Xu
6e1eaf8aec fix(kiro): 修复 Kiro WebSearch MCP 调用 (#344)
* fix(kiro): 接入 Kiro MCP web_search 工具调用

* fix(kiro): 对齐 Kiro IDE MCP 鉴权与 profileArn 头部

* fix(responses): 保留 Responses 嵌套与自定义工具参数

* test(ci): 通过 Rust Action 三项检查
2026-04-27 12:20:26 +08:00
fawney19
488bd08f04 Stabilize Kiro Claude CLI sync tests v0.7.0-rc18 2026-04-27 00:45:48 +08:00
fawney19
3991d47166 Fix format checks and local error messages 2026-04-27 00:27:03 +08:00
fawney19
0c73f245ab shrink formats conversion to compatibility facades 2026-04-26 23:59:53 +08:00
fawney19
989b27426b refactor formats adapters and matrix ownership 2026-04-26 23:59:53 +08:00
fawney19
c10cd8240e refactor ai formats registry adapters 2026-04-26 23:59:53 +08:00
fawney19
5cd2244bc2 fix frontend openai responses alias display 2026-04-26 23:59:53 +08:00
fawney19
0ec4b4c8a4 guard legacy openai alias compatibility 2026-04-26 23:59:53 +08:00
fawney19
4ec591fbf2 centralize openai responses alias handling 2026-04-26 23:59:53 +08:00
fawney19
ea3dc3257e clean up legacy openai cli adapter names 2026-04-26 23:59:53 +08:00
fawney19
5b914aa78c migrate ai format conversion to responses adapters 2026-04-26 23:59:53 +08:00
Entropy.Xu
e36fb8c07a Honor global format conversion override (#341)
Apply the global enable_format_conversion setting when building provider transport snapshots so enabled global conversion overrides provider-level settings at runtime.

Keep the cached provider snapshot unchanged so disabling the global switch restores each provider's original conversion configuration.
2026-04-26 23:54:52 +08:00
Kayphoon
1af9d00abd fix(gateway): 修复仅配置 provider retry 时 429 不重试 (#338)
- attempt.rs: 从 failover_rules/endpoint/provider 三级读取 max_retries 生成 attempt slots,支持配置 provider retry 后 429 自动重试,限制最大 99 并兼容 legacy 默认值 2
2026-04-26 23:50:14 +08:00
Entropy.Xu
e8763b3bbd fix(kiro): 放行可刷新 OAuth 调度候选 (#340) 2026-04-26 23:49:55 +08:00
AAEE86
f3a9fd4c82 feat(gateway): 补齐号池主动探测后台任务 (#342)
- 解析 pool_advanced 主动探测开关与间隔配置
- 对齐 Python 版本的探测间隔默认值和范围限制
- 新增号池配额主动探测 worker
- 支持 codex、kiro、antigravity provider
- 使用 Redis 时间戳和 provider 级锁避免重复探测
- 接入 gateway 后台任务并补充测试
2026-04-26 23:48:31 +08:00
fawney19
baa0ddd787 Improve runtime miss usage diagnostics 2026-04-26 01:44:54 +08:00
fawney19
1d3ea3232d Add unified candidate failure diagnostics 2026-04-26 01:38:37 +08:00
Entropy.Xu
d784c540b6 fix(kiro): 隐藏 OAuth 刷新重试流程 (#339) 2026-04-25 21:29:45 +08:00
fawney19
429fdb47e6 fix(usage): 简化本地执行错误提示 2026-04-25 20:46:22 +08:00
fawney19
912a92cd1a refactor(rules): 规则引擎容错优化,无效规则条目跳过而非中止整个规则集
- header/body rules 的 _are_locally_supported 简化为仅检查是否为数组
- apply 逻辑中遇到格式错误/不支持的规则条目改为 continue 跳过,而非 return false
- 允许非字符串 header value,自动序列化为 JSON 字符串
- 宽松处理无效 regex flag,不再拒绝整条规则

fix(gateway): Claude CLI 路由仅检查 bearer 头,不排斥同时携带 x-api-key 的请求

feat(observability): 监控链路候选展示解密 auth_config 的账号标签和 OAuth 计划类型
v0.7.0-rc17
2026-04-25 19:46:52 +08:00
fawney19
00744c0ce5 feat(observability): 引入错误链路 error_flow 元数据并区分上游/客户端错误
- 网关在本地 failover 时构建 error_flow 元数据(分类/决策/传播策略),写入 report_context
- scheduler-core 解析并透传 error_flow 至候选 extra_data
- admin usage 详情拆分 request/upstream/client/failure_summary 错误域,敏感上游错误标记为 suppressed
- 前端 RequestDetailDrawer 拆出"返回客户端"与"上游响应"双错误卡片
- HorizontalRequestTimeline 节点详情展示真实请求错误及 error_flow 标签
2026-04-25 17:01:07 +08:00
Entropy.Xu
bc97e383d3 fix(gateway): 对齐号池调度预设行为 (#332)
- 保持 sticky session 优先于分配模式排序,并支持 sticky_session_ttl_seconds=0 禁用粘滞绑定
- 移除旧版 free_team_first 预设入口,统一使用 free_first / team_first 新模式
- 对齐 plus_first 对 Plus/Pro 账号的优先级处理
- 调整负载均衡排序种子,避免同一分钟内固定命中同一 Key
- multi-score 预设下记录延迟样本,并补充号池调度/配置/运行时测试
- 收敛 request candidate extra_data 构造入参,修复 clippy too_many_arguments
2026-04-25 16:41:51 +08:00
RWDai
b8205b5a09 Fix/usage json entity escaping (#333)
* fix(usage): 修复 JSON 视图实体转义显示

* fix(usage): 解码 OpenAI 工具参数实体
2026-04-25 16:41:25 +08:00
Entropy.Xu
bb7fe9fe37 fix(kiro): 修复 Kiro OAuth 过期懒刷新 (#334)
* fix(kiro): 修复 OAuth 过期懒刷新

* fix(kiro): 修复 OAuth 过期懒刷新

* fix(scheduler): 修复 candidate extra data clippy 告警
2026-04-25 16:40:45 +08:00
fawney19
cef7dcac71 refactor(usage): 抽取 JsonContentPanel 通用 JSON 展示组件
请求详情抽屉与时间线统一复用工具栏(展开/收缩、复制)和 JSON 视图,时间线的额外信息也由 pre 改为可交互面板
2026-04-25 11:44:01 +08:00
fawney19
61e12e2c17 feat(scheduler): candidate report 携带 header_rules 与 body_rules
各 planner 在构造 report context 时附带端点的 header/body 改写规则,scheduler 解析后写入 candidate extra_data,便于追踪请求实际应用的透传规则
2026-04-25 11:43:53 +08:00
fawney19
65e915fd1d refactor(api-keys): 网关 API Key 改为 32 位字母数字随机串
由 UUID 拼接(48 位 hex)改为 base62 字母数字,缩短长度并提升可读性
v0.7.0-rc16
2026-04-25 10:04:04 +08:00
fawney19
1761921670 fix(usage): 移动端缓存 token 拆分为读/写两列展示
cache_read 与 cache_creation 原本被合并为单值,现分别显示并补充测试
2026-04-25 09:53:32 +08:00
fawney19
e5bbc797e0 chore(gateway): 调小 Postgres 连接池默认值
- max_connections 100 → 20
- idle_timeout 60s → 30s
- .env.example 补充连接池相关变量注释
2026-04-25 09:53:21 +08:00
fawney19
f30b1f3f6b fix(usage): 流式终端 usage 以更完整值为准,Codex CLI 显式选择 response 解析器
- 新增 StandardizedUsage::signal_score/is_more_complete_than/choose_more_complete,流式合并与终端落库均按信号完整度择优
- OpenAI Chat/CLI 解析器支持仅 usage 的终结 chunk 与 response.completed usage
- Codex provider 注入 provider_stream_event_api_format=openai:cli,解析器选择改由 report_context 显式决定
- usage_mapper 扩展嵌套 response/message/item 兼容 Claude message_start/message_delta 及 Gemini stream chunks
- usage SQL upsert 在终态(completed/failed/cancelled)时按 GREATEST 写入 token/费用镜像列
2026-04-25 00:57:01 +08:00
fawney19
2c6209277f fix(usage): Claude 流式合并 message_start/delta usage,前端移动端缓存 token 合并展示
- Claude provider state 在 message_start 记录基础 usage,message_delta 合并 output_tokens
- 前端 UsageRecordsTable 移动端缓存列改为 cache_creation + cache_read 合计展示
2026-04-24 22:28:04 +08:00
fawney19
5b3593038d fix(usage): OpenAI 缺失 input_tokens 时从 total 回推
- 同步与流式两条路径均在 input_tokens 为 0 且 total > output 时用 total - output 兜底
- 补充对应单元测试
2026-04-24 22:08:23 +08:00
Entropy.Xu
67b092253d fix(gateway): 兼容 OpenAI 图像 multipart boundary 大小写 (#331) 2026-04-24 21:41:20 +08:00
fawney19
db1059e73b fix(usage): 修复 Gemini total 重复累加 cache_read 并补充测试
- write.rs: Gemini usage 提取 total 时不再叠加 cachedContentTokenCount
- 补充 Claude 大 cache_read 场景下 input_tokens 不被扣减的测试
- 补充前端 getEffectiveInputTokens 对 Claude 格式不减 cache_read 的测试
2026-04-24 21:20:45 +08:00
fawney19
e265475c17 fix(usage): 修正 input_tokens 统计与显示
- SQL 查询不再用 settlement snapshot 的 billing_input_tokens 覆盖原始 input_tokens
- usage_mapper 针对 OpenAI 格式在 input_tokens 缺失时从 total_tokens - output_tokens 推导
- 前端轮询合并优先采用最新 record 的 input_tokens / effective_input_tokens
2026-04-24 20:59:12 +08:00
Entropy.Xu
343345529d fix(kiro): 修复 Claude CLI 跨格式 Responses 流式转换 (#329) 2026-04-24 20:23:02 +08:00
fawney19
657fcd595c refactor(rust): 拆分 usage sql 仓储为模块并外置 SQL 文件
- 将 usage/sql.rs 拆分为 sql/mod.rs 与 sql/tests.rs
- 将内联 SQL 抽离到 sql/queries/ 目录下的独立 .sql 文件
- 前端用量记录表格移除缓存创建 token 展示,保留 cache read 列
2026-04-24 20:22:24 +08:00
fawney19
d0d71aa51a fix(gateway): OpenAI 图像 finalize 统一返回 b64_json 并对齐 codex CLI 候选流式上游
- finalize 移除 response_format=url 的 data URL 分支,统一输出 b64_json
- image planner decision 依据请求体中的 stream 字段决定 upstream_is_stream
- openai chat sync plan 对 codex+openai:cli 候选强制上游流式
- 扩充 conversion registry 与 standard matrix 的全量 surface 对端测试
v0.7.0-rc15
2026-04-24 19:01:11 +08:00
AAEE86
4618184516 fix: 修复账号批量操作快捷多选不生效和今日 Token 不准确 (#328)
* fix(pool): 修复账号批量操作快捷多选不生效

- 解析号池账号列表接口的 quick_selectors 查询参数
- 列表查询复用现有快捷筛选匹配逻辑
- 支持冷却列表与普通列表的快捷筛选后分页
- 更新架构测试中的 pool admin helper 边界断言

* fix(dashboard): 今日 Token 改为按分项汇总口径展示

- /api/dashboard/stats 的 today.tokens 改为 输入+输出+写缓存+读缓存
- “今日 Token”卡片 value 与 subValue 口径保持一致
- 同步更新 dashboard 相关测试断言
2026-04-24 18:36:38 +08:00
fawney19
3cc54deb9c fix(gateway): SSE 流跳过成功探测与 prefetch,统计聚合 SQL 显式 CAST BIGINT
- stream: event-stream 响应跳过 direct finalize prefetch 与成功失败转移探测,避免消费流首帧
- stream_pump: 仅在已知 content-length 时缓冲非 SSE 响应
- maintenance: usage_billing_facts 聚合列显式 CAST 为 BIGINT,避免类型不匹配
2026-04-24 18:14:59 +08:00
fawney19
f695238e8a feat(billing): 引入 billing v3 settlement snapshot 及 usage_billing_facts 视图
- 新增迁移 20260424000000:为 usage_settlement_snapshots 添加 settlement_snapshot、
  billing_dimensions、billing_input/output/cache tokens、billing_total_cost_usd 等列,
  并创建 usage_billing_facts 视图(从 settlement snapshot 覆盖原始 usage token/cost 字段)
- event_enrichment:构建结构化 settlement_snapshot(含 pricing_snapshot、billing_plan_snapshot、
  resolved_dimensions、cost_breakdown 等),写入 request_metadata
- pricing:新增 pricing_source() 方法区分 provider_override / global_default / unpriced
- sql.rs:settlement snapshot 写入新列;用量汇总查询改用 usage_billing_facts 视图
- maintenance/runtime:所有统计查询的 FROM usage 替换为 FROM usage_billing_facts
- admin observability:在 settlement 响应中暴露 settlement_snapshot / billing_dimensions,
  并从 metadata 中剥离对应字段
- request_metadata:允许 settlement_snapshot / billing_dimensions 字段传播
- stream execution:在首个数据帧到达时记录 TTFB,补全流式请求的 streaming 事件
2026-04-24 17:52:33 +08:00
Entropy.Xu
fb46fcd80f feat(rust): 对齐 SMTP 测试与注册邮件 TLS 链路 (#325)
* feat(rust): 对齐 SMTP 连接测试链路

* fix(rust): 修复注册邮件 TLS provider 初始化
2026-04-24 14:59:00 +08:00
fawney19
e0c928fbe8 feat(auth): /me 接口返回 has_password 字段,前端 Profile 类型同步调整 2026-04-24 14:52:49 +08:00
fawney19
780f09c1a2 feat(billing): 引入 model_id 精确计费查找路径,传播模型 ID 至用量事件与 report context
- UsageEventData 新增 model_id / global_model_id 字段,write.rs seed 结构体同步补充
- report_context 新增 model_id / global_model_id / global_model_name,各 payload 构建时从 candidate 传入
- event_enrichment 优先按 model_id 精确查找计费上下文,回退为按名称多轮查找(保留 NoRule 结果降级逻辑)
- BillingReadRepository 新增 find_model_context_by_model_id,memory/sql 分别实现;SQL 查询重构支持按 provider_model_name 和 mappings 匹配并按优先级排序
- pricing.rs 修复:model_tiered_pricing 为空 tiers 时回退到 default_tiered_pricing
- request_metadata 允许字段列表补充 model_id / global_model_id / global_model_name
- admin usage 路由信息输出及脱敏字段列表同步新增三个 model 相关字段
2026-04-24 14:40:28 +08:00
fawney19
f3c9835759 feat(pool): 引入 pro_first 调度预设、Pool 候选持久化跳过与诊断信息优化
- 新增 pro_first 调度预设(Pro 优先),更新 plus_first 仅针对 Plus 计划,移除 free_team_first
- Pool 内部候选(pool_key_index 不为空)跳过 DB 持久化(available/skipped/unused 均适用)
- LRU 排序新增 catalog_lru_score 回退:runtime 无记录时使用 last_used_at_unix_secs
- 执行路径 miss 诊断消息细化为中文,按 reason 分类输出可读说明
- build_local_request_candidate_status_record 补充 extra_data 和 created_at_unix_ms 字段
- OpenAI CLI 计划构建流程补充候选评估进度跟踪与 terminal reason 设置
- 前端 PoolSchedulingDialog 增加 pro_first 预设展示,修复 LRU 默认预设检测逻辑
2026-04-24 13:29:05 +08:00