From b2ddbc501718b5f2f18f79c31b8be1640ac0f914 Mon Sep 17 00:00:00 2001 From: yetone Date: Sun, 4 Oct 2026 11:54:57 +0800 Subject: [PATCH] =?UTF-8?q?commandcode=200.1.8:=20a=20model=20of=20the=20p?= =?UTF-8?q?lan=20takes=20pictures=20as=20its=20maker's=20models=20do,=20no?= =?UTF-8?q?t=20none=20of=20them=20(ARNO=20on=20magpie=200.1.810,=20Discord?= =?UTF-8?q?:=20command=20code=20provider=20=E7=9A=84=E6=89=80=E6=9C=89?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E9=83=BD=E6=B2=A1=E6=9C=89=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8B=BE=E4=B8=8A=E6=94=AF=E6=8C=81=E5=9B=BE=E7=89=87=E8=BE=93?= =?UTF-8?q?=E5=85=A5)=20=E2=80=94=20Command=20Code's=20/provider/v1/models?= =?UTF-8?q?=20gives=20no=20modalities=20(all=2086=20entries,=20testdata/mo?= =?UTF-8?q?dels.json=20and=20the=20live=20list=20read=20from=20a=20moved?= =?UTF-8?q?=20account's=20plugin-providers.json=20alike),=20and=20runtimeM?= =?UTF-8?q?odel=20always=20set=20capabilities.input.image=20to=20!!m.image?= =?UTF-8?q?s,=20false=20for=20every=20model,=20which=20magpie's=20plugin?= =?UTF-8?q?=20host=20reads=20as=20the=20plugin's=20answer=20(host.js:=20im?= =?UTF-8?q?ageSaid=20when=20the=20value=20is=20a=20boolean)=20and=20takes?= =?UTF-8?q?=20over=20models.dev's.=20So=20every=20model=20of=20a=20moved?= =?UTF-8?q?=20plan,=20Claude,=20GPT-6,=20Kimi=20K3=20and=20Qwen=203.8=20in?= =?UTF-8?q?cluded,=20showed=20no=20image=20input,=20where=20the=20built-in?= =?UTF-8?q?=20(whose=20list=20said=20nothing=20either)=20answered=20from?= =?UTF-8?q?=20models.dev=20(catalog.SeesImages).=20runtimeModel=20now=20sa?= =?UTF-8?q?ys=20image=20only=20when=20m.images=20is=20a=20boolean;=20liveM?= =?UTF-8?q?odels=20takes=20the=20list's=20modalities=20when=20it=20gives?= =?UTF-8?q?=20them,=20else=20the=20default=20list's=20answer=20(which=20no?= =?UTF-8?q?w=20marks=20Claude=20Sonnet=205,=20Opus=205.5,=20GPT-6=20Sol,?= =?UTF-8?q?=20Kimi=20K3=20and=20MiniMax=20M3,=20as=20models.dev=20has=20th?= =?UTF-8?q?em;=20DeepSeek=20V4=20and=20GLM-5.3=20read=20text=20alone=20and?= =?UTF-8?q?=20say=20nothing),=20else=20the=20CLI's=20table's=20(GO=5FMODEL?= =?UTF-8?q?S,=20Pixel=20Canary=20among=20them),=20else=20true=20for=20a=20?= =?UTF-8?q?Claude=20model,=20and=20of=20any=20other=20says=20nothing,=20so?= =?UTF-8?q?=20magpie=20answers=20from=20models.dev=20as=20the=20built-in?= =?UTF-8?q?=20did=20(DeepSeek=20V4,=20GLM-5.x,=20MiniMax=20M2.x,=20Hy4=20a?= =?UTF-8?q?nd=20the=20rest=20models.dev=20calls=20text-only=20stay=20witho?= =?UTF-8?q?ut).=20A=20list=20that=20gives=20modalities=20is=20taken=20at?= =?UTF-8?q?=20its=20word,=20an=20explicit=20text-only=20included=20(the=20?= =?UTF-8?q?old=20`||=20undefined`=20dropped=20it).=20Go's=20goModels=20is?= =?UTF-8?q?=20unchanged=20but=20no=20longer=20says=20false=20for=20a=20mod?= =?UTF-8?q?el=20the=20table=20doesn't=20mark.=20models.test.mjs=20gains=20?= =?UTF-8?q?a=20test=20(a=20Pro=20account's=2086=20models:=20known=20image?= =?UTF-8?q?=20models=20say=20true,=20the=20rest=20leave=20image=20unsaid,?= =?UTF-8?q?=20a=20list's=20own=20modalities=20win,=20Go=20keeps=20the=20ta?= =?UTF-8?q?ble's);=20it=20fails=20on=200.1.7=20and=20passes.=20HOME=3D$(mk?= =?UTF-8?q?temp=20-d)=20bun=20test=20(459=20pass)=20and=20bun=20scripts/ch?= =?UTF-8?q?eck.mjs=20commandcode=20pass.=20Not=20tried=20in=20a=20real=20O?= =?UTF-8?q?penCode/magpie=20session=20with=20the=20new=20version;=20magpie?= =?UTF-8?q?=20needs=20the=20mover's=20min=20raised=20to=200.1.8=20for=20mo?= =?UTF-8?q?ved=20users=20to=20get=20it.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/commandcode/README.md | 5 +++ packages/commandcode/index.mjs | 30 +++++++++++------ packages/commandcode/models.test.mjs | 48 ++++++++++++++++++++++++++++ packages/commandcode/package.json | 2 +- 4 files changed, 75 insertions(+), 10 deletions(-) diff --git a/packages/commandcode/README.md b/packages/commandcode/README.md index 0293ccc..fe3128c 100644 --- a/packages/commandcode/README.md +++ b/packages/commandcode/README.md @@ -72,6 +72,11 @@ the account's own: The Go models carry their reasoning levels, and a requested level is fitted to the nearest one the model has. +The `/models` list doesn't say which models take images. A model is marked +as taking them when it is a Claude model, or when the default list or the +CLI's table says so. For any other model the plugin says nothing either +way, and magpie answers from models.dev, as its built-in did. + ## Not included - Usage and quota (`/alpha/billing/credits`, the 5-hour and weekly windows). diff --git a/packages/commandcode/index.mjs b/packages/commandcode/index.mjs index 3c358ef..46c0d98 100644 --- a/packages/commandcode/index.mjs +++ b/packages/commandcode/index.mjs @@ -34,16 +34,17 @@ const RESPONSES = "@ai-sdk/openai" // the Responses API, which magpie speaks to // ---- models ------------------------------------------------------------------- // The plan's models when its list can't be asked: Claude on Messages, the -// rest on chat completions. +// rest on chat completions. Pictures as models.dev has them (DeepSeek V4 +// and GLM-5.3 read text alone, so say nothing). const MODELS = [ - { id: "claude-sonnet-5", name: "Claude Sonnet 5", context: 1_000_000 }, - { id: "claude-opus-5-5", name: "Claude Opus 5.5", context: 1_000_000 }, - { id: "gpt-6-sol", name: "GPT-6 Sol", context: 1_050_000 }, + { id: "claude-sonnet-5", name: "Claude Sonnet 5", context: 1_000_000, images: true }, + { id: "claude-opus-5-5", name: "Claude Opus 5.5", context: 1_000_000, images: true }, + { id: "gpt-6-sol", name: "GPT-6 Sol", context: 1_050_000, images: true }, { id: "deepseek/deepseek-v4-pro", name: "DeepSeek V4 Pro", context: 1_000_000 }, { id: "deepseek/deepseek-v4-flash", name: "DeepSeek V4 Flash", context: 1_000_000 }, - { id: "moonshotai/Kimi-K3", name: "Kimi K3", context: 1_000_000 }, + { id: "moonshotai/Kimi-K3", name: "Kimi K3", context: 1_000_000, images: true }, { id: "zai-org/GLM-5.3", name: "GLM-5.3", context: 1_000_000 }, - { id: "MiniMaxAI/MiniMax-M3", name: "MiniMax M3", context: 1_000_000 }, + { id: "MiniMaxAI/MiniMax-M3", name: "MiniMax M3", context: 1_000_000, images: true }, ] // The models the Go plan is let use, as the CLI's own table has it @@ -155,9 +156,14 @@ function configModel(m) { } // runtimeModel is a model as OpenCode's provider.models hook returns it. +// Whether it takes pictures is said only when known (m.images a boolean): +// Command Code's list doesn't say, and a false said for every model +// unknown is taken by magpie as the plan's answer, over models.dev's, +// which the built-in asks for a model its list says nothing of +// (yetone/magpie: every model of the plan without image input). function runtimeModel(m) { const npm = m.npm ?? (isClaude(m.id) ? MESSAGES : CHAT) - const input = { text: true, image: !!m.images, audio: false, video: false, pdf: false } + const input = { text: true, ...(typeof m.images === "boolean" ? { image: m.images } : {}), audio: false, video: false, pdf: false } return { id: m.id, providerID: ID, @@ -185,16 +191,22 @@ function runtimeModel(m) { // liveModels is the Provider API's list, with the APIs each model is // served on (its Claude models on /messages alone, the open ones on // /chat/completions and /responses, some on /responses alone); the default list's names and -// windows fill in what it leaves out. +// windows fill in what it leaves out. The list says nothing of pictures: +// a model takes them as the default list or the CLI's table (GO_MODELS) +// says, and every Claude model does; of any other nothing is said, and +// magpie answers from models.dev. async function liveModels(key) { const res = await fetch(BASE + "/models", { headers: { Authorization: `Bearer ${key}`, "x-api-key": key } }) if (!res.ok) throw new Error(`models: ${res.status}`) const body = await res.json() const known = Object.fromEntries(MODELS.map((m) => [m.id, m])) + const table = Object.fromEntries(GO_MODELS.map((m) => [m.id, m])) const out = [] for (const m of body?.data ?? []) { if (!m?.id) continue const k = known[m.id] + let images = Array.isArray(m.modalities?.input) ? m.modalities.input.includes("image") : undefined + if (images === undefined) images = k?.images ?? table[m.id]?.images ?? (isClaude(m.id) || undefined) const eps = (m.supported_endpoints ?? []).map((e) => String(e).replace(/\/$/, "").replace(/^\/v1/, "")) let npm = isClaude(m.id) ? MESSAGES : CHAT // the first of the APIs it is served on, in magpie's order (chat @@ -205,7 +217,7 @@ async function liveModels(key) { id: m.id, name: m.name && m.name !== m.id ? m.name : m.display_name || k?.name || m.id, context: Number.isFinite(ctx) && ctx > 0 ? ctx : k?.context ?? 0, - images: (m.modalities?.input ?? []).includes("image") || undefined, + images, npm, }) } diff --git a/packages/commandcode/models.test.mjs b/packages/commandcode/models.test.mjs index 5f3fde4..71dadc9 100644 --- a/packages/commandcode/models.test.mjs +++ b/packages/commandcode/models.test.mjs @@ -81,3 +81,51 @@ test("the list's failures read as the built-in's", async () => { expect(await fail(Response.json({ data: [] }))).toBe(`${url}: no models listed`) expect(await fail(Response.json({ data: [{ id: "claude-opus-5-5" }, { id: "gpt-6-sol" }] }))).toBe("Command Code listed no models for the Go plan") }) + +// Command Code's list says nothing of pictures, and magpie's plugin host +// takes a model whose capabilities.input.image is a boolean as the plugin's +// answer, over models.dev's (internal/plugin/host.js, imageSaid): a false +// said for every model left each one of a moved plan without image input +// (ARNO on magpie 0.1.810). A model the plugin knows takes pictures says +// so; of one it doesn't know, nothing is said, and magpie answers from +// models.dev as the built-in does. +test("a model says it takes pictures when known, and nothing when not", async () => { + const pro = { type: "api", key: "pro-key", metadata: { plan: "Pro" } } + globalThis.fetch = async (url) => { + const path = new URL(String(url)).pathname + if (path === "/alpha/billing/subscriptions") return Response.json({ success: true, data: { planId: "individual-pro-monthly", status: "active" } }) + if (path === "/provider/v1/models") return new Response(list, { status: 200 }) + return new Response("", { status: 404 }) + } + const hooks = await CommandCodePlugin() + const ms = await hooks.provider.models({ models: {} }, { auth: pro }) + expect(Object.keys(ms).length).toBe(86) + const said = (id) => ms[id].capabilities.input.image + // Claude, the default list's and the CLI's table's + for (const id of ["claude-opus-5-5", "claude-haiku-4-5-20251001", "gpt-6-sol", "gpt-6-luna", "moonshotai/Kimi-K3", "Qwen/Qwen3.8-Flash", "stealth/pixel-canary", "MiniMaxAI/MiniMax-M3"]) { + expect(said(id)).toBe(true) + expect(ms[id].capabilities.attachment).toBe(true) + } + // text alone, or not known: not said either way + for (const id of ["deepseek/deepseek-v4-pro", "zai-org/GLM-5.3", "MiniMaxAI/MiniMax-M2.7", "tencent/hy4-preview"]) { + expect(said(id)).toBeUndefined() + expect("image" in ms[id].capabilities.input).toBe(false) + } + for (const m of Object.values(ms)) expect(said(m.id) === true || said(m.id) === undefined).toBe(true) + + // a list that says, is taken at its word + globalThis.fetch = async (url) => { + const path = new URL(String(url)).pathname + if (path === "/alpha/billing/subscriptions") return Response.json({ success: true, data: { planId: "individual-pro-monthly", status: "active" } }) + return Response.json({ data: [{ id: "claude-opus-5-5", modalities: { input: ["text"] } }, { id: "x/seer", modalities: { input: ["text", "image"] } }] }) + } + _internal.subsSeen.clear() + const said2 = await (await CommandCodePlugin()).provider.models({ models: {} }, { auth: { ...pro, key: "pro-key-2" } }) + expect(said2["claude-opus-5-5"].capabilities.input.image).toBe(false) + expect(said2["x/seer"].capabilities.input.image).toBe(true) + + // Go: the table's pictures, nothing said of the rest + const { ms: g } = await models(list) + expect(g["moonshotai/Kimi-K3"].capabilities.input.image).toBe(true) + expect(g["zai-org/GLM-5.2"].capabilities.input).not.toHaveProperty("image") +}) diff --git a/packages/commandcode/package.json b/packages/commandcode/package.json index 30c66cc..a14863a 100644 --- a/packages/commandcode/package.json +++ b/packages/commandcode/package.json @@ -1,6 +1,6 @@ { "name": "@magpie-community/opencode-commandcode-auth", - "version": "0.1.7", + "version": "0.1.8", "description": "Command Code plans (Pro, GOAT, Max, Ultra, Go, Teams) in OpenCode and magpie", "type": "module", "main": "./index.mjs",