@magpie-community/opencode-qoder-auth 0.2.11 → 0.2.12

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 +7 -2
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -708,8 +708,13 @@ function failure(status, text) {
708
708
  } catch {}
709
709
  msg ||= STATUS_CODES[status] ?? `HTTP ${status}`
710
710
  // a refused chat is the built-in's 401, which never marked the account
711
- // lapsed: only a refused refresh did (errorResponse says kept)
712
- if (status === 401 || status === 403) return { status: 401, message: "the sign-in lapsed — sign in again" }
711
+ // lapsed: only a refused refresh did (errorResponse says kept). Qoder's
712
+ // own words go with it: a 401 right after signing in isn't a lapsed
713
+ // sign-in, and its reason is what says what is (Yayoi_no_yume on X).
714
+ if (status === 401 || status === 403) {
715
+ const said = msg && msg !== STATUS_CODES[status] ? ` (Qoder said ${status}: ${msg.slice(0, 300)})` : ""
716
+ return { status: 401, message: "the sign-in lapsed — sign in again" + said }
717
+ }
713
718
  if (status === 429 || msg.toLowerCase().includes("quota")) return { status: 429, message: "usage limit reached: " + msg }
714
719
  return { status, message: msg }
715
720
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-qoder-auth",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "Qoder subscriptions in OpenCode and magpie: Qoder (qoder.com) and Qoder CN (qoder.cn)",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",