@magpie-community/opencode-workbuddy-auth 0.2.19 → 0.2.20

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 +8 -0
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -3909,6 +3909,14 @@ function makePlugin(site) {
3909
3909
  const { runsOutAt, runsOut, ...counts } = more
3910
3910
  const w = { ...creditWindow("Extra credits", counts), aside: true, ...(runsOutAt ? { runsOutAt, runsOut } : {}) }
3911
3911
  out.windows.splice(out.windows.indexOf(credits) + 1, 0, w)
3912
+ // and, as with the split's, the soonest of them to lapse is
3913
+ // the account's too, on the window that stops it: routing
3914
+ // reads none set aside, so an account whose extra credits
3915
+ // expire first went unknown to it (Kayphoon on Discord)
3916
+ const at = runsOutAt ? Date.parse(runsOutAt) : 0
3917
+ const was = credits.runsOutAt ? Date.parse(credits.runsOutAt) : 0
3918
+ if (at > 0 && (!was || at < was)) Object.assign(credits, { runsOutAt, runsOut })
3919
+ else if (at > 0 && at === was) credits.runsOut = (credits.runsOut ?? 0) + runsOut
3912
3920
  }
3913
3921
  } catch {}
3914
3922
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-workbuddy-auth",
3
- "version": "0.2.19",
3
+ "version": "0.2.20",
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": "./opencode.mjs",