@magpie-community/opencode-zcode-auth 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/index.mjs +7 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,7 +31,11 @@ over Anthropic's Messages API. Provider id: `zcode`.
|
|
|
31
31
|
- Uses the account the ZCode app on this computer is signed in to. For
|
|
32
32
|
every request it reads ZCode's own credentials (`~/.zcode/v2`), so it
|
|
33
33
|
follows ZCode as it signs in again, renews its session or switches to a
|
|
34
|
-
team's plan.
|
|
34
|
+
team's plan, but only while ZCode is signed in to that same account.
|
|
35
|
+
Once ZCode signs out, or signs in to another account, the sign-in uses
|
|
36
|
+
what it saved when it was added; when that session has run out, it
|
|
37
|
+
asks to be signed in again. It never sends one account's requests with
|
|
38
|
+
another's credentials: to use both, add the app's sign-in once for each.
|
|
35
39
|
- **GLM Coding Plan API key**
|
|
36
40
|
- Paste a key (`<id>.<secret>`) and say which site it is from.
|
|
37
41
|
|
package/index.mjs
CHANGED
|
@@ -1044,7 +1044,7 @@ function ownSignIn() {
|
|
|
1044
1044
|
function asZCode() {
|
|
1045
1045
|
return {
|
|
1046
1046
|
url: "",
|
|
1047
|
-
instructions: "Uses the account the ZCode app is signed in to, and follows it.",
|
|
1047
|
+
instructions: "Uses the account the ZCode app is signed in to, and follows it while ZCode stays signed in to that account.",
|
|
1048
1048
|
method: "auto",
|
|
1049
1049
|
async callback() {
|
|
1050
1050
|
const own = ownSignIn()
|
|
@@ -1064,10 +1064,13 @@ function stateOf(auth) {
|
|
|
1064
1064
|
s = JSON.parse(auth.refresh)
|
|
1065
1065
|
} catch {}
|
|
1066
1066
|
if (s.source === "zcode") {
|
|
1067
|
-
// ZCode's own, read now
|
|
1068
|
-
//
|
|
1067
|
+
// ZCode's own, read now, while ZCode is signed in to this same
|
|
1068
|
+
// account. Signed out, or signed in to another account since, it is
|
|
1069
|
+
// what it was when this was signed in: another account's key would
|
|
1070
|
+
// send this account's requests as that one, and an expired session
|
|
1071
|
+
// says sign in again (EXPIRED) rather than borrowing another's.
|
|
1069
1072
|
const own = ownSignIn()
|
|
1070
|
-
if (own) {
|
|
1073
|
+
if (own && own.user === String(auth.accountId ?? "")) {
|
|
1071
1074
|
const { user, ...now } = own
|
|
1072
1075
|
s = { source: "zcode", device: s.device, plan: s.plan, ...now }
|
|
1073
1076
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magpie-community/opencode-zcode-auth",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"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",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.mjs",
|