Files
plugins/packages/qoder/package.json
T
yetone a16adb3025 qoder 0.2.56: Qoder CN signs in to a Lingma 1.0 dedicated domain with Qoder CN IDE's account (Milktea)
Milktea (Discord) said the plugin still can't sign in to their Qoder CN
IDE enterprise dedicated domain (企业专属域). Their domain answers 404 at
/algo/api/v1/version, so Qoder IDE 1.38.0 counts it as Lingma 1.0
(dedicated_lingma; the IDE then logs "use extension 127 login" and leaves
the sign-in to its language server). 0.2.53 refused such a domain.

Milktea measured these on that host (their gist):
- /device/selectAccounts and /api/v1/jobToken/exchange answer 404.
- A console PAT or the console's cookies get 105 "Login timeout" at /algo.
- /algo/api/v3/user/* answers "Request discarded".
What works is the session the IDE's worker keeps:
- <cosyHome>/cache/id holds the machine id (or <cosyHome>/id).
- <cosyHome>/cache/user is base64(AES-128-CBC(JSON)), with key = IV =
  the id's first 16 chars. The JSON has uid, organization_id, email,
  security_oauth_token (pt-), refresh_token and expire_time.

What changed:
- The dedicated method's 404 branch now reads that cache (lingmaSignIn).
  The account it saves has lingma: true, the domain, the IDE's token and
  its machine id, and is named <email> (<domain>). With no cache, or a
  lapsed one, the sign-in says so and lists the folders it looked in.
- cosyHome comes from the CN IDE's main.js: <userDataPath>/SharedClientCache.
  That is ~/Library/Application Support/QoderCN on macOS, %APPDATA%\QoderCN
  on Windows and $XDG_CONFIG_HOME (~/.config)/QoderCN on Linux. The gist's
  Linux-only folders, ~/.lingma and QODERCN_COSY_HOME are read too.
- Every call goes to the domain itself (lingmaSite). The chat is signed
  as the gist captured the worker signing it: Cosy-ClientType 0, version
  2.5.18, no Cosy-Scene or Cosy-Business-*, the assistant scene, and
  model_config format dashscope.
- The models are the IDE's own keys: qmodel_latest, dashscope_qmodel and
  q36fmodel, all modelSelector.item.* names in the CN IDE's workbench. The
  domain's own list names keys its chat refuses. A "Model not exist" said
  in the stream falls through to the next key.
- Renewal reads the cache again; the worker renews its own token ("CN 1.0
  refresh" in its strings). This happens near the token's end, in
  auth.refresh, and once after a 105. With nothing newer, the account
  gets a 401 marked expired that says to open Qoder CN IDE.
- Usage reads nothing, and the check-in is inactive.
- events: a frame with no choices that holds an error, or a code and a
  message, is now the turn's failure. Before, it was read past, which gave
  an empty answer. This is the only change outside the Lingma path.
- README: a section on Lingma 1.0 domains.

Run (mote, bun 1.4.2): packages/qoder `bun test`, 375 pass, 0 fail. The new
lingma.test.mjs has 11 tests, with fixtures in the gist's literal shapes.
fetch is stubbed and HOME is a sandbox. On 0.2.55 all 11 are red. `bun
scripts/check.mjs` passes. dedicated.test.mjs lost its "Lingma is refused"
test, which lingma.test.mjs now covers.

Broken by hand: with Cosy-Scene and Cosy-Business-* kept, and with the
events error frame off, 2 of the 11 went red (the chat's headers, and the
fall-through on an error said in an OK frame).

Not tried:
- Any real Lingma dedicated domain or real Qoder CN IDE cache. Milktea's
  gist was run against one; this code wasn't.
- The cache's AES key, the SSE wrapper, the version 2.5.18 and the
  missing headers come from the gist's capture, not from the IDE's code.
- Whether the cached account belongs to the domain entered isn't checked
  (the cache doesn't name a domain).
- The Remote-SSH layout (<machineId>/SharedClientCache).
2026-11-03 09:33:06 +08:00

29 lines
716 B
JSON

{
"name": "@magpie-community/opencode-qoder-auth",
"version": "0.2.56",
"description": "Qoder and QwenWork (千问办公) subscriptions in OpenCode and magpie: qoder.com, qoder.cn, gateway.qwenwork.cn and the enterprise flagship, VPC and dedicated domains",
"type": "module",
"main": "./index.mjs",
"exports": "./index.mjs",
"files": [
"index.mjs",
"README.md",
"LICENSE-CLIProxyAPI"
],
"keywords": [
"opencode",
"opencode-plugin",
"magpie",
"qoder",
"qoder-cn",
"qwenwork",
"千问办公"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/magpie-community/plugins.git",
"directory": "packages/qoder"
}
}