Trae CN's kimi-k3 / kimi-k3-max / kimi-k3-auto think, and /v1/models
said reasoning: true, but Pi's models.json was written reasoning: false:
piModelJSON read the levels alone. Pi then offered off alone and
`magpie pi effort high` was clamped to off.
provider.Entry.Thinks() (Reasoning or levels) is now the one judgement:
/v1/models' modelObject and magpieModels, which every agent export
reads, both take it. Pi writes reasoning from it, with no
thinkingLevelMap when the levels aren't known, so Pi offers its own off
to high (getSupportedThinkingLevels, read in Pi's bundle) and the
gateway fits them (fitFor caps a switch-only model at high, #214).
Command Code is told reasoning alone for such a model, which its BYOK
reference takes for low/medium/high. OpenCode, Alma and Zed already
judged it so.
Left as they are: omp (pi-catalog's getSupportedEfforts gives a
reasoning model without thinking.efforts no levels, so the flag alone
buys nothing), jcode (how it reads reasoning with no effort not
verified), Crush (can_reason without levels sends no effort on its
openai type), cline/workbuddy/zcode (they write level lists only).
TestOpenCodeNoResellerLevelsForSwitchModel pinned Xiaomi's
mimo-v2.6-flash (a thinking switch alone) as reasoning: false in Pi; it
is now reasoning: true with no map, so Pi still offers no xhigh or max.
Run (worktree, sandbox HOME, -tags nogui -p 1):
- new TestThinkingWithoutLevelsReachesTheExports (trae-cn/kimi-k3-max):
green; red with Pi's old line ("Pi offers [off]") and red with
Command Code's case removed
- internal/agent -run 'Pi|CommandCode|CC|Cc|Thinking|Reason|OpenCode|
Alma|Zed|Omp|JCode|Jcode|Crush|Route|MagpieModels': ok (382s)
- internal/gateway -run 'Model|Reason|Thinks': ok
- internal/provider -run 'Entry|Reason|Thinks|Catalog': ok
- gofmt -l clean; go vet -tags nogui darwin/linux/windows on agent,
provider, gateway: clean
Not tried: a real Pi against a real Trae CN account; whether Xiaomi
takes Pi's "minimal" for mimo-v2.6-flash (the gateway passes a level
it has no list for as asked).
Full suite: SUITE_LINE
A Chinese window said "ZCode 已接入 magpie. ZCode reads its providers at
start-up — restart ZCode …": the notice an agent gives after a change
(state.notice) was English text written in place in each agent's file, and
i18n.js had no entry for any of them.
What changed:
- internal/agent/notice.go: a notice is a template registered with
newNotice ("Restart {agent} to …"), filled with say(kv...); Notices()
lists every one. All the agents' notices (claude, codex daemon, zcode,
agy, cursor-local, wsl, AstrBot's added today, …) are now such templates, the issue's list
being a sample of them.
- i18n.js: every template has a zh, zh-TW, ja and de translation, and
NOTICES lists them. tNotice() reads a notice of several joined: longest
template first, a {slot} never runs over a sentence's end, and a notice
with any part that has no template (a plugin's own) reads as given
rather than half in each language. withNotice() joins the status line
and the notice with 。 in zh/ja.
- app.js: the six places that showed state.notice use withNotice.
Tests:
- TestEveryNoticeIsTranslated: every Notices() template is in NOTICES and
in each language table, with the same slots. Fails with the zh ZCode
line deleted from i18n.js (tried).
- TestNoticesAreTemplates: an AST scan for English written in place as a
Notice. Fails with zcode.go's literal put back (tried).
- tests/agent-notice-lang.test.cjs: every template, filled, alone and
joined, plus a plugin's notice, and connecting ZCode as the reporter
did; en, zh, zh-TW, ja, de at 1100 and 420px, Chromium and WebKit:
22/22. Its zh subtests fail without the zh line.
Run: go test -tags nogui ./internal/agent ./internal/gui; gofmt -l;
GOOS=linux and GOOS=windows go vet -tags nogui ./internal/agent
./internal/gui; the full GUI suite (node --test, both engines, -concurrency 6,
machine load ~140): 5130/5195, 64 failing in 22 files. Rerun alone, 16
files pass; mobile-web, old-webkit, panel-usage and routing-context/
group/keys-fold fail the same on the base commit, b6a263b9.
go test -tags nogui -timeout 40m ./... on the rebased tree: every package
ok but internal/gateway, whose TestQueuedStreamKeptAliveForTheMinute hit
its 1.5s read deadline at a machine load of ~130; it passes -count=3 run
alone, and this change touches nothing it runs.
syncJSON and Pi's writeMagpie set providers.magpie to a freshly built
object, so a key magpie doesn't write there was dropped on every sync.
theirsKept now merges magpie's block into what the file holds: keys magpie
writes are its own, objects in both are merged key by key, and anything
else (compat, an options key, Crush's extra_headers) stays. The model list
is still magpie's whole, so a model gone from the catalog leaves it, and a
sync with nothing new writes nothing.
The same goes for every agent that writes the block whole: Pi and OmO,
Aside, Pencil, OpenCode (and the agents built on it), OpenChamber, Crush
and Command Code.
Verified: TestPiKeepsTheirKeysInMagpiesProvider (the reporter's
compat.sendSessionAffinityHeaders: true in Pi's models.json, through
SyncCatalog and a pick) and TestOpenCodeAndCrushKeepTheirKeysInMagpiesProvider
fail without the change ("compat.sendSessionAffinityHeaders dropped by the
sync", "opencode sync") and pass with it. go test -race ./internal/agent
and go vet ./... pass in a sandbox HOME.
Each was a one-line wrapper of its *At function for the local gateway.
The callers moved to closures of the same name over the agent's own
address (at.v1(), at.gw()), which shadow the package function, so the
wrappers were reached by nothing, tests included (deadcode -test). Their
doc comments now sit on the *At functions, and isCodexGatewayOn has its
own again: it had been left above codexKeptGateway.
go vet (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui
./internal/agent under a temp HOME pass.