Skip to content

v0.1.20

Choose a tag to compare

@kuk-888 kuk-888 released this 26 Nov 05:23
· 8 commits to main since this release

中文更新说明

v0.1.20 是一次聚焦 协议 1:1 深度对齐、百号生产零丢号架构、双部署网页一键热更新、大上下文首字提速与近期社区 Issues 闭环 的重要版本升级。

✨ 核心新特性与重大改进

1. 双部署通用网页一键热更新(Docker + 宿主机全支持)

  • 零 docker.sock、支持崩溃自动回滚:引入 bootstrap.js 轻量监管引导器,支持在 Web 控制台「版本信息」弹窗中一键在线拉取官方 GitHub Release 热更包(aws-quick2api-dist-v*.tar.gz)原地热重启或一键回滚,同时兼容 Docker 非 root 容器与宿主机 systemd / pm2 / npm start 部署。
  • 多层安全门禁:严格锁定官方仓库 kuk-888/aws-quick2api(防 RCE)、仅允许 GitHub HTTPS 域名、恒定时间 SHA-256 校验、防 Zip-Slip / 符号链接 / 解压炸弹安全解压、依赖指纹 depsHash 变更自动拦截引导升级镜像、支持 DISABLE_SELF_UPDATE=true 一键关闭;新版本若在启动校验期崩溃或超时未就绪,自动回滚至上一稳定版本或内置底包。
  • Linux 百号 bootstrap.js 兼容与路径统一:监管进程不再向 execve 环境变量展开 .env(彻底规避 Linux 128KB E2BIG 启动限制并让热重启实时读取最新 .env),同时统一宿主机与容器的 DATA_DIR 解析。

2. 零丢号运行态存储架构(data/pool-state.json + 三层防线)

  • 运行态拆分原子落盘:将号池凭证、代理、备注、Agent 绑定、OAuth 刷新令牌轮换、自动停用状态与策略设置迁移至 ${DATA_DIR}/pool-state.json(150ms 防抖异步原子 rename),彻底解决 Docker 单文件挂载 ./.env:/app/.env 的 EBUSY 风险与只读 .env(0444 / :ro)报错问题。
  • 三层零丢号防线:
    1. 首次启动自动从 v0.1.19 .env 无损迁移全部账号与元数据,并支持低频结构化变更(增删号 / 改配置 / OAuth refreshToken 轮换)异步镜像回可写 .env,兼顾仅挂 .env 的手写 docker run 与降级回退;
    2. 启动即检测 DATA_DIR 写权限,遇 EACCES 立即 Fail-Fast 并打印 chown -R 1000:1000 data .env 修复命令;
    3. Docker 容器未挂载持久化 /app/data 卷时主动输出告警。
  • Docker Compose 开箱即用:docker-compose.yml 默认启用多架构预构建镜像 ghcr.io/kuk-888/aws-quick2api:latest(移除 env_file: 以支持 100+ 账号,支持 docker compose pull && docker compose up -d 直接启动)。

3. 社区 Issues 全面闭环(#1 / #2 / #5 / #6 / #8 / #10 / #11)

  • #6 & #11(Anthropic effort=max、进度条同步、百号扩展与审计日志持久化):
    • 完善思考强度优先级:output_config.effort / reasoning_effort > 模型后缀(如 quick-smart-max)> thinking.adaptive / budget_tokens,零隐蔽降级;
    • Anthropic usage 水位单调不缩水、支持 /compact 骤降自动重置,并按上游真实 context_window 的 80% 动态水位自动轮转热线程;
    • 新增 RequestTraceLogger 纯元数据落盘持久化(${DATA_DIR}/request-traces.json),重启保留管理台「请求日志」,严格零提示词/思考/正文泄露,清空立即落盘。
  • #10(思考模式长时间卡死根治):
    • 加固 turn-stream-runner 全套看门狗:活跃 WS ping/pong 心跳判死、纯 keepalive/status 不重置内容空闲超时、runIdleTimeoutMs、分段纯 thinking_delta 上限保护、turn_usage 后迟到事件自动重挂 postUsageTimer;
    • 客户端 Ctrl+C 取消时发送原生 stop_generation(保留 350ms 线上传输宽限)并立即释放并发槽位。
  • #5 & #8(quick-smart 误拦治理与云端智能体批量同步):
    • 新增可选 SANITIZE_CLIENT_SYSTEM_PROMPT(默认 false,不改写普通用户系统提示词);开启后对 Claude Code / Cursor / Kilo / Antigravity / ZCode 等重型 IDE 系统提示词做线性零回溯防误拦净化,同时 100% 保留 <user_rules> 业务规则;
    • AUTO_REPHRASE_ON_CONTENT_FILTER 采用纯英文领域中立重述模板,热会话走原生 edit_message 分支且严守原模型绝不降级,修复非流式重述偶发拼串问题;
    • 控制台新增「同步云端智能体」弹窗与 POST /v1/admin/keys/sync-agents(支持批量勾选、自定义名称/描述/指令、默认新增不覆写个人自定义助手、旧版 Quick2API Bridge 告警徽章与单账号热编辑),并引入 WarmSessionPool 槽位代次校验与全链路 shortId 归一化,热切换/更新 Agent 或 OAuth 换票时即时清理旧停泊连接、杜绝并发回泊竞态。
  • #1 & #2(三协议工具调用与 Codex / Claude Code 加固):
    • 完整支持 Anthropic 20+ 工具 + MCP 长名 + tool_reference + defer_loading、OpenAI Chat / Responses(Codex shell / apply_patch / custom freeform 参数与命名空间工具);
    • 统一在流式与非流式路径强制执行 parallel_tool_calls: false / disable_parallel_tool_use: true 并对齐热池前缀哈希;围栏感知工具词法解析器与 <decision>/<artifact> 清洗器防标签泄漏;修复累计 >5 文件历史后的纯文本追问 400 问题。

4. 大上下文首字提速(TTFT 优化)与模块化架构重构

  • OOB 附件上传与 WS 拨号握手并行:>46.5KB 大上下文或媒体走带外上传时,同步并行拨号 WebSocket 并完成 session_connect 握手,重叠隐藏 ~0.9–1.0s 建连耗时(实测 180KB/320KB 冷传 TTFT 降低 ~19%–27%);同步开放 Web Cookie 账号 OOB .txt 上传。
  • 渐进 DLP 轮询与多模态并发:OAuth 附件 DLP 轮询改为渐进退避 [250, 400, 600, 1000, 1500]ms,文件与图片阶段并发上传。
  • 热续传命中率加固:剥离历史消息内动态 <system-reminder> 哈希漂移、修复单工具裁剪与 OAuth 换票引起的缓存失效,保障大上下文多轮会话稳定命中 warm_incremental(首字 1.3–2.3s);flushEarly 15s 定时器推迟至 OOB 上传完成并在切号/重试时立即重置,保真返回真实 HTTP 429/502 状态码。
  • 核心引擎模块化:engine.ts 拆解为 ws-transport、warm-session-pool、turn-stream-runner、turn-attachment-builder、turn-frame-builder、turn-protocol-state、media-utils 等单一职责模块,并实现 AWS Quick 协议 1:1 对齐(含 S2C _chunked_frame 重组与多步云端工具用量聚合)。

📦 无损升级指南

  • Docker Compose 用户:直接执行 docker compose pull && docker compose up -d(请保留原有 .env 与 ./data 目录,首次启动会自动无损迁移至 data/pool-state.json)。
  • 源码部署用户:git pull && npm ci && npm run build,并重启服务(npm start 已默认通过 dist/src/bootstrap.js 托管以开启网页一键热更新)。
  • ⚠️ 升级后建议:若此前使用旧版 Quick2API Bridge 助手,升级后可在后台「凭证管理 → 同步云端智能体」勾选账号一键升级为 Coding Assistant;如使用重型编码 IDE 遇到 quick-smart 偶发误拦,可在「路由与策略」按需开启「客户端 System Prompt 防误拦净化」。

English Release Notes

v0.1.20 delivers 1:1 AWS Quick protocol alignment, zero-account-loss state persistence, dual-mode one-click Web self-update, large-context TTFT acceleration, and full resolution of recent community issues (#1, #2, #5, #6, #8, #10, #11).

✨ Highlights

1. Dual-Mode One-Click Web Self-Update (Docker & Host)

  • Zero docker.sock & automatic crash rollback: Introduces a thin bootstrap.js supervisor enabling in-place hot updates and one-click rollback directly from the Web Console for both non-root Docker containers and host (systemd / pm2 / npm start) deployments.
  • Defense-in-depth verification: Locked to official repo kuk-888/aws-quick2api, GitHub HTTPS-only downloads, constant-time SHA-256 verification, hardened pure-Node tar-gz extraction (blocks Zip-Slip, symlinks, devices, Windows drive paths, and gzip bombs), depsHash native-dependency gating, DISABLE_SELF_UPDATE=true opt-out, and automatic rollback if a newly applied release crashes or fails to emit gateway_ready within 25s.
  • Linux 100-account bootstrap.js compatibility: bootstrap.js reads .env hints without expanding .env into fork()'s execve environment (eliminating Linux 128KB E2BIG crashes for 60–100+ OAuth accounts and ensuring .env edits reload on respawn) while unifying DATA_DIR resolution between supervisor and server.

2. Zero-Account-Loss Runtime State (data/pool-state.json)

  • Atomic runtime state split: Runtime credentials, proxies, labels, agent bindings, rotated OAuth refresh tokens, auto-disabled markers, and pool settings now persist atomically to ${DATA_DIR}/pool-state.json (150ms debounced atomic rename), eliminating Docker single-file .env bind-mount EBUSY issues and supporting read-only .env (0444 / :ro).
  • Three-layer protection: Automatic lossless migration from v0.1.19 .env; best-effort mirroring of structural edits and OAuth token rotations back to writable .env (protecting .env-only docker run setups and clean rollbacks to v0.1.19); fail-fast startup probe on DATA_DIR with actionable chown -R 1000:1000 data .env hint on EACCES.
  • Out-of-the-box Docker Compose: docker-compose.yml now defaults to the prebuilt multi-arch ghcr.io/kuk-888/aws-quick2api:latest image without env_file: (supporting 100+ OAuth accounts out of the box).

3. Community Issues Resolved (#1 / #2 / #5 / #6 / #8 / #10 / #11)

  • #6 & #11 (effort=max, usage meter sync, 100-account pool & persistent request traces):
    • Strict effort precedence (output_config.effort / reasoning_effort > model suffix like quick-smart-max > thinking.adaptive / budget_tokens) with zero silent downgrades;
    • Monotonic Anthropic usage floor with /compact drop detection and dynamic 80% upstream context_window warm-thread rotation;
    • Metadata-only RequestTraceLogger persistence (${DATA_DIR}/request-traces.json) surviving restarts with zero prompt/thinking/response content stored and immediate persistence on clear().
  • #10 (Thinking-mode 3–4h stall prevention):
    • Hardened stream watchdogs in turn-stream-runner: active WebSocket ping/pong dead-socket detection, pure keepalive/status excluded from content idle resets, runIdleTimeoutMs, per-segment thinking_delta cap, and postUsageTimer re-arming across late events;
    • Native stop_generation on client abort with a 350ms wire-flush grace window and instant concurrency-slot release.
  • #5 & #8 (quick-smart false-positive mitigation & Cloud Agent sync):
    • Opt-in SANITIZE_CLIENT_SYSTEM_PROMPT (default false) linearly sanitizes heavy IDE wrappers (Claude Code, Cursor, Kilo, Antigravity, ZCode) while preserving <user_rules> business instructions;
    • Domain-neutral AUTO_REPHRASE_ON_CONTENT_FILTER recovers on the exact requested model via native edit_message warm branching with zero prompt logging and clean non-streaming reset;
    • New Web Console "Sync Cloud Agents" modal & POST /v1/admin/keys/sync-agents (batch selection, custom name/description/instructions, safe default create-without-overwriting personal agents, legacy Quick2API Bridge badge, single-account hot-edit), backed by WarmSessionPool slot-generation guards and full-path shortId normalization.
  • #1 & #2 (Tool calling & Codex / Claude Code hardening):
    • Verified Anthropic 20+ tools, long MCP names, tool_reference, defer_loading, and OpenAI Chat / Responses (shell, apply_patch, custom freeform tools, namespaced tools);
    • Enforces parallel_tool_calls: false / disable_parallel_tool_use: true consistently across streaming, non-streaming, and warm-session prefix hashing; fixes >5 historical files plain-text follow-up 400s.

4. Large-Context TTFT Acceleration & Modular Engine Architecture

  • Parallel OOB upload + speculative WebSocket dial/handshake: Overlaps ~0.9–1.0s WS dial + session_connect handshake behind >46.5KB OOB .txt/media uploads (~19%–27% cold TTFT reduction on 180KB–320KB contexts), plus OOB .txt support for Web Cookie credentials.
  • Progressive DLP polling & concurrent media upload: Upgraded OAuth DLP polling to [250, 400, 600, 1000, 1500]ms backoff and parallelized file + image attachment phases.
  • Warm-hit preservation & accurate HTTP error forwarding: Strips volatile <system-reminder> blocks from prefix hashes, invalidates warm sessions on OAuth rekeySlotCredential, and defers/resets the 15s flushEarly timer across OOB uploads and account failovers so 429/502 responses preserve real HTTP status codes and Retry-After.
  • Modular core: Refactored engine.ts into single-responsibility modules with full 1:1 AWS Quick wire alignment (S2C _chunked_frame reassembly and multi-step cloud tool turn_usage aggregation).

📦 Upgrade Notes

  • Docker Compose: Run docker compose pull && docker compose up -d (keep your existing .env and ./data; state migrates automatically to data/pool-state.json).
  • Source Deploy: Run git pull && npm ci && npm run build and restart (npm start now launches via dist/src/bootstrap.js for Web self-update support).