Commit Graph
2029 Commits
Author SHA1 Message Date
yetone 1ccacad632 agent: Obsidian is listed only when a vault has Copilot (iEthan333 on X)
detect was "obsidian's config folder exists", so every Obsidian user got a
row whose provider field could only fail ("no Obsidian vault here has
Copilot"). It now needs a vault in obsidian.json with Copilot installed
(.obsidian/plugins/copilot/manifest.json) or magpie's provider already in
its data.json, so a wired vault can still be disconnected. Every OS's config
folder (mac, Windows, Linux, Flatpak, Snap) is already read by obsidianDirs.

Siblings checked: Zoo Code and Copilot (JetBrains) already require the
plugin installed; VS Code forks and Raycast are the apps that hold the
setting themselves. None changed.

Run: go test ./internal/agent -run Obsidian (wsl-run); the new no-Copilot
vault assertion is red on the old detect (checked by hand). Full agent
package, gofmt, linux and windows vet: see push notes. Not tried: a real
Obsidian install.
2026-11-11 14:34:37 +08:00
yetone e1a2226405 library: EverMe Memory and Nowledge Mem are offered in the market as memory sources, added in one step (OipsAnthony on X)
Both publish an MCP server: EverMe's @everme/memory-mcp (stdio, agent id and evt_ token, managed backend preset) and Nowledge Mem's Streamable HTTP endpoint at 127.0.0.1:14242/mcp (optional Bearer key for a Mem reached over Access Anywhere). Added beside Magpie Memory; their memories stay in their service, and magpie's digest and Memory tab don't read them (docs/subsystems/memory.md).

Run (wsl-run, magpie-wt/memprov at origin/main 032340056): go test -count=1 ./internal/library ok, GOOS=windows go vet ./internal/library, go vet -tags nogui ./internal/library, gofmt -l clean. TestThirdPartyMemoryServers is red without the two entries (the market has no such server). Not tried: a real EverMe token or a running Nowledge Mem; GUI market tests (the page lists servers from the API, no GUI file changed); mote was out of disk, so nothing ran there; full suite not run.
2026-11-11 14:34:30 +08:00
yetone f5e1b10913 settings: longest context can hold a model's own window too (WJaunita45604 on X)
v0.1.3681's Longest context left a window the user set for a model, or "*"
on its provider, alone even when longer. Settings > Models > Routing now has
a menu beside the field: "Models without their own" (the default, as before)
or "Every model". In both modes the shorter of the cap and the user's own
window is told; they differ only when the user's own is longer (own keeps it,
every model brings it down). Settings.ContextCapAll, Settings.CappedOwn,
POST /api/settings/context-cap-mode {all}, magpie model context-cap all|own.
Applied in provider.windowIn (so /v1/models, catalogs, compaction), Codex's
CodexNativeWindow/CodexWindow (the list's ETag tag carries the mode) and the
gateway fallback window. i18n in zh, zh-TW, ja, de.

Run (wsl-run, mote's disk was full): provider (full), settings, settingsapi,
codexcat packages; cli -run ContextCap; gateway -run ContextCap|ModelsList;
GUI context-cap, i18n-keys, model-load, settings-places, settings-general in
chromium and webkit; TestCoreScriptBudget; gofmt; go vet nogui and
GOOS=windows vet. Broken by hand: windowIn's CappedOwn removed turns
TestContextCapAllHoldsTheUsersOwnWindowsToo red.
Not tried: the whole Go and GUI suites, a real Codex reading the list, macOS
or Windows runs, GUI in zh-TW/ja/de beyond the i18n-keys check.
2026-11-11 14:28:17 +08:00
yetone 69453574d7 docs: a key's usage cap (@wanggenjidev on X)
gateway-routing.md and providers-accounts.md: a key whose usage windows magpie reads takes the same usage cap an account does.

Record for the three commits (@wanggenjidev on X: Codex-style percent cap for OpenCode Go keys, generically for every key with windows magpie reads):
- Run at the pushed head (rebased on 08a852a36): TestKeyTakesUsageCap and TestKeyUsageCapPassesTheKeyOver ok; gofmt clean; key-usage-cap, key-spend-cap, account-cap, window-cap, i18n-keys: 180 pass, 0 fail on WSL, chromium and webkit. window-cap in webkit alone: 60/0 on this head and on origin/main a3d2a85dd.
- Earlier on mote at the previous base: provider/gateway/cli targeted tests ok; ./internal/gui ok 188s with -timeout 45m; vet darwin, linux nogui, windows clean.
- Broken by hand: the gateway hold removed, TestKeyUsageCapPassesTheKeyOver goes red.
- mote's disk filled during checking (52 webkit window-cap fails there, 60/0 on WSL on both main and this head); not a window-cap bug found on this change.
- Not tried: a real OpenCode Go key with live windows, Windows/Linux GUI runs, WebKitGTK. The whole GUI suite and the Go suite run after the tag.
2026-11-11 14:21:06 +08:00
yetone d936be7639 usage: Claude's card shows the extra-usage cap and its spend (Shinji_Zl on X)
Claude Code's `claude -p /usage` text omits extra usage, but with
`--output-format json --verbose` a message carries
usage_report.rate_limits.extra_usage (cap and spend in cents). The gateway
adds it as a line; parseClaudeUsage reads it as an Aside "Usage credits"
window (n / cap USD), so a spent cap never marks the account used up.
magpie asks Anthropic nothing itself, and cannot make a request spend
credits: Anthropic decides. The prepaid balance is a separate endpoint and
is not shown.

Run (wsl-run, linux): TestClaudeUsage*/TestClaudeOverage in provider and
gateway, go vet linux/windows/darwin, i18n-keys, i18n-en-no-cjk and
claude-overages GUI files (chromium + webkit).
Broken by hand: Aside false -> TestClaudeUsageCredits red.
Not tried: a real account with extra usage on (the owner's is off); full
suite after the tag; Windows run.
2026-11-11 14:08:18 +08:00
yetone 61a04f42a2 library: a project's Skills menu groups the skills by source, a heading ticks the whole group (Elorynth on X)
The project card's Skills menu listed every library skill flat. It now
lists them as the Library does (skillGroups(true): by repository or the
user's own group, this computer's last, whatever sort the list has), with
a heading over each group. Pressing a heading ticks all of the group's
skills, or unticks them when all are in; it is half-ticked while some are.
A typed filter keeps a group's heading over the skills it finds, and
matches a skill by its group's name. One group only stays the flat list.
openProtoMenu takes a `group` option (the values it ticks) for this.
Paid for in app.js by five comments cut, no budget raise.

Run on the Windows box (mote's Chromium launch hung, SSH refused at
times): project-skills-groups.test.cjs, new, in chromium and webkit,
en/zh/zh-TW/ja/de at 400px wide: red on the old code (6 of 6), green
after. With project-*, i18n-*, menu-*, proto-menu-overflow and
skill-group* GUI files in both engines: all green except
menu-input-scroll and menu-scroll (14 chromium, 13 webkit), which are
red the same at origin/main aa2ea5c90 on the Windows box (commented on
#3402). TestCoreScriptBudget ok at the rebased head.
Not tried: the full suite, the real Linux app (WebKitGTK). Part 2 of the
report (instruction presets bundled into a toolkit) is not built: a
project has no instructions of its own yet.
2026-11-11 13:31:23 +08:00
yetone aa2ea5c906 agent: Claude's main model is written as a tier alias, so Claude Desktop on a subscription no longer sends magpie's prefixed id (iryan_sun on X)
Claude Desktop's Code tab sets CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST=1. Claude
Code then ignores the env block of settings.json (base URL, token, tier model
vars) but still honours the top-level `model`. magpie wrote `model` as the
provider-prefixed id (anth/claude-opus-4-7), so the official API rejected it
and WebFetch failed.

writeTiers now writes `model` as the tier alias (opus/sonnet/haiku/fable, with
[1m]) whose ANTHROPIC_DEFAULT_<TIER>_MODEL already maps to the main model, on
this machine's ~/.claude only. A distro file, the claude-magpie launch file and
a main with no tier keep the id. The model field reads the alias back through
the tier env, also while the gateway is unreachable (drift). Unwire drops
`model` when magpie wrote the alias.

What happens to old values: a settings.json an older magpie wrote with the
prefixed id (model "up/big-x") is rewritten to the alias at the next catalog
sync, for every user, with no step on their side; the tier env already maps it
to the same model. A prefixed id picked from the modelPicker rows is brought to
the alias the same way. A model the user set themselves (claude-haiku-9,
own/xyz, opusplan) is never rewritten.

Ran:
- Real Claude Code CLI (~/.local/bin/claude) in a sandbox HOME and
  CLAUDE_CONFIG_DIR, wired by a magpie built from this tree (gateway :38760)
  to a scripted upstream that logs each request's model: main -> big-x,
  `--model haiku` -> fast-x, a subagent (Agent tool) -> sub-x, WebFetch's
  extraction of https://example.com -> fast-x (haiku's). Old prefixed file
  migrated to "sonnet" by a catalog sync; the three user models above stayed.
- TestClaudeMainModelIsAnAlias: red on the old code, red again with mainWord
  broken by hand, green with the fix; it also covers the user's own models.
- 11 existing tests read the raw `model` as an id; they read it through
  writtenModel now. TestWSLClaudePick compares the distro's file with the
  native one after normalising `model` (the distro keeps the id by design).
- go test ./internal/agent ok at the pushed head; gofmt; go vet darwin, linux
  nogui, windows for internal/agent.
- internal/cli: TestGatewayKeyLimitCLI is red on origin/main b39a793c9 too,
  untouched here: #6082.
Not tried: the real Claude Desktop UI (only Claude Code with the
host-managed flag, 2.1.312/.314/.316); a user whose Claude runs in a WSL
distro is not covered; the full suite is run after the tag.
2026-11-11 13:28:02 +08:00
yetone 4ddc150c66 gui: a hover hint beside the account switch says how it works and why it is the agent's own use
The owner (11-11): "在这个切换开关旁边有一个 hover 的提示,提示这个原理是啥,
以及它为什么不会让你的账号被封禁". Beside Switch {agent}'s account
automatically, an ⓘ mark; resting on the row (or a key reaching the
switch) shows settingshints.js's card with three lines:

- how: the next account's sign-in is written where the agent keeps its
  own, as /login or codex login does; what is left is read by Claude
  Code's own /usage, or where Codex's /status reads it; sessions already
  open keep their account until restarted;
- why it is the agent's own use: Claude Code still sends every request
  itself, straight to Anthropic, unchanged, and magpie sends none (an
  account's own proxy kept); for Codex, only which of your own accounts
  it is signed in to changes;
- the limit: the same as switching by hand; use only your own accounts,
  sharing one is against the vendor's terms. It promises nothing about
  bans: that is the vendor's call.

Only where the switch moves the sign-in. Under the gateway it moves
Claude Code's requests instead, and the "straight to Anthropic" line
would be false, so SignInMovesOf now says `routed` on a kept Claude
whose requests go through the gateway, and the hint shows for `moves`
and for `kept` without it.

The lines and mark are in autoswitchtip.js, imported when the switch is
drawn; app.js gets the one import line, paid for by cutting this branch's
own two comments: the core is 1,533,771, under 1,533,802, no raise.
Strings in zh, zh-TW, ja and de.

Run (xiaomi-gpu, Windows 11, win-run; mote refuses ssh):
- node --test sign-in-moves, keep-login, pool-ends, old-webkit, i18n-keys,
  i18n-en-no-cjk, settings-hints, editor-hints: 148/152. The 4 reds are
  the same at the base 156861b3a: old-webkit's headerpresets.js (#6030)
  and Safari 15.0 :has() (#5919), and settings-hints webkit de at 420px,
  filed as #6073.
- the new test (Chromium and WebKit, en and zh): the mark sits beside
  the switch on its line, the lines rest out of sight, hovering shows the
  card with the three lines beside the row, a press on the mark posts
  nothing; no mark for kept+routed or gateway.
- Broken by hand, each red: the mark's preventDefault removed (a press
  turned the switch off); the routed check dropped (kept+routed showed
  it); Routed not set in SignInMovesOf (TestSignInMovesSaysWhatSwitchDoes).
- go test -run "SignInMoves|ClaudeRoutedSignIn|KeepLogin|SwitchOnly"
  ./internal/provider ok; go vet ./internal/provider ok;
  TestCoreScriptBudget ok; gofmt -l clean.
- A Chromium screenshot of the card in zh looked at.

Not tried: the Codex variant's card in a browser (its strings pass
i18n-keys); the real app; macOS and Linux.
2026-11-11 13:05:16 +08:00
yetone fc24a89183 gui: switching the agent's account is a switch of its own
The owner (11-11): "这个轮换做成一个开关". The used-up switch was off
behind a "Keep Claude Code signed in to" tick box, and the tick box read
as something else. Under the accounts of a Claude Code or Codex with
more than one account there is now a "Switch Claude Code's account
automatically" switch:

- on: the line from the previous commit sits under it, saying when the
  sign-in moves and whether it comes back;
- off: "Keep Claude Code signed in to [account]", the picker that was
  the tick box's (first account, or the one picked);
- switch-only: held on and disabled, with a title saying why, since
  switch-only always moves the sign-in.

The switch posts provider/keeplogin as the tick box did (keepLogin is
the switch off), so nothing on the server changes and a user's saved
keepLogin reads as the switch off. The name is a label for the switch:
clicking it flips it too. `.editor label`'s text-align: right is undone
for it, so its words start at the left. The two "Automatic switching is
off" strings give way to the switch's name and title in zh, zh-TW, ja
and de. docs/subsystems/providers-accounts.md says it under "Used-up
switch".

Run (Windows box, win-run; mote refused ssh and WSL's GUI runs failed
with E_UNEXPECTED):
- sign-in-moves, keep-login, pool-ends, i18n-keys, i18n-en-no-cjk,
  routing-signin, account-return in chromium and webkit, en and zh:
  100 pass
- after the alignment fix: sign-in-moves, keep-login, pool-ends: 72 pass
- TestCoreScriptBudget (wsl-run): PASS
- screenshots, chromium en and zh, on and off: name at the left, switch
  at the right, line or picker under it
- after rebasing on origin/main: see the push

Broken by hand:
- posting !on from the switch: sign-in-moves red 4 of 16;
- dropping the text-align fix: the "words start at the left" check red
  (160 to 224px in), where the old box check had passed.

Not run: the whole GUI suite with the switch (mote and WSL down). At the
previous commit it was cut short on mote with load timeouts; the account
reds there (account-arrange, agent-switch-accounts, claude-switch-only's
"page doesn't move") also fail on origin/main d1b4eff5a and are #6010,
#5925 and #4344. Not tried in the real app with the owner's accounts;
their keepLogin (the switch off) is left as it is.
2026-11-11 13:05:16 +08:00
yetone 8a3dbf0232 gui: the accounts list says what magpie does with the agent's sign-in
A user with two Claude accounts read the used-up switch as gone. Their
"Keep Claude Code signed in to" box was ticked, which turns the switch
off, and nothing on the page said so. Under the accounts of a Claude Code
or Codex with more than one account, a line now says what the switch
does, as NextLogin decides it:

- kept: switching is off, the agent stays on the first account (or the
  one picked) even once it runs out;
- gateway: Claude Code's requests go through magpie, which picks an
  account per request; its own sign-in stays put;
- moves: the share it moves at (98%, or used up for In order / Until
  used up), and whether it comes back to the first (returnsToFirst).

provider.SignInMovesOf gives the mode from the same checks NextLogin
makes (leftAlone, keep, ClaudeThroughMagpie && !SwitchOnly, SpentShareOf,
returnsToFirst). /api/providers carries it as signInMoves on the agent's
own provider row. The Routing tab's sign-in note says the gateway case
too. Strings in zh, zh-TW, ja and de.

Run (mote, through mote-run):
- go test -run 'TestSignInMoves|TestClaudeRouted|TestKeepLogin|
  TestClaudeSwitched|TestNextLogin|TestCodexLogin' ./internal/provider: ok
- go test -timeout 45m ./internal/gui ./internal/provider: ok (script
  size budgets included)
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows on
  provider and gui: ok
- GUI: sign-in-moves, keep-login, i18n-keys, i18n-en-no-cjk,
  routing-signin, account-return in chromium and webkit: 60 pass
- whole GUI suite (make test-ui): see below
- screenshots in WebKit, en and zh: the line sits inside the list at the
  rows' inset; zh sentences join with no space

Broken by hand: dropping NextLogin's keep case from SignInMovesOf turns
TestSignInMovesSaysWhatSwitchDoes red; not appending the line turns
sign-in-moves.test.cjs red 4 of 4.

Not tried: the real app with the owner's accounts; the user's own
keepLogin is left as it is.
2026-11-11 13:05:16 +08:00
yetone 58fb070953 settings: named proxies, chosen as inherit, direct or a saved one anywhere a proxy is (@tsingchao on X)
Settings > Network keeps named proxies (name, address, optional login)
with a Test that says reachable and the latency. Everywhere a proxy can be
chosen (global, plugin downloads, a provider, a key, a Claude account) now
has a Saved mode beside the others; the value is "@<id>". Addresses typed
before are read exactly as before, nothing is migrated or overridden.
netproxy.Parse/Resolve/Redact/EnvWith/Dispatch resolve a reference at the
lowest layer, so a proxy edited once reaches the gateway, usage reads,
sign-ins and the plugin host at the next request; Claude Code's
settings.json env (a snapshot) is rewritten by provider.ProxyEdited.
A reference this computer lacks fails closed (DeadProxy), says the proxy's
name in the request error and as "Proxy missing: {name}" on the provider
row, and never goes direct. The password lives in settings.json (0600), is
never read back by the page, logged, or put in Settings sync. The list
rides with the providers part of a sync (Bundle.Proxies, MergeProxies by
id, passwords only with keys). A proxy in use can't be deleted (409).
The saved list's page code is in proxies.js, loaded when Settings draws it;
app.js grew by Saved-mode helpers only, paid for by 16 long comments cut
(core budget unchanged, no raise).

Run (mote refused ssh all session, so Go and GUI went through win-run on
xiaomi-gpu, Windows 11; gofmt and darwin/linux-nogui/windows go vet were
clean on mote before it went down, at the pre-sync tree):
- go test settings, netproxy, backup, settingsapi, davsync: ok on Windows
  (earlier on mote: also gui, provider, plugin with real Bun, gateway).
- saved-proxies.test.cjs 20 of 20 (chromium+webkit, en zh zh-TW ja de,
  420px) twice more on Windows; provider-proxy-missing.test.cjs 20 of 20.
  One webkit de 420px run of saved-proxies failed once under 4-way
  concurrency and passed 3 of 3 alone; not reproduced.
- TestCoreScriptBudget ok after the move (it was 3.4KB over before).
Red on this tree and on origin/main alike (Windows run, not mine):
settings TestSharedCheckedReadsOnceAndKnowsUnknown; provider
Codex keychain/Git tests; plugin TestHostRunsAsMagpieBun, TestPiPackage;
gui TestGatewayHeldByAContainer and others; old-webkit "compat.js is the
first" (headerpresets.js) and ":has() (Safari 15.4)" on origin/main 245f07b19.
Broken by hand: restore skipping Proxies (TestSavedProxiesTravelWithProviders
red), Parse returning nil for a dangling ref (netproxy tests red), the
Proxy-missing badge disabled (provider-proxy-missing 0 of 20), and the Claude
env snapshot failing open (found by reading, test added).
Not tried: real vendors, the real Claude Code, a real two-computer sync, the
macOS suite and the whole GUI suite on this final tree (mote down; the whole
suite ran to test ~3700 on the earlier tree with reds owned by others).
A proxy missing whose sender never had it is named by its id.
2026-11-11 12:26:43 +08:00
yetone cc659c7559 library: Instructions reach MiniMax Code and WorkBuddy (lysyscy8 on X)
MiniMax Code reads AGENTS.md in its data folder ($MINIMAX_DATA_DIR, else
~/.minimax) before every conversation (readGlobalInstructions in
@minimax-ai/code 0.7.6's chunks), so its target now names that file.

WorkBuddy and WorkBuddy AI keep their instructions as the string
personalization.customPrompt in app/app-config.json of their folder
(PersonalizationCollector and AppConfigService in 5.5.6's app.asar, both
builds). Target.Field says the instructions are a JSON string rather than a
file; instrRead/instrSave read and write it through edit.SetJSON/DelJSON, so
every other key, its order and indentation stay, the user's own prompt stays
in the field around magpie's marker part, and taking the part back leaves
the file byte for byte as it was (an empty personalization object magpie
made goes too). A file that is not JSON, or a field that is not text, is
unknown: reported, never written over. Import takes the user's prompt into
the library the same way.

Run: TestMiniMaxCodeInstructions, TestWorkBuddyInstructionsAreAJSONField,
TestWorkBuddyInstructionsFromNothing, TestWorkBuddyInstructionsUnreadFileIsLeftAlone,
TestWorkBuddyInstructionsImport and TestWorkBuddyAIInstructions, in a sandbox
HOME, on Linux (wsl-run) and Windows (win-run); all fail with the two target
assignments taken out (broken by hand), and pass with them. internal/library
whole on Linux (ok) and Windows: 3 reds, TestGoneAgentListedToTakeOut,
TestCheckMixedServerEachSide (both #4115) and TestPluginImportCarryOnOffRemove
(#6065), all three red the same on origin/main d1b4eff5a on Windows.
Not tried: a running WorkBuddy or mcode reading the written values (the apps'
sources were read; WorkBuddy loads its config as it starts, so a running one
may need a restart); WORKBUDDY_USER_DATA_DIR is not followed.
2026-11-11 11:54:21 +08:00
yetone a982f34130 plugins: async gateway hooks get the request's kind, subagent or not (ahwulv on X, #4655)
GatewayContext had no subagent marker, so OpenViking could not skip memory
recall for Claude Code's subagents. It now carries kind: "subagent" when the
client says so on that request, "" otherwise (main conversation, or a client
that doesn't say). hookKind (internal/gateway/middleware.go) reuses the
gateway's own readings: Claude Code's x-claude-code-agent-id (subOf), and
Codex's x-openai-subagent collab_spawn (callKind + usage.PurposeOf, so a
Codex review or compaction is not a subagent). Headers from #4655's real
Claude Code 2.1.312 capture. It is read per request, so onRequest and that
request's onResponse see the same value and the main turn after a subagent
in the same session is "". Never guessed from the prompt or Agent tool
history. Documented in docs/subsystems/gateway-request-hooks.md.

Before/after: a hook's ctx had no kind; ctx.kind is now "subagent" for such
requests (the OV plugin already reads ctx.kind === "subagent").

Run: TestHookKindFromClientHeaders (claude subagent, claude main in the same
session, codex collab_spawn, codex review, none) and
TestAsyncGatewayHookKindReachesPlugin (real gateway + Bun: main, subagent,
main again; onRequest and onResponse) on mote at the commit before the final
rebase and on a WSL box; with Kind dropped from the context the e2e test
goes red (saw "" want "subagent"). go vet darwin green. Not tried: the real
OpenViking plugin; Claude Code itself against this build; linux/windows vet
was still queued on mote when this was pushed.
2026-11-11 11:50:13 +08:00
yetone d1b4eff5aa agent: version detection and updates for agents installed in WSL distros (mewcoder on X)
A WSL twin row (<kind>@wsl:<distro>) showed no CLI version and no Update
button; the host path's cliupdate machinery only knew host binaries.

Now a twin in a running distro is read and updated inside the distro, for
every cliSpecs kind that has a command (cliupdate_wsl.go):
- one `wsl.exe -d <distro> -e sh` probe prints the command's real path,
  --version and exit code, with its own folder, npm prefix, ~/.local/bin and
  ~/.bun/bin first on PATH (wsl.exe -e has no login PATH, node CLIs exit 127);
  kept 10 min in wslProbes, dropped by Rescan and after an update.
- wslHowInstalled applies the host rules to the Linux path: own updater
  (spec.self), Homebrew, npm, bun, pnpm; volta, yarn and unwritable prefixes
  are left alone.
- the update runs in the distro through wsl.exe (wslRunUpdate); a Linux
  brew's newest is asked in the distro too.
- a stopped distro is never started: no version, and an update says to
  start it. CLIs() lists twins, so Update all takes them in.
No GUI change: the Agents row is keyed by agent id.

Run: gofmt clean; go vet darwin, linux, windows on internal/agent;
go test ./internal/agent ok on mote. TestWSLAgentCLIVersionAndUpdate (fake
registry + fakeWSL distro with an nvm prefix) goes red with the CLI hook
removed from CLI(). Real: win-run on xiaomi-gpu, magpie-desktop's own codex
read 0.162.1, Update true, updated to 0.167.1.
internal/gui on mote: only TestPanelHiddenByWailsMarksPageOutOfSight failed
(AppKit test killed at 120s, mote load ~80; no GUI file touched).

Not tried: real brew in a distro, proxy env inside the distro, sudo-owned npm
folders, kinds without a bin (Goose, mu), starting a stopped distro. Host's
proxy settings are not carried into the distro.
2026-11-11 11:35:41 +08:00
yetone 7476328901 settings: one longest context for every model (WJaunita45604 on X)
Settings > Models > Routing has a Longest context field (magpie model
context-cap [<size>|off], POST /api/settings/context-cap). It lowers every
model's window to it, so a user need not set each model. A window the user
set on a model, or on its provider with "*", wins and is not capped; a model
whose window is unknown stays unknown.

It is applied where the window is derived, provider.windowIn, so /v1/models,
every agent's catalog, group windows and the compaction thresholds that
follow the window all agree. Codex's own models take it through
CodexNativeWindow, CodexWindow and codexcat.Cap on the list the gateway
serves; the list's ETag carries the cap so Codex asks again. The provider
editor's Listed value stays the vendor's.

Run (mote): provider, codexcat, cli, settings, settingsapi, gateway tests;
GUI context-cap, model-load, settings-places, i18n-keys, settings-general in
chromium and webkit (en, zh); TestCoreScriptBudget; gofmt; vet on darwin,
linux nogui and windows. Broken by hand: windowIn without the cap turns
TestContextCapHoldsEveryModelButTheOnesTheUserSet and TestModelsListContextCap
red.
Not tried: the whole GUI suite (one row added to an existing list, no new API
read on page load), a real Codex reading the capped list, Windows run.
Not covered: Claude Code's own [1m] choice (claudeRunName) and agent/claude.go's
fallback when a ref has no window.
2026-11-11 11:07:57 +08:00
yetone eb56de0b59 gui: a model's Same as can be picked from models.dev's list, filtered (timfang4162 on X)
In Model settings the Same as box, which binds a provider's model to
another model's metadata (window, reply limit, levels, images, list
price), was a bare text field. A button beside it now opens the app's own
menu (not a <select>) with the models of the models.dev catalog magpie has
already synced: id, name, window and price on each line, a Filter… box over
id, name and maker, the current one ticked. A pick fills the box, so it is
staged and saved with the editor's Save like a typed id, and a value typed
afterwards still wins; nothing about how Same as is read changed.

GET /api/catalog/models lists the cache with one entry per model
(catalog.SameModel), taken from the provider that lists its window and
price. It fetches nothing. The picker lives in modellimits.js, loaded with
the model rows, so the core script budget is not raised (five comments in
renderModels cut to pay for the strings, 613 bytes of room before).

Run on mote at this tree:
- TestCatalogModelsListsTheSyncedCatalogOnce; broken by hand (last
  provider wins instead of the one with window and price) it fails with
  "kimi-k3 = {ID: ... }; want the provider that lists its window and
  price".
- model-same-pick.test.cjs, 22 cases (chromium and webkit, en zh zh-TW ja
  de, 400 and 900px): filter by maker, name and id, Enter picks, the
  current one ticked, one catalog read, no scroll, no <select>, saved as
  modelPrefs same; a failed read says so. With the filter argument taken
  out of openProtoMenu it fails. provider-same-as.test.cjs still passes.
- gofmt, go vet (darwin, linux nogui, windows) on internal/gui,
  TestCoreScriptBudget.
Full GUI suite at this tree (rebased on 5c05ac41b): the only reds are not this change's, each also red or flaky at origin/main 1f99f6f0b run alone, and filed: account-arrange #6010, account-eye #5052, account-refresh-holds #5814, accounts-own-signin's Antigravity test #6038 (a webkit access-control flake that moves between languages).
Not tried: the real app's WebKitGTK; the full suite is started after the
push.
2026-11-11 10:56:41 +08:00
yetone 0cc91af3db agy: magpie's models go in a settings file of its own, so agy's remote control works (baysonfox on X)
magpie wrote modelProvider gemini, the model and its custom models into
agy's settings.json. That made every agy an API-key session: no Google
account, so no remote control (needs the sign-in plus Google's server-side
flag), and a plain agy asked for GEMINI_API_KEY too.

Now they go in ~/.gemini/antigravity-cli/magpie-settings.json, handed to agy
as --settings for the one session (the launch command, magpie agy run, and
the function in a shell or a WSL distro). settings.json stays the user's.
An older wiring is given back (stashed model and provider) at the next Sync
or pick. agy remote-control and --remote-control run plain, on the sign-in.

Run (mote): go vet, GOOS=windows and linux nogui vet, agent/cli/sessions/update
packages (see push note). Real agy 1.5.3 in a sandbox HOME: plain agy with
the user's untouched settings.json now asks for sign-in (no GEMINI_API_KEY
error); the new launch reached a stub gateway at /v1beta/models/<m>:streamGenerateContent.
Broken by hand: remote-control bypass removed, TestAgyRun red; TestAgy red
on the old code (settings.json written).
Not tried: real remote control (needs a Google sign-in, none in the sandbox);
signed-in BYOM custom models; Windows PowerShell function run.
2026-11-11 10:31:52 +08:00
yetone 9cdeb485bb gateway: a limit that names one model rests that model, not the whole key (WJaunita45604 on X)
A 429 or quota refusal whose body names the model asked (Groq's per-model
TPD, OpenAI's per-model TPM, Gemini's QuotaFailure, any vendor's "limit for
model X") used to rest the account's key, so every other model of the
provider waited. modelNamed (routing.go) now sends such a refusal down the
same path as modelCooledDown: it rests restID (key/model). Readers of rest
state (restingOf, sink, GUI badges via Rest.Model) already understood those.
Account-wide refusals (no model named, another model named, credit, auth)
still rest the key. The id match is on whole ids (gpt-4o is not gpt-4o-mini).

Cline's and ZCode's guard tests expected another vendor's words to rest the
key even when they named the very model; they now expect the model alone.
The "not a trial" ZCode row moved to the new test.

Run (mote): the new TestModelNamedLimitRestsTheModelNotTheKey,
TestLimitNamingNoModelRestsTheKey and TestModelNamedReads, red on the old
code (mr-red.log); gateway tests matching Rest|Rate|Quota|Fallback|Limit|
Cooled|Pool|Overload|Sink|Credit|ZCode|Cline; gofmt; darwin, linux and
windows go vet of internal/gateway.
Broken by hand: modelLimited back to modelCooledDown only, the new tests go red.
Not tried: a real vendor account; the full suite (started after the tag).
2026-11-11 10:31:29 +08:00
yetone 90a028d2c1 air: JetBrains IDEs get a Magpie agent for each running WSL distro (yanghonghang on X)
IDEA 2026.3 starts a WSL project's ACP agent inside the distro through EEL.
An absolute Windows command whose environment differs from the project's is
refused ("ACP executable belongs to a different environment"), which the AI
Assistant shows as "Magpie does not run". The host entry in ~/.jetbrains/acp.json
therefore never worked for a WSL project.

Now each running distro that has opencode gets its own "Magpie (WSL <distro>)"
entry: command is the distro's opencode as a \\wsl.localhost UNC path (the
WSL descriptor, accepted), env OPENCODE_CONFIG points at a magpie-opencode.json
written in the distro's ~/.jetbrains. Set, Sync, Check and the uninstall path
all reach the entries; a stopped distro is never started. The probe now
records the binary paths (distro.Paths).

Ran: mote-run go test -run 'TestAir|TestWSLProbeKeepsPaths' ./internal/agent
(ok), the same on win-run and wsl-run (ok), gofmt, GOOS darwin/linux/windows
go vet ./internal/agent. Broke by hand: turning the WSL branch off in airAt
turns TestAirIDEAddsMagpieAgentForWSLProjects red.
Not tried: a real JetBrains IDE (none on the Windows box); the EEL rule was
read from the IDE's bytecode.
2026-11-11 10:27:44 +08:00
RainierandClaude Opus 5.5 4d9b798d50 web: a LazyCat box's administrators open the page with the box's sign-in (MAGPIE_WEB_SIGN_IN=lazycat) (#5987)
magpie in a LazyCat app (懒猫微服) is opened from the box's app list by
someone signed in to the box already, and asks for a key they never
saw: it is in the container's log. A package can only hand the key to
every browser that reaches the app, or put a proxy in front that adds
the key's cookie to what the box signed in.

The box's ingress, lzc-ingress, sends a browser that isn't signed in to
the box's login page, and puts on every request it passes the app the
box account (X-HC-User-ID), its role (X-HC-User-Role, ADMIN or NORMAL)
and what sent it (X-HC-Source, client for a browser), in place of what
the caller sent. With MAGPIE_WEB_SIGN_IN=lazycat webGuard takes that
sign-in besides the key: lazyCatSignIn lets in an ADMIN account sent by
a browser, each of the three named once, and tells anyone else the box's
reason.

The box's sign-in is a cookie of the box's, and the box's apps are one
site, so a browser sends it with another app's page's requests too: an
earlier build of this change let another app's page on the box include
/boot.js and read window.bootPrefs. So it is taken only for what the
page itself or the user asked for (boxFetched, the Fetch Metadata:
Sec-Fetch-Site same-origin or none, or a GET or HEAD navigation to a
document from another page), never for another page's script, frame,
fetch or form POST, nor from a browser that sends no Fetch Metadata.

It sets no cookie of the page's own, so signing out of the box signs out
of the page. The key's link and cookie work as before, /api still
answers the page alone (webOwnPage), and the gateway's client routes on
the page's port go to the gateway first (onePort), which asks for a
gateway key. StartWeb refuses another value, and lazycat where
LAZYCAT_APP_DOMAIN, which LazyCat sets in an app's containers, isn't
set: all magpie can check, so the setting is the package's word that the
box's ingress is the only way to the page's port. magpie web prints the
box's address beside the link.

Docs: reference.md's new LazyCat section, with a manifest and what must
never reach the page's port, and gui-shell.md's Browser mode row.

On a box (lzcos 1.6.2+fix.4), a probe app that echoes its request
headers: a signed-in browser's request carries X-HC-User-ID,
X-HC-User-Role ADMIN and X-HC-Source client, forged ones replaced; not
signed in, / goes to the login page and a public path gets none of the
three (forged ones taken off, repeated or in lower case too), while
X-HC-User-Groups passes on as the caller wrote it, so it is never read;
a TCP ingress passes every header as sent. Another app's container
reaches the app through the ingress alone (straight to the app's
container it times out); the box itself, and a container in its network
(network_mode: host, which a manifest may set), reach the port.

A test app made from the docs' manifest, running a build of this change
on 68cb92e8e in the image's place as its user (uid 65532): the box's
administrator opens the console with no key, and no cookie is set;
/v1/models still asks for a gateway key; from another app's page a
navigation opens the console, while a script include of /boot.js and a
frame are turned away; in the container, past the ingress, a request
with no Fetch Metadata, no X-HC-Source, NORMAL or a header twice gets a
401. Bound to /lzcapp/var/config, which the box makes as root's, magpie
couldn't write /config; bound to /lzcapp/var it can, and a gateway key
outlived the container.

Tests, through webServed with the headers the probe saw:
TestLazyCatSignInOpensThePage, TurnsAway, AsksWhereFrom, IsAskedEachTime
and IsNoGatewayKey (the client routes, with each sign-in that opens the
page), and TestWebBoxSignInChecksItsValue.
TestRemoteOpensTheOtherMagpie, new on main, gives webHandler no box
sign-in.

Run, at this tree, on 6c3f113ce: Docker golang:1.26.8 (linux/arm64):
gofmt clean; go vet -tags gtk3 ./... (with the GTK and WebKitGTK
headers, as CI), -tags nogui and GOOS=windows clean; both builds ok.
macOS 27.2 (go1.26.8, not root, a temporary HOME): go vet ./... and the
two cross vets clean, the three builds ok; go test -tags nogui ./...,
TestScriptFindsClaudeMoved skipped (it runs the real
/Applications/Claude.app, #5989): 92 packages ok; red outside
this change, each red the same at 6c3f113ce:
TestBunProxyLoginWithReservedCharacters (#3397),
TestGitUpdateInstallsTheBranchsCommitNow and
TestGitUpdateKeepsACommitPin (#5988), on this Mac's bun 1.3.11,
older than MinBun; TestEveryRouteHasACommandOrIsNamed: POST
/api/settings/join, new with e053c337a, has no command. /join, new
with it too, is a client route, so the docs' manifest lists it.

Broken by hand, each red, all green again put back; a break that lets in
what must be turned away was seen to reach the page: TurnsAway with the
once-each check out, no sender taken, the role in any case, the role or
the sender check out (IsAskedEachTime too), app:… and system alone
turned away, or the key's "open the link" kept in the box's 401;
AsksWhereFrom with boxFetched out, no Fetch Metadata taken, another
page's navigation taken of any method or into a frame, an object or an
embed (or anything but an iframe), its request for a document that isn't
a navigation, or another app's page's script (same-site, no-cors);
OpensThePage with another page's navigation taken by GET alone, or none
taken (IsNoGatewayKey too), a cookie set, or webOwnPage out;
IsAskedEachTime with the first sign-in kept; ChecksItsValue with lazycat
taken outside LazyCat or StartWeb not asking webBoxSignIn's error;
IsNoGatewayKey with the client routes behind the box's sign-in, or one
the box signs in on, or a HEAD to one, given to the page;
TestLazyCatManifestListsTheClientRoutes with /me out of the docs.

Not tried: a NORMAL account in a real browser (the box has one
account); signing out of the box in a browser; the box's own client
apps opening the page; a browser without Fetch Metadata; a header named
twice on a signed-in request through the ingress (a browser can't send
one); a multi-instance app; another lzcos version; a community plugin's
page on the box; a real vendor call through the box.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 10:15:40 +08:00
RainierandClaude Opus 5.5 db4da33bc6 gateway: a LazyCat box's X-HC-* headers go on only to a provider whose PassHeaders names them (#5987)
On a LazyCat box (懒猫微服) every app sits behind the box's ingress,
lzc-ingress, which puts on each request it passes the app who sent it:
the box account (X-HC-User-ID), its role (X-HC-User-Role), what sent it
(X-HC-Source), the device (X-HC-Device-ID, -PeerID and -Version) and
when it signed in (X-HC-Login-Time); the box's docs name
X-HC-User-Groups and X-HC-User-Ticket too. A request signed in to the
box gets them on the app's public paths as well, where a package serves
the gateway's client routes. The native route, the Codex passthrough and
relay to the ChatGPT backend (copyHeaders) and /mcp/<server> passed them
all on, so a vendor, the ChatGPT backend or a remote MCP server was told
the box account's name and role and the device's ids.

proxyIdentity takes any X-Hc-* as what a proxy says of the caller, as
it takes Tailscale-*, so nativeHeaderDropped, copyHeaders and the MCP
proxy's header loop skip them. lzc-ingress's X-Forwarded-By was dropped
already (X-Forwarded-*). What 7d196b679 checked and left stays as it
is: a provider's PassHeaders passes on the names it lists, these too, as
the user chose them (gateway-routing.md now says so); Codex's
allow-listed codexHeader, the Codex websocket's headers (taken from a
request magpie built) and passOnCaller are as they were.

What the ingress puts there was read off a probe app on a box (lzcos
1.6.2+fix.4) that echoes its request headers: a browser signed in to
the box got X-HC-User-ID, X-HC-User-Role ADMIN, X-HC-Source client,
X-HC-Device-ID, -PeerID, -Version and X-HC-Login-Time, on a public path
the same as on /.

Tests: TestNativeAnyDropsProxyIdentity and
TestPassthroughDropsProxyIdentity send ten X-HC-* headers and
X-Forwarded-By beside the twelve they sent, and check that none arrive
and X-Custom still does.

Run (macOS 27.2, go1.26.8 darwin/arm64), at this tree, on 6c3f113ce:
gofmt clean; go vet, GOOS=linux -tags nogui go vet and GOOS=windows go
vet of internal/gateway clean; go build -tags nogui ok; both tests ok.
The next commit adds a test to internal/gateway and changes nothing else
of it; the whole package ran there: ok.

Broken by hand: with the X-Hc- prefix out of proxyIdentity, both are
red: the native vendor, the ChatGPT backend and the MCP server were each
told all ten X-HC-* headers.

Not tried: a real vendor call through a box; a provider whose
PassHeaders names an X-HC-* header.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 10:15:40 +08:00
yetone bf0a1252fa codex: the chat open in the Codex app follows a provider switch (hubo31377762 on X)
Switching Codex between magpie and OpenAI left the chat that was open
unusable. The Codex app holds the writer lock of every chat it has loaded, so
no move touched that chat's row, and Codex 0.167 refuses to resume a chat whose
provider isn't the configured one (modelProviderMismatch openai to magpie,
modelProviderNotConfigured magpie to openai). Reopening it did not help.

Just before magpie ends the Codex app's app-server for the route change, the
held chats are now moved to the provider Codex is on: a paginated one by its
row, a legacy plain rollout in place at equal id length (openai and magpie),
packed legacy rollouts and other lengths left to the next sync
(provider.CodexBeforeAppEnd, agent.codexRetagOpenThreads,
sessions.RetagLoadedCodexThreads). The end is a clean SIGTERM and Codex writes
nothing back.

Run (mote-run): gofmt -l on the three packages; go vet for darwin, windows and
linux with nogui over ./internal/...; go test internal/sessions, provider and
agent. Real codex 0.167.1 app-server in a sandbox CODEX_HOME, both ways: no
retag gives modelProviderMismatch (openai to magpie) and
modelProviderNotConfigured (magpie to openai); with the row retagged and the
app-server SIGTERMed, thread/resume succeeds on the new provider in both.

Broken by hand: the hook call removed and the retag call emptied; both new
tests go red (open chat stays on the old provider, order is [end] only).

Not tried: the Codex app GUI itself, Windows runs, a packed legacy thread held
open (left to the next sync). A resumed thread's sandbox falling back to
config.toml's default happens with no provider change and is #6028.
2026-11-11 07:33:20 +08:00
yetone 26d1c5619a sessions: every Claude Code folder is read, not only one (@fivesmallq on X)
Accounts run with their own CLAUDE_CONFIG_DIR (~/.claude-work beside
~/.claude) had only one folder's sessions and token use counted. Claude
folders are now found as Codex's are (appdir.ClaudeHomes): the one in use,
siblings named claude*/.claude* (or one level down) that hold projects/, and
the folders of Claude accounts saved in magpie. The sessions list, calls
(Usage), traces, the read-permission check, Dirs and a deleted session's
companion folders (file-history etc., taken from the session's own folder)
all go through it. A session id in two folders is kept once.

No setting to add folders by hand and no GUI change: discovery needs no
configuration; a folder with another name is not found.

Run (mote): go test appdir, sessions, cli, usage ok; gofmt clean; go vet on
darwin, linux and windows for appdir and sessions. New tests
(TestClaudeHomesIn, TestCallsReadEveryClaudeFolder,
TestListReadsEveryClaudeFolderOnce) fail on the old code for the second
folder's sessions. Broke by hand: dropping the key dedupe in claudeFiles
still passes, since the list and calls dedupe by key later; it is kept as a
guard, not tested alone.
Not tried: real second Claude account, Windows/WSL, GUI.
2026-11-11 07:24:28 +08:00
yetone ce5e5964db gateway keys: model search box, re: patterns and Model names in the key editor (tsingchao on X)
The model picker of a gateway key gets a search box (name or id) and takes
"re:<regexp>" typed then Enter; the row menu gets Model names (aliases-key).
Docs: gateway-routing.md "A key's model patterns and names".

Run (mote): go vet darwin, windows, linux nogui on access/gateway/cli/gui;
go test internal/access, gateway (937s), cli, gui all ok at the pre-rebase
base; after rebasing on origin/main: go build ./..., the new Go tests,
TestCoreScriptBudget, and GUI gateway-key-search-names + gateway-key-models
+ i18n-keys (28 ok, chromium and webkit, en/zh/zh-TW/ja/de, 1100 and 440).
Broken by hand: pattern match off (gateway + access tests red), aliasRequest
off (alias test red), search argument removed (all 20 chromium GUI red).
Not tried: Windows/Linux GUI run, a real client against a real key; the
full suite runs after the tag.
2026-11-11 06:26:47 +08:00
yetone d77eb6d236 memory: search by meaning, on a small model on this computer
A memory search now finds what means the same in other words or another
language ("什么时候上线" finds "Releases go out on Tuesdays"), for the
MCP server's memory_search and the Library's Memory tab alike. It is off
until switched on under Memory → Search by meaning, since it downloads
paraphrase-multilingual-MiniLM-L12-v2 (Xenova's int8 ONNX, ~135 MB,
pinned revision, size and sha256 checked); switched off, the model is
deleted.

- internal/pii/guard: the BERT code runs the embedder too (LoadEmbedder,
  mean pooling; the tokenizer reads 250,002 pieces and WhitespaceSplit).
  Its vectors match ONNX Runtime's int8 to cosine >= 0.995 and are no
  further from fp32 than ORT's own; testdata carries both.
- internal/memembed: the switch, the download, vectors.bin keyed by each
  memory's sha256 (read once, again when the text changes, a cut-short
  file read as none), Keep reading in the backend, the model let go after
  10 minutes unused.
- internal/memory: memory.Semantic fuses the meaning ranking with the word
  ranking by reciprocal rank; a tie goes to the nearer in meaning, since
  a first word hit may hold one common word ("when do we release" had
  "Never delete images when..." first). Near 0.30 / Within 0.15 come from
  97 real memories and 16 queries, half Chinese for English memories:
  12 of 16 sought found with ~4 others each. Rank searches without noting
  memories used.
- GUI: the Search by meaning row (download %, memories read, failures),
  and the tab's search lists what the backend ranked first
  (POST /api/memory/rank), then word matches. zh, zh-TW, ja, de.
- docs/subsystems/memory.md: the section, out of "Not built yet".

Why not multilingual-e5-small, which this was built on first: run for
real, its cosines sat at 0.78-0.89 for everything, and a Chinese search
ranked Chinese memories over the English one it meant. e5-small, e5-base
and MiniLM were compared in ONNX Runtime on the same 97 memories; MiniLM
put the sought one first 9 of 16 and in the top 3 12 of 16, with the
rest at a median cosine of 0.16.

Run before the rebases (mote, on origin/main as of the work):
- gofmt -l internal/ clean; go vet of memembed, memory, pii/..., gui,
  library; GOOS=linux and GOOS=windows vet of memembed and pii/guard.
- MAGPIE_EMBED_DIR=~/models/pml go test -run Embedder ./internal/pii/guard:
  7 texts (CJK, full width, emoji, digits before runs of spaces) at
  0.9962-1.0000 with ORT int8.
- go test memembed, memory, memdistill, pii/..., library, browsermcp.
- Linux (magpie-desktop, -tags nogui, mote's disk was full): go test
  memembed, memory, pii/guard, gui (461s), cli (1228s, past the default
  10m timeout, so -timeout 30m); gateway -run 'MemoryMCP|OwnMCP'.
- Rebased on origin/main 3ebb1ba2c, on mote at this tree: gofmt -l
  internal/ clean; go vet of memembed, memory, pii/..., library, gui,
  gateway, and GOOS=linux and GOOS=windows vet of the first four; go
  test memembed, memory, pii/..., library, browsermcp (Embedder test on
  ~/models/pml); gateway -run 'MemoryMCP|OwnMCP'; cli -run
  'Settings|Parity|Budget'.
- Rebased again on origin/main 5d6935b11 (title bar, cli parity,
  account export, provider catalog): go vet of gui and cli; go test -run
  'Settings|Parity|Budget' of cli and gui, ok with the Bark test fix two
  commits up (TestSettingsSaveKeepsWhatItDoesNotSend, red on main).
- GUI on mote, this commit plus the next (90f4a377b, which fixes
  library-bar-more for #5982): every library-*.test.cjs, i18n-keys and
  i18n-en-no-cjk, BROWSER=chromium and webkit, 701/702 each. The red is
  library-loading's tab list, which has no "Claude plugins" (6af54dc9a)
  and is red alone at origin/main faffb1e95 (#5997). library-bili's
  webkit saved count times out about 1 run in 3, on main too (#6015).
- A real switch-on: the pinned files downloaded from Hugging Face and
  checked in 11s, 5 memories read; 什么时候上线, 端口被占用怎么办, 清理磁盘,
  回复用什么语言 and "when do we release" each find their memory first.
  缩进用什么 finds nothing (0.23 to the tabs memory, under Near).
- Broken by hand: without the tie rule, TestSearchFindsByMeaning's new
  case is red (images first).

Not run: the whole Go suite and the whole GUI suite; go test of
internal/gui and the whole of internal/cli after the rebases (WSL kept
restarting, and they passed on Linux before).
2026-11-11 04:14:58 +08:00
yetone 47e30d0e97 gui: the Mac's title bar drags while a dialog is open, and the bar's middle does everywhere (ssuuuuooo on X)
v0.1.3624 added the .modal-grip strip but it could not work on the Mac:
there the scrim begins under the bar (body.window.mac .modal top: 50px),
so the strip sat below the bar, while the bar itself (header, sidebar top)
is inert whilst a dialog is open (modalBackground), and an inert element
is not hit, so nothing there carried --wails-draggable. On Windows and
Linux the strip worked only at the sides: the dialog's 16-28px top padding
let a tall dialog (the provider editor) lie over the strip's middle.

Now on the Mac the strip reaches up over the bar (top: -grip height; a
fixed child would not do, the scrim's backdrop-filter is its containing
block), and off the Mac the scrim's top padding is at least the strip's
height so no dialog lies over it. docs/subsystems/gui-shell.md updated.

Run (mote-run, chromium and webkit): modal-title-drag.test.cjs gains
"the middle of the title bar drags with a tall dialog open" (web and mac
classes, 5 x 3 points along the bar, header inert): 0 of 4 on the old css,
4 of 4 now. With modal-*, dialog-*, add-sheet*, signin-closes-sheet,
sidebar*, click-scroll, panel-drag-linux, title-bar-tools, i18n-keys,
popover-mac-chrome, editor-roomy: 351 pass; the 3 reds of that run
(modal-centred-late, sidebar-overlay-scrollbar webkit, title-bar-tools
zh-TW webkit) pass 36 of 36 rerun alone at this tree, and
sidebar-overlay-scrollbar webkit also failed once on the base (load).
Not tried: a real drag in the signed macOS app (the test checks the
--wails-draggable value under the pointer, which Wails reads); the
confirmation (action-confirm, top layer) still has no strip.
2026-11-11 04:09:07 +08:00
yetone b9f8548d22 accounts: export ChatGPT and Claude accounts as Sub2API or CLIProxyAPI files (heyiwei5 and Rk1ngggg on X)
WIP commit before the full checks; body rewritten at ship.
2026-11-11 04:07:09 +08:00
yetone 3ebb1ba2cb gateway: Antigravity's refused lines get two zero-width spaces a word, not one after the first letter (shzutbi1 on X)
Claude Code's chats on Antigravity answered 429 "Resource has been
exhausted" again. Reproduced on the owner's real Antigravity account with
Claude Code 2.1.316's own system blocks (claude -p captured through a
local server): both x-anthropic-billing-header and "built on Anthropic's
Claude Agent SDK" are still turned away, and the first-letter break the
cloak made ("x", U+200B, "-anthropic...", "b", U+200B, "uilt on ...") is
turned away too, so the cloak did nothing. Bisected on the account:
a break after the second character, two breaks, or a break in each word
of the line go through (3 of 3 each); a break after the third character
of "x-a" does not. Codex's and Hermes' lines now go through as written.

antigravityCloak now puts a zero-width space after the first and the
second character of every run of three or more letters or digits in each
matched line. The full captured Claude Code prompt with that transform
was answered 3 of 3 on the real account. The refusal is still told
against the prompt as written (hint, 400, no rest), unchanged.

Run: go test -run Antigravity ./internal/gateway on mote (ok), gofmt,
go vet darwin, linux nogui, windows. New TestAntigravityCloakClaudeCode2316
pins the real prompt's output. antigravity_codex_test.go and the Codex
check in antigravity_cloak_test.go read the sent prompt past the breaks.
The old test expectation (first letter only) was changed, not broken by
hand: the old code can't compile against the new helper.

Not run: the full suite (started after the tag), a sandbox magpie binary
(the transform was sent through the live gateway's real account), Hermes
and Codex lines against the real account beyond "as written goes through".
The community plugins carry the same cloak and are fixed in
magpie-community/plugins (antigravity 0.1.1, antigravity-cloak 0.1.3).
2026-11-11 03:54:37 +08:00
yetone 696556e26c provider: Google Vertex AI takes an API key (express mode) and a base URL (Langanpaibian on X)
Vertex AI could only be signed with gcloud credentials and a project id.
A provider now takes one API key instead: a Key with no project is Vertex
express mode, asked at https://aiplatform.googleapis.com/v1/publishers/
google/models/<model>:streamGenerateContent with the key in x-goog-api-key
(Google's docs), no project, no token minted. Express serves Gemini
models only, so Base(Chat)/Base(Anthropic) are empty and the models list
drops partner and Claude models. A key with a project is asked at the
project's address, signed by the key. Vertex.BaseURL (optional, /v1
stripped) replaces Google's host for a keyed provider, such as a proxy.

Security: a Google token or gcloud credentials go only to Google's own
address. A BaseURL is honoured only with a key, and the key is the only
credential sent there; without a key Save refuses it and a providers.json
holding one has it dropped on load.

Wired through: provider.Save/normalize/Sign/Base/planModels, `magpie
provider add google-vertex <key>`, `provider key`, `provider set ... url=`,
`provider <id>` and the list, the editor's API key and Base URL fields
(app.js, 4 translations each), the Providers row pill, and the
providers-accounts subsystem page.

Run (mote-run): gofmt -l clean; go vet for darwin, linux -tags nogui and
windows over ./...; go test -run Vertex for provider, cli, gui, gateway
and tui, all green, with new tests TestVertexExpressKey,
TestVertexExpressBaseURL, TestVertexExpressEditor (fake server) and the
gateway's TestVertexExpressStreams (chat, streamed and whole, asks
/v1/publishers/google/models/... with the key header, no token minted);
vertex-editor, i18n-keys and ledger-protocol GUI files in chromium and
webkit (en and zh editor flows; the i18n check covers zh, zh-TW, ja, de).
Broken by hand: Sign without x-goog-api-key turns the provider, gui and
gateway express tests red. The existing tests that pinned "a key is
refused" now pin the new rules.

Not tried: a real Vertex AI key (no account on hand; the endpoint and
header are from Google's express-mode docs, the tests use fakes), the
full GUI suite in webkit, Windows and Linux runs of the tests.
2026-11-11 03:54:21 +08:00
yetone 6d78627693 gateway: an empty reply on two accounts of a model ends the request there (vhjjkkhg on X)
Alma on Responses to Antigravity's Gemini 3.8 Flash got "an empty reply"
now and then in multi-turn tool turns, and each account's in-place
re-asks plus the next account took 8 to 9 tries over 10+ minutes. A reply
that said nothing on a second account of the same provider's model is
about the request, not the account: the model's remaining accounts are
not asked (emptyAccounts = 2, `emptied` in the candidate loop). Other
providers and a group's other members still are, and nobody rests (the
#1221 branch is unchanged).

Cause of the empty reply itself: NOT found. Chat and Responses build
byte-identical Code Assist contents for a tool conversation (compared),
and about 50 real-account runs in a sandbox HOME (Antigravity login only)
across efforts none to xhigh, multi-user-turn tool loops over both
protocols, gave no empty reply. It looks like upstream's occasional
behaviour (#667 / #1221), so this commit bounds the cost and does not
claim a translation fix.

Run (mote-run): TestEmptyReplyOnTwoAccountsEndsTheRequest (Responses and
Chat; 5 accounts), TestGeminiEmpty*, TestLateRests*, full
./internal/gateway, gofmt, go vet darwin/linux/windows (nogui).
Broken by hand: with gateway.go's change reverted the new test is red
(12 asks, 5 accounts tried; 8 asks and 2 accounts with it).
Not tried: a real Alma turn on an account that returns the empty reply.
2026-11-11 03:32:27 +08:00
yetone 6af54dc9a9 library: Claude Code plugins kept as one item, with a Claude plugins tab (FakeshadowzZ on X)
A Claude Code plugin (.claude-plugin/plugin.json, skills/, agents/,
hooks/hooks.json, .mcp.json) can be installed into the Library from a
folder, a git address or a marketplace.json, and is one row: turned on, off
or removed as a whole, and given to the agents picked with the chips every
tab has. Its skills, MCP servers, hooks and subagents are ordinary library
items tagged Bundle: <plugin>, so each agent gets them through the code of
its kind and the Skills, MCP servers, Hooks and Subagents tabs go on
working. Off clears every part's agents and keeps them for on; Remove
removes the parts. A part whose name the library has gets the plugin's name
as a prefix, never over the user's own. Claude hook events and matchers map
to the portable ones; others become claude:<Event>, for Claude Code only.
Slash commands, LSP servers and non-command hooks are listed as not
carried, not dropped. internal/library/plugin.go, POST /api/library/plugins/*,
the Claude plugins tab in plugins/library/client.js (en, zh, zh-TW, ja, de),
docs/subsystems/library.md.

Run (mote): go test -tags nogui ./internal/library ./internal/gui
./internal/backup ./internal/davsync ok; gofmt clean; go vet darwin, linux
(-tags nogui) and windows clean. GUI, chromium and webkit, en zh zh-TW ja de
at 420 and 1100: library-plugins (new), library-hooks, library-subagents,
i18n-keys, i18n-en-no-cjk, click-scroll all pass. Whole GUI suite started
and cut short at ~460 of its tests: failing only account-dragging and
accounts-sheet (routing, untouched by this), not compared on origin/main.
Broken by hand: dropping the Off handling in givePlugin and the hookTakes
filter each turned the new Go tests red.

Not tried: a real Claude Code plugin from a marketplace, a git source
(tests use folders), WSL, Windows. Not carried yet: commands/*.md, LSP
servers, a plugin's folder across computers (a backup carries the parts, not
the plugin record).
2026-11-11 02:55:15 +08:00
yetone 1d41799f2a agent: turn off every agent's telemetry from Settings › Privacy (OipsAnthony on X)
OipsAnthony on X: "magpie 设置 - 隐私,支持统一关闭所有 Agent 的遥测功能,
这个统一管理的地方优先级最高". v0.1.3562 gave Codex, Claude Code, Gemini
CLI and Qwen Code a Telemetry row each; there was no one switch for all.

Settings › Privacy now has "Turn off telemetry for all agents"
(settings.AgentTelemetryOff, POST /api/settings/agent-telemetry,
agent.SetTelemetryAll in internal/agent/telemetry_all.go):

- On: every agent found here with a telemetry switch is turned off through
  its own switch and that switch's rules (only keys the file lacks are
  written; a value of the user's own that keeps telemetry on is never
  written over: the agent stays on and the reply's "refused" names it
  and why). Each agent the switch turned off gets a stash marker,
  <id>.telemetry.all. An agent found later is turned off on the next
  state the window reads and by a one-minute gateway loop
  (KeepTelemetryAllOff, in WhileServing).
- While on, each agent's own Telemetry row shows off, says "Off for all
  agents in Settings › Privacy" and its buttons are disabled; the API
  refuses it too (ErrTelemetryAllOff).
- Off: only the marked agents are turned back on, which takes out only
  magpie's keys. An agent off by its own row or the user's own config
  before stays off.
- An unreadable settings.json is unknown: nothing is written.
- The setting is per computer (KeepOwn) and the generic settings POST
  can't change it (settingsapi.Merge carries it).

app.js pays for its ~650 bytes with ten Privacy-section comments cut
(core 1,533,550, under its 1,533,802 budget, no raise).

Run (mote, first on 10bef5fe0):
- go test -count=1 ./internal/agent ./internal/gui ./internal/cli
  ./internal/settings ./internal/settingsapi: ok, except gui's
  TestSettingsSaveKeepsWhatItDoesNotSend, red as it should be for a new
  field; with AgentTelemetryOff in its fixture it and the budget and
  parity tests pass (-run).
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./...: clean. gofmt -l: clean.
- GUI, chromium and webkit: privacy-*.test.cjs (new
  privacy-agent-telemetry: 5 languages x 1100/640px plus a refused case
  in each engine, no scroll on click, no native select), i18n-*,
  agent-telemetry, settings-search, click-scroll: 218 of 218 pass.
- The whole GUI suite (1,367 files) was started under ~/suite.lock and
  never got it: lockf gave up after 4h with the lock held by other runs.

- Rebased on 6a81a3c62 (this commit's parent), again: go vet
  ./internal/... (darwin) and GOOS=windows vet of agent, gui, cli; the
  Telemetry, budget, settings-keep, CLI parity and route tests; GUI
  privacy-agent-telemetry, agent-telemetry, i18n-keys and
  privacy-usage-stats in both engines: 64 of 64.

Broken by hand:
- no stash marker in keepTelemetryOff: TestTelemetryAllOff red, "Gemini
  CLI not back on".
- SetTelemetry without the ErrTelemetryAllOff check: TestTelemetryAllOff
  red, "Gemini CLI's row turned on under the switch".

Not tried: a real agent's config on this computer (sandbox HOME only);
Windows runs of the new Go tests (they skip there, a #! stand-in isn't a
command on Windows; the switch's code has no OS-specific path).
2026-11-11 02:38:58 +08:00
yetone 418bb6c9e1 codex: Show Codex's own models off leaves them out of Codex's own picker (iiiiiimone on X)
The switch (#1642) only narrowed the Agents page's pickers. Codex's own list,
which the gateway hands it beside its sign-in and as the Codex app's list
file, kept every model of the ChatGPT account, also with the Codex provider
switched off. codexMerged now leaves the sign-in's visible models out when the
switch is off (provider.CodexOwnLeftOut); the model Codex is set to, models
magpie serves on a ChatGPT account and hidden jobs stay, and the list's ETag
carries the switch so Codex asks again. Codex has one openai_base_url for every
model, so one it is still set to goes through the gateway to OpenAI on its own
sign-in; a model of it can't be sent direct beside magpie's models.

Run: TestCodexListWithOwnModelsOff, red with the filter turned off (own models
all listed, ETag unchanged); gateway, provider tests at this tree.
Not tried: a real Codex app against the list.
2026-11-11 01:54:05 +08:00
yetone c4da9a97dd gui: the window drags from the title bar strip while a dialog is open (ssuuuuooo on X)
On the Mac the main window couldn't be dragged by its title bar while a
dialog was open: #modal's scrim covers the whole window, including the
bar, and had no drag region (--wails-draggable is read from the element
under the pointer). #modal is the one overlay every dialog of the window
uses (provider editor, new provider, what's new, sign-in, ...), so one
strip fixes the class: .modal-grip, last child of #modal (app.js keeps
the dialog the first child), as high as the title bar, drag. The dialog
has z-index 1 over it and so is never a drag region, nor is the scrim
below the strip, which still closes the dialog on a click; the strip
counts as backdrop for modalBackdrop, so a click there closes it too.

Not covered: the confirmation (action-confirm, a top-layer <dialog>);
its ::backdrop hit-tests to the dialog element, which can't carry a
strip. The add sheet is part of the page, not an overlay.

Run (mote-run, chromium and webkit): new modal-title-drag.test.cjs (en,
zh, 1100 and 440px; the provider editor and a new provider's editor):
8 of 8 pass; with the grip's drag style taken out it is 0 of 8. Also
modal-*, dialog-*, add-sheet*, signin-closes-sheet, sidebar, click-scroll,
panel-drag-linux, title-bar-tools, i18n-keys: 162 pass. go test
./internal/gui ok; go vet darwin, gofmt clean.

Not tried: a real drag in the macOS app (the test checks the
--wails-draggable value under the pointer, which is what Wails reads);
windows/linux go vet of internal/gui (no assets-only Go change).
2026-11-11 01:28:27 +08:00
yetone 025123431c library: add and remove a project's skills from the CLI (Sephiro_Lan on X, #5193)
magpie library project … does what the window's Library › Projects page
does, through the same library calls its page makes (AddProject,
RemoveProject, ProjectSkills, ProjectSkill, ProjectCopy):

  magpie library project [--json]                 the projects and their skills
  magpie library project add <dir>
  magpie library project rm <dir> [--keep-files]
  magpie library project skills <dir> [--json]
  magpie library project skill add <dir> <skill…> [agents=a,b…]
  magpie library project skill rm <dir> <skill…>
  magpie library project skill agents <dir> <skill> <a,b…|none>
  magpie library project copy <dir> on|off

<dir> may be relative or "." (library.ProjectPath / ProjectAt find the
listed project, through a link too). A skill added with no agents= goes
to the agents the page's Skills menu picks: those the project's skills
are for already, else every agent here with a project skills folder.
Each skill added says where it was placed; one that wasn't (a folder
there that isn't magpie's, left as it is) is named with why, and the
command exits 1, so a script tells "installed" from "left as it is" by
the status. --help prints the project usage; an unknown flag, command,
skill, agent or on/off value is refused, and so is rm of a skill the
project doesn't have.

Docs: the Projects row of docs/subsystems/library.md, and the site's
library page in en/zh/ja. site/public/llms-full.txt rebuilt with
`node llms-full.mjs`; it also picks up a line (Alma, Shelley) another
docs change left out of it.

Run (mote, at this tree):
- go test -count=1 -run TestLibraryProject ./internal/cli: ok; the same
  on Windows (win-run, xiaomi-gpu): ok.
- go vet ./internal/cli ./internal/library for darwin, linux (-tags nogui)
  and windows: ok. go test -count=1 ./internal/cli ./internal/library:
  ok (45s, 99s), at this head after the rebase. site: node --test worker.test.mjs: 38 pass. gofmt -l:
  clean.
- A sandbox HOME end to end with the built binary: claude and codex
  installed, three library skills, a git project. add ., skill add with
  no agents= (links in .claude/skills and .agents/skills, listed
  in .git/info/exclude, the .gitignore left as it is), a folder of the user's in .claude/skills/pdf (named,
  exit 1, untouched), agents=codex, skill agents, unknown
  skill/agent/flag/command refused, skills --json, skill rm, rm .: the
  links, magpie's folders and the exclude block gone, the user's
  folder kept.

Broken by hand: with the not-placed exit taken out, TestLibraryProjectCmd
goes red ("a folder of the user's in the way: <nil>").

Not tried: a project's MCP servers from the CLI (the issue asks for
skills; servers stay on the page), WSL agents, and a real Linux box.
2026-11-11 00:44:41 +08:00
yetone 4623f54190 gateway: HTTPS for other computers, from magpie's CA or an imported certificate (zhangly1 on X)
zhangly1 on X: Claude on another computer on the LAN needed magpie at
https://. Settings → Network and sharing → HTTPS (magpie https on)
serves other computers TLS on the gateway's own port, with a
certificate magpie's CA (the mTLS one, in ~/.config/magpie/mtls) signs
for this computer's names and addresses; this computer keeps plain
http://. The switch is read per connection, so no restart.

- Certificate row: Import… takes the user's own PEM certificate (with
  chain) and unencrypted key, in any files and order; a pair that can't
  be served (no key, no cert, a stranger key, a passphrase, run out,
  nothing PEM) is refused with the reason in the page's language and
  leaves nothing behind. Remove goes back to magpie's CA. --tls-cert
  still comes first.
- magpie's CA row: SHA-256 shown, Save puts magpie-ca.crt in Downloads;
  the gateway serves it without a key at /magpie-ca.crt to any address
  the share lets in. Rows under it give curl -kO, macOS, Windows, Linux
  and NODE_EXTRA_CA_CERTS steps with Copy.
- A page open from another computer can't turn HTTPS on or off under
  itself (it would lose its own address).
- magpie https status|on|off|import|remove|ca --out; the serve banner
  names magpie's CA or the imported file instead of "(mTLS)".
- docs/reference.md and gateway-routing.md say all of it, and that
  Windows' curl.exe needs --ssl-no-revoke for any private CA.

Run:
- gofmt -l clean; go vet linux -tags nogui ./internal/..., GOOS=windows
  and GOOS=darwin -tags nogui vet of the touched packages (WSL, mote
  refused ssh all evening).
- WSL: go test -tags nogui gateway -run HTTPS|MTLS|ClientCert|CAFile|TLS|LAN
  ok; gui -run HTTPS|MTLS|Keep ok; settings, settingsapi, mtls ok;
  cli -run Help|HTTPS|TLS|Serve|Banner|Flag|Unknown ok. The whole cli
  package hit its 40m timeout in TestEveryAgentFieldNameWritesNothing
  (#5234, #4247, not this change).
- GUI (WSL Playwright, chromium + webkit): https-settings (en, zh, 390px,
  strings in all four languages) ok, plus mtls-settings, allow-ips,
  browser-access, cors-origins, gui-de/ja/zh-tw, i18n-keys,
  i18n-en-no-cjk, lan-*, public-url*, api-key-theme,
  connect-address-kept, gateway-connect-keys, gateway-caller-keys,
  side-gateway-lan, menu-scroll. Reds at load ~130: api-key-theme
  (#5044), connect-address-kept (#5972), gateway-caller-keys (#2572),
  gui-ja (#5943), lan-docker (#4692), all red the same at base
  10bef5fe0 run beside it; allow-ips and gateway-connect-keys went red
  once under that load and pass 18/18 at concurrency 1, base and this
  change side by side.
- Real: a sandbox HOME gateway built from this tree on WSL
  (MAGPIE_ADDR=0.0.0.0:3593, a gateway key, magpie https on, magpie
  serve). From the Windows host: curl -k /magpie-ca.crt 200 without a
  key; Node fetch with NODE_EXTRA_CA_CERTS=magpie-ca.crt 200 on
  /v1/models, 401 without the key, SELF_SIGNED_CERT_IN_CHAIN without
  the CA; plain http:// 400; curl.exe --cacert needs --ssl-no-revoke
  (schannel), then 200. Cert SANs: localhost, the hostname, .local,
  127.0.0.1, ::1 and every address. magpie https import of an openssl
  CA's leaf on the running gateway: Node trusting that CA 200, magpie's
  CA alone refused. remove + off on the running gateway: plain http://
  from Windows 200. This computer's plain http:// 200 throughout.
- At the pushed tree (on origin/main ee818e8bc), WSL:
  gofmt -l clean; go vet -tags nogui linux, GOOS=windows, GOOS=darwin
  nogui of gateway, gui, cli ok; go test -run 'HTTPS|CAFile|MTLS|LAN'
  gateway, gui ok. GUI https-settings, mtls-settings, i18n-keys,
  gui-de/ja/zh-tw, allow-ips, lan-* (both engines): 147/155; reds are
  gui-ja (#5943), lan-docker (#4692), allow-ips webkit under load, and
  gui-zh-tw chromium under load (2 of 3 green alone, filed #5983).

Broken by hand:
- TLSOn without HTTPSOn: TestHTTPSOtherComputer red.
- lanGuard without the caFileOpen exemption: TestHTTPSCAFile red.
- mtls config without GetCertificate = settingsCert: all three
  serving tests red.
- app.js without renderHTTPS(s): https-settings red in both engines.

Not tried: the macOS, Windows and Linux system trust commands on a real
store (they change the box's trust); Claude Desktop itself; a darwin
GUI run (mote unreachable); the full suite before the tag (started
after it).
2026-11-10 23:05:47 +08:00
yetone 6c3f113cee routing: a rule's hours over give the conversation back; looser times (MinglunZhu on X)
MinglunZhu asked twice for a provider by time of day and said the time
setting in Routing rules is awkward. Three causes:

- A conversation a night rule sent to its member stayed there after the
  hours: no rule matched the new turn, so Auto affinity kept it on the
  night's member by its cache (Smart and every routing but In order).
  ruleFor now sets RuleHit.Ended when the last turn's rule had hours
  that are over, and affine lets the conversation go (Affinity.Why
  "hours"); the trace says so in en, zh, zh-TW, ja, de. Tool rounds of
  a turn begun inside the hours stay put; Session, Strict and In turn
  keep their own way.
- The time boxes took only ASCII "HH:MM", while their numeric keypad
  on a phone has no colon and a Chinese IME types ":". clockOf (GUI)
  and clockMinutes (CLI, saved files) now read "22", "2200", "930",
  "22:00", "22.00", "22点30" and full-width digits; "9:5" is still
  no time. time=22~08 takes ~ and ~ for the dash.
- A new rule starts with an intent box; hours took an × and a +. Adding
  another condition now drops the intent box while it is empty.

A time rule in a nested group doesn't give its conversation back yet:
#5977.

Run (mote): go test ./internal/provider (ok); go test -run
'TestRuleHoursOver|TestRuleTime|TestRule|Affinity|StandIn|Session|TestParse|Clock'
./internal/gateway (ok); go vet darwin, GOOS=linux -tags nogui,
GOOS=windows for gateway and provider; gofmt. GUI, chromium and webkit:
routing-time (8/8 after the new trace test's fix), and 28 rule/affinity/
i18n files (routing-rule-*, routing-time*, routing-intent-entry,
routing-folder, routing-pause*, routing-smart-intent, routing-save*,
routing-rules-line, routing-affinity-*, routing-behind-why,
routing-kept-again, routing-session-folder, i18n-keys, i18n-en-no-cjk):
477/481, the 4 reds the new trace test's first wording, fixed and rerun.

Broken by hand: affine's "hours" case off -> TestRuleHoursOverGiveThe
ConversationBack red (Smart stays on kb by cache); origin's
grouprule.go/ruleparse.go -> TestRuleTimeTypedLoosely red; client.js's
"hours" case and the intent give-way off -> routing-time 0/4 in
chromium; the old clockOf -> routing-time red on "9:00".

Not tried: the real app with a real night/day pair of providers; the
full gateway package and full GUI suite (the full Go suite runs after
the tag); Windows run of the touched packages (vet only).
2026-11-10 22:57:20 +08:00
yetone 72e804d2b5 gateway: a provider set Never a fallback takes no other model's request (sonnnnnnnnnnnna on X)
sonnnnnnnnnnnna asked that a request a local uncensored model was given
never falls back to an online provider (Anthropic, OpenAI) when the local
model is full (kv slots) or down, where it could get the account banned.

A provider now has Never a fallback (NoStandIn), off by default: the
Providers page's right-click, under Use first, ticks it; the CLI's
`magpie provider set <id> fallback-for-others=no` sets it. Its keys and
accounts are dropped from a request's plan once a candidate of an
unmarked provider was planned before them (standInsOut, run in planPaused
and in planGroup before restLast and sinkPlanned, so a local model that
failed and is resting still counts as first; a primary with nothing
planned counts too). A request that goes to a marked provider first still
moves on as before, and a weighed group (Smart, Cheapest) that picks a
marked member first sends it there. The dropped rows go to the trace's
left-out list as StandIn; the Routing page says why ("it is set never to
be a fallback for another model"), and the cap, held and barred refusal
checks ignore them so a refusal keeps its old status.

No classifier was built: the model that would judge the request is the
local one that is down, and any other would send the text somewhere the
user didn't choose.

Run on mote (macOS 27) at this tree on 065ca02c2: gofmt -l clean; go
vet darwin, GOOS=linux -tags nogui, GOOS=windows over gateway, provider,
gui, cli; go test ./internal/cli ./internal/gui ./internal/provider ok
(TestCoreScriptBudget after four comments cut in app.js, core 1,533,187
of 1,533,802, no raise), ./internal/gateway -run
'StandIn|UseFirst|Fallback|Barred|Capped|Group' ok (the whole package
ok at e6f151507); GUI in chromium and webkit, 126 of 126: stand-in (new,
5 languages, 1100 and 420 wide), provider-find (with the next commit),
use-first, menu-first-second, routing-held-member, unlisted-models,
i18n-keys, i18n-en-no-cjk; plugin-actions, routing-wb-refused and
group-found-skip ok at ca7a39291. provider-models-rest is red the same
at ca7a39291 (10 !== 83), #4396.

Broken by hand: standInsOut's drop turned off (`other && false`), and
TestNoStandInTakesNoOtherModelsRequest went red ("local down: 200 ...
from cloud2, want the spare").

Not tried: a real local model (llama.cpp/Ollama) going full or down, the
Windows box, a click in the real app.
2026-11-10 22:53:58 +08:00
yetone 40cd70d54e agent: an agent behind billion-context's /bili/ lane still goes through magpie (33sczf on X)
The Library's billion-context tab puts Claude Code behind bili's lane:
ANTHROPIC_BASE_URL http://127.0.0.1:18787/bili/http://127.0.0.1:3425,
which forwards to the gateway. A local proxy with a path is checked by
asking GET / there for magpie's info (#1985), and a bili lane runs only
beside its agent, so the probe said no: the Agents page showed "配置已变更"
with Reconnect, which would have written the gateway over the user's
billion-context.

chainsToGateway (reach.go): an address on this machine's loopback whose
path ends in the gateway's own URL (/bili/<gw>, /bili/anthropic/<gw>, any
port) reaches magpie without a probe. reachesMagpie and surelyMagpie take
it, so every agent's drift check (wiringOff, Claude's managed settings,
Reasonix, T3 Code, Zed) holds, and Claude Code's writes (a pick,
Reconnect) keep ANTHROPIC_BASE_URL on the lane (gwAt/claudeProxied).
The sync's kept-away filter (keptaway.go) kept nothing for a file that
already named the gateway: chainPrefix now keeps one such proxy in front
of the gateway wherever the file had it, for every agent's sync.

Codex is left as it was: its openai_base_url check is exact, and bili's
Codex lane is an MCP server that never takes this address.

Run (mote):
- go test -run 'TestBiliChain|TestChainsToGateway|TestClaudeBehindBili' ./internal/agent: ok
- go test -run 'TestBiliChain|TestChainsToGateway|TestReverseProxy|TestClaudeManagedProxy|Kept|Away|Elsewhere|Proxy' ./internal/agent: ok
- gofmt -l clean; go vet ./internal/agent for darwin, linux (nogui) and windows
Broken by hand: chainsToGateway taken out of reachesMagpie/surelyMagpie
and chainPrefix off: TestBiliChainIsStillMagpie red with the reporter's
exact message for claude, claude-desktop, gemini, opencode and others,
53 files back on the gateway after a sync; TestClaudeBehindBiliLaneKept
red.
Not tried: a real bili lane with a real Claude Code; the full suite
(started after the tag).
2026-11-10 22:46:21 +08:00
yetone ee818e8bce gateway: a Claude run reads its flags, so Message Threads stop re-sending every image (nylesssssssss on X, #5963)
Every bridge run started Claude Code with
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 (there since the bridge's
first commit, 702477525, not added for #5582). With it, or
DISABLE_TELEMETRY or DO_NOT_TRACK, Claude Code 2.1.316 reads none of its
GrowthBook flags (its privacy level must be "default"), and Message
Threads are on by one of them, tengu_curious_tower. So every turn sent
the whole history again, every image in it (#4496's slow turns).

A turn's run (claudeRunEnv) now leaves the quiet variables out, so Claude
Code reads the account's own flags as a plain claude does. Updates and
error reports stay off (DISABLE_AUTOUPDATER, DISABLE_ERROR_REPORTING,
which the flags don't need). A quiet variable the user set, in magpie's
environment or in their Claude Code's settings.json env, is passed as
they set it (their telemetry choice; the run reads no settings of its
own). WSL runs get DO_NOT_TRACK too. The one-off runs (model test,
warm-up, /usage) keep the switch: no history, and an interactive one
would send probeQuotaStatus's request as it starts (#5582).

The issue's patch set CLAUDE_CODE_TETHER_LIVE=1 instead. Not taken: in
2.1.316 that variable wins over the account's flag (ryr(): the env value
is returned before tengu_curious_tower is read), so it would turn threads
on for accounts Anthropic hasn't given them, or has turned them off for.
Here nothing is forced; an account without the flag goes whole, as its
own claude does. Nothing of magpie's sends a request; CLAUDE_CODE_ENTRYPOINT
is untouched.

Run:
- Real Team account (sandbox CLAUDE_CONFIG_DIR + HOME, the keychain item
  copied to the sandbox's name and deleted after, token not rotated),
  claude 2.1.316 -p stream-json, haiku, one process, a 3 MB noise PNG then
  three text turns, bytes to api.anthropic.com per turn through a
  counting CONNECT proxy:
    magpie's old env (NONESSENTIAL=1): 672, 667, 667, 668 KB
    this env (no quiet vars, updater + errors off): 737, 6.3, 2.6, 2.6 KB
  Turn 4 answered the codeword from turn 1 both times. The fresh config
  had no cached flags; after the run it had 1223, tengu_curious_tower true.
  Other traffic with this env: one connection to Datadog's log intake
  (1.5 KB), Claude Code's own.
- go test -count=1 -run 'Claude|WSL|Warm|Usage' ./internal/gateway on mote:
  ok (139s). The full package queued behind ten suites on mote's lock
  and was not run before the tag; the full suite runs after it.
- TestClaudeRunReadsItsFlags: red with the run back on cleanClaudeEnvTTL
  (3 of its 4 cases; the one where magpie's env sets them passes on both), green with it.
- gofmt; go vet darwin, linux (nogui), windows of internal/gateway.

Not tried: a run through a sandbox magpie end to end, the interactive
(TUI) mode with a real account (an image turn runs as -p anyway), WSL, an
account whose flag is off.
2026-11-10 22:44:04 +08:00
yetone e053c337aa gateway: join a shared magpie with a password (EV_John_Liu on X)
EV_John_Liu asked for quick setup on a LAN: the central magpie serves a
page behind a password where other PCs and Macs get their config and a
new key of their own.

Settings -> Network and sharing -> Join with a password sets the
password (at least 8 characters; only a salted PBKDF2-SHA256 hash is
kept, in join.json, 0600, written through temp-and-rename; a file that
can't be read or parsed means joining is closed). The row then shows the
address to give out, <shared address>/join, and Turn off joining.

/join is the key page (/me) opened to join: the visitor types a name for
the computer and the password. POST /v1/magpie/join makes a gateway key
named after that computer (or "Joined from <ip>"). The key is listed in
Gateway keys like any other, where it can be limited or removed. The
page shows the key once and then the setup for that key: Claude Code,
Codex, a new magpie tab (`magpie provider add remote-magpie '<key>'
url='<address>'`), OpenAI-compatible and curl.

Every route judged:
- lanGuard lets another machine reach GET /join and the join route
  without a key, only while magpie is shared. The route checks the
  password itself.
- A browser's POST must come from the page itself. Host must be one of
  this computer's own names (IP, localhost, MAGPIE_PUBLIC_URL's, its
  hostname), so a DNS-rebound name is refused. Origin must equal Host.
  Missing Origin and Origin "null" are refused, and so is any
  Sec-Fetch-Site but same-origin. corsGuard still refuses null, foreign
  and *.localhost Origins before this. curl and scripts, which send no
  browser marks, are judged on the password alone.
- Throttle: each try from another machine costs a token, a right
  password too. The bucket holds 10 and refills one every 10s, so a
  guesser gets about 360 tries an hour, and a flood of tries makes no
  flood of keys. Over the limit the route answers 429 with Retry-After.
- The password and key never go in a URL or a log line. The key comes
  back only in a no-store 201 body. Logs name the key's id and the
  caller's address.
- The routes are classed in the key-slot and read-only route lists.
  They carry no key.

Run on mote at this head (rebased on 065ca02c2):
- gofmt clean
- go vet: darwin, linux -tags nogui and windows, for access, gateway
  and gui
- go test: access, gui, and gateway's join, route-list, key page and
  LAN tests
- The whole gateway package ran before the rebase, and its only reds
  were the two route-list guards fixed here.
- GUI (node --test), chromium and webkit: lan-join (new), key-page,
  mtls-settings, allow-ips, i18n-keys, lan-docker, lan-lazycat,
  lan-address-height, side-gateway-lan: all ok before the rebase, and
  lan-join, key-page and i18n-keys ok again at this head.
- That GUI run caught a TDZ error: JOINING was read before its const,
  which broke /me too. It is fixed in this commit, and key-page went
  from red to green.

Broken by hand (each red, then put back):
- no throttle: TestJoinHoldsAGuesser red
- no lanGuard bypass: TestJoinMakesARevocableKey, TestJoinHoldsAGuesser
  and TestJoinClosed red
- no ownHost check: TestJoinRefusesOtherPages red
- joinRefusal returning "": rebound remote, cross-site and no-Origin
  browser POSTs each got a 201, red
- Dropping only the Origin comparison stayed green, because corsGuard
  refuses the same Origins first.

Not tried:
- a real two-machine LAN join with the built app
- a Windows or Linux run of the tests (vet only)
- the full suite, which starts after the tag
2026-11-10 22:42:11 +08:00
yetone 87b3af7653 library: a project turns a global MCP server or skill off, out of git, and its worktrees follow (WhyULose0 on X)
WhyULose0 asked for MCP servers and skills per project: a global set every
project inherits, each project that set ± items (a global one turned off
for one project too), one place to tick for every agent, nothing written
into the project's git, the router running a shared server once, and a
new git worktree following its main project.

What was there: projects could add skills and servers (Library → a
project's card), the MCP router ran each server once, but a project could
not turn a global item off, magpie wrote its entries into the project's
.gitignore (a tracked file), and a worktree got nothing.

What changed:
- Turning a global item off in one project (ProjectServerOff,
  ProjectSkillsOff; POST /api/library/projects/server-off, skill-off),
  done the way each agent reads a folder: Claude Code's record of the
  project in ~/.claude.json (disabledMcpServers; magpie takes out only
  names it put there), Codex's project .codex/config.toml
  ([mcp_servers.X] enabled = false, only for a server in Codex's own
  config), Claude Code's skillOverrides "off" in the project's
  .claude/settings.local.json.
- With the router on, a project that adds or turns off a routed server
  gives Claude Code (local scope in its project record) and Codex (project
  config) the hub at /mcp/magpie/hub/<agent>~<projectKey>; hubServers
  serves that address the project's set, each server still started once.
  gateway.HubAgentOf cuts the key off for the log, errors and on-demand.
- Out of git: entries go to the repository's info/exclude (one block per
  project, shared by every worktree); the .gitignore is left as the user
  wrote it, and a block an older magpie wrote there is taken out. A folder
  git-inited later gets its block on the next KeepLinked.
- Worktrees: the project's folder in each worktree of its repository gets
  the same skills, servers and offs, found on KeepLinked, let go when
  removed.
- GUI: a project's card lights each agent that has an item from the
  Library; a click turns it off (or back on) in that project. An agent that
  can't take an off (Gemini CLI etc., or a skill that goes through the
  skill router) stays lit and says why. The Skills menu ticks inherited
  skills; unticking turns one off. zh, zh-TW, ja, de.

Limits, per agent:
- Offs only for Claude Code (servers and skills) and Codex (servers).
  Codex reads the project config only in a trusted project.
- A skill reached through the skill router can't be turned off in one
  project.
- Claude Code keys its record by the repository's main top folder, so a
  project in a subfolder turns its server offs on repo-wide.

Run (mote's SSH refused every try today, kex reset; every run went to
the WSL box through wsl-run, linux, at load 60 to 80 from other runs):
- go test -tags nogui ./internal/library: ok at this head. At the base
  before (4a9142ccd) TestEveryAgentInLibrary was red on main's own
  avibe/obsidian, fixed upstream since.
- go test -tags nogui ./internal/gateway ./internal/gui, one rebase back:
  gateway ok; gui ok but for TestSetAnswersWhileDevinAndProvidersHang
  (a set waited 37s; #1375, numbers added there). An earlier run had one
  TestMiddlewareThroughGateway red (the reply's first delta skipped a
  middleware's onEvent; nothing here touches middleware), 5 of 5 alone,
  filed as #5955.
- go vet: linux (-tags nogui) and windows clean; darwin (-tags nogui,
  cross from linux, no cgo) clean but for internal/gui's
  traywindows_darwin_test.go, which needs trayImagePNG from a
  darwin && cgo file, untouched here.
- gofmt -l: clean
- GUI, chromium + webkit: project-*, i18n-* and library-* 4 wide, then
  each red file alone at this head. Alone, all pass, project-scope
  included, but for library-mcp-copy-config ja chromium (#5941) and
  library-browser-setup (#5974); both are red the same way at origin/main
  without this change (40ca0c88d and 6bac8f8a5). library-all webkit
  (#4967) was red alone before the rebase, also at 40ca0c88d.

At 82a8acb09 (this change on 065ca02c2): go vet -tags nogui ./...
clean, ./internal/library ok, project-* and i18n-* GUI 32 of 32. Then rebased over b2b83d4f9's four commits (lessons,
gateway plugin models through a remote, a plugin hook test, agent auto
mode), none of them in a file this change touches.

Broken by hand, each red:
- Claude offs not written: TestProjectServerOff (no record)
- Codex offs not written: TestProjectServerOff (codex project config)
- hubServers ignoring a project's offs: TestProjectSetThroughRouter
- skill offs not written: TestProjectSkillOff
- worktrees not listed: TestProjectWorktreeFollows
- writeExclude a no-op: TestProjectServerOff, TestProjectKeptOutOfGitByExclude,
  TestProjectOutsideGit
- every chip click sent to the add path: project-scope.test.cjs

Not tried: a real Claude Code or Codex run in a project with an off (the
record and table shapes are read from Claude Code 2.1.316's and Codex's
config code, not watched working); darwin (mote down), Windows runs;
a real `git worktree add` (the test writes git's worktree files by hand).
2026-11-10 22:39:29 +08:00
yetone c6bdce26fe agent: auto mode works on every model; its check is turned off unless each model gets Anthropic's results back (JoyYoung2Lucky on X)
Claude Code 2.1.322 in auto mode, routed through magpie, denied every
action it would check with "Auto mode can't check actions in this
session. Its safety check runs on the server, and your requests go
through 127.0.0.1:3425, which doesn't pass it through"
(auto_mode_no_check_in_session), on DeepSeek and on a Claude model
alike. 2.1.316 fell back to its own classifier there; 2.1.322 doesn't
when telemetry or feature flags are off (DISABLE_TELEMETRY,
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC, ...), unless
CLAUDE_CODE_AUTO_MODE_SERVER is "0".

magpie wrote that "0" only when no model Claude Code could reach was
reviewed. Any reviewed one, a relay's Claude on its Anthropic endpoint
included, left it unset, and /model (or a route that drops
safeguard_results) then left the session with no check. That is why a
Claude model failed too.

Now claudeReviewed asks every reachable model (shown entries, group
members, fallbacks, the models it is set to) for
gateway.AutoModeAnswered: a reviewable model on the Claude subscription
or on api.anthropic.com. Any other writes "0", and Claude Code runs its
own classifier through the gateway, fitted to any model
(classifierStandIn); its model is the Claude Code card's auto mode
square (CLAUDE_CODE_AUTO_MODE_MODEL). An empty slot Sync passes (no
small model, say) is skipped, not judged as a model. The gateway still
passes safeguards to relays as before. Nothing mimics Claude Code and
CLAUDE_CODE_ENTRYPOINT is not set.

Real runs, Claude Code 2.1.322 in a sandbox HOME against the live
gateway as a client, auto mode, `ls /`, DISABLE_TELEMETRY=1:
- deepseek/deepseek-flash: the user's exact denial (before).
- deepseek/deepseek-flash with CLAUDE_CODE_AUTO_MODE_SERVER=0 (what
  the fix writes), with and without a classifier model set: the local
  classifier ran (permission_check_status checking -> done), Bash ran.
- openrouter/anthropic/claude-opus-5.5: ran (OpenRouter returned the
  results; the fix still writes "0" for it, which also works).
- claude/claude-sonnet-5 (subscription bridge): ran.
Fake upstreams with and without safeguard_results (in a stream's
message_delta delta) showed the same split.

Tests: TestClaudeAutoModeReview (DeepSeek beside a Claude model writes
0, the user's case), TestClaudeReviewedOnlyWhereResultsComeBack,
TestClaudeReviewedJudgesTheSetModelWhereItGoes (empty slot),
TestT3CodeAutoModeReview, TestAutoModeAnsweredOnlyWhereResultsComeBack.
Broken by hand on WSL, each went red: AutoModeAnswered true for any
reviewable model (relay cases red in agent and gateway); the old
"any shown entry reviewed" rule (the user's case and T3 Code red); an
empty slot judged as a model (three Claude-alone cases red).

Runs, each at the tree named (the diff is the same in all three):
- On 7e1858515 (this commit is on 065ca02c2 after it, a provider
  preset only), WSL magpie-desktop:
  go test -tags nogui -run 'AutoMode|ClaudeReviewed|ClaudeFirstWrite|
  T3Code|ProxyKept|Claude' ./internal/agent ./internal/gateway: ok.
- On a1ba92ad8: WSL full ./internal/agent and ./internal/gateway:
  gateway ok; agent ok but TestGrokInstalled, red on WSL at main
  already (#3548, binfmt interop). mote (darwin) ./internal/agent ok
  (267s); its gateway run lost SSH midway, so darwin gateway is not on
  record. Windows (xiaomi-gpu): the auto mode, T3 Code and proxy tests
  ok; TestT3CodeCodexInstance red as at main (#5130).
- On c2c2c82ca, mote: the targeted tests ok, go vet darwin, linux
  nogui and windows ok for internal/agent and internal/gateway.
- gofmt clean. The full suite starts after the tag.

Not tried: Claude Code versions other than 2.1.322; Bedrock, Vertex
and Copilot routes with real accounts (judged by AutoModeAnswered's
tests only); T3 Code's instance live.
2026-11-10 22:35:57 +08:00
yetone 7e1858515b remote magpie: name its models by the provider serving them there (lcc580 on X)
lcc580 asked for a pass-through on the Remote magpie provider: show the
upstream magpie's own provider beside each model, so an agent can tell the
same model from two of its providers apart. Before, the names followed
both magpies' Provider in model names: with either one Off, both relays'
DeepSeek Chat reached the agents as "DeepSeek Chat · Office" (or plain
"DeepSeek Chat").

- The list a magpie gives another magpie (X-Magpie-Drawers) now names,
  as magpie_by, the provider serving each model there (Entry.ServedBy):
  "routing group" for a group, and for a model of its own Remote magpie
  the provider at the start of that chain. The fetch keeps it as the
  model's By (catalog/live.go).
- A Remote magpie provider gets upstreamProviders: the editor's "Model
  names" tick ("With the provider serving it there"), or
  `magpie provider set <id> upstream-providers=on`. With it on, each of
  its models is labelled "DeepSeek Chat · Office › Relay A" in every
  agent's list, whatever either magpie's Provider in model names says,
  unless the user named the model themselves under Own
  (Entry.Label/upstream, LabelsFor). Model settings' "Agents' lists show"
  line follows the tick at once.
- Ids are unchanged, so a request still goes by office/relay-b/model.
  Off (the default) names everything as before. A remote older than
  magpie_by has nothing to add, so its names stay as before.
- The core's scripts stay in budget: four long comments in app.js were
  cut to pay for it, no raise.

Run:
- Tests that fail on the old code: TestRemoteMagpieUpstreamNames
  (gateway: an httptest remote with two relays' DeepSeek Chat and a
  group, every Provider in model names mode, on and off, the third
  magpie's magpie_by, ids kept), TestServedByAndUpstreamLabel (provider),
  and name-suffix-remote.test.cjs's new case (tick, hint, save body).
- Broken by hand: upstream() returning "" and the magpie_by line removed;
  both Go tests went red with the plain labels, then restored.
- Two real gateways, built -tags nogui on the Linux box (WSL) under
  sandbox HOMEs: B with Relay A and Relay B both serving deepseek-chat,
  A with B as Remote magpie "Office". A's /v1/models before:
  "DeepSeek Chat · Relay A · Office"; after
  `provider set office upstream-providers=on`:
  "DeepSeek Chat · Office › Relay A" / "› Relay B" / "› routing group".
  A request for office/relay-b/deepseek-chat reached relay-b on B.
- gofmt -l clean; go vet darwin, linux (nogui), windows on the touched
  packages; go test catalog, provider, gateway, cli, gui on mote
  (macOS) at the rebased head: ok (catalog 2.6s, provider 165s, gateway 948s, cli 56s, gui 149s).
- GUI on mote, chromium and webkit: name-suffix-remote, remote-magpie,
  remote-self, i18n-keys, i18n-en-no-cjk, gui-ja, gui-de, gui-zh-tw,
  provider-detect-draft, provider-unmasked, routing-remote-windows,
  usage-remote-cards: all green except reds that fail the same on origin/main 388ca9ad4 (run there on the Linux box): gui-ja "ja has every zh string" (#5943) and remote-magpie "asks for the other magpie's address" in both engines (#4398); name-suffix-remote's old "named alone under Off" once in chromium de (#5147, scrollends.js import under load). The new case first failed in webkit (route lost after the save, the page's host went to DNS); it now uses one route whose server is swapped, 20 of 20 on the Linux box (WSL), both engines.

Not tried: the full suite (starts after the tag); the real desktop app's
editor by hand; a chain of three real magpies (the third magpie's
magpie_by is covered by the gateway test only).
2026-11-10 22:20:17 +08:00
yetone b9a1b4aa1d copilot: each account's own models, listed together and routed only to the accounts that have them (applemacssma on X)
"支持多个ghcp账号轮换和平均负载均衡吗,每个ghcp账号有的模型不一样。"
Several Copilot accounts and the Routing strategies (In turn, by usage)
worked already. What didn't: the copilot provider's list was the first
account's /models alone, so a model only another account's plan has was
nowhere to pick, and the gateway took every account to have every model.

Now each Copilot account's /models is kept as its own (accountModels,
read by Account.Lists), and the provider's list is their union
(copilotPoolModels over poolModels, the body codexPoolModels had). A
fetch of the first account's list also asks the other accounts on: one
with no list at once, of the rest the stalest once its list is a day
old, one per fetch. Only a failed ask is remembered (retried after an
hour). A model Copilot refused one account (model_not_supported) stays
in the list while another account on lists it (copilotOthersList).

Run (WSL magpie-desktop at 425195bf3; mote refused SSH all session):
- go test ./internal/provider/ ./internal/gateway/ -timeout 45m: ok
- go vet linux, GOOS=windows, GOOS=darwin CGO_ENABLED=0 for both: ok
- gofmt -l: clean
- TestCopilotAccountsWithOtherModels: octocat lists gpt-4.1 and
  claude-opus-9, hubot gpt-4.1 and gemini-9-pro; the list is the union,
  each model goes only to its account under In turn, gpt-4.1 to both.
- TestCopilotRefusedModelGoesToTheAccountServedIt: octocat's list has
  gemini-9-pro but Copilot refuses it; it then goes to hubot alone and
  stays listed.

Broken by hand:
- copilotPoolModels call removed: the first test red ("lists [gpt-4.1
  claude-opus-9 auto], without gemini-9-pro").
- models.go's union check dropped: the second test red (gemini-9-pro
  left the list).
- A refusal check in Account.Lists made no difference (the gateway
  already keeps a refused account off that model), so it isn't in.

Not tried: real Copilot accounts on two different plans; the full
suite (runs after the tag).
2026-11-10 22:19:31 +08:00
yetone 6bac8f8a59 gui: magpie web on a phone has a tab bar with More (geraldpppppp on X)
On a phone, magpie web's pages sat in a strip under the header that
scrolled sideways, with nothing to show that more pages lay past its
edge. Agents, Library and the rest looked missing. The pages are now a
tab bar at the foot, as an iPhone app's (HIG): each tab its mark over its
word, the page open marked. Five tabs at most: with more pages than
that, the fifth is More, and its menu lists the rest with their marks
and a tick on the open one. More is marked while one of them is open,
and it carries the dot when one of them has one. phonetabs.js does
this. app.js loads it lazily only on a phone, so the core script
doesn't grow. A status line comes up over the bar. The bar is only for
the window, never the tray panel (body.panel).

Agents still isn't shown in gateway mode on a machine with no agents,
as designed (Settings > General > Gateway mode brings it back). Library
has been shown in gateway mode since f285426ac.

Tests: phone-tabs.test.cjs (new) runs at 390x844 in chromium and webkit,
in en, zh, zh-TW, ja and de, with gateway mode on and off. It checks:
- five tabs with More fifth, at the foot, 44px tall;
- nothing scrolls sideways;
- every page is reached from the bar or from More, and More's menu opens
  above the bar;
- the bar covers no page content and no status line;
- a desktop browser has no More.
reader.cjs gets openPage() (the tab, or More's menu). mobile-web,
phone-no-sideways, routing-held-dot and name-suffix-saved open pages
through it. phone-web checks the bar at the foot. old-webkit lists
phonetabs.js as lazy. market-more waits for the view's own foot, not the
window's, which is now above the bar. group-from-model-add wheels Add
wholly into the view before its press, because at 600x420 WebKit took a
press on Add's half-hidden middle as one on the header.

Run on mote:
- The whole GUI suite once (450 files, concurrency 3). 33 red files
  were then run on this change's base and on the branch. The reds only
  on the branch were the four tests that tapped tabs now under More,
  phone-web's old label check, market-more, group-from-model-add (webkit
  600x420), and the panel tests agent-menu-label, zcode-models and
  panel-fit-tabs (webkit). The panel tests are web:true at 360-380px, so
  the bar's padding reached the panel. It is now scoped :not(.panel).
- After the fixes: phone-web, market-more, group-from-model-add,
  agent-menu-label, zcode-models, panel-fit-tabs, phone-tabs,
  mobile-web, phone-no-sideways, routing-held-dot, name-suffix-saved,
  old-webkit and i18n-keys. All are green except reds already filed on
  main: #5919 (old-webkit :has), #5869 (phone-no-sideways de 375) and
  #5215 (tray-cell-click, a web:false panel test). mobile-web's 900/1280
  desktop screenshots need git, so they were run with BASE_REF set to a
  commit of the base's assets: 30/30 pass in both engines, so the
  desktop is unchanged.
- gofmt, go vet for darwin, linux (nogui) and windows, and go test
  ./internal/gui.
- Again at the pushed head, rebased on origin/main ca7a39291: the 13
  GUI files above (239 pass; reds only #5919, #5869 and mobile-web's
  git-less desktop compare), gofmt, vet on all three, and go test
  ./internal/gui ok. TestCoreScriptBudget was over at the old base
  662546e78 and passes here: app.js is ~430 bytes smaller.
- Rebased again on 388ca9ad4 (two agent commits touching app.js and
  i18n.js): the budget tests, i18n-keys, phone-tabs and phone-web
  pass (34 of 34). Then onto 0baa223ec (Kun; a one-line app.js change)
  with no further run before the push.

Broken by hand:
- Without layoutNav's import of phonetabs.js, phone-tabs is 20 of 24 red.
- Without :not(.panel), panel-fit-tabs (webkit, 5 languages) and
  agent-menu-label go red.

Not tried: a real iPhone's Safari, or the LAN share opened on a real
phone.
2026-11-10 22:10:55 +08:00
yetone 0baa223ec9 agent: Kun, magpie as a provider connection through its runtime API (zhongxingyuyes on X)
Kun (KunAgent 0.4.5, Electron, com.xingyuzhong.deepseekgui) keeps its
model providers in ~/.kun/data/model-connections.v2.json (or
$KUN_DATA_DIR) and changes them only through its runtime's admin API,
whose address and token are in runtime.json. magpie wires Kun by
calling that API while Kun runs:

  POST   /v1/model-connections/connect    the magpie connection
  PATCH  /v1/model-connections/:id        models, gateway address
  POST   /v1/model-connections/select     the default model
  DELETE /v1/model-connections/:id        off
  POST   /v1/provider-config/transactions/preview, then commit
         off when magpie's connection is the default: Kun refuses a
         plain DELETE of the connection its default names, so the
         transaction clears the default and removes it in one step,
         and the default the user had before is put back.

When Kun isn't running, wiring says "open Kun, then try again"; the
file is never written behind Kun's back. Kun joins the agent list,
desktop-app detection, the env guard, the icon set (kun.png), the
READMEs and docs/reference.md and docs/subsystems/agent-wiring.md.

Run:
- WSL (Ubuntu 24.04), at the rebased head: go test -tags nogui
  -run 'Kun|ListsModels|Picker|Spelled|HandWired|Sync|Drift|ListOnly|
  Moved|LAN|Proxy' ./internal/agent ./internal/agentenv ok;
  ./internal/library ok; ./internal/gui -run 'Icon|Budget|CSS|I18n|
  Picker' ok (agentenv: no tests match the filter).
- Windows (win-run): go test -run 'Kun|ListsModels|Picker|Spelled|
  HandWired|Drift|ListOnly' ./internal/agent ok. CGO_ENABLED=0 go vet
  for windows (agent, gui, agentenv), darwin nogui (agent, agentenv)
  and linux nogui (agent, agentenv, gui): clean. gofmt -l clean.
- GUI (WSL, chromium + webkit): i18n-keys, i18n-en-no-cjk,
  icon-one-tone, routing-client-icons, icon-tile together 63/63 at
  this head. An earlier run at the pre-rebase head was 60/63, the 3
  reds icon-one-tone's "Open Design one-tone ... Plugins page"
  (chromium), which passed 48/48 alone there and at origin/main: a
  load red (#5425).
- Real Kun 0.4.5 (Linux build, sandbox HOME, `kun serve`): connect,
  a second model, Sync, restart, off. `kun run`
  finished a turn through the gateway (POST /v1/chat/completions,
  Bearer magpie-kun, reply "hello from magpie"). Off restored the
  previous default, and with no previous default Kun was left with
  none and no magpie connection.

Broken by hand: off through the plain DELETE again. The fake Kun now
refuses it as the real one does, and TestKunFromNothing and
TestKunFollowsTheGateway went red with "Deleted connection still has
references: default.providerId"; green with the transaction.

Not tried: Kun's desktop window itself (the runtime was driven
headless); macOS (mote refused SSH all session); `kun run --model`
(run uses its own default model, not the registry's default, so a
CLI run picks magpie's model only with --model).
2026-11-10 22:07:34 +08:00
yetone 388ca9ad45 agent: Claude Desktop says how to go on with the signed-in chats on magpie (Jacky_yyyyyyyy on X)
Jacky_yyyyyyyy on X asked that connecting Claude Desktop keep the earlier
chats and let them be continued. They are kept already: in 3p mode Desktop
runs in Claude-3p (its own userData), the signed-in profile's Code and
Cowork sessions stay untouched in Claude/, claude.ai chats stay on
Anthropic's servers, and Off brings them all back (57e58595b). What was
missing was how to go on with them while on magpie.

Desktop does that itself. magpie's profile already turns on its 3p
import policy (claudeAiImport.enabled, 5be7d05d2). Read from the app
bundles (2.7032 on this Mac, 4.16336's asar from an earlier scratch, read
only): with it on, Settings → Import offers Claude.ai's chats and projects
(arm "direct": a Claude.ai sign-in inside the importer, remotePull in
getImportCapabilities; or a Claude.ai data export zip, localZip) and this
computer's earlier Code and Cowork sessions (localSessions), copied in
under new ids that run on the gateway, originals left alone.
allowedOrganizationUuids unset (as magpie leaves it) allows any org.

So the notice after On and the opened row's "Once connected" line add:
"To go on with them on magpie, open Settings → Import in Desktop: it can
copy in your Claude.ai chats and projects and this computer's earlier
sessions, and leaves the originals as they are." (noticeClaudedesktop5),
in en, zh, zh-TW, ja, de. CONNECT_COST takes a list of sentences, each
translated. agent-wiring.md says the importer covers Claude.ai chats too.
No mimicry, nothing new written to Desktop's files. The isolated
Claude Magpie app is unchanged (the user's own Claude stays signed in).
app.js paid for the sentence with comments cut, no budget raise.

Run (worktree on origin/main a1ba92ad8; mote refused SSH all session,
so Linux runs went to wsl-run magpie-desktop, Windows to win-run):
- gofmt -l internal/agent internal/gui: nothing.
- wsl-run: go test -run 'ClaudeDesktop|Notice|Desktop' ./internal/agent
  ok; TestEveryNoticeIsTranslated ok; go vet -tags nogui ./internal/agent
  ok; go test -tags nogui -run Budget ./internal/gui ok (it was 140
  bytes over before the comment cuts).
- win-run: go vet ./internal/agent ok.
- GUI, Chromium and WebKit (wsl-run): desktop-history 10+10, i18n-keys
  4+4, agent-connect 2+2, desktop-isolated 11+11, all pass.
Broken by hand:
- Notice without noticeClaudedesktop5: TestClaudeDesktopKeepsTheSignedInHistory
  red ("doesn't say how to go on with the history on magpie").
- The opened row rendering only the first sentence: desktop-history 0 of
  10 in Chromium.
Not tried: a real Desktop importing a Claude.ai account's chats in 3p
(would need a Claude.ai sign-in inside a sandbox Desktop); a darwin go
vet and the macOS run (mote unreachable); the full suite.
2026-11-10 22:01:17 +08:00
yetone 6a450c4982 agent: Shelley, magpie's models as its custom models (on X, tweet 2120109384315658393)
"Can support Shelley?" Shelley is boldsoftware/shelley (Apache-2.0, Go,
`shelley serve`). It keeps models and profiles in its SQLite database,
not in a config file, so magpie talks to a running Shelley through the
same API its own Models and Profiles pages use, on the Unix socket it
opens for its CLI ($SHELLEY_SOCKET, else shelley.sock / shelley-N.sock in
$XDG_CONFIG_HOME/shelley or ~/.config/shelley; read from its source).

- Connect: each magpie model is a custom model (POST /api/custom-models,
  provider_type openai, endpoint = the gateway's /v1, Shelley's own
  gateway key, model_name = the catalog id, reasoning/images/max_tokens
  from the catalog). Picking one makes it the default profile's model
  (PUT /api/profiles/{name} with the whole profile, as the API requires)
  and clears a thinking level the model can't take.
- The user's own values: the profile's model and thinking level are
  stashed once and put back on Disconnect (to the server's default if
  that model is gone); only the custom models magpie made (ids stashed)
  are deleted, so a model the user pointed at the gateway by hand stays.
- Sync re-points magpie's models when the gateway port moves; Check names
  a model left on an old address. Shelley not running is an error on a
  pick and nothing on Sync/Check; turned off while Shelley is uninstalled,
  the takeout is stashed and done when Shelley answers again (Alma's way).
- A notice: new conversations start on the pick, an open one keeps its
  model. i18n for zh, zh-TW, ja, de.
- Icon: Shelley's own S mark from its assets, one tone. README (en, zh),
  site index, docs/reference.md, docs/integrating.md, site integrate
  pages (en, zh), docs/subsystems/agent-wiring.md.
- Library: listed as "not looked at (#5897)" like the other new agents.
- Shelley has no Windows build, so there is no Windows or WSL wiring.

Run (mote refused SSH for the whole session, kex reset, so runs went to
the Linux VM and the Windows box):
- Real binary: shelley v0.1718.926152762 linux_amd64 (sha256 66cb5acb…
  checked) in a sandbox HOME/XDG_CONFIG_HOME/-db on the Linux VM, with a
  throwaway test driving it against a fake OpenAI upstream at
  MAGPIE_ADDR: connect made custom model glm-4-6-… and the default
  profile's model; POST /api/conversations/new sent two
  /v1/chat/completions with model=relay/glm-4.6, auth magpie-shelley,
  UA Shelley/58d5f200; disconnect left the profile as before and no
  custom models. Check "" and Drift nil while connected.
- Linux (wsl-run, nogui): go vet ./internal/agent ./internal/agentenv
  ./internal/library; go test ./internal/agent ./internal/agentenv
  ./internal/library ./internal/profile ./internal/sessions: ok except
  TestGrokInstalled (#3548, red on base too) and, before its fix here,
  TestEveryAgentInLibrary. internal/cli times out there in
  TestEveryAgentFieldNameWritesNothing (43m, the #5234 class).
- Windows (win-run): go vet ./internal/agent ./internal/agentenv;
  GOOS=darwin and GOOS=linux -tags nogui vet; the Shelley, applied,
  rewire, disconnect, mark and kept tests: red only in
  TestAppliedOfParsesAnUnchangedFileOnce (#5950),
  TestAsideOfflineDisconnectRestoresWithoutDaemon (#5951) and the #4786
  allocation tests, all red on base d4b4a188e too. internal/cli
  TestHelpOnEveryCommandDoesNothing, TestEveryAgentFieldNameWritesNothing
  and internal/library TestEvery*: ok.
- GUI (node --test, chromium + webkit) i18n-keys, i18n-en-no-cjk,
  agent-notice-lang, gui-de, gui-ja, gui-zh-tw, icon-one-tone, icon-tile,
  routing-client-icons, usage-agent-filter-icons, agent-connect,
  agent-models, agent-layout, on the Windows box at the rebased head:
  110 tests, 107 pass. Red: gui-ja "ja has every zh string" ({model}
  twice, #5943) and icon-one-tone webkit voyage-color (#5962), both red
  at origin/main a1ba92ad8 too.
- At the rebased head 2a9c7b715 (on origin/main a1ba92ad8), Linux:
  vet of agent, agentenv, library ok; go test agent, agentenv, library,
  profile ok except TestGrokInstalled (#3548). Pushed on ca7a39291,
  which changes only internal/gateway (MiniMax drawing); not rerun.
- gofmt -l clean.

Broken by hand: not restoring the profile's model on Disconnect turns
TestShelley and TestShelleyThinkingLevel red; not deleting magpie's
custom models turns TestShelley and TestShelleyKeepsHandWired red.

Not tried: a real model upstream (the upstream was a fake), macOS (mote
unreachable; the darwin build was vetted only), the GUI against a real
Shelley, Shelley's web UI after the switch.
2026-11-10 21:52:19 +08:00
yetone ca7a392919 gateway: MiniMax's image-01 draws on its own image_generation API (rocbomb123 on X)
minimax-cn/image-01 went to chat completions (catalog.ImagesAPI doesn't
know image-01), and MiniMax answered "invalid params, unknown model
'image-01' (2013)". MiniMax draws only on POST <host>/v1/image_generation
(platform.minimax.io and platform.minimax.cn API reference, t2i and i2i,
checked against the docs, not the report).

- draw_minimax.go: a MiniMax API key (filmsMiniMax: the minimax and
  minimax-cn presets, or any provider at api.minimax.io, api.minimaxi.com
  or api.minimax.cn) lists image-01 and image-01-live as drawers and
  draws them at its own host: size -> aspect_ratio (a listed ratio or its
  size; else image-01's width/height in 512..2048 by 8; else the nearest
  ratio; 21:9 image-01 only), n, response_format base64, edit images as
  subject_reference type character, the caller's seed, prompt_optimizer,
  aigc_watermark and style passed on; mask and markup refused before
  asking. data.image_base64 / image_urls are read; base_resp failures in
  a 200 are told by code (1004/2049 key 401, 1008 balance 402, 1026
  content 400, 1002 rate 429, 2013 400), and all images held back
  (metadata.failed_count) says so.
- draw.go: viaFor sends them to the images path, drawImages to
  drawMiniMax, DrawersOf adds them for a MiniMax key.
- A relay serving MiniMax models under another host is unchanged. The
  minimax-code plugin sign-ins are not API keys and are untouched.

Run (mote, at e6f151507 + this change; after the rebase onto
origin/main, which touched no gateway file, -run 'MiniMax|Draw'
./internal/gateway again at the pushed tree: ok):
- go test -count=1 -timeout 45m ./internal/gateway: ok (947s)
- go vet ./internal/gateway on darwin, GOOS=linux -tags nogui, and
  GOOS=windows: ok; gofmt -l clean.
Broken by hand: with the viaFor case and the drawImages hook removed,
TestMiniMaxDrawsOnImageGeneration fails for minimax and minimax-cn with
the reporter's exact "unknown model 'image-01' (2013)".
Not tried: a real MiniMax key (no account here); the fake answers with
the documented bytes. GUI suite not run (no GUI file changed; the
Providers page reads Drawers from the API). Full ./... suite runs after
the tag.
2026-11-10 21:47:45 +08:00