From a5c1a9b80f8404de44acc23cefd5c0e4ee53d241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=94=A1=E5=8F=8A?= <522caiji@gmail.com> Date: Sat, 5 Sep 2026 11:47:38 +0800 Subject: [PATCH 1/4] docs: freeze changelog for v0.2.44 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51625c8..1673756 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ Write each change in both `### English` and `### 中文` under `## Unreleased`. ### English +### 中文 + +## 0.2.44 - 2026-09-04 + +### English + - Document the staged update flow and its restart confirmation boundary for the next patch release ### 中文 From 112515d8e8791b913e328654bc64f00569f33306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=94=A1=E5=8F=8A?= <522caiji@gmail.com> Date: Sun, 6 Sep 2026 01:39:28 +0800 Subject: [PATCH 2/4] feat: add routing strategies and recover failed account runtimes Let operators pick round-robin, weighted round-robin, or fill-first from the System page, recover crashed account daemons with exponential backoff, and keep starting accounts out of the scheduler until health succeeds. --- .env.example | 1 - CHANGELOG.md | 12 + CONTRIBUTING.md | 11 +- README.md | 28 +- README_EN.md | 30 +- deploy/.env.example | 1 - deploy/README.md | 39 ++- deploy/docker-compose.yml | 1 - docs/assets/README.md | 2 +- docs/assets/readme/architecture-en.svg | 24 +- docs/assets/readme/architecture-zh.svg | 24 +- frontend/src/api/system.ts | 17 +- frontend/src/api/types.ts | 18 + .../src/components/account/AccountCard.tsx | 30 +- frontend/src/i18n/messages.ts | 30 ++ frontend/src/lib/account.ts | 10 +- frontend/src/pages/SystemPage.tsx | 59 +++- internal/accounts/manager.go | 309 ++++++++++++++---- internal/accounts/manager_test.go | 296 +++++++++++++++++ internal/accounts/pool.go | 181 ++++++++-- internal/accounts/pool_test.go | 75 +++++ internal/accounts/providers_test.go | 21 +- internal/api/server.go | 10 + internal/api/system_settings.go | 79 ++++- internal/api/system_settings_test.go | 46 +++ internal/executor/chat.go | 71 +++- internal/executor/session_affinity.go | 69 +++- internal/executor/session_affinity_test.go | 23 ++ ...t-DS83YNKu.js => TrafficChart-BamMtm-m.js} | 2 +- .../{index-BPgpsCaT.js => index-HLxaGXjp.js} | 4 +- internal/webui/static/index.html | 2 +- 31 files changed, 1310 insertions(+), 215 deletions(-) rename internal/webui/static/assets/{TrafficChart-DS83YNKu.js => TrafficChart-BamMtm-m.js} (99%) rename internal/webui/static/assets/{index-BPgpsCaT.js => index-HLxaGXjp.js} (79%) diff --git a/.env.example b/.env.example index 7fd043f..7d9f46c 100644 --- a/.env.example +++ b/.env.example @@ -4,7 +4,6 @@ PORT=3010 QODER_DATA_DIR=/data QODER_RUNTIME_DIR=/tmp/cli2api-runtime QODER_WORKER_BASE_PORT=32100 -QODER_MAX_INFLIGHT=4 # When 1/true, bare model IDs can route across Qoder and WorkBuddy accounts. # CROSS_PROVIDER_MODEL_POOL=0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1673756..e8c6d6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,20 @@ Write each change in both `### English` and `### 中文` under `## Unreleased`. ### English +- Add console-selectable account routing strategies: round-robin, weighted round-robin, and fill-first +- Recover failed account runtimes with exponential backoff, and surface starting, recovering, and auth-failed states on account cards +- Show session-affinity TTL, hits, misses, escapes, and the last miss/escape reason on the System page +- Configure per-account concurrency in the console instead of the global `QODER_MAX_INFLIGHT` environment variable +- Align the README and deployment documentation with current provider capabilities, session affinity, API routes, and per-account concurrency settings + ### 中文 +- 控制台可选择账号调度策略:轮询、加权轮询、填满优先 +- 账号运行时启动失败后按指数退避自动恢复,并在账号卡片上展示启动中、恢复中、登录失败状态 +- 在系统页展示会话粘性 TTL、命中、未命中、逃逸,以及最近一次未命中/逃逸原因 +- 账号并发改为控制台按账号配置,不再使用全局环境变量 `QODER_MAX_INFLIGHT` +- 同步 README 与部署文档,修正当前 Provider 能力、会话粘性、API 端点和账号级并发配置说明 + ## 0.2.44 - 2026-09-04 ### English diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 92a15e6..fb493d1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,8 @@ # Contributing -CLI2API is Qoder-first. Keep changes focused and do not add other providers until the -current Qoder milestone is complete. Hard rules live in `AGENTS.md`. +CLI2API keeps the Qoder execution path stable while supporting provider-specific +adapters for Qoder, WorkBuddy, and Trae. Keep new provider work behind the shared +account, routing, and protocol contracts. Hard rules live in `AGENTS.md`. ## Setup @@ -39,7 +40,8 @@ The favicon set and OG social card live in `frontend/public/`. After editing the 1. `cd frontend && npm run sync` — copies the assets into `internal/webui/static/` (embedded into the Go binary by `//go:embed`). 2. Add a matching entry under `## Unreleased` in `CHANGELOG.md` in both `### English` and `### 中文`. -The READMEs instead show `docs/assets/overview-card.png`, which is hand-maintained; regenerate it when login methods, account types, endpoints, or deployment targets change. +Keep README diagrams and provider lists aligned with the supported account types, +endpoints, and deployment targets. Adding a new file to the favicon suite? Update three places: @@ -62,7 +64,8 @@ by hand. ## Rules - Keep the Go layers: auth / endpoint / executor / translate / api -- Keep one Qoder HOME and one Node daemon per enabled account +- Keep one isolated runtime per enabled account: Qoder uses one HOME and Node daemon; + in-process providers use their adapter and must not spawn a child daemon - Keep qodercli compatibility checks in `worker/src/compat.mjs` - Preserve the proven WASM encode and HTTP/SSE request path - Use HeroUI for console components diff --git a/README.md b/README.md index 57a452a..7f09ef1 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ 支持 **Qoder 国际版**、**Qoder 国内版**、**WorkBuddy 国际版**、**WorkBuddy 国内版** 和 **Trae 国内版 Solo**。 -常驻 worker、多账号调度,Docker 一键启动。 +常驻运行时、多账号调度,Docker 一键启动。 [](LICENSE) [](https://linux.do) @@ -17,14 +17,12 @@ - - ## 功能 -- **OpenAI / Anthropic 兼容代理**:`/v1/chat/completions`、`/v1/responses`、`/v1/messages`、`/v1/models`;支持流式/非流式、文本、图片与函数工具调用;文件输入会明确拒绝。`messages` / `responses` 当前为无状态适配层,不支持服务端会话或上游专属工具。 +- **OpenAI / Anthropic 兼容代理**:`/v1/chat/completions`、`/v1/responses`、`/v1/messages`、`/v1/models`;支持流式/非流式、文本与函数工具调用;图片能力取决于 provider(当前 Qoder 支持,WorkBuddy / Trae 不支持);文件输入会明确拒绝。`messages` / `responses` 当前为无状态适配层,不支持服务端会话或上游专属工具。 - **多渠道账号池**:Qoder 国际版 / 国内版、WorkBuddy 国际版 / 国内版、Trae 国内版 Solo;地域隔离、账号固定、并发限制、冷却与同族故障切换 -- **常驻热 worker**:每账号独立 Node 进程与运行目录,鉴权、WASM 编码和云端 SSE 连接保持热;预热后小对话延迟约 1-2 秒,按请求拉起 CLI 的方案通常要 10 秒以上 -- **多种登录方式**:浏览器 Device Flow OAuth、PAT、`qoder-native-v1` 凭证导入/导出 +- **账号级常驻运行时**:Qoder 账号使用独立 Node 进程、HOME 与 WASM 上下文;WorkBuddy / Trae 使用进程内 HTTP/SSE 适配器。登录态、云端连接和账号隔离由各 provider 的运行时负责 +- **按 provider 支持多种登录方式**:浏览器 Device Flow OAuth、PAT,以及适用 provider 的凭证导入/导出 - **Web 控制台**:账号、模型、接入、请求历史与运行时日志,明暗主题 - **部署与运维**:Docker Compose 单容器、安全托管更新(升级前快照、失败自动回滚、逐版本升级)、默认只监听 `127.0.0.1` - **跨平台**:`linux/amd64` / `linux/arm64` 镜像;macOS、Windows 通过 Docker Desktop 运行 @@ -50,15 +48,15 @@ Base URL: http://127.0.0.1:3010/v1 API Key: <首次启动时生成的 Key> ``` -不指定账号时,调度器自动选择可用账号;需要固定账号时加请求头 `X-Qoder-Account: acc_...`。除 Chat Completions 外,也可使用 Anthropic `POST /v1/messages` 与 OpenAI `POST /v1/responses`;两者要求请求携带完整对话,不支持 `previous_response_id` / `conversation` 服务端续接。curl / PowerShell 示例见 [部署说明](deploy/README.md)。 +不指定账号时,调度器自动选择可用账号;需要固定账号时加请求头 `X-Qoder-Account: acc_...`(历史命名,适用于所有 provider)。除 Chat Completions 外,也可使用 Anthropic `POST /v1/messages` 与 OpenAI `POST /v1/responses`;两者要求请求携带完整对话,不支持 `previous_response_id` / `conversation` 服务端续接。需要会话粘性时,可设置 `X-CLI2API-Session`;curl / PowerShell 示例见 [部署说明](deploy/README.md)。 ## 工作方式
-
+
-
+