@magpie-community/opencode-qoder-auth 0.2.44 → 0.2.45

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 -0
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2179,6 +2179,15 @@ function parseUsage(env) {
2179
2179
  }
2180
2180
  const dedicated = field("dedicatedResourcePackages", "dedicated_resource_packages")
2181
2181
  for (const b of Array.isArray(dedicated) ? dedicated : []) add(b, "Dedicated credits")
2182
+ // A free account (personal_standard) with no add-on credits has a plan of
2183
+ // 0 and nothing else: Qoder's client shows that pool as 0/0 and counts the
2184
+ // account as out of credits. Without a window of its own magpie showed no
2185
+ // credits at all (Ariel on Discord), so it reads as none left.
2186
+ if (out.windows.length === 0) {
2187
+ const zero = (b) => b !== null && typeof b === "object" && !Array.isArray(b) && (b.total ?? b.cap) === 0
2188
+ const pools = [field("userQuota", "user_quota"), field("addOnQuota", "add_on_quota"), field("orgResourcePackage", "org_resource_package")]
2189
+ if (pools.some(zero)) out.windows.push({ name: "Credits", used: 100, display: "0 credits left" })
2190
+ }
2182
2191
  return out
2183
2192
  }
2184
2193
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-qoder-auth",
3
- "version": "0.2.44",
3
+ "version": "0.2.45",
4
4
  "description": "Qoder and QwenWork (千问办公) subscriptions in OpenCode and magpie: qoder.com, qoder.cn, gateway.qwenwork.cn and the enterprise flagship (VPC)",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",