ab160534cc813cf9fdff12d8a1935c8f04fafc1e
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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).
|
||
|
|
731277004a |
qoder 0.2.53: Qoder CN signs in to an enterprise dedicated domain (企业版专属域)
Milktea (Discord) has a Qoder CN enterprise dedicated domain on <corp>.rdc.aliyuncs.com. Qoder IDE signs in to it through 「企业版专属域登录」 once the domain is set in its settings. The VPC method takes only <instance>.vpc.qoder.com.cn, so it refused the domain. The new method, "Sign in with Qoder CN Enterprise dedicated domain (企业版专属域)", takes any https host. It follows Qoder IDE 1.38.0's workbench (config.general.dedicatedUrl, _loginDedicatedWithProbe): - It asks GET <domain>/algo/api/v1/version. A 404 is a Lingma 1.0 dedicated domain. Its sign-in is cosy's login/generateUrl with a qoder-cn-ide:// callback, which this plugin doesn't serve, so it is refused with what it is. Any other status is Qoder CN 2.0. If nothing answers, the domain is refused (the IDE falls back to Lingma there). - For 2.0, the domain's origin serves /device/selectAccounts, with the IDE's client id f5a7f67c-… and no redirect_uri. The poll, user info, tokens and usage go to <label>-openapi.<rest>, and models and chat to <label>-gateway.<rest>. These hosts follow the IDE's RNc/TNc/JL0 rule, which keeps the origin for an IP or a dotless host. - Inferred: the IDE's language server picks the chat host, and its rule wasn't read. The account chats on the gateway host if that host answers at sign-in. If not, it chats on the domain itself, which answered on /algo. The pick is kept as dedicatedApi. The domain is kept on the account as `dedicated` (and `vpc`, for its name suffix). siteOf routes it before the VPC rule. A kept domain that isn't one is asked to sign in again, never sent to the public hosts. Run (mote, bun 1.4.2): packages/qoder `bun test`, 355 pass, 0 fail (dedicated.test.mjs 10, vpc.test.mjs 17 unchanged). `bun scripts/check.mjs` passes. Broken by hand: with siteOf's dedicated branch off, the 404 check off, and the origin fallback off, 4 of the 10 dedicated tests went red (Lingma refusal, gateway chat, origin fallback, renewal). Not tried: any real dedicated account, either kind. The fixtures come from the IDE's code, and the reply shapes are the VPC ones (#312). The Lingma 1.0 path is not implemented. |