cline 0.1.8: a model takes images where Cline's catalog says it does, not "text only" for every model (silent on Discord)

runtimeModel said input.image false for every model, so magpie, which
takes a plugin's said capability over models.dev's, treated ClinePass's
DeepSeek V4.1 Flash and GLM 5.3 Flash as text-only: the image tick stayed
off and images went to a describer model.

/ai/cline/models already carries architecture.input_modalities (Cline's own
client reads images from it). fetchCloudModels now keeps it; a feed model
gets its own entry's, else the entry of the model after its prefix
(cline-pass/deepseek-v4.1-flash is deepseek/deepseek-v4.1-flash; :batch
variants count as the model) when every such entry agrees. Where the
catalog says nothing, image is left unsaid, so magpie asks models.dev
instead of being told no. attachment follows image.

Run: bun test packages/cline (80 pass); the new hook test fails with the
old hardcoded input (79 pass, 1 fail); bun scripts/check.mjs cline passes.
The models hook against Cline's live public catalog (no sign-in) gives
cline-pass/deepseek-v4.1-flash and glm-5.3-flash image true, glm-5.3 and
deepseek-v4-pro false, qwen3.8-max unsaid. Not tried with a signed-in
ClinePass account sending a real image.
This commit is contained in:
yetone
2026-10-14 23:10:01 +08:00
parent 9803210691
commit e8fdbdb616
3 changed files with 83 additions and 6 deletions
+46 -4
View File
@@ -472,20 +472,58 @@ async function fetchCloudModels() {
// be most of the window (kimi-k3: 943718 of 1048576), and an agent
// keeps that much of the window free for the reply, so it would
// compact a tenth of the way in
return [{ id, name: given && given !== id && given !== last ? given : prettify(id), free: false, pass: id.startsWith("cline-pass/"), ...(context && { context }) }]
const input = inputsOf(e)
return [{ id, name: given && given !== id && given !== last ? given : prettify(id), free: false, pass: id.startsWith("cline-pass/"), ...(context && { context }), ...(input && { input }) }]
})
}
// KINDS are the kinds of input OpenCode's capabilities name
const KINDS = ["text", "image", "audio", "video", "pdf"]
// inputsOf is what a catalog entry says the model takes (OpenRouter's
// architecture.input_modalities: ["text", "image"]), undefined when it says
// nothing
function inputsOf(e) {
const l = e?.architecture?.input_modalities ?? e?.input_modalities
if (!Array.isArray(l) || !l.length) return undefined
const has = new Set(l.map((k) => String(k).toLowerCase()))
return Object.fromEntries(KINDS.map((k) => [k, has.has(k)]))
}
// bareOf is a model id without its provider and a variant after ":"
// (deepseek/deepseek-v4.1-flash:batch is deepseek-v4.1-flash)
const bareOf = (id) => String(id).split("/").pop().split(":")[0].toLowerCase()
// inputsFor is what Cline's catalog says a model takes: by its own id, else,
// for a model the catalog lists under its maker's id only (the feed's
// cline-pass/deepseek-v4.1-flash is the catalog's deepseek/deepseek-v4.1-flash),
// by the model after the prefix while every entry of that model agrees.
// Undefined when the catalog doesn't say, so magpie asks models.dev.
function inputsFor(id, cloud) {
const own = cloud.find((c) => c.id === id)
if (own) return own.input
const bare = bareOf(id)
const said = cloud.filter((c) => c.input && bareOf(c.id) === bare).map((c) => c.input)
if (!said.length || said.some((x) => KINDS.some((k) => x[k] !== said[0][k]))) return undefined
return said[0]
}
// fetchFeed is both of Cline's model lists merged, recommended first: the
// recommended feed is required, the cloud catalog is what it adds.
async function fetchFeed() {
const [rec, cloud] = await Promise.all([fetchRecommended(), fetchCloudModels().catch(() => [])])
// a recommended model takes the catalog's window for it: the recommended
// feed gives none
// and what the catalog says it takes (images: Cline's own client reads
// it there), else a ClinePass or free model takes what the catalog says
// the model after its prefix takes (silent on Discord: DeepSeek V4.1
// Flash and GLM 5.3 Flash were taken for text-only, so magpie had their
// images described by another model)
const sizes = new Map(cloud.map((m) => [m.id, m]))
const ms = rec.map((m) => {
const c = sizes.get(m.id)
return c?.context ? { ...m, context: c.context } : m
const input = inputsFor(m.id, cloud)
return { ...m, ...(c?.context && { context: c.context }), ...(input && { input }) }
})
const seen = new Set(ms.map((m) => m.id))
for (const m of cloud) {
@@ -519,9 +557,12 @@ const runtimeModel = (m) => ({
capabilities: {
temperature: true,
reasoning: false,
attachment: false,
attachment: !!m.input?.image,
toolcall: true,
input: { text: true, image: false, audio: false, video: false, pdf: false },
// what Cline's catalog says it takes; where it says nothing, images
// are left unsaid rather than said no to, so magpie takes models.dev's
// word for the model
input: m.input ?? { text: true },
output: { text: true, image: false, audio: false, video: false, pdf: false },
interleaved: false,
},
@@ -1052,6 +1093,7 @@ export const _internal = {
fetchFeed,
fetchRecommended,
fetchCloudModels,
inputsFor,
creditsOf,
balanceUSD,
usd,
+36 -1
View File
@@ -3,7 +3,7 @@
import { test, expect, beforeEach, afterEach } from "bun:test"
import { ClinePlugin, _internal } from "./index.mjs"
const { authOf, parseAuth, parseFeed, prettify, creditsOf, balanceUSD, usd, usageOf, limitWindows, failure, bearerOf, toMs, refresh, deviceAuthorize, pollDevice, clientHeaders, constants: { CLIENT, DEFAULT_MODELS } } = _internal
const { authOf, parseAuth, parseFeed, prettify, inputsFor, creditsOf, balanceUSD, usd, usageOf, limitWindows, failure, bearerOf, toMs, refresh, deviceAuthorize, pollDevice, clientHeaders, constants: { CLIENT, DEFAULT_MODELS } } = _internal
// ---- a fetch that answers from a script -----------------------------------------
@@ -920,6 +920,41 @@ test("the models hook gives each model the window Cline's catalog has for it, an
expect(out["no/size"].limit).toEqual({ context: 0, output: 0 })
})
test("the models hook says a model takes images where Cline's catalog says so, and leaves it unsaid where it doesn't", async () => {
const { client: c } = client()
const hooks = await ClinePlugin({ client: c })
serve([
["/ai/cline/recommended-models", () => Response.json({ recommended: [{ id: "anthropic/claude-sonnet-5.5" }], free: [{ id: "cline-pass/deepseek-v4.1-flash" }, { id: "cline-pass/glm-5.3-flash" }, { id: "cline-free/mystery-1" }] })],
["/ai/cline/models", () => Response.json({ data: [
{ id: "anthropic/claude-sonnet-5.5", architecture: { input_modalities: ["text", "image", "file"] } },
{ id: "deepseek/deepseek-v4.1-flash", architecture: { input_modalities: ["text", "image"] } },
{ id: "deepseek/deepseek-v4.1-flash:batch", architecture: { input_modalities: ["text", "image"] } },
{ id: "z-ai/glm-5.3-flash", architecture: { input_modalities: ["text", "image"] } },
{ id: "inclusionai/ling-3.1-flash", architecture: { input_modalities: ["text"] } },
{ id: "no/modalities" },
] })],
])
const out = await hooks.provider.models({ models: {} })
// silent on Discord: DeepSeek V4.1 Flash and GLM 5.3 Flash through ClinePass
// were taken for text-only
expect(out["cline-pass/deepseek-v4.1-flash"].capabilities.input.image).toBe(true)
expect(out["cline-pass/glm-5.3-flash"].capabilities.input.image).toBe(true)
expect(out["anthropic/claude-sonnet-5.5"].capabilities.input.image).toBe(true)
expect(out["inclusionai/ling-3.1-flash"].capabilities.input.image).toBe(false)
// where the catalog says nothing, nothing is said: magpie asks models.dev
expect("image" in out["cline-free/mystery-1"].capabilities.input).toBe(false)
expect("image" in out["no/modalities"].capabilities.input).toBe(false)
expect(out["no/modalities"].capabilities.input.text).toBe(true)
})
test("inputsFor doesn't guess when the catalog's entries of one model disagree", () => {
const yes = { text: true, image: true, audio: false, video: false, pdf: false }
const no = { ...yes, image: false }
expect(inputsFor("cline-pass/m-1", [{ id: "a/m-1", input: yes }, { id: "b/m-1", input: no }])).toBe(undefined)
expect(inputsFor("cline-pass/m-1", [{ id: "a/m-1", input: yes }, { id: "b/m-1" }])).toEqual(yes)
expect(inputsFor("a/m-1", [{ id: "a/m-1" }, { id: "b/m-1", input: yes }])).toBe(undefined)
})
test("prettify reads a model id as a name", () => {
expect(prettify("anthropic/claude-sonnet-5.5")).toBe("Claude Sonnet 5.5")
expect(prettify("openai/gpt-6-astra")).toBe("GPT 6 Astra")
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@magpie-community/opencode-cline-auth",
"version": "0.1.7",
"version": "0.1.8",
"description": "Cline (cline.bot) on your own account — usage billing, ClinePass and the free models — in OpenCode and magpie",
"type": "module",
"main": "./index.mjs",