fawney19
1000b706be
fix(gateway): 收紧本地 usage 测试轮询条件
2026-04-14 01:55:13 +08:00
fawney19
53acfbabf6
refactor(gateway): 重构 ai pipeline 规划链路
2026-04-14 01:27:04 +08:00
fawney19
4fd2b4a014
fix(gateway): 修复 balance 刷新去重键冲突、usage 状态回退与测试竞态
...
- balance_cache: 引入实例级 refresh key 防止多实例共享进程级 HashSet 冲突
- InMemoryUsageRepo: 阻止 pending/streaming 状态覆盖已终结(completed/failed/cancelled)记录
- usage 同步测试: 等待条件从 is_some() 改为检查 status=="completed" 避免竞态
- wallet 测试: 增加轮询等待 wallet 扣款完成
- 整理 import 语句与 tests 模块位置
2026-04-13 16:48:05 +08:00
fawney19
9a376e4223
refactor(admin): 将排行榜排序与排名函数移至 tests 模块之前
2026-04-13 16:13:18 +08:00
fawney19
6aa16ec792
feat(data): 废弃 usage 表 HTTP/结算列,迁移至 settlement_snapshots 与 http_audits
...
- 新增迁移 20260413030000:标记 billing_status、finalized_at、request_headers 等列为 DEPRECATED
- 更新 baseline_v2.sql 同步废弃注释,BASELINE_V2_CUTOFF_VERSION 升至 20260413030000
- usage/sql.rs:inline body 阈值归零,强制所有 body 走 blob 存储;upsert 时清空 legacy header/output_price 列
- 查询层优先读 usage_settlement_snapshots 的 billing_status、finalized_at、output_price_per_1m
- runtime.rs:stale usage 处理同步写入 usage_settlement_snapshots;SELECT FOR UPDATE 改为 FOR UPDATE OF usage
- 前端:PerformanceAnalysis 页面重构为实时面板,新增 prometheus 工具函数与 monitoring API
2026-04-13 14:53:46 +08:00
fawney19
e46629d11a
fix(frontend): 统一 Usage 页面默认时间范围为 today
2026-04-13 14:14:07 +08:00
fawney19
5bb08e6aa4
feat(gateway): 重构 usage 数据层、迁移系统与系统导入
...
数据库迁移:
- 引入 baseline v2 bootstrap,空库首次启动自动初始化
- 服务启动不再自动执行迁移,需显式 `--migrate` 运行
- 新增 pending migration 检测,schema 落后时拒绝启动
Usage 数据层:
- usage body 存储外部化为独立 blob 表
- 新增 HTTP audit 表拆分存储请求/响应头与 body ref
- 后台清理任务支持 legacy body ref 元数据迁移
- usage runtime 写入迁移到专用 tokio runtime(独立线程池, 8MB 栈)
系统导入/导出:
- 支持用户、API Keys、钱包数据的完整导入
- 兼容 legacy 与 v1.3+ 两种导出格式
其他改进:
- executor outcome 增加 runtime miss 诊断上下文
- 主 tokio runtime 栈大小调整为 8MB
- 前端 provider 管理支持 base URL 配置
- dev.sh 支持 --migrate 参数
2026-04-13 14:01:22 +08:00
fawney19
3698e5a833
fix(test): 修复 MutexGuard 跨 await 点的 Clippy 警告
2026-04-12 16:22:29 +08:00
fawney19
f84febbf89
fix(proxy): 修复 Clippy dead_code 与 too_many_arguments 警告
2026-04-12 16:19:23 +08:00
fawney19
e029012f73
Merge pull request #289 from AAEE86/rust
...
fix(usage): 统一使用记录与仪表盘的缓存命中率计算口径
2026-04-12 16:12:22 +08:00
fawney19
9703840a36
feat(proxy): 实现代理节点批量升级回滚、隧道重定向跟随及远程配置管理
...
核心功能:
- 新增代理节点批量升级回滚工作流,支持分批升级、健康探针、跳过/重试/取消等操作
- proxy 隧道流处理器支持 HTTP 重定向跟随(最多 10 跳),区分 307/308 可重播与不可重播请求体
- proxy 协议新增 follow_redirects / http1_only 字段,网关侧同步支持
- 新增代理节点远端配置变更接口(名称、允许端口、调度状态、升级目标等)
- 新增代理节点注册/反注册/心跳的 Admin API,及节点过期清理维护任务
- gateway 隧道 owner-relay 支持流式代理大请求体,新增 5 MiB 默认限制
- 新增 ProxyNodeRegistrationMutation / ProxyNodeRemoteConfigMutation 数据类型
- proxy 配置新增重定向重播预算、心跳间隔等参数,TUI 安装向导同步更新
- 前端 ProxyNodes 页面新增批量升级操作面板及滚动进度展示
2026-04-12 16:02:38 +08:00
fawney19
7c5bb7f383
fix(admin): 修复系统配置导入的多项兼容性问题
...
- 引入 serde_path_to_error,反序列化失败时返回精确字段路径
- 为所有浮点字段新增数字字符串兼容反序列化器,支持 Python 序列化格式
- 修复 OAuth provider key 导入:正确写入加密的 api_key 和 auth_config
- 优化代理节点跳过提示,区分手动 URL 代理与 node_id 引用代理
- 新增测试覆盖上述场景
2026-04-11 23:10:25 +08:00
fawney19
a9f610fa69
feat(admin): 实现系统数据导入导出功能,支持提供商和模型批量配置
2026-04-11 21:39:04 +08:00
fawney19
801e16c988
refactor(gateway): 统一 AETHER_GATEWAY_BIND 为 APP_PORT,新增 API Key 前缀配置和启动自举管理员
...
- 绑定地址固定 0.0.0.0,仅通过 APP_PORT 控制端口,简化 CLI/Docker/systemd/dev.sh/前端代理全链路
- 新增 API_KEY_PREFIX 环境变量,抽取 handlers/shared/api_keys.rs 消除 admin/public 重复逻辑
- 新增 bootstrap_admin.rs,启动时通过 ADMIN_* 环境变量在无管理员时自动创建首个本地管理员
- 前端密码输入改用 type=password,API Key 占位符改为动态前缀
- 删除过时的 pyproject.toml/uv.lock 和旧部署文档
- 更新 .env.example/README 反映新配置项
2026-04-11 17:39:02 +08:00
fawney19
a570a77cca
fix(data): baseline 迁移末尾恢复 search_path 为 public,确保 sqlx 记账正常
2026-04-11 16:17:02 +08:00
fawney19
b0f068cc5d
ci(rust): 移除冗余的 build_release job,测试已覆盖编译
2026-04-11 15:33:04 +08:00
fawney19
fff82de933
fix(data): baseline 迁移 search_path 改为事务级作用域,修复 sqlx 迁移表访问问题
2026-04-11 15:29:13 +08:00
fawney19
8a4a41fcef
fix(docker): 容器以 root 运行,解决日志目录写入权限问题
2026-04-11 15:07:44 +08:00
fawney19
aa5761954e
refactor(data): baseline 迁移改为完整幂等建库脚本,放宽 checksum 校验
...
- baseline migration 从占位 SELECT 1 替换为完整的幂等 DDL,支持全新数据库从零建库
- 迁移校验从 checksum 严格报错改为 warn-only,仅按版本匹配
- 移除过时的 schema 导出文件(README/TSV)
- Dockerfile 移除 :nonroot 标签,docker-compose 移除 user 指令,统一以默认用户运行
2026-04-11 14:31:28 +08:00
fawney19
8cd2c4d5bd
fix(gateway): 默认监听端口改为 8084 以支持非 root 运行
...
- Dockerfile 及 main.rs 默认 bind 从 0.0.0.0:80 改为 0.0.0.0:8084
- docker-compose 以 UID:GID 非 root 用户启动 app 容器
- compose 端口映射与容器内监听端口保持一致,通过 AETHER_GATEWAY_BIND 注入
2026-04-11 13:55:11 +08:00
fawney19
940a28cff4
chore: 清理 .env.example 中过时的 Python 运行时配置项
2026-04-11 13:12:28 +08:00
fawney19
c95feea286
chore: 清理过时的 Python 遗留配置和文档
...
- .dockerignore 移除 Python 相关忽略规则和废弃的 dist 放行条目
- README 更新密钥生成为 shell 脚本,移除过时的 systemd 部署章节
- deploy.sh 从哈希计算中移除已删除的 entrypoint.sh
2026-04-11 13:00:04 +08:00
fawney19
1d896467dc
fix(build): .dockerignore 放行 dist/aether-gateway-* 和 dist/frontend/
2026-04-11 12:49:40 +08:00
fawney19
3a655440b9
chore: 移除过时 Python 脚本,密钥生成改用 shell 脚本
...
- generate_keys.py 替换为 generate_keys.sh (无需 Python 依赖)
- 移除已废弃的 backfill_provider_key_status_snapshot.py
2026-04-11 12:43:19 +08:00
fawney19
80bae8bc2a
fix(build): ldap3 切换到 rustls 后端以消除 openssl-sys 依赖
...
musl 交叉编译时 openssl-sys 找不到系统 OpenSSL, 改用 tls-rustls feature
2026-04-11 12:36:35 +08:00
fawney19
f68c67021c
refactor(build): 切换到 musl 交叉编译 + distroless 镜像方案
...
- docker-publish.yml: 改为 cross 交叉编译 amd64/arm64 musl 静态二进制,
前端在 CI 独立构建, buildx 组装多架构镜像
- Dockerfile.app: 从 139 行容器内编译简化为 24 行纯 COPY 打包
- Dockerfile.app.local: 移除 jemalloc 动态链接 (LD_PRELOAD/libjemalloc2)
- aether-gateway: 引入 tikv-jemallocator 静态链接 jemalloc
2026-04-11 12:21:33 +08:00
fawney19
e37a32c83d
chore(deploy): 默认镜像标签切换为 pre 以跟踪预发布版本
2026-04-11 10:48:34 +08:00
fawney19
ec0bde819a
refactor: 简化 outcome clippy lint 并移动 usage 测试模块至文件末尾
2026-04-11 09:35:31 +08:00
fawney19
848f99d3e5
merge(pr287): absorb remaining rust branch changes
...
Absorb the remaining changes from PR #287 into aether-rust-pioneer after resolving conflicts locally and preserving the admin fixes already landed in this branch.
Closes #287
Co-authored-by: AAEE86 <ppk0227@hotmail.com >
2026-04-11 03:10:16 +08:00
fawney19
34d295c1e0
fix(admin): align global model responses with repository counts
2026-04-11 02:55:02 +08:00
fawney19
a54ac76688
fix(admin): restore pool key usage aggregates
2026-04-11 02:54:54 +08:00
fawney19
cf02a10050
chore: 调整 Postgres 连接池默认参数:增大最大连接数、缩短获取超时
2026-04-11 02:26:33 +08:00
fawney19
6144473ebe
feat: 新增 frontdoor 执行回环守卫与多项可观测性增强
...
- 新增 frontdoor_loop_guard 模块,检测并拒绝 execution runtime 回环到本地网关的请求(HTTP 508)
- candidate loop 引入 span tracking、执行尝试日志与流式看门狗超时
- 本地故障转移策略支持从 report_context 加载,新增 append_local_failover_policy_to_value
- runtime tracing 美化:移除 identity 前缀,按 span 深度树形缩进,target 固定宽度展示
- Codex OpenAI CLI 补齐 chatgpt-account-id/x-client-request-id/session_id/conversation_id 请求头
- OpenAI CLI same/cross-format 聚合规则放宽以支持 openai:compact 客户端格式,并过滤 error-like 响应体
- auth/proxy/finalize 日志补充 user_id/api_key_id/api_key_name/balance_remaining 等字段
- 启动日志拆分为 starting/ready/config 三段,新增 resolve_bind_http_base_url
- access_log middleware 将生成的 trace_id 回注到下游请求头
- Cargo.toml 启用 serde_json preserve_order 特性
2026-04-11 01:50:24 +08:00
fawney19
3f057628b7
fix: 修正用量失败状态判断与 Codex 会话头
2026-04-10 21:33:34 +08:00
fawney19
46f1507d44
feat: 提前记录 pending 用量、优化流遥测时序与前端活跃请求发现机制
...
- 将 record_pending 调用移至执行开始前(sync/stream 两路),确保请求在执行前即有 pending 记录
- stream_pump 在收到第一个数据块前优先 yield 遥测帧,保证 ttfb 早于 data 帧到达
- stream execution 增加 should_refresh_stream_usage_telemetry,在遥测帧携带新 ttfb/elapsed 时及时更新 record_stream_started
- access_log 对高频轮询路径(usage/active、usage/records 等)降级为 TRACE 日志,减少日志噪音
- 前端新增 reconcileActiveRequestDiscovery 工具函数及 discoverActiveRequests 逻辑,活跃请求发现与全局自动刷新解耦,空闲时降频为 5 秒扫描
- RequestDetailDrawer 调整:进行中请求不再自动开启轮询,由用户手动触发;刷新按钮 title 动态适配状态
2026-04-10 20:58:01 +08:00
fawney19
d5b8583d6b
fix: 修正时间戳精度、TTL 定价匹配逻辑及账单快照展示
...
- 将 created_at_unix_ms 从 current_unix_secs 改为 current_unix_ms,修正候选尝试和跳过记录的时间戳精度
- formula_engine: TTL 定价从「<=上限」模糊匹配改为精确匹配,null 值改为回退到基础价格而非透传
- 新增 ttl_pricing_requires_exact_match 和 ttl_pricing_null_value_falls_back_to_base_tier_value 测试用例
- service: 新增 5min/1h cache TTL 的端到端计费验证测试
- RequestDetailDrawer: 优先从 billing_snapshot 读取已解析的价格和费用,正确展示当前 TTL 对应的缓存创建/读取价格,修正输入/输出/缓存费用列的数据来源
2026-04-10 18:50:59 +08:00
fawney19
010ab127e2
feat: 扩展 cache creation token 细分统计与 effective_input_tokens 计费逻辑
...
- 新增 cache_creation_ephemeral_5m/1h_input_tokens 字段,区分不同 TTL 的缓存写入 token
- 引入 effective_input_tokens(扣除 cache read 后的有效输入 token),暴露给 usage 接口
- billing 规则生成器支持 5m/1h ephemeral cache 独立定价与分级计费
- usage_mapper 增加 Claude/Anthropic 格式映射,修复 OpenAI responses 格式字段兼容性
- 迁移逻辑增强:支持 checksum 容错、applied/pending 数量日志、逐步执行信息输出
- executor 抽离 LocalExecutionRequestOutcome 类型,统一 sync/stream 路径返回语义
- provider-transport auth 层新增 complete passthrough headers 构建逻辑
- 前端 usage 类型全面补充 effective_input_tokens、cache_creation_tokens、total_input_context 字段
2026-04-10 17:44:55 +08:00
fawney19
5014e2f5fd
refactor: 抽离 AI pipeline 与调度共享能力逻辑
2026-04-10 01:46:14 +08:00
fawney19
b901a6ffc7
chore: 移除废弃的 build-hub workflow,格式化测试代码
2026-04-09 14:01:37 +08:00
fawney19
fe81eafe2c
feat: 增强 provider query 端点选择逻辑,支持 openai:responses 格式与 key 级 api_formats 过滤
...
- provider_query_selected_fetch_endpoints 支持按 key.api_formats 过滤可用端点
- 端点选择增加 endpoint_supports_rust_models_fetch 检查
- 支持优先级列表之外的自定义 api_format 端点
- 新增 openai:responses 端点的 provider query 集成测试
- 各 crate 补充缺失的 tracing instrument 和小修正
- 前端 Pool 管理页面补充状态逻辑
2026-04-09 13:55:18 +08:00
fawney19
b0b40c16ff
feat: 全栈功能增强 - 扩展 provider/pool 管理、完善调度与数据层、重构前端 Pool 页面
...
后端:
- 扩展 pool_admin payloads 和 provider query models,增强 endpoint key 管理
- 完善 scheduler-core 候选排序与请求候选逻辑
- 增强 usage-runtime 写入、provider-transport 网络层与 OAuth 刷新
- 改进 AI pipeline 响应转换与流式处理
- 扩展 global_models/provider_catalog 数据层查询能力
- 增强 video-tasks-core 多 provider 支持
- 新增大量集成测试覆盖 pool/keys/provider_query/frontdoor
前端:
- 重构 PoolManagement 页面,拆分状态管理/对话框逻辑到独立模块
- 新增 poolAdvancedDialog/poolSchedulingDialog/poolManagementState/poolMobilePresentation 工具函数及测试
- 改进 Dialog 组件与 provider tabs 显示
部署:
- 更新 Rust CI workflow 和 Dockerfile 构建配置
Closes #275
Co-authored-by: AAEE86 <ppk0227@hotmail.com >
2026-04-09 13:51:50 +08:00
fawney19
4fc95adfb9
refactor: 大规模模块拆分与重组,新增 aether-admin crate
...
- 新建独立 aether-admin crate 承载 admin 相关共享契约与纯辅助函数
- 拆分 ai_pipeline 下 kiro/private_envelope/conversion/planner 等大文件为子模块目录
- 重组 admin handlers 各业务域(billing/oauth/provider/system/users 等)为目录结构,移除 shared.rs/builders.rs 等反模式
- 移除 ai_pipeline runtime adapters 旧实现(claude/openai/gemini/kiro/vertex/antigravity 等),改由 provider transport 统一承载
- 移除 control_facade/execution_facade/auth_snapshot_facade 等冗余 facade 层
- 拆分 query/billing 与 query/monitoring 模块、state/runtime/payments 与 security 模块
- 扩展架构测试覆盖 admin_billing/admin_model/admin_users 等新模块
- 删除 docs/architecture/refactor-execution-plan.md 已完成的执行计划文档
2026-04-09 00:10:38 +08:00
fawney19
4fb9882b54
refactor: 拆分 admin handler 大文件为模块目录,消除 shared.rs 反模式
...
- endpoint_keys/pool/architecture 等大文件拆分为独立模块目录
- 删除 crud/query/strategy/system 中的 shared.rs,内容归位到各自模块
- endpoints_admin/models/oauth/write 等模块拆出 payloads/responses/support 子文件
- system/core 下多个 *_routes.rs 合并到 system_routes.rs
- 更新 refactor-execution-plan 文档进度
2026-04-07 12:15:19 +08:00
fawney19
29055c575f
refactor: 拆分 system.rs 大文件,将 email_templates/proxy_errors/system_config 下沉到 shared 层
...
- 删除 1666 行的 admin/system/shared/system.rs,按职责拆分到独立模块
- 新增 handlers/shared/email_templates.rs 和 system_config_values.rs 存放跨层共用的模板/配置工具函数
- 新增 admin/system/shared/email_templates.rs 存放 admin 专用的模板操作逻辑
- 新增 admin/shared/proxy_errors.rs 存放 build_proxy_error_response
- 清理 public/system_modules_helpers 中不属于 public 层的导出
- 新增架构测试守护模块归属边界
2026-04-07 08:19:26 +08:00
fawney19
5d96d6673b
refactor: 大规模模块拆分与代码精简,新增 ai-pipeline/data-contracts 独立 crate
...
- 新增 aether-ai-pipeline 和 aether-data-contracts crate,将 pipeline 逻辑与数据契约从 gateway 中解耦
- 重构 admin handlers:拆分单体模块为 auth/billing/endpoint/features/model/observability/provider/system 等独立子模块
- 合并 chat/cli 重复代码路径:精简 conversion、finalize、planner 中的 sync/chat/cli 分支
- 重构 scheduler/executor/data 层,引入 facade 模式降低模块间耦合
- 移除冗余的 intent 模块,将 plan_fallback/policy/stream_path/sync_path 迁移至 executor
- 前端适配:调整 admin API 调用和 provider 模型测试对话框
2026-04-07 02:50:19 +08:00
fawney19
763ff03a7b
refactor: 拆分 gateway 单体为独立 crate,新增 systemd 部署方案
...
将 gateway 内部的 model-fetch、provider-transport、scheduler-core、
usage-runtime、video-tasks-core 模块提取为独立 crate;重构 gateway
内部模块结构(state/router/cache/data/query 等);移除大量遗留模块
文件;新增 systemd 二进制部署骨架及相关文档;更新前端 usage 相关
API 和组件。
2026-04-05 20:23:16 +08:00
fawney19
cbc811f6ce
refactor: 移除 Python upstream 依赖,清理全部 legacy/Python 兼容层
...
- 移除 upstream_base_url 参数及 AETHER_GATEWAY_UPSTREAM 环境变量,gateway 不再需要指向 Python 宿主
- 删除所有 LEGACY_*/PYTHON_* 常量、路由组、header 定义及 sunset/phaseout 机制
- 将 legacy_gateway_bridge 重命名为 internal_gateway,executor 相关命名统一为 execution_runtime
- dev.sh 新增 Postgres/Redis 预检查,移除 upstream 相关启动参数和提示
- 新增 ai_public 路由处理器
- 全量适配 handler、test、state、control 等模块的命名和接口变更
2026-04-04 01:40:24 +08:00
fawney19
1d9c77522a
refactor: 移除 Python 后端源码,全面迁移至 Rust gateway 架构
...
- 删除全部 Python 源码 (src/) 及 Alembic 迁移脚本,归档至 _deprecated_py_src/
- 重构 Rust gateway ai_pipeline: 拆分 planner/finalize 模块,新增 contracts/adaptation 层
- 重组 handlers 模块为 admin/public/proxy/internal/shared 子模块结构
- 新增 executor 模块,引入 Rust 原生数据库迁移 (aether-data/migrations)
- 简化 CI/Docker 构建流程,移除 base image 二级构建,统一为单一 app image
- 移除 Python 相关基础设施文件 (entrypoint.sh, gunicorn_conf.py, Dockerfile.base)
2026-04-03 16:26:16 +08:00
fawney19
8f26e1a31f
refactor: 移除独立 hub/proxy/executor/gateway crate,统一为 gateway tunnel 架构
...
- 删除 aether-hub、aether-proxy 独立项目及其 Dockerfile/配置
- 删除 crates/aether-executor 和 crates/aether-gateway 全部模块
- 新增 apps/ 目录作为应用入口
- 将 hub 概念重构为 gateway tunnel transport
- 将 executor 重构为 execution runtime
- 新增 tunnel.rs 合约定义和 testkit tunnel/execution_runtime 模块
- 更新 Python 服务层和测试适配新架构命名
2026-04-03 14:59:58 +08:00
fawney19
ddf18fed9a
feat: 扩展 Rust gateway 全功能模块,新增 billing/crypto/wallet crate 及完整数据层
...
- 新增 aether-billing、aether-crypto、aether-wallet 独立 crate
- aether-data 扩展 repository 层:announcements、auth_modules、billing、
candidate_selection、gemini_file_mappings、global_models、management_tokens、
oauth_providers、proxy_nodes、quota、users、wallet 等模块
- aether-gateway 新增 api/auth/billing/control/middleware/scheduler/usage/
video_tasks/hooks/maintenance/model_fetch/provider_transport 等功能模块
- 重构 executor decision 和 gateway state 为模块目录结构
- 新增 gateway router、frontdoor 路由层及对应测试
- Python 侧 API 路由重构,新增 compat/support 模块
- 前端 Logo 组件更新及 Provider 管理页面调整
2026-03-31 19:19:04 +08:00
fawney19
b5a0070023
feat: 引入 aether-runtime/cache/data/http/testkit 基础 crate,完善并发门控与审计系统
...
新增 crate:
- aether-runtime: 服务运行时基础设施(并发门控、分布式并发、指标、队列、优雅关闭、tracing)
- aether-cache: 通用 TTL 缓存与命名空间抽象
- aether-data: 数据访问层(PostgreSQL/Redis 后端、repository 模式)
- aether-http: HTTP 客户端封装(重试、配置)
- aether-testkit: 集成测试工具集(gateway/executor/hub/proxy fixture、等待、负载测试)
gateway 扩展:
- 引入 audit 模块(shadow 执行审计、决策链路追踪、请求审计 bundle)
- 引入 cache 模块(AuthContext 缓存、direct-plan bypass 缓存)
- 引入 data 模块(auth/candidates/config/usage/video_tasks 数据访问)
- 集成 ConcurrencyGate/DistributedConcurrencyGate 请求门控
- 新增本地 auth 拒绝、过载响应构建器
- 补充 control/auth_cache/video/concurrency 集成测试
aether-proxy 扩展:
- AppState 集成 stream_gate / distributed_stream_gate 并发门控
- 新增 ProxyAdmissionError 及准入拒绝流程
- stream_handler 补充门控饱和/不可用场景测试
- 配置与注册客户端逻辑完善
aether-hub 扩展:
- main.rs 引入运行时初始化、指标端点、健康检查
- local_relay 重构为 lib.rs 暴露公共接口
2026-03-24 15:12:56 +08:00
fawney19
eaf8475f9e
refactor: 拆分 Rust gateway/executor 大文件为模块目录结构,拆分 Python gateway.py 为子模块
...
Rust 侧:
- executor.rs 拆分为 executor/ 目录 (plan_builders, stream, sync, submission)
- 新增 kiro_stream/, local_finalize/, local_stream/ 模块目录
- 新增 video_tasks.rs
- 测试文件 ai_execute/files/video 拆分为子目录
- handlers/headers/control/constants 扩展支持新模块
Python 侧:
- gateway.py 拆分为 24 个子模块 (routes, shared, contract, chat, cli, video, files, finalize, reporting 等)
- 新增 antigravity/gemini_cli/kiro 的 rust_http 适配层
- upstream_fetcher 增加 Rust sidecar 支持
- executor_plan/candidate/pipeline 适配调整
测试:
- 对应拆分 test_internal_gateway_routes 为子目录
- 新增 rust_http 相关测试
2026-03-23 17:19:15 +08:00
fawney19
455234e797
feat: 实现 executor 流式执行路径及完善 gateway 多格式 plan 构建
...
- Rust executor 新增流式 plan 支持,覆盖 openai/claude/gemini 的 chat/cli/video 格式
- Gateway 新增 finalize-sync、report-stream 端点及 stream report 模型
- 新增 video sync 操作(create/cancel/remix/delete)的 plan 构建
- 修正 OpenAI Responses(openai:cli) SSE 格式: 添加 event: 行、移除 [DONE] 哨兵
- 统一 OpenAI CLI normalizer 的 ID 生成方法
2026-03-21 15:51:37 +08:00
fawney19
53bb23b510
feat: 实现 executor sync 执行路径及 plan-sync/report-sync 端点
...
Rust gateway 新增同步执行模式,支持 AI 请求(OpenAI/Claude/Gemini chat/cli)
及 Gemini Files CRUD 通过 executor 直接同步执行,执行完成后通过 report-sync
端点向 control 回报结果。Python 侧新增 /plan-sync 和 /report-sync 内部端点,
构建同步执行计划并处理结果上报。包含完整测试覆盖。
2026-03-21 14:07:45 +08:00
fawney19
d735b6316f
feat: 引入 Rust executor/gateway sidecar 及 Python 侧双后端适配
...
- 新增 Rust workspace crates: aether-contracts, aether-executor, aether-gateway
- aether-executor: 支持 Unix Socket/TCP 双传输模式,处理同步/流式上游请求
- aether-gateway: 作为本地主入口代理,集成 /api/internal/gateway/resolve 认证预解析
- Python 侧新增 ExecutionPlan 契约和 RustExecutorClient,各 handler 支持
executor_backend=rust 时将可序列化请求转发给 Rust executor 执行
- 重构 dev.sh 支持 executor/gateway 进程编排与生命周期管理
- 新增 internal gateway 路由,提供 resolve/passthrough 端点
- handler 层(chat/cli/video/endpoint_checker 等)全面适配 Rust executor 回退逻辑
- pipeline 层支持 trusted auth context 跳过重复认证
- 新增 Rust CI workflow 及对应测试用例
2026-03-21 12:57:09 +08:00
fawney19
46737d32f8
feat: 引入 status_snapshot 统一 provider key 状态管理
...
- 新增 StatusSnapshot 模型,聚合 OAuth / 账号 / 配额三维状态
- 新增 StatusSnapshotStore 负责快照的持久化与查询
- 重构 response_builder / endpoint_models,基于 snapshot 输出状态字段
- 前端抽取 providerKeyStatus / oauthRefreshFeedback 工具函数,
统一 PoolManagement、ProviderDetailDrawer、BatchDialog 的状态展示
- errorParser 增加已知 OAuth 错误的友好提示
- refresher 适配 snapshot 写入,account_state 扩展状态分类
- 新增 alembic 迁移及存量数据回填脚本
- 补充前后端单元测试
2026-03-20 19:16:52 +08:00
fawney19
25d38ae632
feat(oauth): 账号封禁前置 OAuth 验证、抽取 provider_context、完善账号状态分类
...
- 新增 verify_oauth_before_account_block:在标记账号封禁前先尝试刷新 token,
区分 OAuth 过期与真正的账号级封禁,避免误标
- 抽取 provider_context.py 统一解析 provider_type,解决 ORM detached 访问问题
- account_state 新增 workspace_deactivated 分类和 auto-removable 状态集合,
补充中文验证关键词匹配
- OAuth refresh 成功后仅清除可恢复的 token 错误,不再自动清除账号级 block
- deploy.sh 依赖指纹改用纯 shell 实现,移除对 Python tomllib 的依赖
- 前端 Pool 管理页面新增筛选和批量操作优化
- 补充对应测试用例
2026-03-20 16:50:59 +08:00
fawney19
aa83b4a7a7
fix: 加固续租失败处理、verify_auth 异常捕获及调度器注册追踪
...
- task_coordinator: 续租连续失败 5 次后主动触发 lock_lost 回调,失败间加指数退避
- proxy_nodes: lock_lost 回调由 lambda 改为具名 async 函数,确保异步停止逻辑正确执行
- provider_ops: 将 prepare_verify_config 纳入外层 try,捕获 ValueError 并返回失败响应
- maintenance_scheduler: 用 _registered_job_ids 动态追踪已注册任务,stop 时按列表清理
- stats_aggregator: 内联 _do_aggregate 为 for/range(2) 循环,消除内嵌函数
2026-03-20 01:22:07 +08:00
fawney19
913ce2dbcb
Merge pull request #252 from AAEE86/nn
...
fix(startup): 收口 leader 失锁后的后台任务
2026-03-20 01:13:01 +08:00
fawney19
cae5e520ac
fix(frontend): 修复 restoreOriginalPlaceholder 递归调用、优化日志参数格式,补全 tsconfig lib 配置
2026-03-20 01:06:15 +08:00
fawney19
772f2ea601
fix(vertex): SA 认证注入代理配置,细化 token 获取异常处理
...
- _auth_service_account 接收 endpoint 参数,通过 _get_proxy_config 解析代理
- vertex_auth 区分 TimeoutException/RequestError/通用异常,提供可读错误信息
- 新增测试覆盖代理传递和超时场景
2026-03-20 00:49:44 +08:00
fawney19
28fa03451c
feat(provider): 模型测试支持自定义请求头,优化对话框布局与并发策略
...
- 前后端新增 request_headers 字段,测试时可自定义额外请求头
- ModelTestDialog 拆分为请求头/请求体并排双栏布局,增加格式化与重置按钮
- 区分 Pool 托管(并发5)和单 Key Provider(并发1)的测试并发数
- JsonImportInput 新增 multiple prop 支持单文件模式
- KeyFormDialog Service Account 输入改用 JsonImportInput,支持拖拽导入
2026-03-20 00:24:56 +08:00
fawney19
6984984c22
feat(provider): 重构模型测试对话框,加固 Vertex AI 传输层
...
模型测试:
- 将消息输入替换为完整 JSON 请求体编辑器,支持格式化和校验
- 新增端点选择面板,测试前可选择目标端点
- 新增调试检查器,可查看每次尝试的请求/响应头和体
- 结果视图改用 HorizontalRequestTimeline 组件展示请求追踪
- endpoint_checker 返回完整调试数据,通过 candidate extra_data 持久化
Vertex AI:
- 改进上下文检测逻辑,不再仅依赖 provider_type,支持从 base_url 推断
- Service Account 密钥现支持自动拉取模型(使用 auth_config 而非 api_key)
- 移除 Gemini Developer API 回退,API Key 仅走 Express 模式
- 端点表单为 Vertex AI 显示格式特定的默认路径模板
- 密钥格式校验仅在 auth_type/api_formats 变更时执行
其他:
- 禁用 ClaudeCode 提供商类型创建入口
- Dialog 组件新增 closeOnBackdrop 属性
2026-03-19 23:52:17 +08:00
fawney19
e4ebd5cca1
refactor(oauth): LinuxDo 备用端点回退、Basic Auth 认证,修复 session 外访问 ORM 对象
...
- LinuxDo provider: token/userinfo 请求增加 backup 端点自动回退
- LinuxDo provider: token 请求改用 HTTP Basic Auth 认证
- 授权 URL 构建: scope 为空时不再发送该参数
- OAuthService: 引入 OAuthAuthenticatedUser 快照,避免 DB session 关闭后访问 ORM 对象
- OAuthService: _handle_login_sync 设置 expire_on_commit=False 防止属性过期
- 新增 LinuxDo provider 单元测试(Basic Auth、端点回退)
- 新增 _handle_login_sync 返回快照的集成测试
2026-03-19 20:32:33 +08:00
fawney19
f573110725
fix(frontend): 用 CSS text-security 替代 password 输入框,简化配额进度条 UI
...
- Input 组件 masked 模式改用 WebkitTextSecurity: disc 替代 type=password,
避免浏览器密码管理器自动填充干扰
- LoginDialog/UserFormDialog/Settings/ProxyNodes 密码字段统一迁移到 masked 属性
- PoolManagement 配额进度条布局从 grid 改为 flex,移除未使用的
getQuotaProgressDisplayClass/getQuotaProgressTooltip 函数
Close #249
Co-authored-by: AAEE86 <ppk0227@hotmail.com >
2026-03-19 20:04:56 +08:00
fawney19 and AAEE86
a8620e133a
fix(kiro): 加固 Kiro adapter 错误处理与请求构建逻辑
...
- 提取 request.py 统一 URL/headers/payload 构建,消除 handler_adapter_base 与 envelope 的重复逻辑
- 新增 error_enhancer 模块,分类 HTTP 状态码与连接错误,增强上游错误诊断信息
- envelope 实现 extract_error_text / on_http_status / on_connection_error,透传错误上下文到 eventstream rewriter
- KiroRequestContext 扩展错误状态字段,支持网络诊断信息传递
- provider_oauth_utils 改用 importlib 动态加载,避免 core 层对 services 的静态依赖
- idc auth_method 下跳过 profileArn,修复 usage 查询参数
Closes #247
Co-authored-by: AAEE86 <ppk0227@hotmail.com >
2026-03-19 13:54:40 +08:00
fawney19
b570aaac48
fix: 补全 OpenAI 工具参数 schema 中缺失的 properties 字段
...
OpenAI API 要求 type=object 的 schema 节点必须声明 properties,
否则会拒绝请求。在 request_from_internal 出口处对工具参数 schema
进行深拷贝并递归补全缺失的空 properties,不影响内部表示。
2026-03-19 02:36:22 +08:00
fawney19
086efe6efe
refactor(usage-queue): ACK 后立即删除消息,清理 consumer 元数据
...
- 消费成功/移入 DLQ 后立即 XDEL,避免主流 Redis 保留已入库历史
- 缩小 usage_queue_stream_maxlen 默认值:200000 -> 2000(仅作短暂缓冲)
- 启动时清理 pending=0 且长期闲置的旧 consumer(防 consumer group 元数据累积)
- 停机时主动 XGROUP DELCONSUMER 移除自身
- 移除 cache_fingerprint 模块及其对 telemetry/recording_helpers 的引用
- 同步更新相关测试,验证 xdel 调用及 consumer 生命周期行为
2026-03-19 02:09:09 +08:00
fawney19
56f3c95763
fix: 统一 input_context_expr 计算口径,移除按 api_format 分支的 CASE 逻辑
...
input_context_expr() 原先按 OpenAI/Gemini 和 Claude 分支计算输入上下文,
现统一为 input_tokens + cache_read_input_tokens,与 usage 表展示口径一致。
同步更新 admin 和 user_me 路由中的缓存命中率注释,并新增单元测试。
2026-03-19 01:35:00 +08:00
fawney19
8a6a961900
feat: 增强 OAuth 标识展示与 Codex 调试日志
...
- 优化 OAuth badge 支持 account_id/account_user_id,tooltip 展示完整身份信息
- 重构池管理额度进度条布局,倒计时独立展示并增加样式区分
- Codex 插件增加 token 解析快照日志,便于排查 OAuth 透传问题
Closes #245
Co-Authored-By: kayphoon <109347466+Kayphoon@users.noreply.github.com >
2026-03-19 00:50:18 +08:00
fawney19
8d8cddcef6
fix(replay): rerun model mapping on replay target
2026-03-18 23:54:19 +08:00
fawney19
1d72a8f9c1
feat: 流式空闲超时、健康监控查询优化、限流桶内存上限与维护清理修复
...
Close #233
Co-authored-by: AAEE86 <ppk0227@hotmail.com >
- cli_monitor_mixin: 引入 STREAM_IDLE_TIMEOUT_SECONDS(可通过环境变量配置),
流传输开始后若超出空闲窗口无新 chunk 则提前取消并返回 504,避免长时间挂起
- stream_context: 新增 managed_recorded_bodies 上下文管理器,确保 chunks 在
telemetry 完成后及时释放;stream_telemetry 使用该接口统一管理 response body 构建
- health endpoint: 将状态聚合改为 GROUP BY 直接统计,事件列表按 api_format
单独查询,避免单次 limit 拉取大量记录导致的遗漏与性能问题;同时过滤不活跃
provider/endpoint,与公开健康接口保持一致
- endpoint health service: 修正时间线数据按 endpoint_id 而非 key_id 聚合
- token_bucket: 引入 max_buckets/bucket_expiry 上限与定时清理,防止内存无限增长;
修复 refill_rate=0 时 get_reset_time 除零异常;新增 _is_unlimited_rate_limit 判断
- maintenance_scheduler: 调整清理顺序(先删整行再按窗口清理),新增 newer_than
边界参数,避免同一行在同一轮中被重复改写
- sync_execute: 新增 create_pending_usage 开关,允许已预创建记录的调用方跳过重复创建
- quota_reader / provider_ops balance: 小幅修复与健壮性提升
- Dockerfile: 添加 MALLOC_ARENA_MAX=2 环境变量以降低 gunicorn worker RSS
- 补充相关测试覆盖
2026-03-18 23:38:26 +08:00
fawney19
3d5b6141a5
feat(codex): 引入 upstream_headers hook 机制,为 Codex 注入 session/conversation/account headers
...
- 新增 upstream_headers.py:可注册 provider+endpoint 维度的 extra headers 构建 hook
- Codex openai:cli 注入 session_id + conversation_id(由 prompt_cache_key sha256 派生)
- Codex openai:compact 注入 chatgpt-account-id(来自 auth_config)+ session_id,不注入 conversation_id
- 修复 prompt_cache:compact 格式现统一为 codex 策略,不再跳过注入
- chat_handler_base / cli_request_mixin 均在 extra_headers 阶段调用 build_upstream_extra_headers
2026-03-18 20:43:14 +08:00
fawney19
203cd5a9d5
fix(redis): 按事件循环隔离 Redis 连接,防止子线程 asyncio.run 导致连接泄漏
...
RedisClientManager 新增 _redis_by_loop 字典,按 event loop id 维护独立连接,
避免 usage consumer 在 asyncio.to_thread + asyncio.run 场景下复用主循环连接。
同步重构 consumer_streams 的写库路径:_apply_record_event 统一走
record_usage_batch,_apply_streaming_event 改为 to_thread 执行同步 DB 操作,
移除冗余的 session 传递和手动 rollback 逻辑。
2026-03-18 17:56:48 +08:00
fawney19
696ec65175
refactor(normalizer): 移除 request key reorder 机制,保持自然插入顺序
...
移除 OpenAI/OpenAI CLI normalizer 中的 _reorder_request_prefix_keys 及
基类 _reorder_request_keys 死代码,request_from_internal 直接返回构建
顺序的 dict,测试同步更新为验证自然插入顺序。
2026-03-18 14:01:56 +08:00
fawney19
cbb66a5667
refactor(task): 引入 MutableRequestBodyState 替代 request_body_ref 字典容器
...
将请求体可变状态从 {"body": dict} 字典容器重构为独立的
MutableRequestBodyState 类,统一管理 original_body / current_body /
build_attempt_body / rectify 等语义,消除各层通过 ref["body"] 间接
读写的隐式约定。
- 新增 src/services/task/request_state.py 定义 Protocol 与实现
- handler/executor/mixin 层改用 request_state 参数传递
- error_handler/state_transition 通过 request_state 判断整流状态
- 新增 request_state 单元测试与 chat/cli 请求体隔离测试
2026-03-18 13:43:39 +08:00
fawney19
53ef35ec80
refactor(cli): 提取 _build_upstream_request 统一流式/非流式的上游请求构建逻辑
...
将 cli_stream_mixin 和 cli_sync_mixin 中重复的上游请求构建代码
(provider behavior / stream policy / envelope / auth / RequestBuilder / URL 构建)
提取到 cli_request_mixin._build_upstream_request,返回 CliUpstreamRequestResult dataclass。
2026-03-18 13:13:47 +08:00
fawney19
1af3067303
refactor(codex): 移除 envelope/request_patching 层,用 context var 统一 compact 状态判断
...
- 删除 CodexOAuthEnvelope 和 request_patching 模块,Codex 不再需要 envelope 层
- 移除 _aether_compact 请求体内部标记,改用 is_codex_compact_request() 集中查询
- 简化 OpenAI CLI adapter,移除 Codex 专用的 get_cli_extra_headers/build_test_request_body 逻辑
- 移除 Codex behavior variant 注册(same_format/cross_format)
- normalizer patch_same_format_request 对 codex 变为 no-op
- 更新相关测试适配新的架构
2026-03-18 12:35:57 +08:00
fawney19
d026398bab
refactor(body-rules): 移除 protected_body_keys 机制,允许 body_rules 自由修改所有请求体字段
...
删除 get_cache_sensitive_protected_body_keys 函数及相关常量、_is_protected_path
辅助函数,从 apply_body_rules、RequestBuilder、ProviderRequestResult 等处移除
protected_body_keys 参数,更新所有调用点和测试用例。
2026-03-18 10:52:07 +08:00
fawney19
684689a82b
fix(usage): session touch 独立提交避免行锁阻塞 & 管理员页面顺序加载降低并发压力
...
后端: 将 session touch 的 commit 从请求事务中分离,防止管理员 usage
页面的长查询持有 user_sessions 行锁阻塞后续请求。touch_session 改为
返回 bool 以支持按需提交。
前端: 管理员 Usage 页面将并行 API 调用改为顺序加载,优先显示记录表格,
统计面板在后台异步刷新,避免瞬时并发打满后端 worker。loadRecords 支持
传入 dateRange 参数确保时间范围一致性。
2026-03-18 00:13:28 +08:00
fawney19
7180eaea88
chore: bump aether-proxy version to 0.2.5
2026-03-17 22:16:47 +08:00
fawney19
7cb204f18a
chore: bump aether-hub version to 0.2.0
2026-03-17 22:15:07 +08:00
fawney19
0342f609d0
feat(tunnel): 请求体流式传输 & OpenAI CLI 请求 key 排序优化
...
Hub 端:
- open_local_stream 不再接收 body 参数,改为通过 push_local_request_body 分块推送
- 请求体按 32KB 分帧发送,避免大请求一次性压缩和传输
- local_relay 改为流式解析 envelope 和转发请求体
Proxy 端:
- stream_handler 改为流式传输请求体到上游,不再预先收集完整 body
- upstream_client 请求体类型从 Full<Bytes> 改为 UnsyncBoxBody 以支持流式传输
- dispatcher 将 StreamEnd/StreamError 事件转发给 stream handler
Python 端:
- hub_transport relay envelope 改为异步生成器流式发送
- 提取 reorder_openai_cli_request_prefix_keys 为公共函数
- Codex passthrough 路径也应用稳定的前缀 key 排序
2026-03-17 22:07:09 +08:00
fawney19
59840fa419
feat(docker): 支持通过 GITHUB_MIRROR 参数加速 hub 二进制下载
...
Dockerfile.app.local 新增 GITHUB_MIRROR 构建参数,deploy.sh
新增 --mirror 选项,国内服务器可指定镜像代理地址加速下载。
2026-03-17 20:43:14 +08:00
fawney19
d390d46ee8
feat(docker): Dockerfile.app.local 支持本地 hub 二进制文件
...
将 aether-hub tar.gz 放到项目根目录即可跳过 GitHub 下载,
解决国内服务器构建时 GitHub 访问慢的问题。
2026-03-17 20:37:09 +08:00
fawney19
37eada9682
chore: bump aether-hub version to 0.1.9
2026-03-17 20:26:29 +08:00
fawney19
73a5325a38
refactor(hub): 用本地 HTTP relay 替代 Worker WebSocket 长连接
...
Hub 数据面改为 /local/relay/{node_id} HTTP 端点,Worker 通过本机
HTTP 请求转发 tunnel 帧,不再维护 /worker WebSocket 长连接。
Hub 侧:
- 新增 control_plane.rs: Hub 通过 HTTP 回调 Aether app 处理心跳 ACK 和节点状态变更
- 新增 local_relay.rs: 接收本地 HTTP 请求,在 Hub 内部打开 LocalStream 并透传到 proxy
- 移除 worker_conn.rs 及 Worker WebSocket 处理逻辑
- 简化 protocol.rs: 移除 NODE_STATUS 帧类型,抽取通用 encode_frame/decode_payload
Python 侧:
- 删除 tunnel_manager.py 及其 WebSocket 连接管理器 (HubConnectionManager)
- 简化 hub_transport.py 为 HTTP relay 调用
- 新增 src/api/internal/hub.py 接收 Hub 控制面回调 (heartbeat/node-status)
- hub_config.py 移除 WebSocket 相关配置,改为 HTTP relay URL
- service.py 新增 update_tunnel_status 方法
- 删除 src/api/admin/proxy_tunnel.py (旧管理接口)
- proxy_node 缓存 TTL 从 15s 降至 3s 加速状态感知
2026-03-17 20:22:12 +08:00
fawney19
460eb5434d
fix(proxy-resolver): 将 resolve_ops_proxy_config 改为异步调用避免阻塞事件循环
...
在 anyrouter/nekocode/sub2api/yescode 架构及 service.py 中,
将同步的 resolve_ops_proxy_config 替换为 resolve_ops_proxy_config_async,
通过 asyncio.to_thread 包装避免同步 DB 查询阻塞事件循环。
2026-03-17 18:06:15 +08:00
fawney19
8a21cb9a55
chore: bump aether-hub version to 0.1.8
2026-03-17 17:32:01 +08:00
fawney19
d0df52ce35
fix(hub): worker 断连时向 proxy 端发送 STREAM_ERROR 防止流阻塞
...
将 unregister_worker 中的 stream 清理逻辑提取为 cancel_streams_for_worker
方法,与 cancel_streams_for_proxy 形成对称设计。worker 断连时主动通知
proxy 端终止相关 stream,防止 proxy 的 stream handler 永久阻塞等待请求体。
添加单元测试覆盖该场景。
2026-03-17 17:29:12 +08:00
fawney19
c1ed42fd3a
feat(body-rules): 支持按 provider_type 覆盖 cache-sensitive 保护字段集合
...
Codex 通过 OpenAI CLI/Compact 格式转发时,endpoint body_rules 需要能
修改 instructions/input/tools 等 prompt 字段。新增 provider_type 维度的
保护集合映射,Codex 场景仅保护 prompt_cache_key,其余 prompt 字段交由
body_rules 自由调整。
2026-03-17 17:09:39 +08:00
fawney19 and LewisPen
c4bb6b8161
feat(auth): 重构认证系统,引入 session 会话管理
...
- 新增 user_sessions 数据库表及 Alembic 迁移
- 实现 SessionService 会话生命周期管理(创建/刷新/撤销/清理)
- 认证流程改用 refresh token cookie + access token 双令牌模式
- 前端实现自动静默刷新、跨标签页同步及设备指纹
- 用户设置页新增会话管理和密码修改功能
- 管理员用户管理新增强制登出和会话查看
- 密码策略增强,支持强度校验和泄露检测
- OAuth 登录流程适配新会话机制
- 新增完整的单元测试和 API 测试覆盖
Closes #232
Co-authored-by: LewisPen <LewisPen@nyadoo.com >
2026-03-17 16:34:09 +08:00
fawney19
d480aa11f3
fix(request-body): 使用 deepcopy 防止请求体在处理流程中被意外修改
...
handler 基类和格式转换 registry 中,原始请求体通过浅拷贝或直接引用传递,
导致下游处理(模型映射、格式转换、重试整流)可能修改原始数据,
影响后续重试或并发请求的正确性。统一改用 copy.deepcopy 隔离副本。
2026-03-17 13:23:02 +08:00
fawney19
d63d5eff85
fix(nginx): 统一所有 location 块的 CF 头剥离,补充 proxy_hide_header 防止响应泄露
2026-03-17 11:33:43 +08:00
fawney19
5dae2a4792
fix(normalizer): 移除 Claude system 中的 billing header
2026-03-17 11:10:04 +08:00
fawney19
dcbd7dc219
feat(normalizer): 稳定请求体字段顺序以提升 prompt cache 命中率
...
在 FormatNormalizer 基类新增 _reorder_request_keys 方法,OpenAI/OpenAI CLI
normalizer 各自定义前缀字段顺序(model, tools, messages / model, instructions,
tools, input),确保静态字段前置、动态内容后置。同时调整 OpenAI CLI 中
instructions 字段的构建位置使其在 input 之前。
2026-03-17 10:26:57 +08:00
fawney19
2dcf8b8414
refactor(prompt-cache): 移除 client_family 命名空间拆分,统一缓存 key 提升复用率
...
不再按 User-Agent 客户端类型拆分 prompt cache namespace,
所有客户端共享同一缓存 key,版本升级至 v3。
2026-03-17 09:49:35 +08:00
fawney19
438f16094f
refactor(stream): 将不完整流 token 估算逻辑收敛到 StreamContext
...
- 新增 has_partial_response / ensure_estimated_output_tokens / should_estimate_incomplete_tokens 方法
- CancelledError 路径在归因前即补充 output_tokens,确保日志包含估算值
- CLI Handler 和 Chat Handler 的兜底估算统一使用 should_estimate_incomplete_tokens
- 移除 cli_monitor_mixin 和 stream_telemetry 中重复的条件判断
- 新增对应单元测试
2026-03-17 03:37:06 +08:00
fawney19
40e0b82fa0
fix(chat-handler): 修复 _prepare_provider_request 缺少 original_headers 参数导致的 NameError
2026-03-17 03:21:19 +08:00
fawney19
b9b0a75fe4
feat(cache-fingerprint): 新增字段级指纹,支持逐字段 sha256 和字节数追踪
...
在请求缓存指纹中为每个 cache_relevant 字段单独计算 sha256 和字节数,
便于精确定位哪些字段发生了变化。fingerprint version 升级为 2。
2026-03-17 02:57:36 +08:00