2c4e76dbba06f306ee6ecbcf5cc21b97901cec91
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d40a074828 |
qoder 0.2.57: QwenWork's gateway calls name the client, and a biz account refreshes for its team (tnt1223)
tnt1223 (Discord) signed in to QwenWork. Test models and the model list
both failed: "QwenWork models: HTTP 403: {"code":"403","message":"User
identity could not be verified"}". No QwenWork account was at hand, so
the case wasn't reproduced. These are the differences from QwenWorkCN.app
1.2.1 (its out/main/main.js) that the code shows:
- openApiJsonRequest puts User-Agent qoderwork/1.2.1, a fresh
X-Request-Id and getQwenWorkClientHeaders (X-QwenWork-Version,
-Release-Version 1.2.1-26092107, -Build 26092107, -Platform, -Arch,
-Channel stable) on every gateway call. These cover the device poll,
the account-context, wallets and the device token's refresh. The
plugin sent none of them. It now sends them on the QwenWork sites
(site.clientHeaders), in openapi() and in usage's read.
- refreshDeviceToken asks for {target:"biz", team_id} when the account
is a biz one (getIdentityFromUser: is_biz with an org and a team, read
through normalizeAccountContext), and for "c" otherwise. It adds
client_id and redirect_uri when the client signs in with that pair.
The plugin always asked for "c", which turned a biz account's token
personal on its first refresh. The sign-in now records identity and
teamId (accountIdentity), and deviceRefreshBody asks as the client
does. An enterprise-domain account sends no redirect_uri, since its
sign-in has none (siteOf).
- The 403 on the model list now adds that the sign-in's identity wasn't
recognised, and to sign in again. Other 403s read as before.
Qoder and Qoder CN are unchanged. A test checks that a Qoder call
carries no X-QwenWork-* or User-Agent, and that the refresh body is the
token alone.
Run on mote (bun 1.4.2):
- packages/qoder bun test: 381 pass, 0 fail.
- bun scripts/check.mjs: all packages ok.
Broken by hand in a copy, with the client headers dropped, the refresh
always "c", the identity not recorded, the enterprise redirect_uri kept
and the hint removed: 4 of the new tests failed.
Not tried:
- A real QwenWork account, personal or biz, so it isn't known that
these were the cause of the 403.
- The chat's Cosy-* signing. The official app signs it through its CLI's
wasm (sign-request), and that wasm also has Cosy-Organization-Id,
Cosy-Organization-Tags and Cosy-Data-Policy, which the plugin doesn't
send. Which account fields fill them wasn't read out of the wasm.
|
||
|
|
60b9abf2bc |
qoder 0.2.37: a QwenWork personal account's usage shows what is left, with each pool, instead of "no credits" (#385)
Cause: the public cloud's account-context answers a personal account's
quota with total and used null and only remaining (the reporter's
{"total": null, "used": null, "remaining": 2098.6336, "exceeded": false}).
parseAccountContext made a window only from total > 0, so every such
account read as "QwenWork: the account reports no credits". The usage
hook already read the account-context on site.usagePath, not Qoder's
/sash/api/v2/me/usage (that is the qoder path); the comment naming a
fetchSiteUsage that doesn't exist is corrected.
What QwenWork's own client reads, from QwenWorkCN.app 1.2.1's
app.asar out/main/main.js: fetchQuotaUsage reads
/api/v1/adapter/user/account-context?include=user,plan,quota,page,data_sharing
(unwrapAdapterResponse: the data object, else the envelope), and for a
personal account fetchUserWallets reads /api/v1/adapter/user/wallets,
taking daily_credits, monthly_credits and longterm_credits'
total_balance (mergeWalletsIntoCreditBreakdown).
Now: remaining is the card's balance, "2098.63 credits (daily 98.6 ·
long-term 2000)", with no used share made up; an account with a total
keeps its used / total window; remaining 0 or exceeded is a spent
window. The wallets are asked on the public cloud only, never for a biz
account or the enterprise flagship (the client doesn't either), and a
failed wallets read leaves the balance without pools. The envelope is
read wrapped in data or bare.
Not changed: an enterprise account on the public cloud, which the
client reads from /api/v2/quota/usage, still reads the account-context.
Run (bun 1.4.2): bun test in packages/qoder, 238 pass, 0 fail; bun
scripts/check.mjs, rc 0. The 5 new tests in qwenwork.test.mjs (built
from the reporter's bytes) fail on the old index.mjs, 14 pass 5 fail.
Probed gateway.qwenwork.cn with a bad token: wallets and
account-context answer 401, /sash/api/v2/me/usage 404.
Not tried: a real QwenWork account (none on this machine).
|
||
|
|
3a59be3caf |
qoder 0.2.34: QwenWork (千问办公), the public cloud and the enterprise flagship (#319)
QwenWork (千问办公) is served from the qoder package as two more provider ids, as the ruling on #313/#314 asked: `qwenwork` (gateway.qwenwork.cn, the desktop client's device flow and account-context usage) and `qwenwork-enterprise` (the enterprise flagship on the enterprise's own domain, asked at sign-in or preset by QWENWORK_ENT_DOMAIN). Chat, the model list and the queue are signed for the site (ClientType 6, scene qwork, cosy 1.1.59, product qoder_work). No PAT and no check-in for QwenWork, so Qoder's desktop identity never reaches it. Qoder and Qoder CN are unchanged. Reviewed at c543f1b (on main 8d687ad; main has no qoder or registry change since), by @LittlefishStudent. Run at c543f1b, sandbox HOME and TMPDIR, network pointed at a dead proxy: - packages/qoder `bun test`: 223 pass, 0 fail. `bun scripts/check.mjs qoder`: ok. - Broken by hand, one at a time: the queue status signed without its site, 1 red; the usage 401 rotation removed, 1 red; the site's system prompt ignored, 1 red; the enterpriseHost routing removed, 6 red. - Read every call of the changed signatures (cosyHeaders, userBlob, queueStatus, queueWait, qoderBody): each passes the site, and a Qoder site has none of the new fields, so its requests are as before (the earlier review's recording probe found them byte-identical). - magpie origin/main 4dfd88206's plugin host, sandbox HOME (scripts/try.sh qoder): qoder 17 models, qoder-cn 4, qwenwork 3, qwenwork-enterprise 3. Not tried against the real API here: no QwenWork account in the sandbox. The author ran sign-in, chats and usage against a real deployment. |