@magpie-community/opencode-qoder-auth 0.2.58 → 0.2.59

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 (2) hide show
  1. package/index.mjs +6 -2
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2692,7 +2692,11 @@ function parseUsage(env) {
2692
2692
  const used = b.used != null ? b.used : total - b.remaining
2693
2693
  if (used < 0) return
2694
2694
  const unit = b.unit || "credits"
2695
- const w = { name: b.name || name, used: Math.min(100, (100 * used) / total), display: `${gfmt(used)} / ${gfmt(total)} ${unit}` }
2695
+ // the count too, so magpie says "183 / 2,000 credits left" as Qoder's
2696
+ // own panel does, not a bare share (jzing.draw on Discord); the plan's
2697
+ // credits refresh when the plan says, as the panel's "refreshes on" does
2698
+ const w = { name: b.name || name, used: Math.min(100, (100 * used) / total), display: `${gfmt(used)} / ${gfmt(total)} ${unit}`, amount: used, limit: total, unit }
2699
+ if (name === "Credits" && until) w.resetsAt = until
2696
2700
  out.windows.push(w)
2697
2701
  if (SPENT_IN_TURN.has(name)) turn.push({ w, used: Math.min(used, total), total, unit })
2698
2702
  }
@@ -2705,7 +2709,7 @@ function parseUsage(env) {
2705
2709
  const used = turn.reduce((a, p) => a + p.used, 0)
2706
2710
  const total = turn.reduce((a, p) => a + p.total, 0)
2707
2711
  for (const p of turn) p.w.aside = true
2708
- out.windows.unshift({ name: "Total credits", used: Math.min(100, (100 * used) / total), display: `${gfmt(used)} / ${gfmt(total)} ${turn[0].unit}` })
2712
+ out.windows.unshift({ name: "Total credits", used: Math.min(100, (100 * used) / total), display: `${gfmt(used)} / ${gfmt(total)} ${turn[0].unit}`, amount: used, limit: total, unit: turn[0].unit })
2709
2713
  }
2710
2714
  const dedicated = field("dedicatedResourcePackages", "dedicated_resource_packages")
2711
2715
  for (const b of Array.isArray(dedicated) ? dedicated : []) add(b, "Dedicated credits")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-qoder-auth",
3
- "version": "0.2.58",
3
+ "version": "0.2.59",
4
4
  "description": "Qoder and QwenWork (千问办公) subscriptions in OpenCode and magpie: qoder.com, qoder.cn, gateway.qwenwork.cn and the enterprise flagship, VPC and dedicated domains",
5
5
  "type": "module",
6
6
  "main": "./opencode.mjs",