The app's sign-in stores the account ZCode is signed in to, and stateOf read ~/.zcode/v2 again for every request. After ZCode switched to account B and the app's sign-in was added again, both entries read B's credentials: A's sent B's requests and its usage card showed B. stateOf now follows ZCode's own credentials only when ZCode's user is the entry's accountId. Otherwise (ZCode signed out, or on another account) it uses the snapshot saved at sign-in, which holds the coding plan key, the Start Plan JWT, the team project and the device. A snapshot whose JWT has run out says EXPIRED (sign in again), as a lapsed sign-in already did, instead of borrowing B's session. own.test.mjs: two app sign-ins (A, then B) with ZCode on B; A's request carries A's key and no request (messages, plan, usage) carries B's key or JWT; and A with only an expired JWT says sign in again without sending B's. Both fail on 0.1.15 (A sent idB.secretB; the expired case was served with B's JWT). The first test now keeps the account's user_info as ZCode signs in again. HOME=$(mktemp -d) bun test packages/zcode: 79 pass. bun scripts/check.mjs zcode passes.
17 lines
636 B
JSON
17 lines
636 B
JSON
{
|
|
"name": "@magpie-community/opencode-zcode-auth",
|
|
"version": "0.1.16",
|
|
"description": "OpenCode provider plugin: signs in to Z.ai's or BigModel's (智谱) GLM Coding Plan as ZCode does, including team seats and ZCode's Start Plan",
|
|
"type": "module",
|
|
"main": "./index.mjs",
|
|
"exports": "./index.mjs",
|
|
"files": ["index.mjs", "prompt.mjs", "README.md"],
|
|
"keywords": ["opencode", "opencode-plugin", "magpie", "zcode", "z.ai", "bigmodel", "glm", "coding-plan"],
|
|
"license": "MIT",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/magpie-community/plugins.git",
|
|
"directory": "packages/zcode"
|
|
}
|
|
}
|