@magpie-community/opencode-qoder-auth 0.2.59 → 0.2.60

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 +10 -1
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1600,7 +1600,16 @@ function failure(status, text) {
1600
1600
  const said = msg && msg !== STATUS_CODES[status] ? ` (Qoder said ${status}: ${msg.slice(0, 300)})` : ""
1601
1601
  return { status: 401, message: "the sign-in lapsed — sign in again" + said, lapsed: true }
1602
1602
  }
1603
- if (status === 429 || msg.toLowerCase().includes("quota")) return { status: 429, message: "usage limit reached: " + msg }
1603
+ // Qoder's words go with the status and code they came in, and the reply
1604
+ // itself when it says more than the message: a 429 that names no quota
1605
+ // ("All models failed", QwenWork) is not shown as an account's limit
1606
+ // with nothing to tell it apart (dsh, QwenWork flash)
1607
+ if (status === 429 || msg.toLowerCase().includes("quota")) {
1608
+ const raw = String(text ?? "").trim()
1609
+ const seen = `Qoder replied HTTP ${status}${code ? `, code ${code}` : ""}`
1610
+ const body = raw && raw !== msg ? `: ${raw.slice(0, 400)}` : ""
1611
+ return { status: 429, message: `usage limit reached: ${msg} (${seen}${body})` }
1612
+ }
1604
1613
  return { status, message: msg }
1605
1614
  }
1606
1615
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-qoder-auth",
3
- "version": "0.2.59",
3
+ "version": "0.2.60",
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",