Commit Graph
933 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 0052c860e0 library: billion-context installed with bun is found on Windows (Zerenjie on X)
biliPath looked for bili.cmd on PATH and in %APPDATA%\npm only. bun add -g
puts bili.exe (with a bili.bunx) in the bin of BUN_INSTALL or ~\.bun\bin,
so a bun install was never found. It now asks proc.FindTool, which tries
.exe and .cmd in every folder a user's tools are installed in. proc's
UserBinDirs also takes BUN_INSTALL's bin (Windows and elsewhere), and
Kiro Crew's adapter search gets ~/.bun/bin, BUN_INSTALL's bin and, on
Windows, %APPDATA%\npm, its siblings that had the same hole.

Run: on xiaomi-gpu (Windows 11) really `bun add -g billion-context` into a
sandbox BUN_INSTALL with PATH holding no bun bin. Before the fix biliPath
was "" ; after, it was bili.exe and `bili --version` answered 0.1.213. go
vet and go test -run Bili|KiroCrew|ToolIn|UserPath for library, agent and
proc passed on Windows and in WSL (magpie-desktop). The three new tests
fail on the old code in WSL (broken by hand with the sources stashed).
Not run: the full suite, a darwin vet and a mote run (mote's disk was
full, 226Mi free), the GUI suites (no GUI file touched).
2026-11-11 14:04:37 +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 d7978141bb sessions: WSL sessions go when the last agent in a distro is uninstalled (_SekiBetu_ on X)
wslList kept every distro's listing, cold, whenever WSLHomes named no
distro. That is also what it names once the last agent in WSL is taken away,
so the sessions of a removed agent stayed listed for good, unopenable and
undeletable. internal/agent now says whether wsl.exe answered the list of
distros (sessions.WSLListed); an answer with no distro an agent is in drops
the listings, no answer keeps them as before.

Run (win-run, xiaomi-gpu; mote refused SSH all session): the new
TestWSLAgentsGoneListingDrops and TestGoneAgentLeavesNoSession (native
Claude and Codex folders deleted: nothing listed, no parse kept; green on
the old code, so macOS/Linux/Windows native lists were already right),
go test ./internal/sessions ./internal/agent, go vet on both.
Broken by hand: with the WSLListed check turned off the new test is red
(7 sessions listed after the agents were taken away).
Not tried: a real WSL distro with a real uninstall; GUI; full suite.
2026-11-11 12:22:45 +08:00
yetone 245f07b19e agent: the pages that poll name rows from a list built once a while
The Sessions page polls its list and its stats every 15s, the Usage
page its clients, and each asked agent.Clients() only for each agent's
id, name and icon. Clients() builds every agent (30+ constructors):
2.5 ms, 378 KB and 3411 allocations a call on the Windows box with
discovery's real 2s look window, mostly os.Stat, filepath.Join and
Getenv. On the real-account run (t69, 4 min) agent.All under the
sessions handler was 22 MB of 210 MB allocated.

agent.Looks keeps that id/name/shared-name/icon list for 30s, built
again at once when the plugins' agents change (agentplug's set) or the
Agents page's refresh (Rescan). A new omp or QwenPaw profile shows by
its id for up to 30s. Nothing is kept in a test binary unless a test
says, so tests that add an agent read it at once. The GUI's sessions
list, stats, one session, markdown export, trash, manage and reads
views, and usageapi.Clients, read Looks.

Tests: TestLooksBuiltOnceAWhile — six asks build once, the list equals
Clients(), a plugin agent switched on and off shows at once, Rescan
builds again. Broken by hand (memo check made false): "six asks built
the agents 6 times; want once".

Run on the Windows box: go test ./internal/agent ./internal/gui
./internal/usageapi at the pre-rebase base 0cc91af3d: usageapi ok, agent
and gui with 38 reds. Those tests, run at 8aae124b0 with and without this
change: the same 37 fail on both (#6068). TestLooks/TestPlugged/TestRescan
ok and go vet ok at 8aae124b0. mote (macOS) refused ssh all session, so no
macOS run and no real-account measurement yet.

Rebased on 156861b3a after the runs; its new commits touch library,
plugin and site only.
2026-11-11 12:02:52 +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 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 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
yetone 92c798aac5 agent: dsh's models are built again every 30 minutes at rest, not 5
With a real-account HOME, an idle magpie allocated ~53 MB per 4 minutes,
and ~42 MB of it was dsh's wiring round building magpie's models again
because dshModelsFor (5 minutes) had passed, with provider.StampNow
unchanged. The forced build is only for what the stamp can't see: another
app rewriting an account's file, and models retired by date. Now it runs
every 30 minutes, and once more when the local day changes, so a dated
retirement still reaches dsh's lists that day.

Run on mote:
- go test -count=1 ./internal/agent: ok (244s)
- GOOS=windows go vet, GOOS=linux go vet -tags nogui ./internal/agent: ok
- gofmt -l: clean
Broken by hand: dshModelsFor back at 5 minutes, TestDshModelsStale is red
(10 and 29 minutes counted stale). The existing "unseen" subtest still
rebuilds models dshModelsFor old.
Not tried: a measured idle allocation on a real binary; that comes with
the next release's acrss/ad run.
2026-11-11 08:02:10 +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 1c3056a2ee agent: dsh_idle_test.go's stream idle tests are back
8fa91a852 wrote its new test over the existing dsh_idle_test.go, which
held the tests that magpie's dsh routes carry streamIdleTimeoutMs
(544b91ca8), so they were deleted with it. They are back as they were,
and the parses' idle test moves to dsh_parses_idle_test.go.

Run on mote at this head: go test ./internal/agent ok (255s), go vet ok.
2026-11-11 07:10:27 +08:00
yetone 8fa91a8520 agent: dsh's parsed entries and patch lists go when idle
Startup's RenameLegacy parses every dsh profile's patch list and entries
(dshNodes and filememo's "dsh list"; ~2 MB of YAML nodes in the t60 idle
heap with real accounts), and KeepDshWired's round reads none of them
while nothing changed, so they were kept for the life of the process for
nobody. Two minutes after the last look they are let go (dsh_idle.go, the
same pattern as usage, sessions and catalog); the drift poll and a round
that writes parse them again.

Run on mote at this head: go test ./internal/agent ok (255s); gofmt
clean; GOOS=windows go vet and GOOS=linux go vet -tags nogui
./internal/agent ok.
Broken by hand: without the dshNodes reset, TestIdleDshParsesLetGo fails
("idle: 1 parsed entries kept"); without DropKind("dsh list") it fails
("the patch list kept while idle").
Not tried: a fresh real-account heap at this head (next acrss run).
2026-11-11 07:05:16 +08:00
yetone edbc700dc3 agent: dsh's round keeps the sum of magpie's models, not the list
Each dsh round (every 30s, for dsh's home and dsbot's) kept the model
list it last built between rounds, for the life of the process, though a
round that finds nothing changed only compares its sum. With a copy of
the real accounts the end heap of an idle v0.1.3641 still held 9.7 MB of
catalog (catalogKept, keptFit) after the held/kept sweep let its own
copy go: the dsh rounds' lists shared it. Now a round keeps the stamp,
the time and the sum, and builds the list again only for a round that
writes, which is what it did when a file changed anyway.
2026-11-11 05:58:14 +08:00
yetone 036b691542 agent: a kept model list past its minute is let go, not kept for good
stampedLists (each agent's magpie models, options, Codex's picks) builds
a list again once it is older than magpieModelsFor, but never let the old
one go. Every agent's list a window poll asked for once stayed for the
life of the process, though it would never be served again: with real
accounts, Pi's alone was 10.9 MB of an idle heap and dsh's 4.1 MB
(piOffered.sharedModels, dshRounds.magpieModels). Now a sweep, armed when
a list is kept, drops the lists past their minute and looks again when the
next of the rest will be; it stops when none is left.

Ran on mote at this head (rebased on 459405960; internal/agent again ok at 5df062f0f): go test ./internal/agent
./internal/gui ./internal/gateway ok; GOOS=windows and GOOS=linux go vet
./... ok. TestKeptListsPastTheirMinuteLetGo is red with the delete removed.

Measured with a copy of the real accounts, 600s idle, two runs each order:
Footprint at the end 114/91 MB before, 109/104 MB after, within the noise.
The end heaps of both still hold 7.5-11 MB of these lists: KeepDshWired
asks for dsh's every 30s, inside the minute, so they are rebuilt and kept
while it runs. The gain is for lists only a window asked for (Pi's
thinking levels, an agent's options) once the window is gone.

Not tried: a run without dsh wired, where the sweep would show.
2026-11-11 02:45:13 +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 3a3d161fa0 agent: Claude Desktop uninstalled on Windows is no longer listed (alien_jambob on X)
alien_jambob (Windows 11, 0.1.3603) uninstalled Claude Desktop and magpie
still listed it under 未设置. The uninstall leaves %APPDATA%\Claude behind
with its claude_desktop_config.json (their Everything search shows it),
and Desktop counted as here whenever any of its folders was.

- On Windows Desktop is listed only while its program is installed
  (desktopInstalled): Squirrel's %LOCALAPPDATA%\AnthropicClaude\claude.exe,
  the MSIX's package folder (desktopdir.Installed, as before), or its
  package in the AppX registry (Claude_… or the Store's
  AnthropicPBC.Claude_…, main package only). A Desktop still on magpie
  stays listed, so it can be turned off, as Alma's fix (1b2ad557f) keeps.
- The library's own Claude Desktop entry (apps(), the one that gets MCP
  servers and skills) had the same folder-only check: it is now
  agent.DesktopApp, with the same rule on Windows. Something magpie gave
  it is still listed by held() to be taken back.
- macOS and Linux keep folder detection (unchanged).

The path the row shows, ~\AppData\Local\Claude\claude_desktop_config.json,
is right: it is the file magpie writes deploymentMode into on Windows
(desktopdir's Mode, as CC Switch does) when Desktop is turned on, so it
doesn't exist on a Desktop never connected. Left as is.

Run: go test -run 'Desktop|MSIX' ./internal/agent ./internal/library on
Windows (win-run, xiaomi-gpu): library ok; agent's only reds are six
that fail the same on origin/main 065ca02c2 on that box, all filed
(#4115 CarriesTheLanguage/OpenLody/DesktopExec, #5068 and #5476 sealed
key, #5069 DesktopHandler). Whole internal/agent and internal/library on
mote (darwin): ok. go vet for windows, linux (nogui) and darwin; gofmt.
Whole internal/agent and internal/library on Linux (wsl-run): library
ok, agent red only on TestGrokInstalled (WSL binfmt interop, #3548).
After rebasing on 40cd70d54: vet for three OSes and -run Desktop|MSIX on
Linux, ok.
e2e on Windows: magpie ls in a sandbox USERPROFILE/APPDATA/LOCALAPPDATA
with only Roaming\Claude\claude_desktop_config.json: origin/main lists
Claude Desktop, this change doesn't; with AnthropicClaude\claude.exe
added both list it.

Broken by hand: with the Windows branch taken out (folders count again),
TestClaudeDesktopUninstalledLeftover goes red on "only the leftover",
"a resource package alone" and "another app's package".

Not tried: a real MSIX Desktop uninstalled (the box has the Squirrel
install, which is the user's own); macOS's leftover ~/Library/Application
Support/Claude after Claude.app is trashed is not changed here
(#5979).
2026-11-10 22:56:39 +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 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 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 71075af726 codex: "subagents on any model" tells Codex V1 for a relay of the ChatGPT backend too (brethhbbm on X)
brethhbbm on X: lead on relay/gpt-6-astra, subagent model set to
relay/gpt-6.1-terra, "Codex subagents on any model" on. A new session's
subagents still ran on Astra, and Routing said the task was sealed and
only a ChatGPT account could read it. The model's catalog entry still
said multi_agent_version "v2".

Cause: the setting (settings.CodexAgentsV1) stamped V1 only on the
ChatGPT account's own models (codex/) and the groups one is in (Fast).
The relay lists Codex's own entry for gpt-6-astra (a sub2api asked with
Codex's client_version), "v2" included, and a relay offering Ultra is
given "v2" (AgentsV2) besides. In V2 Codex hands the lead the
collaboration namespace (spawn_agent etc.), whose arguments a relay of
the ChatGPT backend seals as the backend does (#1109), so
codexSubagentPick kept the subagent on the lead's model (sealedKept).

Fix: catalog.Model.Seals (provider.CodexSeals) marks a model whose
provider is of no sign-in on the Responses API, as the gateway's
canSeal, or a group with such a member. With the setting on, its entry
says V1 like the ChatGPT account's, listed by its relay or made by
magpie, so the task goes as text and the model set for subagents takes
it. Seals is in the list's tag, so Codex asks for the list again. A
model of an account that seals nothing (Copilot's Ultra, #656) keeps
V2, and with the setting off every entry is as before. No prompt text
or instructions change.

Real Codex (0.165.0, sandbox HOME/CODEX_HOME, fake Responses server,
model_catalog_json with the user's gpt-6-astra entry as
relay/gpt-6-astra): with "v2" the first request carries the
collaboration namespace (spawn_agent, send_message, followup_task,
wait_agent, ...); with "v1" it has none.

Run (Linux box via wsl-run; mote refused SSH for the whole session):
- go vet -tags nogui (linux), GOOS=windows go vet, GOOS=darwin
  CGO_ENABLED=0 go vet -tags nogui on codexcat, provider, agent,
  catalog, settings: ok; gofmt -l clean
- go test -tags nogui -count=1 ./internal/codexcat ./internal/catalog
  ./internal/settings ./internal/provider: ok
- ./internal/agent, and -run 'Codex|Ultra|Subagent|Sealed|Collab|AgentsV1'
  ./internal/gateway, were still running when this was pushed; their
  results go on the release's issue thread if red
- at the pushed head (rebased on c2c2c82ca), Windows box: go vet on the
  five packages, and -run 'CodexSeals|CodexAgentsV1|Ultra' codexcat and
  provider: ok
- earlier on mote: -run 'CodexSeals|CodexAgentsV1|Ultra|CodexListed|Listed'
  ./internal/codexcat ./internal/provider: ok

Broken by hand: dropping m.Seals from both V1 conditions in codexcat
makes TestCodexAgentsV1SealingRelay red ("on: map[... relay/gpt-6-astra:v2]");
CodexSeals setting false makes TestCodexSeals red ("relay/gpt-6-astra:
Seals false, want true").

Tests: TestCodexAgentsV1SealingRelay (a relay's listed v2 entry and a
made Ultra entry say v1 with the setting, Copilot's keeps v2, all as
before with it off), TestCodexSeals.

Not tried: a real relay of the ChatGPT backend end to end with a real
subagent spawn; Codex 0.165 exec showed no V1 spawn tools in its first
request (they are deferred), so the V1 side was checked by the
collaboration namespace being gone. No GUI is reachable from this
change. A thread started before keeps the version it started with; a
new session is needed.
2026-11-10 21:05:34 +08:00
yetone c2c2c82ca8 agent: Tuanjie Cowork, a magpie provider and model in its Custom Models (Charles24209792 on X)
Tuanjie Cowork (Unity China's coworker app, dev.codelycowork.desktop,
2.1.6-stable) keeps the user's own models in ~/.codely/settings.json:
customModelProviders {id, name, baseUrl, apiKey, authType} and
customModels {id, model, providerId, displayName, roles, wireApi,
supportsMultimodal}, read afresh on every lookup. Read from the app's own
core (tZ/oE for the file, Mwi for a session's OPENAI_BASE_URL/KEY, BOe
for the model list, rha/sha for its startup migrations).

magpie adds a provider and a model of its own, both id "magpie": the
gateway's /v1 with Cowork's own magpie key, the model picked, wireApi
chat. The user's providers and models and every other key stay as
written; a name or roles given magpie's entries in Cowork are kept when
the model changes. Off takes both out, and the file too when magpie made
it and nothing else is in it. A provider or model with id magpie that is
the user's own is left alone, with an error. Which model a chat is on is
Cowork's own per-workspace pick, which magpie doesn't write; a notice
says to pick "<model> (magpie)" in its model menu while it runs. Skills
go to the shared ~/.agents/skills, which its core scans. Icon from the
app's icon.icns. Lists, READMEs, reference, agent-wiring doc, i18n.

Run:
- go test ./internal/agent ./internal/library ./internal/gui on mote;
  TestTuanjieCowork* and TestHandWiredMagpieProviderSiblings on Windows
  (win-run).
- gofmt; go vet darwin, linux -tags nogui, windows.
- GUI, chromium and 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.
- Cowork's own code on magpie's output: its tZ, oE, rha, sha, cE, KGa,
  Mwi, kOe and BOe, extracted from the 2.1.6 core, run in node on the
  settings.json magpie wrote (with the user's own provider, and fresh).
  Its migrations leave magpie's entries; cE("magpie") finds the model,
  the picker label is "deepseek/pro (magpie)", a session gets
  OPENAI_BASE_URL http://127.0.0.1:3425/v1 and magpie's key, the list
  URL is /v1/models, and the user's glm-4.5 is still there.

Where: the packages, vets and GUI files above ran on mote at b834dc2a7
(this change on 4a9142ccd); at the pushed head (on 016763f23) internal/agent's
Cowork, HandWired, EveryAgent, Aliases and Icon tests, internal/library, and
the de, zh-TW and en-no-cjk i18n files ran on Windows. Reds not from this
change, both red on main already: gui-ja's {model} twice (#5943), and
TestEveryAgentInLibrary for obsidian and avibe (#5945).

Broken by hand, each red:
- rest() keeping magpie's entries: TestTuanjieCowork (two models) and
  TestTuanjieCoworkMadeFile (file left behind).
- no check for a provider id magpie of the user's own:
  TestTuanjieCoworkLeavesTheUsersMagpie/provider.
- unwire never removing a file magpie made: TestTuanjieCoworkMadeFile.

Not tried: the real app's GUI (picking magpie's model in its menu and a
chat through it), Windows detection (its NSIS per-user path isn't
known, so on Windows it shows once ~/.codely exists), Linux.
2026-11-10 20:50:10 +08:00
yetone 4a9142ccd4 agent: Obsidian, magpie's models in Copilot for Obsidian (shirotokiren on X)
shirotokiren asked for magpie to set up Obsidian's AI plugins, naming
Copilot and Smart Connections.

The new agent "obsidian" finds the vaults in Obsidian's obsidian.json:
~/Library/Application Support/obsidian on a Mac, %APPDATA%\obsidian on
Windows, and on Linux $XDG_CONFIG_HOME/obsidian or the Flatpak or Snap
folder. In each vault that has Copilot for Obsidian 4+
(.obsidian/plugins/copilot), magpie edits data.json in the shape
Copilot 4.0.19 reads:
- it adds providers.magpie, openai-compatible at /agent/obsidian/v1,
  with requiresApiKey false and no keychain id;
- it adds one configuredModels entry per magpie model, with a
  deterministic uuid v5 id, plus limits, image input and reasoning
  efforts;
- new models go into backends.chat.enabledModels;
- on the first wire it sets defaultModelKey, and stashes the old value.

A sync keeps the models the user turned off, their default, and the
name they gave the provider. It writes only the keys that change
(edit.PatchJSON, then temp and rename), and nothing when nothing
changed. A provider named magpie counts as magpie's only when its
baseUrl is magpie's Obsidian route. One the user added by hand under
that name is theirs: it doesn't read as connected, Disconnect leaves
it, and Connect says so and writes nothing. Disconnect takes magpie's entries out and puts the old default
back. Copilot 3, a data.json it can't parse, and no vault with Copilot
are each an error, and nothing is written. A notice asks the user to
reload Copilot, since Obsidian holds the settings in memory.

The gateway now answers CORS for app://obsidian.md keylessly
(appOrigin). Copilot streams through the window's fetch, and without
CORS headers it can read no reply. Only Obsidian's own window sends
that origin, so it gets no more than its calls without an Origin get.
From the network it still needs a key.

Smart Connections is not wired. Its free plugin embeds with a local
model only, and its API providers are in the closed Pro plugin, with
keys in the keychain.

Run (mote, at 401187300 + this commit, then again after rebasing on
9c39edb92):
- gofmt
- go vet for darwin, linux nogui and windows
- go test -run 'Obsidian|Notice|CORS|Craft' ./internal/agent ./internal/gateway
- GUI, chromium and webkit: i18n-keys, i18n-en-no-cjk, icon-one-tone
  (56 of 56)
At 9c39edb92 + this commit: the whole internal/agent package ok
(211s), vet for darwin, linux nogui and windows, CORS tests ok.
At 4d95d81ea + this commit: Obsidian, HandWired and Spelled tests,
vet for darwin and windows, and the three GUI files again (56 of 56).
win-run: TestObsidian* ok on Windows 11.

Broken by hand (each went red, then was restored):
- corsGuard without the appOrigin branch: TestCORSObsidian, preflight
  404.
- re-enabling every magpie model on sync: TestObsidianCopilot, "a
  model the user turned off came back on".
- dropping the user's configuredModels: TestObsidianCopilot.
- counting any provider named magpie as magpie's:
  TestObsidianCopilotHandWiredMagpieIsTheirs.

Not tried: a real Obsidian with Copilot loading the written data.json.
The fixtures follow Copilot 4.0.19's types and migrations. Not tried
over LAN either. The full suite runs after the tag.
2026-11-10 20:06:21 +08:00
yetone 5e3f14f21f agent: Paimon, magpie's models through its litellm provider (ditangongyuan on X)
Paimon (aisk/paimon, `uv tool install paimon`) is a terminal coding agent
on pydantic-ai. Read at 7f7fa51 (config.py, llm.py): its settings are one
JSON file, $PAIMON_CONFIG_HOME/config.json, else ~/.config/paimon/config.json
on every OS. "model" is provider:name, and "providers" keeps each
provider's api_base and api_key.

magpie connects it through pydantic-ai's litellm provider, an
OpenAI-compatible proxy that profiles a vendor/model name by its vendor,
as magpie's ids are spelled, and which Paimon's login never offers:
model = litellm:<catalog id>, providers.litellm = the gateway's /v1 and
magpie's key for Paimon (0600, as Paimon writes it), and
compaction.context_window = the model's window. Paimon compacts against
that only for names genai-prices doesn't know, which magpie's ids aren't;
for a model whose window magpie doesn't know it gets the user's own back,
never the last model's. What the user had in the three keys is stashed and
put back on Disconnect (or `magpie paimon default`); the rest of the file
is untouched, and a file magpie made goes again. A model picked in Paimon
itself while magpie's provider stays is the user's from then on. Requests
are told apart by Paimon's paimon/<version> User-Agent. WSL distros, the
PAIMON_CONFIG_HOME isolation, notices in every language, icon, READMEs,
docs/reference.md, agent-wiring.md and the site's list come with it.

Run:
mote refused SSH all session (kex reset), so the Linux runs went
through wsl-run (magpie-desktop) and Windows through win-run:
- go vet: linux -tags nogui, GOOS=windows, GOOS=darwin -tags nogui on
  internal/agent, agentenv, library: ok. gofmt -l: clean.
- go test -tags nogui ./internal/agent/... agentenv library gui cli (WSL,
  base f03ec97b8): all ok except TestGrokInstalled, the known WSL binfmt
  red #3548.
- Windows: TestPaimon, TestHandWired*, TestEveryNoticeIsTranslated,
  TestPortMovesEveryAgent ok (file-mode checks skipped there).
- GUI, chromium + webkit (WSL): i18n-keys, i18n-en-no-cjk,
  agent-notice-lang, gui-de, gui-ja, gui-zh-tw, icon-one-tone, icon-tile,
  mono-icon-redraw, routing-client-icons, usage-agent-filter-icons,
  agent-connect(-no-models), agent-models(-own, -picker), agent-layout:
  150/151; the red is gui-ja's usage price string, untouched here, filed
  as #5943.
- Real Paimon 0.2.8 (uv pip install paimon) in a sandbox HOME on WSL,
  against a sandbox magpie gateway over a fake OpenAI upstream:
  `magpie paimon magpie/fakeup/m1` wrote litellm:fakeup/m1 and
  providers.litellm at 0600; `paimon -p ping` answered "pong from fake
  upstream", the upstream saw POST /v1/chat/completions with
  "paimon/0.2.8 (Python 3.10.19; Linux x86_64)", and magpie usage counted
  the call under Paimon; `magpie paimon default` put the file back equal
  to the user's.
- After the rebase on origin/main 9c39edb92: the three vets, the targeted
  agent tests and internal/gui ok; internal/library's
  TestEveryAgentInLibrary red for avibe from 9c39edb92 (#5945, not this
  change); i18n-keys, i18n-en-no-cjk, agent-notice-lang, gui-de, gui-zh-tw
  ok; icon-one-tone's every-logo case ok in both engines, its webkit
  Plugins-page case timed out on page.goto's 5s at WSL load 92 (#5425).

Broken by hand, each red in TestPaimon:
- the user's window not put back for a model magpie doesn't know (switch
  window: <nil>);
- stashing again while providers.litellm is magpie's (switch window: 200000);
- a file magpie made not removed (made file left: {});
- a model picked in Paimon not kept as the user's (restore after a pick).

Not tried: macOS (mote unreachable) and the GUI's own Connect click with
the real binary; Paimon's auto-compaction at a window magpie wrote (the
fake model had none, so Paimon said compaction was off, as it does for any
name it doesn't know); a model picked in Paimon's own /model while
connected beyond the unit test.
2026-11-10 19:54:37 +08:00
yetone 9c39edb92c agent: Avibe, magpie as a model source through its Model Hub (alex_metacraft on X)
Avibe (avibe-bot/avibe, avibe-os on PyPI, the `vibe` CLI) runs its own
agent, Vibey, and Claude Code, Codex and OpenCode, all on models from its
Model Hub. Its sources live in model_hub.sources of config/config.json in
$AVIBE_HOME (else ~/.avibe, else a legacy ~/.vibe_remote), but a source
can't be written there by hand: its key is sealed in the hub's credential
store and Avibe puts it into its agents' route chains as it is made.

So the Avibe row adds "magpie" the way Avibe's Models page does, through
its internal API (POST /internal/model-hub on state/dispatch.sock, or on
Windows the loopback port + bearer of runtime/control-ipc/endpoint.json):
create_source with kind api_key, vendor custom, base_url the gateway's
/v1, key agentKey("avibe"), protocol openai_chat and save_unverified.
Avibe then lists the models from /v1/models and adds the source to
Vibey's, Claude's, Codex's and OpenCode's chains itself.

- openai_chat, not openai_responses: for a Responses source Avibe's
  CLIProxyAPI runs Codex's executor, which sends codex-tui headers the
  gateway would take for Codex.
- Off is delete_source with force, sent again with the would_remove_hops
  and would_interrupt Avibe answers, as its page confirms them. Sync is
  refresh_source the same way; on a moved gateway the source is made
  again (the key goes with the address; patch_source can't change it).
- The source id is stashed; a custom source at the gateway's /v1 counts
  as magpie's too and is stashed once seen.
- Every change needs Avibe running; otherwise the switch says to run
  `vibe start` (errAvibeDown). Nothing is written to config.json.
- A sync moves the source only from the gateway's own address on an
  older port (avibeMoved). One the user pointed at a NAS's or the LAN's
  magpie, a local proxy's route, or a WSL distro's way to Windows stays,
  as kept.away keeps every file-written agent's; a Rewire after a port
  move sets it again through the field's Set.
- Every test of the package but Avibe's own finds an Avibe running for
  each home (runningAvibe, served in-process), so the tests that connect
  every agent (gateway moved, LAN and proxy addresses kept, drift,
  ListOnly) take Avibe in too.
- The logo is a tile solid to its edges, so it joins app.css's tile rule
  (icon-tile.test.cjs went red without it).
- AVIBE_HOME joins agentenv and the ~-expanding path vars (Avibe expands
  it). Icon from Avibe's assets/logo.png (MIT), 64px.

Run:
- Real Avibe 3.2.5 (uv tool install avibe-os) in a sandbox HOME in WSL
  magpie-desktop, with a fake OpenAI server as the gateway: magpie's own
  code (a throwaway test, AVIBE_HOME + MAGPIE_ADDR) connected it, Avibe
  discovered both fake models with "Authorization: Bearer magpie-avibe"
  and put the source in vibey/claude/codex/opencode chains; Sync
  refreshed; a gateway move to :3592 made the source again there and
  stashed the new id; a second run found the source by address alone
  and still followed the move; off removed it (list_sources []).
  Earlier, by hand: Anthropic /v1/messages and /v1/responses through the
  hub reached the fake as chat completions.
- wsl-run, at this head rebased on origin/main 021a6e1fd (then 401187300, where the Avibe and all-agents tests, i18n-keys, icon-tile and the gui -run set were run again: ok on Linux and Windows): go test
  -tags nogui ./internal/agent ./internal/appdir ./internal/agentenv:
  appdir, agentenv ok; agent ok but TestGrokInstalled, red on WSL2 at
  main (#3548).
- win-run: the Avibe tests and the all-agents tests (drift, port move,
  LAN, proxy, ListOnly, pickers): ok. The whole internal/agent package
  on Windows (one commit earlier) has main's known Windows reds (#4115,
  #5068, #4846, #5130, #5344, ...); its two Avibe reds (drift, ListOnly)
  are what runningAvibe fixed.
- vet (on the Windows box): windows, GOOS=darwin, GOOS=linux nogui on
  agent/appdir/agentenv: ok.
  gofmt clean.
- GUI (chromium + webkit, win-run): i18n-keys, i18n-en-no-cjk,
  icon-one-tone, routing-client-icons, icon-tile: 63 of 63 ok; go test
  ./internal/gui -run 'Icon|Budget|CSS|I18n|Picker': ok.
- mote refused SSH all session, so everything ran on wsl-run/win-run.

Broken by hand:
- a sync moving any address that isn't the gateway's: the LAN- and
  proxy-kept tests red on Avibe's config.json.
- app.css without avibe in the tile rule: icon-tile.test.cjs red.
- protocol openai_responses: TestAvibeAddsMagpieAsAModelSource red.
- confirmed() not resending the echoed hops: the add, knows-its-source
  and follows-the-gateway tests red (source_in_route_chain).

Not tried: magpie on Windows wiring an Avibe that runs inside WSL; a
real Vibey turn against the real gateway (the fake stood in for it);
macOS with a real Avibe.
2026-11-10 19:36:59 +08:00
yetone 99b080e2ee agents: an agent can have its own Provider in model names (KillTry27355 on X)
"希望 可以在不同的 agent中选择是否显示供应商名字,现在只能统一开关":
Provider in model names was one switch for every agent. An agent's
Details on the Agents page now has a Provider in model names row: As in
Settings · <mode> (the default, kept for everyone), On, Not on names I
set, or Off, for that agent alone. The CLI has the same thing:
`magpie model suffix <agent> [on|own|off|every]`.

- settings.AgentSuffix keeps the agent's own mode by the id its lists are
  kept by (Agent.ListsFor, lower-cased, without @wsl: or #profile). An
  agent with none follows PlainNames/PlainOwnNames as before, so nothing
  a user already set changes.
- provider.LabelsFor(agent, es) reads that agent's mode. Every place
  that named models with Labels for an agent now passes the agent: Codex's
  catalog, the agents' written lists (route.go, Pi's extension), the
  gateway's /v1/models (by agentOf(r)), Muse, Antigravity, Ollama, Claude
  Desktop's catalog and descriptions, Claude Science. Labels is
  LabelsFor("").
- POST /api/settings/agent-suffix sets it and rewrites the agents'
  configs (catalog.Touched), as Settings' switch does.
- docs/subsystems/agent-wiring.md says where the mode is kept and read.
- The picker is in agentsuffix.js, imported when an agent's Details open,
  so the core grows by the one line that loads it (1,529,335 of its
  1,533,802 budget, after the previous commit's move). An agent whose
  list takes no names of magpie's (noNames) has no row.

Tests, each red on the old code: TestAgentSuffix (provider: modes, keys
with @wsl and #profile, reset, bad input), TestAgentSuffixReachesItsFileAlone
(agent: Pi's file follows its own mode while Codex's follows Settings'),
TestModelsListFollowsAgentSuffix (gateway /v1/models per agent),
TestModelSuffixAgentCmd (cli), settings_keep (AgentSuffix survives a
Settings save), agent-suffix.test.cjs (5 languages x 1180/390 x chromium
and webkit, and a noNames agent has no row).

Broken by hand (a copy with LabelsFor ignoring the agent and the picker
reading no own mode): TestAgentSuffix, TestAgentSuffixReachesItsFileAlone,
TestModelsListFollowsAgentSuffix and every agent-suffix GUI case went red.
TestModelSuffixAgentCmd stayed green; it checks what is saved, not the
names.

Run on mote at this change on top of 720200092: gofmt -l clean; go vet darwin, GOOS=linux
-tags nogui and GOOS=windows clean; go test -count=1 of internal/provider,
cli, gui, settings, settingsapi and agent: ok; internal/gateway in an earlier
run of this change at 3b261932e: ok (1044s), and at this head -run
'Desktop|Models|Suffix|Science|Muse|Ollama|Antigravity|Codex.*Catalog': ok.
node --test of every agent-*, i18n-* and gui-* file plus old-webkit, both
engines: 1026 of 1049. The reds are all on main or under load:
agent-switch-accounts' 20 not-connected cases (red at origin/main 7c41060c2
too, filed as #5925), old-webkit's Safari 15 styles (#5919), and one case
each of agent-compact (#5607) and agent-stale-copies (#1949), which pass
44/44 when run alone. panel-fold's 'keeps what was clicked' is red on main
too (#5796).

Rebased on 0f94acc99 and run again at this change (9d82986ea): gofmt
clean, go vet clean for darwin, linux (nogui) and windows; provider,
gui, settings, settingsapi and agent ok, the gateway's suffix and
agentOf tests ok; GUI agent-suffix, old-webkit, agent-bulk-visibility,
visibility-saving, i18n-keys and i18n-en-no-cjk in chromium and webkit,
57 of 58, the one red Safari 15's styles (#5919). internal/cli was red
only on /api/model-price having no command, from main's 40ca0c88d;
the next commit names it. Rebased again on ccc96b4a7 before the push
(proc, codex, claudetui, a remote window, routing rules, redact;
no conflict), core budget test ok there.

Not tried: a real agent with a real account picking its own mode; WSL and
Windows agents (the @wsl: key is covered by a unit test only).
2026-11-10 18:57:16 +08:00
yetone bc0d9e8739 agent: magpie's own Claude work folder isn't Claude Code bypassing magpie (ifccod7391564 on X)
The bridge runs Claude Code in os.TempDir()'s magpie-claude-work(-<uid>),
and on the user's own home those prompts go into ~/.claude/history.jsonl
too. LastUsed read them as Claude Code used with none of its requests
reaching magpie, and the Agents page warned "Claude Code 最近绕过了
magpie". The owner's own history.jsonl has 1594 such lines, project
/private/var/folders/.../T/magpie-claude-work-501. LastUsed now passes
over lines whose project is that folder (inMagpieWork: the last path
element, either slash, so a Mac's /private/var, C:/…, C:\… and a WSL
mount all match; magpie-claude-workshop does not). lastJSONLTime takes a
skip; Codex's history.jsonl has no project and passes nil.

Run (wsl-run, magpie-desktop; mote refused SSH the whole time):
- go test -count=1 -timeout 45m ./internal/provider ./internal/agent:
  provider ok; agent ok but TestGrokInstalled, the known WSL2 binfmt
  red (#3548), unrelated
- TestClaudeBridgePromptsArentBypass, TestDriftBypassed on Windows: ok
- cross-OS go vet as in the provider commit; gofmt -l clean
Broken by hand: LastUsed with skip nil: the new test is red with the
reporter's bypassed drift.
Not tried: the GUI (no GUI change), the macOS run (mote down).
2026-11-10 18:21:32 +08:00
yetone 8cc4bd7e3c agent: Craft Agents, through a keyless connection at the gateway (springg1998 on X)
Craft Agents (lukilabs/craft-agents-oss, thecraftagents.com) keeps its LLM
connections in config.json under $CRAFT_CONFIG_DIR or ~/.craft-agent
(paths.ts, storage.ts, llm-connections.ts, v0.15.8). magpie adds one
connection: slug magpie, providerType pi_compat, authType none, baseUrl at
the gateway's /agent/craft-agents/v1, customEndpoint.api
openai-completions. Its models are the ones picked for it, and defaultModel
is always one of them, because Craft resets a default that isn't in the list
to the first. magpie makes it defaultLlmConnection. The user's default is
stashed (as JSON, "" for none) and put back on off when that connection still
exists. A name the user gives magpie's entry stays, and a sync with nothing
to change writes nothing. A config.json with no workspaces list is one Craft
doesn't load, so magpie never creates one: open Craft once first. Picking one
of the user's own models removes magpie's entry and sets that model on their
default connection. Sessions keep the connection they started on, so the
notice says new sessions use it (zh, zh-TW, ja, de).

Detected by ~/.craft-agent, Craft Agents.app (com.lukilabs.craft-agent), or
%LOCALAPPDATA%\Programs\@craft-agentelectron\Craft Agents.exe (per-user
NSIS; the GUID is the UUID v5 of the appId, derived the same way as dsh's
known one). Skills go to ~/.agents/skills. CRAFT_CONFIG_DIR is in
agentenv.Vars. Icon from Craft's own icon.svg (#9570BE). README, reference,
agent-wiring and site list it.

Run on mote, first on origin/main 720200092:
- go test -tags nogui ./internal/agent ./internal/library ./internal/agentenv: ok.
- go test ./internal/gui: ok.
- go test ./internal/proc: ok (at the pre-rebase head).
- GUI tests in chromium and webkit, 69/69: i18n-keys, i18n-en-no-cjk,
  icon-one-tone, icon-tile, tray-logos and usage-agent-filter-icons.
- gofmt -l is clean. go vet passes for darwin, GOOS=linux -tags nogui, and
  GOOS=windows.
Then rebased on 6b92824ff and run again there: go test ./internal/gui,
the Craft, hand-wired, spelled, drift and every-agent tests in
./internal/agent and ./internal/library, and i18n-keys: all ok.
Pushed rebased on 2fbead798 (provider relay URL, Windows restart, gateway cap: no
files in common), not run again there; the full suite runs after the tag.
Broken by hand: with unwire's restore of the user's default taken out,
TestCraftAgents goes red at "restore". On the old code the tests don't
compile (no craftAgents). The first run also showed every-agent tests
(drift, LAN, proxy, port move) needing a Craft fixture, which is now added.
Not tried: a real Craft Agents app or its Pi server against the gateway, or
the Windows install path on a real install.
2026-11-10 18:09:54 +08:00
yetone 720200092e agent: turn off an agent's own telemetry from its settings (OipsAnthony on X)
An agent with a documented telemetry switch has a Telemetry row in its
Settings on the Agents page (opened row and settings sheet). Off writes
that switch into the agent's own config the way magpie writes it already:

- Codex: [analytics] enabled = false in config.toml (feedback left alone)
- Claude Code: env DISABLE_TELEMETRY and DISABLE_ERROR_REPORTING = "1"
- Gemini CLI, Qwen Code: privacy.usageStatisticsEnabled = false

Nothing is written until the user turns it off. Off writes only keys the
file lacks and records them in the stash; a key the user set on refuses
Off and names it; one they set off stays, and the row says so. On takes
out only the keys magpie wrote that still hold magpie's value. An
unreadable config is unknown: the row says so and can't be pressed.
Agent.Telemetry is not a Field, so profiles never carry it and Unwire
leaves it. Only agents on this computer (no WSL distro, #3896).
POST /api/agents/telemetry/{id}; strings in zh, zh-TW, ja, de.

The row is paid for in the core budget with sixteen Agents-page comments
cut in app.js (core 1,532,840 of 1,533,802 after the rebase), no raise.

Run (mote, at this head on origin/main 1ad9d157f; vet, the three packages and agent-telemetry, i18n-keys, agent-details-ready, click-scroll again there, 98 of 98):
- go test -run Telemetry ./internal/agent, then go test -count=1
  ./internal/agent ./internal/gui ./internal/cli: ok
- go vet ./..., GOOS=linux -tags nogui, GOOS=windows: ok; gofmt clean
- GUI, chromium and webkit: agent-telemetry (34 pass: every language at
  1100 and 640px, no scroll on click, no select, the user's own off,
  a refusal, the sheet), and 104 agent-*, i18n-*, click-scroll,
  settings-search, panel-agent and agent-settings files: reds only in
  page-width-steady and mobile-web (red the same at origin/main
  5a347ca8c, #5013, #4541) and agent-compact once under concurrency 6
  (passes alone, 8 of 8; #5607; its fixture has no telemetry)
- internal/cli failed once in the first run with its name lost to a
  tail of mine; it passed on a rerun at this head and at origin/main

Broken by hand: skipping the user-on check, dropping the "still ours"
check before a delete, and removing the WSL gate each turned
TestCodexTelemetryLeavesTheUsers, TestClaudeTelemetryChangedSince,
TestUsageStatsTelemetrySwitch and TestTelemetryOnlyHere red. The tests
don't compile on the old code (no Agent.Telemetry).

Not tried: real Codex, Claude Code, Gemini CLI or Qwen Code reading the
written keys (the keys come from their source); Crush (left for later),
OpenCode (no switch); WSL agents; the whole GUI suite (the agent-*,
i18n and agent-settings files only); the full go suite runs after the tag.
2026-11-10 17:28:15 +08:00
yetone 15acba5347 codex: the Codex app's projects follow an account switch, and the app isn't quit unasked (Michael25651150 on X)
"切换账号 codex 添加的项目丢了 发生过好几次了 另外额度用尽时会强制重启 codex 客户端"

Projects. The Codex app (ChatGPT.app 26.1103 and on) keeps its sidebar's
projects per ChatGPT identity in $CODEX_HOME/.codex-global-state.json,
under electron-account-renderer-state-v1 ({owner, inactive:{<sha256 of
JSON.stringify([chatgpt_user_id, chatgpt_account_id])>: {atoms, globals}}}).
On an account change it parks the old identity's account-scoped globals
and loads the new one's, so magpie's switch (auth.json, then the
app-server's restart) showed an account that never had the app open with
no projects (#5497, #5602, #5702, #5874). Read from the app's own bundle
(early-bootstrap-133 selectRendererOwner, -815's owner hash). The app reads
the file only at launch and writes its memory over it, so magpie writes
it only while the app is closed (codex_projects.go): from the 3s loop once
the file, auth.json or logins.json changed (process listing at most every
30s), and between the quit and the open of every reopen (appQuitDone in
reopenBundle and restartWin). Each identity of auth.json and the saved
Codex logins whose snapshot has no local-projects key gets the project
keys of the identity with the most; an own list (an emptied one too) is
left; g-p- ChatGPT project mirrors and their ties aren't carried, and a
backing naming another account is dropped (the app refuses those). A
file without the key or that doesn't parse is not written; the first
write keeps the file as it was beside it (.magpie-before-projects).

Restart. When quota runs out magpie restarts the app's app-server (the
takeover needs it: the app reads its account only as its app-server
starts, else Send stays grey). A ChatGPT app can then show "hit a snag",
and magpie quit and reopened the whole app (CodexAppRelaunch), and on
Windows reopened an app that started no app-server (codexAppGotNone).
Both now happen only with "Restart the Codex app when magpie switches its
account back" ticked (codexRestartsApp, off by default); otherwise the
Agents row says to quit and reopen, as it did where a relaunch failed.

Run (mote unreachable all session: ssh kex reset on every try; so on the
Linux box and Windows box instead):
- wsl-run: go vet -tags nogui, GOOS=darwin CGO_ENABLED=0 go vet and
  GOOS=windows go vet of internal/provider and internal/agent: ok.
- wsl-run go test -tags nogui ./internal/provider ./internal/agent:
  provider ok; agent red only on TestGrokInstalled (#3548, WSL binfmt).
- win-run go test -run 'TestCodexProjects|TestCodexRendererOwner|
  TestCodexApp|Restart' ./internal/provider ./internal/agent: provider ok;
  agent red on TestWorkBuddyRestartOnMac (#4115) and
  TestOpenMausBotRestartOnMac (added to #4115), neither touched.
- gofmt -l: clean.
- The owner hash checked against node's crypto (TestCodexRendererOwner).

Broken by hand: carryCodexProjects returning at once -> the four
TestCodexProjects* red; the snag gate removed -> TestCodexAppNotQuitUnasked
red (relaunched 1); the Windows gate removed -> red (reopened 1); the
backing strip removed -> TestCodexProjectsFollowASwitch red.

Not tried: the real Codex app. This Mac's ~/.codex state has no
per-identity key (read-only check), so the switch is reproduced against a
Go port of the app's selectRendererOwner on the issues' layout, not the
app itself. No macOS test run (mote down). The takeover (no account)
still shows no projects in the app, by the app's own rule; they come back
with the account. Projects added while the app runs reach other accounts
once it is closed.
2026-11-10 17:10:32 +08:00
yetone d109ec8da8 agent: miniQ, its provider on magpie's gateway (xiancrong on X)
miniQ (LeadingThink/miniQ, 0.1.213) is a desktop coworker and a `miniq`
terminal, both clients of one miniq-daemon. Its model is one provider in
<data dir>/settings.json, {baseUrl, apiKey, model, apiProtocol}: the data
dir is $MINIQ_DATA_DIR, else the folder miniq-data-dir.json names, else
%LOCALAPPDATA%\miniq or ~/.local/share/miniq (macOS too).

Picking one of magpie's models writes the provider as the gateway's /v1,
magpie's key for miniQ (it sends no User-Agent of its own), the catalog id
and apiProtocol chat_completions ("auto" guesses a protocol from the model
name). What the user had is stashed whole and put back on Disconnect; the
rest of settings.json is left alone. A settings.json magpie made is 0600
and goes again when magpie steps out. The daemon reads settings.json once
and writes its copy back on every change, so a running one is told too:
settings.update over the WebSocket daemon.json names, as miniQ's own
Settings does, which also moves open chats. Notice compares the daemon's
settings.get with the file and asks for a restart when they differ.
"On magpie" is known by magpie's key, so a moved port or a proxy in front
of the gateway is told apart by Check (baseUrl and apiKey). WSL: the
distro's ~/.local/share/miniq. Icon, i18n (zh, zh-TW, ja, de), READMEs,
reference, site, MINIQ_DATA_DIR in agentenv.Vars.

Run:
- At the pushed head, rebased on 286e3b6d5: internal/agent and
  internal/agentenv ok; i18n-keys, agent-notice-lang, icon-tile 29 of 29.
- mote: go test ./internal/agent/ ./internal/agentenv/ ok;
  ./internal/gui/ and ./internal/cli/ ok except
  TestGatewayModeStatsNameTheGatewaySessions, run in mote's first local
  hour (00:2x), which is #5690.
- GUI on mote, chromium and 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: 110 of 110.
- Windows (win-run): TestMiniq*, TestOwnProviderNamedAsMagpies/miniq,
  TestFolderVarsAreListed ok (the LOCALAPPDATA path).
- gofmt; go vet darwin, linux nogui, windows.
- Real miniQ in a sandbox on mote: the 0.1.213 aarch64 terminal tarball,
  sha256 checked against terminal.json, miniq-daemon on a sandbox
  MINIQ_DATA_DIR, a fake OpenAI upstream at MAGPIE_ADDR (uncommitted
  test). Set magpie/deepseek/pro: the running daemon's settings.get
  showed the gateway's /v1 at once; `miniq exec --no-start "say pong"`
  sent POST /v1/chat/completions with Bearer magpie-miniq and model
  deepseek/pro and printed the reply. Set "": the daemon and the file
  were back on the user's provider with their key; nothing else in
  settings.json changed. Run twice, before and after the key fix.

Broken by hand:
- push sent "settings.nothing": TestMiniq red ("the daemon was told
  nothing").
- apiProtocol dropped from the provider: TestMiniq red.
- on() by URL only (the first version): TestPortMovesEveryAgent,
  TestDriftUnwiredEveryAgent/miniq and TestReverseProxyIsStillMagpie red.

Not tried:
- miniQ's desktop app; only the terminal and daemon ran.
- Windows and WSL with a real miniQ.
- Session titles: miniQ asks a hard-coded gemini-3.8-flash on the same
  provider for them; without such a model at magpie the chat stays
  untitled (miniQ retries later). Nothing in its settings changes that.
- A project's own model in miniQ overrides the global one, as in miniQ.
- settings.update can't remove a provider, so a daemon that had none
  before magpie keeps magpie's until it restarts; the notice says so.
2026-11-10 16:46:39 +08:00
yetone 5a02bf8c14 agent: mu, Pi with a judgment kernel, wired in ~/.mu/agent (xteam3301 on X)
mu (github.com/qybaihe/mu, npm mu-agent, the mu command and the mu
desktop app) is Pi 1.4.0 with a judgment-kernel extension. Its
kyrn/bin/mu.mjs starts Pi on its own agent folder, so Pi's settings.json
and models.json live in ~/.mu/agent, and the desktop app runs the same
Pi on the same folder. magpie now wires it as it wires Pi.

- agent: mu (piLikeKeyed). Its folder is found as mu.mjs finds it:
  $MU_AGENT_DIR, $KYRN_AGENT_DIR, $MU_CODING_AGENT_DIR,
  $KYRN_CODING_AGENT_DIR ("~" expanded), else ~/.mu/agent, or
  ~/.kyrn/agent while ~/.kyrn is a folder and ~/.mu isn't. Its requests
  say pi/<version>, so the provider's key magpie-mu names it. The alias
  is mu-agent. Its judge (~/.mu/mu.json) is left alone.
- `mu` is also maildir-utils' command (brew, distros). A mu on PATH
  that neither is nor names mu.mjs / mu-agent is not taken for it
  (notMuAgent).
- Gemini models stay on Chat for mu, as for Pi and StepCode (piAsked).
- WSL kind at ~/.mu/agent (found by its folder, not the command); CLI
  update through npm mu-agent; the desktop app (io.github.qybaihe.mu,
  mu.app, %LOCALAPPDATA%\Programs\mu\mu.exe, /opt/mu).
- agentenv and appdir know the four variables.
- library: mu's AGENTS.md / AGENTS.override.md, its mcp.json (Pi's
  native format) and skills in its folder; it reads ~/.agents/skills.
- GUI: a one-tone icon. Default in its model picker says it clears the
  default and mu picks one itself (PICKS_ITSELF).
- docs: READMEs, reference.md, agent-wiring.md.

Run (mote, at this tree before the rebase):
- gofmt -l internal/ clean; go vet darwin, GOOS=linux -tags nogui and
  GOOS=windows of agent, library, appdir (and agentenv on darwin): clean.
- go test -count=1 ./internal/agent ./internal/library ./internal/appdir
  ./internal/agentenv ./internal/usage: ok (agent after its maildir
  fixture stopped using testenv.Program, which refuses a non-script).
  New: TestMu, TestMuDir, TestMuNotMaildirUtils, TestMuTarget; mu added
  to the handwired, spelled, Pi scope, scope-gone and Gemini-on-Chat
  lists.
- Windows (win-run on xiaomi-gpu): go test -run 'TestMu|TestPiScope|
  TestScopeGone|TestHandwired|TestSpelled|TestPiFolderKeepsGemini'
  ./internal/agent ./internal/library ./internal/appdir: ok.
- Real mu-agent 0.3.9 (Node 22.22.0) on mote in a sandbox HOME, a
  sandbox gateway on 47822 over a fake OpenAI upstream: `magpie agents`
  found mu with the user's deepseek model; `magpie mu magpie/fakeup/m1`
  wrote defaultProvider magpie and providers.magpie with key magpie-mu,
  keeping the user's deepseek provider; `mu -p ping` answered "pong from
  fake upstream" (upstream saw POST /v1/chat/completions, model m1,
  UA pi/0.3.9); `magpie usage today` counted the call under agent mu;
  `magpie mu default` put settings.json and models.json back byte for
  byte (cmp).
- GUI, chromium and webkit: pi-default-note (with mu added),
  icon-one-tone, icon-tile, mono-icon-redraw, routing-client-icons,
  usage-agent-filter-icons, i18n-keys, i18n-en-no-cjk, agent-connect,
  agent-models, agent-layout: 88 of 88.
- Rebased onto 1b2ad557f: gofmt clean; vet darwin (agent, library,
  gui), linux nogui and windows (agent, library) clean; go test
  ./internal/library ./internal/appdir ok; ./internal/agent -run
  'TestMu|TestPi|TestHandwired|TestSpelled|TestScopeGone|TestDesktop|
  TestCLIUpdate|TestWSL' ok; ./internal/gui ok but two reds that are red
  on an origin/main 1b2ad557f copy as well: TestCoreScriptBudget
  (1,534,470 > 1,533,802 on main, #5918; this change adds 6 bytes) and
  TestGatewayModeStatsNameTheGatewaySessions (run at 00:xx local, #5690).
  The rebase onto 4c5b89489 only adds LESSONS.md.

Broken by hand, each red:
- no binNot: TestMuNotMaildirUtils (maildir-utils' mu detected as mu).
- no ~/.kyrn fallback: TestMuDir.
- mu out of piAsked: TestPiFolderKeepsGeminiOnChatForRaft.
- mu out of PICKS_ITSELF: pi-default-note, 2 of 2 red (chromium).

Not tried: the mu desktop app (its install paths are read from its
electron-builder config, not an installed copy); a real vendor behind
the gateway (fake upstream only); a Gemini model through mu; WSL with a
real distro; mu's own session files are not read for usage outside
magpie.
2026-11-10 16:27:14 +08:00
yetone 1b2ad557fb agent: Alma or OpenHanako uninstalled is turned off without opening it first (aooo_han on X)
aooo_han connected Alma, uninstalled the Alma app, and then couldn't turn
Alma off in magpie: it said "Alma isn't running - open Alma and try again".
Alma's settings are reached only through its local API, so an app that is
gone could never be turned off.

- Alma: when the API is down and Alma isn't installed (macOS bundle,
  Windows install folder or registered guid, Linux /opt or desktop entry,
  or alma-server on PATH), turning it off clears magpie's own record and
  remembers a takeout (alma.takeout in the stash). Alma's providers live
  in its SQLite database, so magpie doesn't edit its files. If Alma comes
  back, the next Sync takes magpie's provider and default model out of
  it, then forgets the takeout. Turning Alma on again forgets it too.
  An installed Alma that isn't running still says to open it.
- OpenHanako (the sibling with the same need: a sealed catalog it
  rewrites only while running): uninstalled, the model in its config file
  goes back to the user's own and the sealed provider entry is left
  alone, instead of errSealed.
- An app in the Trash, as a Mac app is uninstalled, still shows up in
  Spotlight. spotlightBundles now skips ~/.Trash and /.Trashes paths.

Run: go test -run 'Alma|Hanako|InTrash' ./internal/agent and the whole
internal/agent package (wsl-run, since mote's sshd refused connections);
go vet for darwin, linux (nogui) and windows; gofmt. e2e in a sandbox
HOME on WSL with no Alma: on origin/main `magpie alma default` printed
"Alma isn't running - open Alma and try again"; with this change it
prints "Alma model default", exit 0, and the list shows Alma off.

Broken by hand: without the Alma branch TestAlmaOffUninstalled fails
with "isn't running"; without the Hanako branch
TestHanakoSealedUninstalled fails with errSealed; without the Sync
takeout magpie's provider and default model stay in a returned Alma;
inTrash returning false fails TestInTrash.

Not tried: a real uninstalled Alma on macOS or Windows (the live Alma is
the owner's); a reinstalled OpenHanako doesn't get its sealed provider
taken out (its Sync is skipped once hand-wired); an AppImage OpenHanako
isn't detected as installed.
2026-11-10 16:19:58 +08:00
yetone 00e8242e85 library: Hermes folds its context with billion-context through its /bili/ prefix (Duckb7si on X)
Library › billion-context said no agent could use it on a machine where
Hermes was connected to magpie. Hermes was left out of the lanes on
purpose: bili's native Hermes plugin (hermes-plugin/__init__.py,
apply_env, billion-context 0.1.213) only sets HTTPS_PROXY, HERMES_CA_BUNDLE
and SSL_CERT_FILE. magpie's Hermes provider is http://127.0.0.1:3425/v1,
plain http on loopback, so that proxy never sees it: the plugin would add
its tools and fold nothing.

Hermes now takes the route Zed takes, bili's documented /bili/ prefix.
Turned on, magpie runs `bili start --port 8787` and sets base_url of the
magpie and magpie-anthropic providers to http://127.0.0.1:8787/bili/<gw>,
in config.yaml and in every profile that has magpie's provider
(agent.HermesThrough). Each later Sync or pick keeps a loopback prefix
with a path (hermesPrefix), and drops anything else back to the gateway.
Turning it off puts the gateway back. The empty-list string, docs (en, zh,
ja), llms-full.txt and docs/subsystems/library.md name Hermes.

The other agents bili supports that magpie wires (dsh, Kimi, ZCode, Codex,
Gemini, Qwen, ...) are #5915.

Run (mote, at the rebased head unless said):
- go test -tags nogui ./internal/library: ok (252s) at the rebased head
- go test -run 'TestHermes|TestZed|TestProxy|TestBili|Kept'
  ./internal/agent ./internal/library: ok before the rebase (base
  2219fdd49); the whole internal/agent at the rebased head was still
  running at push (mote load ~60), result goes on #5915
- GUI library-bili, library-all, i18n-keys, i18n-en-no-cjk (chromium and
  webkit, every language): 84, 26, 4, 4 pass, 0 fail (before the rebase)
- site node --test: 107 pass (llms-full.txt regenerated with llms-full.mjs)
- go vet darwin, GOOS=linux -tags nogui, GOOS=windows on agent and
  library: clean; gofmt -l clean
Broken by hand:
- hermesEntries without the prefix: TestHermesThroughBili red (a pick
  drops the prefix)
- no "hermes" URL lane: TestBiliHermesThroughPrefix red (Hermes not
  offered)
Not tried:
- a real Hermes and a real `bili start`; tests fake bili and the probe
- a profile created after turning it on goes to the gateway until Hermes
  is turned on again
- bili's native Hermes plugin installed at the same time
- Windows run (vet only)
2026-11-10 16:16:11 +08:00
yetone 93a33d8174 agent: OpenBot's icon, its requests named its own, its skills in the Library (SSNQT on X)
SSNQT on X, magpie 0.1.3503 on macOS, OpenBot (611ce90d1): no icon in
the Agents list, its requests listed as OpenCode's, and no way to pick
it for skills or MCP servers in the Library.

- Icon: OpenBot's production icon (build/icon-production.png in
  nightly-labs/openbot, 128px) as icons/openbot.png, in pngIcons and in
  app.css's tile rule (a solid tile, icon-tile.test.cjs); openbot is off
  client_icons_test's generic list.
- Requests: OpenBot seals an endpoint's key and headers in safeStorage,
  which magpie can't write, and hands the endpoint to the OpenCode it
  runs, so every request came with OpenCode's User-Agent and nothing of
  OpenBot's. magpie's entry is now at <gateway>/agent/openbot/v1
  (gateway.AgentURL). lanGuard takes /agent/<id> off the path when <id>
  is an agent magpie knows (takeAgentPath), agentOf names that agent
  first, and startedByAgent never takes such a request for a script. An
  unknown id is left in the path (404 as before). An entry written at
  /v1 is rewritten at the next sync; OpenBot reads it after a restart,
  which its notice already says. Requests recorded before stay
  OpenCode's.
- Library: an openbot target with skills in ~/.agents/skills, the only
  folder OpenBot reads (home-skills.ts, HOME_SKILL_FOLDER). Its MCP
  servers are rows in its SQLite database (openbot.db,
  projection_mcp_servers), which magpie doesn't write, so it stays out
  of the MCP picker: #5896.
- Guard: TestEveryAgentInLibrary fails for a built-in agent that has no
  Library target and isn't in noLibrary with a reason. 34 agents had
  none when it landed; they are listed as "not looked at (#5897)". The
  icon guard (TestEveryClientHasNameAndIcon) and the agent-name guard
  (TestIsAgentByUserAgent) were there already.

Run (mote unless said): gofmt -l internal (clean); go vet darwin, GOOS=linux
-tags nogui, GOOS=windows on agent, gateway, library, gui: ok;
go test -count=1 ./internal/agent ./internal/gateway ./internal/library
./internal/gui ./internal/usage: all ok but internal/gui's
TestUpdateSlowDownloadOutlastsTheCheckBound (its check request hit its
deadline with four other suites on the box; passes 3 of 3 alone; the
updater isn't touched here; #5905); TestAgentInPath and
TestEveryAgentInLibrary on Windows (win-run): ok; GUI i18n-keys,
icon-tile, icon-one-tone, icon-builtin-over-address,
routing-client-icons, library-pick-remove: chromium 101/101, webkit
54/54. Real gateway (nogui build, sandbox HOME, port 3591): a POST to
/agent/openbot/v1/chat/completions with OpenCode's User-Agent was
recorded as agent openbot, the same at /v1 as opencode, and
/agent/openbot/v1/models answered the list.

Broken by hand, each red: the takeAgentPath call in lanGuard taken out
(TestAgentInPath: path kept, agent opencode); the pathAgent check in
agentOf taken out (agent opencode); the openbot case in targetOf renamed
(TestEveryAgentInLibrary: openbot has no place); Icon back to generic
(TestEveryClientHasNameAndIcon).

Not tried: real OpenBot or a real OpenCode sending to the new address
(the URL is built as `${baseURL}/chat/completions` by
@ai-sdk/openai-compatible, read in its source); the full suite (runs
after the tag).
2026-11-10 15:56:21 +08:00
yetone 03a800ac69 agent: OpenCode 2's config in its own words (kaising00 on X)
For an OpenCode 2 magpie wrote OpenCode 1's opencode.json: its provider
under `provider`, the small model as `small_model`, and `reasoning: true`
on models that reason. OpenCode 2 converts the first two in memory, but
it doesn't read `reasoning` and logged a WARN for each such model on
every load ("configuration normalization diagnostic ... omitted
unsupported legacy setting", reproduced with a real OpenCode 2.2.6).

Now the OpenCode that reads the file decides its words (openCodeTwo in
opencode_v2.go: the opencode on PATH, or a WSL distro's probed version,
now asked for opencode too). For 2.x magpie writes `providers.magpie` in
OpenCode 2's shape (openCodeNative), `agents.title.model`, and no
`reasoning`. A file written for OpenCode 1 moves over on the next sync:
openCodeFromV1 ports migrateStandardProvider (v2.2.6) so the user's keys
in magpie's provider (headers, timeout, setCacheKey, their own variants,
limit.output) go along; an empty `provider` is dropped; a small_model
that isn't magpie's stays. OpenCode 1, or an unknown version, gets the
same output as before. OpenChamber writes the same file and takes the
same decision, so the two syncs don't undo each other. mimocode, DevEco
Code and Air keep OpenCode 1's words.

Run:
- gofmt; go vet ./internal/agent for darwin, linux (-tags nogui) and
  windows (mote): clean.
- go test -count=1 ./internal/agent on mote: ok, at the rebased head.
- win-run go test -run 'OpenCode|OpenChamber|WSL' ./internal/agent: ok.
- Real binaries on mote, sandbox HOMEs, `opencode debug config
  --print-logs`: the file magpie now writes for OpenCode 2 loads in
  OpenCode 2.2.6 with no WARN/ERROR, and resolves (model, agents,
  providers) exactly as 2.2.6 resolves the OpenCode 1 file it replaces;
  the OpenCode 1 file loads in 1.19.5 with no WARN, small_model and
  reasoning intact. The old file in 2.2.6 still shows the reasoning WARN.

Broken by hand:
- openCodeTwo always false: TestOpenCode2WritesItsOwnWords,
  TestOpenCode2MovesAnOpenCode1File, TestOpenChamberAndOpenCode2AgreeOnWords
  and TestOpenCodeTwo red.
- moveProvider not carrying the v1 block over: the move test red on the
  user's timeout.
- moveSmall off: the move test red on agents.title.model.

Not tried: a real OpenCode 1 desktop app reading a file written for an
OpenCode 2 CLI on PATH (it would see no magpie provider; 1.19.5 logs
`providers` as not representable); Air's bundled OpenCode version; a real
WSL distro with OpenCode 2.
2026-11-10 14:52:01 +08:00
yetone e7fe52fdc3 minimax: follow the data folder MiniMax Code Desktop moved, not ~/.minimax (YujunT46308 on X)
YujunT46308 on X (magpie 0.1.3519, MiniMax Code 3.1.13 CN): with the
app's data folder moved to another parent (localRuntimeDataParentDir),
magpie went on writing ~/.minimax/config.yaml, which the app no longer
reads.

How MiniMax Code 3.1.13 finds it, read from its own app.asar
(dist/main/modules/local-runtime/data-dir.js,
resolveLocalRuntimeDataDirSelection; @mavis/config's config.js for the
runtime): MINIMAX_DATA_DIR, then MAVIS_DATA_DIR, then the desktop
setting, then ~/.minimax. Settings' data-folder move keeps the parent as
config.localRuntimeDataParentDir in its electron-store file
(storage.ipc.js: minimax-agent-cn-config.json for the China build,
minimax-agent-config.json for the global one) in Electron userData,
named by app-identity.js: "MiniMax" (CN) / "MiniMax Agent". The data
folder is <parent>/.minimax.

What changed:
- appdir.MiniMaxDirIn resolves the folder in that order, reading the
  store under ~/Library/Application Support on a Mac and %APPDATA% on
  Windows. A missing, unreadable or unparseable store, or a parent that
  isn't an absolute string, is ~/.minimax, as electron-store itself
  reads a file it can't parse as its defaults.
- internal/agent's MiniMaxDir (detection, connect, restore, Sync, Check)
  and internal/sessions' MiniMaxDir (Usage's calls) both use it; the
  Library's skills follow a.Dir. WSL's mcode still uses the distro's
  ~/.minimax (no desktop app there).
- MAVIS_DATA_DIR joins agentenv's variables, so tests sandbox it.
- agent-wiring.md and reference.md say where the folder comes from.

Run:
- On mote, the real MiniMax Code 3.1.13 CN arm64 dmg: launched with no
  setting, userData was ~/Library/Application Support/MiniMax holding
  minimax-agent-cn-config.json; with config.localRuntimeDataParentDir
  set to a folder, the next launch created <parent>/.minimax/config.yaml.
  appdir.MiniMaxDir() against that real store printed <parent>/.minimax.
  (The test data I made on mote was removed after.)
- mote-run go test -count=1 ./internal/appdir ./internal/agentenv
  ./internal/sessions ./internal/library: ok. ./internal/agent -run
  'MiniMax|Minimax|WSL|Env|Spelled|Handwired': ok.
- win-run go test -run MiniMax ./internal/appdir ./internal/agent
  ./internal/sessions: ok, TestMiniMaxDirIn and
  TestMiniMaxCodeMovedByDesktop ran (not skipped) with %APPDATA% paths.
- gofmt -l clean; go vet of the touched packages for darwin, windows
  and linux (nogui, CGO off) ok.

Broken by hand: with the desktop store read turned off,
TestMiniMaxDirIn and TestMiniMaxCodeMovedByDesktop go red (the folder
reads as ~/.minimax).

Not tried: the Windows desktop app itself (userData %APPDATA%\MiniMax
is Electron's appData plus the app name, the same rule seen on the
Mac); the global build's store with a real install; a store mid-rollback
(the app's guard writes the restored parent back to the same key on its
next launch). A user who also runs the mcode CLI without
MINIMAX_DATA_DIR has it on ~/.minimax, which magpie now leaves alone
while the desktop folder is moved.
2026-11-10 14:43:44 +08:00
yetone 031938ca97 antigravity: 2.30 reads its gateway from ~/.gemini/config/config.json; magpie writes both (YujunT46308 on X)
Antigravity 2.30.0 moved the Enterprise Gateway settings from
~/.antigravity/settings.json to ~/.gemini/config/config.json (same
gateway/models schema, beside the app's userSettings and plugins). Each
version reads only its own file and an update copies nothing across, so
a wiring made for 2.29 left 2.30 off magpie, on every OS (the report was
Windows). The AGY_LLM_GATEWAY_* variables and admin paths are unchanged.

magpie now writes the same gateway block, listSource and defaultModelId
into both files, each with its own stash, and puts each back on
disconnect (config.json keeps userSettings/plugins; a config.json that
isn't there is not created on disconnect). Sync carries a wiring made by
an older magpie into config.json at the next start, at the level the
wired file starts on. Check judges each file.

Run:
- Windows (xiaomi-gpu, real 2.30.0 per-user install, sandbox
  USERPROFILE/APPDATA): language_server.exe headless as the hub.
  With only settings.json wired (what magpie wrote before) it lists no
  models and never resolves a gateway catalog: the report reproduced.
  With this magpie.exe (serve, provider add, `antigravity
  magpie/up/g3`): config.json gets the block beside userSettings, the LS
  logs "Resolving models from Tier 2 (Remote catalog listSource:
  http://127.0.0.1:3640/v1/models" and GetAvailableModels returns up/g3.
  `antigravity default` gives config.json back as it was and
  settings.json as {}.
- macOS (mote, real 2.30.0 language server headless): origin/main's
  magpie wires, then this tree's `magpie serve` syncs config.json, 2.30
  resolves Tier 2 from it; off restores both files.
- win-run go test -run ^TestAntigravity ./internal/agent: ok.
- mote: go test ./internal/agent; -run Antigravity ./internal/gateway
  ./internal/gui; gofmt -l; go vet ./internal/agent; GOOS=linux go vet
  -tags nogui ./...; GOOS=windows go vet ./...: all ok.

Broken by hand: config.json left out of antigravityFiles ->
TestAntigravityConfigJSON and TestAntigravitySyncWiresConfigJSON red;
Sync not connecting an unwired file -> TestAntigravitySyncWiresConfigJSON
red.

Not tried: a chat turn from the real 2.30 GUI app (only its language
server, headless); Linux's 2.30 build (same language server code path,
same home-relative file); whether the agy CLI reads config.json (it has
its own ~/.gemini/antigravity-cli/settings.json row, untouched).
2026-11-10 14:23:48 +08:00
yetone 6287385f91 perf: Codex's bundled instructions and the WSL probe are built on first use
Two package-level values were built on every launch, `magpie
statusline` on each Claude Code message included, for paths it never
takes:
- codexcat's bundled: json.Unmarshal of the 231 KB
  codex_instructions.json into a map (~0.48 MB). Now sync.OnceValue,
  read the first time a model's instructions are looked up.
- agent's wslProbeScript: the WSL probe's shell script, grown with `s +=`
  over every WSL agent, so each step copied the whole string (~0.5 MB),
  on macOS and Linux too. Now sync.OnceValue, built the first time a
  distro is probed. Callers and tests call it.

Measured on mote, sandbox HOME, t44 (v0.1.3519) against t45 (this):
- GODEBUG=inittrace=1 sum: 3.94 MB -> 2.98 MB
- `magpie statusline`, 3 runs: instructions retired ~156M -> ~137M

Run: go vet ./internal/agent ./internal/codexcat (darwin, GOOS=linux,
GOOS=windows) ok; go test ./internal/codexcat ok, ./internal/agent ok
(290s); root go vet ./... after rebase below.
2026-11-10 13:11:19 +08:00
yetone e4197144a8 perf: every package's package-level regexps compile on first use
v0.1.3516 made gateway's and redact's patterns lazy. The other 299
package-level regexp.MustCompile calls, in 148 files across agent,
provider, gui, library, codexcat, sessions, usage, plugin and the rest,
now go through lazyre.New too, so a launch that never reaches them
(`magpie statusline`, run by Claude Code on every message) doesn't
compile them. Fields, maps and params that held them are *lazyre.RE.

Measured on mote (M5 Pro), sandbox HOME, v0.1.3516-equivalent build
(t42) against this one (t43):
- GODEBUG=inittrace=1 sum: 7.39 MB / 69,837 allocs -> 4.62 MB / 46,765
- `magpie statusline`, 3 runs each: instructions retired ~212M -> ~176M,
  peak memory footprint 19.2-19.4 MB -> 16.8-17.0 MB

Run: go vet ./... (darwin) ok; GOOS=windows go vet on each of the 30
changed packages ok; GOOS=linux go vet ok except ., internal/cli and
internal/gui, which stop in wails v3's cgo files when cross-compiled
(the same at main). New TestAllLazyPatternsCompile at the root compiles
all 574 registered patterns (ok), so a bad pattern fails a test rather
than a first use.
Not run before push: the changed packages' own test suites; they run
on mote after it.
2026-11-10 12:54:39 +08:00
yetone 60f0433d1b dsh: a model of its own for DeepSeek Harness's compaction (Musikrv77852 on X, #5395)
DSH compacts on the session's latest model (compaction-basic with no
summarizationModel). A session on magpie/workbuddy/deepseek-v4.1-flash
switched to another model compacted on WorkBuddy first, got 429, and the
switch failed.

DeepSeek Harness's opened row on the Agents page now has a "compaction
model" square (compact_model), offered once dsh is on magpie's route. It
is magpie's own Live setting (settings.DshCompactModel), so nothing is
written into dsh's profiles and no restart is needed. The gateway moves a
dsh compaction to it (dshCompactTo, Route.Moved why "dsh-compact") when
the model is enabled, served by its exact id and allowed to the key; else
the compaction stays as asked with a log line. The Routing page says why.

On magpie's llm-pi-ai routes DSH sends no x-deepseek-harness-compact mark,
so its compaction is now known by compaction-basic's own ask
(@deepseek-ai/dsh-compaction-basic 0.0.1-rc.3, the latest) in
compactAsks. As a result DSH compactions show as Compaction in Usage and
Routing, and a group's Compact rule reaches them too.

The options are spelt magpie/<id> like the model field's, so
`magpie dsh deepseek/flash` still sets the model (fieldForValue gives a
bare value to the first field offering it). CLI: `magpie dsh
compact_model magpie/deepseek/flash`; API: /api/set. zh, zh-TW, ja and
de strings added.

Run (mote): go test -count=1 -timeout 45m on internal/gateway,
provider: ok at the base before the rebase on 0842bc517; agent, gui,
settings, settingsapi, and the gateway's TestDsh/TestCompacting/
TestRuleCompact: ok at this head. The first agent run caught the square
reading dsh's profiles at a stopped WSL distro (TestWSLColdPlaceOpensNothing,
#3896); its options now look at nothing at a cold place. go vet on darwin,
GOOS=linux -tags nogui and GOOS=windows: clean. gofmt clean. GUI in
chromium and webkit: dsh-compact-model (new, 5 languages x 2 widths),
desktop-subagent-model, codex-subagent-model, routing-moved-why,
i18n-keys, i18n-en-no-cjk, claude-subagent-effort-row,
codex-start-model-field, model-test-why and agent-connect-no-models: 140
of 140 pass; after the rebase (i18n.js changed upstream) i18n-keys,
i18n-en-no-cjk, dsh-compact-model and routing-moved-why 48 of 48.

Broken by hand, each red: dropping the compactAsks line (TestCompacting,
TestDshCompactMoved on all three protocols), skipping the move in serve
(TestDshCompactMoved), dropping the agent check (TestDshCompactLeft's
other agent), taking the square out of extra() and dropping the routing
story's case (dsh-compact-model.test.cjs).

Not tried: a real DeepSeek Harness desktop app (none on this Mac or on
mote); the compaction text was checked against the npm package's source.
DS Bot's requests can't be told from dsh's, so its compactions follow
the same setting, though it has no square of its own.
2026-11-10 11:05:59 +08:00
yetone b922e51685 agents: nanobot gets magpie as a provider of its own (Niapyaya on X)
nanobot (HKUDS/nanobot, pip install nanobot-ai) is now an agent magpie
connects. Its config is read from its own source (5c72ced, 0.4.1):
~/.nanobot/config.json, camelCase or snake_case keys, any extra key under
providers an OpenAI-compatible endpoint whose name is stripped from the
model.

magpie adds providers.magpie (apiBase at the gateway's /v1, its key, and
extraHeaders User-Agent nanobot), and sets agents.defaults provider
magpie, model magpie/<id> and contextWindowTokens when the window is
known. What the user had there, both spellings, and a modelPreset that
would go over magpie's model, is stashed and put back on disconnect,
the window as a number. A file magpie made goes again. Also in WSL
distros, with a notice in every language, the icon (a tile in app.css's
rule), READMEs, site list, docs/reference.md and agent-wiring.md.

Run:
- real nanobot 0.4.1 on mote in a sandbox HOME (~/nbsb), a sandbox
  gateway on 47812 over a fake OpenAI upstream: `magpie nanobot
  magpie/fakeup/m1` wrote the config and kept the user's relay provider
  and channels; `nanobot agent -m ping` answered "pong from fake
  upstream"; the upstream saw POST /v1/chat/completions, model m1,
  UA nanobot; `magpie nanobot default` put relay/glm-4.6 back exactly.
- go test ./internal/agent ./internal/gui ok; ./internal/gateway and
  ./internal/cli -run 'Client|UA|Agent|Empryo' ok; go vet darwin,
  linux -tags nogui, windows ok; gofmt -l clean.
- GUI, chromium 110/110 and webkit 65/65: 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.

Broken by hand, each red in TestNanobot: modelPreset not stashed
(preset left over magpie's model), the made file not removed, and the
window restored as a string.

Not tried: a real vendor behind the gateway (fake upstream only),
nanobot's long-running `nanobot gateway`/WebUI picking the change up
live, and WSL.
2026-11-10 10:27:05 +08:00
yetone b75aff1073 library: billion-context for Zed through its /bili/ prefix (CoMi6818 on X)
billion-context's README lists Zed, but Library's billion-context tab
offered only Pi, omp, OpenCode and Claude Code. Zed has no plugin of
bili's. Upstream gives it two routes: `bili zed`, a Linux-only launcher
that leaves a provider on loopback direct (so it never passes magpie's
gateway), and, on every system, the /bili/ prefix its docs give any
client whose model address can be edited, with `bili start` answering
on 8787.

Zed is now a URL lane (biliURLLanes, internal/library/bili_url.go).
Switched on, magpie has bili start answer (one the user runs is used;
else magpie runs its own under KeepLinked's context, logged to
bili-start.log, and starts it again at magpie's start while Zed is on),
then agent.ZedThrough sets the magpie provider's api_url to
http://127.0.0.1:8787/bili/<gateway>/v1 and saves the key for that
address in the credential store, where Zed looks it up by address. A
pick and a sync keep the prefix while magpie answers through it
(zedReach, #1985's proxy recognition). Off puts api_url back on the
gateway and ends magpie's bili start when nothing goes through it.
Zed must be on magpie first; the error says to pick a magpie model.

Run:
- bili 0.1.213 on mote: bili start --port N, then
  /bili/http://127.0.0.1:<fake magpie>/v1 forwarded GET /, GET
  /v1/models and POST /v1/chat/completions with Authorization kept and
  bili's tools injected (repro/zedroute.sh).
- mote: go test -tags nogui ./internal/library ./internal/agent (full
  packages), go vet darwin, GOOS=linux -tags nogui, GOOS=windows.
- mote: library-bili, i18n-keys, i18n-en-no-cjk GUI tests (chromium
  and webkit).
- win-run: go test ./internal/agent ./internal/library -run
  'TestZed|TestBili'.
- gofmt -l clean.

Broken by hand: SetBili without the URL-lane dispatch, and zedReach
without the proxy keep: TestBiliZedThroughPrefix and TestZedThroughBili
go red; restored, green.

Not tried: a real Zed app through bili (no Zed on mote), and the real
keychain write (zedCredential stubbed in tests, as before). Other
clients upstream lists (Cline/Roo/Kilo, Continue, OpenHands, Void,
Cursor, Warp, launcher-only lanes) are not added here.
2026-11-10 09:59:22 +08:00
yetone 1b078d404b gui: a state poll encodes into buffers kept from the last one, and Codex's own models are read without a copy
Each /api/state poll json.Marshal'd the state without its agents twice
(to send it and for keepState's sum) into fresh slices, and made a new
32KB writer; ownCodex cloned Codex's whole model list for a caller that
only reads it. One set of buffers and the writer is now kept between
polls (an atomic slot, not a sync.Pool, which a GC between polls
empties; a poll that finds it taken makes its own, and buffers over
4MB are dropped), and ownCodex reads catalog.CodexShared.

Run on mote at this tree: go vet ./internal/gui ./internal/agent;
go test -run "State|Settings|Allow" ./internal/gui, the same -race for
StateWritten, -run "Codex|OwnCodex|Pick" ./internal/agent: ok.
TestStateWrittenAsEncoded now writes big after small and small after
big; with encodeTo's Reset taken out by hand it is red (a stale tail).
Real accounts, 40 polls of /api/state, alloc_space: 27.8 and 26.1 MB
before, 18.4 and 22.7 MB after.
Not tried: Windows and Linux runs (no OS-specific code).
2026-11-10 09:23:47 +08:00
yetone 079da3a785 perf: a state poll lists dsh profiles once, and skips work for Codex's models and gateway base
Each /api/state poll redid work for each agent row. That work is now done
once, or skipped:
- dsh's profile list is held for the request (dshProfilesHeld). dshModern,
  Joined and dshLead each globbed profiles/*/cordis.patch.yml again.
  Writers still call dshProfiles.
- CodexSignInGone reads the record first. With nothing on record for the
  home, the usual case, it no longer parses auth.json and hashes the
  refresh token on each look. A record that can't be read answers as
  before.
- Codex's effort field reads catalog.CodexShared(), which doesn't copy.
  With both lists, they are joined into one presized slice.
- codexViaMagpieFor builds one presized slice instead of two that grow
  and are then joined.
- onAnotherMachine answers a plain loopback base (localhost, 127.0.0.1,
  [::1], digits-only port, no user info) without url.Parse. Anything
  else still goes through url.Parse.

Measured on mote with the real-account sandbox, allocations over 40
/api/state polls, two alternating pairs:
- before (216ac6f85): 34.6 and 36.2 MB
- after: 26.8 and 23.7 MB

Run on mote:
- go vet on agent, provider and catalog.
- go test, all of internal/catalog.
- go test, internal/provider -run "Gone|SignIn|Codex".
- go test, internal/agent -run "OnAnother|Codex|Dsh|DSH|ZCode|Zcode|Loopback".
All ok.

New test: TestOnAnotherMachineQuickLookAgrees compares the quick look with
the url.Parse logic over 21 bases (user info, a port with letters,
uppercase, [::1], %2f) and requires 0 allocations for the gateway base.

Not tried: the full internal/agent suite (about 50 min).
2026-11-10 08:12:56 +08:00
yetone 216ac6f850 edit, agent: Grok Build's own model tables are read in one pass with nothing built, and its efforts read the shared list
What /api/state still allocated for Grok Build with real accounts, forty
polls on mote (t30):

- grokOwnOptions asked GetTOMLTable for each [model."<id>"] table of
  ~/.grok/config.toml: a stat and a fresh map a table on every look
  (4.6 MB). edit.EachTOMLTable walks the file's kept parse once and
  hands each ordinary table, in TOMLTables' order, with Scalar reading
  a key as GetTOMLTable's map has it (the last of a key written twice).
- the model field's efforts took magpieModels("grok"), a copy of the
  whole list per look, to read one entry (4.5 MB). It reads
  sharedModels; catalog.Efforts already returned a slice of the shared
  entry.

Measured on mote, sandbox HOME with the owner's real account data, 5
warm-up then 40 calls, paired runs:
  /api/state  t30 42.3 / 43.2 MB  ->  t31 33.2 / 38.1 MB  (-16%)
No GetTOMLTable, grokOwnOptions or magpieModels frame is left in t31's
top list.

Tests:
- TestEachTOMLTableAgreesWithGetTOMLTable: 200 model tables, an array
  table and a plain one; names match TOMLTables, every Scalar matches
  GetTOMLTable's map, a look allocates at most 5 times, a missing file
  has no tables and no error.

Run on mote at this tree: gofmt -l clean; go vet of edit and agent;
go test -count=1 of internal/edit and internal/agent (247s): ok.
Not run: the full ./... suite and the GUI suite; no JS changed.
2026-11-10 07:46:15 +08:00
yetone e364d27fce agent, provider, profile: a state poll builds no agents per profile, keys dsh entries without joining them, and works out renames once a change
What /api/state still allocated with real accounts, forty polls on mote
(t29, 76 and 83 MB):

- profile.Details built every agent again for each profile listed
  (7 MB). DetailsIn takes the agents the page already holds for its
  request; Details keeps its signature for other callers.
- dshNodeShared joined an entry's lines into a string to key its parsed
  node (5.7 MB). It now hashes the lines with maphash and checks them
  against its own copy, so a hit allocates nothing; a caller changing
  its slice in place still gets the new text.
- dsh's Joined check read and parsed the first profile's list each poll
  (5.2 MB). It uses dshLook, the parse shared until the file changes;
  dshOver only changes a copy of the items.
- provider.UsageRenames parsed the whole providers.json for each
  profile's in-use check (5.1 MB). It is worked out through filememo
  once per change; a file that doesn't decode goes through read's own
  last-good path as before.

Measured on mote, sandbox HOME with the owner's real account data, 5
warm-up then 40 calls, paired runs:
  /api/state  t29 82.9 / 76.0 MB  ->  t30 38.1 / 47.4 MB  (-46%)
  /api/drift  t29 7.3 / 5.5 MB    ->  t30 9.7 / 7.1 MB (512 kB sampling
              noise: no dsh or renames frame in either top list)

Tests:
- TestUsageRenamesParsedOnceAChange: 60 providers, a look at unchanged
  renames allocates at most 10 times, a rename since shows at once.
  Red on the old rename.go (424 allocations).
- TestDshLookParsesAnEntryOnce now asks dshNodeShared alone for 0
  allocations and checks a slice changed in place. Red on the old
  dsh.go (1 allocation).

Run on mote at this tree: gofmt -l clean; go vet of agent, provider,
profile, gui; go test -count=1 of internal/agent (390s), provider
(256s), profile, gui (174s) and usage: all ok.
Not run: the full ./... suite and the GUI (JS) suite; no JS changed.
2026-11-10 07:36:19 +08:00
yetone 5e1a6a20bd agent: Grok Build's model list keeps magpie's rows and reads models_cache.json once a change
Grok Build's model field cloned magpie's rows for every look to mark
the ones on its own account Same, appended them onto its own models,
and read and walked models_cache.json again each time. The marked list
is now kept as viaMagpieShared keeps its own (grokVia, under the same
stamp), joined with Grok's own models through joinedVia, and the
cache's shown models are read through filememo.

TestGrokFoldsItsOwnAccount now has a models_cache.json of 300 hidden
models beside a shown one, checks only the shown one is offered, and
that a look again within a request gives the list kept. Broken by hand
(grok.go as before): "a look again made the list again", red; green
restored. Run on mote: go vet ./internal/agent, go test -run TestGrok.
2026-11-10 07:18:50 +08:00