4794de398ea8337d223a91e207181c56fcf4ad76
66
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e528aeb3ce |
agent: DevEco Code, Huawei's OpenCode, as an agent (#1885)
foobra asked for DevEco Code (npm @deveco/deveco-code), Huawei's
HarmonyOS coding agent. It is OpenCode underneath, so it joins through
openCodeLike as MiMo Code did (
|
||
|
|
c3bbf16022 |
agentplug: an agent plugin's keys are written in the order it gave them (#1890)
What: connect's result is taken from the module as JSON text (moejs AppendJSON keeps JS insertion order) instead of rt.ToGo, which made a Go map at every level. An object or array connect returns reaches the writer as a json.RawMessage, so edit.SetJSON writes it in the plugin's order; strings, numbers, booleans and null are their Go values as before (the gateway-key mark still matches a string). edit.SetYAML now takes a json.RawMessage too, as a block-style node in the text's order (it would have written the bytes as a list of ints), and the env format writes it compact as before. Why: Kilo's agent plugin (magpie-community/plugins#90) returns each model's effort variants weakest first, low, medium, high, the order Kilo lists them in. Go maps marshal sorted, so Kilo showed high, low, medium. magpie's own OpenCode wiring already keeps order (openCodeVariants). The key paths connect returns are still applied in sorted order: each is a separate edit, and the user's file around them is untouched. Siblings: rt.ToGo's other caller (middleware's string lists) writes no file; the Library's MCP block for a plugin agent is built by magpie, not returned by the plugin. Run: - TestPluggedKeepsPluginOrder (Kilo-shaped connect, a kilo.jsonc with a comment, a theme, $schema, a provider of the user's own with keys zeta, alpha and a trailing key) and TestPluggedKeepsPluginOrderYAMLAndEnv. With agentplug.go put back: FAIL, variants written high, low, medium and provider keys sorted. With yaml.go put back: FAIL, the object written as a list of byte values. Both pass with the change. - gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., the three builds: OK. - go test -tags nogui -timeout 40m ./... under a scratch HOME: all ok. (A first run with the default 10m timeout timed out in internal/gateway while four other sessions' suites ran on this box and the disk was full; the gateway package took 973s under that load and passed.) - Real use, sandbox HOME: this build, `magpie plugin add` of packages/kilo at plugins PR #90 head b67360cb7, a provider whose fake-chat has efforts stored high, low, medium; `magpie kilo magpie/fakeup/fake-chat` wrote variants low, medium, high with the user's comment, $schema, theme and own provider in place, and @kilocode/cli 7.8.8 `kilo models magpie --verbose` lists them low, medium, high. `magpie kilo default` put the file back; the only difference is Kilo's own one-time permission migration. |
||
|
|
fa44fde461 |
netproxy: a proxy's user and password stay out of every log line, error and status that names it (#1886)
What: netproxy.Redact is the one place a proxy address is made fit to show. It is the rule |
||
|
|
4419ebf7d6 |
cli, agent: magpie <agent> <field> shows that field and a field's name or DEFAULT is no longer written as the agent's model (#1129, waitingsnow)
What: `magpie codex model` wrote model = "model" into config.toml (and
applied.json, stash.json); any agent's field name given alone, or as a
value, was set as its model, and `magpie codex DEFAULT` wrote
model = "DEFAULT". Now:
- `magpie <agent> <field>` (any case) prints that one field and writes
nothing;
- a field's name given as a value is refused with a hint
(`magpie claude effort Ultracode`);
- DEFAULT in any case takes magpie out, as `default` does;
- Claude Code's tier names (opus/sonnet/haiku/fable) still set the model,
since agent.ModelAliases marks them, and the agent's help says so.
agent.Field matches key and label in any case; agent.Running is a var
so the cli tests can say Codex isn't open.
Why: ported from waitingsnow's #1129 (commits bbe75c91f, 00bb38581,
244b24a67) onto internal/cli, where the CLI moved after the PR was
opened. The PR's --help part landed earlier as
|
||
|
|
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).
|
||
|
|
1f0ff81dfc |
agent: Grok App's own route picked in magpie is taken, and Disconnect can put one back; a sync that isn't connected writes nothing (#1625)
Follow-up to fjrtdk's commit before this one, which this keeps: magpie never names itself as Grok App's route. - Set refused every own route (errGrokAppRoute) while Options still offered them, so the picker showed choices that only errored. It also broke Disconnect: when unwire leaves no route (Use set it to magpie, nothing stashed), Disconnect sets connect.was's route back through Set, got the error and stopped half done. An own route now takes magpie's channel out and is written as [models] default, the way picking another provider leaves magpie on other agents. That route can't be magpie, so the App's sign-in is never touched. - Sync ran rememberRoute/releaseRoute before checking for the channel, so every user with Grok App installed but not connected got stash entries. Now it returns before them unless the channel is there or the route is still magpie (an older magpie's takeover to put back). - Check again warns when the route is magpie and the channel is gone, which that commit dropped. - The notice uses the App's own labels (Settings › Account, Use; ja 「使う」, de Einstellungen › Konto / Verwenden, from grok-app 0.2.40's settings.nav.account and prov.useThis) and says a chat can pick magpie's models in its model picker (composer_prefs_set, which doesn't move the route). - Sibling: rtk init has no grok agent for Grok Build either (rtk 311ebcb agents: claude codex copilot cursor droid gemini hermes opencode pi trae vibe antigravity), so Grok Build is in rtkNoHook too. Run: gofmt -l clean; go vet ./... on darwin, GOOS=linux -tags nogui and GOOS=windows clean; go test ./internal/gateway ./internal/agent ./internal/library -count=1 pass; node --test i18n-keys and agent-notice-lang pass. Broken by hand: that commit's grokapp.go fails TestGrokAppOwnRouteStays, TestGrokAppDisconnectPutsTheRouteBack and TestGrokAppSyncUnconnected; dropping the Check branch fails TestGrokAppSyncUnconnected; dropping rtkNoHook["grok"] fails TestRTKNoHookGrokBuild. Not tried: the Grok App GUI itself; the config format and behaviour are from grok-app 0.2.40's source. Co-authored-by: fjrtdk <fjrtdk@gmail.com> |
||
|
|
ea3d480edf | agent: Grok App keeps its own route; magpie is a custom provider under Accounts, and the Library writes instructions, MCP and skills on agent-home (#1625) | ||
|
|
0102915fe0 |
gui: Tuned for you lets a compaction window be picked, each with its estimated extra tokens and compactions (#1860)
MrMengJ applied the advised 200K auto-compaction window and wanted 250K or 300K instead, seeing what each costs against the cheapest. A compaction row now has "Other window…", which opens the app menu (never a native select) with every value of the curve the card already replays. Each says its estimated extra tokens over the fewest (or "Fewest tokens" / "As few tokens") and about how many compactions it would have made over the range. The head says it is estimated from the reader's calls. The one picked is put in through /api/tune/apply like Use, with Undo. tune.Point gains compacts, counted by the same replayCompact that prices the point, so tokens and compactions come from one model. Run: go test ./internal/tune ./internal/gui; TestCompactCurveCountsCompactions (compactions fall as the window grows; the last point is close to Facts.Compacts). gofmt -l; go vet internal/tune on darwin, linux -tags nogui, windows. GUI: context-*, gui-zh-tw/ja/de, compact-at, click-scroll, i18n-keys in chromium and webkit, 144 pass. The new context-tune test covers 5 languages at 360 and 1100px: menu inside the window, 300K ticked, notes for 250K and 160K, picking 250K posts apply with no page scroll, Escape posts nothing. On HEAD~ assets context-tune fails 22 of 23. Not run: against a real Claude Code settings.json (the apply path is unchanged from Use). |
||
|
|
6e5f4fc97f |
gui: Tuned for you names its advice "Fewest tokens" and says a compaction window is a token estimate, not what the agent keeps (#1854)
cnlove7777777-art: the card called 230K -> 150K "best for you" on token savings alone, while compacting sooner may lose more of a long coding task. A retention benchmark isn't built now; the card says what it measures instead: - the advised value's label is "Fewest tokens", not "Best for you"; - a compaction row that advises a change adds "A token estimate only: it doesn't measure how well the agent keeps the task after a compaction. The lower the window, the more often it compacts." Not on a window already the leanest, nor on the cache lifetimes. - zh, zh-TW, ja, de translations; agent-wiring.md says the same. Run: context-tune.test.cjs (new assertions on label and caveat) passes in Chromium and WebKit, 360 and 1100 wide, en/zh/zh-TW/ja/de; on origin/main's assets it fails 11 of 12. context-*.test.cjs, gui-zh-tw, gui-ja, gui-de, compact-at, i18n-keys: 99 pass, 0 fail. Not tried in the real app window. |
||
|
|
403f3845e2 |
gateway: Codex's spawn_agent names every model also when Codex hands it to the lead through a tool search, as it does on 0.162 (Gearclickist on Discord)
Gearclickist, after v0.1.1214: the lead still saw only five models for
its subagents. v0.1.1214 (
|
||
|
|
e59de0c967 |
agent, gui: Codex's magpie API sign-in says its Chrome control needs ChatGPT, so pick ChatGPT to keep it (#1824)
What: the "magpie API" option of Codex's sign-in (internal/agent/codex.go; the GUI picker and the TUI both show the option's note) now ends with "Codex's Chrome control needs the ChatGPT sign-in, so pick ChatGPT to keep it", in en, zh, zh-TW, ja and de (i18n.js). The login field's comment and docs/subsystems/agent-wiring.md say why. Why: with magpie as Codex's provider (no requires_openai_auth), codex-rs's getAuthStatus returns authMethod null and no token, so Codex's Chrome control says "Codex auth token is unavailable". Reproduced earlier with real codex 0.162.1 in a sandbox CODEX_HOME; the ChatGPT sign-in (openai_base_url) keeps the token. Nothing magpie writes can bring the token back on magpie API without turning the Codex app into a ChatGPT account, so the option says what it costs. Run: codex-signin-always.test.cjs (now also zh-TW, and asserts the API note names Chrome and ChatGPT in the page's language) in Chromium and WebKit at 1100px and 440px, 10/10 pass with playwright 1.62.0; with origin/main's i18n.js it goes red for zh, zh-TW, ja, de. gofmt -l clean; go vet ./... on darwin, linux (-tags nogui), windows; go test ./internal/agent ./internal/gui ./internal/tui green. Not run: the Windows box, the real Codex app's picker. |
||
|
|
3c4f8f9aed |
gateway: the models added to Codex's spawn_agent are headed neutrally, naming neither magpie nor Codex's limit (Gearclickist on Discord)
|
||
|
|
5d33f060b7 |
gateway: Codex's spawn_agent names every model a subagent may be put on, not only the first five (Gearclickist on Discord)
Gearclickist turned on "Codex subagents on any model", but when Codex dispatched subagents only a few models could be picked. Codex itself caps the list: spawn_agent's description names only the first five show_in_picker models of its catalog (codex-rs child_config.rs MAX_SPAWN_AGENT_MODEL_OVERRIDES, multi_agents_spec.rs spawn_agent_models_description), Codex's own ahead of magpie's. Yet it takes any catalog model by name (find_spawn_agent_model_name). So the lead saw none of magpie's models. spawnAgentModels (codex_spawn_models.go) adds the rest of the catalog Codex was handed after Codex's own list, under a line of its own, at most 200. It covers spawn_agent at the top level and in Codex's multi_agent_v1 namespace, at CodexPath (codexBackend) and at /v1/responses for Codex (handle). - At CodexPath the list is Codex's own listed models less those hidden on the Agents page, then CodexListed unless Codex is held to its own. - At /v1 it is CodexCatalog under the key's allowance. - A lead the ChatGPT backend answers in multi-agent V2 seals its subagents' tasks for a ChatGPT account (#619), so it is offered Codex's own only. Only the tool's description changes, never base_instructions. With V1 on, it does change in requests to the ChatGPT backend too. Not covered: the model_catalog_in_context feature (under development, off by default) puts a five-model catalog in context, and it is not widened. Run: - go test ./internal/gateway ./internal/agent -count=1 under a sandbox HOME: ok. - TestSpawnAgentNamesEveryModel uses 40 models on a real Codex 0.162.0 request (testdata/workdir/codex-0.162.0.json). Its 4 subtests are CodexPath, /v1, a sealed V2 lead and a V1 lead, and all pass. - With spawnAgentModels returning body by hand: CodexPath, /v1 and V1 go red. - With the sealed rule taken out: V2 goes red. - go vet on darwin, GOOS=linux -tags nogui, and GOOS=windows; gofmt -l is clean. Not verified: a real Codex lead picking one of magpie's models past the fifth from the longer list. |
||
|
|
7f03d320d0 |
agent: a Codex thread started on CC Switch's OpenAI mirror goes through magpie while a magpie model is on, so reopened it isn't refused by ChatGPT for the magpie model picked in it (#1796)
WardLu's old threads say model_provider "custom": CC Switch's mirror of the official OpenAI provider ([model_providers.custom], name "OpenAI", requires_openai_auth, no base_url). magpie takes Codex onto a magpie model by openai_base_url, which Codex applies to its built-in "openai" provider only. A thread resumed on "custom" therefore went straight to chatgpt.com with the magpie model picked in it, and ChatGPT answered "The 'group/intent-auto' model is not supported when using Codex with a ChatGPT account"; magpie's log never saw it. While Codex goes to magpie by the base URL, takeMirrors now gives each such mirror magpie's ChatGPT backend (codexURL) as its base_url, as failover already does for a mirror that is Codex's current provider, and records the ids in the stash (codex.mirrors). giveMirrors takes the base URL off again when Codex steps off magpie (one of its own models, reset, Disconnect), leaving one changed since as it is. A mirror a profile names is the user's and is left alone. isCCSwitchMirror still counts a taken mirror as a mirror, so its models stay grouped under OpenAI and ccSwitchTables doesn't treat it as a relay. No detection or guide was added: with the requests reaching magpie the old threads keep their history and model. Moving them onto another provider is already the Sessions page's Move (#887), which rewrites every rollout of the thread (resumed _segment files too) and the state DB row. Run: - go test -tags nogui ./internal/agent -run 'CCSwitch|Mirror|Codex': ok. TestCodexTakesCCSwitchMirrorForItsThreads fails on the code before this commit ("the mirror isn't through magpie"). - gofmt -l, go vet (darwin, linux, windows), full go test ./... before the push. Not tried: a real Codex resuming a "custom" thread against a real ChatGPT account. The same base_url on a requires_openai_auth mirror is what mirror failover (#504) has written since it shipped. |
||
|
|
ce71b22cfe |
gateway: a Claude model a provider writes with a dot (Copilot's claude-opus-5.5, claude-sonnet-5.5, claude-haiku-4.5) is listed to Claude Desktop by its dashed id, so Claude Code knows it (#1819, mdwsk88)
Claude Desktop's Code tab runs Claude Code on the id magpie lists a model by. claudeLooking lists a Claude model with reasoning levels as magpie-<n>.anthropic.<model>, which Desktop and Claude Code read as that Claude model, but claudeModel matched dashed versions only. Copilot writes a version with a dot, so each of its Claude models fell to mythos-magpie-<n>, a model Claude Code doesn't know: Opus 5.5 ran at 32000 output tokens and effort high (128000 and medium for the model it knows), and Haiku 4.5, the haiku tier, was sent output_config.effort, which Copilot answers with 400 "model claude-haiku-4.5 does not support reasoning effort". claudeModel now dashes the version first (provider.ClaudeDashed). A request is still served by <n> alone (aliased), so Copilot still gets its own claude-opus-5.5. An id with a suffix (claude-sonnet-4.5-thinking) and other vendors' ids are listed as before. This is mdwsk88's fix from mdwsk88/magpie@51a5ad80, reviewed line by line and taken with its tests. Sibling: ClaudeDashed and ClaudeUndashed knew opus, sonnet, haiku and fable but not mythos, while desktopClaude, claudeLine and claudeVersion know it. Claude Code 2.1.296 (read from its binary) matches claude-mythos-5-1 by substring before claude-mythos-5, so a dotted claude-mythos-5.1 would read as Mythos 5; it is now dashed like the others, in Claude Code's settings and in Desktop's list. The other matchers of Claude ids (agent's claudeName, gateway's claudeFamily, claudeVersion, claudeLine, provider.sameModel) already take a dot. ClaudeFast's list is dashed but applies to api.anthropic.com alone, which never writes a dot. Run (go1.26.8 toolchain, sandbox HOME, private GOCACHE/GOMODCACHE, -tags nogui): - With the old desktop.go and claudedash.go put back, the new tests fail: TestClaudeDesktopEffortIDs "copilot/claude-opus-5.5 listed as mythos-magpie-5238445297, want ^magpie-\d{10}\.anthropic\.claude-opus-5-5$" (and the opus-4.6, sonnet-5.5, haiku-4.5, dated sonnet-4.5 and mythos-5.1 rows), TestClaudeDesktopDottedClaudeReachesItsModel "listed as mythos-magpie-9584025798", TestClaudeDashedOnlyClaudeVersions "ClaudeDashed("claude-mythos-5.1") = "claude-mythos-5.1"". Green with the change. - go test ./internal/gateway ./internal/provider: ok; -run 'Desktop|Claude' over internal/agent too: ok. -race -count=3 -run TestClaudeDesktop ./internal/gateway: ok. - gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: clean. Not run: a real Copilot account or the real Claude Desktop through this build (the reporter's own run used a stub upstream and real Claude Code 2.1.295); Windows and WSL; the full go test ./... (machine loaded). Co-Authored-By: mdwsk88 <11055210+mdwsk88@users.noreply.github.com> |
||
|
|
e6753190cd |
agent: a model picked for omp's default role joins its enabledModels list when there is one, so omp starts on it and doesn't pick another (#1769)
real-jacket: with enabledModels in ~/.omp/agent/config.yml, magpie wrote only modelRoles.default, and omp kept starting on a model of the list. omp holds a new session's default role to that list while it names anything (main.ts buildSessionOptions, sdk.ts resolveAllowedModels and pickDefaultAvailableModel); its other roles resolve against every model it has, so only the default role is held to it. Pi had the same rule, fixed in #160. omp_scope.go: a model picked for the default role is added to the end of a list that doesn't already take it in, by name or by one of omp's globs (Bun.Glob, where * doesn't cross "/"), comments and order kept (edit.EditYAMLNode, new). No list, or an empty one, is left as it is: omp then takes every model. Entries scoped to folders ({path, models}) are the user's and never changed. Disconnect takes the plain magpie/... entries out once nothing else in config.yml is on magpie (a list left empty goes, never []); a scoped entry on magpie still counts as in use. A renamed provider's entries are renamed once (ompScopeOnce). Check reports a default role on magpie the list leaves out as drift, which Reapply mends. docs/subsystems/agent-wiring.md says the same. Run: - omp_scope_test.go: the default joins the list (plain, glob, level suffix, comments kept), a list that takes it in or none is left alone, Disconnect clears magpie's entries and keeps the user's and scoped ones, and the leaving-out is drift. Each goes red with its part taken out (ompScopeWith not appending, dropMagpie not calling ompScopeWithout, Check without the list). - go test -tags nogui ./internal/agent ./internal/edit. - gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., sandboxed go test ./... at the rebased head. Not run: a real omp binary starting a session on the config written. Pi has no RenameRefs, so a renamed provider's magpie/<old>/... entry stays in Pi's enabledModels (not changed here). |
||
|
|
e4134d1fb7 |
agent: Codex's proxy is worked out from the login shell's NO_PROXY and HTTP_PROXY and macOS' HTTP entry alone, as its reqwest reads them, so "Codex 经代理连 magpie" no longer shows while Codex goes direct (liu_dyj on X)
liu_dyj: with the VPN on, magpie said Codex reached magpie through a
proxy that didn't pass its requests on; versions before
|
||
|
|
24350a3722 |
agent, gateway: Claude Code on a model Anthropic doesn't review gets auto mode's server review turned off, so it no longer says magpie isn't eligible (1EFLOPS on X)
1EFLOPS runs Claude Code through magpie on Codex's gpt-6.1-sol. In auto mode, Claude Code 2.1.296 says "this session isn't eligible because your requests go through 127.0.0.1:3425 ... ask your gateway to implement https://code.claude.com/docs/en/auto-mode-classifier-billing". What the page asks of a gateway: pass the anthropic-beta header (dangerous-tool-use-2026-09-03), the request's `safeguards` field, and `safeguard_results` in the reply through unchanged, and leave tool-use ids alone. The results are verdicts from Anthropic's own safety classifier. For a gateway that can't provide them, the page's remedy is CLAUDE_CODE_AUTO_MODE_SERVER=0. Pro, Max and Team plans never see the notice. In the bundle, Claude Code falls back on server_unsupported, server_unavailable_disabled or server_no_result, and the notice shows whenever there's no real verdict. Only that variable removes it. Per route: - Claude subscription bridge, Anthropic API key, relays in front of Anthropic, Bedrock and Vertex: already pass the beta, `safeguards` and `safeguard_results` through ( |
||
|
|
ee7a9b24a6 |
agent: Grok App is an agent magpie connects: a magpie provider channel with magpie's models and their efforts (#1625, fjrtdk)
fjrtdk asked for Grok App (RongleCat/grok-app, a desktop GUI over the Grok
Build CLI) as a full agent: MCP, skills, RTK, models and effort.
What was already there, read in the App's source:
- MCP: the App reads ~/.grok/config.toml's [mcp_servers] in both of its
modes and hands them to the CLI it starts, so the Grok Build row's MCP
sync already reaches it.
- Skills: Grok Build's ~/.agents/skills, synced from the Grok Build row.
- RTK: rtk has no installer for Grok Build, so there is nothing to wire.
What was missing is models, and that is what changed:
- internal/agent/grokapp.go: a new agent, "grok-app" (alias grokapp), for
the App's agent-home/config.toml under its data folder: GROK_APP_HOME,
else ~/Library/Application Support/com.grokapp.grok-app or ~/.grok-app
on a Mac, %APPDATA%\grokapp\grok-app\data (and two older places) on
Windows, $XDG_DATA_HOME/grok-app or ~/.grok-app on Linux; the first
that exists.
- Connecting writes a [model.magpie] channel in the App's own format
(its custom routes): model, base_url = the gateway's /v1, name,
api_key (magpie-grok-app, so usage says the App), api_backend =
"chat_completions", app_provider_mode = "generic", app_models and
app_efforts as JSON strings (the App unquotes them with serde_json),
supports_reasoning_effort, app_supports_vision for a model that takes
images, and context_window when magpie knows it. app_models lists
magpie's models with their effort levels ("none" left out), so the
App's model and effort pickers show them.
- It sets [models] default = "magpie"; what was there is stashed, and
Disconnect puts it back and drops the channel: the file is
byte-identical to before (TestGrokApp).
- A sync keeps the model and the default effort the user picked in the
App while magpie still serves them, and writes nothing when nothing
changed.
- Picking one of the App's own routes (the official "grok", or a
channel of the user's with a base_url) takes magpie out.
- The notice says to start a new chat or restart the App, which reads
its providers when it starts an agent; translated in i18n.js (zh-CN,
zh-TW, ja, de) and listed in NOTICES.
- agents.go, agentenv.go (GROK_APP_HOME), docs/reference.md,
docs/subsystems/agent-wiring.md, both READMEs' agent lists.
Picking magpie in the App is a custom route, so the App runs that agent in
its independent mode (its own #557): it clears agent-home's auth.json
rather than syncing the official sign-in. ~/.grok is never written.
What was run:
- go test -tags nogui ./internal/agent ./internal/agentenv ./internal/gui:
ok. Full go test -tags nogui ./... under a temp HOME: ok.
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui: ok.
- Broken by hand, each red: context_window written quoted (TestGrokApp);
the user's picked model ignored (TestGrokAppSyncKeepsTheirs); their
default effort dropped (SyncKeepsTheirs); Disconnect not unstashing
(TestGrokApp); a no-op sync writing (SyncKeepsTheirs); "none" listed
as an effort (TestGrokApp).
- Real use in a sandbox HOME: a built magpie on 127.0.0.1:3681 with a
fake upstream; `magpie grok-app magpie/fake/echo-1` wrote the channel;
the real grok 1.0.50, started as the App starts it on a custom route
(GROK_HOME=agent-home, --model magpie), answered through magpie, the
upstream saw echo-1 and usage.jsonl counted agent "grok-app". `magpie
grok-app default` restored the file (the only difference was grok's own
[marketplace] line written while it ran). ~/.grok/config.toml untouched.
Not tried: the real Grok App GUI (it would sign in through the keychain
and ~/.grok), a model with effort levels end to end, Windows and Linux
paths beyond TestGrokAppDir.
|
||
|
|
94fd332c35 |
agent, gui, tui: an agent's own models can be left out of its model picker (#1642, MizuIro-H)
DeepSeek Harness offers its own DeepSeek models beside magpie's in its
model picker, and nothing in magpie could leave them out: `magpie visible`
and the model list only cover magpie's catalog. An agent's model list now
has a switch at the top, "Show {agent}'s own models", for an agent that
has models of its own. Off, its picker offers magpie's alone.
- settings.OwnModelsHidden lists the agents whose own models are left
out. provider.OwnModelsHidden / SetOwnModelsHidden read and write it.
POST /api/settings keeps it: the Settings page doesn't send it.
- agent.Picks(f, cur) is a field's options without the agent's own
(no Ref, a value). It leaves them in when the field has no magpie
option at all, and always keeps the value the agent is set to now, so
the user's own choice isn't dropped or rewritten. The GUI's agent
fields and the TUI picker read it. The CLI still sets an own model by
name.
- GET /api/agent-models/{id} says `own` and `ownHidden`. POST
{ownHidden} sets it. The GUI's switch rolls back if the save fails,
and closing the list filters the picker at once, before the state is
read again. The order view (magpie's models alone) hides the switch.
- Strings in zh, zh-TW, ja, de.
Run: go test ./internal/agent ./internal/provider ./internal/settings
./internal/tui, all green. go test ./internal/gui is green apart from
TestTrayCellClickReleasedPanel, which fails the same alone on
origin/main
|
||
|
|
4b1b5dd822 |
agent: CC Switch's unified-history mirror waits for the proxy check and drops failover on quit too, tested on its own bytes (xuxing0727 on X)
CC Switch with "unify Codex session history" runs the official sign-in
as model_provider = "custom" (name OpenAI, requires_openai_auth,
supports_websockets), so failover goes on that table's base_url, not
openai_base_url.
|
||
|
|
221e24a3c7 |
agents, gateway: Codex's subagent model offers every provider's models, not only ChatGPT's (#1633, laacmilan)
The Agents page's Codex "subagent model" field (settings.CodexSubagentModel,
which the gateway puts x-openai-subagent collab_spawn requests on) listed
only the ChatGPT accounts' models, and its setter refused any other
provider's. A user whose lead runs on a chat provider (Token中心, 智谱Plan)
couldn't put its subagents there.
- provider: CodexSubagentModels is Codex's shown catalog
(CatalogFor("codex"), so hidden or unpicked models stay out), ChatGPT
accounts first, routing groups included. SetCodexSubagentModel takes any
provider/model or group id, refuses a bare Codex name.
CodexSubagentUnserved says "magpie doesn't serve it now" for a non-ChatGPT
id that isn't served. CodexAccountModel exported.
- gateway: codexSubagentPick gets the body. When the lead ran on the
ChatGPT backend the task arrives sealed (encrypted_content), and only a
ChatGPT account can open it: set to another provider, such a subagent
stays on the model asked for, with Kept = sealedKept in the route trace
(#1613's constraint; the reverse, a chat lead with a subagent on ChatGPT,
was already handled by
|
||
|
|
f156d90460 |
agent, gui: Codex isn't handed to a magpie it can't reach, through a proxy or after magpie quits (Muma102kMichael, Leon920717, thisisvainxx on X)
Muma102kMichael (Windows): after magpie took Codex over, every project and every new chat got 502. Codex's reqwest sends its requests for http://127.0.0.1:3425 through HTTP_PROXY/ALL_PROXY or the system's proxy, and only an exact IP or a CIDR in NO_PROXY (on Windows, with no NO_PROXY, the bypass list with "*." removed) keeps 127.0.0.1 off it: "127.*" and "localhost" don't, and macOS' exceptions aren't read. A proxy in global mode answers 502 for every request. With [features] respect_system_proxy Codex asks the system alone and goes direct with no proxy set there. Account failover, which magpie writes uninvited when 2+ ChatGPT accounts are on, put all of Codex's traffic, its own models included, behind that proxy. - codex_proxy.go works out Codex's proxy the way Codex does and probes GET / through it (must answer as magpie). Failover waits for that probe and isn't written while the proxy doesn't pass Codex on; one written before goes again. - New drift kind "proxied": the Agents pill says Codex reaches magpie through a proxy that doesn't pass its requests on, How to fix names the fix (DIRECT rule for 127.0.0.0/8, NO_PROXY=127.0.0.1, or 127.0.0.1 in Windows' bypass list), and the dialog has a one-click Disconnect from magpie (also on unreachable drift). - Leon920717: after quitting magpie Codex kept retrying. The app that serves the gateway now takes failover out in OnShutdown (EndCodexFailover); the next start's Sync writes it again. A connected Codex is kept (its model is magpie's; Disconnect restores). A kill or crash still leaves failover in place. - thisisvainxx: "several restarts". Codex's app-server keeps the base URL it started with, and KeepCodexDaemonCurrent ends with magpie, so EndCodexFailover restarts it when no codex session is on it. Run: - real codex-cli 0.162.1 in a sandbox CODEX_HOME against a fake 502 proxy and a fake gateway: NO_PROXY=localhost,127.* -> 30 POSTs to the proxy; NO_PROXY=localhost -> proxy; NO_PROXY=127.0.0.1 -> gateway; respect_system_proxy with HTTP_PROXY set -> gateway directly. - go test -tags nogui ./internal/agent/ (full package, 465s, ok) and the new tests after the daemon change; each new test went red with its guarantee broken by hand (failover gate, drift, EndFailover, daemon restart on quit). - node --test agent-proxied/agent-unreachable/agent-failover/ agent-disconnect-preview: 104 passed, chromium + webkit, en zh zh-TW ja de, window and panel. - gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui clean. Not tried: the quit path in the real app, on the Windows box, or whether computer use / remote connection broke for this same reason. |
||
|
|
d82985eee1 |
agent: a routing group whose members are all best on Responses is asked there by Pi, omp, droid and dsh, so its tool-call arguments stream (#1594, ObsidianArch02)
magpieModels gave a routing group no native API, since its members may each want another. Pi, omp and droid then asked every group on Chat Completions, and dsh put it on its Chat route, even a group of GPT members all served on Responses. The gateway translated each answer from Responses to Chat, and that translation holds a tool call's arguments until the call ends (#613), so Pi's Code Mode saw no code until the whole call had been generated. A group now has APIs ["responses"] when every member, nested groups' included, is served best on Responses (allResponses over the group's members, by Provider.Native). Any other group keeps none: one with a Chat member, and a Messages-only group too, as the gateway knows whether a Claude thinks adaptively by its own model id, not the group's. dsh moves a start on such a group to its Responses route (dshStartOnItsRoute); a dsh session resumed on it asks for the model once, as for any model that moved routes. The rest of the request (a protocol picked per group, conversion shown per request) is not in this commit. Verified: - TestPiModelsAskedOnTheirNativeAPI: auto-gpt-5-5, a GPT group and a group of that group get openai-responses; a group with a Chat member and one of Messages-only members get none. Without the route.go change it fails for the three Responses groups. - TestOmpModelsAskedOnTheirNativeAPI: the same for omp. - TestGroupOnResponsesRelaysArgumentDeltas (gateway): a group of two Responses-only members asked on /v1/responses relays each function_call_arguments.delta as the vendor sent it, on /responses. It guards what this change relies on, and passed before it too. - go test ./internal/agent ./internal/provider, gofmt -l, GOOS=linux and windows go vet -tags nogui. - Not tried with a real Pi against a real group. |
||
|
|
76db4c6c28 |
main, agent: --help on any command or agent only prints its usage, and Snow and Gemini CLI refuse a value they don't know instead of taking magpie out (#1457, blackrion)
`magpie snow --help` printed "✓ Snow CLI model --help" and did what
`magpie snow default` does. It deleted profiles/magpie.json, put back the
active profile, and wrote "--help" as advancedModel into the profile it
went back to. There were two causes:
- run's agent forms took any second argument as a model. The `len(args)==2`
branch special-cased only `default`.
- Snow's model Set, on magpie's profile, treated a value no profile of the
user's is on as "leave, and write it into the profile left for".
The arguments were the class, not Snow alone. Under the old code, `magpie
claude --help` and `magpie codex --help` wrote "--help" as Claude Code's
and Codex's model, and `magpie save --help` saved a profile named
"--help" (the new guard test caught each of these).
What changed:
- help_cli.go and run: -h or --help anywhere in the arguments, or help as
the word after the command, prints that command's usage and returns
first, before run reads, moves or starts anything. It prints the
command's own usage where it has one (model, group, group rule, library,
plugin, quota, sessions, search, visible, webdav, s3, claude-code), its
lines of magpie's usage otherwise, and for an agent its forms and
fields. The usage gains a `magpie <command> --help` line.
- `magpie <agent> …` refuses any other argument starting with "-"
(negative numbers aside): "unknown flag X: nothing was changed".
- snow.go: on magpie's profile, a model that is neither through magpie
nor any profile's model is refused, and the files stay as they were.
A `magpie/<x>` that isn't in the catalog is refused on or off magpie's
profile; it used to fall through to the same leave. A model of one of
the user's profiles still switches Snow there, and empty still goes
back to the profile they were on.
- gemini.go, a sibling found by auditing every agent's Set: provider is
Gemini CLI's first field, so `magpie gemini <a model with no option>`
reached it. It unrouted Gemini CLI (stashed key, sign-in and model put
back) and only then said "unknown provider". An auth it doesn't know is
now refused before unroute. The audit found no other Set that leaves
on an unknown value. The other model Sets write an unknown value as the
agent's own model, which is the intended own-model pick. The on/off
provider fields of ante, claudedesktop, copilotjetbrains, cursorlocal,
pencil, t3code, workbuddy and zcode take any non-empty value as "on".
Both are left as they are.
- docs/subsystems/agent-wiring.md says the above.
Tests:
- TestHelpOnEveryCommandDoesNothing reads the commands from run's switch
in main.go's AST, so a new command is covered without a list to keep.
It adds every agent id. For each one it runs --help, -h and help in
several positions under a sandbox home, and checks that nothing is
written, the run returns within 20s and usage is printed.
- TestAgentHelpLeavesSnowWired is the reporter's case: Snow wired, then
`snow --help`, `-h`, `help`, `model --help` and `snow-cli --help`,
unknown flags, and `snow nonsense`. Snow's files must stay the same.
- TestSnowUnknownModelChangesNothing and TestGeminiUnknownAuthChangesNothing
cover the Sets.
What was run:
- Each test was run against the old code. Old main.go: the save, snow,
claude and codex subtests FAIL ("✓ saved profile --help" with
profiles.json written; "✓ Snow CLI model --help"; "✓ Claude Code model
--help"; "✓ Codex model --help"), and so does TestAgentHelpLeavesSnowWired.
- Old snow.go with old main.go: TestAgentHelpLeavesSnowWired FAILs with
Snow's files changed, and TestSnowUnknownModelChangesNothing FAILs with
`"--help" taken`.
- Old gemini.go: TestGeminiUnknownAuthChangesNothing FAILs with
`"nonsense-model" changed Gemini CLI`.
- All pass with the fix.
- In a sandbox HOME with pinned Go caches, at origin/main
|
||
|
|
26816de2f9 |
library, agentplug: an agent a plugin adds is given the Library's instructions, MCP servers and skills where its agent.library says (AlmarionAI on X)
Agent plugins wired models and keys only: library.targetOf had no case
for them, so the Library's instructions, MCP servers and skills never
reached an agent a plugin adds, while the announcement said the
Library carries over.
An agent export can now say
library: { instructions, mcp, mcpFormat, skills }
each a path (~ and $VAR expanded, as config is). mcpFormat names the
agent whose MCP file it is shaped like (agentplug.MCPFormats: claude,
codex, gemini, opencode, cursor, zed, ... 18 of the library's
mcpFormats). A format outside the list, or an mcp without one, keeps
the plugin from loading. library.pluginTarget makes such an agent a
Target, so it is written as any agent is: magpie's marker block in the
instructions file, servers merged beside the user's own (their fields
kept), skills linked or copied, Applied recording only magpie's part,
backups kept. Takes refuses a place the plugin doesn't name, and says
which agent.library key would give it.
Docs: docs/subsystems/library.md and agent-wiring.md; plugins.html
(en, zh, ja) gets the library field and what magpie does with it.
Run:
- internal/library/agent_plugin_test.go: TestPluginAgentGetsTheLibrary,
TestPluginAgentWithoutAPlaceIsRefused, TestPluginAgentMCPFormat,
TestPluginMCPFormatsAreWritten. With targetOf's plugin case and the
check() validation taken out by hand, the first three go red.
- e2e: a nogui build in a scratchpad HOME (env -i, no live configs),
`magpie plugin add` of a throwaway toy agent plugin; `library
instructions set/agents`, `library mcp add/rm` wrote and took back
only magpie's block and server, the user's "mine" server, its "note"
field and other keys kept, backups made; with mcp dropped from the
plugin, `library mcp add ... agents=toy` is refused naming
agent.library.mcp.
- go test -tags nogui ./... (one unrelated FIFO flake in internal/agent,
fixed in the commit before), gofmt -l clean, go vet for GOOS=linux
and GOOS=windows clean. No GUI code changed.
|
||
|
|
6b8dc4cdd8 |
proc, agent: magpie finds an agent CLI under the Node nvm's default names, not the folder whose name sorts last (v9 after v22)
proc.UserPath added "the newest-looking" nvm Node to magpie's PATH, the
last folder of ~/.nvm/versions/node/*/bin in string order. That isn't
the Node a terminal gets, and string order puts v9.11.2 after v22.12.0
and v22.3.0 after v22.12.0. So magpie could find, run and update a
codex/claude/gemini under a Node the user's terminal doesn't use (found
while answering 悠悠哥 on Discord,
|
||
|
|
9f407cafa1 |
agent, gui: an agent CLI found off the terminal's PATH says where it is (悠悠哥 on Discord)
悠悠哥 (macOS) saw "Codex 0.162.1 · 未接入" under 未设置 on the Agents page while `which -a codex` found nothing and ~/.codex wasn't there. Detected() is true when the agent's command is on magpie's own PATH, and proc.UserPath adds to it the folders users' tools go in (~/.local/bin, npm's prefixes, nvm's newest Node, bun, volta, pnpm, Homebrew), which a desktop app launched from the Finder needs. A codex left in one of those that the terminal's PATH no longer has (an npm install under a Node nvm no longer uses) is found, runs, and gives its version, so the row looked made up. Reproduced in a sandbox HOME: PATH=/usr/bin:/bin, no ~/.codex, @openai/codex 0.162.1 under ~/.nvm/versions/node/v22.12.0; after UserPath, Codex is detected with CLI 0.162.1. ChatGPT.app's bundled codex (Contents/Resources/codex-cli, 0.162.0-alpha here) is never on magpie's PATH and isn't what was found. The agent is still listed: the CLI is real and runs (a lazy-loaded nvm leaves the same folder off a login shell's PATH while the user does run codex from it). What changes is that it says so. CLI gains path (the file magpie runs) and offPath (its folder isn't in proc.LoginPath; false when the login PATH can't be told, or for a CLI found at a fixed path rather than through PATH). The Agents row shows "Not on your terminal's PATH" after the version, its tip and the version's naming the file and that it can be deleted if left from an uninstall; en/zh/zh-TW/ja/de. The note gives way at the narrow width, where the version's tip still says it. docs/subsystems/agent-wiring.md says how detection and the note work. Run: TestCLIFoundOffTerminalPath (red with OffPath forced false); agent-cli-offpath.test.cjs in Chromium and WebKit, five languages, 560 and 440px (16 failures on the old app.js), with agent-app-version, agent-cli-missing, cli-update and agent-update-all (66 pass); go test ./internal/agent ./internal/gui; full go test -tags nogui ./...; gofmt; GOOS=linux and GOOS=windows go vet -tags nogui on both packages. |
||
|
|
6536982756 |
edit: an agent's config saved with a UTF-8 BOM is edited through it and keeps it — magpie claude <model> no longer says "invalid JSON/JSONC" (#1534, AnxForever)
On Windows, PowerShell 5.1's `Set-Content -Encoding UTF8`, Notepad and
Claude Code channel switchers save ~/.claude/settings.json with a UTF-8
BOM in front. Claude Code reads such a file; magpie's JSON layer handed
the BOM to json.Valid and gjson, so `magpie claude <model>` failed with
"<path>: invalid JSON/JSONC" and the agent couldn't be wired at all. TOML
refused the same with "UTF-8 BOM is not supported", though Codex's own
parser (toml_parser's lexer) skips a BOM, and env/YAML files glued the BOM
to their first key's name.
The fix is at the package's two choke points, so every format and every
caller of edit.Read gets it:
- edit.Read returns the file without a leading BOM (the agent package's
own readers, Claude Desktop, Ante, Empryo, Snow, Pi MCP etc. go through
it).
- WriteAtomic puts the BOM back when the file it replaces starts with one
and the new bytes don't (keepBOM). The user's file keeps the encoding it
was saved in: the tools that wrote it may expect it, and the agent read
it with the mark before, so keeping it is the user's own bytes, not a
guess. A file without a BOM never gets one; an emptied file stays empty.
This is what astrbot.go already did for AstrBot's cmd_config.json.
- PatchJSON (bytes in, bytes out) reads through and keeps a BOM too.
- The TOML "BOM is not supported" error is gone with the case it named.
- Siblings read outside edit.Read: Claude Code's settings.json and CC
Switch's legacy config.json in the importer, and Crush's provider list,
trim it with the new edit.TrimBOM.
- Prime Agent's Disconnect (beforeMagpie.restore, on main since this
work began) compares the file with its copy from before through the
BOM, so a BOM'd settings.json is put back byte for byte and the copy
removed; it used to stay as magpie left it, the copy beside it.
The reporter's fork commit (AnxForever/magpie 0bb750c1) was reviewed: it
trimmed the BOM in the seven JSON entry points and wrote the file back
without it; this change keeps the BOM instead and covers TOML, YAML, env
and the readers outside the JSON layer.
Run:
- New tests built on a Windows-shaped settings.json (BOM + CRLF + the
user's env and permissions): TestJSONSettingsWithBOM, TestPatchJSONKeepsBOM,
TestJSONItemWithBOM, TestTOMLConfigWithBOM, TestEnvAndYAMLWithBOM fail on
the old code ("invalid JSON/JSONC", nothing found) and pass; with keepBOM
disabled by hand four of them go red. TestWriteAtomicAddsNoBOM.
TestPrimeAgentRoundTripWithBOM fails on main (not put back) and passes.
TestClaudeConfigDirImport (BOM case) and TestImportCCSwitchConfigWithBOM
fail on the old importer ("invalid character 'ï'") and pass.
- Full chain in a sandbox HOME: old binary `magpie claude
deepseek/deepseek-flash` on a BOM'd settings.json -> "invalid
JSON/JSONC"; new binary -> "✓ Claude Code model", BOM and CRLF kept, the
user's env untouched; `magpie claude model default` after it leaves no
blank line. Old `magpie codex gpt-5.5` on a BOM'd config.toml -> "UTF-8
BOM is not supported"; new -> set, BOM kept.
- Windows box: the edit package's test binary passes whole; magpie.exe
`claude deepseek/deepseek-flash` on a settings.json written by
PowerShell 5.1 Set-Content -Encoding UTF8 (sandboxed USERPROFILE/APPDATA)
sets the model and keeps ef bb bf.
- go test -tags nogui ./internal/edit ./internal/agent ./internal/provider
./internal/library; gofmt -l; go vet (darwin, GOOS=linux, GOOS=windows)
on the touched packages; the full suite.
|
||
|
|
814a5ed73c |
agent: dsh asks each of magpie's models on its own API, a route per protocol (01huadalang on Discord)
dsh's llm-pi-ai sets one api for a whole route, so magpie's single "magpie" route asked every model over Chat Completions. A GPT served on Responses, or a Claude served on Messages, was translated from Chat, and its sealed reasoning was lost between tool calls. 01huadalang asked for a group per protocol. What changed: - dshPutRoute writes up to three routes from each model's catalog APIs (dshRouteOf): magpie (openai-completions, as before, for Chat models, Gemini-native ones, groups and agent-bridged sign-ins), magpie-responses (openai-responses, gateway /v1) and magpie-anthropic (anthropic-messages, the gateway root, forceAdaptiveThinking where gateway.AdaptiveThinking). A route left with no models is taken out. An api the user picked for a route in dsh's Models page is kept, and so are keys they added to it. - The start (agent-default-model) names its model's route on a pick, an effort change, and the home layer's mirror. Sync moves a start on one of magpie's routes to the route its model is now on (dshStartOnItsRoute), keeping its mark, effort and other keys. A start on the user's own route stays. - dshCheck checks each route's baseURL against its own api, and asks the route the start names to list its model. - Disconnect, dshOurs, dshKeepPick and dshFillNewProfiles know all three routes. sessions' dshGatewayProvider counts dsh sessions on any of them as magpie's. - docs/subsystems/agent-wiring.md: a line on the routes. Known limit: a dsh session resumed on a model that has since moved routes asks for the model to be picked again once, since dsh finds a model by route and id. Run: - go test -tags nogui ./internal/agent (whole package, default order) and ./internal/sessions -run TestDsh: pass. New tests TestDshRoutesAModelOnItsNativeAPI, TestDshSyncMovesAStartToItsModelsRoute, TestDshCheckSaysAStartOnAnotherRoutesModel and TestDshGatewayProviderTakesEveryRouteOfMagpies. With dshRouteOf forced back to the single route, the three agent tests go red. - Real dsh (headless, sandbox HOME and DSH_HOME) on patches magpie wrote, pointed at a fake gateway: the start on magpie answered from /v1/chat/completions, the one on magpie-responses from /v1/responses (reasoning.effort high), and the one on magpie-anthropic sent /v1/messages with thinking adaptive and output_config.effort high. dsh accepted all three routes. Its Anthropic turn then ended on my fake's SSE, not on the wiring. - gofmt -l clean. go vet -tags nogui for darwin, GOOS=linux and GOOS=windows on internal/agent and internal/sessions. |
||
|
|
9c11abbd00 |
agent: jcode is an agent magpie connects: a magpie profile with magpie's models, jcode started on the one picked (wani on Discord)
wani asked on Discord for jcode (1jehuang/jcode, a coding agent in Rust)
as an agent magpie connects. There was no earlier request in issues or
history.
What changed:
- internal/agent/jcode.go: a new agent for jcode's config.toml in
$JCODE_HOME, else ~/.jcode (jcode-storage's jcode_dir). Detected by the
file, the folder, or `jcode` on PATH.
- Connecting adds a named profile, [providers.magpie], with the keys
`jcode provider add` writes: type "openai-compatible", the gateway's
/v1, an inline api_key naming jcode (magpie-jcode; jcode's requests
carry nothing else that tells it apart) and requires_api_key = true.
Without that key, jcode sends no key to a loopback base URL.
- Its models list has one entry per model of magpie's: context_window
(128000 when magpie doesn't know it; jcode would assume 200k), input
text/image, and reasoning = true for a model with effort levels, so
jcode's /effort offers them.
- It sets [provider] default_provider = "magpie" and default_model, the
model picked. What was there is stashed, and Disconnect puts it back.
- Picking a model of jcode's own while it is on magpie takes magpie
out: the profile goes and the user's provider comes back with that
model.
- Each key is set alone, so the user's other keys and tables stay, as
do their own keys in magpie's profile (headers, extra_body) and a
reasoning_effort they set on one of its models while the model has
that level.
- jcode writes a profile's models as [[providers.magpie.models]]
tables when it rewrites the file itself (Config::save,
to_string_pretty). Those are replaced by the one list.
- A sync with nothing to change doesn't write.
- Disconnect drops the profile whole, sub-tables included.
- Check says when the profile is gone while jcode still starts on it,
or when its base_url or key is off.
- While jcode runs, the notice says to restart open jcode sessions,
since it reads the file when it starts. The notice is a newNotice
template, translated in i18n.js (zh-CN, zh-TW, ja, de) and listed in
NOTICES, as TestEveryNoticeIsTranslated asks.
- agents.go, agentenv.go: registers it; JCODE_HOME joins the agent env.
- icons/jcode.svg: jcode's halftone mark (jcode.sh/favicon.svg) as a
mask icon, every other dot of its lattice.
- docs/reference.md, docs/subsystems/agent-wiring.md, README.md,
README.zh-CN.md: jcode's row and its place in the agent list.
- WSL isn't covered: jcodeAt reads the place's home and JCODE_HOME, but
it isn't added to the WSL agent list (another session has wsl.go open).
What was run:
- go test -tags nogui ./internal/agent -run '^TestJcode'. The fixture is
the bytes jcode 0.94.0 wrote for `jcode provider add`. The tests went
red when, by hand, I:
- made a no-op sync write;
- dropped the user's reasoning_effort;
- skipped the stash, so Disconnect wasn't byte-identical;
- left jcode's [[providers.magpie.models]] tables in, which makes
invalid TOML;
- dropped requires_api_key.
- Real use:
- jcode v0.94.0 (release binary, sha256 checked) ran under a sandbox
HOME with JCODE_HOME set and JCODE_NO_TELEMETRY=1. Its config.toml
was the one jcode wrote for its own "probe" profile.
- A sandbox magpie (MAGPIE_ADDR 127.0.0.1:3671) with a fake OpenAI
upstream on 3672 ran `magpie jcode magpie/fake/org/echo-1`, a model id
with two slashes.
- `jcode run 'Say hello in one word.'` answered with the upstream's
reply, streamed. The upstream saw model org/echo-1, and usage.jsonl
recorded the turn under agent "jcode".
- `jcode provider add two …` while connected appended its own profile
and left magpie's as it was.
- `magpie jcode default` then gave back the file jcode wrote,
byte-identical, with jcode's new [providers.two] kept.
- The icon rendered as a mask in Chromium and WebKit. The only GUI
change is the notice's translations; TestEveryNoticeIsTranslated and
internal/gui pass, and node --check accepts i18n.js.
- gofmt -l; go vet (darwin, GOOS=linux, GOOS=windows) on internal/agent
and internal/agentenv; go test -tags nogui ./internal/agent
./internal/agentenv ./internal/gui; go test -tags nogui ./... under a
temp HOME (load ~80): every package passed. After rebasing on
origin/main, internal/agent and internal/agentenv were run again,
along with internal/gui, gofmt and the linux/windows vet.
|
||
|
|
8b393938f5 |
agent: StepCode can be connected to magpie, and Disconnect puts back its own model (#1526, BUKOWSKIREAL)
StepCode (StepFun's coding CLI, `step`) is a Pi fork that keeps Pi's settings as TOML in ~/.stepcode/config.toml and Pi's models.json beside it. It is now an agent target: Connect sets defaultProvider/defaultModel to magpie, appends the magpie pattern to enabledModels when the user scopes models, and writes providers.magpie into models.json with the per-agent key. Disconnect puts back the user's own provider, model and scope (only the patterns magpie added are taken out if the user changed the scope since), restores or removes providers.magpie, and removes a models.json magpie created. STEP_CODING_AGENT_DIR and STEPCODE_CONFIG_DIR move the folder as StepCode's own resolveStepConfigRoot does; WSL is covered. The patch is BUKOWSKIREAL's (7cc88463 in their fork), reviewed line by line: no network, telemetry or credential reads, writes only to the two StepCode files and magpie's stash. Added here: a test that StepCode's real User-Agent, "step (darwin 25.2.0; arm64)", counts as StepCode, and the real-CLI test now looks for a "magpie" row in `step --list-models` rather than the word anywhere (the docs path step prints can contain it). Run: - Config format checked against stepfun-ai/Step-Code at 3d70bae5 and the official 0.1.3 darwin-arm64 binary (sha256 matches latest.json): `step config path --json` names ~/.stepcode/config.toml and models.json. - Sandbox HOME, sandbox gateway on 127.0.0.1:3647: a user config with defaultProvider "step", step-3.7-flash, thinking high, two scoped models, telemetry off. `magpie stepcode magpie/deepseek/deepseek-flash`, then `step -p` answered PONG through the gateway (usage record: agent stepcode, deepseek-flash, 200). `magpie stepcode default` put config.toml back value for value, removed models.json, and `step --list-models` no longer listed magpie. - The same round trip from the real web page (sandbox `magpie web`), switch on, then off through the disconnect preview, which listed the three values it puts back; config.toml came back byte-identical. The row and icon checked in Chromium and WebKit, en and zh; no GUI assets change. - Broke the guarantee: with unwire never restoring the defaults, TestStepCodeLifecycle, ...NativeChangedAndPreexisting and ...StrictValidationAndRollback go red. Without the "step" alias the new UA check goes red. - MAGPIE_TEST_STEPCODE_BIN=<0.1.3> go test -run TestStepCodeRealCLISandbox passes (it failed before the row check above). - go test -tags nogui ./... ; gofmt -l; go vet (darwin, GOOS=linux, GOOS=windows) on internal/agent and internal/agentenv; go build for darwin, linux (nogui) and windows. Not tried on a real Windows, Linux or WSL machine. Co-authored-by: BUKOWSKIREAL <233685554+BUKOWSKIREAL@users.noreply.github.com> |
||
|
|
64262a19f0 |
agent: Prime Agent is an Agents-page row, wired like Pi into ~/.prime/agent, and Disconnect puts its files back (#1528, takltc)
What changed
- internal/agent/primeagent.go: Prime Agent (PrimeIntellect-ai/prime-agent,
CLI prime-agent) through the piLike path, as OmO was added. Its folder is
~/.prime/agent or PRIME_AGENT_CODING_AGENT_DIR (~ expands, as upstream's
agent_dir does; appdir now lets that variable carry ~). models.json and
settings.json were checked against upstream v0.10.0 (pa-core settings and
models registry): Pi's camelCase fields, the same thinking levels and
enabledModels rules. Connect writes providers.magpie, defaultProvider and
defaultModel and keeps the user's providers and settings. Only the global
settings.json is written; allowedModels and subagentDefaultModel are left
alone.
- Prime Agent sends no User-Agent, so its provider block carries the key
magpie-prime-agent and the usage log names it (piLikeKeyed). The block is
Pi's otherwise, compat.sendSessionAffinityHeaders included (Prime Agent's
openai_completions honours it), kept as the user set it (piBlockKept).
- Disconnect restores both files byte-for-byte: before magpie's first write
a copy is kept (*.before-magpie, or a note that the file was absent), and
Disconnect puts it back when nothing else changed since (Agent.Restore). A
file changed while connected is left with only magpie's part taken out.
- WSL kind, agentenv, the icon, PICKS_ITSELF in the GUI, docs and READMEs.
Run
- go test -tags nogui ./internal/agent ./internal/appdir ./internal/agentenv
./internal/library ./internal/usage; the new tests went red with the key,
the restore, the ~ expansion, PICKS_ITSELF and the icon each taken out.
- pi-default-note.test.cjs in chromium and webkit.
- Real use: prime-agent 0.10.0 installed into a sandbox HOME, a sandbox
gateway on 127.0.0.1:3651 and a fake upstream on 3652. The interactive
TUI with no flags started on magpie/fake/echo-1, the fake got the request
and usage.jsonl recorded agent "prime-agent". `magpie prime-agent default`
put models.json back byte-for-byte; settings.json got its values back, but
Prime Agent rewrites the whole file when it runs (every key, nulls), so
that file is equal in content, not bytes. Reconnecting over that
null-filled file and disconnecting again left it byte-identical. After
the rebase onto
|
||
|
|
78b3f1f21a |
agent: an agent pointed at magpie on another machine keeps that address and key through a start's sync (coeo91 on Discord)
coeo91: after an update or a restart, the base URL in an agent's config sometimes went from the LAN address back to 127.0.0.1. Every start of magpie (and a provider added, a catalog fetched) runs SyncCatalog, which runs each agent's Sync to bring magpie's models in its files up to date. Each Sync writes magpie's whole provider block, base URL and key included, from gateway.URL(), so a block the user had pointed at a magpie on another machine (a NAS's, or this machine's LAN address) went back to 127.0.0.1 with magpie's own key. Only ZCode (zcodeAddress), WorkBuddy (buddyWriteAt) and Codex (#816) kept such an address; in a sandbox HOME, 27 files of the other agents went back (Qoder, OpenCode, Pi, Crush, Cline, Qwen Code, Kimi, Grok, Hermes, omp, MiniMax, Snow, Hanako, VS Code, Copilot JetBrains, Goose, dsh, ...). The fix is one place for all of them: SyncCatalog runs each Sync through synced, which passes every file written through keptAway (edit.Filtered, a filter on edit.WriteAtomic while it runs). In a file without the gateway's own address, with an address on another machine and none a WSL distro was seen at, a write that brings gateway.URL() in place of that address keeps the address, and one that brings magpie's own key (gateway.Token, TokenFor, the LAN key, "Bearer " too) in place of another key keeps that key. An address on this machine's loopback (another port, localhost) still follows the gateway, a WSL distro's way to Windows is still magpie's to move, magpie's own files are never filtered, and with two addresses or keys gone the write is left as it is. A pick made in magpie still points the agent at this magpie. Tests: - TestSyncKeepsAnAddressOnAnotherMachine wires every agent in a sandbox HOME, points each file at 192.168.50.10 with a key of its own, adds a provider and runs SyncCatalog: no file is back on 127.0.0.1, the address and key are kept, and the new model is written. With SyncCatalog calling a.Sync() directly it fails on 27 files. - TestKeptAwayOnlyWhatIsSure: old port, localhost, WSL and two-gone cases follow the gateway; a NAS beside a local Ollama is kept; Qwen Code's key written on its own is kept. - TestKeyValuesFormats, TestFilteredWrites. Run: gofmt -l (clean); GOOS=linux and GOOS=windows go vet -tags nogui ./internal/agent ./internal/edit; go test -tags nogui ./... in a temp HOME. |
||
|
|
2c75d89827 |
agent: AstrBot is an agent magpie connects: its default chat model one of magpie's, its own providers kept (orange27 on Discord)
orange27 asked on Discord for AstrBot (AstrBotDevs/AstrBot) as an agent.
What changed:
- internal/agent/astrbot.go: a new agent for AstrBot's data/cmd_config.json
under its root ($ASTRBOT_ROOT, else ~/.astrbot, the desktop app's, else
~/astrbot / ~/AstrBot when it holds an install).
- Connecting adds one "magpie" entry to provider_sources
(openai_chat_completion at the gateway, key magpie-astrbot) and one
"magpie/<model>" entry per model of magpie's to provider.
- It sets the default chat model:
agent_runner.config.model.provider_id on 4.28+, or
provider_settings.default_provider_id on older layouts.
- Field types are taken from AstrBot's own defaults and validator: key is
a list, timeout and max_context_tokens are ints, modalities lists
text/image/tool_use, and custom_headers / custom_extra_body are objects.
- The user's own sources and models are kept byte for byte. What they
change in magpie's entries (timeout, proxy, enable) stays through a
sync, and a sync with nothing new doesn't rewrite the file.
- The UTF-8 BOM AstrBot writes is kept.
- The first connect copies the file to cmd_config.json.before-magpie.
- Disconnect takes magpie's entries out and puts back the pick it found,
so the file comes back byte for byte.
- A pick the user makes while connected is theirs and stands.
- Without the file it says to start AstrBot once (or set ASTRBOT_ROOT).
Without provider_sources (before 4.10) it says to update.
- The notice says to restart AstrBot, before saving in its WebUI: it
reads the file only at start-up and its WebUI writes the whole file
back on save.
- Docker installs aren't reached: their root is inside the container.
- agents.go, agentenv.go: registers it; ASTRBOT_ROOT joins the agent env.
- icons/astrbot.svg: AstrBot's logo, as a mask icon.
- applied_test.go, rewire_test.go: the every-agent tests seed AstrBot's
settings, as they do Hanako's.
- docs/subsystems/agent-wiring.md, docs/reference.md: AstrBot's row.
What was run:
- go test -tags nogui ./internal/agent -run '^TestAstrBot'. The tests went
red when, by hand, I dropped the BOM, rewrote the user's entries, left
the pick unrestored, overwrote the user's own pick, made a no-op sync
write, rewrote the backup on a switch, or broke the legacy layout.
- Real use:
- AstrBot 4.28.2 installed with uv into a scratch venv (Python 3.12),
run from an isolated root under a sandbox HOME.
- A sandbox magpie (MAGPIE_ADDR 127.0.0.1:3617, ASTRBOT_ROOT set) with a
fake OpenAI upstream on 3618 ran `magpie astrbot magpie/fake/echo-1`.
- AstrBot restarted, logged "Selected openai_chat_completion(magpie/
fake/echo-1) as default chat model provider", and answered a WebUI
chat (/api/chat/send) with the upstream's reply.
- usage.jsonl recorded the turn under agent "astrbot".
- `magpie astrbot default` gave back the file AstrBot wrote,
byte-identical, and AstrBot started clean on it.
- The icon rendered as a mask in Chromium and WebKit. No GUI strings were
added: the notice is the agent's own English line, like the others'.
- gofmt -l; go vet (darwin, GOOS=linux, GOOS=windows) on internal/agent and
internal/agentenv; go test -tags nogui ./... under a temp HOME (load
~170-240): every package passed but internal/gateway. That package
doesn't import internal/agent. It timed out at 10m, then with -timeout
30m failed TestQueuedStreamWaitedOutIsTheStreamsError (its 400ms idle
read and the 100ms "the first has the slot" sleep; a delay injected
before the first request reproduces it). internal/agent and
internal/agentenv were rerun green after rebasing on origin/main.
|
||
|
|
ac79966a6d |
agent, gateway: Claude Code knows a relay's claude-opus-4.6 as Opus 4.6, not the retired Opus 4 (misteer_ti.)
Claude Code 2.1.296 parses a Claude model id whose version has a dot
(relay/claude-opus-4.6-us[1m], as many relays name them) as Claude Opus
4: it warns the model is retired, asks with max_tokens 32000 and offers
no effort. The same id with dashes (relay/claude-opus-4-6-us) is Opus
4.6 to it: max_tokens 64000, adaptive thinking, effort.
What changed:
- provider/claudedash.go: ClaudeDashed (a Claude-family version's dots
to dashes; other vendors' ids untouched), ClaudeSpelled (dashed only
when that spelling comes back to exactly this served id), and
ClaudeUndashed/ClaudeRead (a dashed spelling back to the one served
id; an id served as spelled always wins, two ids dashing alike are
neither; :level and [1m] kept). ClaudeRead also knows a switched-off
provider's models, so Reseat still moves Claude Code off one
(TestReseatOff went red without it: opus read "", not
cop/claude-sonnet-4.5).
- agent/claude.go: every model magpie writes into Claude Code's
settings is spelled so: model, the ANTHROPIC_DEFAULT_*_MODEL tiers,
ANTHROPIC_SMALL_FAST_MODEL, CLAUDE_CODE_SUBAGENT_MODEL, modelPicker.
Every read of them (env, claudeMain, claudeStandInAt) takes the
spelling back, so fields, applied state and Drift keep the dotted id.
The user's own values are stashed and given back raw. A Sync rewrites
what an older magpie wrote dotted. claudeName, the capabilities env
and the compact-window lookup see the dashed spelling.
- agent/t3code.go and gateway/desktop.go (claudeLooking): T3 Code's
Claude slugs and Claude Desktop's Code-tab ids without efforts are
spelled dashed too. Desktop entries with efforts still use the mythos
alias, which Claude Code doesn't misparse.
- gateway.go: validateModel and unprefixed take the dashed spelling
back to the served dotted id, before key limits, middleware and
usage see it.
- docs/subsystems agent-wiring and gateway-routing say so.
What was run:
- New tests: TestClaudeDashedIDsReachTheDottedModel (gateway),
TestClaudeDottedVersionsGoInDashed, TestClaudeDottedServedDashedToo
(agent), TestClaudeDashedOnlyClaudeVersions, TestUndashInExactWins,
TestClaudeSplitKeepsEffortAndMark (provider).
- Break-it checks:
- With ClaudeSpelled/ClaudeUndashed made identity:
TestClaudeDottedVersionsGoInDashed fails ("the main model and its
followers": model relay/claude-opus-4.6-us).
TestClaudeDashedIDsReachTheDottedModel fails (sent
"claude-opus-4-6-us", want "claude-opus-4.6-us").
- With ClaudeRead alone made identity, the agent test fails at
"read back" (model:relay/claude-opus-4-6-us).
- Real use: the installed claude 2.1.296 in a sandbox HOME and
CLAUDE_CONFIG_DIR, against an in-process gateway on a free port and
a fake Anthropic upstream. The settings.json was written by
agent.Find("claude").Apply("model", "relay/claude-opus-4.6-us").
- Dashed (magpie's write): the upstream got model claude-opus-4.6-us,
max_tokens 64000, thinking adaptive, effort high. Claude Code
reported canonicalModel claude-opus-4-6, maxOutputTokens 64000.
- The same config with the dotted id by hand: max_tokens 32000,
canonicalModel claude-opus-4-0.
- Full go test -tags nogui ./... (TestReseatOff red on the first
run, fixed as above; agent, provider, gateway and main rerun green),
gofmt -l, go vet, and GOOS=linux and
GOOS=windows go vet -tags nogui on the touched packages.
|
||
|
|
4e584faa51 |
agent: a Codex the user disconnected stays disconnected through restarts and updates (paynezhuang)
paynezhuang on Discord: magpie's first start pointed Codex at the gateway by itself; they switched Codex on, chose "Disconnect from magpie", and after each update and restart config.toml had openai_base_url again. Cause: Codex's Sync runs at every start (SyncCatalog) and calls failover(), which writes openai_base_url whenever Codex is signed in to ChatGPT and another of the user's ChatGPT accounts is on in magpie. Nothing told it the user had taken magpie out. The same Sync's #701 branch (sign-in "magpie API" on one of Codex's own models) wired a disconnected Codex again too, and with magpie API Disconnect itself left failover's base URL behind (its own model Set ran failover). Fix: Disconnect marks the agent disconnected in the stash (<id>.disconnected) before it writes anything; connect() and an Apply that leaves the agent wired take the mark out. Codex's failover treats a marked Codex as having no other account on (and takes out a base URL it owns), and the #701 re-wire skips it. Failover for a Codex never disconnected, and a base URL written by hand (#856), are as before. Siblings: TestDisconnectStaysThroughSync connects and disconnects every non-WSL agent with fields, then runs SyncCatalog and dsh's KeepDshWired round twice: none is wired again and no file outside magpie's own changes. It passes on the old code too (only Codex had the problem); it guards the class. Cursor, Copilot CLI and Devin can't be connected in the sandbox and skip; Native (Aside) and Launch agents don't Sync wiring. Run: - TestCodexDisconnectStaysWithAccountsOn (ChatGPT and magpie API) and TestCodexAPIDisconnectStays fail on the old code ("start 0 after Disconnect wired Codex again", "disconnect left magpie in") and pass now. - go test -tags nogui ./internal/agent ./internal/gui . (sandbox HOME): ok - gofmt -l, go vet, GOOS=linux and GOOS=windows go vet -tags nogui ./internal/agent: clean - Real magpie (nogui build, `magpie web --gateway`) under a scratchpad HOME, gateway 127.0.0.1:3481, web 3482, fake ChatGPT auth.json plus a second ChatGPT login on: old build re-wrote openai_base_url 2s after a restart following Disconnect. New build: first run wires (failover), connect, disconnect, restart as 0.1.99998, then start as 0.1.99999 (last-version moved): config.toml byte-identical to after Disconnect, no failover; connecting again wires it and a restart keeps it. |
||
|
|
a5114d931f |
agent: Claude Desktop from its MSIX isn't said to be off magpie when the package's copy is emptied, and Reconnect puts its gateway back (dumplings)
dumplings (Windows, Desktop 2.31226.0 from the MSIX) saw "Claude Desktop
已不经过 magpie:配置已变更" while Desktop ran on magpie, and Reconnect
didn't clear it; switching Desktop's provider off magpie and back did.
Two causes:
- Check went over both sets of folders magpie writes for a packaged
Desktop (the package's LocalCache and the real ones, as which build
is installed can't be told) and failed when either was off magpie.
2.31226 reads the real %LOCALAPPDATA%\Claude-3p (bg5eau, already in
desktopdir), so the package's copy, emptied, isn't Desktop off
magpie. desktopRead now judges only the set whose Claude-3p Desktop
ran in last ("Local State", desktopdir.LastRun), every set when it
ran in none, as before.
- Reapply on an unwired drift re-set the field drift shows on and
fields on magpie's models. Desktop's drift shows on a tier (sonnet,
on a magpie model), and its provider field ("magpie") isn't a model,
so the gateway was never written back. Reapply now also re-sets a
field whose value is magpie itself, as Wired already counts it.
The reporter's analysis said 2.31226's AppxManifest excludes
Claude-3p from virtualization; that manifest wasn't seen here (the
Windows box has no MSIX Desktop), the fix rests on Desktop reading the
real Claude-3p, which bg5eau's case showed.
Run: TestClaudeDesktopMSIXChecksTheFoldersDesktopRuns (MSIX layout:
package Roaming\Claude and Local\Claude-3p with an older Local State,
the real Claude-3p newer); red with Check over every set, and red
with Reapply without the magpie-valued field. go test -tags nogui for
internal/agent, internal/desktopdir, internal/gui, internal/library;
the agent package's TestClaudeDesktop* built for windows/amd64 and run
on the Windows box, all pass; gofmt -l; go vet -tags nogui on darwin,
GOOS=linux and GOOS=windows for internal/agent, internal/desktopdir.
|
||
|
|
cb406c8425 |
plugins: a plugin can add an agent magpie has no setup of its own for
Plugins could be subscription providers or gateway middleware. Now a third
kind: an agent plugin, so a user whose agent magpie doesn't ship can still
put it on magpie.
- internal/agentplug: a plugin's magpie.agent module (or a *.agent.js file)
exports agent = {id, name, config, format?, model, prefix?, bin?, dir?,
ua?, icon?, notice?} and an optional connect({gateway, model, models,
agent}) returning the other keys to write. Compiled in moejs, reloaded
when plugins.json or the file changes; why one didn't load is kept.
- internal/jsmod: module compiling (imports kept inside the plugin), moved
out of middleware so both share it.
- internal/agent/plugged.go: each becomes an Agent (Plugin set) after
magpie's own. JSON, YAML and env files are edited key by key, comments
kept; what each key held is stashed typed under plugin:<id>:<path>, and
its own model or Disconnect puts every key back. A built-in id is
refused; a connect that throws writes nothing. Key magpie-<id>; usage
names it by key or ua (usage.PluginAgents).
- GUI Plugins page: an Agent kind chip and glyph, a Discover "Agents"
section (market kind "agent"), and an installed row line "Adds X to
Agents" or why it didn't load. zh, zh-TW, ja, de strings.
- Docs: site Plugins page (en, zh, ja) "Agent plugins", reference.md,
agent-wiring.md, gateway-middleware.md.
Run:
- go test ./... (all ok); gofmt -l clean; GOOS=linux go vet -tags nogui
./... and GOOS=windows go vet ./... clean.
- TestPluggedYAML, TestPluggedJSONUnwire, TestPluggedRefused.
- GUI: plugin-agent.test.cjs 22/22 (en, zh, zh-TW, ja, de; 980 and 420;
chromium and webkit); all plugin-*.test.cjs, i18n-keys,
deprecated-subscriptions, filter-ime: 315 pass, 0 fail.
- Real use, in a sandbox HOME: an Aider plugin (~/.aider.conf.yml, prefix
openai/, connect writes openai-api-base/key) installed in a dev build;
picking DeepSeek V4.1 Flash on the Agents page wired the file keeping the
user's comment and keys; real aider 0.86.2 `--message` answered through
magpie from the real DeepSeek account; usage.jsonl recorded agent aider,
provider deepseek, 200; Disconnect restored the file byte for byte.
|
||
|
|
0fb4ff17ba |
agent: Snow CLI's thinking level is set from the Agents page, from the levels magpie's model has (#1457)
zRain (#1457) asked for thinking.effort, responsesReasoning and responsesVerbosity. magpie's profile asks the gateway on Chat Completions (requestMethod "chat"), and on that protocol Snow 0.9.2 reads chatThinking only (api/chat.ts: enabled sends reasoning_effort; unset or disabled sends thinking {type: "disabled"}). thinking.effort is the Anthropic method's, responsesReasoning and responsesVerbosity the Responses method's, so none of them would change a request of magpie's profile, and they aren't written. A "thinking" field, as Pi's and dsh's, writes chatThinking {enabled: true, reasoning_effort: <level>} the way Snow's own settings screen does (ui/pages/configScreen/useConfigState.ts), on magpie's profile only, and copies it to config.json. Its levels are the catalog's for the model picked through magpie, after a default that says Snow takes off then; a model that lists none offers none. Clearing it deletes chatThinking. A chatThinking the user had on the profile magpie's was made from comes along and is shown as theirs; it is only changed when picked here. Enabled with no level reads as "on". On a profile of the user's own the field is empty, offers nothing and refuses a pick. Tests: TestSnowThinking, with a user profile in Snow's own format carrying chatThinking: shown as theirs, levels offered, a pick written and mirrored, kept through Sync, none offered for a model without levels, cleared to Snow's default, the user's profile untouched. Writing a fixed level instead of the pick fails it ("chatThinking: map[enabled: true reasoning_effort:high]"). TestSnow* and TestSync* pass under a temp HOME with pinned caches. GUI: snow-fields.test.cjs (Chromium and WebKit, en/zh/zh-TW/ja/de, window at 1240 and 720, tray panel at 440): on magpie's profile the row draws the small and thinking pills, the thinking default reads "default (off)" in each language and no pill runs past the row; on a profile of the user's own neither is drawn. With the small key taken out of app.js none() it fails 5 cases. The agent field, layout, effort and subagent GUI tests pass beside it (156 tests), and go test ./... passes under a temp HOME. Real Snow CLI 0.9.2 (sandbox HOME made by Snow itself): with magpie's profile written by this code (model relay/glm-4.6, small relay/glm-4.5v, thinking high) and its baseUrl pointed at a fake server, `snow --ask` sent its turn as relay/glm-4.6 with max_tokens 131072 and reasoning_effort high, and its light request as relay/glm-4.5v. |
||
|
|
e949c0ca8f |
agent: Snow CLI's light model (basicModel) can be picked apart from its main model on the Agents page (#1457)
zRain (#1457) asked for Snow's advancedModel and basicModel to be chosen separately; magpie wrote the picked model to both. Snow 0.9.2 asks basicModel for its summaries, compaction and file search (utils/config/apiConfig.ts; agents/compactAgent, summaryAgent). A "small" field, as OpenCode's and Crush's, sets basicModel on magpie's profile (profiles/magpie.json, copied to config.json): a model through magpie only, since both models go to the profile's one baseUrl, the gateway. Empty, it follows the main model. A small model of its own stays through a new main model and a catalog sync (snowProfileFor keeps a basicModel that differed from the advancedModel it replaces), and one the gateway no longer resolves goes back to following. On a profile of the user's own the field reads empty, offers nothing and refuses a pick: that profile's models are theirs to set in Snow. The Agents row leaves a small field with nothing to offer and no value out, as it does an effort with none (app.js none()). Tests: TestSnowSmallModel (pick, read back, refuse a non-magpie model, kept through a new model and Sync, follows again when cleared, Disconnect). With the keep in snowProfileFor removed it fails "small after a new model and sync". TestSnow* and TestSync* pass under a temp HOME with pinned caches. |
||
|
|
6ad5dc5855 |
agent: Snow CLI's window, output and image support follow magpie's model until the user sets them in Snow, and a vision model of theirs that would reach the gateway is left out (#1457)
zRain (#1457, Discord #feedback) asked that maxContextTokens / maxTokens be synced when the model changes, and for Snow's vision settings. magpie's profile (profiles/magpie.json) already took maxContextTokens and maxTokens from the catalog on every pick and catalog sync, which also wrote over a value the user had set on that profile in Snow's own settings. Now what magpie last wrote of maxContextTokens, maxTokens and supportsVision is stashed (snow:<dir>:wrote), and a value that differs from it is the user's and is kept through later picks and syncs; the others follow the new model. Leaving magpie's profile forgets the stash, so connecting again starts from the user's profile. supportsVision is now set as every agent is told a model sees (fx, Copilot): true while magpie's Vision describes images at the gateway, else the catalog's word; it used to be copied from the user's profile, where it described their own model. Snow 0.9.2 sends images to the main model only when supportsVision !== false (agents/visionAgent.ts). The user's profile is copied into magpie's, vision settings included. Snow's vision model takes visionBaseUrl || baseUrl and visionApiKey || apiKey (buildVisionConfigOverride), so one with no endpoint of its own went to the gateway, which doesn't know it, and one with its own endpoint but no key sent magpie's key there. snowOwnVision keeps only a vision model with both, on the requestMethod and baseUrlMode it was asked with. Checked against Snow CLI 0.9.2's source (6ef56454: utils/config/ apiConfig.ts ApiConfig, agents/visionAgent.ts, api/chat.ts). Tests (temp HOME, pinned caches): TestSnowSyncedKeepsTheUsers, TestSnowVisionThroughMagpie, TestSnowUsersVisionModel, with Snow's own profile layout. With the stash check disabled TestSnowSyncedKeepsTheUsers fails "the user's window was written over: 65536"; without supportsVision TestSnowVisionThroughMagpie fails "supportsVision <nil>"; without snowOwnVision TestSnowUsersVisionModel fails "visionModel kept: glm-4.5v". go vet (darwin, linux, windows) clean, gofmt clean. |
||
|
|
8a00d0bfa9 |
agent: Cursor Private Inference is listed on the Agents page when it is installed in a folder of the user's choosing on Windows, or kept as its AppImage on Linux (#1254, whiteS18, laacmilan)
It was found only by a product.json naming it in one of the apps
folders (on Windows %LOCALAPPDATA%\Programs, %LOCALAPPDATA%, Program
Files). Its 3.24.9 Windows user setup (CursorUserSetup-x64-3.24.9.exe,
from the cursor-local download) installs flat - resources\app\
product.json beside "Cursor Private Inference.exe" - into whatever
folder the installer is given, so one put on another drive or folder
was never found, and Routing still showed requests from it while the
Agents page had only Cursor. On Linux the build is only an AppImage
(Cursor_Private_Inference-3.24.9-x86_64.AppImage), a single file that
no product.json lookup could find.
findCursorLocal now also takes the folders Windows' uninstall entries
name for "Cursor Private Inference (User)" (cursorLocalInstalls: HKCU
and HKLM, InstallLocation, else DisplayIcon's folder), and an AppImage
named for the build in the Linux apps folders plus ~/.local/bin, ~/bin,
~/Downloads and ~ (regular Cursor's Cursor-<v>-x86_64.AppImage isn't
taken).
Run:
- TestCursorLocalFoundWhereInstalled fails with each half removed by
hand ("installed in a folder of the user's: found \"\"", "its
AppImage: found \"\"") and passes with the change.
- On the Windows 11 box: the real 3.24.9 user setup installed silently
into C:\Users\yeton\cpi-1254\app; a probe test in the cross-built
agent.test.exe found nothing with the old lookup and found
"...\app\Cursor Private Inference.exe" (detected: true) with the
new; TestCursorLocal* pass there. The copy was uninstalled after.
- go test -tags nogui ./internal/agent under a temp HOME; go vet
(darwin, GOOS=linux and GOOS=windows, nogui); gofmt -l clean.
Not run: the AppImage on a real Linux desktop.
|
||
|
|
9e665491ec |
context: Tuned for you — each agent's settings worked out from the user's own calls, for the fewest tokens, put in on a click and undone on another
The Context tab now replays the period's calls of each agent against the
settings that decide what they cost, and shows, per agent and per model,
the value that would have used the fewest tokens for how this user works:
Claude Code's auto-compact window per model (modelSettings.<model>.
autoCompactWindow), its main and subagent prompt cache lifetimes
(promptCacheTtl, subagentPromptCacheTtl: 5m or 1h), and Codex's
model_auto_compact_token_limit. Each row says where the value comes from
now (the agent's default, the user's own setting, one magpie set, or a
variable that comes first and locks it), why (how fast conversations grow,
what a compaction leaves, how long the user pauses), the cost curve, and
the saving. Nothing is written until "Use …" is clicked; what was there is
stashed and Undo puts it back, unless the user changed it since. A window
the user set past the model's own is shown capped, as Claude Code caps it
(min(setting, model window)), so no saving is claimed that wouldn't happen.
Advice under a 3% saving is "already the leanest".
On the owner's 7 days (88K Claude Code calls, 956 Codex): opus keeps 200K
(their 500K is capped to it), fable 5.1 200K → 160K saves 5% (2.56M
tokens), both cache lifetimes and Codex's 272K are already the leanest.
Run: go vet ./... and go test ./... pass (internal/tune, internal/agent
TestTune*: user-set values kept, env locks, undo after a user edit, TOML
key order). context-tune.test.cjs passes in Chromium and WebKit, en/zh/
zh-TW/ja/de, at 360 and 1100px (22); context-window, context-scroll-end
pass. Full GUI suite: library-servers-bulk and market-have failed once
under load and pass alone; market-have fails on origin/main
|
||
|
|
793af76242 |
gui: Codex's subagents setting, unset, says the lead picks the model and only falls back to the main model, not just "same as model" (willz on Discord)
willz set Codex's "subagents" to 同主模型 (same as model), and a subagent
still ran on another model. Codex 0.162 lets the spawn_agent call's own
`model` argument win over `[agents] default_subagent_model`
(core/src/agent/child_config.rs:
requested_model.or(agent_default_subagent_model)). The default only
applies to a spawn that names no model, and the spawn_agent tool lists
up to 5 models the lead may name. So "same as model" was false whenever
the lead named a model.
This was reproduced with the real codex-cli 0.162.0 in a sandbox
HOME/CODEX_HOME, against a fake Responses server on port 3683 that logs
each request's model and x-openai-subagent header. The lead ran on
gpt-6.1-sol in every case:
a. lead names astra, default unset -> subagent on gpt-6-astra
b. lead names none, default unset -> subagent on gpt-6.1-sol
c. lead names astra, default sol -> subagent on gpt-6-astra
d. lead names none, default astra -> subagent on gpt-6-astra
magpie already holds every subagent to one model with the "subagent
model" setting (the gateway's codexSubagentPick,
|
||
|
|
9bb2a467e4 |
agent: Snow CLI is an agent magpie sets up: a magpie profile in ~/.snow, made the active one, that Snow App takes in with "Sync Snow CLI API config" (#1457)
Snow CLI (npm snow-ai, MIT, MayDay-wpf/snow-cli) keeps one profile per file under ~/.snow/profiles (or $SNOW_CONFIG_DIR), names the active one in active-profile.json, and copies it over config.json at every start, headless `snow --ask` included. Each profile is the whole snowcfg: base URL, key, request method and models. Snow App (MayDay-wpf/snow-app) reads ~/.snow/profiles/*.json when "Sync Snow CLI API config" is pressed. magpie writes profiles/magpie.json from the profile the user was on (their settings kept, Snow's OAuth sign-in left out): baseUrlMode base at the gateway's /v1, requestMethod chat, the agent's key, the model as advancedModel and basicModel, and the catalog's window and output (200000 and 64000 when not known, the output cut to the window). It makes that profile active and copies it to config.json. The profile the user was on, whether there was an active-profile.json at all, and a magpie.json of their own are stashed; Disconnect, `magpie snow default`, or picking a model of one of the user's profiles puts those back. A Snow from before profiles (config.json alone) gets the default.json Snow itself would make, so its next start doesn't take magpie's config for the user's. Check reports a base URL, key or request method moved off magpie's; Sync rewrites the profile on a port move. A WSL distro's ~/.snow is found and written the same way. Registered: agents.go, the WSL kinds, SNOW_CONFIG_DIR in agentenv, the npm update spec (snow-ai), the icon (Snow App's own, trimmed to 96px), README, docs/reference.md, docs/subsystems/agent-wiring.md, the site's agent list and start.html (en, zh, ja). Run: - go test -tags nogui ./... in a scratch HOME: 44 packages ok. New: TestSnow, TestSnowOwnProfile, TestSnowNoProfiles, TestSnowUsersMagpieProfile, TestSnowCheckSync, TestAgentSnowDefault; snow added to TestOwnProviderNamedAsMagpies, the WSL more-agents tests and TestMaxTokensWithinContextWindow. All fail before this commit (no agent "snow"). - go vet -tags nogui for darwin, linux and windows; gofmt -l clean. - Real Snow CLI 0.9.2 in a sandbox HOME against a sandbox magpie (`magpie serve` on 127.0.0.1:3571, a fake OpenAI upstream on 3561): `magpie snow fake/pro` made the magpie profile active, `snow --ask` answered through the gateway (POST /v1/chat/completions, model pro, logged as agent snow), and `magpie snow default` left profiles, active-profile.json and config.json byte-identical to before. - GUI: agent-layout, agent-connect, agent-models-picker, agent-field-names and models-add-and-icons in Chromium and WebKit; a Snow CLI row checked at 520-960px in en, zh, zh-TW, ja and de in both engines. No new GUI strings. |
||
|
|
189586612e |
agents, gateway: Codex's subagents go on a model set in its row, a ChatGPT account's (willz on Discord)
Codex's lead names each subagent's model itself in spawn_agent, and
Codex's [agents] config can't overrule it. The Agents page's Codex row
now has a "subagent model" square (the app's model picker, Default
first). Its options are only models a ChatGPT account in magpie serves,
because a subagent's task is sealed for ChatGPT accounts.
- settings.CodexSubagentModel holds it. It is an agent Field
(subagent_model), so the TUI/CLI, profiles, davsync's "agents" part
and WSL twins carry it too. The setter refuses another provider's
model. It keeps a ChatGPT account's model that isn't served now, so a
backup restored on another computer still applies (ApplyFields stops
at the first failed Set). POST /api/settings keeps it.
- The gateway (codexSubagentPick) moves a collab_spawn request onto it.
codexBackend does this for Codex's own bare models; serve() does it
for any other model. When no ChatGPT account on in magpie serves it,
or a held gateway key may not use it, the request stays on the model
asked for. Route.Subagent records asked/to/kept. The lead's turns,
titles, guardian and the rest are never moved. Off (the default)
changes nothing.
- Routing page: kindWhy says the subagent was put on the model set, or
stayed on its own and why. "only account on for" names the model it
went on. Strings added in zh, zh-TW, ja and de.
- docs/subsystems: gateway-routing.md and agent-wiring.md describe it.
Run (darwin, rebased on origin/main):
- gofmt -l internal/: clean.
- go vet -tags nogui on gateway, provider, agent, gui and settings:
darwin, GOOS=linux and GOOS=windows.
- go build ./...
- HOME=<temp> go test -tags nogui ./...: all ok.
TestSettingsSaveKeepsWhatItDoesNotSend flagged the new field; it is
now set there.
- GUI tests, Chromium + WebKit:
- codex-subagent-model.test.cjs: 20/20 (en, zh, zh-TW, ja, de at
1100 and 560 px).
- Also green: routing-kind, subagent-effort, codex-memories,
codex-memories-settings, i18n-keys, gui-ja, gui-de, gui-zh-tw and
click-scroll.
Failing without the change (codexSubagentPick returning nil):
- TestCodexSubagentPutOnTheModelSet
- TestCodexSubagentOnAnotherProviderPutOnTheModelSet
- TestCodexSubagentModelNotServedKeepsTheAsked
- TestCodexSubagentModelHeldKeyKeepsTheAsked
TestCodexSubagentModelLeavesOtherRequests guards the other side: the
lead's turns, titles and guardian stay untouched.
Not tried with a real Codex CLI and ChatGPT account. A subagent spawn
needs a signed-in Codex home, and this session may not touch the live
~/.codex. The fake ChatGPT backend tests cover both routes.
|
||
|
|
0b5b10da2a |
agent, gateway, gui, tui: a Codex that goes through magpie only to fail over to the user's other ChatGPT accounts says so on the Agents row and keeps to its own models (#1385, shenghsi)
With several ChatGPT accounts on, failover writes openai_base_url into ~/.codex/config.toml so a turn the signed-in account can't pay for goes on to the next account. With Codex's switch off, the row said only "not connected", but every request still went through the gateway, and the gateway's /backend-api/codex/models answer added all of magpie's models (62 for the reporter). - agent: Agent.FailingOver means not wired, while the stash's codex.failover (or a CC Switch mirror's codex.mirror_failover) base URL points at magpie. FailoverSaid is the line the CLI list and the TUI show. CodexOwnOnly is true for this machine's Codex when it is failing over and no WSL Codex is connected, since a WSL Codex shares the gateway path. Sync ages a models_cache.json that isn't tagged with the own-only list. - gateway: codexModels leaves out provider.CodexListed when gateway.CodexOwnOnly (set by main to agent.CodexOwnOnly) says so. The ETag and X-Models-Etag carry provider.CodexOwnListTag. Neither tag contains the other, so Codex fetches the list again when it is connected or disconnected. - gui: /api/state carries failover. The row says "Not connected · goes through magpie only to fail over to your other ChatGPT accounts". Its title says what turns it off. A "ChatGPT accounts" button opens Providers › Codex. Strings are in zh, zh-TW, ja and de. openProvider no longer draws the Providers list before it has loaded. It was only safe once the tab had been opened, and this is its first caller from another page. - docs: agent-wiring and gateway-routing describe the failover-only Codex and list the new tests. A user's hand-written openai_base_url (#856) isn't failover's, so it stays a plain not-connected row. Verified: - TestCodexFailoverOnlyKeepsOwnModels (agent) builds the reporter's state in a temp HOME: Codex signed in, two more ChatGPT logins on, Sync, so the stash has codex.failover=1 and no joined/beside. It checks that the row is not wired and is FailingOver, that FailoverSaid names Providers › Codex, and that the real gateway handler's /backend-api/codex/models lists only the backend's gpt-5.5. It also checks that the cached full list is aged, and that after Join magpie's fake/m1 is back. - TestCodexModelListOwnOnlyForFailover (gateway) checks the list and both ETags with the hook on and off. - agent-failover.test.cjs checks the row text, title and button in en, zh, zh-TW, ja and de, at 980px and 420px, in Chromium and WebKit (20 pass). It also checks that the button opens Codex's editor, that the page doesn't scroll sideways, and that no click moves it. - Broken by hand, each test goes red: - codexModels ignoring the hook fails both Go tests. - failingOver returning false fails the agent test. - dropping the Sync cache case fails the agent test. - removing the GUI branch fails the GUI test. - drawing the list before it has loaded (the old openProvider) fails the GUI test. - go test -tags nogui ./internal/agent ./internal/gateway ./internal/provider ./internal/gui ./internal/tui ./internal/codexcat . in a temp HOME: all ok. - node --test agent-*.test.cjs (254 pass) and i18n-keys, gui-ja, gui-de, click-scroll: all pass. - gofmt -l is clean. - go vet -tags nogui on darwin, linux and windows: clean. - go build, and GOOS=windows go build: ok. |
||
|
|
1bc0ed404a |
minimax-code: magpie's models have one slash in the whole ref, so SubAgents take them (#1387, worksyang)
MiniMax Code 3.1.0 checks a SubAgent's model against /^[^/\s]+\/[^/\s]+$/ (uQn in @minimax-ai/code's chunk-2XPMNZVR.js), and magpie wrote its models under custom_provider.magpie by catalog id, so custom_provider:magpie/bb-codex/gpt-6.1-sol was refused (AGENT_CONFIG_INVALID). - The writer keys each model by its catalog id with "~" for each slash (bb-codex~gpt-6.1-sol, provider.FlatID), when exactly one served id spells that way (provider.Flattened); else it keeps the slashed id. - The gateway takes such an id back to that one provider's model or group in validateModel and unprefixed (unflat / provider.Unflat): only an id with "~", no slash, that resolves as nothing else; two ids spelled alike are neither. Never a bare-name first hit. Key limits, middleware and usage see the catalog id, so a key held to bb-codex/* is refused other~gpt-6.1-sol on every route, count_tokens too. - A config an older magpie wrote moves on the next sync: the user's keys on a model go to its new key, defaultModel, defaultLightModel and memory.captureModel/consolidationModel follow, and the slashed key stays with enabled: false, so a session begun on it still resumes (checked with mcode exec --continue). Get still reads magpie/<catalog id>, and Disconnect still puts back the stashed default and variant. Other agents: no installed agent bundle here (cline, command-code, qwen-code, deepseek, pi, omp, codebuff, openclaw) has this regex; native agents were not checked. Verified: - go test -tags nogui ./internal/agent ./internal/gateway ./internal/provider (temp HOME), gofmt -l, go vet darwin/linux/windows. - New TestMiniMaxCodeOneSlash uses the reporter's regex and ids; TestFlatModelIDsReachTheirProvider has two providers serving gpt-6.1-sol. Breaking unflat, mcodeKey, the key carry-over, the legacy enabled:false and the ref rewrite each turned the tests red. - Real run: built magpie serve in a temp HOME on 47812, two fake upstreams; `magpie mcode magpie/other/gpt-6.1-sol` wrote other~gpt-6.1-sol; real mcode 0.6.5 exec reached other's upstream with gpt-6.1-sol (usage: other/gpt-6.1-sol); its agent loader accepted an agent.md with custom_provider:magpie/other~gpt-6.1-sol and refused the two-slash one; `magpie mcode default` put minimax/MiniMax-M2.7 back. |
||
|
|
78d90571cf |
agent: each named omp profile is an agent of its own, on Windows and in each WSL distro (#1233)
* agent: each named omp profile is an agent of its own, on Windows and in each WSL distro (#1187) The Agents tab's omp row only ever wrote the one folder ompDir picks, so a profile started with omp --profile kept the model it had. ~/.omp/profiles/* is now listed per location: omp#<name> on Windows, omp#<name>@wsl:<distro> in a distro, each with the omp row's model, role and thinking controls writing that profile's own config.yml and models.yml. The profile the default row already points at (OMP_PROFILE) is not listed twice, and a stopped distro is not started to list its profiles: the names come from the probe and stay in wsl.json. * gui: an omp profile's id is encoded in the Agents page's requests (#1187) omp#<name> went into /api/agents/connect and the rest raw, so a browser read #work as the fragment and connected, disconnected or previewed the default omp row instead. api() now encodes each path segment, which is what agent-models and agents/cli already did for the id alone. * agent, gui: an omp profile name is one omp takes, and only its # is encoded (#1187) api() encoded every character of a path, so a query's ? = & became part of the path and Usage, quotas and Sessions 404ed. Only # is encoded now, which is what omp#<name> needs; a query stays a query. ompProfileOK also refuses the Windows device names omp refuses on every platform (aux, nul, com1, lpt9.x, con.work), and work. is checked through that rule rather than by making the folder, which Windows would turn into work. |