8338 Commits
Author SHA1 Message Date
antior 7794c45bd1 plugin: expose account plan names
Test / test (windows-latest) (push) Failing after 27s
Docker / build (linux/amd64) (push) Failing after 1m22s
Test / test (ubuntu-latest) (push) Failing after 14m2s
Test / cli (linux/amd64, nogui) (push) Failing after 9m44s
Test / cli (android/arm64, nogui) (push) Failing after 6m21s
Docker / build (linux/arm64) (push) Canceled after 0s
Test / test (macos-latest, 1/3) (push) Canceled after 0s
Test / test (macos-latest, 2/3) (push) Canceled after 0s
Test / test (macos-latest, 3/3) (push) Canceled after 0s
Test / test (macos-latest, gateway) (push) Canceled after 0s
Docker / merge (push) Canceled after 0s
Verification: targeted provider/plugin tests passed with -race; provider-concurrency Playwright tests passed 24/24 in Chromium and WebKit, English and Chinese; i18n tests passed 8/8; go vet passed for plugin/provider/gui; Windows, Linux and Darwin nogui builds passed. New provider, host and GUI tests failed on the old implementation (missing Account.Plan, null plan values, and labels without plan names). An expanded nogui package run was not clean: Windows TempDir cleanup, symlink privilege, local SOCKS connection, cached-read allocation, and Codex restart helper failures remain outside this change. Real NAS account, GUI and SSE verification are not yet run.
2026-11-20 20:21:48 +08:00
antior e5ef1b0a3d docs: describe account concurrency priority
Test / test (windows-latest) (push) Failing after 1m0s
Test / test (macos-latest, 1/3) (push) Canceled after 0s
Test / test (macos-latest, 2/3) (push) Canceled after 0s
Test / test (macos-latest, 3/3) (push) Canceled after 0s
Test / test (macos-latest, gateway) (push) Canceled after 0s
Test / test (ubuntu-latest) (push) Canceled after 0s
Test / cli (linux/amd64, nogui) (push) Canceled after 0s
Test / cli (android/arm64, nogui) (push) Canceled after 0s
Docker / build (linux/amd64) (push) Failing after 1m20s
Docker / build (linux/arm64) (push) Canceled after 0s
Docker / merge (push) Canceled after 0s
2026-11-20 19:27:32 +08:00
antior ff9b0dc936 provider: support plugin account concurrency
Test / test (windows-latest) (push) Failing after 3m16s
Test / test (macos-latest, 1/3) (push) Canceled after 0s
Test / test (macos-latest, 2/3) (push) Canceled after 0s
Test / test (macos-latest, 3/3) (push) Canceled after 0s
Test / test (macos-latest, gateway) (push) Canceled after 0s
Test / test (ubuntu-latest) (push) Canceled after 0s
Test / cli (linux/amd64, nogui) (push) Canceled after 0s
Test / cli (android/arm64, nogui) (push) Canceled after 0s
Docker / build (linux/amd64) (push) Failing after 1m59s
Docker / build (linux/arm64) (push) Canceled after 0s
Docker / merge (push) Canceled after 0s
Let a plugin report an automatic request limit for each account. Account and provider manual limits keep priority, and the GUI and CLI show the automatic value without saving it as a manual override.

Verification on origin/main f65fe92ef: targeted provider/plugin tests and race tests pass; go vet, Linux nogui vet, Windows vet, native build, Linux nogui build and Windows build pass; 57 Chromium/i18n plus 24 WebKit GUI tests pass. Without the change, the new automatic-limit GUI cases fail in English and Chinese on both engines. Earlier full Windows runs also exposed unrelated existing path, symlink, cleanup and timeout failures.
2026-11-20 19:20:52 +08:00
yetone f65fe92ef9 library: OpenClaw takes MCP servers and the MCP router (@JeffreyCalm on X)
OpenClaw had no Library target, so Library -> MCP had no switch for it,
and the router couldn't be turned on there. OpenClaw 2026.11.6 reads MCP
servers from openclaw.json's mcp.servers. Its schema is strict: an
unknown key such as timeout, type or toolFilter.allow fails the whole
config. So the new fmtOpenClaw writes only keys OpenClaw accepts:
- remote servers: url, transport (streamable-http or sse) and headers;
- local servers: command, args and env;
- requestTimeoutMs for magpie's own long servers (its default is 60s).
The transport is written for every remote server, because OpenClaw
treats a url with no transport as SSE. Keys the user set themselves are
left alone: toolFilter, requestTimeoutMs, auth, enabled and the rest.
OpenClaw fails the whole file on an unset ${VAR}, so it gets no env
refs.

Image generation and built-in search (2nd half of the report): magpie
wires OpenClaw as openai-completions. OpenClaw's native OpenAI web
search applies only to direct OpenAI traffic, and image_generate needs
an image provider configured in OpenClaw. The gateway drops nothing.
With this target, Magpie Image and Magpie Web Search can now be given to
OpenClaw as MCP servers. Native wiring is #7334. Refs #5897.

Run:
- TestOpenClawMCP and TestOpenClawMCPHub (new) on mote.
- Real OpenClaw 2026.11.6 (Node 24.22.1) in a sandbox HOME on mote, on
  the openclaw.json magpie wrote:
  - "Config valid", and mcp doctor all ok;
  - mcp status shows magpie as streamable-http;
  - mcp probe lists the tools of the stdio server (with env), of the
    streamable HTTP magpie entry, and of a user server with toolFilter.
- Full acceptance on mote at b9dc1d0be + this commit:
  - gofmt -l clean;
  - go vet, GOOS=linux go vet -tags nogui and GOOS=windows go vet ok;
  - build ok;
  - go test -tags nogui -timeout 45m ./...: every package ok except
    four reds outside internal/library. Three are filed:
    TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes (#7117),
    TestBuiltinsTranslated (#7257) and
    TestSettingsSaveKeepsWhatItDoesNotSend (#7240). The fourth,
    TestShimIgnoresDialogWordsInHistory, is new as #7341.

Broken by hand:
- the old targets.go (no openclaw case): both tests red;
- encode writing transport "http": both tests red;
- removing transport in real OpenClaw: mcp status said sse and the
  probe timed out against the streamable server.

Not tried:
- a real magpie gateway hub (a fake streamable MCP server stood in);
- OpenClaw skills and instructions targets;
- the GUI switch in a browser.
2026-11-20 18:22:38 +08:00
yetone b9dc1d0beb library: a skill in ~/.agents/skills can be removed with no copy kept too (Eternalfate__ on X)
v0.1.4585 (6a0afc38a) put a tick, "Keep a copy in magpie's backups", on
the sheets that remove skills. The same reader, on v0.1.4594, saw it on
no sheet. It shows only when a folder of magpie's own would be deleted,
and most users have no such skill:
- a skill brought in from the agents (most of a library) has Put back,
  not Remove: it goes back to them, nothing kept or deleted;
- one linked from ~/.agents/skills (npx skills, Codex) only loses the link;
- an agent's own skill with its folder in ~/.agents/skills, where most
  skills are, always went to the backups, and its sheet had no tick
  (inSharedDir). That sheet says "Its entry in ~/.agents/skills goes to
  the backups too", so the reader saw backups promised and no way out.
  The TUI's D said it deleted such a folder and kept it all the same.

The entry leaves ~/.agents/skills either way (setAside moves it out), so
the other tools reading that folder lose it either way; kept, it only sat
in the backups, which are never pruned when they hold skills. Now it is
deleted like any other folder when the tick is off, and its sheet (one
skill, and the picked ones) has the tick, saying "Its entry in … is
deleted too" when unticked. Never deleted, as before: a link's target.
An entry in ~/.agents/skills that is a link only goes, and its sheet says
"Its link in … goes too" (it said the entry went to the backups).

Remove all / the picked library skills counted one brought in from the
agents as a folder moved to the backups (or, linked, as only unlinked),
and showed the tick for it. It goes back to them (putBack): it is said
so, "{n} go back to the agents they were brought in from, as they were",
and counts for neither, nor for the tick.

Four new strings in zh, zh-TW, ja and de. docs/subsystems/library.md
says what changed.

Run (mote, this tree at base 5754fea43, origin/main when fetched):
- go test ./internal/library -run 'WithoutBackup|Found|Shared': ok.
- broken by hand: skills.go at HEAD (the inSharedDir guard back) with the
  new test: TestRemoveFoundSkillWithoutBackup red, the shared entry in the
  backups. skill-remove-nobackup.test.cjs at an origin/main 5754fea43
  copy: all 20 subtests red in chromium and webkit (Remove all said "1
  folders are moved … 2 linked from folders of your own are only
  unlinked" for one brought in).
- GUI, chromium and webkit: skill-remove-nobackup (en, zh, zh-TW, ja,
  de at 980 and 440px: shared entry ticked and unticked, its post, a
  shared link with no tick, Remove all with one brought in, with and
  without a folder of magpie's, nothing sideways), found-skill-pick-
  remove, library-bar-more, library-found-hooks, library-hooks,
  library-pick-remove, library-servers-bulk, remove-all-skills,
  remove-found-server, remove-found-skill, shared-skills, skill-put-back,
  i18n-en-no-cjk, i18n-keys: 176 pass, 12 red. Red: found-skill-pick-
  remove at 420px (#5013) and library-bar-more in chromium (#7326), both
  red at the origin/main 5754fea43 copy too.
- go test ./internal/library ./internal/tui ./internal/cli ./internal/gui
  -timeout 45m: library, tui, cli ok. gui: TestBuiltinsTranslated (#7257)
  and TestSettingsSaveKeepsWhatItDoesNotSend (#7240) red, both open and
  about other pages. GOOS=linux go vet -tags nogui and GOOS=windows go vet
  of library and gui: ok.
- gofmt -l internal/: nothing.

Not run: the full go test ./... and the whole GUI suite. Not tried in the
real app, nor on Windows or Linux; deleting goes through the same
os.RemoveAll as a folder in an agent's own skills folder. Not changed:
Put back still has no Remove; a skill brought in goes back to the agents,
where it can be removed (now with the tick).
2026-11-20 17:35:32 +08:00
yetone 5754fea435 gateway: a saved Claude account's run in the caller's folder starts with it trusted in that account's file (@ahz2ygnhjmIJ0E0 on X)
The reporter's own ~/.claude.json trusts the folders they work in, while
magpie's saved accounts' .claude.json files had them only here and there.
A run of an account without the entry was asked about the caller's folder
in the interactive mode, and 2.1.329's question went unread (70a881071),
so each account in turn waited out 45s. claude -p asks nothing, which is
why claudePrintMode answered 200.

Before an interactive run of a saved account in the caller's folder,
trustCaller now records the folder in that account's .claude.json, under
the keys Claude Code looks it up by (claudeTrustKeys: the path and its
resolved one, /private/tmp/... on a Mac), through the same
provider.ClaudeTrustFolder that trusts magpie's own folder (#4830). Every
caller's folder is recorded, not only those the user's own file trusts:
the shim answers yes for a saved account all the same (TrustEnv), and
Claude Code then writes just this entry, so the file ends as it would,
without the question. The signed-in account's own ~/.claude.json is
never written (configDir ""), and its untrusted folders still go to
magpie's folder (startTrusted).

Run:
- mote: go test -tags nogui -count=1 -run 'TestClaudeBridgeTrusts|TestClaudeTrust|TestClaudeOneOff|TestClaudeTUI' ./internal/gateway ok (67s).
- Broken by hand: with claude_subscription.go from 70a881071,
  TestClaudeBridgeTrustsCallersFolderForSavedAccount fails ("the run
  started with [/elsewhere] trusted, want the caller's ..."); green with
  the change.
- Real Claude Code 2.1.329 on mote, sandbox HOME and CLAUDE_CONFIG_DIR,
  the account file holding the folder under /tmp/... and /private/tmp/...
  as trustCaller writes it, and MAGPIE_CLAUDE_TUI_TRUST not set: the
  helper wrote init and the message was sent (authentication_failed,
  no sign-in in the sandbox); nothing asked about trust.
- mote: go vet (darwin, GOOS=windows, GOOS=linux) of internal/gateway and
  internal/provider clean; gofmt clean.

Not tried: a signed-in saved account sending a real message; Windows and
WSL runs (WSL runs never use the caller's folder, binary.wsl).
2026-11-20 16:42:52 +08:00
yetone fafa1978c5 provider: Factory's mover min is 0.1.55, Claude Code's turn after /compact on the chat route is adapted block by block
@dannykkg on X (11-20): through magpie, Factory refused Claude Code again
after a compaction. On /api/llm/o models magpie's chat route joins a user
turn's text blocks with nothing between them, so the first turn after
/compact reached the plugin as one text that opened with the summary
header, and the restored-file reminders glued after it went to Factory as
written ("Called the Read tool with the following input:"). 0.1.55
(magpie-community/plugins ed868e79) splits such a text back into its
blocks at the places only joining makes and adapts each as on the
Messages route. Their other point, Factory refusing a list of declared
tool names since 11-17, was fixed in 0.1.50/0.1.51. keepMovedCurrent
brings every moved user to 0.1.55.

npm view --prefer-online --registry https://registry.npmjs.org
@magpie-community/opencode-factory-auth: 0.1.55 (publish.yml run
44702288715; red only for the known middleware-system-prompt/think-tags
trusted-publisher E404s).
Run: mica-run go test -count=1 -run 'Mover|Move|Migrat|Factory|Plugin'
./internal/provider: ok. gofmt -l internal/provider: clean.
Not tried: a real Factory account (none here, on mote, mica or
xiaomi-gpu), so the fix is inferred, not seen to pass Factory.
2026-11-20 16:37:56 +08:00
yetone 555a82e8cc openmausbot: its engine's calls are counted as OpenMausBot's, not Claude Code's (@huangfuyafei on X)
huangfuyafei on X: in Usage → Requests, OpenBot's calls show OpenBot, but
OpenMausBot's show Claude Code. OpenMausBot (milind-soni/OpenMausBot,
read at 9f67fa5) runs the real Claude Code CLI as its engine.
server/drivers/claude.ts's claudeEnvironment deletes
CLAUDE_CODE_ENTRYPOINT and adds no header of its own, so a request
carries Claude Code's User-Agent and nothing else. magpie wrote the
"magpie" engine in ~/.openmausbot/config.json with the gateway's plain
token (keyAt), so the gateway's agentOf fell through to the User-Agent
and named Claude Code. OpenBot is told apart by its /agent/openbot path.

- internal/agent/openmausbot.go: the engine's ANTHROPIC_AUTH_TOKEN and
  ANTHROPIC_API_KEY are agentKeyAt("openmausbot", gw), the key naming
  OpenMausBot (as desktopKey does for Claude Desktop). An engine written
  before gets the key at the next sync (ombMerged makes the routing keys
  magpie's); OpenMausBot reads the file when it starts.
- internal/gateway: claudeCodeInside is Claude Code's User-Agent under
  another agent's path or key (Claude Desktop apart). claudeTierStandIn
  and observedKind (claudeCodeAs) treat such a call as Claude Code's, so
  the haiku/sonnet/opus tier stand-in and the auxiliary marking of
  tool-less helper calls still apply inside OpenMausBot. Real Claude Code
  on the plain token or magpie-claude is unchanged.
- docs/subsystems/agent-wiring.md, gateway-routing.md say so.

Run (mote, through mote-run; mote at load 21-137 on 18 cores, mica at
92-108 on 12 with another session's full suite, so mote as the lesser):
- go test -count=1 -timeout 45m ./internal/gateway ./internal/agent
  ./internal/usage at the pre-rebase head 3c9d79d28+change: agent ok,
  usage ok; gateway FAIL on three known reds, none in this change's code:
  TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes (#7117; 3 of 3 red on
  a clean origin/main 6bb90df8e too), TestSearchQueueKeepsCodexAlive/
  progress at load 137 (#7090, pings=3 complete=false; 3 of 3 green on
  main and head after), and the doneHold fake's close-of-closed-channel
  panic (#6505, #6690).
- At the rebased head (on 6bb90df8e): -count=3 of TestClaudeCodeInsideAnApp,
  TestClaudeTier*, TestStandIn*, TestAgentInPath and the two reds above:
  all ok but #7117; -run 'OMB|OpenMausBot|Omb' ./internal/agent ok;
  GOOS=linux and GOOS=windows go vet of both packages ok; gofmt -l clean.
- Broken by hand: on the old openmausbot.go/gateway.go/observe.go,
  TestOpenMausBotEngine and TestOpenMausBotKeepsTheUsers fail (token
  "magpie") and TestClaudeCodeInsideAnApp fails (404 for
  claude-haiku-4-5-20251001: no tier stand-in under the OpenMausBot key).

Not tried:
- a real OpenMausBot run against the gateway (the key and the agentOf
  path are tested; the app was read, not run);
- OpenMausBot's own "claude" engine, inheriting ~/.claude/settings.json
  pointed at magpie: it sends the plain token with Claude Code's
  User-Agent and is still counted as Claude Code;
- the classifier stand-in (automode.go) stays keyed on agent=="claude":
  it follows the user's ~/.claude /model, not OpenMausBot's Claude home;
- the observedKind assertion calls claudeCodeAs directly, not through
  observeRequest;
- a key change alone doesn't offer Restart (ombPart leaves the key out);
  a running OpenMausBot needs a restart to send the new key.
- No GUI change: OpenMausBot's name and icon already exist.
2026-11-20 16:36:26 +08:00
yetone 6bb90df8e9 gateway, gui: an added provider's embedding and rerank models are listed (@rfiacne on X)
@rfiacne asked why an added provider's embedding models aren't
recognised. Routing them already worked: /v1/embeddings and /v1/rerank
took a bare id, provider/id or a slashed id from the provider's fetched
list. But they were nowhere a user looks. GET /v1/models answered
?kind=embedding with 400 and never listed them, and the provider editor
showed only a count, and only when the provider had no chat model.

- /v1/models?kind= takes embedding and rerank (all includes them). Each
  row is provider/model with "kind", owned_by, magpie_label and
  supported_endpoint_types embeddings or jina-rerank, the names Cherry
  Studio's new-api provider reads (listModels.ts ENDPOINT_TYPE_ALIASES).
  Disabled models and those a held key can't reach are left out. The
  default list stays chat models (TestKindGroupsServeEachAPIByRoute).
  Cherry Studio, listed every kind already, gets them too for its
  knowledge bases; ?format=text stays chat. A remote magpie asks by
  headers, not ?kind=, so its list is unchanged.
- gateway.RetrievalModels: the fetched list's Serves models and the
  preset's, each id once, shared by the list and the GUI.
- The provider editor lists Embedding models and Rerank models as read
  only chips (embedIds/rerankIds, retrievalRows), in every language.
  The script budgets rise by 354 for it: the editor draws it, so there
  is no page to move it to.
- docs: integrating.md, the site's integrate page (en, zh), and
  providers-accounts.md; site/node docs-index.mjs rebuilt llms-full.txt
  and search/*.json for them.

Run on mote (load ~20-28 of 18 cores; mica was at 40 of 12), at
6ce8f232c, rebased on origin/main 6635dec7c:
- go test -tags nogui -run 'TestAddedProvidersRetrievalModelsListed|
  TestRetrievalModelsOnce|TestKindGroupsServeEachAPIByRoute|Kind|Cherry|
  Models' ./internal/gateway: ok. TestAddedProvidersRetrievalModelsListed
  is red on the old gateway.go (?kind=embedding,rerank: 400).
- go test -tags nogui -run 'Budget|Provider' ./internal/gui: ok (before
  the rebase; the budget was re-measured after it, at exactly the new
  numbers).
- node --test provider-retrieval-rows and provider-retrieval-only, both
  engines, 5 languages, 900 and 420 px: 46 pass. provider-retrieval-rows
  is red on the old app.js (no rows).
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui ./...:
  ok.
- After the rebase on origin/main 3c9d79d28 and again on 70a881071: the tests above plus
  TestCoreScriptBudget, TestTogetherLiveList and
  TestModelsListMediaOnlyWhenAsked in gateway, gui and provider: ok
  (testenv's docs-index check passes after the rebuild).
- The full go test -tags nogui -timeout 45m ./... was stopped before it
  ended, not run to the end (owner: never hold a verified fix behind a
  full suite).
Not tried: a real provider's live list in the app; the whole GUI suite
(1636 files); OpenRouter, whose embedding models are on a separate
/api/v1/embeddings/models list that magpie doesn't fetch.
2026-11-20 16:12:11 +08:00
yetone f203b10726 catalog: Together AI's model list is read, its embedding and rerank models by their type (@rfiacne on X)
@rfiacne asked why the embedding models of a provider they added aren't
recognised. Together AI's GET /v1/models answers a bare JSON array
(together-python's models.list reads the answer as a list), and magpie
read only {"data": [...]} or {"models": [...]}, so the whole list failed
with "not a model list": no chat model and no embedding model was ever
fetched from it. Its embedding and rerank ids often don't say what they
are (togethercomputer/m2-bert-80M-32k-retrieval, Salesforce/Llama-Rank-V1),
but each row's "type" does (together-python's ModelType: chat, language,
code, image, embedding, moderation, rerank, audio, transcribe, video).

- a list that is the array alone is read as the rows;
- a row whose "type" is "embedding" or "rerank" ("reranking", as
  Vercel's says) is that API's model, from any list;
- at api.together.xyz alone, the rest of its types: image and video
  models go with those, audio to speech, transcribe to transcriptions,
  moderation is dropped.

Run on mote (load ~23 of 18 cores; mica was at 80 of 12):
- go test -tags nogui -run 'TestTogetherLiveList|TestVercelLiveList'
  ./internal/provider: ok. TestTogetherLiveList is red on the old
  live.go ("not a model list").
The full suite runs with the next commit, which builds on this one.
2026-11-20 16:11:39 +08:00
yetone 70a8810718 claudetui: Claude Code 2.1.329's trust question is answered, and one left unanswered is no account's fault (@ahz2ygnhjmIJ0E0 on X)
The reporter (macOS arm64, magpie 0.1.4573/0.1.4586, Claude Code
2.1.329): the interactive mode showed the folder trust question, sat on
it for 45s, and magpie tried every account in turn before a 502.

Cause: 228da69ef (v0.1.4554) recognised a dialog by its heading's words
above its No and Yes rows. Real Claude Code (2.1.327 and 2.1.329) heads
the trust question "Quick safety check: Is this a project you created
or one you trust?", draws "❯ No, exit" first, and has "trust this
folder" only in the Yes row under it. optionDialog never saw the
question, so the helper neither answered it (TrustEnv=1) nor ended at
once for a folder only the user answers for (startTrusted's fallback):
every run waited out ReadyWait. The test fake had a made-up "Do you
trust this folder?" heading and drew itself again once listening, which
real Claude Code doesn't, so the tests passed.

- optionDialog: the dialog is its No and yes rows at the foot of the
  screen, with the question's words in or after the rows, or at most
  dialogBody before them. History holding the words with a prompt box
  under them is still none (TestShimIgnoresDialogWordsInHistory).
- fakeTrust draws a real 2.1.329 run's bytes (testdata/trust-2.1.329.bin,
  captured in a sandbox CLAUDE_CONFIG_DIR, folder
  /private/tmp/magpie-trust-fixture) and draws nothing again until a key.
- A helper that ended on a question it couldn't get answered
  (claudetui.Unanswered, ", not answered in ") is a tuiRefusal: a 400
  no account rests for, not asked of the next account. It was a 502
  that each account waited out in turn.

Run:
- Real Claude Code 2.1.329 on mote, sandbox HOME and CLAUDE_CONFIG_DIR
  (onboarding done, not signed in), magpie claude-tui-helper with
  MAGPIE_CLAUDE_TUI_TRUST=1 in a new folder: on origin/main eb1da1572
  it ends after 47s "asked whether to trust /tmp/..., not answered in
  45s" with the reporter's screen; with this change it answers yes,
  .claude.json records hasTrustDialogAccepted for the folder, the prompt
  shows and the message is sent (answered authentication_failed, the
  sandbox has no sign-in).
- Red on the old tui.go / claude_subscription.go, green now:
  TestTrustQuestionOf2_1_329 (real bytes), TestShimTrustsWhenTold
  (0 of 3 lines in 30s), TestClaudeTUIUnansweredQuestionIsNoAccountsFault
  (502).
- mote-run: go test ./internal/claudetui ok (192s); go test -run Claude
  ./internal/gateway ok (102s); GOOS=windows and GOOS=linux go vet of
  both packages clean; gofmt -l clean.
- win-run (xiaomi-gpu): the trust, never-prints and deadline tests of
  ./internal/claudetui ok.

Not run: the full suite (run after the push), a real signed-in account's
turn through the gateway, Claude Code in WSL or on Linux.
2026-11-20 16:08:30 +08:00
yetone 3c9d79d282 gateway: a key can set how the routing groups it asks for route (justforlxz on X)
justforlxz asked on X for a routing strategy among a gateway key's
options. A key now has Routing: unset follows each group's own (the
default), "smart" is the default Quota first, or any built-in routing
(order, drain, rotate, usage, pace, weight, free, fast, cheap, expiring,
fit) or a plugin's <plugin>/<name>. Manual is refused, and a Manual group
still goes to its pick. A provider or nested group with its own routing
keeps it (#576), as under the group's own.

- access: Key.Routing, Identity.Routing, the routing-key action
  (CleanRouting). An issued key that sets none follows its issuer's.
- provider: GroupRouting is the list of routings a group takes. SaveGroup
  and CleanRouting both use it.
- gateway: keyRouted is applied wherever a request's group is resolved:
  handle (Chat, Messages, Responses, and the masked-route move),
  embeddings/rerank, draw, video, a System One decision group and relayed
  search. count_tokens plans no group. planned carries the routing the plan
  was made by, so leastHeld weighs members the same way and the trace's
  group shows it.
- CLI: magpie gateway-key routing <id> [follow|smart|...].
- GUI: a "Group routing" badge on the key row, hidden until hover like
  the tier and masking badges, opens the app's menu (openProtoMenu). The
  routings the rotation plugin serves are left out when it is off. zh,
  zh-TW, ja and de strings are included.
- docs/subsystems/gateway-routing.md: the paragraph after ServiceTier.

Run (at cf5840a37 rebased on eb1da1572):
- gofmt -l: clean. On mote: go vet ./..., GOOS=linux go vet -tags nogui
  ./..., GOOS=windows go vet ./..., and go build for darwin, linux
  (nogui) and windows: all ok.
- On mote, go test -count=1 -timeout 45m for internal/access, cli,
  provider, gui and gateway: access, cli and provider ok. internal/gui
  red only on TestBuiltinsTranslated (#7257) and
  TestSettingsSaveKeepsWhatItDoesNotSend (#7240), both red on main.
  internal/gateway red only on TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes
  (#7117, red on main). A doneHold "close of closed channel" panic was
  logged by the HTTP server (#6690).
- On mica, the GUI files gateway-key-*, gateway-keys-*,
  gateway-caller-keys, i18n-keys, i18n-en-no-cjk and key-row-chips-fit in
  Chromium and WebKit, 5 languages, 1100/420 widths: 549 of 550 pass. The
  one red is gateway-key-account-groups (rename typed as "DayDaytime"). It
  is red alone 2 of 3 on origin/main eb1da1572 too, filed as #7316.
- Red on the old code, broken by hand: TestKeyGroupRouting fails on Chat,
  Messages and Responses with keyRouted made a no-op (the Free first key
  goes to the paid member first). TestKeyRouting,
  TestGatewayKeyRoutingCLI and gateway-key-routing.test.cjs don't build or
  find their field, action or badge on the old code.
- TestKeyGroupRouting's Manual case stays green with keyRouted's Manual
  guard removed, because a Manual group is sent to its pick before
  routing. The guard is held by TestKeyRoutedCases.

- Rebased on 6635dec7c (it changes i18n.js and the core budget). At this
  head on mote: internal/gui -run Budget|I18n|Strings|Keys ok, the
  access/cli Routing tests ok, and gateway-key-routing, gateway-key-tier,
  i18n-keys and i18n-en-no-cjk in both engines: 48 of 48 pass.

Not run or tried: the full go test ./... and the whole GUI suite (both
mote and mica were running other sessions' GUI suites, at load 27/18 and
70/12). Windows and Linux test runs. A real gateway with a real key and
real accounts.
2026-11-20 16:01:53 +08:00
yetone 6635dec7cd agents: Show settings file in an agent row's menu (InkCoalW on X)
InkCoalW asked on X for agent config files (settings.json, config.yaml
and the like) to be managed as CC Switch does it. magpie already sets
what is managed in those files: providers, models, effort, MCP servers,
skills, hooks and the agent's own options. So the rest of the file gets
an entry point, not an editor. An agent row's menu has "Show settings
file", which shows the file magpie writes (agent.Path) in the file
manager. A file not written yet shows its folder. An in-app raw editor
would race magpie's own writes and the agent's live sessions, so there is
none.

POST /api/agents/reveal takes only the agent's id and looks the path up
in agent.Detected(). A path or an unknown id shows nothing. The page
served to a browser (magpie web) is refused, and the item isn't drawn
there or in the tray panel.

app.js and the core scripts' budgets are raised by 182: one item, packed
to the shortest form. openAgentMenu draws every agent's menu, so there is
no page to move it to. The route is named in the CLI parity list as the
window's own.

Run, on mote via mote-run, at this head rebased on eb1da1572:
- go test -tags nogui -run 'TestAgentReveal|TestAgentOpen|TestCoreScriptBudget|TestEveryRouteIsNamedForTheCLI' ./internal/gui: ok
- the internal/gui package in full: the only reds are TestBuiltinsTranslated
  (#7257) and TestSettingsSaveKeepsWhatItDoesNotSend (#7240), which fail
  the same on a fresh origin/main eb1da1572 copy.
- go vet with GOOS=darwin, linux and windows on ./internal/gui: ok.
  gofmt: empty.
- agent-open-terminal.test.cjs: 24/24 in Chromium and WebKit, in five
  languages, at 980 and 420 wide. On the old app.js it is 20 of 24 red.
- i18n-keys: ok.

Broken by hand:
- the route at the old sessions.go: TestAgentRevealShowsOnlyItsFile red
- the isWeb check removed: red ("the browser's page showed a file: 204")

Not tried: a real Finder, Explorer or Linux file-manager reveal, and
Windows or Linux runs.
2026-11-20 15:53:23 +08:00
yetone aebc65c18e library: the hooks an agent runs that magpie didn't give it are listed, brought in and removed (InkCoalW on X)
InkCoalW asked on X for magpie to read and manage the hooks an agent
already uses (~/.claude/settings.json, Codex's hooks.json and the like),
covering both managing and cleaning them up. The Library's Hooks tab now
lists them under "In your agents", the way found skills and servers are:
each one shows its event and matcher, its command, its agent and its file.

- Bring in (hooks/import) makes it a library hook, or joins a library
  hook with the same event, matcher, command and timeout, and records the
  entry in the file as magpie's. The file is left byte for byte as it was.
- An entry the library can't keep as written has Bring in greyed out and
  a title that says why: several commands, a prompt or other non-command
  handler, or a shape such as async. It can still be removed.
- Remove (hooks/remove-found) asks first. It copies the file to magpie's
  backups, then takes out only that entry through the same hookWrite path
  magpie's own hooks use: Codex's trust keys are re-keyed, Grok's TOML
  block is cut, and the rest of the file, its comments included, stays.
- A key gone stale since the list was drawn is refused. One of two
  identical entries removes only one.
- RTK's own hooks belong to the RTK tab and aren't listed.

The page sends only a key the server derived. The file paths join
revealable() so the row's path link opens.

Run, on mote via mote-run, at this head rebased on eb1da1572:
- go test -tags nogui -run 'TestFoundHooks|TestHooks' ./internal/library: ok
- go test -tags nogui -timeout 45m ./internal/library ./internal/gui:
  library ok. gui has three reds:
  - TestEveryRouteIsNamedForTheCLI is the next commit's route, fixed there.
  - TestBuiltinsTranslated (#7257) and TestSettingsSaveKeepsWhatItDoesNotSend
    (#7240) fail the same on a fresh origin/main eb1da1572 copy.
- go vet with GOOS=darwin, linux and windows on ./internal/library and
  ./internal/gui: ok. gofmt -l: empty.
- GUI: library-found-hooks.test.cjs is 12/12 in Chromium and WebKit, in
  en, zh, zh-TW, ja and de, at 440px. Also run: library-hooks,
  library-rtk-nohook, project-hooks, found-fold, found-skill-pick-remove,
  library-all, library-loading, plugin-github-hooks, i18n-keys,
  i18n-en-no-cjk, gui-de, gui-ja, gui-zh-tw, with agent-open-terminal and
  agent-menu-label: 171 of 183 pass. The 12 reds fail the same on a fresh
  origin/main eb1da1572 copy:
  - gui-ja "{agents}" twice (#7144)
  - found-skill-pick-remove (#5013)
  - agent-menu-label in the WebKit panel (#6371)

Broken by hand, each one red:
- no backup: TestFoundHooksRemoved
- no Codex re-key: TestFoundHooksRemoved
- applied records not claimed: Listed and BroughtIn
- no RTK owner: Listed
- no shape check: Listed
- the old client.js: the GUI test is 0/12
- RTK filter removed: the GUI test is 0/12

Not tried: real agents' files outside a sandbox HOME, Windows and Linux
GUI runs, the whole GUI suite (both test machines were running other
sessions' GUI suites).
2026-11-20 15:53:22 +08:00
yetone eb1da15722 gateway: a vendor's error reaches the agent in its own words first (@gptchan404)
@gptchan404 on X: magpie wrapped a vendor's error in its own words, e.g.
Factory's refusal arrived as "claude-opus-5-5 refused this request
(safety filter: content_policy_rejected — <Factory's words>) via
Factory", so there was no error of the vendor's own to take back to it.

Now the message the agent reads starts with the vendor:

  Factory: This request was blocked by Factory's usage policy check.
  (upstream request id …, code content_policy_rejected) (HTTP 400)
  magpie: claude-opus-5-5 refused this request (safety filter:
  content_policy_rejected) via Factory — <the plugin's advice>

Line 1 is the provider's name, the vendor's words verbatim
(provider.VendorWords), then (HTTP status, code, request id), each
left out when the words already hold it. magpie's own notes go on a
second line that starts "magpie: ". A plugin's advice after " — " goes
on magpie's line (pluginWords). The vendor's JSON error fields
(type/code/param/request_id) still pass through as before
(writeVendorErrorFrom).

Covered: Anthropic messages, OpenAI chat, Responses and Gemini, each
whole and streamed, for any vendor error (writeVendorErrorFrom ->
upstreamTold) and for a safety-filter refusal no one else answered
(failTo -> refusalTold).

Only the client sees the new text. A try's held bytes and call.Error
keep magpie's reading, because the rest scope, the rate hold, the
retired model, the verify hold and failover all classify them. The
holdWriter retells them on output only (retold, in release and in
passing writes). codex_backend's summaryEndedShort now reads the
vendor line only.

Tests whose pinned text changed on purpose: kept_error_test,
zcode_blocked_test, verify_test (sameVerify: a held verify answer is
magpie's own and keeps its one-line form),
remote_magpie_restricted_test. Doc: docs/subsystems/gateway-routing.md.

Run (mote, at this tree):
- go test ./internal/gateway -run
  'Told|Refus|Factory|Kept|Relay|Verify|Codex|Plugin|Retired|Rate|Zcode|ZCode|Restricted':
  ok (346s).
- Red on old code: TestRefusalToldWithTheVendorsWordsFirst and
  TestVendorErrorToldWithItsOwnWordsFirst, 32 of 32 subtests red at
  origin/main 76868bad6. TestPluginAdviceToldOnMagpiesLine red with
  pluginWords broken by hand.
- Earlier gateway run: only TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes
  red, also red on clean origin/main (#7117).
- gofmt -l clean. GOOS=windows go vet ./... ok. GOOS=linux go vet of
  ./internal/gateway and ./internal/provider ok (a cross ./... vet stops
  in Wails' cgo files).
- Full suite: queued on mote at this tree, pushed before it finishes
  per the owner's rule (10-22); any red gets an issue.

Not tried: a real Factory account (the case comes from the plugin's
own message format, packages/factory index.mjs); the GUI request view
shows the client's body, so it shows this text, and has no separate
vendor-raw view; a remote magpie chained in front of another would
show the inner magpie's first line inside the outer's.
2026-11-20 15:28:24 +08:00
yetone 76868bad61 provider: Factory's mover min is 0.1.54, dsh's Web GUI sentence and skill catalog go as Factory takes them
@a1pha1nthefog (X, 11-20): dsh on factory/claude-opus-5-5 was still
content_policy_rejected before any output on factory 0.1.53. 0.1.54
(magpie-community/plugins 9daf7114) sends dsh's Web GUI sentence "The
browser provides no implicit DOM, route, or screenshot context." with
"gives", the rewording Antigravity took for the same dsh fingerprint, and
"harness" in dsh's skill catalog as "runtime", as 0.1.52 does in its prompt
and tool descriptions. A refusal on a new session's first turn now says to
turn skills, MCP servers and plugins off and on a few at a time to find it.
keepMovedCurrent brings every moved user to it.

npm view --prefer-online @magpie-community/opencode-factory-auth@0.1.54:
0.1.54 (publish.yml run 44691148143; red only for the known
middleware-system-prompt/think-tags trusted-publisher E404s).
Run: mica-run go test -count=1 -run 'Mover|Move|Migrat|Factory|Plugin'
./internal/provider: ok. gofmt -l internal/provider: clean.
Not tried: a real Factory account (none here, on mote, mica or
xiaomi-gpu), so the fix is inferred, not seen to pass Factory.
2026-11-20 15:06:43 +08:00
yetone 6a0afc38a9 library: a skill can be removed with no copy kept in the backups (Eternalfate__ on X)
Removing a skill always moved its folder to ~/.magpie/backups/<time>/,
and backups that hold skills are never pruned, so they piled up. The
sheet that asks first now has one tick under what it says, "Keep a copy
in magpie's backups", ticked unless the reader unticked it last time
(localStorage magpie.libSkillBackup). Unticked, the sheet says the
folder is deleted and Remove posts noBackup: true. The default is
unchanged.

What is deleted is only magpie's own folder for the skill, or an
agent's own skill folder. Never deleted, either way:
- a folder a library skill links to (~/.agents/skills or anywhere
  else): only the link goes, and there's no tick on its sheet;
- an entry in ~/.agents/skills, which other tools read too: it still
  goes to the backups (inSharedDir), and the sheet has no tick for it;
- a skill brought in from the agents: it still goes back to them;
- a link inside a skill's folder: RemoveAll takes the link, not its
  target.

Every path that removes skills:
- GUI: one skill, Remove all / Remove n, Remove gone, an agent's own
  skill and several of them (skills/remove, remove-all, remove-gone,
  remove-found, remove-found-some take noBackup);
- CLI: magpie library skill rm <name> --no-backup, and --no-backup on
  rm --all and rm --gone, whose prompt says so;
- TUI: d asks, then D deletes with no backup (d d still keeps a copy);
  the first d's flash says so, on rows with a folder to delete.
library: RemoveSkillsHow, RemoveFoundSkillsHow, RemoveGoneSkillsHow
(keep bool); RemoveSkill(s) and RemoveFoundSkill(s) keep a copy as
before.

The sheets with the tick say they hold nothing to lose (modal.dirty
false): toggling it made Cancel ask to discard changes. A page reload
with such a sheet open still reads the form as changed (beforeunload
reads the core's modalFormDirty); not changed here.

Existing backups stay where they are, in ~/.magpie/backups/<time>/skills
and <time>/<agent>/skills. Nothing clears them; the Library's Backups
button opens the folder. docs/subsystems/library.md says so.

Run (mote, this tree at base 9494a38b4; rebased onto 848e3b1b2, whose two
commits since touch only internal/gateway):
- new tests: TestRemoveSkillWithoutBackup, TestRemoveFoundSkillWithout-
  Backup (library), TestLibrarySkillRmNoBackup (cli),
  TestLibraryDeleteWithoutBackup (tui): ok.
- broken by hand: with keep forced true in RemoveSkillsHow and
  RemoveFoundSkillsHow, all four are red (folders found in the backups);
  with the inSharedDir guard taken out, TestRemoveFoundSkillWithoutBackup
  is red (the shared entry deleted, not backed up).
- go test ./internal/library ./internal/cli ./internal/tui ./internal/gui
  -timeout 45m: library, cli, tui ok. gui: TestBuiltinsTranslated (#7257)
  and TestSettingsSaveKeepsWhatItDoesNotSend (#7240) red, the same at
  origin/main 9494a38b4 without this change.
- gofmt -l: nothing. GOOS=linux go vet -tags nogui and GOOS=windows go
  vet of those four packages: ok.
- GUI, chromium and webkit: skill-remove-nobackup (new: en, zh, zh-TW, ja,
  de at 980 and 440px; tick, its text, the choice remembered, the post,
  no tick for linked or shared skills, nothing sideways), i18n-keys,
  i18n-en-no-cjk and the 27 files that remove skills or read these
  sheets' lines. Red: the new file's Cancel (the dirty-form ask above,
  fixed and green after), and api-key-theme (#6444),
  found-skill-pick-remove at 420px (#5013), saved-signedout-remove
  (#6666): those 18 the same at origin/main 9494a38b4.

Not run: the full go test ./... and the whole GUI suite. mote and mica
were both taken by other sessions' full suites for over an hour. No
guard test outside the packages run reads the files changed (grep for
docs/subsystems/library.md and plugins/library). Not tried in the real
app or on Windows or Linux; a Windows junction to a skill folder goes
through the same linked() branch as on macOS.
2026-11-20 14:59:04 +08:00
yetone 848e3b1b26 gateway: a Claude Code run on an account asks Anthropic's own models, never magpie's routing names
@ahz2ygnhjmIJ0E0 on X (v0.1.4573): the Claude warm-up sent
claude/claude-haiku-5-5 and group/opus-5-5[1m] to Anthropic, which
answered "There's an issue with the selected model", so the 5-hour
window never opened.

Cause: the warm-up runs `claude -p --model haiku --setting-sources ""`.
--setting-sources keeps settings.json's env out, but Claude Code 2.1.327
still takes the tier variables (ANTHROPIC_DEFAULT_HAIKU_MODEL, ...) from
its own environment, which cleanClaudeEnv passed on from magpie's, and
from ~/.claude.json's legacy env, read whatever --setting-sources says.
Where they hold magpie's routing names, haiku resolved to
claude/claude-haiku-5-5 and opus to group/opus-5-5 (the [1m] cut off).

Fix, for every Claude Code run on an account (warm-up, Warm up now, the
model test, /usage, the bridge's turns, -p and interactive): each run's
--settings sets every model variable (ANTHROPIC_MODEL, each tier's model
and its _NAME/_DESCRIPTION/_SUPPORTED_CAPABILITIES, the small fast,
subagent and auto mode models) to "", which outranks both the
environment and ~/.claude.json, and an empty one is Claude Code's own
default; cleanClaudeEnv no longer passes them on either. An id given
with --model (claude-opus-5-5[1m]) is sent as given. There is no
warm-up model setting: the warm-up asks the haiku alias, so no picker
to limit. Codex's warm-up already asks the account's own catalog id.

Run:
- TestClaudeRunsAskAnthropicsOwnModels (new; the reporter's literal
  names in magpie's env) red on 9494a38b4 for the warm-up, model test,
  /usage, the bridge's args and its env; green after (mica-run, mote-run).
- go test ./internal/gateway -run 'TestClaudeRunsAskAnthropicsOwnModels|
  TestWarmClaude|TestClaudeUsage|TestClaudeCLI|TestAskClaude|
  TestCleanClaudeEnv|TestClaudeTest|Claude.*Settings|TestClaudeBridge'
  ok on mote; gofmt clean. The same run again after rebasing onto
  eae77a48a (this commit's parent): ok on mica.
- Real Claude Code 2.1.327, sandbox HOME, against a local fake
  Messages server logging the model, with ANTHROPIC_DEFAULT_HAIKU_MODEL
  and ANTHROPIC_MODEL set to the reporter's names in the env and
  ~/.claude.json: old --settings sent claude/claude-haiku-5-5 (haiku) and
  group/opus-5-5 (opus); new sends claude-haiku-5-5 and claude-opus-5-5;
  claude-opus-5-5[1m] went as claude-opus-5-5 both ways. Process env
  alone and ~/.claude.json alone each leaked on the old settings.

Not tried: a warm-up against Anthropic on a real account; the
interactive mode's run with a real account; Windows/WSL Claude Code.
The full suite (go test -timeout 45m ./..., Linux/Windows vet of
internal/gateway) was started on mote at the tree before the rebase and is not in this
record.
2026-11-20 14:29:12 +08:00
yetone eae77a48a0 gateway: a reading that finds a vendor-timed quota rest's window renewed has the vendor asked once
RookieRicardoR on X: a GLM Coding Plan key ran out, they used a reset
card (重置卡) on Zhipu's side, and magpie kept answering "limit reached"
without asking Zhipu. Zhipu's 1308/1310 names the reset time, so the key
rests by "resets" till it and timedHeld answers every request locally.
Since #2718 a reading that finds the window less than full (renewed)
doesn't lift a rest the vendor timed, only a window truly started again
(restarted) does, because a vendor's usage can read low while its
refusal stands. A reset bought on the vendor's side moves neither, so it
was never noticed before the named time.

Now liftRests, on renewal, lets such a hold go once for its named time
(askOnRenewalLocked: askAt = now, the rest itself kept, recorded in
restingUntil.renewAsked). The next request asks the vendor: an answer
clears the rest as any answer does; refused again with the same time,
it is held till then whatever later readings say, so #2718's repeated
refusals don't come back. This applies to every provider whose windows
magpie reads (Zhipu/Z.ai plan quota, sub2api balance URLs, subscriptions)
and to quota and credit rests, not rate rests. Where no windows are
read, the rest line's "Try now" (Unrest) already asks at once.

The same tweet said the same prompt from Pi got Claude Code's earlier
DeepSeek reply word for word. magpie keeps no reply to give a later
request (classify caches routing verdicts, vision_cache image
descriptions, prev_response rebuilds input; held answers are errors
only), and magpie sets no temperature or seed for DeepSeek.
TestSameRequestIsAskedEveryTime now holds that: the same bytes from
Claude Code's and an OpenAI client's protocol, twice each, reach the
vendor four times and get its four answers.

Run (mote, at this commit on origin/main 9494a38b4):
- go test ./internal/gateway/ ./internal/provider/ -count=1 -timeout 45m:
  provider ok (150s); gateway FAIL (987s) on one test only,
  TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes, red the same alone at
  origin/main 9494a38b4 (3 of 3) and filed as #7117. The log also has
  doneHold's "close of closed channel" panic, filed as #6690.
- go test ./internal/gateway/ -run 'TestSameRequestIsAskedEveryTime|
  TestRenewalAsksAVendorTimedRestOnce' -count=2: ok
- go test ./internal/gateway/ -run 'TestRenewalAsksAVendorTimedRestOnce|
  TestReadingKeepsARefusalsRest|TestAutoVisionKeepsOffARefusedAccount|
  TestKeyBackOnceItsWindowIsNotFull|TestZhipuRestsUntilItsReset|Held|Rest': ok
- GOOS=linux and GOOS=windows go vet ./internal/gateway/ ./internal/provider/: ok
- gofmt -l: clean

Broken by hand:
- askOnRenewalLocked's call taken out: TestRenewalAsksAVendorTimedRestOnce
  red ("the window read renewed, and the key is still held").
- its once-per-time guard taken out: red ("asked again for the same named
  time").
- a reply cache keyed by path and body wrapped round Handler:
  TestSameRequestIsAskedEveryTime red ("the vendor was asked 2 times for
  4 requests").

Not tried: a real Zhipu reset card or a real GLM account; the test uses
a sub2api window and Zhipu's reset wording. Bug 2 was not reproduced with
real DeepSeek; the reporter's Requests trace would show both calls.
2026-11-20 14:19:29 +08:00
yetone 9494a38b43 providers: a model picked past the served ones joins them
onkashiko on X: 点开一个供应商新选模型的时候,之前已经选中的模型就会失效,
对于有大量模型的中转供应商来说很不方便,新选的模型难道不应该是新增进模型
列表吗.

Cause: with nothing picked, a relay on Vendor's list serves the first 24
of its models (drawn dashed), and Best in family its newest of each
family. A click on any other model set the picks to that one alone, so
the provider turned Picked only with one model and Save took away the
24 agents had been seeing. The TUI's toggle already starts from the
served set and adds to it; the GUI was the outlier.

Now a click on a model the list doesn't serve joins the served ones,
and so does an id typed by hand, by Add model or left in the box at
Save (chosenIds). A dashed one clicked with none picked is still picked
alone (#681). The Vendor's list hints, which said "Click a model to
pick just it", now say "Click a dashed one to pick just it", in zh,
zh-TW, ja and de too.

Siblings: Best in family (the same served set) and the typed id paths
are covered; Usage only serves nothing, so a click there still picks
just it.

Run:
- provider-pick-adds.test.cjs (new): the reporter's case on a 60-model
  relay, saved picks plus one more, #681's dashed pick, Add model and
  Save with a typed id, Best in family, Usage only; en/zh/zh-TW/ja/de,
  Chromium and WebKit, 1000 and 420: 20/20 on WSL (magpie-desktop).
  Red on the old app.js/i18n.js: the hint times out, and with the hint
  check removed the first save has only the 30th model, not 24 + it.
- GUI at the pushed base 64ae6e206: the 68 files that reach the
  editor's chips, plus i18n*, gui-* and click-scroll, Chromium and
  WebKit, on WSL: 1208 of 1330 pass. The files with reds were run at
  76b490576 without this change: 12 fail the same way, all filed
  (model-chip-steady #4388, model-copy-id #4621, provider-fetch-again
  #3292, models-works-only #4391, zero-priced-free #5262,
  provider-picks-stay #4397, provider-models-rest #4396,
  plugin-move-unserved #4392, provider-typed #4673, remote-magpie
  #4398, inner-scroll-contain #4689, model-find #7287 filed now). The
  rest were single WebKit reds that moved between two runs
  (model-key-tag, test-models-key-hint, media-kind, model-images-menu,
  editor-chips-wheel); the five files pass 34/34 in WebKit at this head.
- TestCoreScriptBudget and the i18n Go tests ok at this head, with no
  raise: 6d46859c4 left app.js 35 bytes of room, so draft.chosen.length
  is read as draft.chosen[0] (13 places, the same truth: ids are never
  empty) and the hint's words were cut to fit.

Not tried: a real relay account; the change is the editor's draft only,
and the save body is what the tests check.
2026-11-20 12:10:43 +08:00
yetone ac456d819f library: a plugin's tag shows only what that plugin brought (#7280)
Skills, Hooks and Subagents tag a part a Claude plugin brought "In
<plugin>", but nothing on those tabs could narrow to a plugin: typing
its name in the skills' filter found nothing (jinpwng).

- On Skills, Hooks and Subagents the tag is now a button. It shows only
  that plugin's items, under a bar naming it ("Only what code-kit
  brings") with Show all. The pick is per tab and in memory only;
  nothing is written. It clears itself once the plugin brings none of
  the tab's items. MCP keeps the plain tag.
- The skills' filter matches a skill's plugin name too.
- A clickable tag on a library row wraps under a long name instead of
  being cut off by the name's ellipsis. At 420px in zh, zh-TW, ja and
  de the tag was clipped and could not be clicked. This also covers
  "Update available".
- New string in zh, zh-TW, ja and de.

Run (mote, load ~30-45 from other sessions' suites): node --test
library-plugin-filter (new: each tab, tag to bar to Show all, the skills
filter by plugin name, no write, no dialog, no page error; en, zh,
zh-TW, ja and de at 420 and 1100, chromium and webkit), skill-where,
skill-auto-update, skill-update-edited, skill-update-feedback,
phone-no-sideways and library-plugin-parts: 210 of 210 ok. Before the
wrap rule, library-plugins, library-hooks, library-subagents(-import),
skill-groups, skill-parts and i18n-keys were run too. Only
library-plugin-filter's 420 non-English cases failed there (the clipped
tag, now fixed), plus one webkit skill-where "ResizeObserver loop" page
error that passed on the rerun.
Broken by hand: with the tag's onclick setting nothing,
library-plugin-filter is 0 of 62.
Not tried: a real Claude plugin in the app; the faked API has one.
2026-11-20 12:06:44 +08:00
yetone 57c90f9f27 library: a project's claudePlugins and pi read in another build's shapes (#7282)
A library.json whose project had "pi": {"npm:example": ["pi"]} or
"claudePlugins": {"demo@local": true}, as another build of magpie wrote
them, failed the whole library's read ("cannot unmarshal array … pi …
type string"): `magpie library project --json` exited 1, /api/library
answered 400, and no change could be made (jinpwng, v0.1.4573).

- Project.UnmarshalJSON reads claudePlugins as a list or as a map of id
  to on: true is in the list, false is left out, since magpie only turns
  a plugin on and writes nothing for one off. pi is read as source to
  "on"/"off", or to the agents it is for (some: on, none: off), or to a
  boolean.
- A read changes nothing. The first write after such a read keeps the
  file's bytes as library.json.before-reshape (reshapedCopy, never over
  an existing copy; one that can't be made stops the write), then writes
  magpie's shape.
- Any other shape still fails the read, and nothing is written over it.

Run (mote): go test ./internal/library -run
'TestProjectReadsOtherShapes|TestProjectExportApply|TestProjectPi|TestProjectClaudePlugin'
-count=1: ok; the full suite is in the push record.
Broken by hand (mica): with UnmarshalJSON renamed away,
TestProjectReadsOtherShapes is red with the reporter's own error, "json:
cannot unmarshal array into Go struct field Project.projects.pi of type
string".
Not tried: the reporter's own r11 file; a preview of the conversion
before it is written (the kept copy is the way back).
2026-11-20 12:06:44 +08:00
yetone 06db81530e library: a project's choices exported from the CLI and applied at another folder (#7278)
jinpwng asked to carry one project's Library choices, with what they
need, to a new path (a new checkout, another machine) from the CLI.

- `magpie library project export <dir> [file|-]` writes ExportProject's
  JSON (kind magpie-project, version 1): the project's skills, servers,
  subagents, hooks and plugins by agent, its Claude Code plugins, Pi
  packages, servers and skills turned off, and its instructions, plus
  need: each hook's and subagent's definition, each skill's and plugin's
  remote source; a plugin's own hooks and subagents go by their plugin.
  No ownership record (Placed, HookRecs, AgentFiles, PiRecs, ClaudeWrote,
  InstrFiles), key, sign-in or other project goes in; a server goes by
  name only, since its settings can hold a key. The file is 0600.
- `apply <file|-> <dir>` (also `import`) makes the folder a project,
  saves a hook or subagent the library here lacks from the export (for no
  agent of its own), and gives each choice through the setters the page
  uses: the agents the folder has for it kept, the export's added, so a
  second apply changes nothing and the folder's own entries stay. A Claude
  plugin or Pi package the folder has already is left as it is;
  instructions only when it has none. What this library lacks (a skill,
  server or plugin) is named with its source and exits 1; nothing is
  fetched.

Run (mote): go test ./internal/library -run 'TestProjectExportApply'
-count=1: ok; the full suite is in the push record.
Real CLI (built binary, two sandbox HOMEs with stub claude and pi on
PATH): in A, project add, hook bark and subagent checker for claude, Pi
npm:pi-demo, export; A deleted; in B (its own "echo mine" Stop hook in
.claude/settings.local.json) apply saved bark and checker and printed
"has what the export has", a second import printed the same and added
nothing; B's settings.local.json held SessionStart "echo bark" beside
"echo mine", .claude/agents/checker.md was written and .pi/settings.json
listed npm:pi-demo.
Broken by hand: with the hook save in ApplyProject skipped,
TestProjectExportApply is red.
Not tried: the reporter's own projects; a Windows path in an export.
2026-11-20 12:06:44 +08:00
yetone bbac3b5a60 library: Claude Code's own plugins list their skills, hooks and subagents (#7266)
A plugin installed with `claude plugin install` showed nowhere in the
Library's Skills, Hooks or Subagents, and a project's whole-plugin choice
(Library > Projects, Claude Code plugins) named it with nothing of what it
brings (jinpwng, v0.1.4572). ReadNative had readers for Codex and Pi only.

- claudeNative reads Claude Code's installed_plugins.json (v2): every
  record whose installPath is there, user scope as the user's, project and
  local scope with their projectPath. Enabled comes from enabledPlugins in
  the scope's own settings (settings.json, the project's
  .claude/settings.json or settings.local.json); unknown stays unknown.
- Parts come from the plugin's .claude-plugin/plugin.json and Claude's
  default places (skills/, hooks/hooks.json, .mcp.json, agents/*.md), the
  manifest's own paths added; subagents are a new part kind, read with
  the library's subagent reader, a .md with no front matter skipped.
- The GUI lists them read-only on Skills, MCP, Hooks and Subagents with
  plugin id and scope (the project's folder for a project one), and a
  project card's Claude Code plugin row says what the plugin brings.
  magpie writes nothing: Claude Code keeps loading them.
- `magpie library native` names Claude Code too.

Run (mote): go test ./internal/library -run TestNative -count=1: ok.
node --test on 115 GUI files (every library-* and project-* file, plus
builtins, nav, sidebar, phone-no-sideways, i18n-keys and the other files
that reach these tabs), chromium and webkit: 2330 tests, 2320 ok, 10 red. library-open-again is red the same way alone on origin/main 7dc85f26e (#6751); project-pi, library-bili and billion-context were red only under the full run at load ~24 and pass alone.
Real Claude Code 2.1.327 in a sandbox HOME/CLAUDE_CONFIG_DIR: marketplace
add, plugin install at user and at project scope, plugin validate ok;
ReadNative on that record listed both, with their skill, hook and
subagent. Before this change the same record listed nothing for Claude.
Broken by hand: with claudeNative out of ReadNative,
TestNativeClaudePlugins is red; with nativeSection("subagent") and the
parts line out of client.js, library-native and project-claude-plugins
are red (28 fail).
Not tried: the reporter's own plugin.
2026-11-20 12:06:44 +08:00
yetone 4edccb1858 library: an extension-only Pi package is a plugin (#7267)
Library -> Claude plugins -> Look for plugins refused a Pi package whose
package.json declares only pi.extensions ("no plugin"), so a project
couldn't be given it for Pi, while one with a skill imported (jinpwng,
v0.1.4572, Pi 1.5.2).

- readPlugin takes a folder with a Pi package.json, and its name,
  description and version fill what no plugin manifest gives.
- piPackageExtensions resolves pi.extensions as Pi does (a file, a
  folder's index.ts/index.js or each extension in it, a glob, "!" leaving
  one out, nothing outside the package). They count as parts, are kept as
  Plugin.Extensions, and are shown in the probe, the plugin's row and
  dialog, and the project card ("Pi extensions", in zh, zh-TW, ja, de).
- magpie writes nothing for an extension: a project giving the plugin to Pi
  gets the one package entry (#7243's projectPiWanted) and Pi loads it.
  The plugin's user-wide agents give Pi none of it.

Run (mote): go vet ./internal/library; go test ./internal/library
-count=1 -timeout 45m: ok (177s). node --test library-plugins,
project-plugins, i18n-keys, project-pi, library-plugin-parts (chromium
and webkit, en/zh/zh-TW/ja/de, 420 and 1100): 110 pass, 0 fail.
Real Pi: a throwaway test installed the issue's package (extension
registering a command and a no-op session_start) from a folder through
ProbePlugins/InstallPlugins, gave it to a project for Pi, and Pi 1.5.2
--mode rpc --offline --approve listed its command in get_commands.
Broken by hand: with readPlugin's extensions taken out,
TestPiExtensionOnlyPackageIsAPlugin is red (Extensions:0, then no parts to
install). i18n-keys caught "Pi extensions" in a Go error; it says
"extensions for Pi" there.
Not tried: the reporter's own package.
2026-11-20 12:06:44 +08:00
yetone 0e9af21ff3 library: a plugin from a git download keeps one name across updates (#7269)
A plugin at the top of a git or GitHub download was named after the temp
folder it was cloned into (magpie-skill-<random>), so each Update read a new
name and added a second bundle, while the project's .pi/settings.json kept
pointing at the first folder and Pi went on loading v1 (jinpwng, v0.1.4572).

- rootName names the download's top after the repository (file:///x/acme.git
  is "acme", owner/repo is "repo", git@host:a/b.git is "b"); a folder inside
  the download, or a local folder, keeps its own name.
- UpdatePlugin of a one-plugin source installs under the bundle's own name,
  so a bundle a magpie before this named magpie-skill-... is updated in place
  too: same folder, same project assignment, same Pi entry.

Run (mote): go test ./internal/library -run
'TestPluginRootName|TestPiPackageFromGitUpdatesInPlace|TestPluginUpdateKeepsItsName|Plugin'
-count=1 -timeout 45m: ok. Full suite with the batch's last commit.
Real Pi: a throwaway test drove Pi 1.5.2 (npm, --mode rpc --approve) in a
sandbox HOME against a project the Library gave the git package to. With
this change: one bundle "skills" (the repo's name), get_commands acme-v1
before and acme-v2 after Update, settings.json unchanged. Broken by hand:
the same run on origin/main's plugin.go gave bundles
[magpie-skill-332298903 magpie-skill-745278034] and Pi still listed acme-v1
after Update; the two new Go tests were red there too (temp-folder name;
two bundles).
Not tried: the reporter's own repository.
2026-11-20 12:06:44 +08:00
yetone 3a3af27e03 provider: Factory's mover min is 0.1.53, so dsh's first turn is not refused
@a1pha1nthefog (X, 11-20): dsh on Factory's Opus 5.5 still got
content_policy_rejected on factory 0.1.52, on the first turn of a fresh
session; 0.1.51's retry with every tool renamed was refused too, so it is
the prompt. 0.1.53 (magpie-community/plugins 50826752) sends dsh's opening
"You are an AI agent powered by DeepSeek Harness." as "You are an AI
agent." and its "You are a coding agent powered by the <model> model." as
"Current model: <model>.". keepMovedCurrent brings every moved user to it.

npm view --prefer-online @magpie-community/opencode-factory-auth@0.1.53:
0.1.53 (published by publish.yml run 44670300240; that run is red only for
the known think-tags/system-prompt trusted-publisher E404s).
Run: mica-run go test -run 'Mover|Move|Migrat|Factory|Plugin'
./internal/provider: ok. gofmt -l internal/provider: clean.
Not tried: a real Factory account (none in the sandbox).
2026-11-20 12:05:40 +08:00
yetone 1ee41113f5 grok: with no size typed, Grok Build compacts at its own 85% of the window (@taktoshilite on X)
@taktoshilite: the Grok config magpie writes says auto_compact_threshold_percent
= 25-something and 50-something, so a 1M model compacts at a quarter of
its window; they asked for ~90%.

Cause: 4f94b8a82 wrote each model's whole window as context_window plus
a percent from Long conversations. Its default is settings.WorkingWindow,
272K (Codex's own window), so a 1M model got 27% and a 524288 one 51%.
Grok Build's own default is 85 (resolve/compaction.rs,
DEFAULT_AUTO_COMPACT_THRESHOLD_PERCENT), 80 for xAI's own models in
default_models.json.

Change: settings.ForAgent("grok") reads magpie's default (no global size,
no Grok entry) as Full window, so no percent is written and Grok Build
uses its own 85% (1M compacts near 850K). A size the user picks still
goes in: a global or Grok-only size writes its percent (900K on a 1M
model = 90), and Grok's own {} entry keeps 272K. A percent typed by hand
in ~/.grok/config.toml is kept as before (grokOwnPercent). The stale 27/51
magpie wrote is dropped on the next sync, since the stash marks it as
magpie's. CLI (`magpie model compact`) and the Grok Build sheet say Grok
compacts at its own threshold; sub text translated into zh, zh-TW, ja, de.
docs/subsystems/agent-wiring.md says so.

Tests:
- TestGrokCompactsAtItsOwnPercentByDefault (internal/agent): catalog
  windows 1M and 524288, an old config with magpie's 27/51; default
  writes none, Grok {} gives 27/51, 900K gives 90, a hand-set 90 stays.
- TestGrokFollowsItsOwnThresholdByDefault (internal/settings).
- grok-compact.test.cjs: Grok sheet shows Full pressed, posts own at on a
  click, 900K shows 900k; Claude's row unchanged; en/zh/zh-TW/ja/de,
  Chromium + WebKit, 900px and 420px.

Run (mote, at e702accf9's tree on origin/main 64ae6e206):
- Red on the old code: with settings.go and model_cli.go from 64ae6e206,
  the agent test fails "magpie's default: big 27%, mid 51%" (the
  reporter's numbers) and the settings test fails at "default".
- go test -count=1 -tags nogui ./internal/settings ./internal/agent
  ./internal/cli ./internal/provider: all ok (agent 288s, provider 170s)
- go vet (those packages), GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: clean
- gofmt -l: clean.
- GUI: grok-compact, agent-compact, i18n-keys, agent-prefs, compact-at
  pass; agent-details-ready 32 of 36 red, the same 32 at 64ae6e206
  alone ("ends ~80px short and jumps", #6373).

Not tried: a real Grok Build conversation compacting at 85% on a 1M
model; the full Go suite (mote and mica were over their cores).
2026-11-20 12:03:55 +08:00
yetone 64ae6e206b gateway: /responses/compact is held to a key's MaxConcurrency and refused a read-only key (#7281)
6e6da86c8 added POST /v1/responses/compact and /responses/compact
without judging them in the two every-route guards, so the full gateway
suite went red on TestKeySlotEveryRoute and TestReadOnlyKeyEveryRoute.
Both routes ask a model through serve's tries as /responses does, so
they are keySlotLazy in keySlotRoutes and in readOnlyRefused (the guard
already refused them; only the test list was missing them).

Run on mote at this tree:
- go test ./internal/gateway -count=1 -timeout 45m at 6e6da86c8: FAIL,
  with TestKeySlotEveryRoute and TestReadOnlyKeyEveryRoute (the two
  fixed here) and TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes,
  which is red 3 of 3 on origin/main c2924c36d alone (#7117). Its log
  also has the recovered doneHold "close of closed channel" panic
  (#6505, #6690).
- -run 'TestKeySlotEveryRoute|TestReadOnlyKeyEveryRoute|
  TestResponsesCompact|TestBrowserKey' -count=1: ok.
- gofmt -l internal/gateway: clean.
Not run: the full gateway suite again at this head.
2026-11-20 11:40:19 +08:00
yetone 6d46859c48 provider: a relay key bills at its sub2api group rate times the provider's top-up rate (@YIXIE233 on X)
@YIXIE233 has several sub2api relays. Each reports a key's group rate at
GET /v1/sub2api/billing, and each sells its dollars at its own price (¥1
for $1 at one, ¥7 for $100 at another). Until now every key's rate was
typed by hand and typed again whenever a relay changed its prices.

Now a provider of API keys has a "Top-up rate" under Advanced, next to
Price rate (TopUpRate: above 0 up to 1000, at most four decimals). With
one set, the gateway's KeepKeyRatesRead asks each key's relay for its
rate in the background. It reads at start, every 6h, 30 min after a
failed read, and at once on a save that sets a new top-up rate. It is
never on a request's path. The relay asked is the origin of its sub2api
key query, else of its first base; loopback and vendor hosts are never
asked. Readings go to key-rates.json beside providers.json.

A key then bills at group rate x top-up rate, and that rate reaches both
places a price is used: PriceAt (Cheapest/By price routing) and
BaseKeyPriceIn (the ledger, Usage, spend caps). A group rate of 0 prices
at 0 (zeroRate), not at the list price.

- A key's own KeyPriceRates still wins.
- A key never read, or whose reads all failed, is unknown and bills at the
  provider's PriceRate, never 1x.
- A failed reread keeps the last rate it read.

The Usage caches key on a hash of the rates read, so a reread that finds
the same rates keeps them. /api/providers lists keyGroupRates, which the
editor names under the box. An empty per-key line's placeholder shows
group rate x top-up rate. `magpie provider key-rate` lists both. i18n:
zh, zh-TW, ja, de. Not counted yet: sub2api's peak-hour multiplier
(#7286).

Run (mote, via mote-run):
- At 7dc85f26e, before the rebase: go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./...: ok. gofmt -l: nothing.
- go test -count=1 ./internal/provider ./internal/cli ./internal/usage:
  ok.
- go test ./internal/gui: two reds, TestBuiltinsTranslated (a Routing
  string in zh/zh-TW/ja/de) and TestSettingsSaveKeepsWhatItDoesNotSend
  (RedactModelDir). This change doesn't touch either; checked against
  origin/main below.
- The box's code lives in the lazy keyrates.js (loaded for a provider of
  keys of its own too, keyRateField's new `on`). The top-up rate rides
  keyPriceRates(ed, body), and keyPriceRates gives undefined when no
  per-key lines were drawn. With that, app.js stays under
  TestCoreScriptBudget with no raise (a first cut was 261 bytes over).
- go test -run 'CoreScriptBudget|TopUpRate|KeyPriceRate|I18n|Translated'
  ./internal/gui at the rebased head (c2924c36d): ok except
  TestBuiltinsTranslated (#7257). That test and
  TestSettingsSaveKeepsWhatItDoesNotSend (#7240) fail the same on an
  archive of origin/main c2924c36d.
- node --test top-up-rate, key-price-rate, provider-price-rate and
  old-webkit .test.cjs (Chromium and WebKit, en/zh/zh-TW/ja/de): 62 pass,
  2 fail. Both fails are old-webkit (guideback.js imported by navpages.js,
  the class of #6570, and Safari 15 styles, #7235), and they fail the same
  on origin/main c2924c36d.

Broken by hand: with readKeyPriceRate turned off and zeroRate dropped
from tariffOf, TestKeyGroupRateTimesTopUpRate, ...FailedReadIsUnknown and
...Zero go red ($1.8 where $0.14 was wanted); green again once restored.

Not tried: a real sub2api relay. The fixtures are sub2api's own reply
shapes from backend/internal/handler/gateway_key_billing.go (schema 1),
served by httptest.
2026-11-20 11:39:44 +08:00
yetone c2924c36d4 gui: Settings left blank after a restart say why and are read again; a view entrance plays out of sight (WaiooT on X)
WaiooT on X, v0.1.4573 on the Mac: after Restart only or Restart to
update the window came back on Settings › About with nothing under the
header and sidebar.

Two ways the page leaves that pane blank, both fixed:
- Every page of Settings is drawn from one read of /api/settings. One
  that failed (a magpie just restarted still starting, or its read
  erring) left them all empty, and only the footer said why, for 8 s;
  nothing read them again. The view now says "Couldn't read the
  settings" with the reason and Try again, and reads them again by
  itself at 2, 4, 8 s up to every 30 s; the line goes once they are
  read. It lives in settingsunread.js, imported only when a read fails,
  so app.js stays under its budget with no raise (TestCoreScriptBudget
  ok). Words in zh, zh-TW, ja and de.
- A page out of sight (the Mac's window hidden, #4293) paused every CSS
  animation, a view's one-shot entrance too, so a view shown then sat at
  its first frame, opacity 0, until the page heard it was back. A view's
  entrance now plays out of sight (app.css), and a page told it is back
  finishes any view entrance still running (playViews).

Run (mote):
- settings-unread.test.cjs (new): 14 pass at this tree, both engines,
  en/zh/ja; on the old app.js, app.css and i18n.js all 14 red (no line,
  About empty; the out-of-sight view's opacity "0").
- settings-*.test.cjs, window-visibility, window-asleep, version-restart,
  i18n-keys, i18n-en-no-cjk, old-webkit, panel-units-follow,
  sidebar-settings-steady and refresh-page, both engines: 510 pass, 2
  red, both old-webkit and both red on the base 76b490576 as well:
  guideback.js unlisted (#6570) and a :has() in app.css (#7235).
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestAssets'
  ok.
- A real restart of a built magpie in a sandbox HOME (POST /api/restart,
  the handover, the new window's page reporting back): /api/settings
  answered in ~2 ms and About drew 18 rows, so an empty sandbox config
  didn't reproduce it; the new page's view did read opacity "0" while
  its window was out of sight.

Not tried: a visible window on a real Mac (over ssh the window never
shows), so which of the two the reporter met is not confirmed; the
reporter's own config.
2026-11-20 11:27:11 +08:00
yetone 6e6da86c81 gateway: POST /v1/responses/compact is relayed to a provider whose own API is Responses (#7281)
Pi's Responses compaction extension sends OpenAI's unary
POST /v1/responses/compact. Before this change, the generic route
answered it with the 404 for an unknown path and never reached the
upstream.

/v1/responses/compact and /responses/compact (responses_compact.go)
now go through serveAgent and serve, so the key, account and model
holds apply as they do on /responses. The request is marked unary
compact, and the candidates are cut to a key's provider that asks the
model on Responses (compactsUnary: no account, carriesCompaction).
attempt relays it as it came (keep, never translated), and passthrough
sends it to <Responses base>/responses/compact. The unary
response.compaction object goes back untouched, sealed item included.
compactionWatch records who wrote the sealed item, so a later
/responses that carries it goes back to that provider (#1099). The
call is recorded as KindCompact. When no candidate is left, the client
gets a 400 invalid_request_error: "/responses/compact is not supported
for <model>: ... compact on /responses instead". This follows the
CodexPath wording and gives the client a fallback. handle's
codexCompact branch is not on this path, so an earlier compaction item
in the input stays the client's. protoOfPath shapes key-limit errors
on the route as Responses errors.

Not changed: ChatGPT, Copilot and plugin accounts are refused on this
route until a real account is tried (#7285). Codex's own compact still
goes through CodexPath.

Run (mote, at this tree):
- the new TestResponsesCompactRelayed and
  TestResponsesCompactRefusedOffResponses: red on origin/main 7dc85f26e
  (404 not_found_error, both paths), green here.
- go test ./internal/gateway -run
  'TestResponsesCompact|TestCodexCompactionTriggerOnV1|NativeCompaction|KeyLimit':
  ok.
- go vet ./internal/gateway on darwin, linux and windows: ok. gofmt -l:
  clean.
- go test ./internal/gateway -count=1 -timeout 45m: started at this tree
  and not finished at push. The result will go on #7281.
Not tried: a real Pi compaction against a real Responses upstream.
2026-11-20 11:20:46 +08:00
yetone 7dc85f26e6 provider: a plugin account whose model list fell back serves every model
bitssly on X (商汤小浣熊, v0.1.4573, Windows 10): three accounts ticked,
In order, and sn-kimi-k3-1-pro's chain held two of them. The third, a
one_time_purchase account, was in no Routing row for the model.

An account's own list comes from its plugin's models hook. When the
hook can't read the vendor's list for that account (raccoon's
model_catalog failing for its token), it hands back the plugin's
defaults, and the host marks the account fellBack. keepListed puts back
the last list read for it, but an account that never had one kept the
defaults as its "plan", and pluginLists read them as such: Raccoon's
defaults have sn-kimi-k3 but not sn-kimi-k3-1-pro, so AccountsFor put
the account in left, which is asked only after a listing account
refuses the model as unserved, never after a 429. The host's own
comment says an account whose list can't be read is taken to have them
all, as a built-in whose fetch failed (catalog.Live not ok) is.

toldList now reads a fell-back account's list as none told, in each
place that reads plugin.Account.Models: pluginLists (routing),
pluginAccountCatalog and pluginServedCatalog (the models it offers),
and pluginAccountListed (a key's models prefill).

Test: TestFellBackPluginAccountServesEveryModel, the reporter's shape
(three raccoon accounts, the middle one fell back to the plugin's
defaults): red on the old code ("sn-kimi-k3-1-pro goes to [Signed in
Signed in (3)] (left out 1, barred 0)"), green now; a list really told
still leaves sn-kimi-k3 out of the two accounts that lack it.

Run on mote: go test ./internal/provider ./internal/plugin -count=1
-timeout 45m: ok, ok. gofmt -l clean.
Not run: the whole suite (mote at load 41, mica at 44); the gateway
package reads this through AccountsFor only.
Not tried: a real Raccoon account (none here) - which vendor answer made
the reporter's account fall back is not known; the plugin side marks
its fallback explicitly in magpie-community/plugins.
2026-11-20 10:54:42 +08:00
yetone 4716a77ff9 library: a plugin that is a Pi package, given to a project for Pi, is one entry of its .pi/settings.json (#7243)
A library plugin whose folder has a package.json with a `pi` object, given
to a project with Pi among its agents, is now a wanted package of the
project (projectPiWanted): its library folder, written as one entry through
the same pipeline as a package given by source (#7249). Applied again it
stays one entry; withdrawn (or the plugin turned off or removed) only the
entry magpie wrote goes. A declaration the project has of the same folder,
filtered or not, is left byte for byte and not reported, as it loads already.

Run (mote): gofmt, go vet, go test ./internal/library (ok); the new
TestProjectPluginPiPackage covers not-for-Pi, reapply, another project
untouched, withdraw, a filtered native entry byte for byte, and withdrawal
beside the project's other packages.
Not tried: a real Pi resolving the package's skills and extension.
2026-11-20 05:57:12 +08:00
yetone 54b9516473 library: a project's Pi packages, on, off or removed, and adopting its own (#7249)
A project now takes Pi packages: entries of its .pi/settings.json
`packages`, matched by piSourceID. A package is on (its source), off but
kept (every filter empty, as `pi config` writes it) or removed. Project.Pi
is what the project wants, PiRecs what magpie wrote; only an entry still as
magpie wrote it is changed or taken out, and a file magpie made goes with
its last entry. An entry the project had is its own: refused with a problem
until adopted, then switched without a rewrite, and put back as it was (never
deleted) when let go; one that picks some resources is refused.

Surfaces: POST /api/library/projects/pi (how on|off|removed|adopt),
`magpie library project pi [list|add|on|off|rm|adopt] <dir> <source...>`,
the project's own packages in Own["pi"], and a Pi packages block on the
Claude plugins tab's project card (switch, remove, Take over, add field) in
en, zh, zh-TW, ja, de. Pi installs a package itself when it next starts.

Run (mote): gofmt, go vet; go test ./internal/library ./internal/cli
./internal/gui (library, cli ok; gui red only in TestBuiltinsTranslated
#7257 and TestSettingsSaveKeepsWhatItDoesNotSend #7240, both filed);
GUI project-pi (new), project-own, project-plugins, project-hooks,
project-claude-plugins, project-servers, i18n-keys in chromium and webkit.
Not tried: a real Pi starting in a project with these packages; the whole
GUI suite; Windows.
2026-11-20 05:46:18 +08:00
yetone cfe006ea0f library: a Codex plugin's manifest is read like a Claude Code one, and its hooks go to Codex (#7255)
A folder with .codex-plugin/plugin.json is a plugin now. Its skills and
mcpServers are read like Claude's manifest fields (Claude's win where both
name one). The hooks it names (a path, a list of paths or inline) are
Codex's own: kept as written as codex:<Event> hooks with their matcher and
given to Codex alone, so .codex/hooks.json gets them and Claude's settings
do not. An event Codex has none called (codexHookSpec's native list, from
codex-rs/hooks) is left out and said. A manifest's mcpServers naming
./.mcp.json no longer reads that file twice. Codex 0.165's binary names
.codex-plugin/plugin.json and resolves plugin.json#hooks; the shape matches
hooks/hooks.json.

Ported in outline from Arobotmaster's 874624ed, not its code: that commit
also changed session-start matchers and put env on script hooks, which are
other goals.

Run on mote: gofmt, go vet ./internal/library, go test ./internal/library
and ./internal/cli (whole packages, ok); new TestPluginCodexManifest (probe
counts, Codex gets the hooks, Claude gets none, remove takes them out).
Not tried: a real Codex plugin from a marketplace (Codex marketplaces are not
read), a plugin with both manifests naming different hooks, Codex actually
running the carried hooks.
2026-11-20 05:28:25 +08:00
yetone 8de4669fb6 library: hooks reach DeepSeek Harness through its Claude Code hooks plugin (eiyuuzaki2333 on X)
DSH was the one Library agent with no Hooks. Its plugin
@deepseek-ai/dsh-hooks-claude-code runs a Claude Code hooks.json on dsh's
interception points, so a hook given to dsh is written to
$DSH_HOME/magpie-hooks.json (Claude shape, dsh tool names bash|pwsh and
write|edit|str_replace_editor, the events the bridge runs). Each profile gets the
plugin and @deepseek-ai/dsh-hook-protocol installed at dsh's own version
(`dsh plugin --profile <name> add`), then one marked magpie-hooks insert row.
No row is written, and any magpie row is taken out, while the plugin isn't
there (a user removed it, or the install failed): dsh leaves out a row whose
plugin is missing, and a deny hook would then allow everything. A user's own
row for the plugin is left alone and said. Failed installs retry after 10 min.

Not supported by dsh, so left off (named in docs/subsystems/library.md):
subagents, slash commands, rules, env, project MCP/hooks, Claude plugins.

Run:
- real dsh 0.2.2-rc.5 on mote, sandbox HOME, fake model server: bash call
  denied through the bridge with the hook's reason shown to the model;
  without @deepseek-ai/dsh-hook-protocol the row fails to import (hence both
  packages are installed).
- mote: go test ./internal/library ./internal/agent -count=1 ok (before the
  removed-plugin fix); go test ./internal/library -run Hook ok after it;
  GOOS=windows, GOOS=linux and native go vet ./internal/library ok; gofmt -l clean.
- GUI library-hooks, project-hooks, library-rtk-nohook (12 tests, each
  covering en/zh/zh-TW/ja/de at 440px) in chromium and webkit: 12/12 both.
- New tests: TestHooksDsh*, red on the old code (dsh was no hook agent).
  The hooks page is driven by hookAgents, so no GUI change was needed.

Not tried: the full magpie sync against real dsh (full sync not run against
real dsh: the row format was written by hand and loaded by real dsh, the
install is faked in tests); Windows and WSL dsh; a dsh older than 0.2.2-rc.5;
session-start narrowing (dsh's source names unknown). Full suites run after
the tag.
2026-11-20 05:10:42 +08:00
yetone 4ff57b8cbf library: a project's own resources are listed apart from what magpie placed, with a source in the CLI's --json (#7245, #7247)
ProjectView.Own reads, per kind, what the folder's own files already give
agents and magpie didn't write: skills in the skills folders, servers in
each agent's project MCP file (name and transport only, never URL, args or
env), hooks in .claude/settings.json, settings.local.json and
.codex/hooks.json (an entry is magpie's when it equals a HookRecs entry),
and subagent files whose hash isn't in AgentFiles. Read-only: a link out of
the folder or a file that can't be read is left out. The cards show them
under "Project's own", no chips. `magpie library project server|hook|subagent
<dir> --json` gains `items`, each with source "magpie" or "project"; the old
maps stay as they were.

Not done: Claude plugins, Pi packages and instructions are not read as the
project's own yet; the cards have no "Assigned by MagPie" heading, the
chips already say it.

Run on mote: gofmt, go vet library, cli, gui; go test ./internal/library and
./internal/cli (whole packages, ok); new TestProjectOwnResources and the CLI
source check; GUI project-own (new), project-hooks, project-servers,
project-skills-*, project-plugins, i18n-keys in both engines, then every
library-* and project-* file once: library-bar-more went red in that run and
green alone (load, not filed: it did not touch this change).
Not tried: a real project with hundreds of skills (the read is on every
state poll of a project folder).
2026-11-20 05:05:17 +08:00
yetone 1e174f8f9f library: a project gets a single hook, for the agents that read a project's hooks file (#7253)
A project had hooks only through the plugins it took. Now the Hooks tab
lists the projects, and a hook can be given to one on its own, per agent
(Claude Code and Codex; Pi, Goose and the rest read no project hooks
file). Project.Hooks feeds projectHooks, so the write and the HookRecs
ownership records are the ones plugins' hooks already use: withdrawing
removes only what magpie wrote, never the user's own entries. Worktrees
follow through syncTrees; renaming or deleting a hook in the library moves
or drops its project entry. CLI: magpie library project hook.

Also fixes the CLI's problem keys (they lacked the kind prefix for mcp and
subagent) and the empty-project count in syncTrees, which now counts
Hooks and ClaudePlugins.

Run on mote: gofmt; go vet library, cli, gui; go test of the TestProject*,
TestHook* and TestLibraryProject* tests in internal/library and
internal/cli; GUI project-hooks (new, chromium and webkit, en and zh),
project-plugins, project-claude-plugins, i18n-keys. 14 other library GUI
files were red on this base with "nativeView is not iterable"; origin/main
has 03ae057b8 for that, rerun after the rebase.
Not tried: a real Codex or Claude session reading the written files.
2026-11-20 04:36:59 +08:00
yetone 81dc4fc67d usage: a Claude account the vendor sends no 5-hour window for shows none (shangyuan0818 on X)
claudeWithUnstarted made up an unstarted 5-hour window for every whole
/usage reading without one, so a Claude Ultra account that has none (the
vendor sends none) still showed one in Usage. Anthropic leaves a window
null until a request starts it, so an idle account and one with no such
window read alike; the use tells. claudeNoFiveHour: an account whose week
rose since a reading under five hours old, still with no 5-hour window, is
one the vendor sends none for; the made-up window is then left out and
stays out (read from the card kept on disk after a restart too) until a
reading or header tells a real one. An account not yet seen used keeps the
unstarted window as before (motui9535's idle Team accounts).

The Usage page's Warm up button no longer shows for a Claude account read
with windows but no 5-hour one: it has none to start.

ChatGPT Pro 100 (prolite): codexWindows already shows whatever
primary_window and secondary_window /wham/usage sends, named by
limit_window_seconds, and no path filters by plan; the ChatGPT app reads
the same fields. No prolite reply is available here, so no cause was
found in magpie; asked the reporter for the reply.

Run (on mica; mote's load was over its cores): TestClaudeNoFiveHour red
on the old code (broken by hand: claudeNoFiveHour returning false) and
green on the new; go test ./internal/provider -run Claude ok; gofmt -l
clean; go vet darwin, linux, windows for internal/provider. GUI
quota-warm.test.cjs 10 of 10 red with the old page.js, green on the new
in chromium and webkit (all five languages, 390px and wider);
warm-now, warm-reset-asleep, i18n-keys green in both engines. Full
`go test ./...` -timeout 45m started on mica at this tree, not finished
at push. Not tried: a real Ultra account without a 5-hour window.
Not changed: the warm-up still sends such an account a request on its
backoff (filed).
2026-11-20 04:17:29 +08:00
yetone ac8b26547f gui tests: routing-mode-goes says Quota first, not Smart, since 9ec023a46 renamed it
9ec023a46 updated every sibling test but this one; its 20 pooled-provider
cases were red on origin/main 03ae057b8 (expected Smart, got Quota first).
Run on mica: routing-mode-goes 40 of 40 in chromium and webkit.
2026-11-20 03:59:43 +08:00
yetone b6b6ba752e routing: an account's seat on the stage tells every window it has, under its status (YujunT46308 on X)
The stage's seat said one share and drew a bar; the other windows were only
in its tooltip, so the reader went to Usage to see what was left. Under the
status the seat now lists every window the account has, worded by the Usage
page's own winParts (short name, used or left per the quotaLeft setting,
when it starts again; counts such as "355 / 500 credits" come with
quotaText), each with its full reset time on hover. No new colours, no
motion, no new strings: it wraps on a narrow stage.

Honest about unknown: a seat with no card of its own, or whose read failed,
shows no windows (its status already says so); a wallet's balance stays its
status; the window the status already says is not told twice.

Run (mica, tree at this change rebased on origin/main 03ae057b8):
- routing-seat-wins.test.cjs: 22 of 22 in chromium and webkit, 5 languages,
  1100 and 420px. Broken by hand (line returning no windows): 11 red in
  chromium.
- routing-*, panel-routing*, i18n*, ctx-route* GUI files (207 files, both
  engines): reds were routing-mode-goes (stale since 9ec023a46, fixed in the
  next commit) and routing-pin-away (red on origin/main too, #6512).
- go test ./internal/gui -run 'TestCoreScriptBudget|Asset|I18n|Script': ok.
Not run: the whole GUI suite (both machines already had one running, one
suite per machine); WebKitGTK/Linux app; Windows.
2026-11-20 03:59:43 +08:00
yetone 3eba174fd9 sessions: a restart no longer opens each Claude Code subagent's file again (shangyuan0818 on X)
Every list built each session's subagents, and ccTask and ccMeta keep what
they read in memory only. After a start, each of a few thousand subagent
files was opened for its first user line (or its meta file), under
Defender's per-open scan. The parse already read that file; its task and
meta now stay in its state (StateMore Task, TaskRead, SubMeta) and the
list uses them, falling back to ccTask/ccMeta when a parse has none. A
subagent's parse made before this (no TaskRead) is read again once
(ccStale), then not.

Windows (xiaomi-gpu, Defender on, sandbox HOME, Claude-only reads), fixture
of 12k files / 9.3 GB with 9k subagent files, three requests together:
- warm restart: 2.2 s -> 1.0 s
- restart after one session grew: 2.4 s -> 1.1 s
- restart after one new session: 2.3 s -> 1.1 s
- grow or new session while running: 0.55 s -> 0.4 s on the next list
- cold, no cache: 21 s -> 15.8 s (the subagent read is no longer done twice)
The plain 100-session fixture (6.6 GB) was 0.3 to 0.8 s warm before and
stays there: it has no subagent files to open, and I did not reproduce
"15 s after an agent used". The 5 s cold figure the reporter gives matches.

Run: go test ./internal/sessions at this head (mote), gofmt, go vet for
linux, windows and darwin. TestSubagentTaskAndMetaComeBackFromTheSavedParse
is red on the old code (the list read the subagent's file once with its meta
gone); TestSubagentParseWithoutItsTaskIsReadOnce guards the one-time reread.
Not tried: a real Claude Code subagent's meta.json on Windows (the fixture
has none, the meta path is covered by the test); the full suite and the GUI
files are run after the push. A task past a subagent's 16th line is now
found where ccTask gave none.
2026-11-20 03:53:58 +08:00
yetone 03ae057b8e library: a native list that is not a list draws the tab without it
6d153bffc (#7244) iterates /api/library/native's reply. A reply that is
not an array (a GUI test's catch-all {}, an older magpie behind a remote
window) threw in nativeSection, and the Skills, MCP and Hooks tabs drew
nothing. On origin/main 82611c3c9, skill-update-feedback, skill-where and
library-open-again were 38 of 38 red on mica; about 111 GUI test files
that touch the Library answer unknown /api paths with {}.

A reply that is not an array now lists no native rows. A failed read
still draws nothing, as before.

Run (mica, via mica-run, at this head): skill-update-feedback and
skill-where green in chromium and webkit (red at 82611c3c9).
library-open-again stays red with its old error, "the library was read
1 times, not 2", the same as at f534245f1 before #7244 (#6975).
go test -run Budget ./internal/gui ok. Not run: the whole GUI suite at
this head.
2026-11-20 03:04:12 +08:00
yetone 75d0b9feac gui: an icon button at work shows the spinner, not its glyph turning
wiirhan on X (tweet 2123287273043378671): "资源库--技能--更新技能的loading
状态为啥是直接转箭头?" A Library skill's Update turned its own up arrow
while the fetch ran (.lib-icon.busy svg { animation: lib-spin }), so the
busy state looked like a broken arrow, not like work.

glyphBusy (app.js) puts the spinner's arc, CLI_SPIN, the one saving() and
a CLI's update pill turn, in place of the button's glyph while it works,
and puts the glyph back when it is done or fails. The arc turns at .8s,
and under prefers-reduced-motion it stands still.

Siblings: an agent row's Apply again and Restart (.ag-fix) turned their
reapply arrow the same way, and now take glyphBusy too. Kept as they are:
the refresh arrows that re-read data (quota-refresh, usage-refresh,
rt-read, #sync, pu-again). Their glyph is a turning arrow, so turning it
says what it does, and the owner tuned them in #16.

TestCoreScriptBudget: app and core budgets +228. glyphBusy is packed to
its shortest form, and renderAgents and the Library rows draw it on every
window, so there is no page to move it to.

skill-update-feedback.test.cjs waited for the svg itself to animate. It
now waits for the arc's path, with the row's actions still in view.

Run (mote, via mote-run):
- busy-glyph-spinner.test.cjs (new): chromium + webkit, en/zh/zh-TW/ja/de,
  1100px and 420px (reduced motion at 420). Green 22/22. Red 22/22 on
  origin/main f534245f1's assets. Restart's glyphBusy broken by hand:
  chromium 11/11 red.
- go test ./internal/gui: ok at the rebased head (budget included).
- Whole GUI suite at 59e0421f4, beside other sessions' runs (load 20-60):
  29713 tests, 28689 pass, 1024 fail in 122 files. One red was this
  change's: skill-update-feedback, fixed above. The other 121 files were
  run again at head 0f0827c28: 118 still red (2300 tests, 1021 fail). The
  same 118 files at origin/main f534245f1: 2254 tests, 1017 fail, the same
  files red. Subtest counts differ by one or two in account-cap,
  context-cap, desktop-tiers, menu-input-scroll, rest-try-now and
  tray-cell-click, both ways; none touches an icon button.
  provider-base-as-typed was red once at head and passes when rerun.
  Filed already: #6975 (most of the 118), #6782, #7016, #7097, #7131,
  #7132, #7101, #7100, #7242, #7033, #7083, #7046, #6234.

Not tried: the real app (Wails/WebKitGTK). The change is an svg swap with
a transform animation the spinner already uses there.
2026-11-20 03:04:12 +08:00
yetone ddfc9b17d9 gui: Claude Code's max effort says /effort can't change it (daix91 on X)
@daix91 asked on X whether Claude Code's effort can no longer be changed.
Max is fixed in Claude Code's environment (CLAUDE_CODE_EFFORT_LEVEL=max,
the design since c1d38cc50), which outranks /effort, and nothing in
Details said so. The New sessions effort button's title, where 534b85bf9
put the per-tier lines, now ends with one line while Max is picked: "Max
is fixed in Claude Code's environment, so /effort can't change it. Pick
another level to get /effort back." Picking another level in the slider
drops it at once (renderEffortPicker), and picking Max puts it back. No
visible label is added. The env behaviour is unchanged. Translated in zh,
zh-TW, ja and de.

Test: internal/gui/tests/claude-effort-max.test.cjs covers Chromium and
WebKit, en/zh/zh-TW/ja/de, at 1100 and 560px (20 tests). It checks that
the title ends with the line once and that the line is not visible text,
that there is no sideways scroll, and that picking high drops it at once,
names high in the title and POSTs {agent:claude, field:effort,
value:high}. After a reload it checks the line is still gone, and that
picking Max brings it back.

Run:
- Red on old code: claude-effort-max against origin/main's assets failed
  20 of 20 (no line in the title). With the change, 20 of 20 pass on mica.
- Go, on mote at the pre-rebase head f85198750: gofmt -l clean;
  go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows
  go vet ./... and go build all ok; go test ./internal/gui ok (181s).
- Whole GUI suite on mica at f85198750 (chunked 100 files, concurrency
  3, load 40 to 70): 29,589 tests, 1,044 failures in 135 files.
  claude-effort-max and i18n-keys passed. The 135 files were rerun at
  head and at base 83bb079de: 123 red at head, 118 at base (#6975). The
  five head-only files were rerun alone. images-codex-one, models-fold,
  routing-groups-page and usage-focus-steady passed. desktop-tiers
  failed ("no tiers square"). Run alone six times at base 83bb079de it
  failed 0 to 2 of 4 each time, the same way, so it is #6475 (commented
  with the numbers). Not caused by this change.
- Targeted run on mica: tier-effort, claude-effort, panel-effort,
  claude-subagent-effort-row, wsl-claude-tiers, subagent-effort, gui-ja,
  gui-zh-tw, i18n-en-no-cjk, i18n-keys and claude-effort-max gave 111 of
  112 pass. The red is gui-ja's "ja has every zh string" ("Gets copies…
  {agents}"), #7144, red on main since 88b65d758.
- After rebasing on 82611c3c9 (app.js changed upstream), on mica:
  gofmt -l clean; go test -run Budget ./internal/gui ok (TestCoreScriptBudget
  included); claude-effort-max, i18n-keys, tier-effort, claude-effort,
  panel-effort and i18n-en-no-cjk 66 of 66 pass.

TestCoreScriptBudget has room at this base, so the budget is not raised.

Not tried: a real Claude Code session with Max picked. The env path
itself is unchanged.
2026-11-20 03:00:40 +08:00
yetone 82611c3c9e library: a project turns on a plugin Claude Code installed, in its own settings (#7254)
Plugins Claude Code has installed itself (installed_plugins.json) are listed
on a project's Claude plugins tab, each with one Claude chip. On writes
enabledPlugins.<id> = true into the project's .claude/settings.local.json
through the format-preserving JSON edit (comments and the user's keys stay);
off takes out only a key magpie wrote that is still true. A key the user
already had is neither written nor taken out; a file magpie made goes once
the skill offs, hooks and plugin keys sharing it are all gone. Worktrees
follow through syncTrees; RemoveProject lets go. Written fresh, not ported.

Run (mote-run): go vet library/gui/cli; go test ./internal/library -run
TestProjectClaudePlugin (new, two tests); project-claude-plugins,
project-plugins and i18n-keys GUI files in chromium and webkit, en and zh;
go test ./internal/gui reds only on testenv's docs-index guard
(routing-groups pages newer than the search index, not from this change).
Not tried: a real Claude Code reading the project's enabledPlugins; the
whole GUI suite; a CLI for it; "off" for a plugin the user turned on
user-wide.
2026-11-20 02:49:50 +08:00
yetoneandArobotmaster ab342fa40d library: magpie library project server and subagent add, rm and agents (#7248)
The CLI had project skills and instructions only. `server` and
`subagent` now list, add (agents= or the agents already used, else every
agent here that reads a project's MCP file or subagents folder), take
out and re-point a project's library servers and subagents through
ProjectServer and ProjectSubagents, the calls the Library page makes.
A name the project doesn't have is refused, as is an unknown agent or
flag; a part magpie couldn't place exits 1 with why.

The command shape follows the reference commit in the reporter's fork
(0d3a6de55), rewritten over this tree's calls rather than ported.

Run: mote-run go test ./internal/cli -run TestLibraryProject (the new
TestLibraryProjectServerAndSubagentCmd: the user's own .mcp.json server
survives an add and an rm, Codex's file gets the server, Claude's and
Codex's subagent files come and go with their agents). gofmt and go vet
./internal/cli clean.
Not tried: the whole Go suite; the package run also prints testenv's
docs-index guard (routing-groups pages newer than the search index),
which is not about this change; a real agent reading the files.

Co-authored-by: Arobotmaster <50254754+Arobotmaster@users.noreply.github.com>
2026-11-20 02:40:53 +08:00
yetone 6d153bffca library: list the skills, MCP servers and hooks of plugins installed natively in Codex and Pi (#7244)
The Library now reads Codex's plugin cache (plugins/cache/<marketplace>/<plugin>/<version>,
manifests under .codex-plugin, .claude-plugin or .cursor-plugin; config.toml's
enabled flag) and Pi's packages (settings.json packages, package.json pi.skills,
user and project scope) and lists what they bring on the skills, MCP and hooks
tabs under "Installed in the agents themselves", with origin and scope.
Read-only: nothing is copied, linked or registered; the agent keeps loading it,
load status stays unknown. Paths stay inside the plugin; an unreadable file
means unknown. New GET /api/library/native (lazy, not on the polled
/api/library) and `magpie library native`. Docs row in library.md.

Run (mica, sandbox HOME, nothing of the live ~/.codex or ~/.pi touched):
- go vet darwin; internal/library native tests (6) and the new GUI test
  library-native.test.cjs in chromium and webkit, 5 languages, 980 and 380 px.
- Built binary against a sandbox copy of the real Codex cache manifests (74 files).
- Not tried: Claude native plugins, subagents, Pi MCP and hooks, a live Codex
  or Pi, Windows and WSL Pi. The whole GUI suite and the full Go suite run after the push.
- Not mine: every package using testenv is red on origin/main 9ec023a46 from the
  stale docs index (docs/routing-groups.html and its ja/zh copies; its author is
  regenerating it), so go test of internal/library and internal/gui fails there
  before and after this change. TestEveryRouteHasACommandOrIsNamed named the new
  route; settings_parity_test.go now maps it to `magpie library native`.
2026-11-20 02:34:58 +08:00
yetone 9ec023a46b routing: the default routing is called Quota first, not Smart (@canlee886)
The groups magpie finds on its own (auto/<model>) hold one model served by
several providers, and with no rules they follow their Routing, whose
default was labelled Smart / 智能. @canlee886 read that as "judges how hard
the task is and sends easy ones to a cheap model". It does not: the member
whose allowance renews soonest goes first, ties in list order, the next takes
over on a failure.

A cheap-model rule cannot be a built-in default for these groups: their
members are the same model, so there is no cheaper member to send an easy
request to. The mechanism for hard-to-strong, easy-to-cheap exists (the
"Hard to strong, easy to cheap" template and rules with an intent) but it
needs members of different strength, which the user picks. So the honest fix
is the label.

- The mode is "Quota first" (额度优先, 額度優先, 枠優先, Kontingent zuerst) in
  every picker, chip, tooltip and hint, in all five languages (the English
  key text and each translation).
- The no-rules line now says it does not judge how hard a task is.
- docs/reference.md, gateway-routing.md and the routing-groups site pages
  (en, zh, ja) name it the same. The stored value ("") is unchanged, so no
  saved group or provider changes behaviour and nothing needs migrating.

Run (mica, node --test, chromium and webkit, five languages): 19 GUI files
(routing-rule-example, routing-save, routing-group-strategy, routing-manual,
routing-weight-chip, rotate-figure, account-weight, routing-key-windows,
routing-free-expiring, builtins, i18n-keys, i18n-en-no-cjk and the routing
Smart-text files): 440 of 446 pass. The 6 reds (account-arrange 1 and 2,
key-weight 17 to 20) fail identically on origin/main 87a933e50, filed
separately. The tests assert the new label and hint; run against the old
assets they fail on the old text. Not run: the full Go suite and the full GUI
suite (run after the tag); not tried in the Linux WebKitGTK app.
2026-11-20 01:56:08 +08:00