@magpie-community/opencode-zcode-auth 0.1.35 → 0.1.36

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.
Files changed (3) hide show
  1. package/README.md +6 -3
  2. package/index.mjs +9 -5
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -166,9 +166,12 @@ and end. The card's plan and term stay the coding plan's. A gift read
166
166
  that fails leaves just the coding card — magpie hides a card's windows
167
167
  behind an error, so a gift hiccup must not black out a working Coding
168
168
  Plan. A gift that goes out of date while requests use it simply stops
169
- showing. Beside the coding plan's windows each gift bucket is named
170
- after its plan ("Start Plan · GLM-5.1-Trial"), one plan or several, so
171
- the two allowances can't be read as one.
169
+ showing. Beside the coding plan's windows each gift bucket is named by
170
+ its model first, as ZCode's own "Today's balance" lists it, then by its
171
+ plan ("GLM-5.1-Trial · Start Plan"), one plan or several, so the two
172
+ allowances can't be read as one. The model comes first because magpie's
173
+ ring and account row cut a long name short: "ZCODE GLOBAL BUI…" (the
174
+ Start Plan claimed on 10-29) said neither (#504).
172
175
 
173
176
  **Gift plans that start later.** A plan on the balance whose `starts_at`
174
177
  is still to come (a Start Plan taking effect at 23:00 today) serves
package/index.mjs CHANGED
@@ -800,7 +800,7 @@ async function startUsage(s) {
800
800
  return g
801
801
  }
802
802
 
803
- // byPlan names a bucket after its plan ("ZCode 1024 Dev Day · GLM-5.3")
803
+ // byPlan names a bucket after its plan ("GLM-5.3 · ZCode 1024 Dev Day")
804
804
  // when the gift's buckets come from more than one plan: two plans each
805
805
  // give a GLM-5.3, and named alike a spent one and a live one can't be
806
806
  // told apart (01huadalang, Discord: the new-user plan's spent GLM-5.3
@@ -808,7 +808,7 @@ async function startUsage(s) {
808
808
  // their own names, as the card's header names the plan.
809
809
  function byPlan(windows) {
810
810
  const several = new Set(windows.map((w) => w._plan || "")).size > 1
811
- return (name, plan) => (several && plan ? plan + " · " + name : name)
811
+ return (name, plan) => (several && plan ? name + " · " + plan : name)
812
812
  }
813
813
 
814
814
  // countedFirst puts the buckets a request spends before those set aside
@@ -869,9 +869,13 @@ async function dualUsage(s, out) {
869
869
  // Several buckets may serve one model: one spent sibling cannot block it.
870
870
  const best = bestBuckets(g.windows)
871
871
  // beside the Coding Plan's windows every gift bucket is named after
872
- // its plan, one plan or several: "Start Plan · GLM-5.1-Trial" can't
873
- // be read as the Coding Plan's own (windy, Discord)
874
- const label = (name, plan) => first(plan, "Start Plan") + " · " + name
872
+ // its plan, one plan or several: "GLM-5.1-Trial · Start Plan" can't
873
+ // be read as the Coding Plan's own (windy, Discord). The bucket's
874
+ // own name (ZCode's show_name, as its "Today's balance" lists it)
875
+ // comes first: magpie's ring and account row cut a long name short,
876
+ // and "ZCODE GLOBAL BUI…" said neither the model nor the plan's
877
+ // kind, so the Start Plan read as missing (Danbuth, plugins#504)
878
+ const label = (name, plan) => name + " · " + first(plan, "Start Plan")
875
879
  out.windows.push(...countedFirst(g.windows.map(({ _plan: p, _spent, ...w }, i) => {
876
880
  const selected = gift.allModels.filter((m) => best.get(m.toLowerCase()) === i)
877
881
  const models = selected.map(giftID)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-zcode-auth",
3
- "version": "0.1.35",
3
+ "version": "0.1.36",
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, and claims its gift plans daily",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",