Commit Graph
7 Commits
Author SHA1 Message Date
yetone 1a1ca0351b Revert "catalog: a listed model its id names a video model is one (agnes-video-2.5)"
This reverts commit b5b6cc573. It broke a rule #1399 set on purpose: a
model's name alone makes no video model, since magpie would then send
videos requests to a relay that may not serve them. A relay's video model
stays in the chat list until its list says "kind": "video" or the user
marks it Video in the provider editor, which needs the row there. The
full suite at b5b6cc573 (mote, go test -timeout 45m ./...) was red in
internal/gateway on TestCustomProviderMakesVideos,
TestCustomProviderVideoNeedsTheListsWord and
TestCustomProviderVideoTheUserMarks: sora-like-2, unmarked, became a
video maker and a /v1/videos request went out for it. I ran only
catalog, provider, agent and gui before pushing, not gateway.

Agnes's agnes-video-2.5 and -flash therefore stay among its chat models,
and the user marks them Video, as #1399 designed.

Run (mote, at this tree): go test ./internal/catalog and
go test -run 'TestCustomProvider' ./internal/gateway.
2026-11-04 18:38:32 +08:00
yetone b5b6cc5739 catalog: a listed model its id names a video model is one (agnes-video-2.5)
glorious_rabbit_30894 on Discord (#help): models of a custom provider
pointed at Agnes AI (apihub.agnes-ai.com/v1) "can't be added to an
agent". Agnes runs new-api; its /v1/models rows carry only id,
owned_by "custom" and supported_endpoint_types ["openai"], no kind,
domain or modalities. Nothing but the id tells agnes-video-2.5 and
agnes-video-2.5-flash from its chat models, and magpie had a name check
for image models (DrawsID) but none for video, so both were offered to
every agent as chat models, and never as video models.

FilmsID is DrawsID for videos (video, sora, veo, kling, seedance,
hailuo, vidu, runway, *-t2v/i2v/r2v; veo and kling only as a word of
their own, so inkling still chats). fetchPage marks a row a video model
by it when the list says no kind, no domain, no text output and the id
isn't an image model's. mendKinds applies the same to a list saved
before, so a fetched Agnes list is fixed on the first read, not the next
fetch. A model whose list says it answers in text is never moved.

Checked FilmsID against every id in models.dev's cache (~/.cache/magpie
models.json, 2026-11-04): every id it matches outputs video and no text,
except nvidia/synthetic-video-detector (a classifier, text out); video
models it misses are named for nothing it could know (ray2, minimax-h3,
gemini-omni), and their lists' modalities or a user's kind still mark
them.

Not the cause of the report, as far as can be told: with Agnes's real
list (testdata, fetched 2026-11-04) and models.dev's real cache, a
custom provider at .../v1, at the bare host, Anthropic or Responses
protocol, reaches Available, Exposed and Catalog with all four chat
models, and every agent's picker (claude, codex, opencode, pi, omp,
... 75 fields) lists them beside a relay's. The reporter says (#help 09:52) dsh, VS Code and Codex can't pick them,
with no error; that is not reproduced here and is asked for.

Run (mote):
- at this tree on origin/main 69eb93e0a: go test ./internal/catalog ok;
  go vet ./internal/catalog ./internal/provider for darwin, linux and
  windows ok; gofmt -l clean
- at the same change on 9595a503a: go test ./internal/provider
  ./internal/agent ok; ./internal/gui red only in TestCoreScriptBudget
  (#5139) and TestMainWindowCorners/macOS_26_SDK (#3949), both filed,
  neither in a file this touches
- sandbox HOME, Agnes's real list + models.dev's cache: Picks, Spell,
  Apply and Drift for codex, dsh, vscode, claude, opencode take
  agnes/agnes-2.5-flash with no error, and magpieModels for each lists
  the four chat models and, with this change, no video model
Broken by hand: live.go at HEAD with FilmsID kept: both Agnes tests red
(video models [] and listed as chat, saved list's too); green with it.
Not tried: a real Agnes key (none here); Agnes's video models asked at
/v1/videos (magpie's video path for a base URL) — whether Agnes serves
them there is unknown.
2026-11-04 18:10:35 +08:00
yetone 92d2ed74f9 providers: an Ark key's Seedance models are under Video models in its editor, each to tick
axelburks on Discord: "供应商里方舟的配置页,有图像模型选项能勾选模型,但是没
有视频模型选项不能勾选视频模型". A Volcengine Ark key's editor listed its
Seedream models under Image models, to tick, and had its Seedance models
among the chat models or nowhere.

Cause, two parts:
- The editor had no video section at all: video models had no list and no
  hidden set (gateway-routing.md said "Video models aren't listed in the
  editor, so there is nothing to hide there").
- catalog's live parse read only "kind" and modalities.input/output. Ark's
  /api/v3/models marks no kind: it says domain "VideoGeneration" /
  "ImageGeneration" and modalities.input_modalities/output_modalities. So
  Seedance came back as a chat model, and 3D models (output 3d, no text)
  as chat models too.

Change:
- catalog: a live row with no kind is a video model when its domain is
  VideoGeneration or it outputs video without text, an image model for
  ImageGeneration or image without text; Ark's input_modalities /
  output_modalities are read when input/output aren't there, so a model
  that gives no text (Ark's 3D) is left out of the chat list.
  TestFetchArkMarksVideoModels runs on a captured Ark list
  (testdata/volcengine-ark-models-2026-11-03.json, fetched read-only
  with GET /api/v3/models, no key in it).
- provider: HiddenVideomakers beside HiddenDrawers, VideomakerHidden.
- gateway: VideomakersOf (Videomakers on a given list, for the editor),
  OfferedVideomakers = Videomakers less the unticked ones, read by
  AutoVideomaker, videomakerObjects (another magpie's list) and
  mediaModels(true) (generate_video). A hidden one still makes its video
  when named: bareVideomaker, videosCreate and arkFilms read Videomakers.
- gui: the editor's Video models section (renderVideomakers), filmIds and
  hiddenVideomakers on /api/providers, kept on save as hiddenDrawers is;
  i18n for every language. app.js comments cut to stay under
  TestCoreScriptBudget, which this change reached; no raise.
- docs: gateway-routing.md's Hidden image models section.

Old data: an Ark list fetched before keeps Seedance among its chat models
until its list is fetched again;
customVideomakers already counts any Seedance id an Ark key lists or picks
as a video model, so it makes videos and shows under Video models now.

Run on mote, this change and the next (/v1/models ?kind=, gateway and
docs only) rebased on f4c664a09; this commit's own tree, on 17f2387e1,
gave the same Go results with Linux and Windows vet of ./internal/...
clean:
- go test -count=1 -timeout 45m ./internal/catalog ./internal/provider
  ./internal/gateway ./internal/gui: catalog, provider and gateway ok;
  gui red only in TestMainWindowCorners/macOS_26_SDK (#3949, red on main).
- GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: clean. gofmt -l: nothing.
- GUI (at the next commit's tree, which adds no GUI file or script): the 51 provider-*, drawers, image-models, i18n and
  video-models-hide files, both engines, every language, wide and narrow:
  1161 of 1188 ok. The 27 reds are 5 files that are red the same 27 at
  origin/main d1cdce130 run alone: provider-fetch-again (#3292/#5057),
  provider-models-rest (#4396), provider-picks-stay (#4397),
  provider-levels-scroll (#4395), provider-typed (#4673).
  video-models-hide: 22 of 22 ok.
- The whole GUI suite (all files) ran earlier at this change on 8af751987,
  347 of 19153 red at load 100 to 200; the 66 files with a red, run again
  alone, are red in the same tests at origin/main 17f2387e1 (all filed:
  #4388, #4391, #4398, #4320, #4541/#5013, #2564, #4244, #4304 and the
  above).
Rebased again onto d1cdce130 (sessions, Cursor mover, library and routing
plugins, group-unlists; nothing this change touches but gateway.go,
which merged clean) and run there: TestCoreScriptBudget and internal/gui's
new tests, the gateway's ?kind= and video tests, internal/provider and
internal/catalog, video-models-hide 22 of 22: ok.

Broken by hand, each red, then put back:
- the domain/output check in catalog's live parse:
  TestFetchArkMarksVideoModels red
- OfferedVideomakers returning Videomakers whole:
  TestHiddenVideomakerLeavesListsButStillFilms red
- the editor's filmIds left empty: TestVideoModelsHidden red
- a save without hiddenVideomakers dropping the old ones:
  TestVideoModelsHidden red
- renderVideomakers' call in the editor left out: video-models-hide
  22 of 22 red
- a chip's click not changing the draft: video-models-hide 22 of 22 red

Not tried: no real Ark video was made (no money spent); the list parse was
checked on a real Ark list fetched read-only. The editor was not opened in
the real app, only in the GUI tests' fake API.

Credit: axelburks on Discord.
2026-11-03 18:34:19 +08:00
yetone 8413267097 catalog: a list's image/jpeg is an image, so OpenCode Go's models that see take images again (zeo9901)
zeo9901 (CC01CC) on Discord #feedback: "magpie 中 opencode go 所有的模型似乎
都无法实现图片输入了". Their screenshot is a routing group of DeepSeek V4.1
Flash at Open Design and at OpenCode Go.

Cause: OpenCode Go's own /models (https://opencode.ai/inference/go/v1/models,
the same at /zen/go/v1/models) lists what a model takes as media types:
deepseek-v4.1-flash's modalities.input is ["text","image/jpeg","image/png",
"image/gif","image/webp"], Gemini's adds application/pdf and audio/*, and so
on. catalog's live-list reader took the list word for word and asked for
"image", found none, and recorded ImageInput = false, an explicit answer.
entryFor puts a list's explicit answer over models.dev's (which says
image), so with a working Go key every Go model was text-only: a direct
pick had its image described or turned away with "model does not support
image input", a group member was sent it described or not at all, and
agents were told the models take text only. It used to work while Go's
list spelt modalities as models.dev does, or said nothing.

Fix: catalog.Kinds reads a modalities list as models.dev words it
(image/* image, video/* video, audio/* audio, text/* text,
application/pdf pdf, each once, an unknown word kept, nil stays nil).
imageInput and the live reader's InputModalities/OutputModalities go
through it, as do Codex's input_modalities, the labs rows and a decision
provider's listed facts (decide.go). A list saved before this, still
holding Go's media types and false, is mended when read (mendKinds), so
a user sees images from the first read after the update, not the next
fetch. A user's own Accepts images answer still wins.

Which OpenCode Go models take images, per Go's list on 2026-10-31:
deepseek-v4.1-flash, kimi-k3, kimi-k3.1-pro, kimi-k2.7-code, glm-5.3-flash,
qwen3.8-max, qwen3.8-flash, qwen3.7-plus, minimax-m3, minimax-m3.1-flash,
mimo-v2.6-flash, mimo-v2.6-pro, step-5-preview, gemini-4-argon, grok-4.7,
gpt-6-luna, gpt-5.6-luna, claude-haiku-5-5, muse-spark-1.2/1.3-contributor.
Text only: deepseek-v4-pro, glm-5.2, glm-5.3, hy3, hy4-preview,
longcat-2.0, beam-free, iceman-contributor-free.

Tests (fixture: four rows of Go's real list, read without a key, no test
reaches the network):
- TestOpenCodeGoMediaTypesSee (catalog), TestKinds,
  TestSavedMediaTypesListSees, TestListedFactsMediaTypesSee (provider).
- Broken by hand: Kinds returning its input unchanged turns all four red
  (deepseek-v4.1-flash, kimi-k3, gemini-4-argon "Images false"); the
  mendKinds call taken out turns TestSavedMediaTypesListSees red.

Run on mote at the working tree on 82b45888a (origin/main 82b45888a plus this change):
- gofmt -l internal cmd: nothing.
- GOOS=linux go vet -tags nogui and GOOS=windows go vet of
  ./internal/catalog ./internal/provider ./internal/gateway: ok.
- go test -tags nogui ./internal/catalog ./internal/provider
  ./internal/gateway ./internal/agent -count=1 -timeout 45m: all ok
  (catalog 0.7s, provider 129s, gateway 665s, agent 203s).
  The docs paragraph was added after the run; no code changed since.
  The full go test ./... and the GUI suite were not run (no GUI file
  changed).
- Rebased onto ceeb73a0f (two commits outside catalog); at the rebased
  tree go test -tags nogui ./internal/catalog ./internal/provider
  -count=1 -timeout 45m: ok (catalog 0.8s, provider 98s).

Docs: gateway-routing.md, "A model that turns an image away".

Not tried: a real OpenCode Go request with an image (the only Go key here
has expired, and it isn't to be used). Not known: which agent and version
the reporter uses; Open Design's DeepSeek in the same group is a separate
provider and wasn't looked at.
2026-10-31 14:51:11 +08:00
yetone 2ac423f4f2 kimi: a Kimi Code plan model is told always_thinking, dynamically_loaded_tools and its default effort, as Kimi's list says (jiabubu)
jiabubu on Discord (Kimi Code 2.2.0, Windows): Kimi Code's own provider
gives K2.8 Preview and K3.1 Pro the capabilities thinking,
always_thinking, image_in, video_in, tool_use and
dynamically_loaded_tools; through magpie they had thinking, image_in and
tool_use, so Kimi Code offered a thinking switch the models refuse to
turn off, and started K2.8 on high where Kimi's own starts it on max.

Kimi Code 2.4.1's managed provider (packages/oauth managed-kimi-code.ts,
capabilitiesForModel) derives them from /coding/v1/models:
supports_thinking_type "only" -> thinking + always_thinking,
supports_dynamic_tools -> dynamically_loaded_tools, supports_video_in ->
video_in, think_efforts.default_effort -> the default. magpie now reads
the same fields (flat, or nested reasoning.type, tools.dynamic_load,
reasoning.effort.default) into catalog.Model (AlwaysThinks,
DynamicTools, DefaultEffort; kimiFacts), carries them through
provider.Entry and the agent's model list, and the new Kimi Code's table
gets always_thinking, dynamically_loaded_tools and default_effort at the
vendor's default (else high, as before). Only Kimi's list sends these
fields, so another vendor's model is written as before; kimi-cli, which
refuses unknown words, gets none. A routing group has none of them.

default_effort is now recorded in the stash as magpie's (kimiOwn), so a
level the user picked stays while the model has it. A table with high
and no record is read as the high magpie wrote before it kept one, and
becomes the vendor's default (max on K2.8, high on K3/K3.1).

Left out:
- video_in: with type="kimi" Kimi Code uploads a video to
  {base_url}/files (purpose=video) and sends the ms:// id. The gateway
  has no /files route, and the id belongs to the account that stored it.
  Filed as #4485.
- dynamically_loaded_tools works (Kimi Code's tool select is behind
  KIMI_CODE_EXPERIMENTAL_TOOL_SELECT): the loaded tools' system message
  is lifted into the request's tools (liftMessageTools, #2322), so they
  stay callable (TestKimiCodeLoadedToolsReachKimi), but each load
  restarts Kimi's prompt cache. Filed as #4486.
- max_output_size: Kimi's own provider writes none; magpie keeps writing
  the model's known reply cap (32768 on K2.8 per models.dev), unchanged.

This also covers #3399 (K3.1 offered thinking off): Kimi's list says
"only" for both K3.1 models.

Real list: tests read Kimi's /coding/v1/models reply of 2026-10-31
(internal/catalog/testdata/kimi-code-cn-models-2026-10-31.json, read
with the owner's kimi-code-cn key, no key in the file).

Run (mote, at this commit on origin/main b62fa332f; the agent-wiring.md
line was added after the run, docs only):
- go test -tags nogui -count=1 -timeout 45m ./... : 79 packages ok;
  internal/proc (TestNoCommandBypassesProc) and internal/sqlitedb
  (TestOnlyThisPackageReachesSQLite) red on a Go module cache my e2e
  sandbox had left inside the run folder (vendor files under
  e2e-kimi/sb/home/go/pkg/mod); with it removed both ok.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./... ok; gofmt -l clean.
- Real Kimi Code 2.4.1 (npm) in a sandbox HOME/KIMI_CODE_HOME on mote,
  with a sandbox magpie serve (MAGPIE_ADDR 127.0.0.1:34652), the
  kimi-code-cn preset pointed at a fake upstream that serves the real
  list: magpie wrote the six tables (K2.8: thinking, always_thinking,
  image_in, tool_use, dynamically_loaded_tools, support_efforts low/high/
  max, default_effort max; K2.7 Highspeed without
  dynamically_loaded_tools), Kimi Code took the config, and `kimi -p`
  reached the upstream with thinking enabled and reasoning_effort max
  (K2.8) and high (K3.1 Pro).
- Rebased onto 43966a53f..f2eb56c6b (claude, GUI budget, usage; none of
  them touch these files) as f5a82f215, then again at this head:
  internal/agent, internal/catalog, internal/provider ok, internal/gateway
  -run 'Kimi|MessageTools|Lift' ok. The full suite was not rerun there.

Broken by hand, each red then green:
- kimiFacts not called: TestFetchKimiCodeFacts and
  TestKimiCodePlanCapabilities red.
- fields not carried in route.go / entryFor: TestKimiCodePlanCapabilities
  red.
- the unrecorded-high rule off: TestKimiCodeOldHighBecomesTheVendorsDefault
  red.
- always_thinking without the !legacy guard: the kimi-cli case red.

Not tried: the TUI picker by eye (that the thinking switch is gone);
tool select with a real MCP server and the experimental flag; Windows
(the reporter's system; nothing here is OS-specific); a real Kimi
upstream through magpie (the list was real, the chat was a fake).
2026-10-31 03:27:34 +08:00
yetone f51ab771f6 catalog, provider: a model only models.dev's lab lists is known, and a Claude account lists the gated models Anthropic told its Claude Code of (iebb on Discord)
iebb on Discord (10-27): his account has Claude Mythos 5.1, magpie
doesn't list it. models.dev took the gated Mythos 5.1 out of
anthropic's provider list (models.dev #11327) and kept only its lab
file, models/anthropic/claude-mythos-5-1.toml (#11328).

Cause. magpie read only models.dev's api.json (providers -> models).
The Claude subscription's list was exactly catalog.Provider("anthropic"),
so Mythos 5.1 left it with that PR. And a vendor list that still
returns it (an Anthropic key's /v1/models) got no window, reply limit,
name or thinking for it, since nothing read the lab catalog.

Fix.
- catalog: Sync also keeps models.dev's lab catalog (models.json) as
  labs.json beside the cache, through temp+rename; a failed fetch
  keeps the last one, and a cache without it is Stale once a process.
  A model only a lab lists votes into the same tables as a listed one
  (ContextOf, OutputOf, NameOf, Thinks, SeesImages); a model a
  provider lists keeps what providers say. A thinking lab-only model
  with no levels takes those of the newest of its family a provider
  gives (labKinEfforts: Mythos 5.1 takes Mythos 5's). catalog.Describe
  builds a Model from an id for lists that name ids alone.
- provider: the Claude account's list is models.dev's anthropic list
  plus what Anthropic told the account's Claude Code beyond it, read
  from .claude.json's additionalModelOptionsCache / modelAccessCache /
  additionalModelCostsCache (Claude Code's own sign-in and each saved
  account's directory). Account.Lists honours modelAccessCache's
  entitled per account, ListPrice falls back to Anthropic's price
  from additionalModelCostsCache, and the agent's own Claude Code
  picker (claudeOwn) offers the signed-in account's extras. WSL keeps
  the catalog list. magpie still asks Anthropic nothing with a Claude
  sign-in; nothing is sent differently, no Claude Code mimicry change.
- docs/subsystems/providers-accounts.md: two rows, the lab catalog
  and a Claude account's models.

Testdata: models.dev's api.json and models.json as served on 10-27,
cut to the anthropic and azure providers' Claude models and the
anthropic lab. Tests never reach the network.

Run:
- TestLabOnlyModelIsKnown, TestLabsLeaveListedModels, TestSyncKeepsLabs,
  TestClaudeAccountListsGatedModels, TestAnthropicKeyGatedModelDescribed:
  pass.
- go test -count=1 -timeout 45m ./internal/catalog/ ./internal/provider/
  ./internal/agent/ ./internal/gateway/ at 2e165fe9d + this change:
  catalog, agent (362s), gateway (557s) ok; provider crashed in
  TestUnreadLoginsWriteErrorsKeepCredentials ("close of synctest
  channel from outside bubble" in filememo.Forget). It crashes the
  same alone on a fresh origin/main 19dc5b925 and is #3632, open.
- rebased onto origin/main 2afacd7d1 (this commit's parent): catalog
  and provider again with -skip TestUnreadLoginsWriteErrorsKeepCredentials,
  both ok. agent and gateway were not run again after the rebase.
- gofmt -l internal/: nothing. go vet for darwin, linux and windows on
  catalog, provider, agent, gateway at the rebased head: ok.
- Real use: magpie built from this tree (linux, nogui) in a golang:1.26.8
  container with a sandbox HOME, so the Mac's Keychain and ~/.claude are
  never read. `magpie sync` fetched models.dev's real catalogs today
  (api.json's anthropic has no claude-mythos-5-1; labs.json has it).
  With a fake Claude sign-in and a .claude.json whose bootstrap caches
  name claude-mythos-5-1, `magpie models` lists claude/claude-mythos-5-1
  "Mythos 5.1" low/medium/high/xhigh; `magpie model spec` gives 1M,
  128k, vision on; `magpie model price` gives $25/$125, cache read
  $2.5, write $31.25 / $50 (1h). A custom Anthropic-protocol provider
  against a fake /v1/models returning claude-mythos-5-1 lists
  fakeanth/claude-mythos-5-1 "Claude Mythos 5.1" with 1M / 128k /
  low..xhigh.

Broken by hand, each red:
- lab reading off in loadGen: every lab assertion in the catalog tests
  and the provider tests (no window, no levels, the API-key entry's
  context 0).
- syncLabs off: TestSyncKeepsLabs.
- labKinEfforts off: the efforts assertions.
- the Claude list back to catalog.Provider("anthropic"): "Claude
  account's list has no Mythos 5.1".
- claudeLists / claudeCodePrice off: the entitlement and price
  assertions.

Not tried:
- a real account with Mythos 5.1: none here. The .claude.json keys and
  shapes were read from Claude Code 2.1.311's own binary, not a real
  account's file.
- a custom Anthropic-protocol provider without catalog=anthropic gets
  no price for a lab-only model (labs carry none).
- the plugin host's mdev() (host.js) reads api.json only; Gemini CLI's
  own picker stays catalog-only; a saved Claude account whose Claude
  Code never ran has no .claude.json, so its gated models show once it
  has run there.
2026-10-27 12:16:33 +08:00
Ha1baraA1 c8b4ac7755 fix(catalog): honor models.dev reasoning toggles (#1294)
* catalog: honor reasoning toggles as off effort

Include none when models.dev reports both a reasoning toggle and effort levels. Keep toggle-only entries level-less, and leave effort-only entries unchanged.

Validation: go test ./... with GOFLAGS=-tags=nogui; all packages pass. The new catalog regression failed before the fix and passes after it. No vendor API request was made locally.

* catalog: limit reasoning off to DeepSeek

* catalog: include verified Kimi reasoning toggles

* fix(catalog): keep off effort provider scoped
2026-10-14 15:30:43 +08:00