opendesign 0.1.5: a signed-in account's models reason in magpie, at the low and high levels amr-link took (#137, sryimnoob123)
sryimnoob123 measured amr-link with reasoning_effort high and low on all 11 models (magpie 0.1.1254, Windows): every one answered 200, and all but gpt-6-luna streamed reasoning, four the catalog calls "standard" too. Their install showed all 11 with reasoning false and no levels. Two causes: - provider.models gave the live list in the config's shape (reasoning: true, modalities: [...]). magpie's plugin host reads a listed model's thinking from capabilities.reasoning and its kinds from capabilities.input, so for a signed-in account every model read as not reasoning, with no image input. It now gives OpenCode's model shape (servedOf: api, capabilities, variants), as minimax/workbuddy do. - No model had levels: nothing declared variants, and magpie shows a model's levels only from them. models.mjs now records the measured levels (efforts): ["low", "high"] on the 10 that thought, [] on gpt-6-luna (took it, never thought). Only the two levels the table shows were given. A model with levels reasons whatever its capability word; one the seed doesn't know keeps the old rule (advanced reasons) with no levels. refresh-models.mjs keeps efforts like names. Run: - bun test packages/opendesign: 21 pass, 0 fail. New: "a signed-in account's models reason at the levels amr-link took (#137)", "the seed's models carry the measured levels as the config's variants"; the live-list test now pins the OpenCode shape. - Broken by hand: modelsOf back on modelOf (config shape) -> 2 fail; efforts not passed from the seed to the live list -> 1 fail. - magpie origin/main internal/plugin/host.js run under bun with a preloaded fetch stub serving a 3-model catalog (init + providers, a stored oauth account): with 0.1.4 gpt-6-luna, deepseek-v4-pro and claude-haiku-5.5 all list reasoning=false variants=[] image=false; with this change luna false/[]/image true, v4-pro true/[low high], haiku true/[low high]/image true, url the amr-link base. - refresh-models.mjs against the same stub: efforts kept per model. - bun scripts/check.mjs: every package ok. - TMPDIR/HOME isolated bun test (whole repo): 1526 pass, 0 fail. A first run had 1 fail, packages/grok/login.test.mjs "a login's link is still handed on" timing out at 5s with load average ~100; alone 3/3 pass and the rerun of the whole repo passed. Untouched package; not filed. Not tried: a real Open Design account (none here) or magpie's `model efforts` command end to end; the levels rest on the reporter's table. Full suite: bun test (whole repo, with factory 0.1.30 below it): 1527 pass, 0 fail
This commit is contained in:
@@ -60,8 +60,14 @@ magpie calls the plugin's `provider.models`, which reads `amr-link`'s live
|
||||
`/v1/models` at that account's key on every listing, so what a signed-in
|
||||
account is offered is what its plan entitles it to right now. Limits, input
|
||||
modalities and the vendor's own cost words (`rate`, e.g. `x0.5` for "low")
|
||||
come from that same catalog; a model whose vendor tier is `advanced` is
|
||||
marked as one that reasons.
|
||||
come from that same catalog.
|
||||
|
||||
Reasoning levels are not in the catalog, so `models.mjs` records the ones
|
||||
measured against `amr-link` (#137): every model took `reasoning_effort`
|
||||
`low` and `high`, and all but GPT-6 Luna thought at them, the ones the
|
||||
catalog calls `standard` too. Those models reason at `low` and `high`;
|
||||
GPT-6 Luna has no levels. A model the seed doesn't know reasons when its
|
||||
vendor tier is `advanced`, with no levels until it is measured.
|
||||
|
||||
`models.mjs` is the seed the provider has *before* anyone signs in. Refresh
|
||||
it from the live catalog with:
|
||||
@@ -71,8 +77,9 @@ magpie plugin login opendesign # once, so the key is on hand
|
||||
bun refresh-models.mjs # or OPENDESIGN_KEY=sk-amr-… bun …
|
||||
```
|
||||
|
||||
The script keeps the names already chosen — the catalog carries ids only —
|
||||
and reads nothing else: no secret is written to the file or printed.
|
||||
The script keeps the names and measured levels already there — the catalog
|
||||
carries neither — and reads nothing else: no secret is written to the file or
|
||||
printed.
|
||||
|
||||
Requests go to the **Responses** API (`@ai-sdk/openai` at
|
||||
`https://amr-link.open-design.ai/v1`), which is what an Open Design API key
|
||||
|
||||
@@ -233,11 +233,24 @@ function thePlan(summary, tier) {
|
||||
return "Design Plan " + t[0].toUpperCase() + t.slice(1)
|
||||
}
|
||||
|
||||
// levelsOf is a model's reasoning levels: the ones models.mjs records as
|
||||
// measured against amr-link (#137), where the vendor's capability word
|
||||
// misleads both ways — "standard" models took reasoning_effort and thought
|
||||
// at it, and GPT-6 Luna took it and never thought. A model the seed doesn't
|
||||
// know has none until it is measured too.
|
||||
function levelsOf(m) {
|
||||
return Array.isArray(m?.efforts) ? m.efforts.filter((e) => typeof e === "string" && e) : []
|
||||
}
|
||||
|
||||
// modelOf turns one model's facts — models.mjs's, or amr-link's catalog
|
||||
// read again — into the model magpie shows.
|
||||
// read again — into the model magpie shows, as the provider's config has
|
||||
// it. A model reasons when it has levels, or else when the vendor calls it
|
||||
// "advanced". variants are its levels as @ai-sdk/openai options: magpie
|
||||
// shows a model's levels only from its variants, and only when it reasons.
|
||||
function modelOf(id, m) {
|
||||
const rate = COST[text(m?.cost)]
|
||||
const thinking = THINKING[text(m?.capability)]
|
||||
const levels = levelsOf(m)
|
||||
const thinking = levels.length > 0 || (THINKING[text(m?.capability)] ?? !!m?.reasoning)
|
||||
const context = Number(m?.context)
|
||||
const output = Number(m?.output)
|
||||
const input = Array.isArray(m?.input) ? m.input.filter((x) => typeof x === "string" && x !== "text") : []
|
||||
@@ -246,7 +259,8 @@ function modelOf(id, m) {
|
||||
name: text(m?.name) || id,
|
||||
attachment: true,
|
||||
tool_call: true,
|
||||
reasoning: thinking ?? !!m?.reasoning,
|
||||
reasoning: thinking,
|
||||
...(levels.length && { variants: Object.fromEntries(levels.map((e) => [e, { reasoningEffort: e }])) }),
|
||||
...(rate && { rate }),
|
||||
limit: {
|
||||
context: Number.isFinite(context) && context > 0 ? context : 200_000,
|
||||
@@ -256,6 +270,41 @@ function modelOf(id, m) {
|
||||
}
|
||||
}
|
||||
|
||||
// KINDS are the kinds of input and output OpenCode's capabilities name.
|
||||
const KINDS = ["text", "image", "audio", "video", "pdf"]
|
||||
const kinds = (list) => Object.fromEntries(KINDS.map((k) => [k, list.includes(k)]))
|
||||
|
||||
// servedOf is modelOf's model as provider.models hands it back: OpenCode's
|
||||
// model, not the config's. magpie reads a listed model's thinking from
|
||||
// capabilities.reasoning and its kinds from capabilities.input, so a config
|
||||
// shape there (reasoning: true beside no capabilities) listed every model a
|
||||
// signed-in account has as one that doesn't reason, with no levels (#137).
|
||||
function servedOf(id, m) {
|
||||
const c = modelOf(id, m)
|
||||
return {
|
||||
id,
|
||||
name: c.name,
|
||||
api: { id, url: LINK, npm: NPM },
|
||||
status: "active",
|
||||
headers: {},
|
||||
options: {},
|
||||
cost: { input: 0, output: 0, cache: { read: 0, write: 0 } },
|
||||
limit: c.limit,
|
||||
capabilities: {
|
||||
temperature: true,
|
||||
reasoning: c.reasoning,
|
||||
attachment: c.attachment,
|
||||
toolcall: c.tool_call,
|
||||
input: kinds(c.modalities.input),
|
||||
output: kinds(c.modalities.output),
|
||||
interleaved: false,
|
||||
},
|
||||
release_date: "",
|
||||
variants: c.variants ?? {},
|
||||
...(c.rate && { rate: c.rate }),
|
||||
}
|
||||
}
|
||||
|
||||
// facts() is amr-link's catalog entry in the seed's own shape.
|
||||
function facts(m) {
|
||||
const meta = m?.metadata ?? {}
|
||||
@@ -277,14 +326,15 @@ function seed() {
|
||||
}
|
||||
|
||||
// modelsOf() shapes amr-link's live catalog as magpie's models: the list an
|
||||
// account's plan entitles it to right now, in the seed's shape. A model the
|
||||
// seed knows keeps its name; the catalog carries ids only.
|
||||
// account's plan entitles it to right now, as provider.models gives them. A
|
||||
// model the seed knows keeps its name and its measured levels; the catalog
|
||||
// carries ids only.
|
||||
function modelsOf(catalog) {
|
||||
const out = {}
|
||||
for (const m of catalog?.data ?? []) {
|
||||
const id = text(m?.id)
|
||||
if (!id) continue
|
||||
out[id] = modelOf(id, { ...facts(m), name: MODELS[id]?.name ?? id })
|
||||
out[id] = servedOf(id, { ...facts(m), name: MODELS[id]?.name ?? id, efforts: MODELS[id]?.efforts })
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
@@ -135,34 +135,90 @@ const CATALOG = {
|
||||
],
|
||||
}
|
||||
|
||||
// what magpie's plugin host reads off a model provider.models gives back
|
||||
// (internal/plugin/host.js, providers()): its thinking from
|
||||
// capabilities.reasoning, its levels from the variants' names
|
||||
const asMagpieReads = (m) => ({
|
||||
reasoning: !!m.capabilities?.reasoning,
|
||||
variants: Object.keys(m.variants ?? {}),
|
||||
image: !!m.capabilities?.input?.image,
|
||||
})
|
||||
|
||||
test("the account's list is the vendor's own, live", () => {
|
||||
const models = I.modelsOf(CATALOG)
|
||||
expect(Object.keys(models)).toEqual(["gpt-6-luna", "deepseek-v4-pro", "brand-new-9"])
|
||||
expect(models["gpt-6-luna"]).toEqual({
|
||||
id: "gpt-6-luna",
|
||||
name: "GPT-6 Luna",
|
||||
reasoning: false,
|
||||
rate: "x0.5",
|
||||
tool_call: true,
|
||||
attachment: true,
|
||||
api: { id: "gpt-6-luna", url: "https://amr-link.open-design.ai/v1", npm: "@ai-sdk/openai" },
|
||||
status: "active",
|
||||
headers: {},
|
||||
options: {},
|
||||
cost: { input: 0, output: 0, cache: { read: 0, write: 0 } },
|
||||
limit: { context: 1050000, output: 304000 },
|
||||
modalities: { input: ["text", "image", "file"], output: ["text"] },
|
||||
capabilities: {
|
||||
temperature: true,
|
||||
reasoning: false,
|
||||
attachment: true,
|
||||
toolcall: true,
|
||||
input: { text: true, image: true, audio: false, video: false, pdf: false },
|
||||
output: { text: true, image: false, audio: false, video: false, pdf: false },
|
||||
interleaved: false,
|
||||
},
|
||||
release_date: "",
|
||||
variants: {},
|
||||
rate: "x0.5",
|
||||
})
|
||||
expect(models["deepseek-v4-pro"]).toMatchObject({ reasoning: true, rate: "x2", limit: { context: 1048000, output: 232000 } })
|
||||
expect(models["deepseek-v4-pro"]).toMatchObject({ rate: "x2", limit: { context: 1048000, output: 232000 } })
|
||||
// a model the seed doesn't know is named by its id, and a catalog entry
|
||||
// without limits still gets a workable entry
|
||||
expect(models["brand-new-9"]).toEqual({
|
||||
expect(models["brand-new-9"]).toMatchObject({
|
||||
id: "brand-new-9",
|
||||
name: "brand-new-9",
|
||||
attachment: true,
|
||||
tool_call: true,
|
||||
reasoning: true,
|
||||
rate: "x1",
|
||||
limit: { context: 200000, output: 32000 },
|
||||
modalities: { input: ["text", "image"], output: ["text"] },
|
||||
})
|
||||
})
|
||||
|
||||
// #137 (sryimnoob123): amr-link took reasoning_effort low and high on all 11
|
||||
// models, and every one but GPT-6 Luna thought at it, "standard" or not
|
||||
test("a signed-in account's models reason at the levels amr-link took (#137)", () => {
|
||||
const models = I.modelsOf(CATALOG)
|
||||
expect(asMagpieReads(models["deepseek-v4-pro"])).toEqual({ reasoning: true, variants: ["low", "high"], image: false })
|
||||
expect(models["deepseek-v4-pro"].variants).toEqual({ low: { reasoningEffort: "low" }, high: { reasoningEffort: "high" } })
|
||||
// took the level and never thought at it
|
||||
expect(asMagpieReads(models["gpt-6-luna"])).toEqual({ reasoning: false, variants: [], image: true })
|
||||
// "advanced" but never measured: it reasons, at no level said for it
|
||||
expect(asMagpieReads(models["brand-new-9"])).toEqual({ reasoning: true, variants: [], image: true })
|
||||
// the catalog calls these "standard"; they thought at both levels
|
||||
const standard = I.modelsOf({
|
||||
data: ["claude-haiku-5.5", "deepseek-v4-flash", "deepseek-v4-flash-vision-exp", "mimo-v2.6-flash"].map((id) => ({ id, metadata: { capability: "standard" } })),
|
||||
})
|
||||
for (const m of Object.values(standard)) expect(asMagpieReads(m)).toMatchObject({ reasoning: true, variants: ["low", "high"] })
|
||||
})
|
||||
|
||||
test("the seed's models carry the measured levels as the config's variants", async () => {
|
||||
const hooks = await OpenDesignAuthPlugin({})
|
||||
const cfg = {}
|
||||
await hooks.config(cfg)
|
||||
const models = cfg.provider.opendesign.models
|
||||
const levels = Object.fromEntries(Object.entries(models).map(([id, m]) => [id, m.reasoning ? Object.keys(m.variants ?? {}) : null]))
|
||||
expect(levels).toEqual({
|
||||
"claude-haiku-5.5": ["low", "high"],
|
||||
"deepseek-v4-flash": ["low", "high"],
|
||||
"deepseek-v4-flash-vision-exp": ["low", "high"],
|
||||
"deepseek-v4-pro": ["low", "high"],
|
||||
"deepseek-v4.1-flash": ["low", "high"],
|
||||
"glm-5.3-flash": ["low", "high"],
|
||||
"glm-5.3-flashx": ["low", "high"],
|
||||
"gpt-6-luna": null,
|
||||
"kimi-k2.7-code": ["low", "high"],
|
||||
"mimo-v2.6-flash": ["low", "high"],
|
||||
"mimo-v2.6-pro": ["low", "high"],
|
||||
})
|
||||
expect(models["claude-haiku-5.5"].variants.high).toEqual({ reasoningEffort: "high" })
|
||||
})
|
||||
|
||||
test("an empty catalog is no models", () => {
|
||||
expect(I.modelsOf({ data: [] })).toEqual({})
|
||||
expect(I.modelsOf(null)).toEqual({})
|
||||
@@ -187,6 +243,7 @@ test("the plugin declares the provider and answers its methods", async () => {
|
||||
attachment: true,
|
||||
tool_call: true,
|
||||
reasoning: true,
|
||||
variants: { low: { reasoningEffort: "low" }, high: { reasoningEffort: "high" } },
|
||||
rate: "x0.5",
|
||||
limit: { context: 1048000, output: 232000 },
|
||||
modalities: { input: ["text", "image"], output: ["text"] },
|
||||
|
||||
@@ -6,18 +6,20 @@
|
||||
//
|
||||
// name: what the model is called; context/output: its token limits; input:
|
||||
// the non-text modalities it takes; cost and capability: the vendor's own
|
||||
// words, which the plugin turns into magpie's rate and thinking flags.
|
||||
// words, which the plugin turns into magpie's rate and thinking flags;
|
||||
// efforts: the reasoning levels amr-link was seen to take and think at,
|
||||
// measured, not read (#137), so a refresh keeps them.
|
||||
|
||||
export const MODELS = {
|
||||
"claude-haiku-5.5": { name: "Claude Haiku 5.5", context: 1000000, output: 132000, input: ["image", "file"], cost: "low", capability: "standard" },
|
||||
"deepseek-v4-flash": { name: "DeepSeek V4 Flash", context: 1048000, output: 232000, cost: "medium", capability: "standard" },
|
||||
"deepseek-v4-flash-vision-exp": { name: "DeepSeek V4 Flash Vision (exp)", context: 1048000, output: 232000, input: ["image"], cost: "medium", capability: "standard" },
|
||||
"deepseek-v4-pro": { name: "DeepSeek V4 Pro", context: 1048000, output: 232000, cost: "high", capability: "advanced" },
|
||||
"deepseek-v4.1-flash": { name: "DeepSeek V4.1 Flash", context: 1048000, output: 232000, input: ["image"], cost: "low", capability: "advanced" },
|
||||
"glm-5.3-flash": { name: "GLM 5.3 Flash", context: 1048000, output: 232000, input: ["image", "video"], cost: "low", capability: "advanced" },
|
||||
"glm-5.3-flashx": { name: "GLM 5.3 FlashX", context: 1000000, output: 232000, input: ["image", "file", "video"], cost: "medium", capability: "advanced" },
|
||||
"gpt-6-luna": { name: "GPT-6 Luna", context: 1050000, output: 304000, input: ["image", "file"], cost: "low", capability: "standard" },
|
||||
"kimi-k2.7-code": { name: "Kimi K2.7 Code", context: 262000, output: 262000, input: ["image"], cost: "medium", capability: "advanced" },
|
||||
"mimo-v2.6-flash": { name: "MiMo V2.6 Flash", context: 1048000, output: 232000, input: ["image", "audio", "video"], cost: "low", capability: "standard" },
|
||||
"mimo-v2.6-pro": { name: "MiMo V2.6 Pro", context: 1048000, output: 232000, input: ["image", "audio", "video"], cost: "medium", capability: "advanced" },
|
||||
"claude-haiku-5.5": { name: "Claude Haiku 5.5", context: 1000000, output: 132000, input: ["image", "file"], cost: "low", capability: "standard", efforts: ["low", "high"] },
|
||||
"deepseek-v4-flash": { name: "DeepSeek V4 Flash", context: 1048000, output: 232000, cost: "medium", capability: "standard", efforts: ["low", "high"] },
|
||||
"deepseek-v4-flash-vision-exp": { name: "DeepSeek V4 Flash Vision (exp)", context: 1048000, output: 232000, input: ["image"], cost: "medium", capability: "standard", efforts: ["low", "high"] },
|
||||
"deepseek-v4-pro": { name: "DeepSeek V4 Pro", context: 1048000, output: 232000, cost: "high", capability: "advanced", efforts: ["low", "high"] },
|
||||
"deepseek-v4.1-flash": { name: "DeepSeek V4.1 Flash", context: 1048000, output: 232000, input: ["image"], cost: "low", capability: "advanced", efforts: ["low", "high"] },
|
||||
"glm-5.3-flash": { name: "GLM 5.3 Flash", context: 1048000, output: 232000, input: ["image", "video"], cost: "low", capability: "advanced", efforts: ["low", "high"] },
|
||||
"glm-5.3-flashx": { name: "GLM 5.3 FlashX", context: 1000000, output: 232000, input: ["image", "file", "video"], cost: "medium", capability: "advanced", efforts: ["low", "high"] },
|
||||
"gpt-6-luna": { name: "GPT-6 Luna", context: 1050000, output: 304000, input: ["image", "file"], cost: "low", capability: "standard", efforts: [] },
|
||||
"kimi-k2.7-code": { name: "Kimi K2.7 Code", context: 262000, output: 262000, input: ["image"], cost: "medium", capability: "advanced", efforts: ["low", "high"] },
|
||||
"mimo-v2.6-flash": { name: "MiMo V2.6 Flash", context: 1048000, output: 232000, input: ["image", "audio", "video"], cost: "low", capability: "standard", efforts: ["low", "high"] },
|
||||
"mimo-v2.6-pro": { name: "MiMo V2.6 Pro", context: 1048000, output: 232000, input: ["image", "audio", "video"], cost: "medium", capability: "advanced", efforts: ["low", "high"] },
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@magpie-community/opencode-opendesign-auth",
|
||||
"version": "0.1.4",
|
||||
"version": "0.1.5",
|
||||
"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",
|
||||
"type": "module",
|
||||
"main": "./index.mjs",
|
||||
|
||||
@@ -57,7 +57,8 @@ if (!catalog.length) {
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
// names already chosen are kept: the catalog has ids only
|
||||
// names already chosen are kept, and so are the measured reasoning levels:
|
||||
// the catalog has ids only, and says nothing of efforts
|
||||
let before = {}
|
||||
try {
|
||||
;({ MODELS: before } = await import(pathToFileURL(TARGET).href))
|
||||
@@ -80,6 +81,8 @@ for (const m of catalog) {
|
||||
if (extra.length) facts.push(`input: [${extra.map((x) => JSON.stringify(x)).join(", ")}]`)
|
||||
if (typeof meta.cost === "string") facts.push(`cost: ${JSON.stringify(meta.cost)}`)
|
||||
if (typeof meta.capability === "string") facts.push(`capability: ${JSON.stringify(meta.capability)}`)
|
||||
const efforts = before[id]?.efforts
|
||||
if (Array.isArray(efforts)) facts.push(`efforts: [${efforts.map((x) => JSON.stringify(x)).join(", ")}]`)
|
||||
const name = before[id]?.name ?? id
|
||||
lines.push(` ${JSON.stringify(id)}: { name: ${JSON.stringify(name)}${facts.length ? ", " + facts.join(", ") : ""} },`)
|
||||
}
|
||||
@@ -92,7 +95,9 @@ const header = `// The models an account is offered before anyone has signed in
|
||||
//
|
||||
// name: what the model is called; context/output: its token limits; input:
|
||||
// the non-text modalities it takes; cost and capability: the vendor's own
|
||||
// words, which the plugin turns into magpie's rate and thinking flags.
|
||||
// words, which the plugin turns into magpie's rate and thinking flags;
|
||||
// efforts: the reasoning levels amr-link was seen to take and think at,
|
||||
// measured, not read (#137), so a refresh keeps them.
|
||||
|
||||
export const MODELS = {
|
||||
${lines.join("\n")}
|
||||
|
||||
Reference in New Issue
Block a user