@magpie-community/opencode-opendesign-auth 0.1.4 → 0.1.5
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 +11 -4
- package/index.mjs +56 -6
- package/models.mjs +14 -12
- package/package.json +1 -1
- package/refresh-models.mjs +7 -2
package/README.md
CHANGED
|
@@ -60,8 +60,14 @@ magpie calls the plugin's `provider.models`, which reads `amr-link`'s live
|
|
|
60
60
|
`/v1/models` at that account's key on every listing, so what a signed-in
|
|
61
61
|
account is offered is what its plan entitles it to right now. Limits, input
|
|
62
62
|
modalities and the vendor's own cost words (`rate`, e.g. `x0.5` for "low")
|
|
63
|
-
come from that same catalog
|
|
64
|
-
|
|
63
|
+
come from that same catalog.
|
|
64
|
+
|
|
65
|
+
Reasoning levels are not in the catalog, so `models.mjs` records the ones
|
|
66
|
+
measured against `amr-link` (#137): every model took `reasoning_effort`
|
|
67
|
+
`low` and `high`, and all but GPT-6 Luna thought at them, the ones the
|
|
68
|
+
catalog calls `standard` too. Those models reason at `low` and `high`;
|
|
69
|
+
GPT-6 Luna has no levels. A model the seed doesn't know reasons when its
|
|
70
|
+
vendor tier is `advanced`, with no levels until it is measured.
|
|
65
71
|
|
|
66
72
|
`models.mjs` is the seed the provider has *before* anyone signs in. Refresh
|
|
67
73
|
it from the live catalog with:
|
|
@@ -71,8 +77,9 @@ magpie plugin login opendesign # once, so the key is on hand
|
|
|
71
77
|
bun refresh-models.mjs # or OPENDESIGN_KEY=sk-amr-… bun …
|
|
72
78
|
```
|
|
73
79
|
|
|
74
|
-
The script keeps the names already
|
|
75
|
-
and reads nothing else: no secret is written to the file or
|
|
80
|
+
The script keeps the names and measured levels already there — the catalog
|
|
81
|
+
carries neither — and reads nothing else: no secret is written to the file or
|
|
82
|
+
printed.
|
|
76
83
|
|
|
77
84
|
Requests go to the **Responses** API (`@ai-sdk/openai` at
|
|
78
85
|
`https://amr-link.open-design.ai/v1`), which is what an Open Design API key
|
package/index.mjs
CHANGED
|
@@ -233,11 +233,24 @@ function thePlan(summary, tier) {
|
|
|
233
233
|
return "Design Plan " + t[0].toUpperCase() + t.slice(1)
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
+
// levelsOf is a model's reasoning levels: the ones models.mjs records as
|
|
237
|
+
// measured against amr-link (#137), where the vendor's capability word
|
|
238
|
+
// misleads both ways — "standard" models took reasoning_effort and thought
|
|
239
|
+
// at it, and GPT-6 Luna took it and never thought. A model the seed doesn't
|
|
240
|
+
// know has none until it is measured too.
|
|
241
|
+
function levelsOf(m) {
|
|
242
|
+
return Array.isArray(m?.efforts) ? m.efforts.filter((e) => typeof e === "string" && e) : []
|
|
243
|
+
}
|
|
244
|
+
|
|
236
245
|
// modelOf turns one model's facts — models.mjs's, or amr-link's catalog
|
|
237
|
-
// read again — into the model magpie shows
|
|
246
|
+
// read again — into the model magpie shows, as the provider's config has
|
|
247
|
+
// it. A model reasons when it has levels, or else when the vendor calls it
|
|
248
|
+
// "advanced". variants are its levels as @ai-sdk/openai options: magpie
|
|
249
|
+
// shows a model's levels only from its variants, and only when it reasons.
|
|
238
250
|
function modelOf(id, m) {
|
|
239
251
|
const rate = COST[text(m?.cost)]
|
|
240
|
-
const
|
|
252
|
+
const levels = levelsOf(m)
|
|
253
|
+
const thinking = levels.length > 0 || (THINKING[text(m?.capability)] ?? !!m?.reasoning)
|
|
241
254
|
const context = Number(m?.context)
|
|
242
255
|
const output = Number(m?.output)
|
|
243
256
|
const input = Array.isArray(m?.input) ? m.input.filter((x) => typeof x === "string" && x !== "text") : []
|
|
@@ -246,7 +259,8 @@ function modelOf(id, m) {
|
|
|
246
259
|
name: text(m?.name) || id,
|
|
247
260
|
attachment: true,
|
|
248
261
|
tool_call: true,
|
|
249
|
-
reasoning: thinking
|
|
262
|
+
reasoning: thinking,
|
|
263
|
+
...(levels.length && { variants: Object.fromEntries(levels.map((e) => [e, { reasoningEffort: e }])) }),
|
|
250
264
|
...(rate && { rate }),
|
|
251
265
|
limit: {
|
|
252
266
|
context: Number.isFinite(context) && context > 0 ? context : 200_000,
|
|
@@ -256,6 +270,41 @@ function modelOf(id, m) {
|
|
|
256
270
|
}
|
|
257
271
|
}
|
|
258
272
|
|
|
273
|
+
// KINDS are the kinds of input and output OpenCode's capabilities name.
|
|
274
|
+
const KINDS = ["text", "image", "audio", "video", "pdf"]
|
|
275
|
+
const kinds = (list) => Object.fromEntries(KINDS.map((k) => [k, list.includes(k)]))
|
|
276
|
+
|
|
277
|
+
// servedOf is modelOf's model as provider.models hands it back: OpenCode's
|
|
278
|
+
// model, not the config's. magpie reads a listed model's thinking from
|
|
279
|
+
// capabilities.reasoning and its kinds from capabilities.input, so a config
|
|
280
|
+
// shape there (reasoning: true beside no capabilities) listed every model a
|
|
281
|
+
// signed-in account has as one that doesn't reason, with no levels (#137).
|
|
282
|
+
function servedOf(id, m) {
|
|
283
|
+
const c = modelOf(id, m)
|
|
284
|
+
return {
|
|
285
|
+
id,
|
|
286
|
+
name: c.name,
|
|
287
|
+
api: { id, url: LINK, npm: NPM },
|
|
288
|
+
status: "active",
|
|
289
|
+
headers: {},
|
|
290
|
+
options: {},
|
|
291
|
+
cost: { input: 0, output: 0, cache: { read: 0, write: 0 } },
|
|
292
|
+
limit: c.limit,
|
|
293
|
+
capabilities: {
|
|
294
|
+
temperature: true,
|
|
295
|
+
reasoning: c.reasoning,
|
|
296
|
+
attachment: c.attachment,
|
|
297
|
+
toolcall: c.tool_call,
|
|
298
|
+
input: kinds(c.modalities.input),
|
|
299
|
+
output: kinds(c.modalities.output),
|
|
300
|
+
interleaved: false,
|
|
301
|
+
},
|
|
302
|
+
release_date: "",
|
|
303
|
+
variants: c.variants ?? {},
|
|
304
|
+
...(c.rate && { rate: c.rate }),
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
259
308
|
// facts() is amr-link's catalog entry in the seed's own shape.
|
|
260
309
|
function facts(m) {
|
|
261
310
|
const meta = m?.metadata ?? {}
|
|
@@ -277,14 +326,15 @@ function seed() {
|
|
|
277
326
|
}
|
|
278
327
|
|
|
279
328
|
// modelsOf() shapes amr-link's live catalog as magpie's models: the list an
|
|
280
|
-
// account's plan entitles it to right now,
|
|
281
|
-
// seed knows keeps its name; the catalog
|
|
329
|
+
// account's plan entitles it to right now, as provider.models gives them. A
|
|
330
|
+
// model the seed knows keeps its name and its measured levels; the catalog
|
|
331
|
+
// carries ids only.
|
|
282
332
|
function modelsOf(catalog) {
|
|
283
333
|
const out = {}
|
|
284
334
|
for (const m of catalog?.data ?? []) {
|
|
285
335
|
const id = text(m?.id)
|
|
286
336
|
if (!id) continue
|
|
287
|
-
out[id] =
|
|
337
|
+
out[id] = servedOf(id, { ...facts(m), name: MODELS[id]?.name ?? id, efforts: MODELS[id]?.efforts })
|
|
288
338
|
}
|
|
289
339
|
return out
|
|
290
340
|
}
|
package/models.mjs
CHANGED
|
@@ -6,18 +6,20 @@
|
|
|
6
6
|
//
|
|
7
7
|
// name: what the model is called; context/output: its token limits; input:
|
|
8
8
|
// the non-text modalities it takes; cost and capability: the vendor's own
|
|
9
|
-
// words, which the plugin turns into magpie's rate and thinking flags
|
|
9
|
+
// words, which the plugin turns into magpie's rate and thinking flags;
|
|
10
|
+
// efforts: the reasoning levels amr-link was seen to take and think at,
|
|
11
|
+
// measured, not read (#137), so a refresh keeps them.
|
|
10
12
|
|
|
11
13
|
export const MODELS = {
|
|
12
|
-
"claude-haiku-5.5": { name: "Claude Haiku 5.5", context: 1000000, output: 132000, input: ["image", "file"], cost: "low", capability: "standard" },
|
|
13
|
-
"deepseek-v4-flash": { name: "DeepSeek V4 Flash", context: 1048000, output: 232000, cost: "medium", capability: "standard" },
|
|
14
|
-
"deepseek-v4-flash-vision-exp": { name: "DeepSeek V4 Flash Vision (exp)", context: 1048000, output: 232000, input: ["image"], cost: "medium", capability: "standard" },
|
|
15
|
-
"deepseek-v4-pro": { name: "DeepSeek V4 Pro", context: 1048000, output: 232000, cost: "high", capability: "advanced" },
|
|
16
|
-
"deepseek-v4.1-flash": { name: "DeepSeek V4.1 Flash", context: 1048000, output: 232000, input: ["image"], cost: "low", capability: "advanced" },
|
|
17
|
-
"glm-5.3-flash": { name: "GLM 5.3 Flash", context: 1048000, output: 232000, input: ["image", "video"], cost: "low", capability: "advanced" },
|
|
18
|
-
"glm-5.3-flashx": { name: "GLM 5.3 FlashX", context: 1000000, output: 232000, input: ["image", "file", "video"], cost: "medium", capability: "advanced" },
|
|
19
|
-
"gpt-6-luna": { name: "GPT-6 Luna", context: 1050000, output: 304000, input: ["image", "file"], cost: "low", capability: "standard" },
|
|
20
|
-
"kimi-k2.7-code": { name: "Kimi K2.7 Code", context: 262000, output: 262000, input: ["image"], cost: "medium", capability: "advanced" },
|
|
21
|
-
"mimo-v2.6-flash": { name: "MiMo V2.6 Flash", context: 1048000, output: 232000, input: ["image", "audio", "video"], cost: "low", capability: "standard" },
|
|
22
|
-
"mimo-v2.6-pro": { name: "MiMo V2.6 Pro", context: 1048000, output: 232000, input: ["image", "audio", "video"], cost: "medium", capability: "advanced" },
|
|
14
|
+
"claude-haiku-5.5": { name: "Claude Haiku 5.5", context: 1000000, output: 132000, input: ["image", "file"], cost: "low", capability: "standard", efforts: ["low", "high"] },
|
|
15
|
+
"deepseek-v4-flash": { name: "DeepSeek V4 Flash", context: 1048000, output: 232000, cost: "medium", capability: "standard", efforts: ["low", "high"] },
|
|
16
|
+
"deepseek-v4-flash-vision-exp": { name: "DeepSeek V4 Flash Vision (exp)", context: 1048000, output: 232000, input: ["image"], cost: "medium", capability: "standard", efforts: ["low", "high"] },
|
|
17
|
+
"deepseek-v4-pro": { name: "DeepSeek V4 Pro", context: 1048000, output: 232000, cost: "high", capability: "advanced", efforts: ["low", "high"] },
|
|
18
|
+
"deepseek-v4.1-flash": { name: "DeepSeek V4.1 Flash", context: 1048000, output: 232000, input: ["image"], cost: "low", capability: "advanced", efforts: ["low", "high"] },
|
|
19
|
+
"glm-5.3-flash": { name: "GLM 5.3 Flash", context: 1048000, output: 232000, input: ["image", "video"], cost: "low", capability: "advanced", efforts: ["low", "high"] },
|
|
20
|
+
"glm-5.3-flashx": { name: "GLM 5.3 FlashX", context: 1000000, output: 232000, input: ["image", "file", "video"], cost: "medium", capability: "advanced", efforts: ["low", "high"] },
|
|
21
|
+
"gpt-6-luna": { name: "GPT-6 Luna", context: 1050000, output: 304000, input: ["image", "file"], cost: "low", capability: "standard", efforts: [] },
|
|
22
|
+
"kimi-k2.7-code": { name: "Kimi K2.7 Code", context: 262000, output: 262000, input: ["image"], cost: "medium", capability: "advanced", efforts: ["low", "high"] },
|
|
23
|
+
"mimo-v2.6-flash": { name: "MiMo V2.6 Flash", context: 1048000, output: 232000, input: ["image", "audio", "video"], cost: "low", capability: "standard", efforts: ["low", "high"] },
|
|
24
|
+
"mimo-v2.6-pro": { name: "MiMo V2.6 Pro", context: 1048000, output: 232000, input: ["image", "audio", "video"], cost: "medium", capability: "advanced", efforts: ["low", "high"] },
|
|
23
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magpie-community/opencode-opendesign-auth",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
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": "./index.mjs",
|
package/refresh-models.mjs
CHANGED
|
@@ -57,7 +57,8 @@ if (!catalog.length) {
|
|
|
57
57
|
process.exit(1)
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
// names already chosen are kept
|
|
60
|
+
// names already chosen are kept, and so are the measured reasoning levels:
|
|
61
|
+
// the catalog has ids only, and says nothing of efforts
|
|
61
62
|
let before = {}
|
|
62
63
|
try {
|
|
63
64
|
;({ MODELS: before } = await import(pathToFileURL(TARGET).href))
|
|
@@ -80,6 +81,8 @@ for (const m of catalog) {
|
|
|
80
81
|
if (extra.length) facts.push(`input: [${extra.map((x) => JSON.stringify(x)).join(", ")}]`)
|
|
81
82
|
if (typeof meta.cost === "string") facts.push(`cost: ${JSON.stringify(meta.cost)}`)
|
|
82
83
|
if (typeof meta.capability === "string") facts.push(`capability: ${JSON.stringify(meta.capability)}`)
|
|
84
|
+
const efforts = before[id]?.efforts
|
|
85
|
+
if (Array.isArray(efforts)) facts.push(`efforts: [${efforts.map((x) => JSON.stringify(x)).join(", ")}]`)
|
|
83
86
|
const name = before[id]?.name ?? id
|
|
84
87
|
lines.push(` ${JSON.stringify(id)}: { name: ${JSON.stringify(name)}${facts.length ? ", " + facts.join(", ") : ""} },`)
|
|
85
88
|
}
|
|
@@ -92,7 +95,9 @@ const header = `// The models an account is offered before anyone has signed in
|
|
|
92
95
|
//
|
|
93
96
|
// name: what the model is called; context/output: its token limits; input:
|
|
94
97
|
// the non-text modalities it takes; cost and capability: the vendor's own
|
|
95
|
-
// words, which the plugin turns into magpie's rate and thinking flags
|
|
98
|
+
// words, which the plugin turns into magpie's rate and thinking flags;
|
|
99
|
+
// efforts: the reasoning levels amr-link was seen to take and think at,
|
|
100
|
+
// measured, not read (#137), so a refresh keeps them.
|
|
96
101
|
|
|
97
102
|
export const MODELS = {
|
|
98
103
|
${lines.join("\n")}
|