@magpie-community/opencode-zcode-auth 0.1.50 → 0.1.51

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 +7 -3
  2. package/index.mjs +11 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -359,9 +359,13 @@ plans add `-Trial` entries, which are told as read):
359
359
  | GLM-5-Turbo | 200K | 64K | none, high |
360
360
 
361
361
  The Start Plan's config has all of these except GLM-5.3. An account
362
- with no GLM Coding Plan also lists every model its gift plans serve under
363
- the model's own name, as ZCode does (the Start Plan's GLM-5.3 bucket makes
364
- GLM-5.3 a model), since all of its requests go to the gift anyway.
362
+ with no GLM Coding Plan lists the models its gift plans' balance names,
363
+ under each model's own name, as ZCode does (the Start Plan's GLM-5.3
364
+ bucket makes GLM-5.3 a model), since all of its requests go to the gift
365
+ anyway. A config model the balance doesn't name is left out: an account
366
+ whose Start Plan holds only GLM-5.3-Flash lists GLM-5.3-Flash (and its
367
+ -Trial entry), not GLM-5.2 or GLM-5-Turbo. Only a balance that names no
368
+ model leaves the config's list standing.
365
369
 
366
370
  A gift plan's models appear again as `<model>-Trial` entries, so a
367
371
  request can spend the gift's quota on purpose. A trial entry is listed
package/index.mjs CHANGED
@@ -768,6 +768,12 @@ async function claimOne(s, planID) {
768
768
  // gifts are the rewards website's, claimed in the client.
769
769
  const TOUCH = "/api/v1/marketing/touch"
770
770
  const CLAIM_ACTION = "claim_zcode_plan"
771
+ // touchSeq is the feed's seq: ZCode's own count of its feed requests
772
+ // since the process started, from 0, one GET per refresh. It is not a
773
+ // page: "仅供服务端日志定位,不改变投放判断" (docs/marketing-touch-client.md,
774
+ // marketingTouchService.ts's bootRequestSeq, zai-org/ZCode@a9fe401), so a
775
+ // check-in asks once, never seq 0..8 in a row (plugins#676), and a banner
776
+ // seen at one seq and not another is a delivery arriving later.
771
777
  let touchSeq = 0
772
778
  // clientLanguage is the language ZCode names to marketing/touch: zh-CN or
773
779
  // en-US, its two UI languages, never another (marketingTouchService's
@@ -2369,6 +2375,11 @@ export async function ZCodeAuthPlugin({ client, magpie } = {}, options = {}) {
2369
2375
  // the list it was told last, as the built-in keeps the one it fetched last
2370
2376
  const fell = !ms.length
2371
2377
  if (fell) ms = start ? START_MODELS : MODELS
2378
+ // a gift-only account serves what its balance names, as ZCode
2379
+ // offers it (resolveStartPlanBalanceAvailability): the Start
2380
+ // Plan's config models the balance lacks would only be refused
2381
+ // (young02036). A balance naming none leaves the config's list.
2382
+ if (start && giftNames(gift).length) ms = ms.filter((m) => giftNames(gift).some((x) => x.toLowerCase() === m.id.toLowerCase()))
2372
2383
  const url = s.base + "/v1"
2373
2384
  const out = Object.fromEntries(ms.map((m) => [m.id, model(m, url)]))
2374
2385
  const details = [...ms, ...modelsOf(cfg, planID(START_BASE)), ...modelsOf(cfg, planID(ZAI_BASE)), ...MODELS]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-zcode-auth",
3
- "version": "0.1.50",
3
+ "version": "0.1.51",
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": "./opencode.mjs",