What changed: ZCode 3.14 has a 数据存储路径 (data storage path) setting. Changing it copies ~/.zcode/v2 to <folder>/.zcode/v2 (all but setting.json, copyDataDirectory's filter) and from the next start ZCode reads credentials.json and runtime/provider from there. The choice stays in the home folder's .zcode/v2/setting.json as dataBaseDir (readBootstrapDataBaseDirFromDisk), and setting.json itself is always read from the home folder (getSettingsFile: ZCODE_DESKTOP_HOME_DIR, HOME, USERPROFILE). The plugin read credentials.json and runtime/provider from ~/.zcode/v2 only, so for such a user "ZCode app's sign-in" read the stale copy left at home (or nothing). It now reads dataBaseDir as magpie's built-in does (magpie 41972b25f, internal/appdir ZCodeDataIn: trimmed, ignored when empty, not a string or not absolute) for credentials.json and the zcode-builtin.json walk, and keeps reading setting.json (the team plan) from the home folder. The credential key's seed is unchanged: ZCode builds it from os.homedir(), not the data folder. Read from ZCode 3.14.3's app.asar (a copy): out/main/index.js (bootstrap), out/main/chunk-*.js and out/host/chunk-*.js (getDataBaseDir, getAppConfigDir, copyDataDirectory, getCredentialsFile, the settings file under the home folder, defaultCredentialSecret). What was run: - moved.test.mjs (new): with dataBaseDir set, ownSignIn takes the moved folder's key and session over the stale home copy, and a team plan named in the home setting.json; "", blank, relative, number and null keep the home folder. With zcodeDir put back on homedir() it fails (old key read). - HOME=$(mktemp -d) bun test at the repo root: 1185 pass, 0 fail. - bun scripts/check.mjs zcode. - Not run: a real ZCode with a moved folder, Windows.
17 lines
636 B
JSON
17 lines
636 B
JSON
{
|
|
"name": "@magpie-community/opencode-zcode-auth",
|
|
"version": "0.1.17",
|
|
"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"
|
|
}
|
|
}
|