You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fc8fdb7
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: AGENTS.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,14 +11,14 @@ Keep writing-code docs in these files only:
11
11
|`docs/PLAN.md`| Current milestone checklist. |
12
12
|`docs/PROVIDERS.md`| Future account-provider design. Not a current milestone. |
13
13
14
-
Do not add new `TODO.md`, `NOTES.md`, or extra plan files. The only extra design doc is `docs/PROVIDERS.md` (WorkBuddy / future account types). User-facing install stays in `README.md` / `README_ZH.md`. Local protocol facts stay in ignored `docs/capture-notes.md`. Host ops stay gitignored in `docs/PRIVATE_DEPLOYMENT.md`.
14
+
Do not add new `TODO.md`, `NOTES.md`, or extra plan files. The only extra design doc is `docs/PROVIDERS.md` (WorkBuddy / Qoder CN / future account types). User-facing install stays in `README.md` / `README_ZH.md`. Local protocol facts stay in ignored `docs/capture-notes.md`. Host ops stay gitignored in `docs/PRIVATE_DEPLOYMENT.md`.
15
15
16
16
## Do
17
17
18
18
- Pull latest `main` and merge it into the current branch before starting any feature work (skip only when already on up-to-date `main`)
- Follow `docs/DESIGN.md` (taste v1 adapted for this console)
24
24
- Keep iterating Qoder login, usage, and account routing. Borrow scheduling ideas from [sub2api](https://github.com/Wei-Shaw/sub2api), not its commercial gateway
@@ -32,4 +32,4 @@ Do not add new `TODO.md`, `NOTES.md`, or extra plan files. The only extra design
32
32
- Leave console `/api/*` or worker `/admin/*` unauthenticated
33
33
- Copy sub2api billing, Redis slots, multi-tenant API keys, or session-hash-for-profit
34
34
- Add a new component library, purple AI chrome, centered generic login cards, or emoji in UI copy
35
-
- Start Cursor / Anthropic / WorkBuddy until the current Qoder milestone in `docs/PLAN.md` is done
35
+
- Start Cursor / Anthropic until the current Qoder milestone in `docs/PLAN.md` is done. Qoder CN is that milestone (`provider=qoder` + `region=cn`); do not spawn a full `qoderclicn` per request
Copy file name to clipboardExpand all lines: README.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -164,7 +164,7 @@ X-Qoder-Account: acc_...
164
164
- Route requests across multiple Qoder accounts with failover
165
165
- Keep Qoder login state available without starting a full CLI Agent per request
166
166
167
-
Qoder is the only supported upstream at this time. CLI2API is a local gateway; it does not provide accounts, quotas, or an official Qoder API service.
167
+
Supported account types are Qoder Global, Qoder CN, and WorkBuddy. CLI2API is a local gateway; it does not provide accounts, quotas, or an official API service.
168
168
169
169
## How it works
170
170
@@ -179,7 +179,7 @@ Each enabled account gets its own Node process and runtime directory so Qoder WA
179
179
180
180
## Features
181
181
182
-
- Browser Device Flow OAuth, PAT, and `qoder-native-v1` credential import/export
182
+
- Browser Device Flow OAuth, PAT, and `qoder-native-v1` credential import/export for Qoder Global and Qoder CN
183
183
- OpenAI-compatible `GET /v1/models`
184
184
- Streaming and non-streaming responses
185
185
- Tool calls and `reasoning_content`
@@ -196,6 +196,8 @@ Each enabled account gets its own Node process and runtime directory so Qoder WA
196
196
|`QODER_RUNTIME_DIR`|`/run/cli2api`| Ephemeral per-account Qoder runtime homes |
197
197
|`QODER_MAX_INFLIGHT`|`4`| Maximum concurrent requests per account |
198
198
|`QODER_WORKER_BASE_PORT`|`32100`| Internal worker port range |
199
+
|`QODERCLI_JS`| image default | Pinned Qoder Global CLI bundle |
| L | Qoder CN (`qoder` + `region=cn`) — planned, see below |
43
45
44
46
Typical small-chat latency is ~1-2s after warmup, versus ~10s+ for spawn-CLI wrappers.
45
47
@@ -168,15 +170,78 @@ no scheduling, billing, or persistence changes.
168
170
-[x] Account card renders quota progress bar + add-on line (danger at exceeded, warning at ≥80%)
169
171
-[x] Worker compat, Go manager, and frontend coverage
170
172
173
+
## Phase L — Qoder CN (China mainland)
174
+
175
+
Goal: add Qoder China as `provider=qoder` + `region=cn`. Reuse the existing
176
+
child-process worker and `qoder-native-v1` credentials. Pin a second CLI,
177
+
`@qodercn-ai/qoderclicn@1.1.27`, instead of a new protocol adapter.
178
+
179
+
Design facts and locked product decisions: `docs/PROVIDERS.md` section
180
+
「Qoder CN(中国大陆版)」. Do not spawn a full `qoderclicn` per request.
181
+
Do not invent a `qodercn` provider family. Do not upgrade the 1.1.27 pin.
182
+
183
+
### L0 descriptor
184
+
185
+
-[x] Register Qoder region `cn` on the existing Qoder descriptor
186
+
-[x] Accept `POST /api/accounts` with `provider=qoder, region=cn`
187
+
-[x] Keep historical empty region as `global`
188
+
-[x] Flip `TestStoreRejectsUnknownProviderAndRegion` so `qoder+cn` is valid
189
+
-[x] Do not merge L0 alone: an enabled CN account would still spawn the global CLI
190
+
191
+
### L1 worker CLI filename
192
+
193
+
-[x] Hook `qoderclicn.js` in `rewrite-loader.mjs` (same needles as 1.1.27 global; `includes("qodercli.js")` does **not** match `qoderclicn.js`)
194
+
-[x] Resolve default bundle paths for both packages in `daemon.mjs`
195
+
-[x] Choose `hotEndpoint` fallback from worker-only `QODER_SITE` or the loaded filename (`api1.qoder.sh` vs `gateway.qoder.com.cn`)
196
+
-[x] Do not use `QODERCLI_SITE` to flip CN/Global; that env does not change compile-time `Xi`
197
+
198
+
### L2 manager spawn
199
+
200
+
-[x] Add `QODERCNCLI_JS` / `QoderCNCLIPath`; missing CN path fails spawn, never falls back to global CLI
201
+
-[x] Keep `HOME={runtime}`. Pass CLI-readable dirs: `QODER_CONFIG_DIR={home}/.qoder` or `QODERCN_CONFIG_DIR={home}/.qoder-cn`. Do **not** rely on `QODER_HOME` — 1.1.27 CLI ignores it
202
+
-[x]`materializeHome` / `SyncCredential` take region and read/write `.qoder` or `.qoder-cn`
203
+
-[x] Export `qoder-native-v1` includes `provider` + `region`; import without region stays global for old bundles
204
+
-[x] Unit test: CN account env points at `qoderclicn.js` + `.qoder-cn`; global still uses `qodercli.js` + `.qoder`
205
+
206
+
### L3 same-region failover
207
+
208
+
-[x] Add `RegionFilter` to `RouteQuery`; treat empty item region as `global`
209
+
-[x] Thread region through `executor/chat.go``pick` / `attemptsFor` / stream + non-stream loops, not only `pool.go`
210
+
-[x] After the first pick, lock that account's region for the rest of the request
211
+
-[x] Sticky-escape from a cooling pin stays in the same region
212
+
-[x] Tests: Global A 429 → Global B, never CN; pin-CN cooling must not land on Global
213
+
-[x] Merge before L4; mixed-pool UI without L3 will failover across sites
214
+
215
+
### L4 console
216
+
217
+
-[x] Add `qoder-cn` i18n keys and `AddAccountModal` option
218
+
-[x]`accountProviderLabel` distinguishes Qoder CN from Qoder Global
219
+
-[x] PAT helper text for CN points at `https://qoder.com.cn/account/integrations`
220
+
221
+
### L5 image and config
222
+
223
+
-[x] Install both `@qoder-ai/qodercli@1.1.27` and `@qodercn-ai/qoderclicn@1.1.27` in the image
224
+
-[x] Export `QODERCLI_JS` and `QODERCNCLI_JS`
225
+
-[x] README / CHANGELOG bilingual notes
226
+
227
+
### L6 acceptance
228
+
229
+
-[ ] Empty CN account → browser or PAT login → chat `只回复OK`
230
+
-[ ] Import CN `qoder-native-v1` → daemon becomes hot
231
+
-[ ] Mixed pool: pin stays on the matching CLI; Global 429 does not hit CN
0 commit comments