@magpie-community/opencode-trae-auth 0.1.5 → 0.1.6

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 +3 -2
  2. package/index.mjs +5 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -105,8 +105,9 @@ magpie's usage card shows the account's credits:
105
105
  - **Source:** `api.trae.cn/trae/api/v2/pay/ide_user_ent_usage`.
106
106
  - **What it adds up:** each entitlement pack's `credits_limit` (-1 means
107
107
  unlimited) and what the pack has used.
108
- - **What it shows:** credits left as the balance, and the share used as a
109
- window.
108
+ - **What it shows:** one Credits window: the credits used of the packs'
109
+ total, with the share, which magpie shows as used or left like
110
+ WorkBuddy's.
110
111
 
111
112
  ## Daily check-in
112
113
 
package/index.mjs CHANGED
@@ -881,8 +881,11 @@ export const TraeCNAuthPlugin = async ({ client }) => {
881
881
  const out = { plan: r.v.is_credits_billing ? "Credits" : "Free", user: a.name || a.uid, signIn }
882
882
  if (c.unlimited) out.balance = "unlimited"
883
883
  else if (c.limit > 0) {
884
- out.balance = `${round(Math.max(0, c.limit - c.used))} of ${round(c.limit)} credits left`
885
- const w = { name: "Credits", used: Math.max(0, Math.min(100, (c.used / c.limit) * 100)) }
884
+ // the count rides on the window (amount of limit, in credits), as
885
+ // WorkBuddy's does, so magpie says it in the window's row, used or
886
+ // left, in its own words and number format, rather than as an
887
+ // English balance line beside it (yetone/magpie#694)
888
+ const w = { name: "Credits", used: Math.max(0, Math.min(100, (c.used / c.limit) * 100)), amount: round(c.used), limit: round(c.limit), unit: "credits" }
886
889
  if (c.until) w.resetsAt = new Date(c.until).toISOString()
887
890
  out.windows = [w]
888
891
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-trae-auth",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "OpenCode provider plugin for Trae CN (trae.cn): your Trae CN account's models, free tier included, with Trae's own browser sign-in",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",