Commit Graph
415 Commits
Author SHA1 Message Date
yetone 6c6d3bc842 gateway: Codex's web.run goes to a relay set to search by itself (YIXIE233 on X)
YIXIE233's GPT relay serves /v1/alpha/search itself, but Codex's web.run
(<base>/alpha/search) only went upstream for ChatGPT accounts; for every
API-key provider magpie ran its own searcher. The per-provider "Searches
the web by itself" switch (search=yes, Advanced > Web search, default
off) already sent Responses' web_search tool and Claude's WebSearch
through as sent; now it covers web.run too.

- relaySearchers resolves the model's provider, or a routing group's
  members in order (the leading candidate decides, as for the request).
  A provider qualifies when it has search on, is an API-key provider
  (not a ChatGPT account, not a plugin) and has a Responses base.
- The search goes to that base's /alpha/search with the provider's key,
  Codex's headers, originator and the agent's User-Agent.
- If the relay fails, magpie searches in its place and the output says
  "X's web search failed (why); magpie searched in its place."
- Settings' "magpie searches for every model" still overrides it.
- GUI help text, every language, names web_search and web.run; the CLI
  help, docs/reference.md and docs/subsystems/gateway-routing.md say so.

Tests: TestCodexWebRunGoesToRelayThatSearches and
TestCodexWebRunInGroupFollowsLeadingMember are red on the old code
(magpie's searcher answered). TestResponsesWebSearchToolToRelayThatSearches
guards the web_search pass-through. provider-search.test.cjs covers en,
zh, zh-TW, ja, de in both engines and at 400px (no sideways scroll).

Run (mica): gofmt clean; go vet, GOOS=linux and GOOS=windows vet ok.
Full go test ./... -timeout 45m before the rebase: 102 packages ok, only
internal/gui TestCoreScriptBudget red (app.js 22 bytes over); fixed by
shortening the English help key (net -2 bytes), budget not raised.
At 64c5e1e0a (on origin/main d4af0ca4f; then rebased over ae94571d7, a Library change, and the gui budget tests rerun ok): internal/gateway,
internal/gui and internal/cli ok; provider-search, i18n-keys and
images-codex-one GUI files 72 pass, 0 fail.
Whole GUI suite (two runs on mica, under other sessions' load): reds in
30 files, none touched by this change. The 26 files run alone on
origin/main d4af0ca4f are red there too (154 tests; filed in #6975,
#6934, #6709); header-centre (#3479) and icon-tile (#6759) are red on
main too. images-codex-one was red only under load and passes alone
at the pushed head.

Not tried: a real relay serving /alpha/search (tests use a local fake);
a plugin-served provider (excluded on purpose).
2026-11-17 23:50:29 +08:00
yetone ae94571d70 library: a project's own instructions, in the file each agent reads
@VictorHong1022 on X asked to manage AGENTS.md per project beside a
project's skills, so the shared instructions keep only general rules.

A project in the Library now has instructions of its own (the
Instructions tab, expand a project; `magpie library project
instructions <dir>`). magpie writes them into the project file each
picked agent reads there, by that agent's own name for it: Claude Code
CLAUDE.md (or .claude/CLAUDE.md when that is the one there), Codex and
pi their override first, Gemini GEMINI.md (or its context.fileName),
Qwen QWEN.md, CodeBuddy CODEBUDDY.md, the rest AGENTS.md. magpie owns
only a marked part (<!-- magpie:begin … --> to <!-- magpie:end -->):
the user's own text around it is kept byte for byte, CRLF included, a
hand edit of magpie's part stays until the project's text changes, a
file magpie made is listed in the repo's .git/info/exclude and removed
when emptied, and an agent's user-wide instructions file is refused.
Worktrees of the project follow it. A first text goes to the agents
the shared instructions are on for, else every agent here that reads a
project file. Problems show as the project's "instructions" problem.

Tested:
- internal/library: 8 new tests (block kept around user text, CRLF,
  hand edit kept, made file excluded and removed, renamed files,
  global file refused, worktrees). Four broken by hand, each red.
- internal/cli: TestLibraryProjectInstructionsCmd; red with the
  default agents dropped.
- GUI: project-instructions.test.cjs, en and zh, chromium and webkit,
  6 of 6. Red when Goose (no project file) was offered, and red when
  the defaults ignored the agents the instructions are on for.
- Real use on mote: the built binary, sandbox HOME and project. add,
  text, agents; CLAUDE.md kept CRLF with the part appended; AGENTS.md
  and GEMINI.md made and excluded; the user-wide CLAUDE.md untouched;
  zed refused; an edited part survived `library sync`; `agents none`
  put CLAUDE.md back byte for byte, removed the made files and
  emptied the exclude block.
- Full Go suite (go test ./... -timeout 45m) on mote: 103 packages ok,
  gofmt clean, go vet darwin, linux (nogui) and windows rc=0, at this
  change on origin/main 873b1f7d5.
- At dbb7230ae (rebased on d4af0ca4f), on mote: gofmt clean; go vet
  darwin, linux (nogui) and windows rc=0; go test internal/library,
  internal/cli, internal/gui and internal/testenv ok; node --test
  site/*.test.mjs 133 of 133. Not the whole Go suite again: of the
  commits that came in, only backup_cmd.go and main.go in internal/cli
  touch a package this change does, and its tests pass.
- The 89 Library GUI files (library-*, lib-*, project-*, skill-proj*,
  i18n-keys) at dbb7230ae on mote, both engines: 1868 of 1876. Red:
  library-open-again's 6 at 1100px, red alone at origin/main 28f27e07b
  too (#6751); library-new-skill's chromium en 420 timed out waiting for
  "taken" under the parallel run and passed alone at this head.
- Rebased again on 28f27e07b (three commits, one internal/cli test):
  go test internal/cli and internal/library ok on mote, and
  docs-index.mjs leaves the generated site files unchanged.
- Site: node docs-index.mjs regenerated llms-full, search and
  docs-index.sums at the rebased head; node --test site/*.test.mjs
  133 of 133.
- Full GUI suite (make test-ui, both engines) on mote at 873b1f7d5's
  rebase, beside other sessions' runs at load up to ~100: 28532 tests,
  1156 red in 133 files, none of them project-instructions. 115 files
  are #6975's, red at origin/main. Run alone at this change and at
  origin/main 8e1534f5f, the other 18 give the same result at both:
  16 green, name-suffix-remote red (#5147), library-env red. Recorded
  on #6975.

Not tried: a real Cursor, Copilot or Gemini session reading the files;
the library tests on Windows or Linux (cross vet only). Cursor and
Copilot read both CLAUDE.md and AGENTS.md, so picking Claude Code and
them together can show them the text twice.
2026-11-17 23:37:54 +08:00
yetone 5bfa57e3d3 usage: check one model on one provider with a few fixed-answer calls, kept beside the other providers
skingstyle48487 on X runs more than ten relays and asked for something
like the "pelican test" to spot one that waters a model down. In a
follow-up (2122694296054972815) they said speed, failures and the model's
name show whether a relay is fast and stable, not whether the model got
weaker. They asked for small tests with known answers, the share of right
answers and of right tool calls, and relays compared side by side.

On Usage › Requests › Model speed › Providers, each row has a Check… that
opens a dialog. Opening it sends nothing; only its Check makes the calls.
POST /api/relay-check (gateway.CheckRelay) makes 6 small streamed Chat
Completions calls through the gateway, pinned to provider/model as an
agent would, three at a time:
- write 1 to 40;
- 1234 × 5678, 987 × 654 and 2468 × 1357;
- weather in Paris and time in Tokyo, each call offering both tools,
  so the right one has to be picked.

Each part says what it found, never a verdict on the provider:
- whether the answer was the expected one, and what came back;
- the model the reply named, when the ledger would call it another
  model (usage.Swapped, not SameSpelled or ListedAs);
- the provider that answered, when the call was handed on;
- how many input tokens the 118-character prompt was counted as;
- first token, tok/s and the whole time.

The dialog heads the parts with "Answers right: n of m" and "Right tool
calls: n of m". The numbers come from the gateway's own usage records (a
tap in appendUsage keyed on the request's context), not from each
protocol's reply. The tally of each provider's last check is kept in the
window's storage. The Providers table then shows Answers and Tool calls
columns: sortable, amber when short of all, a dash for providers not
checked, so relays are compared side by side. The dialog code is a
lazily loaded root script (relaycheck.js), as app.js has no room left.

Run, at this head:
- mote: go test -timeout 45m ./internal/gateway ./internal/gui
  ./internal/cli ./internal/usage: ok (the full ./... suite passed at
  41d88731c, before the fixed-answer calls; mote and mica were each
  running another session's GUI suite at this head);
- gofmt -l, GOOS=linux go vet -tags nogui ./... and GOOS=windows go
  vet ./...: clean;
- go test -run 'CheckRelay|ReadChatStream' -v ./internal/gateway
  (5 tests pass);
- usage-model-speed.test.cjs, chromium and webkit, en, zh, zh-TW, ja and
  de at 400px: 12/12;
- i18n-keys and old-webkit: their only reds are the three on origin/main,
  each filed (#6877 ", with an image", #5919 :has(), #6030
  headerpresets.js);
- TestCoreScriptBudget and the app.js budget: ok, not raised.
Broken by hand:
- taking tapUsage out of appendUsage turns TestCheckRelayAnsweredAsAsked
  and TestCheckRelaySaysWhatDiffers red;
- dropping the tool-name check turns TestCheckRelayCountsEachAnswer red
  (get_weather for Tokyo read as right);
- pressing Check as the dialog opens turns the GUI test red ("opening the
  dialog sends no call").
Not tried:
- the whole GUI suite at this head (both machines busy with another
  session's suite);
- a real relay (fakes only);
- a context-window probe;
- a comparison with the vendor's own count_tokens;
- a periodic check (the check runs only on a press).
2026-11-17 23:13:03 +08:00
yetone 50c5a52dbd backup: a backup file carries the usage history, and a restore merges it (JasonLeeForOnly on Discord)
JasonLeeForOnly moved magpie to a new server with magpie backup / magpie
restore and lost every call's usage history: a backup file held the setup
only.

- backup.WithUsage puts usage.jsonl's whole lines (gzipped, usage.LogBackup)
  and the quota history (gzipped) in Bundle.Usage. magpie backup and
  Settings -> Sync -> Export add it unless --no-usage / the tick says no.
  Collect never does, so sync, join and automatic backups are unchanged.
- Restore (Parts.Usage, on in All; magpie restore --no-usage and the Import
  tick turn it off) merges: usage.MergeLog appends the lines the log here
  doesn't have, compared byte for byte as a multiset, so restoring the same
  file twice adds nothing and two equal calls both arrive. It reads most
  of the log before the gateway's log lock, the rest under it, and appends
  with O_APPEND in 4MB chunks, after a newline when the log ends in an
  unfinished line. Quota points merge with provider.MergeQuotaHistory.
  A file without usage (older magpie, or --no-usage) restores as before.
- Result.Usage is the calls added; the CLI and the Import form say it.
- Docs: sync-backup.md, reference.md, site sync pages (en, zh, ja) and the
  search index/llms-full.txt rebuilt with node docs-index.mjs.

Not changed: where usage is also shared by sync, the old computer's calls
are in usage-others and, after a restore, in this log too: filed #6987.

Run on mote at this head (26f69e85e rebased on origin/main 4a1ac8442):
- gofmt -l clean; go vet (darwin), GOOS=linux go vet -tags nogui,
  GOOS=windows go vet for backup, usage, cli, gui; GOOS=linux go build
  -tags nogui and GOOS=windows go build of the app.
- go test -count=1 -timeout 45m ./internal/backup/ ./internal/usage/
  ./internal/cli/ ./internal/davsync/ ./internal/provider/ ./internal/gui/:
  all ok.
- GUI (Chromium and WebKit, 5 languages, 1100/420px): sync-*.test.cjs,
  i18n-*.test.cjs, auto-backup.test.cjs: 245 pass, 1 fail, i18n-keys'
  "a plugin's words are its own" over claude_image_budget_test.go, red on
  origin/main and filed as #6877.
- Real use: a built magpie on mote, two sandbox HOMEs, a copy of a real
  105,815-line usage.jsonl (47MB): magpie backup wrote a 9.1MB file in
  1.9s (364 bytes with --no-usage); magpie restore on a home holding the
  last 1000 of those calls added 104,815 in 0.5s, the sorted log then equal
  to the old one; a second restore added 0; the --no-usage file changed
  nothing; magpie usage read the merged log.

Broken by hand, each red: MergeLog without the multiset skip
(TestBackupCarriesUsageHistory); no newline before the
first appended line (TestUsageMergeKeepsLinesWhole); WithUsage not setting
Bundle.Usage (both tests). The Import form's tick check first sat after
the Import click and went red in WebKit; it now runs before the click.

Not tried: the GUI's export and import against a real gateway (the GUI
tests use a fixture API); the full go test ./... and the whole GUI suite,
since mote and mica were each running other sessions' full suites.
2026-11-17 22:41:26 +08:00
yetone 64ad53f6c7 sessions: magpie sessions search and show, for agents (yansheng1003 on X)
yansheng1003 asked for a command or skill an agent can call to search
and read its sessions. magpie had the search on the Sessions page and
in the Magpie Sessions MCP server, but not on the command line.

- `magpie sessions search <words…> [--agent] [--days N|today|all]
  [--limit N] [--wait] [--json]`: the Sessions page's search
  (sessions.SearchSaid over said-v1.db; SearchSaidSince adds the --days
  bound), newest first, each hit named agent:id with title, folder,
  time and the words round the match. A one-shot command waits for the
  index (SaidReady, 60s by default, a progress line on a TTY only).
- `magpie sessions show <agent:id|id> [--find] [--from N] [--max-chars N]
  [--json]`: the viewer's reader (TranscriptOf, TranscriptAt) as text,
  from where the words were said; --json is the page's transcript.
- One renderer: the MCP server's search_sessions/read_session text moved
  to sessions.SaidText/SessionText (said_text.go), with how to ask for
  more given by each caller (TextHow). The MCP server's output is
  unchanged (its tests pass as before).
- Consent: neither reads, nor makes the index, until the user has
  answered which agents magpie may read; it prints notAskedLine and
  exits 1. An agent not allowed is ErrNotRead for --agent and show.
- Flags: an unknown flag or a missing value is refused with the usage,
  never taken for words or a session id; `--` ends flags; -h/--help
  prints the subcommand's own usage (help_cli.go).
- Parity: /api/sessions/said and /api/sessions/transcript now map to
  these commands (settings_parity_test.go).
- Library: magpie-sessions is a featured official skill
  (magpie-community/plugins skills/magpie-sessions, pushed as plugins
  cf5b0312), listed after magpie-quota.
- Docs: usage.html "Search what was said" in en, zh and ja; llms-full,
  search indexes and docs-index.sums regenerated (node docs-index.mjs).

Run at 114eb4592 (rebased on a2213b1b6), on mote:
- gofmt -l internal: clean. go vet darwin, GOOS=linux -tags nogui and
  GOOS=windows of internal/cli, sessions, gateway, library: ok (before
  the rebase; upstream's one commit touches none of these).
- go test -count=1: internal/cli -run 'TestSessions|TestEveryRoute|TestHelp'
  ok; internal/library -run TestFeaturedSkills ok; internal/gui -run
  TestEveryRouteIsNamedForTheCLI ok; internal/sessions (whole package)
  ok; internal/gateway -run 'SessionsMCP|Sessions' ok.
- site: node --test search.test.mjs worker.test.mjs, 47 pass.
- Real binary, sandbox HOME holding internal/sessions/testdata's Claude
  and Codex sessions: search before `sessions read on all` printed the
  not-asked line, exit 1; --help printed usage, exit 0; --bogus refused,
  exit 1; then search "login bug" found the Claude session, --json gave
  the Codex hit, show --find and a bare Codex id read their sessions.

Broken by hand: without the consent check TestSessionsSearchNotAsked is
red; without the since filter the --days today case is red.

Not run before the push: the full suite. Both mote (load 31 on 18
cores) and mica (21 to 30 on 12, another session's gateway run) were
over their limits; it runs at this head after the push. Not tried: real
agents' long histories (the index on a large history is the GUI's, as
before), Windows and Linux runs of the command.
2026-11-17 17:33:23 +08:00
yetoneandID-VerNe 3f6a101fe1 providers: Images per request in the editor's Advanced, per model, learned from 100milionseek's and Coarena's words (#6849)
Yuu_jiang_ on X (#6849): 100milionseek and Coarena take at most 8 images
a request, counted over the whole conversation, tool results included,
and every turn after the ninth screenshot failed with no way on but
/clear. ID-VerNe's max-images (the commit before) set one number from
the CLI. This builds on it:

- The cap is per provider, and optionally per model: max-images=8, or
  max-images=8,gemini-3-flash=10. The exact model is looked up first,
  then its upstream name, then "*" for all. The provider's cap moves
  with a model's local id like the other per-model limits.
- 100milionseek's "At most 8 images per request (MAX_IMAGES)." and
  Coarena's "A request may carry at most 8 images." are learned as
  Copilot's words are, by provider and model, so the first refusal is
  the last. A user's own number is fitted before any refusal; a learned
  one that is smaller still lowers it.
- Images are counted everywhere, a tool_result's too; the oldest are
  left out first and the latest user turn keeps its own. Only the
  request sent changes; session files are not touched. A request with
  no cap, or within it, goes out byte for byte as it came.
- The provider editor's Advanced (folded unless set) has Images per
  request under Max output, in maximages.js, imported as that field is
  drawn, in every language. A GUI save keeps the value when the field
  isn't drawn. An editor opened and closed is not dirty (the draft
  takes the value only when typed), and the import, like keyrates.js's,
  draws nothing once the editor has closed: before that, a quick close
  threw "Cannot read properties of null (reading 'maxImages')" and
  ('keyPriceRates'), which add-sheet and key-box-once caught.
- Budgets: app.js and the core +354, said in core_budget_test.go.

What was run:
- go test -count=1 -timeout 45m ./... on mote at 618bfc1a9 + these two
  commits: 102 packages ok; internal/tui red on TestEveryWordHasZh
  ("subagent pool", red on main, fixed by 6fbc24a05). After rebasing on
  origin/main c9e8422fa: internal/gui (budgets), tui, agent, testenv,
  gateway and provider: all ok. gofmt clean; GOOS=linux go vet -tags
  nogui ./... and GOOS=windows go vet ./... ok on mica.
- At 618bfc1a9 + these commits, on mote: provider-max-images 60/0,
  add-sheet 6/0, add-button 6/0, key-box-once 20/0, nokey-editor 4/0,
  provider-base-api 4/0, add-sheet-custom 32/0, kimi-subagent-pool
  20/0, sync-signins-except 20/0; old-webkit 4/2 (#6030 headerpresets,
  #5919), i18n-keys 3/1 (#6877), provider-max-output 4/20 (#6209),
  editor-hints 30/10 (the same at origin/main, in #6934).
- The whole GUI suite (1569 files, chromium + webkit, every language)
  on mote at the pre-fix head under another session's suite: 153 files
  red. Each red file rerun at the fixed head and at origin/main
  ad585ccd6 on mica (and mote for the close ones). Red at head only:
  add-button (Escape showed the discard confirm: the dirty draft, fixed),
  add-sheet and key-box-once (the null draft above, fixed); now 3/0,
  6/0, 20/0, provider-max-images 60/0. Every other red file is red the
  same at origin/main, the same subtests: filed with its numbers as
  #6934 (the #6782 class). i18n-keys' ", with an image" is #6877,
  old-webkit #6030/#5919, provider-max-output #6209.

Broken by hand (each red, then put back): the relay words left out
(TestImageCapLearnedFromRelayWords), per-model lookup by upstream name
gone (TestMaxImagesOnAModelListedByItsOwnID), a copy made when nothing
applies (TestImageCapNoneIsTheSameBytes), the learned cap over the
user's (TestMaxImagesStandsOverTheLearnedCap), the GUI save dropping it
(TestProviderSaveKeepsMaxImages), the CLI's empty value
(TestProviderSetMaxImages), the cap not moving with a local id, the JS
parse without its 1000 limit and the field not unfolding Advanced
(provider-max-images), and the draft written on open (provider-max-
images' Escape check, 20 red).

Not tried: no real 100milionseek or Coarena account (the words are the
reporter's literal ones); no GUI run on Windows or Linux; the suite's
GUI half ran under load, so many reds are shared timeouts.

Co-authored-by: ID-VerNe <yuu_seeing@foxmail.com>
2026-11-17 15:39:12 +08:00
ID-VerNe e049b5cd35 providers: a user-set cap on the images of one request (max-images)
100milionseek's and Coarena's APIs take at most 8 images a request, counted
over the whole conversation, and answer the ninth with a 400 of their own
words (#6849): "At most 8 images per request (MAX_IMAGES)." and "A request
may carry at most 8 images.". imageCapWords matches Copilot's wording
alone, so the cap is never learned there and every turn of a session that
has shown nine screens fails, with no way on but /clear.

`magpie provider set <id> max-images=<n>` sets the user's own cap. The
gateway fits a request over it before it is sent, the oldest images left
out for the line imageOverCap stands, exactly as the learned Copilot cap
does; no refusal is needed to know it. The user's number stands over a
cap Copilot's refusal taught the same provider. 0, the default, keeps
the learned path as it was. The provider editor has no field for it: a
GUI save keeps what the CLI set, as it keeps usefirst and standin.

What was run:
- gofmt -l internal/ (clean); go vet ./internal/gateway ./internal/cli
  ./internal/provider ./internal/gui (clean); GOOS=linux go vet ./...
  (only wails beta.24's own cross-compile errors, the same 12 as at the
  base commit 1bfc6378c)
- go test ./internal/gateway -run 'ImageCap|MaxImages|CopilotGemini'
  -count=1 (ok)
- go test ./internal/cli -run 'MaxImages|ProviderSet' -count=1 (ok)
- go test ./internal/gui -run 'TestProviderSaveKeepsMaxImages|
  TestEveryRouteIsNamedForTheCLI|TestSettingsSaveKeepsWhatItDoesNotSend|
  TestEveryWordHasZh' -count=1 (ok); go test . -run
  'TestNoEagerPackageRegexps' -count=1 (ok)
- full packages: ./internal/cli, ./internal/gateway, ./internal/provider,
  ./internal/gui at -timeout 45m/40m

Broken by hand: TestMaxImagesFitsBeforeSending was written asserting
three images left out of twelve against a cap of eight; it went red on
the correct code and was corrected to four, the count the body shows.
TestMaxImagesUnderCapUntouched first compared the bytes sent with the
bytes posted and went red because the gateway sends the vendor the
model's own id, not the provider-prefixed one; it now compares the
images and texts. Its second case first said "one history image and
eight latest" leaves the history image alone, which was wrong arithmetic
(nine minus one is eight, a fit); it now posts nine in the latest
message alone, where nothing can be left out.

Not tried: a real 100milionseek turn through the built gateway (the
provider serves from this machine; the probe in #6849 measured it on
/v1/messages directly). The learned-Copilot path is unchanged and its
tests pass as before. -race: this Windows box has no C compiler, so
-race doesn't build there; the MaxImages tests were run -count=5
instead. Full-suite reds on this machine, all reproduced at the base
commit 1bfc6378c with this change stashed, none in files this change
touches: internal/gateway (ClaudeAsRootEnv, HandedOver/HandedOff x5
("A device attached to the system is not functioning" on a TCP
handover), HubRootsOfACodexThread, MaskedRecordKeepsSentAndBack in a
full run only), internal/cli (healthcheck x2, library-project,
opencode-default, update-find: the real magpie running on 3425 and a
real OpenCode install), internal/provider (Codex keychain x11, priced
free, resolve x2, Qianwen, saved-but-signed-out, git-on-disk x2: real
proxy settings and Windows keychain), internal/gui
(GatewayHeldByAContainer: Windows file lock on magpie.exe;
LodyImportHandoff: %AppData% undefined), internal/agent (WorkBuddy,
Hermes x4, mise shim x2, DesktopHandler, Grok, Codex own-models,
AppliedOf, AsideOffline, ClaudeViaMagpieKept, ClaudeDesktopLanguage:
macOS-specific paths and real installs), build/darwin
(FreedHeap: darwin overlay build on Windows).
2026-11-17 15:18:24 +08:00
yetone ff88ec264a sync: subscriptions whose sign-ins stay on this computer (Ethereal499 on X)
Sync's sign-ins can now leave chosen subscriptions out on one computer
(`signInsExcept`, provider ids; Ethereal499 on X keeps Claude's accounts
off other computers). On that computer:

- its accounts of those subscriptions never go up;
- the server's accounts of them are never merged in, so a removal or a
  new account on another computer changes nothing here;
- the server keeps them as they are for the computers that do sync them
  (syncOnce splits the remote set with SignIns.Except and puts the held
  part back with With after the merge, so the hash doesn't change);
- the preview and Restore count and restore none of them.

An id names both the built-in and its -plugin id. An old config has no
field and syncs everything as before. The setup text doesn't carry the
choice, since it belongs to one computer.

GUI: Settings > Sync > edit > Advanced, under "Sign-ins", a "Not synced"
row with a multi-select openProtoMenu of the subscriptions with an
account. The row shows only while the sign-ins tick is on. The strings
already existed in en, zh, zh-TW, ja and de. CLI: `sign-ins-except=`
on the WebDAV, S3 and GitHub setups ("none" clears it), and status
shows the excluded ids. docs/subsystems/sync-backup.md says it.

Tests:
- TestSignInsExcept (provider) and TestSyncSignInsExcept (davsync, two
  computers on a fake DAV).
- sync-signins-except.test.cjs: both engines, 1100 and 420px, all 5
  languages.

Broken by hand, each red and then restored:
- the Except in collect;
- the Except on the remote set before the merge;
- the Except in the preview;
- the With after the merge;
- the GUI form's post of signInsExcept.

Run:
- At ac4a4cf84 on mote: `go test -timeout 45m ./...`, 102 packages ok,
  exit 0.
- At ac4a4cf84, the whole GUI suite on mote. The first part ran at
  concurrency 6 under load 25 to 37, and mote rebooted mid-run (not
  this session's doing). The 410 files it never reached ran at
  concurrency 4. Reds fell in 125 files, none of them a sync-* file
  except s3-sync (see below).
- At the rebased head b781d0bcb on mote:
  - go test ./internal/davsync ./internal/provider ./internal/cli
    ./internal/gui: ok.
  - Every sync-*.test.cjs, webdav-settings-refresh and
    sync-signins-except: ok.
- gofmt -l: clean.
- On mica: go vet ./..., GOOS=linux go vet -tags nogui ./... and
  GOOS=windows go vet ./... ok, plus go build, GOOS=linux go build
  -tags nogui and GOOS=windows go build.

Red the same on origin/main 873b1f7d5, run there alone:
- s3-sync webkit en ("picking S3 must not scroll the page"), #3413 and
  #2448.
- i18n-keys (", with an image" in plugins/routing), #6877.

Not run: the full Go suite at the rebased head. Another session's full
suite held mote, and mica was full. The 125 GUI files red under load
were not each run alone on main.

Not tried: a real sync between two computers with real accounts.
2026-11-17 14:08:48 +08:00
yetone ce16633367 tune: a Codex card locked by config.toml's own compact limit hands it to magpie on a click (sufeng1894 on X)
sufeng1894 asked why Codex's compaction threshold can no longer be set by
hand. The card said config.toml's model_auto_compact_token_limit wins, and
the background row said features.async_compaction's
model_async_compact_threshold_percent wins: both locked, and nothing on
the card did anything about it.

Cause. Only the old tune card (9e665491e to f20118304, 10-10 to 10-28)
wrote model_auto_compact_token_limit, stashing the user's own raw value;
the 10-28 migration puts that raw value back, which then locks the card.
So the values on the screen are the user's, or the user's restored by
that migration. A magpie-written value could have lost its stash through
stash.json races (before 270b52573), an unparsable stash (before
58651568b), tuneMigrateCodex forgetting the stash even when its file
write failed, and codexAsyncSync stashing only after every write. The
last two are fixed here: the migration forgets only after the write
succeeds, and codexAsyncSync records its stash in a defer right after
reading the old state, advancing it per successful write.

Change. A locked card shows one button, "Let magpie set it" (zh 交给
magpie 设置, zh-TW, ja, de), only when the user clicks. POST
/api/tune/takeover (TuneTakeOver):
- the file's limit moves into Long conversations by tuneMigrateCodex's
  rule (a lower Long the user has is kept), the key is deleted from
  config.toml with every other key kept, and the file value is stashed
  (tune.codex.compact_file); Undo puts Long back and writes the key back,
  unless the user changed Long since;
- a background threshold of the user's (enabled = true) is adopted as
  magpie's background share with its own Undo, which turns the share off
  and gives back the percent and enabled as they were. enabled = false
  is not taken.
Nothing removes the user's value without that click.

Run:
- internal/agent, internal/gui, internal/cli, internal/tune at the pushed
  head (rebased on ca87ae9c5) on mica: ok. TestCoreScriptBudget raised
  by 189 (the button, its post and Undo background), reason in the file.
- Full Go suite -timeout 45m on mica at the pre-rebase head (2ba62f7f7
  base): every package ok except TestCoreScriptBudget, since fixed.
- Broken by hand, red: migrate forgetting first (TestTuneCodexMigrateKeepsStash),
  asyncGiveBack disabled (TestTuneCodexTakeOverAsync), longUndo in place
  of codexLongUndo (TestTuneCodexTakeOver), and the GUI button disabled
  (context-tune, 11 red).
- context-tune, compact-one-value, codex-async-compact, i18n-keys at the
  pushed head on mica, Chromium and WebKit, every language, 360 and 1100:
  the new test passes; reds are codex-async-compact's zh/zh-TW "kept the
  share out" (4, the same at ca87ae9c5) and i18n-keys' routing plugin
  word (#6877).
- win-run TestTune|TestCodexAsync in agent and gui: ok. wsl-run vet and
  those tests with -tags nogui: ok. GOOS=windows go vet and GOOS=linux
  go vet -tags nogui: ok. gofmt -l: clean.
- make test-ui on mote, pre-rebase head, through header-centre (about a
  third; the rest still running when pushed): reds in 29 files, none a
  tune file. The first 16 (account-arrange to context-cap) were run
  alone at this head and at origin/main ca87ae9c5 on mica: the same
  reds at both (base has 4 more, in agent-own-direct), the #5475 class.
  The next 13 (ctx-session-line to header-centre) were run the same way at the pushed head: 59 red at head, 60 at ca87ae9c5, the same tests (header-centre's halfway case red in one engine at each).

Not tried: a real Codex session after the takeover; codexAsyncSync's
defer has no test with a failing write.
2026-11-17 06:39:40 +08:00
yetone dbbb2f26b1 groups: free: takes the models a catalog marks free (#5903)
A routing group's pattern may now start with free: (provider.FreePrefix):
free:workbuddy/* is, of the models workbuddy/* matches, those whose
catalog entry says free (Entry.Free, the vendor's or plugin's own flag as
the catalog was last read). The rest after free: is a glob, a re: pattern
or an id, matched as on its own, so free:re:workbuddy/hy.* works too. It
is expanded where every pattern is (matchesIn, PatternHits) each time the
groups are read, from the catalog magpie already keeps: no request to a
vendor, and a model the next list marks free joins without a save.

Only the flag decides. A $0 price (PricedFree), a rate of 0, an account
named Free or "free" in an id never counts; the test holds a
deepseek-v4-free id with no flag, a rate-0 model and an or/y priced at $0
out. Existing patterns read as before: openrouter/*:free still means ids
ending in :free (that is why the rule is a prefix, not a :free suffix),
and a provider's AutoInclude takes no free: (isIDPattern).

GUI: the Routing editor's pattern box counts and lists a free: rule live
as it does any pattern (patternTest in plugins/routing/client.js, from
groups.models' free), refuses "free:" alone, and one hint line says the
flag is the last catalog's, not a promise of no charge, in en, zh, zh-TW,
ja and de. CLI help, docs/subsystems/providers-accounts.md and the site's
routing-groups page (en, zh, ja) say the same.

routing-levels.test.cjs: the Advanced hint line made the editor taller,
so the second group's Levels row opened under the editor's sticky foot
and the click landed on the foot (webkit en). The test already wheels to
that row for its first group; it now does for the second too.

Run:
- TestGroupFreeRule, TestFreeRuleSyntax and the existing pattern tests
  pass. Broken by hand: with groupmatch.go and autolist.go from
  origin/main both are red (no members for free:workbuddy/*, IsPattern);
  with takes() ignoring the flag, TestGroupFreeRule is red (all six
  WorkBuddy models matched).
- group-free-rule.test.cjs (new): chromium and webkit, en and zh,
  green; red with origin/main's client.js.
- go vet ./... (darwin, mica), GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: clean. gofmt -l: nothing.
- Full suite go test -tags nogui -timeout 45m ./... on Linux (WSL
  magpie-desktop) at 1e180c630 (this change on ac4a4cf84): 102 ok, no
  FAIL. Not run whole on macOS: mote had another session's GUI suite
  and mica's disk was full (2 GB free; a run there failed on "no space
  left on device").
- At the pushed head 6801ae683 on Linux: internal/provider, cli,
  plugin, agent, gui packages; group-free-rule, group-patterns,
  routing-levels, gui-zh-tw, gui-ja, gui-de: all ok, 21 tests pass.
- GUI: the 182 files that reach the Routing page or i18n, on Linux at
  d55680755's tree: 2805 pass, 112 fail in 21 files. The same 21 run on
  origin/main cb4ad12bd: 102 fail in 18 of them. The three red only
  here (input-look, search-keys, routing-levels) were rerun at
  concurrency 2: input-look and search-keys green, routing-levels red
  from this change and fixed above (green 2 of 2). Reds on main, filed:
  group-editor-selected #5049, i18n-keys #6877, codex-memories-settings
  #6372, inner-scroll-contain #4689, grip-inset #6293, and the rest in
  #4120's class; form-align newly filed as #6894.

Not tried: a real WorkBuddy account's catalog (the flags come from the
plugin's list, as the test's fixture has them); the GUI files on macOS.
2026-11-17 02:19:48 +08:00
yetone 8707ea7757 gateway: Codex's prompt suggestions go on a model set for them (@0xcb198609 on X)
The Codex app's home-page prompt suggestions (thread_source
ambient_suggestions, and their safety check, ambient_suggestion_safety;
the Routing page's 提示词建议) are a background agentic turn that reads
the project and connected apps. The app asks for the model its server
config names (codex-app-model-routing's
codex_ambient_suggestions_model_slug, gpt-6-luna) with provider model
fallback on, so with magpie as Codex's provider they ran on the
provider's default model, often auto: @0xcb198609 saw 76.9k tokens in
113s on deepseek-v4-pro. Codex has no config.toml key for that model,
only an on/off switch in the app (store key ambient-suggestions-enabled,
Settings › Configuration › Homepage suggestions; read from the 26.1106
bundle).

magpie now has a setting for it, "Codex prompt suggestions" in Codex's
row on the Agents page (Settings, beside Codex composer predictions):
- Empty, the default, is Codex's own pick: nothing moves. A value the
  user set is never overridden.
- A model or group of magpie's puts both calls there: in serve as the
  codex-suggestions move (the Routing page says why), and on the ChatGPT
  backend's route before the split, carrying the asked model to serve so
  the trace and ledger keep it. codexOwnOffMagpie leaves a bare
  gpt-6-luna to magpie while the setting is on (codexSideSet).
- A target that is disabled, unserved or not allowed to the gateway key
  leaves the call as asked, with a log line (compactRefused).
- To fit app.js's script budget without raising it, the suggestions and
  auto-review pickers share codexPick with codexSidePick, and every
  Codex row's button comes from condButton. The new route is named for
  the CLI (settings_parity_test.go). agent-prefs and settings-general
  list the new row.
- The row's tooltip and the Routing page's Suggestions story say where
  Codex turns them off. magpie's old story said "Suggested prompts",
  which the current app no longer shows; corrected in all five languages
  from the app's own locale files.

Run (mote, at this head rebased on e25210b6e):
- go test -timeout 45m ./...: ok, every package (101). A first run
  at e97271f02 had cli and gui red on the CLI-parity guard and
  TestCoreScriptBudget; both fixed here, without raising the budget.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./...: clean. gofmt -l: clean.
- TestCodexSuggestionsMoved/Left/MovedOffChatGPT/ModelRefusesBareName,
  TestCodexSuggestionsSetting: ok.
- GUI: codex-suggestions (new), codex-predictions, codex-auto-review,
  routing-kind, i18n-keys: 58/58 ok before the rebase; at this head
  codex-suggestions, i18n-keys, agent-prefs, routing-kind 84/84 ok.
  Every GUI file that opens Codex's row or the Routing kind stories
  (26) ran too: red only in codex-async-compact (zh, zh-TW) and
  codex-memories-settings (chromium scroll), both red the same on
  origin/main e25210b6e and filed as #6658 and #6372.
- Rebased last onto 90d54a267 (internal/sessions and internal/usage
  only): internal/sessions, internal/usage, TestCoreScriptBudget, the
  route guards and the CodexSuggestions tests ok again there.

Broken by hand: codexSuggestionsTo returning "" and codexSideSet's new
case off: TestCodexSuggestionsMoved red (m1 sent, and a 404 "magpie
knows no model gpt-6-luna"), TestCodexSuggestionsMovedOffChatGPT red.

Not tried: a real Codex app's prompt suggestions against magpie (no
Codex.app here or on mote); the whole GUI suite (only the files that
open Codex's row, its settings or the Routing kind stories).
2026-11-16 18:59:40 +08:00
yetone 19794cc10c serve: a headless magpie follows a Remote magpie's agent picks (KoiLx0 on X)
v0.1.4298 made a client magpie follow the models a Remote magpie's
agents are on (agent.FollowRemotePicks), but only the app's Library loop
(library.KeepLinked) ran it. `magpie serve` and `magpie serve --web`
followed the remote's model list and efforts (the long-poll in the
gateway) and never a pick changed on the remote. Both now run
agent.KeepFollowingRemote, which calls FollowRemotePicks every 30s; it
still asks the remote at most every 5 minutes, and only while a Remote
magpie is added.

Run at this head, on mica:
- go test -timeout 45m ./internal/agent/ ./internal/cli/: ok
- go vet; GOOS=linux go vet -tags nogui; GOOS=windows go vet: ok
- Real use: two sandbox magpies (R with a fake OpenAI upstream and a
  gateway key, C with R as remote-magpie "office"), both `magpie serve`.
  Claude Code connected on R to openai/gpt-5.5: C recorded
  claude.model.remote at start. R's Claude Code moved to
  openai/gpt-5.4-mini at 15:41; C's ~/.claude/settings.json followed
  at 15:45:49 (the 5-minute step). Efforts set on R (low,high) and a new
  upstream model reached C's /v1/models, Codex's magpie-models.json and
  Claude Code's model list within seconds to about a minute, before and
  after this change.

Not broken by hand: the loop is a ticker around FollowRemotePicks, whose
following is covered by remote_picks_test.go.

Not tried: Windows and Linux real boxes.
2026-11-16 15:46:21 +08:00
yetone 9dcec67513 archive: the request archive in an S3 bucket is kept under a GiB, oldest calls removed
An R2 user on X: the sync bucket grew by 18 GB in under a month. The
backup and usage files are small and rewritten in place; what grew was
the request archive, every call written whole (bodies up to 32 MiB) as
archive/<date>/<id>.json and never removed. The archive on this computer
is capped at a GiB; the one in the bucket had no cap.

Now the bucket's archive is held to RequestArchiveMB (a GiB unless set,
carried by sync), down to a tenth under it past the cap, oldest first:
- only keys of ArchiveName's own shape under <prefix>/magpie/archive/
  are counted or removed; the backup, usage, other prefixes and anything
  else in the bucket are never touched (a test seeds seven such keys);
- uploads are counted as they go, and the bucket is listed again only
  after a tenth of the cap more is uploaded: one LIST for ~1000 calls,
  never one per call;
- the serving magpie lists once two minutes after it starts, archive on
  or off, so a bucket grown before this update is brought under the cap
  without the user doing anything (auto-cleanup chosen over a button:
  the objects are magpie's own, already capped locally, and a removal
  is logged);
- the Usage page's switch tooltip says the size ("…in <bucket>, up to
  1.1 GB"), in every language; the core script budget is kept, not
  raised: the two tooltips share one options object and the switch's
  aria-checked is set from a boolean.

The Nov 3 rise in Class B reads has no code cause found: archive reads
are click-driven only, and the backup's conditional GET runs every 3
minutes per computer online.

Red on the old logic (bucketAdded and KeepBucketArchiveBounded made
no-ops by hand, on mica): TestRequestArchiveKeptUnderItsSize "after 200
calls the archive holds 248 calls, 7629310 bytes, over its 1048576 (48
from 2020 left); 0 LISTs, 0 DELETEs"; TestBucketArchiveBroughtUnderIts
SizeAtStart keeps 30 calls / 3000 bytes; TestBucketArchiveListedPer
TenthUploaded "0 LISTs". With the fix: "200 calls: 44 kept, 986389
bytes; 4461157 bytes uploaded, 39 LISTs, 203 DELETEs".

Run at this tree (rebased on c6a67dd41):
- mote: gofmt -l internal clean; go test -timeout 45m -count=1
  ./internal/davsync ./internal/gateway ./internal/settings
  ./internal/settingsapi ./internal/cli: all ok (gateway 897s).
- mica: go test ./internal/gui ok (TestCoreScriptBudget included);
  GOOS=windows go vet of the six touched packages ok; GOOS=linux go vet
  of davsync, gateway, settings, settingsapi ok (gui and cli need
  WebKitGTK's cgo, not vetted for Linux).
- mica GUI, Chromium and WebKit, every language: request-archive,
  request-archive-usage, i18n-keys, i18n-en-no-cjk 22/22 at this tree;
  with call-headers, context-text, routing-bodies, routing-side-calls,
  usage-ledger-search and web-page 114/114 before the tooltip's last
  wording change.

Not tried: a real R2 or S3 bucket (fake S3 only), and the reporter's
own bucket contents.
2026-11-16 11:25:30 +08:00
yetone 64c4261582 sessions: search what was said in every agent's sessions, from the page and an MCP server
cryingLiu on X asked to search the chat history of every agent magpie
reads sessions from: prompts and replies, from one place.

What the user gets:
- The Sessions page's search also lists, under the agent's own list,
  the other agents' sessions whose conversation says the words, each
  with a snippet. A hit opens the conversation in the sheet at the
  message that said it (transcript?find=), with "N earlier messages
  not shown"; the page itself never scrolls. While the index is still
  being built the head says "Indexing sessions…" or "Indexing N of M
  sessions…", and the page asks again every 3s until it is done.
- Magpie Sessions, a built-in MCP server in Library → MCP (Discover),
  opt in per agent like the other magpie servers. Its tools are
  search_sessions(query, agent?, limit) and read_session(id, around?),
  both returning text. It runs as `magpie mcp sessions` over stdio and
  reaches the gateway's /mcp/magpie/sessions, which serves only local
  callers that are not browsers.

How it works:
- internal/sessions/said_index.go keeps said-v1.db beside sessions.json:
  a contentless SQLite FTS5 index (detail=none) of the words each
  session says. It is built from the sessions list sessions already
  caches and refreshed at most every 10s: a new or rewritten file is
  read once, a grown Claude Code or Codex file only from where it ended,
  and a gone one is forgotten. A query asks the index which sessions
  have every word, then reads only those files for the snippet, for at
  most 6s. A search waits up to 2s for a refresh. While the first
  listing is still running the answer says `listing`, so an empty first
  answer is not read as "no session says it".
- Privacy: only agents sessions.Reads allows are indexed or searched;
  nothing is read until the user has answered the sessions question,
  and in gateway mode no agent's own files are read (the page doesn't
  ask). Reset forgets the index.
- /api/sessions/said for the page; the CLI parity list names it.

Run, at this tree (rebased on origin/main 256910f17):
- gofmt -l clean; go vet on mote for darwin, GOOS=linux -tags nogui
  and GOOS=windows: ok.
- go test -tags nogui ./... -timeout 45m on the WSL Linux box:
  every package ok at c8e445c4b (the tree before the one-hit wording,
  whose gateway tests ran again on mote: ok).
- GUI: the whole suite on mica at this head was still running when
  this was pushed (owner: never hold a verified change behind a full
  suite). Under mica's load, beside another session's full suite, 90
  tests had failed so far, all in files this change doesn't touch
  (accounts, Details, keys, plugins, providers); none in sessions,
  library or i18n. The files this change reaches passed on their own
  (below).
- Focused, green: internal/sessions (Said*, TranscriptAt),
  internal/gateway (SessionsMCP*, own MCP, read-only, key slots),
  internal/library (market, opt in), internal/gui (Said, Sessions,
  gateway mode); GUI sessions-said, sessions-search, library-sessions-mcp,
  vision-mcp-library, library-browser-setup and i18n-keys in chromium
  and webkit, every language, wide and narrow.
- Broken by hand, one at a time, each red and green restored: the
  index's Listing left out (TestSearchSaidWhileTheSessionsAreFound red
  in 2.5s); the page ignoring `listing` (sessions-said 6 of 7 red); the
  MCP's local/browser guard (TestSessionsMCPOnlyForAgentsHere red); the
  server's opt in (TestSessionsServerInDiscover red); every Reads check
  on the search path, the index's and SearchSession's together
  (TestSearchSaidLeavesOutAgentsNotRead red). With those gone the
  gateway-mode GUI test stays green, because the sessions listing
  leaves an unread agent out before the index sees it.
- Real use, in a sandbox HOME with GOPATH, GOMODCACHE and GOCACHE
  pinned, over the real history through symlinks (29 GB Claude Code,
  60 GB Codex, 14,102 sessions), sessions reads set to all in the
  sandbox: first listing ~60s cold (answers say still being found),
  whole index built in 9m50s while queries answered in ~6s each, index
  38 MB, a common word 4.9s and a rare word 1.0s warm, read_session at
  the words of a huge session 1.8s, peak footprint 442 MB for the whole
  process with the sessions cache. Nothing was written under the real
  ~/.claude or ~/.codex.
- The real binary end to end on mote, in a sandbox HOME: `magpie serve`
  on a free port and `magpie mcp sessions` over stdio with
  MAGPIE_GATEWAY, against a Claude Code session written there:
  initialize, tools/list, search_sessions found it with its snippet,
  read_session at the words started 3 messages before them, a word
  nowhere said "No session says", and a POST with a web page's Origin
  was refused 403. That run is how "1 sessions say" was found and
  made "1 session says" (TestSessionsMCPSearch red before, green after).

Not tried: a real agent (Claude Code, Codex) calling the server it was
given from the Library, and the page against a real backend (the GUI
tests fake the API). The index on Windows and Linux ran only through
the Go suite.
2026-11-16 07:19:18 +08:00
yetone 8f3f7a46af provider: Baidu Qianfan's Token Plan Personal shows its month through a console sign-in (yuushabu_buyinn on X, #5860)
A Qianfan Token Plan key tells nothing of the plan's usage: Qianfan's
OpenAPI has no read for it, and the console's own page asks
console.bce.baidu.com/api/qianfan/charge/tokenPlanPersonal/resource with
the signed-in cookie. So the plan is read as StepFun's Step Plan is: the
editor of a provider at qianfan.baidubce.com/v2/tokenplan/personal has a
"Token Plan usage" field, drawn by the same renderStepPlan (now told
whose sign-in it brings) from qianfanplan.js, imported when such an
editor opens. The bookmarklet, run on the console, checks the session
with that same request and copies the console cookie; a raw Cookie
header or a copied cURL is taken too, since document.cookie leaves out
HttpOnly cookies. The paste is checked with a real read before it is
kept, by provider id, in qianfan-auth.json (0600, lastgood-guarded,
moved and dropped with the provider). POST /api/qianfan/{id}/session and
/signout serve it.

The Usage page's card (qianfanPlanQuotas in PlanQuotas) is the running
plan's credits (billingMode credit) or tokens as one Month window up to
expiresAt, the plan's tier as its name and auto-renew beside it;
released and past plans are skipped, and routing reads the same windows
(accountPlanWindows). A redirect, 401, 403, an HTML page or a refusal
naming the login is a signed-out session: an error card saying so, never
0 left; any other failure is an error card too, the last reading kept
only on a passing network error. The per-plan apiKey in the console's
reply is never kept, logged or shown.

Not done: the Enterprise (team) plan has no card. The console has no
tokenPlanTeam/resource; it reads team plans through seat and admin APIs.

Not tried with a real account: no one here is signed in to Baidu Cloud's
console, and #5860 has no reply bytes posted. The fixtures follow the
field names in the console's own script bundle and in the
dsh-qianfan-token-plan reader (planType, resourceStatus, billingMode,
usedCredits/totalCredits, usedTokens/totalTokens as numbers or strings,
expiresAt, autoRenew), not a captured reply.

core budget +35 (app.js and core): the field moved to qianfanplan.js;
what is left in the core is the import and two quotaError lines.

Run (at the pushed tree, rebased on origin/main 8df7885d4):
- mote: go test -count=1 -timeout 45m ./internal/provider ./internal/gui
  ./internal/cli: ok (provider 279s, gui 209s, cli 113s)
- mote: GOOS=linux and GOOS=windows go vet of the three (linux with -tags nogui): clean
- gofmt -l internal/: empty
- mica: node --test qianfan-plan, stepfun-per-provider, qianwen-plan,
  i18n-keys, i18n-en-no-cjk, old-webkit (Chromium and WebKit, en and zh;
  i18n-keys over zh, zh-TW, ja, de): 40 of 42 pass. The two reds are
  old-webkit's headerpresets.js (#6030) and app.css :has() (#5919), the
  same on origin/main 8df7885d4, run there.
- Red before: qianfan-plan.test.cjs on origin/main 8df7885d4, 4 of 4 red
  (no field). Broken by hand on mica: with a
  redirect not read as signed out and Released not skipped,
  TestReadQianfanPlan, TestSaveQianfanPaste and TestQianfanPlanCard go red.
- Not run: the whole Go suite and the whole GUI suite.
2026-11-16 01:54:28 +08:00
yetone ec5b96c44f cli test: POST /api/quit/disconnect is the window's own (#6786)
261f48226 added the Quit question's Disconnect and quit route without naming it in the CLI parity list, and TestEveryRouteHasACommandOrIsNamed has been red on main since (CI at 0ffb21f83, ubuntu and macOS). It quits the app, so it is the window's own, beside GET /api/quit.

Run at origin/main f9807c5e8 plus this: go test -tags nogui -count=1 -run TestEveryRouteHasACommandOrIsNamed ./internal/cli on mote ok (red at 0ffb21f83 on CI); the whole internal/cli package on mica ok (44s). gofmt -l clean.
2026-11-16 01:12:39 +08:00
yetone 2649d5d727 agents: Dim alpha (dima) is an agent, started on magpie's gateway (T_t__biu on X)
Dim alpha (arcships/dim, npm dimcode-alpha, command dima) gets a row on
the Agents page. Picking a magpie model there starts dima with the
variables Dim documents for any OpenAI-compatible endpoint
(docs/design/model-startup.md): DIM_BASE_URL (gateway /v1),
DIM_API_FORMAT=openai-compatible, DIM_API_KEY (magpie-dim), DIM_MODEL
and both DIM_MAX_*_TOKENS (the catalog's, else 128000/32000). They hold
for that run only; Dim's saved Providers, settings and database are not
written. The pick is in magpie's own dim.json; a dima function in the
user's shell profiles runs `magpie dim run`, and the row gives the
command for an open terminal. Picking Dim's own (or Disconnect) removes
both. Nothing signs in to, reads or proxies Dim's own account or the
DimAgent subscription (removed at its vendor's request, v0.1.471).

Run:
- mica, at this tree (rebased on 574b7b96f): gofmt -l clean; go vet (darwin), GOOS=linux
  -tags nogui and GOOS=windows go vet of internal/agent, cli, agentenv;
  go test -tags nogui -count=1 -timeout 45m ./... -> ok, 101 packages. An earlier run on mote
  was red in internal/library's TestEveryAgentInLibrary (dim had no
  Library place); dim is now in noLibrary as "not looked at (#5897)".
- Broken by hand: DIM_API_FORMAT=openai-chat turns TestDim and
  TestDimRun red; dropping shell(false) turns TestDim red (function
  kept in .zshrc).
- Real dima 0.1.0-alpha.24 on mote, sandbox HOME, sandbox magpie serve
  on 127.0.0.1:38600 with a fake OpenAI upstream: `magpie dim
  magpie/fakeup/echo-1` wrote dim.json and the .zshrc function; `zsh -ic
  'dima exec -p "reply with one word"'` answered through the gateway
  (upstream got POST /v1/chat/completions, model echo-1); usage.jsonl
  recorded agent "dim"; `magpie dim default` removed the file and the
  function, and dima ran as npm installed it. Dim's home was never
  written by magpie.

Not tried: a real model provider (only the fake upstream); Windows and
WSL runs (the shell function is this machine's home only, no WSL
distro support); a Library target (skills, MCP, instructions; #5897); Dim's interactive TUI beyond
exec -p and --version.
2026-11-15 17:16:57 +08:00
yetone 02f1cee794 plugin: a plugin installs the vendor CLI it signs in through (niuniu_8964 on X)
agy-cli signs in and serves requests through Google's agy CLI. In magpie's
Docker image there is none, so its sign-in failed with "agy CLI not found"
and the user had to get a shell in the container and install it by hand,
where it lived outside the volume. Claude's sign-in already installs
claude when it is missing ("Installing Claude Code…"); a plugin had no way
to say it needs a CLI.

A plugin now declares its CLI as auth.cli = {name, manual, installed(),
install({signal})}. The host lists it as Provider.CLI and answers two new
calls, cliInstalled and installCli (run through the provider's proxy, and
given up when magpie gives up). pluginCLI returns that CLI when it isn't
installed, so the plugin's sign-in goes through the same "installing"
state as Claude's: the Providers sheet shows "Installing Antigravity CLI…",
then the sign-in link; a failed install names its cause and the plugin's
manual command. `magpie plugin login` does the same in a terminal. An
answer magpie can't get (host down, a timeout) counts as installed, so a
plugin is never reinstalled for a failed read.

The agy-cli side (installing agy into the data folder, which is on the
container's volume, and keeping that copy current) is in
magpie-community/plugins.

Run, at this head (rebased on 60ebaea03), on mica:
- go test ./internal/cli ./internal/plugin ./internal/provider ./internal/gui: ok
- GOOS=linux (-tags nogui) and GOOS=windows go vet of plugin, provider, cli: ok; gofmt clean
- TestPluginSignInInstallsItsCLI red on the old pluginSignIn (no CLI found,
  straight to waiting), green now. TestPluginInstallsItsCLI covers the host
  calls: listing, a refused install, an install given up, a good one.

Real use, magpie's Dockerfile built on xiaomi-gpu (Docker Desktop, linux
amd64), volume on /config, agy-cli loaded from its working tree:
- `magpie plugin login agy-cli 1`: "Installing it…", agy 1.5.9 downloaded
  to /config/data/magpie-agy-cli/agy, then agy's Google sign-in link.
- restart: agy still there and runs.
- `magpie web` in the container, agy removed, POST /api/plugin-signin:
  state installing ("Antigravity CLI"), then waiting with the link.
- agy.version set back to 1.5.0 and restarted: the plugin updated its copy
  a minute later.

Not tried: finishing a Google sign-in in the container (no keyring there;
agy-cli's file sign-in is the path), a real install on macOS, Windows or a
musl Linux, and the full suite.
2026-11-15 14:52:48 +08:00
yetone 60ebaea033 claude: the newest Claude Code on the machine runs, and an old one's sign-in says it is too old (zi_xiang5806 on X)
zi_xiang5806's in-magpie Claude sign-in ended "Sign-in didn't finish":
the claude magpie ran was an npm 2.1.38 first on PATH, which has no
`auth login --claudeai` ("error: unknown option '--claudeai'"), while
`claude update` had installed 2.1.325 into another Node after it.

- proc.FindTools lists every `claude` (each PATH folder, then where
  installers put it), deduped by real path, cached like FindTool.
- claudecode.Own (behind claudecode.Find, so the sign-in, the gateway's
  bridge, bili, keep and `magpie claude-code` all get it) runs the
  newest. The first on PATH is passed over only for one whose version
  is known and newer; an unreadable version is unknown, not old.
  Versions are read first where each is installed, running nothing
  (npm package.json via proc.PackageVersion, the native installer's
  versions/<v>, Homebrew's Caskroom/claude-code/<v>); only when one is
  known that way is another asked --version (VersionOf, kept per file
  until it changes, an unknown for a minute). With one claude, or none
  known, nothing is run.
- A sign-in whose claude says "unknown option"/"unknown command" now
  says Claude Code is too old, with its version and path, and to run
  `claude update` (or npm install -g @anthropic-ai/claude-code@latest).

Tests: TestClaudeSignInRunsTheNewestClaudeCode and
TestClaudeSignInSaysClaudeCodeIsTooOld put two fake npm-layout claudes
(2.1.38 first, 2.1.325 second) on PATH in a sandbox HOME; both were red
with Find reverted to the first on PATH (the first with the reporter's
exact "unknown option '--claudeai'"). TestOwn*, TestInstalledVersion,
TestFindTools.

Run at base 96d1b93b2 (the 5 commits rebased over touch none of these
files): full `go test -count=1 -timeout 45m ./...` on mote, 101 ok,
exit 0 (internal/gateway ok 1036s; an earlier version that ran
--version on every candidate turned ~20 gateway Claude bridge tests red
through their fake claude, which is why nothing is run when no version
is known where it is installed). claudecode, proc and provider
TestClaudeSignIn also ok on wsl-run (Linux) and claudecode on win-run;
GOOS=linux and GOOS=windows go vet of proc, claudecode, provider ok;
gofmt clean.

Not tried: a real sign-in with a real old CLI and account; WSL's
too-old message; the Agents page still shows the first on PATH.
2026-11-15 14:30:16 +08:00
yetone b466aa2803 update: a Daily channel, one release a day that passed its tests, for the app and Docker (fishmagic80 on X)
fishmagic80 on X: Stable is too slow (community plugins need a newer
magpie than it has), every release is too fast, and Docker users have
nothing in between. Daily sits between them.

What it is:
- site/worker.js keepDaily: at the daily cut (20:00 UTC, the quarter-hour
  cron) the newest tag whose commit has a successful Test run and whose
  release has all 17 assets is picked and kept in LEDGER "daily". A day
  with none keeps the day before's; a failed GitHub read writes nothing.
  /api/latest?channel=daily (503 until a pick exists), /download/daily/<p>,
  and an urgent release overlays it as on Stable.
- .github/workflows/docker-daily.yml reads that feed and points
  ghcr.io/yetone/magpie:daily at the picked version's image.
- App: settings.UpdateDaily ("daily"); update.Channel()/Picked() (Stable()
  kept); the feed is asked channel=daily, never falls back to GitHub's
  latest, What's new lists every change since yours. Settings > About >
  Update channel has Every version / Daily / Stable; the version row says
  "Up to date on Daily (· {v} is out on Every version)". CLI: magpie
  update channel [stable|daily|every].
- Words in en, zh, zh-TW, ja, de, on top of 7f832b2f2's 尝鲜版/搶先版/先行版
  for Every version (kept as it landed).
- The channel row wraps its switch under its name when narrow (ja at
  420px was 18px past the window with three segments).
- app.js budget +338: the segment, its line and the two Up to date on
  Daily words, packed to one t() per choice; Settings and renderUpdate
  draw on every window, nothing lazy to move them to.
- Docs: docs/reference.md, site docs (docker, privacy in en/zh/ja),
  llms-full.txt, search indexes.

Red on the old code (a daily-old worktree, then only settings allowing
"daily"): the feed was not asked channel=daily, 40 notes instead of all,
Picked false, notesKey "zh" not "zh|daily", the Daily row showed
"available"; the GUI tests had no Daily segment.

Run on mote at this commit's tree (on origin/main ec1a1a7a5; the Daily pick itself is live on the deployed worker: /api/latest?channel=daily answers 0.1.4171, /download/daily 302s to its dmg):
- go test -count=1 ./internal/settings ./internal/settingsapi
  ./internal/update ./internal/cli ./internal/gui: all ok (TestCoreScriptBudget
  included).
- GUI, chromium and webkit, every language: update-*.test.cjs (22 files),
  i18n-*.test.cjs, settings-search.test.cjs: 554 of 554 pass.
- site: node --test site/*.test.mjs, 132 of 132 (130 before the rebuild).
- gofmt -l clean; go vet darwin, windows (gui/update/cli) and
  GOOS=linux -tags nogui.

Also: site/public/search/*.json and llms-full.txt rebuilt
(search-index.mjs, llms-full.mjs); they still listed Antigravity's old
sign-in after 9cd5f3652, so the two site freshness tests were red.

Filed: #6730, engines.magpie is never read, so a plugin needing a newer
magpie installs on Stable (0.1.3078) and fails without saying why
(page-amp-usage >=0.1.3681, middleware-company-guard >=0.1.3841,
page-day-card >=0.1.3427).

Not tried: a real self-update on Daily, a real docker-daily workflow run,
the whole GUI suite, the worker's unauthenticated GitHub reads under a
rate limit.
2026-11-15 13:10:18 +08:00
yetone ec1a1a7a55 library: import the slash commands the agents already have
miantiao_me on X (after v0.1.4189): 「之前在 Pi 定义的可以导入吗?」. Library ›
Slash commands now has a "Find in agents" card at the top. It reads the
command files each agent already has, from the same places magpie writes
them (Pi prompts/*.md, Claude commands/*.md, OpenCode command/ and
commands/, Gemini and Qwen .toml, Qwen .md, Droid), and lists them to
import, the way Subagents' import does.

- Parsing: frontmatter description plus body; for TOML, description and
  prompt. Arguments go back to magpie's form: Claude's $ARGUMENTS[n] and
  $n (0-based) become $n+1, Gemini/Qwen {{args}} becomes $ARGUMENTS,
  Pi's $@ becomes $ARGUMENTS (${@:N} is left as written).
- Files magpie wrote itself are skipped. The same content in several
  agents is one command; a name with different bodies per agent shows
  "Differs by agent" and one of them is picked; a name the library has
  with other content is "Name taken" and can't be picked.
- An imported command keeps its source agents ticked, and magpie adopts
  each original file byte for byte (Command.Taken): sync writes the same
  bytes at the same path, so the file is never doubled or rewritten.
  After an edit the agent gets magpie's render at that path; a rename
  drops Taken. Taken never leaves the machine (Collect strips it, Put
  keeps the local one).
- API: POST /api/library/commands/probe, and commands/import through
  the library change route. internal/cli's parity test names the probe
  as stage 3, like subagents/probe.
- Docs: docs/subsystems/library.md has the new row.

Run at 039e25752 (on origin/main dd89f1255), on mote:
- go test ./internal/library/ ./internal/cli/: ok. ./internal/gui/: only
  TestCoreScriptBudget red (app.js 10 bytes over), red on main, #6733;
  this commit doesn't touch app.js.
- gofmt clean; GOOS=linux and GOOS=windows go vet -tags nogui ./...: ok
  (at fb01ae2bb, base 028b07b4b; the two later main commits are Windows
  hook code in internal/gui).
- GUI: library-commands-import (new: chromium + webkit, en/zh/zh-TW/ja/de,
  420 and 1100 wide, no sideways scroll, press stays in place),
  library-commands, library-subagents-import, i18n-keys, i18n-en-no-cjk:
  64 of 64.
Earlier, at 1a70f31b6 (base 6af327e2b):
- go test -timeout 45m ./...: every package ok except internal/cli's
  TestEveryRouteHasACommandOrIsNamed, which named the missing probe route;
  fixed here and green since.
- Whole GUI suite (--test-concurrency=8, mote at load 17 to 44 with
  another session's go suite and GUI runs): 26887 pass, 1005 fail in 109
  files, none of them library-commands. The 109 files run alone at
  99719df19 and at origin/main 5bd41301b: 1145/996 vs 1144/997, the
  same tests red apart from language/width variants that flip between
  runs. Recorded on #6709.
Tests use a sandbox HOME with real Pi prompt files from Pi's repo
(internal/library/testdata/pi-prompts). Broken by hand: with syncCommands'
Taken branch off, all four import tests go red ("has a slash command of
its own"); with Put's Taken keep off, TestCommandImportNotCarried goes red.
Not tried: a real Pi install on a live HOME (by rule), or Windows/Linux
runs of the Go tests.
2026-11-15 12:59:12 +08:00
yetone 72418591f0 cli tests: POST /api/warm-all is named with warm-now, as stage 3 (#6724)
5bd41301b added POST /api/warm-all (All accounts warms every account in
use) and left TestEveryRouteHasACommandOrIsNamed red: the route had no
command and no name. Its sibling POST /api/warm-now waits for a command
in stage 3; warm-all goes beside it the same way.

Run (mica, at origin/main 62ced98cc): go test ./internal/cli/ ok (43s).
Broken by hand (the line taken out): TestEveryRouteHasACommandOrIsNamed
red, as on 5bd41301b. gofmt -l clean.
Not run: the full ./... suite (a one-line test-table entry).
2026-11-15 12:30:18 +08:00
yetone 142994b21c web: magpie web reaps the processes it adopts, as magpie serve does (swang20201 on X)
The Docker docs run `magpie web --addr 0.0.0.0:3430 --no-open`, so in a
container without an init `magpie web` is PID 1 and adopts every orphan.
382c8c0bd made `serve` reap them (proc.KeepReaping) and left `web` out.
A plugin's backend whose host had ended (magpie-gemini-web's
aistudio2api) then stayed <defunct> under magpie for good, and the
plugin, asking kill(pid, 0), took it for still running and refused
every restart.

Run:
- TestLongRunningCommandsReap (internal/cli): serveCmd and webCmd each
  call proc.KeepReaping. Red with origin/main's web_cli.go, green here.
- Real use on Linux (WSL2 Ubuntu 24.04, `unshare -Urpf --mount-proc`
  so magpie is PID 1, sandbox HOME), an orphan left in the namespace
  that exits after 1s: on origin/main `web` still had 1 zombie after
  12s, `serve` 0; with this change both have 0.
- go test ./internal/cli -run TestLongRunningCommandsReap on mica.
- Full suite (-timeout 45m) and GOOS=linux/windows go vet on mica:
  started at this tree before the push; result follows.

Not tried: the reporter's container itself. The plugin's own check is
fixed in BUKOWSKIREAL/magpie-gemini-web#59; the plugins repo's 18
siblings are magpie-community/plugins#1164.
2026-11-15 04:52:55 +08:00
yetone 6256d9956a gateway keys: a limit can follow a subscription account's own window (ljayic on X)
A key's limit gains the period "account": it names one subscription
account ("<provider>/<user>") and one of its windows (5h, Weekly, Monthly,
...), and starts and resets when that account's window does, at the reset
time in the account's last good reading (quotas.json), never asked of the
vendor on the request's path (provider.AccountWindow).

When the window can't be read (no reading yet, no such window, or its reset
has passed with no reading since), the limit is "reset unknown": it is
neither reset nor lifted. It counts from the latest time the window can't
have begun before (the reset that passed, else when the limit was set), so
it counts at least the window's calls; a refused call gets Retry-After 300
and a 429 saying the window can't be read now, and the accounts are read
again in the background at most once a minute.

GUI: Gateway keys -> a key's limit -> Window -> "An account's window", then
an app-menu picker of the accounts' windows as read (GET
/api/caller-keys/account-windows); the row reads "$x / $y · 5h of
codex/...", and an unknown reset reads "resets with the account's window".
CLI: magpie gateway-key limit <id> account --account codex/me@example.com
--window 5h --tokens 2m. i18n zh, zh-TW, ja, de. reference.md and
gateway-routing.md say it, with the fallback.

Run (at this tree, base ec8125e68, rebased onto 1ac137e10 which touches
none of these files):
- gofmt -l clean; go vet darwin, linux (-tags nogui), windows clean (mica).
- go test -count=1: internal/access, internal/budget, internal/provider,
  internal/cli, internal/gui ok (mica). TestEveryRouteHasACommandOrIsNamed
  was red until the new route was named (magpie quota).
- New: TestAccountWindowLimit (budget), TestAccountWindowFromLastReading and
  TestReadAccountWindowsOnceAMinute (provider), TestParseAccountWindowLimit
  (cli), TestCallerKeyAccountWindowsRoute (gui). Broken by hand: the unknown
  branch made to guess a 5h window from now -> TestAccountWindowLimit red
  ("let through on a window not read").
- GUI: gateway-key-account-window.test.cjs, chromium + webkit, en zh zh-TW
  ja de, 500px, no native select: 10 of 10 (red without the keys.js and
  i18n change). Every GUI file that loads the caller-keys fixture or the
  Gateway keys page, plus i18n*: 1064 tests, 1046 pass, 18 red, the same
  18 red on origin/main ec8125e68 alone: api-key-theme (6, #6444),
  gateway-key-arrange 420px (10, #6268), text-size webkit (a subtest and its test, #6561).
Not tried: a real Codex/Claude account's window through a live gateway;
the full GUI suite (mote and mica each had a full suite running).
2026-11-15 03:50:46 +08:00
yetone 07dfd0bb8f update: a magpie stuck in its exit on Windows no longer holds the restarted one (BESTLJP0412 on X)
BESTLJP0412 on X (Windows 11 26200, 0.1.4179 to 0.1.4193, WebView2 157):
after an update's restart the window stayed "Not Responding", and a
process with a single thread sat on port 3425 and the WebView2 profile.

A Go process has several threads while it runs; one left means it is in
ExitProcess (os.Exit on Windows), which ends every other thread and then
runs each loaded DLL's detach on the last one. A detach that waits for a
thread already ended (WebView2's, COM's) never returns, so the old magpie
never ends, its handles stay open, and the new one waited its 60s
(awaitGone), went on beside it, and hung on the held port and profile.

Both ends fixed:
- the old one: cli.Main ends through endProcess, on Windows
  TerminateProcess on itself instead of ExitProcess. Everything magpie
  writes is written by then; the kernel closes every handle and no
  detach runs.
- the new one: awaitGone's wait for the old magpie (awaitExit) looks at
  its thread count every 250ms; one thread for a second is a magpie stuck
  in its exit, and it is ended (opened with PROCESS_TERMINATE). This is
  what fixes the update from 0.1.4193 and older, which still exit through
  ExitProcess.

docs/subsystems/gui-shell.md says how a Windows restart waits and ends.

Tests (Windows, real processes; the stuck detach is a fiber-local storage
callback set to kernel32's Sleep with INFINITE, which ExitProcess runs on
its last thread and TerminateProcess doesn't):
- cli TestEndProcessSkipsAStuckDetach: first checks the stand-in is real
  (os.Exit there hangs with exactly 1 thread left), then that
  endProcess(3) ends with code 3. Broken by hand (TerminateProcess taken
  out): red, "endProcess hung in a DLL's detach, as os.Exit does".
- update TestAwaitGoneEndsAMagpieStuckInItsExit: a predecessor stuck that
  way is ended in ~1.4s. Broken by hand (the thread check skipped): red,
  "the start went on after 20.022s with the old magpie still stuck".

Run:
- win-run on xiaomi-gpu (Windows 11): go test ./internal/cli ok (179s);
  ./internal/update all ok but TestPackagedByDpkg, red the same on
  origin/main 442964d70 (#4603, a ':' file name on NTFS).
- mote: gofmt; go vet, GOOS=windows go vet, GOOS=linux -tags nogui go vet
  of internal/cli and internal/update ok.
- mica: full go test ./... -timeout 45m started at this tree; still running
  at push (ship-at-once rule), result to follow on the issue thread if red.

Not tried: a real update restart of the app on Windows with a stuck
WebView2 detach (the hang can't be brought on at will there); the fix is
checked with the FLS stand-in above.
2026-11-15 02:31:56 +08:00
yetone 4c86b0ab47 cli tests: POST /api/providers/delete is magpie provider rm (#6677)
90efddaba added the window's batch removal without naming it in
cliForRoute or notYet, so TestEveryRouteHasACommandOrIsNamed has been red
on main since 14:31 UTC (ubuntu and macOS CI at 0b8c4bfc3). The CLI's
removal is `magpie provider rm <id>`, one provider at a time.

Run (mote): go test -tags nogui -count=1 ./internal/cli at origin/main
91d27452b plus this: ok (67s). Red without it at 0b8c4bfc3, in #6677.
Not run: the rest of the suite; only a test table changes.
2026-11-15 00:52:12 +08:00
yetone 91d27452b7 library: slash commands, written into each agent's own command folder
miantiao_me on X asked for custom slash commands (prompt templates) kept
once in the Library and given to agents as skills are. Library → Slash
commands keeps a name, a description and a prompt where $ARGUMENTS is
every word typed after /name and $1, $2… the first, second… word. Each
ticked agent gets its own command file, in its own folder and shape
(internal/library/commands.go, from each agent's docs and source):

- Claude Code: <claude dir>/commands/<name>.md; $n becomes $ARGUMENTS[n-1]
  (Claude counts from 0), a literal $0 is escaped.
- OpenCode: <config>/commands/<name>.md, as written.
- Pi: <agent dir>/prompts/<name>.md, as written.
- Gemini CLI: ~/.gemini/commands/<name>.toml, $ARGUMENTS is {{args}}.
- Qwen Code: <qwen home>/commands/<name>.md, {{args}}.
- Factory Droid: ~/.factory/commands/<name>.md, $ARGUMENTS.
- Gemini, Qwen and Droid have no $1…: a command using them is not written
  for those agents, and the row and editor say so.
- Codex is listed greyed: it reads ~/.codex/prompts no more, its skills
  took their place. WSL agents get none yet.

What magpie wrote is recorded per file with its hash (Applied.Commands),
through syncOwnFiles, now shared with subagents: a file the user changed,
or one by that name magpie didn't write, is never overwritten or removed;
one equal to magpie's bytes is adopted. Commands travel with backups and
WebDAV sync (Bundle.Commands; an older bundle keeps this computer's).
docs/subsystems/library.md has the row.

Run (mote was over its load, so mica, then mote at the end):
- At 4119054bb on origin/main 90efddaba: gofmt -l clean; GOOS=linux and
  GOOS=windows go vet -tags nogui ./... ok; go test -timeout 45m ./...
  every package ok but internal/cli's TestEveryRouteHasACommandOrIsNamed
  (POST /api/providers/delete, from 90efddaba, #6677).
- GUI at 5783bf8cb (on 49f49c41c): the 276 files this can reach (every
  library, i18n and sidebar-icon file, new library-commands included),
  both engines, 420 and 1100, en/zh/zh-TW/ja/de: 5218 of 5340 pass. The 15
  red files were run again at 49f49c41c itself and are red the same
  there, test for test.
- At this head (rebased on 217e933dd, which touches only core i18n.js of
  these files): internal/library, gui, davsync ok, cli red as above;
  the 81 library, i18n and nav-sub-icons GUI files pass but library-env
  (#6675).
- Final head (rebased on cd030691a): go test ./internal/library ok; GUI
  library-commands, -plugins, -hooks, -subagents, -groups and i18n-keys,
  both engines: 68 of 68 pass.
- Broken by hand: Claude's $n mapping left as written turns
  TestCommandsWordsByPlace red; the sidebar section missing turned
  library-groups red (my bug, fixed here).
- Real, sandbox HOME: Claude Code 2.1.316 `claude -p "/magpietry alpha
  beta"` expanded first=[alpha] second=[beta]; OpenCode 2.0.25 listed it
  (GET /api/command) and its session command expanded the same. Gemini
  got the $n problem and no file.

Red on origin/main too, not this change: found-skill-pick-remove (#5013),
library-env (#6675), skill-group-shared (#6687), old-webkit (#6030,
#5919), the /api/update/using posts (#6133, #6667, #6668), library-new-skill
(#6539), mobile-web (#5013), phone-no-sideways (#5869), view-no-sideways
(#6669), and skill-where, text-size, usage-ledger and
usage-speed-all-models, each with an open issue. Left alone: a Claude plugin's
commands becoming library commands (#6672).

Not tried: pi, Qwen Code and Droid binaries (their files checked by tests
only), Codex (greyed), a real run on Windows or Linux.
2026-11-15 00:48:52 +08:00
yetone 106a24b95e library: skills from GitHub and git update by themselves when switched on
0xYaCo on X: "skill 能自动化升级吗?". magpie already checked for skill
updates by itself (every 12h, as the Skills tab opens), but each update
waited for a click on Update. A new switch, Update by themselves, sits
under the Skills list while a skill comes from GitHub or git
(POST /api/library/skills/auto-update; `magpie library skill auto-update
on|off`; library.json's autoUpdateSkills, this computer's own). It is off
by default. When it is on, KeepSkillsCurrent (a gateway.WhileServing loop)
runs AutoUpdateTick 2 minutes after start and then hourly. Every 12h that
runs CheckSkills, then UpdateSomeSkills on the skills found at "update".
So a skill changed here stays in Unupdated with its Update button, one
removed upstream is only marked, and a replaced edited version goes to the
backups, as with an update by hand. Updated names and a new error are
logged.

Run (WSL2 magpie-desktop, Go 1.26.8; mote was at load 167, mica's disk full),
at ab637d3c4 (this change on 14807bcf2):
- TestAutoUpdateSkills (local git repo fixture, no network) ok.
  Broken by hand (switch and due checks removed): FAIL
  "off: ... Updated:[pdf] ... notes "two"". Restored: ok.
- -race -count=5 TestAutoUpdateSkills|TestInstallFromGitRepo: ok
- gofmt -l: clean; go vet -tags nogui ./... ok; GOOS=windows go vet ./...
  ok; go build -tags nogui, GOOS=windows go build ok
- go test -tags nogui -timeout 45m ./... under a temp HOME: every
  package ok except two reds in untouched packages, each also red alone
  at origin/main 659ca3f02: internal/update
  TestSettleAsksAboutADownloadKeptElsewhere (filed #6648) and
  internal/usage TestRequestStateKeptAcrossACatalogFetchedAgain (#6572).
- GUI: skill-auto-update.test.cjs (en, zh, zh-TW, ja, de; 400px wide;
  Chromium and WebKit), i18n-keys, i18n-en-no-cjk, skill-update-feedback
  and skill-update-edited: 36/36 pass.
Not run: the whole GUI suite had started but not finished at push
(pushed at the coordinator's ask), and nothing was run at the rebased head
e0e8f34a7 (its parents touch lessons/update only). No darwin vet: the
cgo-off cross vet fails in gui's traywindows_darwin_test.go on main too.
Not tried with a real GitHub skill in a live magpie.
2026-11-14 19:09:55 +08:00
yetone 9f4e1120f3 agent: a Codex not connected is never pointed at magpie for account failover
TylerBai_loveai on X (tweet 2121532671180632290): with several ChatGPT
accounts added in magpie and Codex not connected, Codex's requests went
through magpie anyway; only adding Codex in Agents, then Disconnect,
put it back.

Cause: Sync's `failover` in codex.go wrote
`openai_base_url = "http://127.0.0.1:3425/backend-api/codex"` (stash
codex.failover), or pointed a CC Switch OpenAI mirror's base_url at the
gateway (codex.mirror_failover), for any Codex signed in to ChatGPT with
another of its accounts on (#1385), on every start and Sync, unless the
user had disconnected Codex or turned on "Only switch Codex's sign-in".
The row said not connected while every request went through magpie.

Fix: failover writes nothing any more. A Codex that isn't wired or
using magpie as its provider gets what failover wrote before taken out
by Sync: the marked base URL, or the mirror's base_url. A base URL the
user wrote by hand has no mark and stays (#856). Failover between Codex
accounts comes with connecting Codex. modelOptions no longer counts
failover as through magpie, so a pick of Codex's own model on the
Agents page doesn't go via magpie. codexProxyOK (the proxy probe only
failover waited for) is gone. The CLI's and GUI's switch-only lines,
reference.md and the subsystem pages say failover is for a connected
Codex.

Users already affected: the first Sync after updating (magpie's start)
removes the marked openai_base_url or mirror base_url, and the route
change restarts Codex's app-server; Codex then goes straight to OpenAI
on its own sign-in. A thread opened while it was on magpie keeps its
provider until reopened, as after Disconnect.

Tests:
- TestCodexNotConnectedStaysOffMagpie: two spare accounts on, Codex
  not connected; SyncCatalog, Sync twice and a model pick leave no
  base URL, no model_provider, not Wired/FailingOver/CodexOwnOnly.
- TestCodexFailoverFromBeforeTakenOut: a marked base URL and a marked
  mirror base_url from before are taken out, bytes restored exactly.
- TestCodexSwitchOnlyKeepsCodexOffTheGateway, the CC Switch mirror,
  disconnect-stays and proxy/EndFailover tests reworked to seed the
  old state by hand; TestCodexFailoverHeldWhileProxyDoesNotPassOn
  deleted with codexProxyOK.

Red on the old code (old codex.go + codex_proxy.go, new tests, mote):
TestCodexNotConnectedStaysOffMagpie, TestCodexFailoverFromBeforeTakenOut
and TestCodexSwitchOnlyKeepsCodexOffTheGateway fail with the reporter's
line `openai_base_url = "http://127.0.0.1:3425/backend-api/codex"`;
TestCodexCCSwitchOfficialOpenAIMirror fails with the mirror pointed at
magpie.

Run (mote; mica's disk is full, 100% with other sessions' runs, and
mote's load was ~17-25 of 18):
- At base b592c1fde: go vet ./... (darwin, GOOS=linux, GOOS=windows)
  ok; go test -timeout 45m ./... 98 ok, two reds:
  TestEveryRouteHasACommandOrIsNamed (fixed on main by 69946f43c) and
  TestCoreScriptBudget, mine (+24 bytes) - the GUI string was shortened
  to fit, no raise.
- Rebased on a63923e3d (what main changed since the base: agent, cli,
  gateway, gui, provider, sessions): gofmt -l clean; go test
  ./internal/agent ./internal/cli ./internal/gui ./internal/provider
  ./internal/sessions all ok. Then rebased on 943404477 (GUI tests
  only below run there).
- GUI (chromium + webkit, every language, both widths): switch-only,
  agent-failover, i18n-keys, i18n-en-no-cjk, claude-switch-only,
  panel-switch-accounts: 115 of 116; the red is claude-switch-only
  chromium 1100 en "the page doesn't move" (scrollTop 3), 4 of 12
  alone here, 0 of 9 on origin/main 943404477, on a path this change
  doesn't touch; filed as #6645 with its output. agent-switch-accounts is 20 of 24
  red the same on a fresh origin/main 69946f43c (#5925, Claude Code
  path, untouched here).

Not tried: a real Codex with real ChatGPT accounts across the update
(sandbox HOME tests only), Codex in WSL, Windows.
2026-11-14 18:40:09 +08:00
yetone 69946f43c4 cli: POST /api/page-away is named as the window's own, so the route parity test is green
80a315a70 added POST /api/page-away, the page saying it went from view
so its Sessions and Usage caches can go. It has no CLI meaning, and
TestEveryRouteHasACommandOrIsNamed was red on main for it. It is now
in notYet as a window route.

Run: go test -run TestEveryRouteHasACommandOrIsNamed ./internal/cli on
mote at origin/main 75f872ef1: red before, ok after.
2026-11-14 17:48:48 +08:00
yetone 07a62b3739 providers: Copy all keys, and magpie provider keys, carry a provider's keys to another magpie
@emilochen on X asked to batch-export one provider's keys, to sync them
between a local and a cloud magpie. Each key row could copy only its own
key (#1480), and nothing printed them all.

- A provider with two or more keys gets a "Copy all N keys" row under
  Add another key. It asks provider/key with allKeys (provider.AllKeys:
  the main key and every listed key, deduplicated, turned-off ones too)
  and copies them one a line, for the other magpie's Paste several
  (keys/import). The secret goes only to the clipboard on the click,
  through the page's copy(); nothing logs it, and the route sits behind
  the GUI API's existing local/origin guards. A signed-in account has
  no keys and is refused.
- The row is drawn by keyrates.js (copyAllKeysRow), already imported
  when a provider with two or more keys opens; keyRateField now takes
  which of its parts to draw. It has its own class, keys-copy-all, not
  .add, since ~21 GUI tests take .acc.add as the one adding row.
  TestCoreScriptBudget's core budget goes up by the 72 bytes left in
  app.js (the placing line and the helper's new argument); app.js stays
  under its own budget.
- CLI: `magpie provider keys <id>` prints the keys one a line;
  `magpie provider keys <id> add [key… | -]` adds them from words or
  stdin (SplitKeys + AddKeys), so
  `magpie provider keys relay | ssh cloud magpie provider keys relay add`
  works. A word starting with "-" is refused, never taken as a key.
- Strings in en, zh, zh-TW, ja, de.

Related: #5387 (sharing saved providers through magpie:// links), not
closed by this.

Run on mote (mote-run) at this tree on 11ddf076b (debc80271, its new parent, changes LESSONS.md only):
- gofmt -l internal/: clean. go vet (darwin) ./internal/provider
  ./internal/gui ./internal/cli; GOOS=linux go vet -tags nogui ./...;
  GOOS=windows go vet ./...; GOOS=linux go build -tags nogui and
  GOOS=windows go build: ok.
- go test -count=1 ./internal/provider ./internal/cli: ok;
  ./internal/gui: ok (TestCoreScriptBudget included, after the budget
  change).
- GUI, Chromium + WebKit: key-copy-all (en/zh/zh-TW/ja/de × 900/420px),
  api-key-usage, i18n-keys, key-price-rate, key-copy, key-weight,
  click-scroll: 104/104. key-copy-all again in WebKit twice: 15/15 each.
- GUI, 43 key/provider/i18n files at the change vs the same files at
  untouched 11ddf076b: the only new reds were api-key-usage's key-row
  count (it counted .acc:not(.add); now leaves keys-copy-all out). The
  other 67 reds are the same on the base and filed: #5835 key-switch,
  #6414 key-balance-card de, #6424 key-box-once, #5866 signin-proxy
  380, #6444 api-key-theme, #4126 key-replace 420, #4673
  provider-typed, #6416 key-import Paste several, and #6628 (filed now)
  login-export's Export row count.

Broken by hand: key-copy-all.test.cjs at untouched 11ddf076b assets
fails 10 of 15 in WebKit (the 5 that pass are "one key has no Copy
all"). The Go tests can't build on the old code (AllKeys, keysCmd).

Not tried: the real app and the system clipboard, the Windows and
Linux boxes, a real cloud/headless magpie over ssh, and the full Go
suite (mote and mica were both over their load limits; the three
touched packages and cross-OS vet ran instead).
2026-11-14 16:34:10 +08:00
yetone 11ddf076b4 usage: a Qwen AI platform Token Plan is read through a sign-in to the platform (@imthe99galaxy on X, #5829)
On v0.1.4137 a provider on the Qwen AI platform's Token Plan
(qwen-token-plan, token-plan.maas.qianwenaiapi.com) had no quota card at
all. The plan key (sk-sp-) only authorizes inference; the platform tells
the plan's usage only to a sign-in on the platform, and magpie had none.

Now each such provider can sign in to the platform, as the QianWen CLI
1.10.0 does (qianwen_plan.go, UA qianwen-cli/1.10.0):
- a device sign-in with PKCE S256 at t.qianwenai.com/cli/device/code and
  /cli/device/token, approved in the user's browser; the editor's
  "Sign in to the Qwen AI platform" opens the page and waits for it;
- the session is the provider's own, kept by provider id in
  qianwen-auth.json (0600), moved on Rename and dropped on Delete;
- cli.qianwenai.com/data/v2/api.json (GenerateCLIAccessToken) mints a
  console token, kept and minted once more when the gateway answers
  NotLogined; ConsoleNeedLogin or a fresh token refused signs it out;
- the usage is the Alibaba Token Plan's BroadScopeAspnGateway call at
  cs-data.qianwenai.com with consoleSite QIANWENAI, region cn-beijing,
  read by the shared aliAskUsage/aliReadWindows (alibaba_usage.go now
  takes the console per call). The sk-sp- key is never sent there.
- Plan windows (planquota.go) and routing's key allowance
  (key_allowance.go, keyTag "qianwen") read it; not signed in, the card
  says so with Open settings (NeedsAccessKey).
- GUI routes /api/qianwen/{id}/signin (POST start, GET state),
  /signin/cancel, /signout; the editor's field lives in qianwenplan.js,
  imported when such a provider's editor opens. The core script budget
  is raised by 326 for the import and one quotaError line (its reason in
  core_budget_test.go). The routes are in the CLI parity's notYet, as
  StepFun's are.

Run, on mote at the base df2b819c6 (= origin/main then):
- gofmt -l: clean. go vet (darwin), GOOS=linux go vet -tags nogui,
  GOOS=windows go vet on internal/provider, internal/gui, internal/cli: ok.
- go test -count=1 -timeout 45m ./internal/provider ./internal/gui
  ./internal/cli: provider ok; gui and cli red on TestCoreScriptBudget
  and TestEveryRouteHasACommandOrIsNamed, both mine; fixed (code moved to
  qianwenplan.js, budget +326, routes named), then gui ok, cli ok.
- go test -race -run Qianwen ./internal/provider: ok.
- GUI (chromium + webkit, 900/420px, en zh zh-TW ja de where the file
  has them): qianwen-plan 20/20, stepfun-per-provider,
  usage-access-key-card, volc-access-key, quota-balance-error,
  i18n-en-no-cjk all ok; earlier also opencode-zen-balance,
  siliconflow-balance, usage-card-refresh, usage-remote-key-limits,
  usage-remote-cards ok. Reds not mine: i18n-keys "a plugin's words are
  its own" (#6619, fixed on main by ea6470cb7), old-webkit's
  headerpresets.js (#6030) and app.css :has() (#5919).
- Rebased on origin/main 79a30eb9c and run again at that tree on mote:
  go test -count=1 -timeout 45m ./internal/provider ./internal/gui
  ./internal/cli all ok; qianwen-plan + i18n-keys 24 pass, 0 fail. Rebased again onto
  fc75d90af before the push; b507b5f69 and fc75d90af touch only
  internal/sessions and third_party/yaml.v3, not run again.

Broken by hand, each red, then restored: the NotLogined retry, the
code_verifier, renameQianwen, the planquota channel, forgetQianwen on
Delete, the session expiry check, qianwenWatch not called, the sign-in
quotaError mapping.

Not tried: a real sign-in. No Qwen AI platform account is available here,
and approving the device sign-in grants an OAuth permission. Fixtures are
built from the QianWen CLI 1.10.0 source and the live device/code and
unauthenticated replies; the usage reply's shape is the Alibaba Token
Plan's, which the CLI reads with the same code.
2026-11-14 15:46:34 +08:00
yetone 667ac8bd6f settings: a look at one setting takes the shared settings, not a copy
settings.Load() copies the whole Settings (clone + deepCopy of every map
and slice) for each caller. 133 places read one field of it and threw
the rest away: the proxy for every outgoing request (netproxy), the
GitHub token, the China mirror switch, a model's output cap, wire or
price on a gateway request. With a real account in the tray, Load's
clone was 26.6 MB of the 318 MB the process allocated in its first
seven minutes, most of it through netproxy.For on each request.

Each of them now reads settings.Shared(), the read-only settings every
caller is given for the same settings.json. Only reads were changed:
a scalar field (string, bool, int, float) or a map field's index
read. A caller that keeps a whole map or slice, or calls a method on
the settings, still takes Load's copy.
2026-11-14 14:02:49 +08:00
yetone b325718f0a antigravity: turned-away lines go reworded, not broken up; Antigravity min 0.1.12 (#1118)
Since 11-14 Google's check reads past invisible characters. A system
prompt with Claude Code's billing line and Agent SDK line, broken up
with two U+200B in every word as the cloak sent them, was turned away
5 of 5 with the bare 429 "Resource has been exhausted". Claude Desktop's
Code tab through magpie to Antigravity failed every turn (hc295971796
on X, tweet 2121429628019781849), and on v0.1.4110 with the Antigravity
Cloak plugin Antigravity hit 429 very often (daoche_wuzui, tweet
2121432333769433178).

The built-in cloak (codeassist.go) now rewords each line Google turns
away, in plain words:
- the x-anthropic-billing-header line is left out to its line's end; a
  system part or message holding only it is dropped;
- "built on Anthropic's Claude Agent SDK" -> "built on the Claude Agent
  SDK by Anthropic";
- Codex's "based on GPT-5" -> "built on GPT-5";
- Hermes' "created by Nous Research" -> "built by Nous Research";
- omp's RFC "keywords" -> "key words".
A copy an older magpie or middleware broke up (U+200B, U+2060, soft
hyphen, inside or between words) is matched and reworded as the line.
The Code tab's main line passes as written and is kept.

The plugins repo's packages carry the same rewording (plugins 5bb41941:
opencode-antigravity-auth 0.1.12, opencode-agy-cli-auth 0.1.41,
middleware-antigravity-cloak 0.1.7 on the dist branch). The Antigravity
mover's min goes to 0.1.12, the version dist has (these packages are
not on npm); the cloak middleware is Official and updates itself.

Run:
- real Antigravity account, sandbox HOME, gemini-3.8-flash, 10
  sequential requests each through the new plugin: Code tab main prompt
  as Claude Desktop sends it 10/10 200, Agent SDK subagent line 10/10,
  an old two-U+200B copy 10/10, Codex GPT-5 10/10, Hermes' earlier
  persona 10/10, omp's RFC line 10/10. The zero-width break went 0/5.
- mote-run: gofmt -l; go vet, GOOS=linux go vet -tags nogui and
  GOOS=windows go vet of internal/gateway, provider, cli;
  go test -count=1 -timeout 45m ./internal/gateway/ ./internal/provider/
  ./internal/cli/ ./internal/middleware/: all ok (gateway 926s);
  vet clean, gofmt clean.
Broken by hand: codeassist.go from origin/main with these tests: 6 fail
(TestAntigravityCloakClaudeCode2316, ...RewordsEveryLineItTurnsAway,
...AnswersHermesAndCodexByDefault, TestOnlyAntigravityIsSentThePrompt
Reworded, ...LineWrappedOrWidened, ...TurnsCodexsGPT5ThreadAwayOnce).
Not tried: models other than gemini-3.8-flash; the whole go test ./...
(only the four packages this touches); Claude Desktop itself (its Code
tab's system prompt was captured and replayed instead).
2026-11-14 11:42:32 +08:00
yetone 4e770f733a library: subagents imported from a repository
CHENGJIAHEGOXIS on X asked for an easy way to install a repository of
subagents such as msitarzewski/agency-agents. Library → Subagents now
has a find line. It takes what the skill installer takes: owner/repo, a
GitHub or GitLab link to a repository, folder or file, any git address,
or a folder on this computer. It lists the subagents found, lets the
user tick all or some, and imports them as Library subagents for the
agents ticked.

- Fetching is the skill importer's: resolvePluginRoot's source handling
  moved into fetchSourceRoot, which both use. tooBig still refuses a
  whole repository that is too big and asks for the folder's link.
- A subagent is a Markdown file whose front matter has a description.
  - Its name is the slug of `name`. In an `agents` or `droids` folder
    with no `name`, it is the file's own name.
  - The description is folded to one line of at most 1000 characters.
  - The body is the prompt.
- Dropped: every other front-matter key (agency-agents' color, emoji
  and vibe, and tools, model, author or anything else). A Codex TOML
  role is not read. A skill's folder (one with SKILL.md) and .git,
  .github and node_modules are skipped.
- Two files with one name: the shallower is taken, and the other is
  listed as left out, with why. So is a file Subagent.check refuses.
- An imported subagent records its source and file (From) and a hash
  of its description and prompt as imported (FromHash). Imported again,
  a subagent from the same file is:
  - have, when it is unchanged;
  - update, when upstream changed and the library's copy still matches
    FromHash (description and prompt replaced; agents, skills, servers
    and model kept);
  - edited, when the user changed it in magpie (left as it is).
- A name the library already uses for another subagent is never written
  over: the import takes the next free name-N.
- A carried library carries From.
- The page has Select all, a filter past eight, a tag per state, the
  files left out, and a summary of what was imported and updated.
  i18n: zh, zh-TW, ja, de.
- The fixture is agency-agents' own files in
  internal/library/testdata/agency-agents. No test reaches the network.

Run on 80ae5ba24, which is this change on e730a14dc:
- gofmt -l is clean. GOOS=linux and GOOS=windows go vet -tags nogui
  ./... are clean (mote).
- go test -tags nogui -count=1 -timeout 45m ./... on mica: 98 packages
  ok. internal/cli's TestEveryRouteHasACommandOrIsNamed was red because
  the new POST /api/library/subagents/probe wasn't named. It is now in
  notYet beside skills/probe and plugins/probe, and the test passes.
- GUI files run in chromium and webkit, in every language:
  - The new library-subagents-import.test.cjs and the doc's Library
    list: 117 of 118 passed. The red was i18n-keys: "{n} subagents" is
    the sessions plugin's key. The keys now use {count}.
  - A second run of the doc's Library list, i18n*, project-subagents,
    skill-install-* and plugin-*: 1652 of 1768 passed. The 116 reds are
    in 7 files that fail the same way alone on a fresh origin/main
    (e730a14dc): 116 there, 114 at this head. Each has an open issue:
    - found-skill-pick-remove: #4097 and #5013
    - plugin-option-placement: #6559
    - plugin-signin-no-url: #5938
    - plugin-signed-out-account: #5998
    - plugin-move-unserved: #4392 and #4410
    - plugin-page-foreign-error: #6117
    - plugin-card-update: #3079

Run at the pushed head, rebased on eb1b83000, on mica:
- gofmt -l is clean.
- go test ./internal/library ./internal/gui ./internal/cli: ok.
- library-subagents-import, library-subagents and i18n-keys: 38 of 38
  passed.

Broken by hand, each red, then reverted:
- Clash renaming off (`false && taken[name]`):
  TestSubagentImportLeavesTheUsersOwn red.
- The edited check made `case true:`: TestSubagentImportAgainUpdates
  red (paid-media-auditor read as update).

Real import, in a sandbox HOME magpie web on mote (built from this
change), with Claude Code and
Codex detected:
- The probe of https://github.com/msitarzewski/agency-agents found 283
  subagents. One was left out: the mcp-memory copy of
  backend-architect.
- Importing all 283 wrote 283 files to ~/.claude/agents (only name and
  description in the front matter) and 283 TOML roles to ~/.codex/agents.
- A probe of .../tree/main/engineering then showed 66, all have.

Not tried: the Windows and Linux runtime, GitLab and plain git sources
against real repositories, an agent in WSL, a repository over tooBig's
limit.
2026-11-14 09:11:31 +08:00
yetone 5211fd3ba2 usage: a currency "By provider" shows each provider's costs in what it sells in
onkashiko on X: DeepSeek, Kimi (China), Zhipu and other domestic vendors
price in yuan, the rest in dollars, and one currency for every cost made
the Usage page read wrong for half of them.

Settings > Usage > Currency gains a third choice, By provider. With it,
a figure of one provider's calls (a model's, an account's, a key's row,
a request, a routing try, a quota card's whole) shows in the currency
that provider sells in, and every sum across providers (the total,
agents, sessions, charts, the tray, Bark's daily, the day page) in the
currency a "Totals in" row picks, a row shown only while By provider is
chosen. GUI, TUI and CLI agree. Costs stay stored in dollars; only the
display converts, at the live rate (internal/fx).

Which providers sell in yuan (provider.PricesInYuan): a .cn host; a
preset at its own site that is a yuan preset (deepseek, zhipu,
volcengine, tencent-cloud, bailian, siliconflow…), ends in -cn, or is in
its China region; a plugin id ending in -cn; a provider of one's own
with a yuan models.dev catalog served at that catalog's site. A relay
made from DeepSeek's preset, Z.ai, Kimi's and MiniMax's international
endpoints stay in dollars: they share a catalog with their Chinese
twins, so the catalog alone can't tell.

Known limit: models.dev has only dollar prices (converted from the
vendors' yuan at ~6.7-7.0), so a yuan figure is that dollar price at
today's rate and can differ a few percent from the vendor's own list.

A second ask from onkashiko: set the currency of the menu bar and of
the totals apart, sums converted by themselves.

So Settings > Usage also gains an Advanced fold (closed by default, open while
set) with one row, Menu bar currency: Same as totals (the default), $ or
¥ (settings.TrayCurrency, TrayCostIn). It sets the menu bar's totals
cards and the tray tooltip's cost; the Usage page, the panel, the TUI,
the CLI and Bark's daily message stay in the totals' currency
(totalsCurrency). Like the other menu bar settings it stays on this
computer (KeepOwn). Every sum is still made in dollars and converted
once, at the live rate, so a mixed-currency total is never added up
from yuan and dollars.

Settings' currency rows (Currency, Totals in, Menu bar currency and the
rate in the tooltip) moved out of app.js into currencyprefs.js, imported
when Settings draws its usage prefs, and costInYuan is packed: the core
is 3 bytes under coreScriptBudget, with no raise.

Run:
- go test -count=1 at this tree on mote: internal/settings,
  settingsapi, tui, cli, catalog, provider, fx and gui all ok
  (TestCoreScriptBudget included). The full go test ./... and the whole
  GUI suite are queued behind other sessions' suites on suite.lock
  (mote and mica, load 35 and 60) and had not started at push.
- GUI files at this tree (mica): currency-provider, currency, i18n-keys,
  i18n-en-no-cjk, tray-cost, tray-totals, every settings-*, old-webkit:
  362 pass, 28 red. Every red is red the same at origin/main ac0b5c287
  on mote, and filed: settings-search (#6133, #6353), settings-hints
  (#6107, #6353), settings-lines-wrap de 440px (#6353), old-webkit
  appearance.js (#6467) and :has() (#5919). The one red of this change,
  settings-groups' list of Usage's parts (now with the Advanced fold),
  is fixed here: 14 of 14.
- currency-provider.test.cjs (new): en, zh, zh-TW, ja, de at 900 and
  420px, both engines; By provider, Totals in ¥, then Advanced: $ for
  the menu bar with totals in ¥, totals stay ¥21.60, the fold opens
  itself after a reload. Plus currency.test.cjs (3 choices now),
  i18n-keys, i18n-en-no-cjk, tray-cost: green in both engines.
- TestTrayCostIn (values, refused eur/provider, KeepOwn),
  TestFXByProvider (trayCurrency vs totalsCurrency), TestCoreScriptBudget.
- gofmt -l clean; GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., GOOS=linux go build -tags nogui,
  GOOS=windows go build on mote at this tree: ok.
- Broken by hand, each red: costInYuan ignoring the provider (GUI
  test: deepseek showed $1.00 for ¥7.20), PricesInYuan without the
  preset's site check (a relay made from DeepSeek's preset read as
  yuan), CostIn without its By provider branch (settings test),
  TrayCostIn ignoring TrayCurrency (TestTrayCostIn, TestFXByProvider),
  the fold not opening while set (webkit), the row saving into
  totalCurrency (chromium).
- Real app in a sandbox HOME on mote (dev build, magpie web and magpie
  usage) with DeepSeek, OpenAI and Z.ai presets and one call each: the
  window and the CLI both show deepseek-v4-pro ≈¥15.44, gpt-4.1 ≈$1.00,
  glm-4.6 ≈$0.290 and the total ≈¥24.07 at 6.685; /api/settings' fx
  carries yuan ["deepseek"].
Not tried: Windows and Linux windows and trays, the real menu bar with
Menu bar currency changed (drawn natively; covered through trayCurrency
in Go), a real Kimi CN or Zhipu account.
2026-11-13 22:46:00 +08:00
yetone 533f351085 library: billion-context.json syncs, its settings change from its tab, running bilis reload
@Luxzinw on X asked for three things: sync billion-context's config,
edit its settings in the Library's billion-context tab, and have running
bili proxies reload after a change.

Sync. billion-context.json goes in the library part (library.Bundle.Bili),
by sync and backup file alike. magpie finds it the way bili's
src/paths.ts does: BILI_CONFIG_FILE, else $XDG_CONFIG_HOME (or
~/.config, %USERPROFILE%\.config on Windows), then
billion-context/billion-context.json.
- The text is carried as written, comments kept.
- magpie's summary recipe is carried at the canonical gateway address
  and localized to this computer's gateway when written, so two
  computers on different ports don't trade it back and forth.
- A newer local file is never blindly overwritten. Before a carried file
  replaces a different one here, this computer's copy is kept with the
  backups.
- An unreadable file, or one over 1 MiB, counts as unknown and is never
  carried as empty. A bundle without the file leaves this computer's
  alone.
- A file naming a DSN is left out of keyless backups.
- The credential store (<config>.summary-credentials.json) never
  travels.
- A library with no such file hashes as before.
- The new sync preview names the file when it would be added, changed
  or removed.

Settings. GET/POST /api/library/bili/settings, and a Settings section
under the agents in the tab:
- In front: "Summarize with a fast model" (externalSummary), picked from
  the app's menu, never a <select>. It offers magpie's served models and
  the file's own recipes. "Fold only when nudged" (requireNudge) and
  "Nudge every N tokens" (nudgeGrowthTokens).
- Under Advanced, collapsed: the compression philosophy
  (prompts.compressPhilosophy with acknowledgePromptsRisk, which bili
  needs before it reads a prompt override).
Writes go through edit.PatchJSON and temp+rename, so unknown keys,
comments and the BOM are kept. bili disables its whole compress section
on one bad value, so magpie writes only values bili accepts. A magpie
model becomes a providers.magpie recipe whose key is saved in bili's own
credential store, the way bili writes it (0600, O_EXCL .lock,
temp+rename). A user's own providers.magpie is never taken over. A file
bili can't read is said so and left alone.

Reload. After a change, and after sync writes the file, every running
bili on loopback is sent POST /__bili/config/reload. bili reloads routes
and compress there. The status line says whether it did, or that the
agent needs a restart.

Also: agentenv.Vars clears BILI_CONFIG_FILE in sandboxes, and the
settings-parity list names the two routes for stage 3, as the other bili
routes are.

Run (mica, macOS):
- At abcbc632e, this change on origin/main 9a8219237. The three commits
  main gained before the push (e8001f73a, 7af7a3aba, 005178104) touch
  none of these files:
  - go test -count=1 -timeout 45m ./internal/agentenv ./internal/agent
    ./internal/cli ./internal/library ./internal/gui ./internal/davsync:
    all ok;
  - go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
    ./..., go build: ok;
  - gofmt -l: nothing;
  - library-bili-settings, library-bili, i18n-keys and sync-scope
    .test.cjs, Chromium and WebKit, every language, 1100 and 420 wide:
    ok;
  - library-bili-settings was red in WebKit 1 run in 4: the tab was
    clicked by its index in a list read before the sidebar drew its own
    list, in another order, so the click reached another tab. A dump of
    the page at the miss showed Instructions still open. Both files now
    click the tab by its name. library-bili.test.cjs did the same twice
    and is changed with it. After the change: WebKit 6 runs in a row and
    both files in both engines, all green.
- Full go test ./... at an earlier base, 7eecbcc56: only
  TestFolderVarsAreListed and TestEveryRouteHasACommandOrIsNamed went
  red, both guard tests for this change. They are fixed here and pass in
  the run above.
- Whole GUI suite at that base: 71 reds, none in the Library, i18n or
  sync. Each also fails without this change on origin/main 459d668b3
  (68 there, and the rest pass at this head):
  - agent-details-ready: #6369, #6373
  - api-key-theme: #6444
  - account-arrange: #6010
  - agent-switch-accounts: #5925
  - aside-native: #6212
  - agent-menu-label: #6371
  - account-refresh-holds: #5814
  - bark: filed as #6543

Broken by hand:
- Collect not carrying the file: TestBiliFileCarried red.
- The model pick without summary, or Advanced not kept open: the GUI test
  red (22 of 32).
- On the old code the new Go tests don't compile, and the route test
  gets 404.

Not tried: a real bili proxy reloading. The reload is tested against a
fake /__bili/config/reload, and bili's source was read, not run. Not
tried with a real WebDAV/S3/GitHub server between two computers either:
the davsync tests use the fake server. When a running bili doesn't reload, the status
line says to restart the agent.
2026-11-13 22:02:05 +08:00
yetone 58ea9cade8 daemon: a launch agent written as Background is mended to Standard (#2961)
The commit before writes ProcessType Standard for new installs. Every
agent already installed kept Background until the user ran `magpie
daemon install` again, which no one is told to do. Now `magpie serve`
rewrites that one line of the installed launch agent as it starts
(daemon.Mend), leaving the rest of the user's install as it is, and
says so in the log. launchd reads the file when it loads the agent, not on
a kickstart: so it is taken up at the next login, or at `magpie daemon
restart`, which now takes the agent out and loads it again instead of
`kickstart -k` (and `start` does the same when it mends the file).

This is the same class as #6261: the gateway's process held to
background priority by macOS while agents wait on it.

Run:
- TestLaunchdOldAgentMended: an installed agent rewritten to the old
  Background line is mended byte for byte to what Install writes, 0600,
  with no launchctl call from Mend; Restart boots it out before loading
  it; on Linux nothing is touched. TestLaunchdInstall's restart now
  expects bootout, then load. Broken by hand (mended never mends):
  red at "Mend: the plist is" and "want a bootout first".
- TestLaunchdInstall (plutil -lint on darwin), the whole daemon package,
  vet on darwin, linux, windows: ok; and the package run named in 6261's commit: all ok (gateway 908s, plugin 159s, cli 52s) at base 7eecbcc56; at the pushed head (rebased on 459d668b3, which touches none of these files) build, gofmt, linux and windows vet, and awake, daemon, cli tests ok again

- Real launchd on mote (macOS 27.2), a throwaway agent of its own label
  running /bin/sleep: as Background, launchctl print says "spawn type =
  background (5)" and ps pri 4, the band #6261's app was napped into.
  The file rewritten to Standard and `kickstart -k`: still background
  (5), pri 4. bootout + bootstrap: "spawn type = daemon (3)", pri 20.
  So a kickstart doesn't take the mended file up, and restart's reload
  does.

Not tried: a real `magpie daemon install` on mote (it would take the
gateway's port from the other sessions there).
2026-11-13 21:31:01 +08:00
yetone 459d668b35 sync: pick what syncs, preview a sync, undo the last one (#6428)
jinpwng (#6428, on X) syncs two computers and wants only Library and
memory to go between them: each keeps its own providers, settings and
models. They also want to see what a sync would change before it
applies, and to roll the last one back.

What syncs: providers, settings and profiles now have switches like
agents' models, library and memory (Config.Providers/Settings/Profiles,
*bool, nil = synced as before, so an existing setup syncs exactly what
it did). The sync form shows Providers (and its API keys), Settings and
Agents' models up front; Profiles, usage and sign-ins sit under
Advanced, closed unless one is set away from its default. The form
sends a part's choice only when it is or was off. A part left out
stays as it is here and on the server; turning it back on joins it
like a first sync (st.Off, rejoin). The sync's line says which parts
each computer keeps ("Stays as it is on each computer: ..."). The
setup text and the CLI carry it: magpie <webdav|s3|github> set
providers=no settings=no profiles=no.

Preview: davsync.Preview (plan.go) says, per part, what syncing now
would bring in, send up, or leave; library items and memory files by
name, sign-ins and plugins gone. Preview... in Settings > Sync shows it,
and Sync now from there runs SyncPreviewed(token): if the server or
this computer changed since, it says so and shows the new plan instead
of syncing something else. CLI: magpie <kind> preview.

Undo: a sync that brings parts in records them (st.Applied) and keeps
a sealed copy of this computer first (keepSealed, as Restore does).
Undo the last sync puts those parts back from that copy, on this
computer only (st.Local, so the next sync sends it up rather than
fetching the server's again). If one of them changed here since, it
asks first (409 changed, Undo anyway). CLI: magpie <kind> undo-sync
[anyway]. Restore's own Undo is unchanged.

docs/subsystems/sync-backup.md and the site's sync docs (en, zh, ja)
have a section on it. i18n: zh, zh-TW, ja, de.

Run (worktree at base 48e394146):
- go test -count=1 . ./internal/davsync ./internal/cli: ok (mote).
  Broken by hand, each went red: syncs() forced true (scope tests),
  rejoin's again forced false, UndoSync without the st.Local update.
- go test -count=1 ./internal/gui: TestCoreScriptBudget was over by
  85 bytes; the sync-left line moved into syncfiles.js, now ok.
- go vet ./internal/gui, GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok. gofmt -l: nothing.
- node --check app.js, syncfiles.js, sync-scope.test.cjs: ok.
- GUI (mica), every test file that opens Settings > Sync or calls
  davsync (22 files) plus i18n-keys, Chromium and WebKit, 1100 and
  420px, en/zh/zh-TW/ja/de: 453 of 454 pass. The red is s3-sync webkit
  en "picking S3 must not scroll the page" (0 !== 98), the same on
  origin/main 52c9880cb (#3413, #2448). An earlier run also had
  library-new-skill chromium en 420 red, the same on main (#6539).
  sync-scope.test.cjs is new: on the old code there is no Providers
  switch, Preview or Undo, so it fails at once.
- Rebased on origin/main 7eecbcc56 (app.js and i18n.js changed there):
  TestCoreScriptBudget, go test . ./internal/davsync, node --check, and
  i18n-keys, sync-scope, webdav-settings-refresh (both engines): ok.
- The full go test ./... was started through mote's suite lock when
  this was pushed; its result goes on #6428.

Not tried: a real WebDAV, S3 or GitHub server (the tests use fakes);
the real app on Linux WebKitGTK. "Save and sync" from the form, after a
preview, syncs without the preview's token check.
2026-11-13 21:09:44 +08:00
yetone 6fc8fdae41 cli: the Usage page's switched-off check-ins route is named (wxkwxk666 on X)
5d54a990d added GET /api/usage/checkins/off and left it out of the
CLI parity list, so TestEveryRouteHasACommandOrIsNamed went red on main
(seen in that commit's full suite on mote). It is named in notYet as a
Usage page read; `magpie accounts checkin` already checks in every
account, as for POST /api/usage/checkin-account.

Run, on mote: go test -run TestEveryRouteHasACommandOrIsNamed
./internal/cli, red at 5d54a990d's full suite, ok with this line.
2026-11-13 19:04:48 +08:00
yetone 0fda3a1c12 cli: provider set resolve.<host>=…, the editor's Connect to from the CLI (quantum_lsfc on X)
v0.1.4012 added Advanced › Connect to (Provider.Resolve) in the GUI
only; the reporter asked for it from the CLI. `magpie provider set <id>
resolve.<host>=<IP or dns:name>[,…]` sets a host's connect addresses,
an empty value takes the host out, and `resolve=` clears them all (any
other resolve= value is refused, never saved). provider.Save checks
them as the GUI's do (netproxy.CheckResolve, TakesResolve), so a bad
place or a vendor's own host is refused with nothing written. `magpie
provider <id>` lists them as "connect". Usage and docs/reference.md say
how.

Run on mote: go test -count=1 ./internal/cli ok (166s);
TestProviderSetResolve ok; go vet ./internal/cli for darwin, linux
(-tags nogui) and windows ok; gofmt -l clean. A nogui build in a
sandbox HOME on mote: provider add + set resolve.api.corp.example=
10.0.0.5,dns:gw.corp.example saved and shown as connect; resolve=oops
and a bad place refused; resolve= cleared it; provider set --help
printed usage.
Broken by hand: not deleting the host on an empty value, and taking a
non-empty resolve=, each turn TestProviderSetResolve red.
Rebased on origin/main 9572a2b4c and run again on mote: the resolve,
Pair and Help tests of internal/cli ok.
Not tried: a request actually dialled through the rule from the CLI
(the dial is the GUI's, covered by netproxy's and provider's tests),
nor the reporter's managed network; Windows and Linux beyond go vet.
2026-11-13 16:39:09 +08:00
yetone a95a7a1cd8 providers: each API key can bill at a price rate of its own (tnt12231 on X)
A relay sells keys in groups that bill at different rates against the
official price (0.5x on one, 1.2x on another) under one endpoint, and
magpie had only the provider's price rate. Now a key can have its own:

- provider.KeyPriceRates, keyed by key id like KeySpendCaps: cloned,
  normalized on save, carried when a key is replaced. A key without one
  bills at the provider's PriceRate. A price the user set for a model
  stands as set, as it does under the provider's rate.
- Usage prices each call at its key's rate (usage.Pricer memoizes per
  key id, BaseKeyPriceIn), so the Usage page, a key's spend cap and its
  typed balance follow it. PriceAt, used to route by price, takes the
  rate of the key the provider holds.
- GUI: the provider editor's Advanced has "Price rate per key" under
  Price rate, shown only with two or more keys, folded past 8 keys like
  the per-key proxies. An empty line shows the provider's rate as its
  placeholder. Save sends keyPriceRates ({} clears, left out keeps).
  The lines, the check and the placeholder live in keyrates.js,
  imported when a provider with two or more keys opens. The core's
  budget goes up 397 for what is left in app.js (the import, the
  draft's copy, Advanced opening for it, the save's line, proxyLines
  drawing another kind of line); app.js stays under its own.
- CLI: magpie provider key-rate <id> [key [rate|default]].
- docs/subsystems/providers-accounts.md: a Key price rates row.

Run, at this head (rebased on 287a1ffa2) through mote-run:
- go test ./internal/usage ./internal/cli ./internal/gui: ok.
  ./internal/provider: ok but TestHostBuildsNoList, red the same on
  origin/main 51b98b1a8 (3 of 3), filed as #6479 (likely 16b8c300f).
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., go build: ok.
- GUI: key-price-rate.test.cjs (chromium and webkit x en, zh, zh-TW,
  ja, de: own rates saved, provider rate as placeholder, bad values
  refused, comma decimals, {} on clear, a folded key keeps its rate,
  one key shows no lines and posts none), i18n-keys and
  provider-many-keys-proxy (it shares proxyLines): ok. old-webkit:
  keyrates.js added to its on-demand list; its two reds (compat.js
  first, Safari 15.0 styles) fail the same on origin/main 51b98b1a8
  (#5919 and the on-demand list's #6467 family).
- Earlier, at 92bce5c72: the GUI files that reach the provider editor
  (134 tests). The 6 provider-many-keys reds fail the same on that base
  (#6209); proxy-login-fields' chromium zh timeout passes 12/12 alone on
  base and branch (#6374).

Broken by hand: atKeyRate leaving PriceRate as the provider's made
TestKeyPriceRatePrices and TestPricerKeyPriceRates red; the save not
sending keyPriceRates made 20 of 30 key-price-rate GUI tests red, and
keyrates.js dropping each parsed rate made them red again after the
move.

Not tried: a real relay with several keys at different rates; the real
Linux WebKitGTK app. The budget estimate and the Sessions page's costs
still use the provider's rate.
2026-11-13 16:31:24 +08:00
yetone 51b98b1a85 model efforts: a relay listing no levels says where magpie's come from, and a set that changes nothing says so
@czhhcz on X (magpie 0.1.4016, Claude Code, a third-party relay): the
relay's /v1/models gives a Claude model `reasoning_levels: []`, yet
`magpie model efforts` lists five levels for it, and setting every level
was "silently dropped"; only hand-editing modelEfforts worked.

What happens: a custom relay that names no levels for a model gets the
model's own levels from models.dev (borrowedEfforts), and the gateway
fits requests to them, so Claude Code's max and xhigh already reach the
relay as asked (TestRelayListingNoLevelsStillGetsTheAgentsEffort). A set
of every level is the default, so nothing is saved, but the CLI printed
"✓ … offers every level it has" as if it had changed something; the
hand edit changed nothing either. An empty list stays "unknown", not
"none": magpie writes [] itself for levels it doesn't know.

- provider.KnownBorrowed(model) says when a model's levels are borrowed.
- `magpie model efforts` prints, for such a model, that the provider's
  list names none and these are the model's own from models.dev, and
  that `off` sends no reasoning field.
- ChangeModelEfforts / ChangeModelSpec report whether anything changed.
  A set that changes nothing prints "· nothing changed" with what it
  already offers, and no ✓.
- Sibling: `magpie model spec --reasoning` printed "✓ saved" over the
  same no-op; it now says nothing changed.
- GUI: its level chips show the current state, and ticking every level
  is the default, so nothing is sent; no silent-drop path, unchanged.

Run on mote: go test ./internal/cli ./internal/provider (whole packages);
go test ./internal/gateway -run 'Effort|Reasoning|Relay|Adaptive|Spec';
go vet, GOOS=linux -tags nogui and GOOS=windows go vet of the three packages; gofmt -l.
New tests: TestModelEffortsOfARelayThatListsNone (a httptest relay with
reasoning_levels: [] in a sandbox HOME) and
TestRelayListingNoLevelsStillGetsTheAgentsEffort.

Broken by hand, each red: the no-change check skipped (✓ printed again),
the borrowed line left out of the listing, and spec's "saved" forced.

Not tried: a real relay; the GUI suite (no GUI file changed).
2026-11-13 16:10:47 +08:00
yetone 6bc0d1e203 claude-desktop: Claude Magpie's Code tab on a Claude Code folder of its own (#6459)
The Separate app (Claude Magpie.app, #5671) kept its own Desktop
userData, but its Code tab's bundled Claude Code still read and wrote
the user's ~/.claude: their CLAUDE.md, skills, plugins and history went
into the twin, and the twin's sessions into theirs (xMopf7RF on X).

An opt-in, macOS-only switch under the Separate app's Advanced fold
(settings.DesktopIsolatedClaude, POST /api/settings/desktop-isolated-
claude, `magpie claude-desktop launcher claude-dir on|off`) gives it
~/.claude-magpie-desktop:

- desktopiso.Script exports CLAUDE_CONFIG_DIR in the app's launch
  script; turning the option on or off remakes the app, and the hint
  says to quit and reopen Claude Magpie, since a running one keeps its
  environment.
- desktopOn writes Desktop's model windows, caps and explore entries
  into that folder's settings.json instead of ~/.claude's while it is on
  (desktopCodeDir, desktopClaudeSync); off moves them back. The folder
  is kept when it is turned off, and shows as the claude# row "Claude
  Code · Claude Magpie".
- The fold is drawn by claudemagpie.js, imported the first time it
  shows; what stays in app.js is the import (isoLazy) and the fold's
  place, 216 bytes, so the core budget goes up by 180 (the 36 of room
  there was taken first).

Run:
- gofmt -l clean; go vet ./internal/... on darwin, GOOS=windows and
  GOOS=linux -tags nogui vet of agent, cli, desktopiso, gui, settings,
  settingsapi (mote).
- go test agent, cli, desktopiso, desktopdir, settings, settingsapi,
  gui, library on mote: all ok except cli's three healthcheck/update
  tests, which ask the gateway mote's own magpie serves on :3425
  (#6223, the same with or without this change).
- TestCoreScriptBudget and TestSettingsSaveKeepsWhatItDoesNotSend at
  this commit and the next.
- GUI on mote, Chromium and WebKit: desktop-isolated-claude (five
  languages, 1100 and 640px), desktop-isolated, i18n-keys,
  i18n-en-no-cjk, old-webkit, and every agent*/desktop*/claude* file
  (98 files, 1,595 of 1,662 pass). Every red is the same on origin/main
  92bce5c72 run alone: old-webkit (#6467, #5919), agent-details-ready
  (#6373), agent-switch-accounts (#5925), claude-quota-onboarding
  (#6179), agent-menu-label (#6371), desktop-tiers Chromium (#6475).
- A real Claude Desktop on mote in a sandbox HOME (~/sb6459, removed
  after): `claude-desktop magpie`, `launcher add`, `launcher claude-dir
  on`. The window and caps moved into .claude-magpie-desktop/
  settings.json, ~/.claude kept only its theme, the script exported
  CLAUDE_CONFIG_DIR, and the launched Desktop's main process and
  children had it in their environment. `claude-dir off` moved them
  back and dropped the export; `launcher remove` removed the app.
  mote's real ~/.claude was listed before and after: unchanged.

Broken by hand:
- desktopOn without the clone-folder branch: TestClaudeDesktopIsolated
  ClaudeDir red (the window stays in ~/.claude).
- The fold without its ontoggle: desktop-isolated-claude red ("shut by
  the redraw").
- settingsapi not keeping the field: TestSettingsSaveKeepsWhatItDoes
  NotSend red.

Not tried: a Code-tab session driven in the real Desktop's UI, so
bundled Claude Code writing into the folder was not seen in this run
(an earlier look at #6459 saw it). Library has no targets for the
clone's folder yet (#6469). The whole GUI suite (1,484 files) was not
run; the files on the Agents page and every i18n file were.
2026-11-13 16:02:12 +08:00
yetone a65dade2e3 gui: an accent colour of your own and a picture behind the pages (CHENGJIAHEGOXIS on X)
CHENGJIAHEGOXIS asked for colours beyond the three themes and for a
local picture. Settings › General gains two rows under Appearance:

- Accent color: magpie's own, six quiet presets (Blue, Teal, Green,
  Orange, Pink, Graphite) and a swatch that opens the system's colour
  picker. Saved as settings.accent (#rrggbb only, checked in saveOwn;
  `magpie settings set accent "#0d9488"` works through settingsapi.Keys).
  The server draws it (appearance.go accentVars): darkened on the light
  theme and lightened on the dark one until it reads as text at 4.5:1
  on the background and cards, with white or near-black text on it,
  whichever reads better. Never under Omarchy, whose theme is the look.
- Background image: Choose… takes a PNG, JPEG, GIF or WebP of 16 MB at
  most, sent as base64 JSON to POST /api/appearance/wallpaper, saved as
  `wallpaper` in magpie's folder (edit.WriteAtomic); settings.Wallpaper
  is its stamp. A thumbnail, Change and Remove show; Remove deletes the
  file. It is drawn behind the window's pages (never the tray panel)
  under a veil of the theme's background at 84%, so text reads as on
  the plain page; the cards stay opaque, and body's colour stays the
  theme's, which Windows' title bar tint reads.

boot.js puts the look's stylesheet in before the first paint and says
which look it drew (bootPrefs.look); applyPrefs asks /api/appearance/css
only when the settings' look differs. The rows, with the Colorblind,
Reduce motion and Loading bird rows, are drawn by appearance.js,
imported when Settings draws, so the core scripts stay under their
budgets with no raise (app.js 2,393 under, the core 503 under).
A save of Settings that doesn't send accent keeps it (Merge guard),
and the wallpaper stamp is kept by every Settings save.

fonts.test.cjs: the two new rows push the font row to the foot of its
560×620 window, where Playwright's click scrolled it in by a pixel and
the test read that as the page moving; the reader now scrolls it in
first with the wheel. settings_keep_test sets Wallpaper; the three
/api/appearance routes are named in the CLI parity test's notYet.

Run (mote, at this change on origin/main 406ad72f1; after the rebase
on fa3ee5a7e, which touched only the Library plugin and the site here,
the core budget, TestEveryRoute*, TestSettings*, TestAccent*,
TestWallpaper*, appearance-look and i18n-keys again, the same result):
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows on
  internal/gui, settings, settingsapi: clean.
- go test -count=1 ./internal/gui/... ./internal/settings/...
  ./internal/settingsapi/... ./internal/cli/...: ok.
  (go vet ./internal/cli too.)
- GUI, chromium and webkit: appearance-look (picking a preset, the
  reader's own and back; boot.js's look not fetched again; choosing
  and removing a picture; the rows keep their height while
  appearance.js loads; en, zh, zh-TW, ja, de at 420 and 1000px: rows
  fit, words translated), fonts, settings-general, settings-sections,
  settings-groups, reduce-motion, skeleton-bird, i18n-en-no-cjk: green.
  Red the same at origin/main 7693cf263 without this change, all
  filed: api-key-theme (#6444, filed now), i18n-keys "No folder"
  (#6422), settings-search and settings-lines-wrap de 440px (#6353).

Broken by hand, each red, then restored:
- Merge guard removed: TestAccentSetting red ("a save without the
  accent changed it").
- accentInk = 1.0: TestAccentReadable red.
- applyPrefs' lookPaint call removed: appearance-look's accent and
  picture tests red in chromium.
- the thumbnail made 66px tall: the row-height test red.

Not tried: the real app on Windows, Linux or Omarchy (title bar tint
with a picture, WebKitGTK drawing the layers), the system's real colour
picker dialog (the test sets the input's value), a 16 MB picture in the
real web views, and the whole GUI suite (queued on mote's suite lock
after the tag).
2026-11-13 13:52:41 +08:00
yetone 741d502d2a library: a synced MCP server can run its own command on this computer (jinpwng on X, #6426)
jinpwng runs one MCP server on a Mac and in WSL. Each needs its own
program path, and the only ways around it were two servers with two
names or keeping the server to one computer, which loses the sync of its
agents and note (#3836).

A command server now has an optional `shared` start. When it is set,
command, args and env are this computer's, and every reader (the agents'
files, projects, the router, the check) runs them with no change of its
own. Collect carries the shared start in their place and never the field,
so the other computers get exactly what they had. Put keeps this
computer's start, and what comes in for the server becomes the shared
start, so a note, agents or the other computer's own command change still
comes in. A server that comes in as a URL, one kept to this computer,
and the editor sending no shared start each end it.

- GUI: a saved synced command server's editor has "Use another command
  on this computer" under Command. With it on, the hint names what the
  other computers run, and "Use the synced command" goes back. Nothing
  else on the page moves; a new server and a local one have no button.
- CLI: `magpie library mcp here <name> <command args…>` and
  `… here <name> off`; the listing names a server that has one.
- TUI: an edit keeps the shared start.
- Docs: docs/subsystems/library.md, site docs (en, zh, ja).

Run (mote, at the tree pushed but before the rebase):
- go test ./internal/library/... ./internal/cli/... ./internal/tui/...
  ./internal/backup/... ./internal/gui/: ok
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows: clean
- GUI, chromium and webkit: mcp-server-here (new: en, zh, zh-TW, ja, de at
  1100 and 390, the payload, no button on a local server, no sideways
  scroll), library-mcp-json, library-mcp-spaced-path, library-mcp-win-line,
  market-address, mcp-home-health, mcp-startup-timeout, market-have,
  mcp-editor-cancel, mcp-local-server, i18n-en-no-cjk, i18n-keys and the
  other library MCP files: 235 of 238. The reds:
  - i18n-keys "a plugin's words are its own": the same at origin/main
    3f6b1b0c9 (#6422, #6423, memory's "No folder").
  - market-have chromium "a server added by hand is marked added": a flake,
    red 1 of 3 at origin/main 3f6b1b0c9 and 1 of 3 here (#4620).

At the rebased head (on 04776ec6c, which touched library/client.js):
go test ./internal/gui/ ./internal/cli/ ok; GUI mcp-server-here,
mcp-local-server, library-group-steady, i18n-keys: 69 of 70, the red is
i18n-keys' #6422 above.

Broken by hand:
- keepStart doing nothing: TestServerHereThroughSync red (a sync took
  this computer's own command away).
- Collect carrying the server as is: red (carried /opt and "shared").

Not tried: the CLI's here command by hand (vet only; it calls the
tested ServerHere); the real app on a Mac with a real WSL computer syncing over
WebDAV; the test does the Mac-to-WSL round trip through Collect and Put.
A backup restored into an empty library gets the synced command only,
since a backup carries what sync carries.
2026-11-13 13:42:48 +08:00
yetone 04776ec6cb providers: a plugin subscription imports accounts from a file through its own auth.import, WorkBuddy's from 0.2.32 (marchen_cc on X)
marchen_cc on X: 「从文件导入账号」 took no WorkBuddy sign-in file. The cause
was not WorkBuddy's: magpie's import reached only built-ins (Codex,
Claude, Antigravity, Factory), and a plugin had no way to say it could
read a file. This adds that for every plugin subscription:

- A plugin's auth may have import(texts, {signal}), returning sign-in
  results, with importFrom (and importFroms by language) saying which
  file to choose. The host's importFiles op keeps each one as a sign-in
  is kept (keptAs, saved under signInKey, settled), so an account
  already there comes back "updated"; it is cancellable (signInSteps)
  and takes at most 100.
- /api/signin/import and `magpie accounts import <plugin> <files>` go
  to provider.ImportPluginFiles when PluginImportable(id); the editor's
  「从文件导入账号…」 row and the import sheet show for such a plugin, in
  its own words (importSay), moved subscriptions included (subOf).
- docs/subsystems/provider-plugins.md: "Accounts from a file".
- WorkBuddy's mover min goes to 0.2.32, which reads the desktop app's
  .info sign-in or a JSON credential, and sends a cloud-hosted
  enterprise account (*.sso.copilot.tencent.com, *.copilot.qq.com,
  *.sso.codebuddy.cn, iOA apart) to its enterprise's address (emilochen
  on X), published and checked with npm view --prefer-online.
- TestCoreScriptBudget +468 for the import branch, packed to one
  statement. importSay is read as the Providers rows draw, so it has
  no lazy page; nothing else was moved out (#2710). The budget's
  arithmetic was checked over this tree: 1,267,762, at the new cap.

Run on mote (mica's disk is full; mote over its cores) at this change
on 3f6b1b0c9; ac1702c33 (the library plugin and its GUI test, no core
script) landed after, and the core budget's arithmetic was redone at
this head:
gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows on
internal/{gui,plugin,provider,cli}; go test -count=1 of those four:
all ok. GUI (chromium + webkit, en and zh): plugin-import,
login-import, factory-key, plugin-moved-signin, i18n-keys: 23 pass, 1 fail: i18n-keys "a plugin's words are its own",
memory_mcp.go's "No folder", red on main since 72facf72e (#6422).
Plugins repo: workbuddy import.test.mjs 6 of 6, bun scripts/check.mjs
ok, root bun test 8534 pass / 1 fail (agy-cli smoke under load, green on a rerun: 8535 pass, 0 fail;
unrelated, plugins #1070).

Broken by hand: without the host's importFiles handler,
TestPluginImportFiles goes red; without importable in pluginSubs,
plugin-import.test.cjs goes red ("WorkBuddy lists no import").

Not tried: a real WorkBuddy desktop .info file or a real enterprise
account on a cloud-hosted domain; the fixtures follow WorkBuddy's own
client source. Not tried on Windows or Linux beyond vet.
2026-11-13 13:32:32 +08:00
yetone c2a1d80fc2 routing: In turn says each message you send goes round, and draws it (Wing8Aqua on X)
"Each turn of a conversation goes to the next one" read as every message
of a session moving to another account, when a reader expects a new
session to be the unit, and the line was long. What the gateway does
(affinity.go affine): under In turn with Stays on Auto or Within a turn,
each message the user sends ("new-turn") goes to the next account, round
the list; the agent's tool calls for that message stay ("turn"); a new
conversation goes to the one holding fewest. Session and Strict keep a
whole conversation on one, so In turn goes round per conversation; Off
moves every request. Routing is unchanged.

The words now name the unit and the cost: each message you send goes to
the next one, round the list; its tool calls stay; a move costs some
prompt cache; Stays on Session keeps a whole conversation on one. Same
in the provider editor, a group's editor, the Routing plugin's mode
line, the CLI's groups help and the docs (en, zh, ja; llms-full.txt
rebuilt), in en, zh, zh-TW, ja and de.

Under the words, while In turn is picked, a small figure: two
conversations of three messages, a pill naming the account (A, B, C)
each message went to and dots for its tool calls in that account's
shade, drawn as Stays has it now (Auto moves each message, Session one
account a conversation, Off every request). Theme tokens only (--fg-2,
--muted, --faint, --card-2, --line), no colour. The figure lives in
rotfig.js, imported when In turn is first shown; the core keeps a
one-line hook, and its budget goes up 333 for that and the words.

Run (mote, at this tree): rotate-figure.test.cjs, new, provider editor
and group editor, en zh zh-TW ja de, 900px light and 420px dark,
chromium and webkit, 40/40; stays-strict, routing-group-strategy,
routing-save, routing-advanced, rate-limited-sink, group-template,
group-editor-fits, group-editor-align, routing-affinity-order,
routing-affinity-lead, routing-affinity-cache-write,
routing-pool-tooltip, routing-rows-fit, routing-weight-chip,
group-patience, group-defaults, builtins, search-keys, i18n-keys,
i18n-en-no-cjk, text-size, routing-editor-foot, gateway-key-own-rotate,
routing-accounts-narrow all ok; site worker.test.mjs 41/41;
TestCoreScriptBudget ok; go test ./internal/cli ok; gofmt clean; go vet
./internal/cli ./internal/gui darwin, linux -tags nogui, windows ok.
Red, the same on origin/main 5eac086ae (run there on mica):
account-arrange 53 !== 52 (#6010), old-webkit headerpresets.js (#6030)
and :has() in app.css (#5919).
After the rebase onto d6a6865b1, again at this head: TestCoreScriptBudget
ok, rotate-figure 40/40, site node --test 120/120; i18n-keys red only
on main's "No folder" in memory_mcp.go (72facf72e, #6422). Rebased
again onto 1cc7b7267 (a Gateway list label in app.css and i18n.js):
the core budget measured again there, 1,266,252 of 1,266,341; the full
suite runs after the tag.

Broken by hand: the new test against origin/main's assets is red (old
words, no figure); Session drawn like Auto is red (AAABBB expected,
ABCBCA drawn); the hook never drawing the figure is red.

Not tried: the real app (Wails WebKit, WebKitGTK); the figure is a
static SVG, no motion.
2026-11-13 12:55:57 +08:00
yetone e39b9d5df7 cli: magpie tool reads an event-stream answer and names its folder (Norethcy on X, #6049, #6392)
`magpie tool memory_search --scope project --json` exited 1 with "isn't
JSON-RPC: is it magpie? (invalid character 'e' ...)", and memory_save said
the same after it had saved. The CLI sent no X-Magpie-Cwd, so the memory
server asked it roots/list on the call's own event stream (it accepts
text/event-stream), waited 3s for an answer that never came, and sent the
result as a second SSE event; rpc() then read the whole stream as one JSON
body.

Now magpie tool sends the folder it runs in (X-Magpie-Cwd), as `magpie mcp
memory` does, so --scope project is that folder's project and no roots are
asked. rpc() also reads a text/event-stream answer: it takes the data event
whose id is the call's, answers a server's roots/list with its folder and
refuses any other ask at once, so no server's question breaks the CLI or
makes it wait.

Run (mote, -tags nogui):
- TestToolMemoryThroughTheGateway (real gateway, sandbox HOME, a git repo
  as cwd): red on the old code with the reporter's exact error; green now,
  both calls under 2.5s.
- TestToolReadsAnEventStreamAndAnswersTheServer: red on the old code.
- go test ./internal/cli: ok.
Broken by hand: without the header, the event-stream test is red (no
folder named); with stream reading off, it is red with the reporter's
error.
Not tried: the reporter's macOS app build itself; Windows.
2026-11-13 12:29:04 +08:00
yetone c2fd48782b Put back what 1f05c311d took out of main by mistake
1f05c311d was committed with its worktree's older tree on top of a
fresh origin/main (git reset --soft), so beside the memory fix it
undid every file 610ae1f54..c1312ac15 changed (45 files: key balance,
import links, project subagents, uninstall, site, LESSONS.md and
more). This commit restores each of them to c1312ac15 byte for byte;
the tree is now c1312ac15 plus the memory fix alone
(git diff --stat c1312ac15 HEAD: the 4 files of the fix).
2026-11-13 12:18:23 +08:00