@magpie-community/opencode-opendesign-auth 0.1.10 → 0.1.11

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/index.mjs CHANGED
@@ -280,6 +280,18 @@ function levelsOf(m) {
280
280
  return Array.isArray(m?.efforts) ? m.efforts.filter((e) => typeof e === "string" && e) : []
281
281
  }
282
282
 
283
+ // CAP is the most output a model may be asked for where amr-link's catalog
284
+ // (metadata.context_budget) says more than its API takes. Asking for more is
285
+ // a 400 "Open Design: The request could not be completed." that names no
286
+ // field, so nothing can lower it and retry. A client that names no limit
287
+ // (Codex) is given the published one by magpie, so every turn would fail
288
+ // (#827, Gitleonan, measured 2026-11-09 on two accounts): glm-5.3-flash took
289
+ // 131072 and refused 132000 (one account took 232000), and gemini-3.8-flash
290
+ // took 65536 and refused 65537 on both. The cap is applied here, not in
291
+ // models.mjs: the live catalog's number overrides the seed's (withSeed), and
292
+ // refresh-models.mjs writes the vendor's number back into the seed.
293
+ const CAP = { "glm-5.3-flash": 131072, "gemini-3.8-flash": 65536 }
294
+
283
295
  // modelOf turns one model's facts — models.mjs's, or amr-link's catalog
284
296
  // read again — into the model magpie shows, as the provider's config has
285
297
  // it. A model reasons when it has levels, or else when the vendor calls it
@@ -305,7 +317,7 @@ function modelOf(id, m) {
305
317
  ...(rate && { rate }),
306
318
  limit: {
307
319
  context: Number.isFinite(context) && context > 0 ? context : 200_000,
308
- output: Number.isFinite(output) && output > 0 ? output : 32_000,
320
+ output: Math.min(Number.isFinite(output) && output > 0 ? output : 32_000, CAP[id] ?? Infinity),
309
321
  },
310
322
  modalities: { input: ["text", ...input], output: ["text"] },
311
323
  }
@@ -480,7 +492,11 @@ export const OpenDesignAuthPlugin = async () => {
480
492
  const models = { ...seed(), ...(was.models ?? {}) }
481
493
  for (const [id, m] of Object.entries(models)) {
482
494
  const rate = RATES[id] === undefined ? undefined : "x" + RATES[id]
483
- models[id] = { ...m, api: { ...(m.api ?? {}), npm: wireOf(id) }, provider: { ...(m.provider ?? {}), npm: wireOf(id) }, ...(rate && { rate }) }
495
+ // a kept copy's limit is capped too: an earlier version wrote the
496
+ // catalog's 232000 for glm-5.3-flash, which amr-link refuses (CAP)
497
+ const out = Number(m.limit?.output)
498
+ const limit = CAP[id] && !(out > 0 && out <= CAP[id]) ? { limit: { ...(m.limit ?? {}), output: CAP[id] } } : {}
499
+ models[id] = { ...m, ...limit, api: { ...(m.api ?? {}), npm: wireOf(id) }, provider: { ...(m.provider ?? {}), npm: wireOf(id) }, ...(rate && { rate }) }
484
500
  }
485
501
  cfg.provider[ID] = {
486
502
  name: "Open Design",
package/opencode2.mjs CHANGED
@@ -85,7 +85,6 @@ export function fieldsOf(prompts) {
85
85
  if (p.placeholder) f.placeholder = String(p.placeholder)
86
86
  if (p.type === "select" && Array.isArray(p.options))
87
87
  f.options = p.options.map((o) => ({ value: String(o.value), label: String(o.label ?? o.value), ...(o.hint ? { description: String(o.hint) } : {}) }))
88
- // a prompt shown only when another answer says so can't be required
89
88
  // a prompt shown only when another answer says so can't be required, and
90
89
  // neither can one whose own validate() accepts an empty answer (the
91
90
  // browser sign-in's optional API key)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-opendesign-auth",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Open Design Cloud (Design Plan) in OpenCode and magpie: the account's device sign-in, its models, and the plan's 5-hour and 7-day allowance",
5
5
  "type": "module",
6
6
  "main": "./opencode.mjs",