@magpie-community/opencode-qoder-auth 0.2.65 → 0.2.67

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 +9 -1
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2889,7 +2889,14 @@ function parseUsage(env) {
2889
2889
  const used = turn.reduce((a, p) => a + p.used, 0)
2890
2890
  const total = turn.reduce((a, p) => a + p.total, 0)
2891
2891
  for (const p of turn) p.w.aside = true
2892
- 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 })
2892
+ const sum = { 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 }
2893
+ // the plan's credits renew when the plan says, and what is left of them
2894
+ // is lost then: routing reads no window set aside, so the whole renews
2895
+ // with the plan's, as WorkBuddy's does (a Teams account renewing
2896
+ // tomorrow was ranked as one that never renews, behind an account
2897
+ // renewing in 18 days: @tnt12231 on X)
2898
+ if (until && turn.some((p) => p.w.resetsAt)) sum.resetsAt = until
2899
+ out.windows.unshift(sum)
2893
2900
  }
2894
2901
  const dedicated = field("dedicatedResourcePackages", "dedicated_resource_packages")
2895
2902
  for (const b of Array.isArray(dedicated) ? dedicated : []) add(b, "Dedicated credits")
@@ -3797,6 +3804,7 @@ const makePlugin = (site) => async ({ client }) => {
3797
3804
  // doesn't call this. The device token of a job-token account has no
3798
3805
  // end on record: usage rotates it once Qoder refuses it, as before.
3799
3806
  refreshLead: RENEW_LEAD,
3807
+ rotating: true,
3800
3808
  async refresh(auth) {
3801
3809
  // a Lingma 1.0 account: the IDE's newer token, when it has one;
3802
3810
  // nothing when it hasn't yet (fresh says so once it is needed)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-qoder-auth",
3
- "version": "0.2.65",
3
+ "version": "0.2.67",
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",