@magpie-community/opencode-qoder-auth 0.2.11 → 0.2.13
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.
- package/README.md +10 -4
- package/index.mjs +36 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -91,17 +91,23 @@ itself.
|
|
|
91
91
|
## Models
|
|
92
92
|
|
|
93
93
|
The `provider.models` hook reads the account's own list, as Qoder's client
|
|
94
|
-
asks for it (`/algo/api/v2/model/list`). It keeps the enabled
|
|
95
|
-
|
|
94
|
+
asks for it (`/algo/api/v2/model/list`). It keeps the enabled models of the
|
|
95
|
+
listing's `app` scene, the list Qoder's app shows and the one a request
|
|
96
|
+
names (`session_type: "app"`), and adds any model only the `chat` scene
|
|
97
|
+
still lists after the model it follows there, so a model picked before
|
|
98
|
+
stays served (since 0.2.13, #97: the app listed Fast, 0.8×, where chat
|
|
99
|
+
lists Performance, 1.1×). It leaves out "auto" and "default", which route
|
|
100
|
+
inside Qoder. It takes
|
|
96
101
|
each model's reasoning levels from its `thinking_config`, and its context
|
|
97
102
|
from its `context_config`: the largest window it offers (Qoder's docs
|
|
98
103
|
give Qwen3.8-Flash 200K, 400K and 1M), not `max_input_tokens` (180K
|
|
99
104
|
there), which is only what a request naming no window gets. A model listed
|
|
100
105
|
with no windows keeps `max_input_tokens`.
|
|
101
106
|
|
|
102
|
-
The `config` hook declares the list as it was on 2026-09-30
|
|
107
|
+
The `config` hook declares the list as it was on 2026-09-30, with the
|
|
108
|
+
app's Fast from 2026-10-12:
|
|
103
109
|
|
|
104
|
-
- Ultimate, Performance, Efficient
|
|
110
|
+
- Ultimate, Fast, Performance, Efficient
|
|
105
111
|
- Sonus, Cantus
|
|
106
112
|
- Qwen3.8-Max, Qwen3.8-Flash, Qwen3.7-Max, Qwen3.7-Plus
|
|
107
113
|
- Kimi-K3, Kimi-K2.8-Preview
|
package/index.mjs
CHANGED
|
@@ -340,9 +340,11 @@ async function refreshJob(site, refresh, user) {
|
|
|
340
340
|
const EFFORT_ORDER = ["minimal", "low", "medium", "high", "xhigh", "max"]
|
|
341
341
|
const EFF5 = ["low", "medium", "high", "xhigh", "max"]
|
|
342
342
|
|
|
343
|
-
// Qoder's list when the account's can't be asked (as it was on 2026-09-30
|
|
343
|
+
// Qoder's list when the account's can't be asked (as it was on 2026-09-30,
|
|
344
|
+
// with the app's Fast from 2026-10-12).
|
|
344
345
|
const MODELS = [
|
|
345
346
|
{ id: "ultimate", name: "Ultimate", context: 1_000_000, efforts: EFF5 },
|
|
347
|
+
{ id: "fast", name: "Fast", context: 1_000_000 },
|
|
346
348
|
{ id: "performance", name: "Performance", context: 1_000_000, efforts: EFF5 },
|
|
347
349
|
{ id: "efficient", name: "Efficient", context: 200_000 },
|
|
348
350
|
{ id: "smodel", name: "Sonus", context: 180_000, efforts: EFF5 },
|
|
@@ -485,10 +487,34 @@ function modelInfo(raw) {
|
|
|
485
487
|
return m
|
|
486
488
|
}
|
|
487
489
|
|
|
488
|
-
//
|
|
490
|
+
// sceneModels is the models an agent can pick from the listing: the "app"
|
|
491
|
+
// scene's, which is what Qoder's app shows and what a request names
|
|
492
|
+
// (qoderBody's product and session_type "app"), in its order, then any
|
|
493
|
+
// "chat" model the app no longer lists, after the model it followed there,
|
|
494
|
+
// so a pick made before stays served. On 2026-10-12 the app listed Fast
|
|
495
|
+
// (fast, 0.8×) where Performance (1.1×) had been, and chat still listed
|
|
496
|
+
// Performance (magpie-community/plugins#97). A listing with only one scene
|
|
497
|
+
// gives that one. Each key once: the app's entry wins.
|
|
498
|
+
function sceneModels(listing) {
|
|
499
|
+
const app = Array.isArray(listing?.app) ? listing.app : []
|
|
500
|
+
const chat = Array.isArray(listing?.chat) ? listing.chat : []
|
|
501
|
+
const out = [...app]
|
|
502
|
+
let after = -1
|
|
503
|
+
for (const m of chat) {
|
|
504
|
+
const i = out.findIndex((x) => x?.key === m?.key)
|
|
505
|
+
if (i >= 0) {
|
|
506
|
+
after = i
|
|
507
|
+
continue
|
|
508
|
+
}
|
|
509
|
+
out.splice(++after, 0, m)
|
|
510
|
+
}
|
|
511
|
+
return out
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
// modelInfos is the listing's enabled models an agent can pick: "auto"
|
|
489
515
|
// and "default" route inside Qoder and aren't one model.
|
|
490
516
|
function modelInfos(listing) {
|
|
491
|
-
return (listing
|
|
517
|
+
return sceneModels(listing)
|
|
492
518
|
.filter((m) => m?.enable && !["", "auto", "default"].includes(String(m.key ?? "").trim()))
|
|
493
519
|
.map(modelInfo)
|
|
494
520
|
}
|
|
@@ -708,8 +734,13 @@ function failure(status, text) {
|
|
|
708
734
|
} catch {}
|
|
709
735
|
msg ||= STATUS_CODES[status] ?? `HTTP ${status}`
|
|
710
736
|
// 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
|
-
|
|
737
|
+
// lapsed: only a refused refresh did (errorResponse says kept). Qoder's
|
|
738
|
+
// own words go with it: a 401 right after signing in isn't a lapsed
|
|
739
|
+
// sign-in, and its reason is what says what is (Yayoi_no_yume on X).
|
|
740
|
+
if (status === 401 || status === 403) {
|
|
741
|
+
const said = msg && msg !== STATUS_CODES[status] ? ` (Qoder said ${status}: ${msg.slice(0, 300)})` : ""
|
|
742
|
+
return { status: 401, message: "the sign-in lapsed — sign in again" + said }
|
|
743
|
+
}
|
|
713
744
|
if (status === 429 || msg.toLowerCase().includes("quota")) return { status: 429, message: "usage limit reached: " + msg }
|
|
714
745
|
return { status, message: msg }
|
|
715
746
|
}
|
package/package.json
CHANGED