@magpie-community/opencode-workbuddy-auth 0.1.7 → 0.1.8

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 +4 -2
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -474,7 +474,9 @@ function capacity(v) {
474
474
  const compact = (n) => (Number.isInteger(n) ? String(n) : n.toFixed(2).replace(/0+$/, "").replace(/\.$/, ""))
475
475
 
476
476
  // usageOf is the account's credits, from its resource summary: the plan's
477
- // credits used against what the cycle grants, as magpie's built-in said.
477
+ // credits used against what the cycle grants, as magpie's built-in said —
478
+ // the count itself too (amount of limit, in credits), for magpie to say it
479
+ // as used or left beside the share (magpie#659).
478
480
  function usageOf(sum, plan) {
479
481
  const out = { plan: plan || (sum?.IsPaidUser ? "Pro" : "Free"), windows: [] }
480
482
  let total = 0, used = 0
@@ -482,7 +484,7 @@ function usageOf(sum, plan) {
482
484
  total += capacity(p?.CycleTotalCapacity)
483
485
  used += capacity(p?.CycleUsedCapacity)
484
486
  }
485
- if (total > 0) out.windows.push({ name: "Credits", used: (100 * used) / total, display: `${compact(used)} / ${compact(total)}` })
487
+ if (total > 0) out.windows.push({ name: "Credits", used: (100 * used) / total, display: `${compact(used)} / ${compact(total)}`, amount: used, limit: total, unit: "credits" })
486
488
  return out
487
489
  }
488
490
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-workbuddy-auth",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "OpenCode provider plugins for WorkBuddy's plans: WorkBuddy (CodeBuddy, copilot.tencent.com) and WorkBuddy AI (www.workbuddy.ai)",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",