Commit Graph
980 Commits
Author SHA1 Message Date
yetone c2fd48782b Put back what 1f05c311d took out of main by mistake
1f05c311d was committed with its worktree's older tree on top of a
fresh origin/main (git reset --soft), so beside the memory fix it
undid every file 610ae1f54..c1312ac15 changed (45 files: key balance,
import links, project subagents, uninstall, site, LESSONS.md and
more). This commit restores each of them to c1312ac15 byte for byte;
the tree is now c1312ac15 plus the memory fix alone
(git diff --stat c1312ac15 HEAD: the 4 files of the fix).
2026-11-13 12:18:23 +08:00
yetone 1f05c311d9 library: an open memory holds still while the Memory tab polls (Nietzsche_Li on X)
"资源库-记忆中,被展开的记忆的表单会定时抖动". While search by meaning
still has memories to read (read < of, which can last up to a minute
between memembed.Keep's reads) or a learn-from-conversations run goes,
the Memory tab reads its row again every 2s, and each read drew the
whole page anew. The open editor was a new .lib-detail each time and
played its content-in entrance (opacity .5, 2px slide) every 2s.

- semWatch/distWatch draw nothing when the read changed nothing, and
  redraw only their own row (redrawRow) when it did; the whole tab only
  when the memories changed.
- render() marks a .lib-detail open before it (same data-detail) as kept,
  so it doesn't replay its entrance. This covers every render of an
  open editor in the Library: memories, instruction sets and agents'
  files (the siblings; no other Library tab polls into render()).
- A new memory's text no longer takes the focus back on every render.

Run (mote): library-memory-steady.test.cjs, all 5 languages, 980/420,
chromium + webkit: green 4 of 4 whole-file runs after the last change
(webkit alone 2 of 2 before it). Broken by hand: the same test against
origin/main's client.js and library.css: 22 of 22 red ("the editor
played its entrance again"). One webkit de 420 red was the test's own
first row click intercepted by the header at 420px while the page
settled; the test now opens rows with a DOM click.
Also run, both engines, every language, 980/420: library-memory, library-memory-select, library-memory-suggest, memory-icon, library-instr-busy, library-instr-sets, library-linked-set, library-follow-server: all green. No Go code changed, so no go test or vet.
Not tried: the real app on a real memory store mid-read.
2026-11-13 12:17:43 +08:00
yetone 6a506e2834 agent: pi-magpie's source pattern compiles on first use (TestNoEagerPackageRegexps)
d52e2feaf added piMagpieExt as a package-level regexp.MustCompile, so
TestNoEagerPackageRegexps in the root package was red on main
("internal/agent/pimagpie.go:13:19: a package-level regexp is compiled
at launch; use lazyre.New"). It is lazyre.New now, as the rest of
internal/agent's patterns are.

Run on mica: go test -run TestNoEagerPackageRegexps . ok (red before,
in the full suite at 70f4593e6); go test -run Pi ./internal/agent ok;
go vet ./internal/agent ok; gofmt clean.
2026-11-13 12:10:08 +08:00
yetone 861a0442c1 agent: Codex in a running WSL distro is connected once Codex on Windows is (@not_4O4 on X)
The Codex app's work mode on a project whose run environment is WSL starts
its app-server inside the distro, on the distro's ~/.codex (the app resolves
CODEX_HOME there with `bash -lc 'printf %s "${CODEX_HOME:-$HOME/.codex}"'`).
magpie wired Codex on Windows and, as a separate Agents row, the distro's
twin (codex@wsl:<distro>) only when the user connected that too, so the
picker listed OpenAI's models alone there.

ConnectCodexTwins, run at the start of each SyncCatalog, connects the twin
of each running distro once while Windows' Codex is connected. It leaves a
twin alone that is connected or disconnected already, whose config names a
provider or base URL of the user's own, or whose distro is stopped (asking
one starts it). A stash mark (<id>.autoconnected) keeps it to once, so a
later Disconnect stands. docs/subsystems/agent-wiring.md says so.

Run: TestConnectCodexTwins and TestConnectCodexTwinsKeepsOwnProvider; go
test ./internal/agent on mote (ok, 305s); TestWSL* and the new tests on the
Windows box (ok); gofmt; go vet darwin, linux and windows (nogui).
Broken by hand: Windows-connected check removed (red), own-provider check
removed (red). The Disconnected check is covered by the mark alone.
Not tried: the Codex app itself with a WSL project (read its bundle for the
CODEX_HOME resolution only); the reporter's distro and networking.
2026-11-13 11:01:27 +08:00
yetone d52e2feaff pi: with the pi-magpie extension installed, magpie's models.json block goes (KenyonCode on X)
pi-magpie (npm, tinysnake) serves provider "magpie" from the live catalog
and warns at every start while models.json still names providers.magpie
(one baseUrl for every model, a frozen list). magpie wrote that block
itself, so the user was told to delete it by hand.

When Pi's settings.json "packages" lists pi-magpie, Pi's Sync and model
pick now drop magpie's own block (only one pointing at this gateway with
magpie's key; a block the user wrote stays) after keeping
models.json.before-pi-magpie, through the atomic JSON delete, the rest of
the file untouched. Check no longer calls the missing block a broken
wiring. Without the extension nothing changes.

Run: TestPiMagpieExtensionTakesOverTheBlock (sandbox HOME) and ./internal/agent
on mote, vet darwin/linux nogui/windows. Broken by hand: viaExt forced false
-> the test goes red with the block still there.
Not tried: a real Pi with the extension installed.
2026-11-13 10:37:44 +08:00
yetone 2abfe2b644 codex: the editor extension's bundled Codex version is read, so the threshold is written (HermanHongbb on X)
The background-compaction table is written only when every Codex that
reads the config is known to be new enough. The openai.chatgpt extension's
reader was always made with no version, so any machine with the extension
installed counted as "unknown" and the table, with the threshold, was
held out: Codex compacted at its own 65%.

The extension ships bin/<target>/codex-package.json beside its codex
(checked in the real Open VSX packages of chatgpt 26.51111.21308, Linux
x64 and Windows x64: "version": "0.169.0-alpha.11.1"). It is read now, one
reader per installed copy, in every dot folder's extensions (VS Code,
VS Code Server, Cursor, Windsurf, VSCodium, ...); copies in .obsolete are
skipped. A version that can't be read stays unknown, not old. Settings'
existing note (codexAsyncHeld) names the editor extension and its version
when it is what holds the threshold back.

Run: TestExtensionCodexVersionRead (new; red with the version read turned
off by hand: got map[:4]), go vet darwin/linux/windows, gofmt, and go test
./internal/agent on mote, ok.
Not tried: a live VS Code with the extension; the full suite before the tag.
The macOS extension layout is the same package (darwin vsix not unpacked).
2026-11-13 10:29:39 +08:00
yetone ac15036ab4 provider: a catalog entry points at its provider instead of copying it
Entry.Provider was a Provider value, 1,328 of an Entry's 1,760 bytes,
copied into every model of every provider each time a catalog, an
agent's list or a routing group's entries were built. It is now a
*Provider: entriesOf and decide's list give every model of one provider
the same one (sharedEntry), and a group's entry points at its first
member's. It is read only; every place that hands it on as a value
(Resolve, CanFast, ownAgent, modelAllowed, …) dereferences it, so what
they get is a copy as before. entryFor keeps its signature for the one
model ServedEntryOf builds; offEntries' entries now carry their provider
too.

Measured on mote with the owner's real accounts (acctp sandbox, page
open for 2m32s, w40 = before, w41 = this, alternating):
- catalogOf's allocations 106 MB -> 67 MB, providerEntries' 88 -> 78 MB
- CPU at the page's settle mark 3.42/3.33 s -> 3.18/3.30 s
- live heap unchanged (76.3/76.1 -> 76.7/75.9 MB): the lists are
  rebuilt, not kept, so the copies were churn for the GC, not held

Run: go build and go vet ./... and the tests compiled (go test -run ^$)
on mote; the full suite at this tree (d1e823d5f) on mica: 99 packages ok, 0 FAIL (agent 317s, gateway 972s, gui 188s, provider 220s, usage 56s).
2026-11-13 05:12:30 +08:00
yetone 3d4c8edcea gui: Open the Codex app is in Codex's row menu, not a button on its row
ee1553913 (Yink88564391 on X) put an Open button on Codex's Agents row,
between its Details and its model picker, so that row's Details sat
further left than every other row's (the owner, 11-13: "导致整个页面在
视觉上不是对齐的"). The button is gone. Codex's row menu, beside Open in
terminal, has "Open the Codex app" where the desktop app is installed
and Open Codex with doesn't say Terminal (openApp); it posts agents/open
with the id alone as the button did. With no app, Open in terminal is
the menu's only way, as before the button. The tray panel and the web
build have neither. Its CSS and the "Open Codex in a terminal" words go;
comments and the setting's error say "Open Codex with", not the button.

codex-open-button.test.cjs now opens the menu, and checks every
connected row's Details and model picker start at one x.

Run (mica): GUI codex-open-button 62/62, agent-open-terminal 24/24,
agent-prefs 56/56, i18n-keys, i18n-en-no-cjk, chromium and webkit,
en/zh/zh-TW/ja/de, 900 and 400px; go vet internal/gui, settings,
provider; go test internal/gui, settings, provider, agent -run
"Codex|Budget|Settings" ok; gofmt clean.
Broken by hand: the button put back on the row turns the line-up check
red (codex 479 vs claude 532 at 900px, every language).
Again at 5c1c38f63 after the rebase onto dbaf9d68c (mica): codex-open-button 62/62,
i18n-keys, go test internal/gui -run "Budget|Codex" ok.
Not tried: a real Codex app open from the menu; Windows and Linux.
2026-11-13 04:22:45 +08:00
yetone 32d6be0d05 gui: Memory has a brain of its own, in the sidebar and on its requests
The owner (11-12): Memory should have its own icon, a brain. The
Library's Memory tab had a bookmark, and Memory's own requests (the
conversations it reads into memories, made as memdistill.Agent
"memory") were drawn in Routing's graph, Usage and Sessions with the
generic cube under their raw id, since "memory" was no client.

- icons/memory.svg: a brain, 16-grid, stroke 1.4 with round caps and
  joins, as the sidebar's marks are; drawn as a one-tone mask.
- navicons.js: the Library's Memory tab draws the same path.
- agent.others: a client "memory", named Memory, with that icon, so
  /api/state's clients and agent.Looks (Usage, Sessions) name and draw
  it. It has no User-Agent: its requests are known by their token.
- TestEveryClientHasNameAndIcon: memdistill.Agent is among the ids the
  gateway records, so it must be a client with a real icon.
- tests/memory-icon.test.cjs: the sidebar's Memory tab draws the path
  icons/memory.svg has (and no other tab does), and a request from
  "memory" in Routing is drawn with the memory mask, not the cube.
  Chromium and WebKit, en/zh/zh-TW/ja/de, 1100 and 420px (no sidebar at
  420px, so there the request only).

Run on the tree rebased onto ff8b43711 (same five-file diff; the go packages and the four GUI files first ran at fa7e466ac and again here: TestEveryClientHasNameAndIcon ok, 42 of 42) (mote; mote was at load ~27 and mica ~43, mote was the less loaded):
- go test ./internal/agent ./internal/gui ./internal/memdistill
  ./internal/usageapi: ok.
- node --test memory-icon nav-sub-icons routing-client-icons i18n-keys:
  42 of 42 ok, both engines.
- go vet: darwin agent+gui; GOOS=linux agent (gui needs cgo for wails
  on linux); GOOS=windows agent+gui: ok. gofmt -l clean.

Broken by hand (origin/main fa7e466ac with the new tests):
- TestEveryClientHasNameAndIcon: "the gateway records requests as
  memory, which isn't among the clients".
- memory-icon.test.cjs with no icons/memory.svg: 2 of 2 red; with the
  svg but the old bookmark path: 12 of 22 red, every 1100px case.

Not tried: the real app on any OS; Codex's own memories model row
(MEMORIES in app.js) keeps its notebook, as it is Codex's memories, not
Magpie Memory. The Magpie Memory MCP server keeps magpie's favicon, as
magpie's other servers do.
2026-11-13 04:08:39 +08:00
yetone 6acf5ee5c3 providers: StepFun's logo is the current mark, five squares in a circle (zzstar101 on X)
magpie drew StepFun's old stepped-S in blue. StepFun's own sources show
the new mark: stepfun.com's favicon (step_favicon.svg), the Hugging Face
org avatar of stepfun-ai (the step-5-preview card), and lobe-icons'
`stepfun` (mono). lobe's `stepfun-color` is still the old mark, so there is
no colour one to take; the mark is one tone, so it is stored as the mono
icons are (icons/stepfun.svg, currentColor, drawn as a mask that follows
light and dark). The presets (StepFun, StepFun China), the "step" model-maker
rule (IconForCatalog's table) and Step Code use "stepfun". A provider saved
with "stepfun-color" keeps working: that file now holds the same new mark
in black, which the one-tone check draws as a mask too.

Run (mote): go test of internal/provider and internal/agent ok; go test
-tags nogui ./internal/gui ok; GUI files stepfun-per-provider, icon-one-tone,
mono-icon-redraw, models-add-and-icons, icon-tile, nav-sub-icons ok in
chromium and webkit; a screenshot of the Providers list in chromium and
webkit, light and dark, shows the new mark for both icon names.
usage-cards-hide's "de 560" sideways scroll is red in chromium and
webkit, and the same on origin/main aa744b9ed without this change
(#6294). Broken by hand: the old mark in stepfun.svg makes
TestStepFunLogoIsTheCurrentMark red.
Not tried: the Linux WebKitGTK window; the full suite before the tag.
2026-11-13 00:11:37 +08:00
yetone ee1553913d gui: Codex's Agents row has an Open button, for the app or the terminal by a setting (Yink88564391 on X)
The Codex row on the Agents page now has an Open button beside the start
button. It opens the Codex desktop app (mac and Windows) when it is
installed, else Codex's CLI in a terminal. "Open Codex with" in Codex's
details (Automatic, Codex app, Terminal) picks which; it is this computer's
own setting (settings.CodexOpen, kept across a sync and a Settings save).
The row menu's Open in terminal still opens the terminal. The web build has
no button.

Run (mica): go test internal/gui, agent, settings, settingsapi, provider
ok; gofmt clean; GOOS=windows vet and GOOS=linux -tags nogui vet clean;
GUI codex-open-button (62), agent-open-terminal (24), i18n-keys,
codex-service-tier in chromium and webkit, en/zh/zh-TW/ja/de, narrow.
agent-prefs lists the new row.
Broken by hand: codexOpensApp always false turns TestCodexOpenButton red.
Budget: coreScriptBudget +1,112 for this code, packed small, no page to
move it to.
Reds on main before this change, same count at e18aca103 without it:
agent-details-ready (16 chromium), gui-ja and gui-de (one string),
agent-prefs panel-sheet test (5 chromium), and from 4e0026661
plugin-signed-out-account, plugin-signin-no-url, saved-signedout-remove,
signin-proxy. Not caused here; not fixed here.
Not tried: a real Windows launch of the Codex app, a real macOS app open,
Linux.
2026-11-13 00:11:20 +08:00
yetone e18aca1038 agents: an agent's own context window, and a routing group's own Compact at (ul3140773077392, NovaStudiosss on X)
ul3140773077392 on X: dsh compacts earlier than other harnesses at the same
window, so one global size per model fits none. An agent's sheet (Agents,
the agent's Settings line) now holds "Context window": a size for every
model, or model=size pairs (provider/model, group/<id>, provider/*, a bare
model id, *). Empty follows each model's own window. It is applied in
provider.CatalogFor, the choke point every agent's model list goes through,
so dsh's contextWindow, Codex's catalog and Claude Code's window all read
it, and a window set this way makes Codex/Claude compact at that window
(Entry.WindowSet). Stored in settings.AgentContexts, kept by a general
save (settingsapi); POST /api/settings/agent-contexts and
`magpie model window <agent> [model=size...|off]`.

NovaStudiosss on X: Routing, a group's Edit, Advanced already had "Context"
(the window agents are told). It now has "Compact at" beside it
(Group.Compact; compactSet reads it before the members' smallest), also
`magpie group ... compact=`.

GUI: agentwindow.js, loaded on demand through agentcompact.js so app.js
stays inside its budget (TestCoreScriptBudget passes; the "Context window
in {agent}" label reuses the existing "Context window" key). Every agent
with fields now has a sheet; agent-prefs' Pi expectation says so.

Run at the pushed head, on mote: go vet (darwin; linux -tags nogui;
windows) on provider, agent, cli, gui, settings, settingsapi; gofmt clean;
go test provider, cli, settings, settingsapi, gui (TestCoreScriptBudget
and cli's route table fixed here), agent -run Dsh; node --test agent-window
and group-compact (chromium and webkit, en zh zh-TW ja de, 900 and 420px),
agent-compact, agent-prefs, compact-at. Reds seen identically on a
detached origin/main 4e0026661: agent-prefs webkit "in the panel a
Settings line..." (#6139) and old-webkit "compat.js is the first" / "styles
hold up in Safari 15.0" (#5919, #3403).

Broken by hand, each red then restored: withAgentWindows out of CatalogFor
(TestAgentOwnContextWindow, TestDshOwnContextWindow); the group branch in
compactSet (TestGroupOwnCompactAt); the settingsapi keep line
(TestSettingsSaveKeepsWhatItDoesNotSend); the window row in the sheet
(agent-window tests); compact dropped from the group save
(group-compact tests).

Not tried: a real dsh with a real account (its compaction is dsh's own;
the test reads the window magpie hands it), the full GUI suite (queued
behind another run on mote), Windows and Linux runs of the new tests.
2026-11-12 23:01:29 +08:00
yetone 7dbfc9f2fe usage: FlowDown and Bob are clients drawn with their own app icons (shannnnnks on X)
Their requests were unnamed in Usage and Routing. FlowDown (wiki.qaq.flow)
sets no User-Agent in its sources (checked Lakr233/FlowDown), so the system's
"FlowDown/<build> CFNetwork/..." is what arrives; Bob (com.hezongyidev.Bob) is
closed source and is matched the same way, by "bob/". Icons are the apps' own
App Store icons at 64px, as color SVGs wrapping the PNG, so app.js's size
budget is untouched.

Run: TestFlowDownAndBobAreClients (agent), see push notes for the rest.
Not tried: real traffic from Bob (its UA is the CFNetwork default for its
executable name, not captured); FlowDown/Bob are not wired as agents, since
neither reads a config file magpie can write.
2026-11-12 22:24:45 +08:00
yetone c96f33d659 agent: Hermes is one entry in the Agents list and the model pickers; its profiles are not rows (geekbb on X)
7050da0a4 (Norethcy on X) made each other Hermes profile an agent
hermes#<name> so the Library could give it its own skills and MCP servers,
and that also put one row per bot, each with its own model pick, in the
Agents list. geekbb: Hermes should have one entry; the bots Hermes made are
Hermes's to manage.

The profile agents stay, as the Library's targets (Norethcy's request keeps
working), but are now marked Agent.Nested: DetectedIn (the Agents list, the
tray panel and every picker built from it) and ClientsIn leave them out.
All and Find still reach hermes#<name> by id.

Existing settings: a model a user set on a profile lives in that profile's
config.yaml and is not touched, so it keeps applying; a profile on magpie
still follows the connected config's model unless it was picked, and a
picked one stays picked (hermes:<path>:picked). Nothing is dropped or
rewritten; what goes is only the extra row and its picker.

Run on mote: go test ./internal/agent ./internal/library; new
TestHermesProfilesAreNotListedAsAgents, red with Nested off and green with it;
GUI hermes-profile-row (rewritten: one Hermes row, no "Hermes ·" text),
hermes-profiles, i18n-keys in chromium and webkit, five languages; gofmt;
go vet darwin, linux, windows for agent and library.
Not tried: a real Hermes with several bots; the full suite before the tag.
2026-11-12 22:23:54 +08:00
yetone a687f6b040 agent: a Hermes profile named in Chinese reads as its name, not u64cd-u4f5c (geekbb on X)
Hermes makes a profile's id from a non-ASCII name with slugifyProfileName
(apps/desktop hermes-bots/labels.ts): each non-ASCII letter becomes
-u<hex>-, so 个人数据管理 is u4e2a-u4eba-u6570-u636e-u7ba1-u7406. The
Agents list drew that id: "Hermes · u81ea-u52a8-u5316-u673a-u5668-u4eba".

A Hermes profile row (hermes#<id>, and the profile:<id> model field of the
connected Hermes) now reads the name Hermes keeps in the profile's
profile.yaml (ui_meta.hermes-bots.title, then display_name, the order its
Bots roster uses), else the id with those runs decoded: excel--u64cd-u4f5c-u5458
is excel操作员, test-u673a-u5668-u4eba is test机器人. A token below U+0080 or
not a letter or digit is left as written. The id (agent id, folder, `hermes -p`)
is unchanged; the row keeps its "Hermes · " prefix and layout. Every place
the name shows (GUI rows and subtitles, TUI, usage/sessions) takes Agent.Name,
so one change covers them.

Run: TestHermesProfileRowsReadAsNames with the reporter's six ids (red on the
old code: names stay the raw ids, broken by hand); go test ./internal/agent
./internal/library ./internal/usageapi ./internal/tui; vet darwin, linux nogui,
windows.
Not tried: a profile created in the real Hermes app (its source was read, not
run). A hand-named ASCII profile like "uface" (u + 4 hex) would also decode.
2026-11-12 20:47:42 +08:00
yetone 5a13482682 agent: dsh's settings section is compared as a tree, not as two Marshals
dshSettingsRoute marshalled the pi section before and after putting
magpie's routes in, to tell whether anything changed. On a real
account's sandbox (mote, ~/r2278) that was 12.75 MB of the first 45 s's
allocations, every start. The section is now copied, and the copy and
the edited tree compared field by field (yamlSame: every field Marshal
reads, not line and column). Only when the trees differ are both
marshalled, so a tag spelled out on one side still reads as no change.

Run:
- real-account sandbox, alloc profile at 45 s: w28 yaml.Marshal from
  dshSettingsRoute 12.75 MB, w30 none; total 547 -> 503 MB.
  settings.yaml's mtime unchanged (Nov 10) after the w30 start.
- mica: go test ./internal/agent ok (333s), go vet, GOOS=linux and
  windows vet; new TestYamlSameReadsWhatMarshalWrites.

Not tried: a settings.yaml whose section magpie does change, beyond
the existing dsh tests.
2026-11-12 20:46:57 +08:00
yetone 17345f684f agent: Spotlight is asked once for every desktop app, and a stale answer never waits
After the Sessions caches dropped (five idle minutes), the next
/api/sessions/stats on `magpie web` took 2.3–4.1s on the real account
on mote while its handler ran ~220ms of CPU. Two goroutine dumps taken
1.2s and 1.8s into the ask both sat in ownSessionsOff → agentsHere →
agent.Detected → HasApp → desktopApp.version → spotlightBundles: one
mdfind per bundle id (13 of them, ~50ms each idle, far more under
load), serial under one lock, asked again whenever the 5-minute answer
expired. Every other agent.Detected caller (Providers, quit ask, gateway
pause, Sessions) paid the same.

- spotlightBundles asks one `mdfind -attr kMDItemCFBundleIdentifier`
  for every id desktopApps names, and keeps the answer by id. Past
  spotlightFresh a caller gets the kept answer at once while one
  goroutine asks again; only the first ask after start waits, once for
  every caller. A failed mdfind keeps the answer before it.
- agentsHere stops at the first detected agent instead of checking all.

Measured with the real account's data on mote, the Sessions stats ask
at 370s, after the drops (`magpie web`, sandbox HOME):
  main (w27)  2.3–4.1s in three runs earlier today; 1.34s in this run,
              while mote's load fell from ~180 to ~10
  this (w28)  0.77s at load ~170, then 0.046s
The rest of the 0.77s is the stats themselves being read again.
Tests: TestSpotlightParse; TestSpotlightOneAskStaleNeverWaits (10 reads
are one ask; a stale read returns while the refresh is held; two stale
reads are one refresh). On mica: go vet ./internal/agent ./internal/gui,
go test -count=1 -timeout 45m ./internal/agent ./internal/gui ok
(280s, 186s).
Not tried: Spotlight off on the Mac (mdfind fails; the answer is none,
as before); Intel Mac.
2026-11-12 19:36:52 +08:00
Flandern1211 5e933e153a agent: ZCode gets a Restart when magpie's models change while it runs (Flandern1211 on X, #5662)
ZCode reads its providers at start. Its Agents row now offers Restart for a
model list magpie changed while the app runs, as Claude Desktop's, WorkBuddy's
and OpenMausBot's do: restartApps has ZCode.app (dev.zcode.app) and
ZCode.exe, appReads covers config.json and provider_config.json, and
zcodePart hashes only magpie's provider, provider rule and model rules,
without the key or another provider's rules.

Patch by Flandern1211 (fork branch fix/zcode-restart-5662, 7b663fea9), read
line by line: three files in internal/agent, no network, credential, dependency
or .github change. Kept as written; this commit only adds the Restart line to
docs/subsystems/agent-wiring.md.

Run (mote, at this tree on origin/main 5a3d73039):
- TestZCodeRestartOnWindows red with the zcode restartApps entry renamed away
  by hand ("behind: <nil>"), green with it.
- go vet darwin, darwin nogui, linux nogui, windows on internal/agent: ok.
- GUI agent-app-restart, restart-app, agent-notice-lang, agents-last-known in
  chromium and webkit: 100 of 100 pass.
- internal/agent package: started, result follows in the tag's suite record.
- gofmt -l: clean.

Not tried: a real ZCode on macOS. dev.zcode.app is the patch's bundle id and
could not be checked here (no ZCode.app on the Macs); a wrong id leaves the
Mac row without a Restart, as before, and does not close anything. Real
Windows ZCode.exe was reproduced by the author on 3.17.2, not by me.

Co-authored-by: Flandern1211 <163982805+Flandern1211@users.noreply.github.com>
2026-11-12 18:59:53 +08:00
yetone 900d1673d3 claude-desktop: a model listed by its 1M id runs to 1M, not the 272K working window (henglu486729 on X)
With Only each model's largest window (DesktopLongest) a 1M model is listed
by its "[1m]" id, but Full window off still gave it the working window as
its autoCompactWindow, so Desktop's Code tab compacted and showed it at
272K. desktopPlan's work() now leaves such a model at its whole window.
A threshold typed in magpie (CompactAt, per model or provider), the user's
own autoCompactWindow and a typed window still win. Listing and
inferenceModels already carried the 1M (supports1m/prefer1m, max_input_tokens).

Run (mote): TestClaudeDesktop* in internal/agent and Desktop|Claude in
internal/gateway ok; go vet darwin, GOOS=windows, linux nogui ok; gofmt
clean. New TestClaudeDesktopLongestRunsTo1M red on the old claude.go
(glm entry ""), green after. Not tried: the Windows Desktop 5.1231.2 app
itself (only 2.7032's bundle read); full suite is run after the tag.
2026-11-12 18:53:30 +08:00
yetone e0b67f342b gui: times follow the system's 12 or 24 hour clock (iXerol on X)
An en-US Mac set to 24-Hour Time showed Routing's request times in 12
hours: no webview hands the page the system's clock, and navigator.language
carries only the region. boot.js now says it as hourCycle ("h23" or "h12",
left out when the system names none, and for a browser tab, which keeps its
own): macOS from AppleICUForce24HourTime / AppleICUForce12HourTime, Windows
from Control Panel\International sTimeFormat, Linux from gsettings
clock-format. intlLang() adds -u-hc-<cycle> to its tag, so every formatter
that takes it follows, and the places that forced 24 hours (hour12: false,
hourCycle h23) spread hourClock() instead: 24 unless the system says 12.
Read once per 30s, so a change in System Settings shows at the next load.

Run on mote: new hc-clock.test.cjs (en-US on a 24h system, en-GB on a 12h
one, a silent system), chromium and webkit; Go tests for the three readers
and boot.js; gofmt; go vet darwin, windows and linux nogui; internal/gui
tests; GUI files of gui-*, i18n-*, panel-*, quota-*, reset-*, routing-*,
usage-* in chromium and webkit. TestCoreScriptBudget was over by 77 bytes
and passes with two app.js comments cut, no raise.
Broken by hand: hc-clock is red without the intlLang suffix.
Not tried: a real Windows or Linux session's setting (the readers are
unit-tested on their formats), a live Mac.
2026-11-12 17:29:52 +08:00
yetone c1a91b5a52 agents: Mistral Vibe is an agent, and a Library target (alterxyz4 on X)
Vibe (mistralai/mistral-vibe, the `vibe` CLI) keeps its settings in
config.toml in $VIBE_HOME, else ~/.vibe. magpie now connects it: a
[[providers]] entry named magpie (the gateway's /v1, api_style openai,
backend generic), one [[models]] entry per catalog model aliased
magpie/<provider>/<model>, and active_model set to the alias, with the
previous value stashed and put back on Disconnect. Vibe reads keys only from
the environment, the keyring or ~/.vibe/.env, so the key naming Vibe goes in
the provider's extra_headers as an Authorization header; nothing is put in
the user's environment. Avibe's `vibe` command is turned away by binNot.

Library (#5595): instructions are $VIBE_HOME/AGENTS.md and skills
$VIBE_HOME/skills (vibe/core/system_prompt.py,
vibe/core/config/harness_files/_paths.py, read at 3.1.2). VIBE_HOME is in
appdir's usable list and agentenv. README (en, zh), docs/reference.md and
docs/subsystems/agent-wiring.md list it; the restart notice is in zh, zh-TW,
ja, de.

Run (mica, sandbox HOME):
- go test -count=1 ./internal/agent ./internal/library ./internal/appdir
  ./internal/agentenv ./internal/gateway ./internal/gui: ok.
- gofmt -l clean; go vet darwin, linux -tags nogui, windows on the touched
  packages: clean.
- Real vibe 3.1.2 (uv tool install mistral-vibe) with the file shape magpie
  writes, against a fake OpenAI upstream: the alias with slashes resolves as
  active_model, the request goes to /v1/chat/completions with model kimi/k2,
  Authorization: Bearer <key> from extra_headers and user-agent
  Mistral-Vibe/3.1.2.
- GUI: agent-notice-lang, i18n-keys, i18n-en-no-cjk, gui-zh-tw pass.
- Broken by hand: vibeMine returning false fails TestVibe,
  TestVibeOwnModelTakesMagpieOut and TestVibeSyncKeepsTheirs.

Not tried: the file written by the built magpie binary itself (the unit tests
write it through the same code), Windows runs of the new tests, a Vibe
signed in to Mistral with its own models alongside. gui-de and gui-ja
"every zh string" were red on the base for the "{agent} isn't installed
here" string, not for this change.
2026-11-12 17:07:23 +08:00
yetone 1b884225ad gateway: agy's own /effort or --effort level beats the Agents row's pick (haohaolee on X)
Antigravity CLI on a Google model through an API provider: the row's
effort field was there and applied (TestAgyAgentEffort), but agy's own
/effort (works on the Google names agy knows, which the gateway serves
by bare name) and --effort low|medium|high (any model) send a
thinkingLevel that the row's pick then rewrote, so the session's choice
seemed to do nothing. A request naming a level is now left as asked
(agyLevelAsked); a request with thinkingBudget -1 still gets the row's.
"/effort" stays "not adjustable" for "magpie/..." model keys: agy 1.5.5
and 1.5.6 have no settings or ModelInfo key that enables it (tried
thinkingLevel, thinkingBudget, displayName, vertexModelId).

Run: TestAgyAgentEffort, TestWithGeminiEffort on mote; the new case is red
(sent "low" for an asked HIGH) with the condition removed by hand and green
with it. Real agy 1.5.5/1.5.6 against a fake Gemini upstream in a sandbox
HOME showed the levels reaching the gateway. Not tried: a real Gemini API
key, agy against the real gateway end to end.
2026-11-12 16:34:34 +08:00
yetone b4b82e5857 agents: Codex's profile list drops a deleted provider's models (JNDliuliuM on X)
Codex wired by its profile alone (codex -p magpie) kept offering the models
of a provider that was deleted. The profile's model was one of that
provider's, so it no longer resolved as a magpie model, wired() was false,
and the profile's Sync returned before it wrote magpie-models.json again.
The old list stayed, new providers' models never reached it. The Sync now
writes the list again whenever the profile names magpie as provider and its
list, even when the model it was set to is gone. All-of-Codex scope already
did this (asProvider and ownCatalog), as did the models_cache.json staling.

Found by syncing a sandbox HOME in both scopes after a provider edit and a
provider delete: only profile scope plus delete left the old list.
TestCodexProfileListDropsADeletedProvider is red on the old code (listed
added/m2 and added/m3 after the delete) and green now.

Run on mote: internal/agent package, go vet darwin, linux nogui, windows.
Not tried: a real Codex CLI reading the list; the viaBase models_cache.json
path (covered by existing tests, not changed).
2026-11-12 14:14:36 +08:00
yetone 52b516da6d agents: a model of no known window is told the default under the longest context too (ul3140773077392 on X, #6259)
settings.ContextCap held every window magpie knew, but fourteen agents
write a default of their own (128000 or 200000) for a model whose window
magpie doesn't know, and that default went out past the cap: Crush, ZCode,
VS Code and its forks (Copilot, Zoo Code, Air), Copilot for JetBrains, Zed,
jcode, Pencil, AtomCode, Kimi, OpenClaw, Snow, WorkBuddy and CodeBuddy.
unknownWindow holds each default to the cap. AtomCode's output clamp used
the constant and now uses the window it is told.

BaoCode (a Claude Code front end) keeps its own context per model and
reads no window from magpie; Claude Code gets the cap through
CLAUDE_CODE_MAX_CONTEXT_TOKENS, which it does follow. Not changed.

Guard: TestEveryAgentFollowsContextCap connects every agent that can be
here to a provider with a 987654 model and a model of no window, under a
cap of 99999, and fails on any agent file holding either window or a
default. Red on the old code in 14 agents' files (checked on mote), green
after.

Run on mote: go test ./internal/agent ./internal/provider ok; go vet
darwin, GOOS=windows, GOOS=linux -tags nogui ok; gofmt clean.
Not tried: a live BaoCode, the full suite (started after the tag), GUI.
2026-11-12 11:53:33 +08:00
yetone 138d806f7a codex: "applies to" waits while Codex is routed through magpie by the base URL too (kakzyanaba on X)
80dcd3472's "applies to" field (All of Codex / codex -p magpie only) was
refused only while Codex was Wired(). Codex routed through magpie by
openai_base_url alone (beside its ChatGPT sign-in, or for failover) reads as
not wired, yet magpie keeps config.toml and its list there. Moving the choice
to the profile then made codexIn read magpie.config.toml (nothing in it): the
row showed disconnected, config.toml's wiring stayed behind unmanaged, and
Codex went on with its own default list, magpie's models gone from the picker.

The choice now also waits while Codex is Routed() or FailingOver(). Someone
already switched stays switched: disconnect, then choose All of Codex.

Run (mote): go test ./internal/agent ./internal/gui ok; gofmt clean; go vet
darwin, linux nogui, windows ok. TestCodexScopeWaitsForBaseURLRouteToo is red
with the guard back to Wired() alone (scope changed while Codex is routed),
green with it.
Not tried: a real Codex app, the GUI row in a live window; I could not
confirm the reporter's exact state, only that this path produces it. A cache
poisoned by a timed-out refresh (#6142) is a separate cause and not changed.
2026-11-12 11:46:06 +08:00
yetone 80dcd34729 codex: connect Codex through codex -p magpie alone (hpnjstar on X)
The Codex agent gets an "applies to" field: All of Codex (as before) or
"codex -p magpie only". In the second mode magpie writes
<CODEX_HOME>/magpie.config.toml (model_provider, model, effort,
model_catalog_json, its own [model_providers.magpie]) and a catalog beside
it, and never touches config.toml: its top-level model_provider, model and
openai_base_url stay the user's. Disconnect deletes that file and magpie's
catalog (kept if the user added to it). Plain `codex` keeps its own provider.

Codex 0.165 reads `--profile NAME` from NAME.config.toml and refuses -p while
config.toml holds a legacy [profiles.NAME] or profile = "NAME", so this is
the file form, not a [profiles.magpie] table. Codex without profile files
(older than the May 2026 removal of legacy profiles) isn't served in this
mode. The choice changes only while Codex is disconnected, so the two wirings
never share a config. Only magpie's models are offered in this mode; no
joining, failover or subagent fields.

Run (mote, at the rebased head): go test ./internal/agent ./internal/gui ok;
gofmt clean; go vet darwin, linux nogui, windows ok; GUI i18n-keys,
i18n-en-no-cjk, gui-zh-tw, codex-signin-always, agent-connect,
agent-disconnect in Chromium and WebKit. Real codex 0.165.0 in a sandbox
CODEX_HOME against a fake server: `codex -p magpie` sent one request
(Bearer magpie, model fake/m1); plain `codex` sent none; config.toml was
byte-identical after connect, effort change, sync and disconnect.
Broken by hand: letting scope change while connected turns two
TestCodexProfileOnly tests red.
Not tried: a real account, the Codex app, the GUI row in a live window, an
older Codex without profile files. gui-de and gui-ja "has every zh string"
are red on main without this change (#6234).
2026-11-12 10:10:28 +08:00
yetone 972f69fdc7 dsh: a start's first round goes by the last magpie's record (#2278)
A start's first dsh round read every profile through the yaml emitter to
find what the last magpie's round had found: nothing to write. On a real
account that was ~60 MB of the first minute's 523 MB.

The round's key (dsh's files, the gateway, the models) is now summed with
sha256, the same in every process, and a round that ends with nothing to
write records it in the cache folder (dsh-rounds.json, temp + rename).
A start's first round goes by that record when it is this magpie
version's; a dev build never does. A file, the models or the version
changed has the round run as before.

Run:
- go test ./internal/agent (mica): ok 188s.
- GOOS=darwin/linux/windows go vet ./internal/agent ./internal/gateway
  ./internal/appdir: ok.
- Broken by hand: with the record not read, TestDshFirstRoundGoesByTheLastMagpies
  is red ("read and wrote dsh's files 1 times").
- Real account, mote sandbox HOME, a start after one start (pprof
  alloc_space at 50s): dshRounds.once 101 MB -> 38 MB (the catalog
  only), yaml emitter 43 MB -> none, total 522 MB -> 463 MB. Footprint
  peak 168 MB (w11) -> 165 MB.

Not tried: Windows and Linux real starts; the record is plain JSON in
appdir.Cache() there too.
2026-11-12 07:03:00 +08:00
yetone e0a1ab0a47 agent: RenameLegacy reads no thinking level as a model
RenameLegacy looks for model fields still holding a legacy provider id.
It read every field's value, Pi's defaultThinkingLevel too, and Pi's
effort Get checks the level against the models Pi offers: the whole
catalog built for Pi at every start, though no thinking level is ever a
model id. A field whose key ends in "effort" is now skipped.

Measured on mote with a real account (its providers, Codex and dsh
homes), the profile 8s after start, two runs each:
- before (w5): RenameLegacy 67 MB allocated, piOffered/sharedModels
  46-48 MB of it
- after (w6): RenameLegacy 25 MB, piOffered gone from the profile;
  the diff of the two profiles: sharedModels -47 MB, but the dsh round
  now builds its own list (+27 MB) where it used the one Pi built, so
  ~20 MB less allocated at start. liveHeap 104.5 MB both, footprint
  134-137 MB both: this is garbage saved, not memory kept.

Run: TestRenameLegacyBuildsNoModels (new) passes; with the old
legacy.go it fails ("RenameLegacy built pi's models"). gofmt, go vet
and go test ./internal/agent on mica at 40c8d0c81 plus this change: vet clean, ok internal/agent 287s.
Not tried: Windows or Linux; the change is a string check on keys.
2026-11-12 04:15:52 +08:00
yetone c75a1a0f83 agent: dsh's bili route asks sharedModels for the catalog, as every reader of the list does (TestModelReadersShareTheList)
The previous commit read len(magpieModels(...)) in dshThrough; the guard test
that lists readers of the shared catalog went red. Run (mica): go test -tags
nogui ./internal/agent: ok (202s); ./internal/library: ok (139s); go vet
darwin, GOOS=linux -tags nogui, GOOS=windows on agent and library: clean;
GUI library-bili, library-all, i18n-keys, i18n-en-no-cjk and site node --test:
exit 0 at the commit before.
2026-11-12 02:24:10 +08:00
yetone a1a3b6fadb library: DeepSeek Harness folds its context with billion-context through its /bili/ prefix (VantH_off on X)
VantH_off asked for DeepSeek Harness in billion-context's support.
Library's billion-context tab offered Pi, omp, OpenCode, Claude Code, Hermes
and Zed. bili's dsh route is `dsh plugin add billion-context` (billion-context
0.1.213 README), which loads in dsh's process and takes traffic by proxy
settings; magpie's dsh route is baseURL http://127.0.0.1:3425/v1, plain http
on loopback, so that never sees it and the plugin would add tools and fold
nothing (the Hermes case, 00e8242e8). dsh's route baseURL is editable, so it
takes the route Zed and Hermes take, bili's documented /bili/ prefix.

Turned on, magpie runs `bili start --port 8787` and writes magpie's route
baseURL in every dsh profile and the home layer as
http://127.0.0.1:8787/bili/<gateway>/v1 (Anthropic route: no /v1)
(agent.DshThrough: dshSyncFresh with the prefixed gateway). dshReach reads the
prefix back from the profiles' routes (loopback path before the gateway's
address) and Check, Sync, a pick and the serving round (dshWiredWith, which
read gateway.URL() directly) keep it; an address that isn't a local proxy's
goes back to the gateway. Off writes the gateway back. Empty-list string (en,
zh, zh-TW, ja, de), docs (en, zh, ja), llms-full.txt and
docs/subsystems/library.md name dsh. bili's dsh plugin installer is never run
for it. The remaining agents are #5915.

Run (mica, at the pushed head unless said):
- TestDshThroughBili, TestBiliDshThroughPrefix: ok
- see below for the packages and GUI files
Broken by hand:
- dshReach returning gw: TestDshThroughBili red (a sync drops the prefix)
- no "dsh" URL lane: TestBiliDshThroughPrefix red (dsh not offered)
Not tried:
- a real dsh and a real `bili start`; tests fake bili and the probe, so
  whether dsh's SDK sends to the prefixed address is by analogy with Hermes
- Windows run (vet only)
2026-11-12 02:24:10 +08:00
yetone a6d84e13a9 agent: Claude Desktop can use this computer's LAN HTTPS address for SSH remote sessions (zyc-bit on X, #4546)
Desktop's built-in SSH remote sessions hand the profile's gateway address
and key to the remote host. magpie wrote 127.0.0.1 and this computer's own
key there, so the host refused it (provider_loopback; a non-loopback address
must be https), the gateway turned the key away from another machine, and
3p mode's sshHostAllowlist (empty) allowed no host.

Desktop's row gets a "gateway" picker, drawn only while LAN sharing is on
and an address of this computer is https (gateway.LANURLs: HTTPS on, or
MAGPIE_PUBLIC_URL): "This computer" (default, loopback) or that address.
The pick is settings.DesktopGateway (carried by the settings save, kept by
KeepOwn). desktopOn / desktopCheck / desktopKeyApplied write and compare
desktopGateway() and the key at it (agentKeyAt: the sharing key). On a
non-loopback address sshHostAllowlist is seeded once with ["*"]
(desktopSeedOnce; the user may narrow it, never rewritten). The pick holds
only while it is still one of the https addresses; Agent.Gateway is
desktopGateway, so Rekey (after the sharing toggle, and now after the HTTPS
toggle) sets Desktop again, back to loopback when sharing goes off.
desktopIsOurGateway takes this computer's LAN addresses; realReachProbe no
longer verifies the certificate (magpie's CA is not trusted on this
computer), which read a LAN https address as unreachable.

Run (mica, sandbox HOME): go test ./internal/agent ./internal/settings
./internal/settingsapi ok; ./internal/gui ok except
TestPanelHiddenByWailsMarksPageOutOfSight, flaky the same on origin/main
fc615339f (#5322); go vet darwin, linux (nogui) and windows on the three
packages; gofmt clean. TestDesktopPointedAtLANHTTPS is red when desktopOn
writes loopback and when the key is not the sharing key. GUI
desktop-gateway-address.test.cjs 20/20 (chromium + webkit, en zh zh-TW ja
de, 1100 and 420px), red 20/20 with the field left in the "nothing to pick"
filter's absence; i18n-keys, desktop-*, click-scroll files.

Not tried: a real Desktop SSH session to a remote host, the remote host
trusting magpie's CA (it must, or use an imported certificate), the real
Claude Desktop app. Windows and Linux runs only vetted.
2026-11-12 01:28:03 +08:00
yetone 7e3e0fec4f gui: put agents back as they were when magpie quits, connect them again at start (tudjam17795 on X)
New Settings > General switch, "Put agents back when quitting" (zh: 退出时还原 Agent 配置),
default off. With it on, quitting the GUI app runs the same restore Disconnect does
for every agent magpie has connected (*.before-magpie files back byte for byte), and the
next start connects those agents again. Off keeps today's behaviour: a connected agent
keeps magpie as it quits.

- agent.RestoreOnQuit disconnects each wired agent that the user did not disconnect, then
  forgets the <id>.disconnected mark, so the quit leaves no mark; it stashes the list of ids.
  agent.RewireOnStart takes that list once and connects those still unwired and not
  disconnected since. An agent the user disconnected stays disconnected.
- gui: OnShutdown restores only when the setting is on and this process served the
  gateway; start re-wires in the background (not while the gateway is paused). A restore
  on quit also quits at once without the ask.
- settings.RestoreOnQuit, settingsapi key kept unless sent, row in index.html, i18n for
  zh, zh-TW, ja, de, docs in gui-shell.md and agent-wiring.md.
- app.js: the repeated Off/On settings rows go through one helper (segsOO), 422 bytes
  smaller overall, so TestCoreScriptBudget passes without raising the budget.

Run (sandbox HOME, mica because mote was loaded):
- go test internal/agent, internal/gui, internal/settings, internal/settingsapi, internal/cli
  at the rebased head: the new tests and the budget test pass.
- GUI, chromium and webkit, five languages, widths 1100 and 420: restore-on-quit (new),
  quit-ask-setting, quit-ask, settings-general, settings-sections, settings-places,
  i18n-keys, i18n-en-no-cjk, gui-de, gui-ja, gui-zh-tw, and for the rows moved to
  segsOO: reduce-motion, skeleton-bird, lightweight, keep-login, checkin-at,
  update-auto, update-hide, update-restart, update-download, tray-bird, tray-logos,
  tray-cost, wsl-agents-setting, login-allow. All 0 fail.
- gofmt -l clean; go vet darwin, windows, linux -tags nogui clean.

Broken by hand: not forgetting the disconnected mark turns
TestRestoreOnQuitAndRewireOnStart and TestRestoreOnQuitLeavesUserDisconnected red;
dropping the Disconnected() checks turns TestRestoreOnQuitLeavesUserDisconnected red;
dropping the setting gate turns TestRestoreAgentsOnQuit red.

Known reds, not from this change (same on the base 60559ee73): 20 GUI failures in
settings-hints, settings-lines-wrap and settings-search (#6133, #6107, #6156, #6073);
internal/gui TestPanelHiddenByWailsMarksPageOutOfSight killed under load (#6063);
internal/agent TestPiGroupEntryKeepsItsMembers on mica.

Not tried: real agent configs (sandbox HOME only), a real Wails quit on a Mac with real
accounts, Windows via win-run, the Linux WebKitGTK app.
2026-11-12 00:19:34 +08:00
yetone 7b9ae7cf9c agent tests: Pi's group entry counts the group look-ups, not the process's bytes (#6178)
TestPiGroupEntryKeepsItsMembers (efdca11be) compared runtime.MemStats
TotalAlloc across five polls, which counts every goroutine the earlier
tests left running. Alone it passed; in a full ./internal/agent run, with
~1,000 tests before it, it was red on macOS CI and on mote. A bisect on
mote found no single test behind it: the red needs tests from both halves
of a 128-test set, so it is cumulative, not one leak.

provider.GroupsFound counts how often GroupFinder found a group's
members, and the test asks that five kept polls found none.

Run (mica): -run TestPiGroupEntryKeepsItsMembers green; with agents.go's
old provider.GroupFinder() loop put back by hand it is red ("found the
group's members 5 times"); ./internal/agent whole ok (200s);
./internal/provider's only reds were the three on main (fixed in the
next commit). gofmt clean.
2026-11-12 00:17:23 +08:00
yetone 85e6ec5406 agent: Paseo's Claude model picker lists magpie's models (@TheMist016 on X)
Paseo (getpaseo/paseo) starts the same Claude Code, but builds its own model
list: first-party models plus settings.json's `model` and a few
ANTHROPIC_*_MODEL variables (providers/claude/models.ts). It never reads
Claude Code's modelPicker, where magpie writes every model, so the rest were
not selectable in Paseo. Paseo's own ~/.paseo/config.json takes
agents.providers.claude.additionalModels ([{id,label,description}], checked
against protocol/src/provider-config.ts) and passes each id to Claude Code as
written.

New agent "Paseo" (detected by ~/.paseo or PASEO_HOME): its switch writes the
models Claude Code's /model lists (same ids, [1m] marks, names; only the ones
picked for it) there, marked "via magpie" in the description; the user's own
entries and keys stay, off takes out only magpie's, a sync refreshes when on.
Claude Code must be connected to magpie as well.

Run (mote-run, sandbox HOME in tests): TestPaseoAdditionalModels,
TestStateListsPaseo, internal/agentenv, internal/gui full package ok;
internal/agent full run red only on TestPiGroupEntryKeepsItsMembers, which is
red the same on origin/main 12cd456f2 (passes alone; filed). gofmt clean,
vet darwin, windows and linux nogui on internal/agent. Broken by hand: Set
writing no models goes red.
Not tried: a real Paseo daemon reading the file (checked against its schema
source only); GUI browser suites.
2026-11-11 23:08:39 +08:00
yetone efdca11be3 agent: Pi's group entry keeps whether a member speaks Messages across polls
Pi's Drift is asked on every /api/drift poll, about every 12s on
every page. Each poll wrote the entry of the model the agent is set
to. For a routing group, piModelJSON found all of the group's members
again (GroupFinder, membersFound, resolveIn) only to see whether one
speaks Anthropic's Messages API, for #5037's short promptCache. With
the real-account copy on mote, an alloc_space diff of 55s with the
Sessions page open showed 21.7MB allocated, 17.1MB of it under Drift
(5 polls, ~3.4MB each), 16.1MB of that in this look-up.

provider.GroupHasNative answers it through keptOf: kept across
requests while the files' stamp stays the same, a minute at most, as
the catalog's other kept builds are. Outside a request it is found
afresh, as before. The entry is the same.

Test: TestPiGroupEntryKeepsItsMembers. Over successive requests, a
group's entry allocates under half of one provider.FindGroup: 3,600
bytes against 71,040 for a 40-member group. With the old agents.go it
is red: 72,672 against 71,040. TestPiGroupPromptCache and
TestPiGroupThinkingIsWhatPiRuns pass.
2026-11-11 22:26:07 +08:00
yetone f3cdb03c8a agents: a Claude Code kept in another config folder is a row of its own (BieJian21872 on X)
Only the folder CLAUDE_CONFIG_DIR (else ~/.claude) names was found. Every
other ~/.claude… folder holding Claude Code's files (settings.json,
.credentials.json or projects/) is now claude#<name>, "Claude Code · <name>",
made by claudeIn at that folder (place.dir, as claude#launch is): connected,
model picked and checked in its own settings.json. With the variable
elsewhere, ~/.claude is claude#default. ~/.claude.json, another tool's
.claude-… folder and the launch file's folder are not rows. A folder
outside the home folder is not found (documented in agent-wiring.md).

Run at the pushed head's parent 16ed1a952 plus this change, on mote:
go test ./internal/agent (ok), ./internal/library (ok), ./internal/cli
(one red, TestEveryRouteHasACommandOrIsNamed on POST
/api/plugin-pages/arrange, not this change; #6162). gofmt clean; go vet
darwin, linux nogui and windows on internal/agent. Broken by hand:
dropping claudeDirAgents from onMachineAll turns
TestClaudeCodeInMoreThanOneFolder red.
Not tried: a real Claude Code against a second folder; GUI suite (no GUI
file changed); internal/gateway and internal/sessions were still running.
2026-11-11 21:02:21 +08:00
yetone 19782923c5 codex: the compaction magpie makes can go on a model of its own (0neB1aze on X)
Codex's memories had a model of their own, its compaction did not. Codex's row has a compaction model square (compact_model, settings.CodexCompactModel), read by the gateway on each compaction (codexCompactTo, before codexCompact). Only a compaction magpie makes is moved: it asks for a plain-text summary any model reads back. One a ChatGPT account seals, or a pick that compacts natively, is left, since only the writing account reads it (#1099); a disabled, unserved or key-barred pick is left with a log line. The text sent to the model is unchanged.

Run on mote: TestCodexCompactOnItsOwnModel (red with the move taken out) and TestCodexCompactToLeavesNative; go test for gui, settings, settingsapi, agent, provider, gateway; darwin, linux and windows vet; the GUI files in both engines. Not tried: a real Codex session compacting on the chosen model.
2026-11-11 20:57:11 +08:00
yetone 80e4856803 agent: an agent's command in ~/.local/bin is found on Linux and macOS too (Xuanwo on X)
Detected asked only magpie's own PATH off Windows. A magpie started from a
desktop launcher has no ~/.local/bin on it, where the official Antigravity
CLI installer puts agy, so the Plugins page said "Antigravity CLI isn't in
Agents: magpie doesn't find it in ~/.gemini/antigravity-cli". binAt now asks
proc.FindTool on every OS (PATH, then ~/.local/bin, npm, bun, Volta, cargo
and the other folders a user's tools live in), as Windows already did and as
CLIMissing already did.

Run: TestDetectedFindsBinInLocalBin on Linux (wsl-run, magpie-desktop): red
with binAt put back to LookPath only, green with the change. On mote:
go test ./internal/agent ./internal/proc ./internal/gui ok, gofmt clean,
go vet for darwin, windows and linux nogui clean.
Not tried: a real agy install on the Linux VM, and the GUI Plugins page.
2026-11-11 18:58:22 +08:00
yetone e3e774be7a agents: Claude Code's Co-Authored-By commit signature on or off from its settings (9_bishi on X)
Claude Code's row in Agents > Settings gets a "Commit signature" On/Off menu. Off writes
Claude Code's own key attribution.commit = "" in settings.json; On takes out only what
hid it (attribution.commit "" , attribution false, includeCoAuthoredBy false), so the
default comes back. A custom attribution text is the user's own: the row shows "Your own
text", is disabled, and is never written over. attribution.pr is untouched.
Route POST /api/settings/claude-attribution, S2 in the settings parity test.

Run at the rebased head (on 967fefcec), on mote with a private GOCACHE:
- go test ./internal/agent -run Claude, ./internal/cli -run Parity|Settings,
  ./internal/gui -run Budget|Script: ok
- GUI claude-attribution.test.cjs + i18n-keys.test.cjs in chromium and webkit: 6/6 each
  (en and zh, fake API)
- gofmt -l clean; go vet darwin, linux (-tags nogui), windows: ok
- agent-prefs.test.cjs chromium: 5 of 28 red, identical at base 745d209dc and here
  (#6139); not from this change.
Broken by hand: Off writing "x" instead of "" turns TestClaudeAttributionSet red.
Not tried: a real Claude Code making a real commit, the Windows box, the full suite
before the tag (started after it), webkit for agent-prefs.
2026-11-11 18:14:10 +08:00
yetone 7050da0a4c hermes: each other profile is an agent row with its own skills and MCP servers (Norethcy on X)
Hermes reads skills/ and mcp_servers from each profile's own home, but the
Library only reached the connected profile. Every other profile is now an
agent row hermes#<name> ("Hermes · <name>"), like omp#<name>: its model pick
stays, and the Library target points at that profile's config.yaml and
skills/. No row is listed while Hermes itself is gone (CLIMissing). Tool
off-lists (tools.exclude) work on the rows too. The GUI says "starts on the
model picked here" for them as for Hermes.

Run: wsl-run go test ./internal/agent ./internal/library (ok, full packages);
GUI hermes-profile-row, hermes-profiles, omp-profile-connect, i18n-keys in
chromium and webkit, five languages; gofmt; go vet GOOS=darwin and windows
for agent and library.
Broken by hand: without hermesProfileAgents in onMachine,
TestHermesProfilesAreAgents is red; without the hermes# branch in targetOf,
TestHermesProfilesGetTheirOwnLibrary is red; without the app.js change the new
GUI test is red (10 of 10).
Not tried: a real Hermes with real profiles, Windows via win-run, the full
GUI suite, the internal/gui Go package (wsl lacks gtk4, build fails there).
2026-11-11 16:38:41 +08:00
yetone 164826d8b6 agent tests: a settled dsh round's allocations are held to the same round over fewer models (#6118)
TestDshRoundWithNothingChangedBuildsNothing held the round to a fixed 300
allocations, and Windows CI read 421 with the skip working. It now settles
the route over 2 models and over 402, and fails when the larger is over
1.5x the smaller + 50: reading the files differs by system, building the
catalog grows with the models.

Broken by hand (`if false && r.done && key == r.last` in dshRounds.once):
red on Windows, 78375 allocations over 402 models against 1780 over 2.
Run at 8fe720453 + this: -run TestDshRound -count=3 on Windows (ok);
internal/agent whole on WSL (ok, 736s).
2026-11-11 16:31:22 +08:00
yetone 5c02be05b8 agent: agy moves onto the community agent-agy plugin
The built-in agy agent (Antigravity CLI) is the first built-in agent a
community agent plugin serves, as the retired subscriptions moved onto
provider plugins. While @magpie-community/agent-agy is installed and on,
magpie's agy is the plugin's: the built-in leaves the list (here and in
WSL), its id and aliases are the plugin's, and what the built-in wired
is handed over. Turned off or removed, the built-in is back. Nothing is
forced yet; the forced install and the built-in's retirement come once
the plugin is on npm and a real run with it is on record.

The plugin (plugins ebcff866, 0.2.0) follows the built-in since
0cc91af3d: its config is magpie's own magpie-settings.json, handed to
agy with --settings, agy's settings.json is only read, and
remote-control runs as agy is.

What an agent plugin can say now (agentplug; docs/reference.md and the
site's plugins pages, en/zh/ja, and llms-full.txt):
- base: the agent's own settings file, read for the user's own model
  and passed to connect and own; needs launch.args with {config}, and
  stepping out removes magpie's config file whole;
- launch {env, model, args, plain}: `magpie start <id>` and the shell
  functions (posix, fish, PowerShell, a WSL distro's) put args before
  the model flag, and run a plain word or flag as the agent is;
- own({config, base, model}), effort, wsl, aliases.

Moving over (plugged_moved.go): agentMovers names agy's package;
agyHandover gives back a settings.json an older built-in wired (Sync),
then makes magpie-settings.json the plugin's stash, so the plugin's
agent reads as connected and stepping out removes the file.

Run (mote, macOS 27, Go 1.26.8) at fe8c05e0c, the base before the last
rebase:
- go test internal/agent (507s), agentplug, sessions, edit, update,
  plugin: ok.
- internal/cli and internal/gui: red only on main's own reds, the same
  at origin/main 8fe720453: TestModelUsageAlignsEveryDescription and
  TestModelUsageLinesUpItsDescriptions (#6104),
  TestSettingsSaveKeepsWhatItDoesNotSend (#6103), TestCoreScriptBudget
  (#6116, filed now).
- GUI, both engines, and site node --test: agy-effort, agy-launch,
  library-rtk-agy, gui-de, gui-zh-tw, i18n-en-no-cjk, i18n-keys,
  plugin-page-foreign-error, site/*.test.mjs: 114 pass.
- vet: macOS, GOOS=windows, Linux in WSL (-tags gtk3); gofmt clean.
- The shell functions with a config path holding a space: bash and zsh
  on mote, PowerShell on Windows (win-run), bash in WSL.
- Broken by hand: TestAgyPlugin red with Args, Plain or the file's
  removal taken out.
At 20d807d92 (rebased on 8fe720453): vet (macOS, windows) ok, agentplug
and internal/agent -run 'Agy|Plugged' ok, agy-launch and i18n-keys
pass; plugin-page-foreign-error is red there and at plain origin/main
8fe720453, from that commit (#6117), not this change.
Plugins repo: bun test packages/agent-agy 4 pass.

Not tried: fish (on none of the machines); a real agy run with the
plugin at 0.2.0 (the 0.1.0 design ran for real in a sandbox HOME, the
settings.json one this replaces); Windows and WSL agy with the plugin;
an install from npm: @magpie-community/agent-agy isn't on npm yet, so
until its first publish no user is moved.
2026-11-11 16:13:19 +08:00
yetone fe8c05e0c8 agent: Claude's model variables hold Anthropic's own ids on Claude Code's own subscription, so Desktop's Code tab stops failing WebFetch (iryan_sun on X)
ANTHROPIC_DEFAULT_<TIER>_MODEL, ANTHROPIC_SMALL_FAST_MODEL,
CLAUDE_CODE_SUBAGENT_MODEL and the auto mode model stayed
"claude/claude-haiku-4-5[1m]" after the main model became an alias. A tier
variable can't be an alias of itself, so on this computer's own file a
Claude model of Claude Code's own subscription is now written as
Anthropic's bare id (provider.ClaudeBare): through magpie that id goes to the
same subscription (OwnRoute), and Anthropic knows it. Haiku has no 1M window,
so its [1m] mark is taken off. Read back, a bare Claude id is the
subscription's ref (ClaudeUnbare), so every field, the tiers' follow logic
and the gateway's stand-in read it as before.

Old files: a settings.json written with the prefixed ids is rewritten by the
next Sync (the check that already brought dashed spellings up to date), for
every user. Models of other vendors or a relay keep their ref: Anthropic has
no id for them. A distro's file and the claude-magpie launch file keep refs.

Run (wsl-run, Ubuntu, at the pushed head after rebasing on origin/main):
internal/agent -run "Claude|Tier|Folder" ok; internal/provider ok;
gofmt -l clean; go vet -tags nogui for linux, darwin and windows clean.
Before the rebase, the whole internal/agent package had two reds:
TestFolderVarsAreListed (BUN_INSTALL, fixed on main since) and
TestGrokInstalled (WSL2 binfmt, already #3548). Neither touches this change.
Real claude 2.1.316 with a fake upstream showed Desktop's
PROVIDER_MANAGED_BY_HOST sends the tier env as written, so prefixed ids go
to Anthropic.
Broken by hand: with ClaudeBare turned into a no-op,
TestClaudeModelVariablesAreAnthropicsOwnIDs fails on the bare ids and on the
Sync rewrite.
Not tried: the real Claude Desktop Code tab, a WSL distro user, real
accounts through magpie end to end. A non-Claude model or a relay-served
Claude model still has no Anthropic id, so its tier variable keeps the ref
and Desktop's Code tab still can't use it.
2026-11-11 16:02:17 +08:00
yetone 6c95722da6 agents: OpenMausBot's row draws its real logo, not a black square (HulaSup on X)
The Agents row showed a plain black square for OpenMausBot. Its icon file
(OpenMausBot's build/icon.svg, a black tile with a silver cursor, Apache-2.0,
byte-identical to upstream at main) was named openmausbot.svg, and app.js
draws an SVG without the -color suffix as a one-tone mask: the black tile
became a black square. Renamed to openmausbot-color.svg, which app.js loads
as an image (as Antigravity, Cherry Studio).

TestEveryClientHasNameAndIcon now fails a client whose SVG holds gradients
but isn't named -color; it is red on the old name (checked by hand), green now.

Run (wsl-run, magpie-desktop, nogui tag; mote's disk is full):
- go test ./internal/agent: ok. go test -run 'Icon|Client' ./internal/gui: ok.
  The full ./internal/gui run hung 600s in TestGatewayMode (gatewaymode_test.go:63)
  on WSL, a test this change doesn't reach; not filed or investigated.
- go vet on linux (nogui) ./internal/agent ./internal/gui and windows ./internal/agent: ok.
- gofmt -l: clean.
Not tried: the live GUI in chromium/webkit; the full suite.
Protocol (HulaSup's question): magpie writes OpenMausBot an engine of its own
as a Claude endpoint (driver claudeAgent, ANTHROPIC_BASE_URL), Anthropic messages.
2026-11-11 15:58:45 +08:00
yetone 612dc1956f agent: BUN_INSTALL is an agent folder variable; TestGrokInstalled's fake is not an MZ file (#3548)
Both were red on origin/main 2c644da04 on WSL (wsl-run, nogui).

TestFolderVarsAreListed: kirocrew.go reads BUN_INSTALL for its CLI search
path, but agentenv.Vars didn't list it, so no sandbox cleared it. Added.

TestGrokInstalled (#3548): the fake downloaded grok began with "MZ", which
WSL2's binfmt interop hands to the Windows loader (EINVAL), so the update
path reported "Invalid argument". On the non-Windows branch the fake now has
a body no loader claims, so exec gives ENOEXEC as on real Linux. The Windows
branch keeps MZ.

Run: both tests red before, green after at this change on WSL; gofmt, linux
and windows go vet of internal/agent and agentenv; -run "Grok|Update|Env|Kiro"
on internal/agent green. Not run: full suite, macOS.
2026-11-11 15:21:21 +08:00
yetone d78d853a4e agent: telemetry off for Crush, Kimi Code, Goose, Pi and Cline too (daoche_wuzui on X)
Settings > Privacy "Turn off telemetry for all agents" and each agent's own
Telemetry row now also cover Crush (options.disable_metrics), Kimi Code
(top-level telemetry in config.toml), Goose (GOOSE_TELEMETRY_ENABLED in
config.yaml), Pi (enableInstallTelemetry; Pi itself, not its forks) and
Cline CLI (telemetryOptOut in data/settings/global-settings.json). Each key
was read from that app's source, docs or binary. Same rules as before: only
missing keys are written, a user's own value is never overwritten, an
unreadable file is unknown (TOML and YAML are parsed strictly).

Antigravity (app and agy) has no local key: agy's EnableTelemetry is
json:"-" and the setting lives on the Google account. Droid (org-set),
OpenCode/omp (OTel is opt-in), Cursor CLI (account privacy mode) and Hermes
(sends none) have none either. Grok Build, Kiro, CodeBuddy, Command Code and
Amp were not looked at.

Run (wsl-run, mote's disk is full): telemetry_more_test.go green; broken by
hand twice (wrong off test: crush and cline red; lenient unreadable read:
kimi and goose red). go vet for windows, darwin and linux nogui clean.
internal/agent whole package: only TestGrokInstalled red, a WSL exec
"Invalid argument" in a /tmp stand-in, not touched here; the one red this
change caused (TestFolderVarsAreListed, CLINE_GLOBAL_SETTINGS_PATH) is fixed
in agentenv.Vars. Real goose and crush binaries read the sandbox paths; not
tried: that any of the five honours the written key at run time, Windows run.
2026-11-11 14:45:04 +08:00
yetone 0c44b9ece4 agent: a dsh round builds the provider catalog once
keepDshWired's round ran outside any provider.Hold, so every
PublicRef, RenamedRef and Exposed it asked built every provider's
models again. With a real account, 158 MB of what magpie allocated in
its first minute was this round, 72.55 MB of it dshStartOnItsRoute's
four refs, all worked out before the first was looked up.

The round now holds the catalog for its whole run, and the start's
refs are worked out only when the one before isn't listed.
provider.EntriesBuilt exposes the build count for the test.

Test: TestDshRoundBuildsTheCatalogOnce gives the start an auto ref
no model has and counts catalog builds in a writing round. On the
old dsh.go it is red with 3 builds; with the change, 1.
2026-11-11 14:43:25 +08:00
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