d3fc6f2bfada18e6ae7887b79ed1e4c650ca37e1
16
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
cdfdb62c69 |
agent: a model field's list is joined with the catalog once while neither changed
Each agent's model field returned append(its own models,
viaMagpieShared(...)...), a copy of the whole catalog's options for
each field of each agent on every poll: Picks was 94.7 MB of 496 MB
over forty polls of the Agents page with real accounts. withVia keeps
the joined list per agent and prefix while the own models read the same
(sameOption, field by field) and the catalog's list is the very one
kept (same array), and joins it again when either changed. The list is
read only and clipped, as viaMagpieShared's is; every caller of a
field's Options reads it, Picks clones it before it drops anything.
The 52 `return append(own, viaMagpieShared(...)...)` sites call it.
omp's and Reasonix's planner edit the joined list after the append, and
Grok's writes Same into its copy, so they keep their own copies.
TestWithViaKeepsTheJoinedList: the same own models give the same array,
own models changed in a value or only an icon are joined anew, a
provider saved since is listed, and nothing joined is the catalog's own
list. TestSameOptionReadsEveryField sets each field of Option alone and
fails when sameOption doesn't see it. Broken by hand: never answering
from the kept list ("the same own models joined the catalog again"),
and FastFor left out of sameOption ("sameOption doesn't read
Option.FastFor").
Run on mote: both tests alone 3 of 3; internal/agent, internal/tui and
internal/cli ok; internal/gui red only on TestSettingsSaveKeepsWhatItDoesNotSend
(#4514) and TestMainWindowCorners (#3949); gofmt, vet and GOOS=windows
and linux vet clean. Real accounts in a sandbox HOME, forty polls:
Picks 94.7 MB -> 51.2 MB, state 190.8 MB -> 154.0 MB, state and drift
replies byte for byte the same as before. Footprint peak 136 MB.
|
||
|
|
bb478f0e50 |
agent: a look that only ranges over magpie's models reads the list kept
magpieModels gives each caller its own copy of the list it keeps per
agent. Most callers only range over it, or count it, and a range copies
each model anyway, so the copy guarded nothing for them (the models'
own lists were shared before too: the copy was shallow). sharedModels
is the list kept, read only; every `range magpieModels(` and
`len(magpieModels(` in internal/agent (39 files) takes it. Callers that
keep the list, append to it or hand it on still get their copy.
Real accounts (sandbox copy of the owner's HOME, network blocked), 40
polls of /api/state, /api/providers and drift, pprof alloc_space
between two heap snapshots,
|
||
|
|
dd7442f283 |
agent: a look at the via-magpie options shares the kept list
viaMagpie handed every caller its own copy of the options list it keeps per stamp, and a window poll asks for it from most agents' fields and pickers. In a real-account sandbox (abr.sh, 20 polls of drift, state and providers on v0.1.2463) those copies were 33.7 MB of slices.Clone, plus ~8 MB more on the way, of the 713 MB the polls allocated. viaMagpieShared returns the kept list itself, clipped, so an append makes the caller's own array. The 58 callers that only read it, or append onto it, now take it; viaMagpie (a copy) stays for the ones that change it. TestKeptListSharedWithoutACopy checks that 20 shared looks return the kept array, and that an append onto a shared look and a write into get's copy leave the kept list as it was. Run on mote at this tree: - gofmt, go vet (darwin, GOOS=windows, GOOS=linux with gateway), go build ./...: ok. - Broken by hand (shared returns slices.Clone): the test is red, "a shared look copies the kept list". - go test -count=1 ./internal/agent: ok (480s). Not run: internal/gateway and internal/gui packages on this tree. |
||
|
|
73a12e8bf6 |
wsl: a distro's agent folder that is a link is opened where it leads (#4502)
On Windows, adding a skill or switching RTK on for an agent in WSL failed with `mkdir \\wsl.localhost\<distro>\root\.codex: Cannot create a file when that file already exists` (linusxiong). In the distro ~/.codex is a link to /mnt/c/Users/<user>/.codex. Through \\wsl.localhost Windows can't follow a link the distro has: a mkdir of it says it exists, and nothing below it can be made, written, read or listed. ggbdpq found and explained the link (thanks); their patch, which takes that EEXIST as "there", wasn't used: the writes below the link fail next (its test passed because a symlink here is followed). The fix, for every agent folder and every writer through \\wsl.localhost: - The WSL probe asks `readlink -f` in the distro where each agent folder, its skills folder and the folders beside them lead (wslLinkPaths -> distro.Links; a $HOME that is itself through a link is left alone), and which drive each Windows mount is (win:/mnt/c C: -> distro.Drives). - distro.open opens a path at or below a link where it leads: on a Windows drive, the drive's own path (C:\Users\<user>\.codex); elsewhere in the distro, through \\wsl.localhost again. native spells it back through the link, so the agent is told its own path. - A link readlink couldn't resolve is never guessed at: distro.open errors, and the agent is unreached (Agent.Unreached: its notice says why; every field Set and Sync returns it). - Writers: the agents' own files (place.join/place.open, every filepath.Join(at.home, ...) in internal/agent), the library's WSL targets (wslOpen/wslOpened; one "wsl" problem per agent and nothing written), RTK (rtkAt, rtkInstall checks agent.WSLOpen before its mkdir), the Sessions page's WSL reads (sessions.WSLHome.Open) and the Copilot CLI sign-in read (provider.CopilotWSLHomes -> CopilotWSLDirs). - Not changed: magpie's image MCP server opens arbitrary paths an agent in WSL gives it the same way; filed as #4578. Links deeper than the probed paths (other than <agent dir>/skills) aren't resolved. A distro probed by an older magpie has no Links until probed again (each run). Run: - Real Windows box (xiaomi-gpu, distro magpie-desktop, sandbox /tmp/x4502/home with .codex -> /mnt/c/Users/yeton/runs/x4502-target/.codex, .claude -> /tmp/x4502/data/claude, .pi -> a missing folder), a throwaway Windows test running the real probe with that HOME: probe said link:.codex /mnt/c/..., link:.claude /tmp/x4502/data/claude, link:.pi, win:/mnt/c C:, win:/mnt/d D:. The old way, MkdirAll(\\wsl.localhost\ magpie-desktop\tmp\x4502\home\.codex\skills\pdf) = "Cannot create a file when that file already exists" (the report's error). distro.open wrote SKILL.md to C:\Users\yeton\runs\x4502-target\.codex\skills\pdf and to \\wsl.localhost\magpie-desktop\tmp\x4502\data\claude\skills\pdf, both read back with cat in the distro through the links; .pi said "~/.pi in WSL magpie-desktop is a link magpie couldn't follow". Sandbox and target removed after. - New tests with a fake distro whose ~/.codex and ~/.claude are links to /mnt/c/... that don't exist here, so, as through \\wsl.localhost, nothing below them can be made: TestWSLFolderIsALinkToC, TestWSLFolderLinkUnresolved, TestRTKWSLFolderIsALink, TestRTKWSLFolderLinkUnresolved (library); TestWSLProbeLinks (runs the probe script), TestWSLOpenThroughLinks, TestWSLAgentFolderIsALink (config and a Claude session read on C:), TestWSLAgentFolderLinkUnresolved (agent). - Broken by hand: the library tests on the base (with a no-op FakeWSLDrives) fail with "mkdir .../home/me/.codex: file exists", the report's error; with ggbdpq's patch applied they still fail (the skill mkdir, and RTK's hook not written). - mote: go build ./...; go vet of agent, library, sessions, provider for darwin, GOOS=windows (and linux for agent, library); gofmt -l clean; go test -timeout 45m ./internal/agent ./internal/library ./internal/sessions ./internal/provider: all ok. - Windows (win-run): the same four packages. The new tests pass (the RTK ones skip: the fake distro runs sh). 32 tests are red, all already red at the base |
||
|
|
b75e21be31 |
agent: the Qoder app counts as Qoder again, found by the status file it writes to ~/.qoder (#2138, xiaozicoder)
xiaozicoder's Windows 11 has the Qoder app and the Qoder CN app (Qoder-win-x64-user.exe, Qoder-CN-win-x64-user.exe from qoder.com and qoder.cn) and no qodercli, and since v0.1.1220 magpie's Agents page lists no Qoder at all. Qoder-win-x64-user.exe is the Qoder app (com.qoder.app, qoder-app/releases/latest.yml at 0.4.7), not the Qoder IDE. Its app.asar runs Qoder's CLI as its agent (qodercli 1.1.64's worker runtime, config dir .qoder / .qoder-cn, QODER_CONFIG_DIR, with BYOK config management), so ~/.qoder/settings.json's providers.magpie reaches it. It writes the enabledPlugins of its bundled qoder-context plugin to settings.json, which alone stopped counting in the same change, so the app's Qoder was lost. The app also writes .qoder-app-status.json (-canary-, -dev- for its other channels) into ~/.qoder, or ~/.qoder-cn for the China product (the map is in its app.asar; this Mac's Qoder.app 0.4.3 wrote one). Agent gets sign, one more sign the agent is here for a dirShared folder, and Qoder's (both builds) is that file. The JetBrains plugin's folder of #1495 has none, so it still isn't Qoder. Run: TestQoderAppIsQoder (both builds: plugin-only settings.json not detected; each of the three status files detected; the status file with no settings.json detected; a folder of that name not) red on the old code (Qoder CN subtests fail), green now; TestQoderSettingsFromAnIDEPluginIsNotTheCLI still green; go test ./internal/agent -count=1 -timeout 45m ok (1576s, the machine at load ~350; a first run hit the default 10m package timeout mid TestCodexAgentsV1WarnsWhenCodexOwnV2IsOn at 1s, not a hang). gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows clean. A nogui build's `magpie ls` in a sandbox HOME (PATH=/usr/bin:/bin) with ~/.qoder holding the plugin-only settings.json and a copy of this Mac's real .qoder-app-status.json, and ~/.qoder-cn the same with a qoder-cn status, lists Qoder and Qoder CN. Not tried: the Qoder app on Windows itself, and whether its agent takes magpie's provider from settings.json in practice (would need a live ~/.qoder changed). |
||
|
|
2eee900dc9 |
agent: eight more syncs keep what the user set on magpie's block (#2030's siblings)
|
||
|
|
c6da41b04c |
agent: an IDE plugin's ~/.copilot or ~/.qoder-cn isn't taken for the CLI (#1495, v5tech)
v5tech traced two agents listed with no CLI installed to the JetBrains
plugins that write the CLI's folder:
- GitHub Copilot's JetBrains plugin writes ~/.copilot (ide/, instructions/,
prompts/, agents/, skills/, hooks/; the paths are in its jar). Copilot
CLI was detected by that folder alone.
- Qoder CN's JetBrains plugin fills ~/.qoder-cn (its indexer in
shared_client/, app/, plugins/) and writes a settings.json holding only
{"enabledPlugins":{...}}, which is the CLI's Path, so the CLI was found
by its "config file".
What changed:
- Copilot CLI sets dirShared, as omp does for Pi's folder: settings.json
or the copilot command still finds it.
- Agent gets pathOwn: when set, the file at Path counts only if it says
the file is the agent's. Qoder (both builds, one qoderAt) sets dirShared
and pathOwn = !qoderPluginOnly: a settings.json that parses as an object
of enabledPlugins alone is the plugin's. Any other key, {}, or a file
that can't be read or parsed still counts (unknown is not "the
plugin's"), and so does qodercli / qoderclicn on PATH. The global build
is held to the same because the code and the plugin are shared; that
the intl plugin writes ~/.qoder the same way is by analogy, not seen.
- docs/subsystems/agent-wiring.md says so.
Run: go test ./internal/agent/ -count=1 (ok, 226s), including the new
TestCopilotFolderFromAnIDEPluginIsNotTheCLI and
TestQoderSettingsFromAnIDEPluginIsNotTheCLI (the reporter's folders,
then the command on PATH, then the CLI's own settings).
Broken by hand: Copilot's dirShared off -> the Copilot test fails; Qoder's
pathOwn nil -> both qoder subtests fail; Qoder's dirShared off -> both
fail.
Not tried: a real JetBrains plugin or Qoder CLI; WSL (its probe counts the
distro's folder and isn't changed; a Windows JetBrains writes the Windows
home, not the distro's).
|
||
|
|
20582866a5 |
agent, gui: an agent's advice after a change reads in the window's language (#1508, NovaTrailX)
A Chinese window said "ZCode 已接入 magpie. ZCode reads its providers at
start-up — restart ZCode …": the notice an agent gives after a change
(state.notice) was English text written in place in each agent's file, and
i18n.js had no entry for any of them.
What changed:
- internal/agent/notice.go: a notice is a template registered with
newNotice ("Restart {agent} to …"), filled with say(kv...); Notices()
lists every one. All the agents' notices (claude, codex daemon, zcode,
agy, cursor-local, wsl, AstrBot's added today, …) are now such templates, the issue's list
being a sample of them.
- i18n.js: every template has a zh, zh-TW, ja and de translation, and
NOTICES lists them. tNotice() reads a notice of several joined: longest
template first, a {slot} never runs over a sentence's end, and a notice
with any part that has no template (a plugin's own) reads as given
rather than half in each language. withNotice() joins the status line
and the notice with 。 in zh/ja.
- app.js: the six places that showed state.notice use withNotice.
Tests:
- TestEveryNoticeIsTranslated: every Notices() template is in NOTICES and
in each language table, with the same slots. Fails with the zh ZCode
line deleted from i18n.js (tried).
- TestNoticesAreTemplates: an AST scan for English written in place as a
Notice. Fails with zcode.go's literal put back (tried).
- tests/agent-notice-lang.test.cjs: every template, filled, alone and
joined, plus a plugin's notice, and connecting ZCode as the reporter
did; en, zh, zh-TW, ja, de at 1100 and 420px, Chromium and WebKit:
22/22. Its zh subtests fail without the zh line.
Run: go test -tags nogui ./internal/agent ./internal/gui; gofmt -l;
GOOS=linux and GOOS=windows go vet -tags nogui ./internal/agent
./internal/gui; the full GUI suite (node --test, both engines, -concurrency 6,
machine load ~140): 5130/5195, 64 failing in 22 files. Rerun alone, 16
files pass; mobile-web, old-webkit, panel-usage and routing-context/
group/keys-fold fail the same on the base commit,
|
||
|
|
e77a373792 | agent: every agent in a WSL distro under NAT is given the LAN sharing key, not "magpie" (whqtian on Discord) — v0.1.972 gave it to omp only, and OpenCode in WSL was still written "apiKey": "magpie" with Windows' address, which the gateway takes from loopback only. keyAt(gw) is the key for a gateway URL: the LAN sharing key when the URL isn't this machine's and sharing is on, else gateway.Token; OpenCode (and MiMo Code), Crush, Pi/omo, Codex, Claude Code, Kimi Code, Hermes, Grok, MiniMax Code, Droid, Morph, dsh, Qoder/Qoder CN and omp write it, their Checks compare against it (an old "magpie" there shows as drift), and ourKey still sees a LAN-keyed config as magpie's. TestGatewayKeyBeyondLoopback fails without the change. go vet ./..., go test -tags nogui ./internal/agent ./internal/gui ./internal/gateway ./internal/access ./internal/provider under a temp HOME, GOOS=linux/windows go build pass. | ||
|
|
165fee0df5 | agent: an agent's own provider named as one of magpie's isn't magpie's, in every agent that spells a model provider/model (the rest of #835) — OpenHanako's own deepseek/deepseek-v4-pro read as magpie's deepseek, and so did a model of any agent's own provider whose name magpie has a provider by: Pi's, Crush's, Hermes's, OpenCode's relay/glm-4.6 with magpie's relay had the row connected on the agent's own model, and Disconnect from magpie put that model back and left the row connected. An agent says how magpie's values are spelled in it (Spelled, replacing #835's Prefixed): magpie/<ref> for Antigravity CLI, Pi, OmO, Aside, Goose, Zed, VS Code, Crush, DeepSeek Harness, Command Code, fx, omp, Hermes, Mister Morph, Kimi Code, Empryo, MiniMax Code, Droid, Qoder, Qoder CN, Grok Build, AtomCode, Cline and OpenHanako, whose every Get spells magpie's so (a sandbox Set of magpie/relay/glm-4.6 read back as that in each); for OpenCode, MiMo Code and OpenChamber also a provider of the config's own that sends to magpie's gateway, as openCodeRef names a model there. A stopped WSL distro's agent keeps its live one's. Left as they are: Claude Code, Claude Desktop, Codex, Gemini CLI, Cursor, Copilot, Devin (magpie's are bare refs there), Muse Code (a model with / is magpie's by design: Meta's have none), Alma (its own are providerId:model), Air (magpie's only). TestOwnProviderNamedAsMagpies (26 agents: own relay/glm-4.6 not connected, Connect, Disconnect puts it back and the row is off) fails on the old code in each; TestOpenCodeGatewayProviderIsMagpies. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. | ||
|
|
dd70a4055a | wsl: OpenCode, Kimi Code, omp and the other CLIs magpie sets up through a file in the home are set up in WSL distros too (#515: on Windows only Codex, Pi, OmO and Claude Code were found in a distro) — fourteen agents join wslKinds, each found by its folder under the distro's $HOME or its command on the distro's own PATH, and listed as <name> · WSL <distro> (opencode@wsl:Ubuntu…): OpenCode (~/.config/opencode, opencode), MiMo Code (~/.config/mimocode, mimo), Kimi Code (~/.kimi-code, kimi; the old kimi-cli's ~/.kimi where that is all there is, found by the command), omp (~/.omp/agent, omp), Crush (~/.config/crush/crush.json, Linux's place, not Windows' LOCALAPPDATA), Hermes Agent (~/.hermes), Grok Build (~/.grok, by its folder alone, as on this machine), Droid (~/.factory), fx (~/.fx, by its folder alone: fx is also the JSON viewer), Command Code (~/.commandcode), MiniMax Code's mcode (~/.minimax), Muse Code (~/.config/muse), Qoder and Qoder CN (~/.qoder, ~/.qoder-cn). Each is its host constructor at a place (opencodeIn, kimiIn, ompIn, crushIn, hermesIn, grokIn, droidIn, fxIn, commandCodeIn, miniMaxIn, museIn, qoderIn/qoderCNIn; the host's opencode(home, cfg) and the rest wrap them), so it writes the same keys and schema as on this machine, but the gateway as the distro reaches it (place.gw/v1: 127.0.0.1 when mirrored, Windows' address under NAT) in its provider, its Check and its Sync, and its folder at the default, as the distro's variables (OPENCODE_CONFIG_DIR, KIMI_CODE_HOME, HERMES_HOME, FACTORY_HOME_OVERRIDE, MINIMAX_DATA_DIR, QODER_CONFIG_DIR…) aren't read (place.getenv is "" there); OpenChamber, a Windows app, isn't looked at for a distro's OpenCode, and omp there, whose version isn't known, gets xhigh rather than a max an older omp refuses. Their notices are the restart advice of their own, as for Codex. A stopped distro's agent is built without looking at its files (place.cold: exists/isDir are false, so the defaults are taken), its options read none (wslOwnAsleep, kimiOwnOptions/ompOwnOptions/miniMaxOwnOptions without a file), and a pick, once the distro is started, builds the agent again warm, so it writes the file the agent reads — an opencode.jsonc already there, ~/.kimi for kimi-cli — not the default. Left out: Gemini CLI and Antigravity (a key lent through .env, a launch command), dsh (profiles and .env), Devin (no gateway; its model list from the devin command on this machine), Goose (no magpie routing; its name is pressly's goose too), Cursor and Copilot (no magpie routing), and the apps (Cline, Hanako, WorkBuddy, ZCode, Claude Desktop, OpenChamber, Alma, Cindy); and the library's skills, MCP and instructions for the new WSL agents, which wslTargetOf still gives only Claude Code, Codex, Pi and OmO. Nothing ran on Windows or in a real WSL. wsl_more_test.go, on fake distro roots under temp dirs with the host's variables pointed elsewhere: TestWSLProbeFindsMoreAgents (each folder and command in the probe, none for grok and fx, kimi-cli by its command), TestWSLMoreAgentsDiscovered (all fourteen listed, no command, UA or aliases), TestWSLMoreAgentsPick (each agent, mirrored and NAT: its file in the distro names the distro's gateway, no 127.0.0.1 under NAT, Check passes, Sync keeps it, the notice; this machine's home and the folders its variables name untouched), TestWSLMoreAgentsStopped (nothing asked nor opened, the last value shown, options, a pick starts the distro and writes there) fail without the change; TestWSLStoppedPickFindsItsFiles fails without the warm rebuild (the pick wrote a second opencode.json beside the .jsonc). go vet ./internal/..., go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build and vet ./internal/..., GOOS=windows go test -c ./internal/agent/ ./internal/library/, and go test -tags nogui -count=1 ./... under a temp HOME pass (TestFXInState failed once on its TempDir cleanup race, passes on the rerun; untouched). | ||
|
|
f3b45634a3 | agents: Droid, Qoder, OpenHanako, WorkBuddy, OpenCode and ZCode no longer get an output limit above the model's context window (#347) | ||
|
|
4eead4d4e0 | agents: the effort picked for Cline and Qoder is the one they use — Cline's reasoning is written {enabled:true,effort} ({enabled:false} for none), as its own pickers leave an enabled false that drops an effort beside it, and such a one reads as none; Cline's VS Code extension (4.x), which takes its provider, model, base URL and key from globalState.json and secrets.json before providers.json, has those set too where they are, stashed and put back on the way out, and $CLINE_DATA_DIR is honoured. Qoder (1.1.6x) keeps each model's effort in model.preferences and moves model.reasoningEffort there once: magpie sets the model's preference (a model id with dots too), carries the effort in use to a model with none of its own, and keeps reasoningEffort for older Qoders. Cline's desktop app keeps its composer's model and effort in its web view's storage, which magpie leaves alone; its notice says to pick there | ||
|
|
b87a3ce360 | agents: Qoder is known as Qoder, not Bun — Qoder CLI is a Bun single-file build whose requests carry Bun's User-Agent and nothing of Qoder's, so magpie's provider in Qoder (and Qoder CN) now carries the key magpie-qoder (magpie-qoder-cn), which the gateway knows an agent by before its User-Agent: usage, the routing view and the models it is shown say Qoder. A Qoder wired before with the key magpie is still magpie's and gets the new key on the next sync, as magpie starts | ||
|
|
55afcdd4bb | agents: Qoder CN — qoderclicn, the China site's build of Qoder's CLI, is the same CLI with its own accounts and its settings in $QODERCN_CONFIG_DIR, ~/.qoder-cn by default; magpie wires it as it does Qoder, a magpie custom provider with every magpie model and model.name/model.reasoningEffort, as its own agent | ||
|
|
cae88f031c | agents: Qoder — magpie's models in Qoder's CLI (1.1) as a "magpie" custom provider in ~/.qoder/settings.json ($QODER_CONFIG_DIR): picking magpie/<model> or a routing group writes the provider, with every magpie model, its context, output, images and the efforts it takes, and makes it model.name; the effort is model.reasoningEffort. The comments and entries of the user's settings stay, and stepping out of magpie takes its provider away and puts back the model the user had. Qoder offers custom providers only to a signed-in account whose plan has BYOK. It asks every model for enable_thinking, which OpenAI's API refuses, so that is dropped for openai.com. Tested live: magpie → settings.json → qodercli -p → magpie's gateway → upstream, the reply streamed back |