Commit Graph
11 Commits
Author SHA1 Message Date
yetone 2eee900dc9 agent: eight more syncs keep what the user set on magpie's block (#2030's siblings)
1e654d8ce fixed T3 Code's sync, which rewrote magpie's provider instance
whole. The same shape lost user-set keys in eight more agents. On every
Sync and every pick, each one rewrote magpie's own block in the agent's
config whole. Each app's schema was taken from its own source, never
guessed:

- Qoder 1.1.70 (@qoder-ai/qodercli bundle): providers.magpie lost routing
  (the compact and subagent models), firstPayloadTimeoutMs,
  streamIdleTimeoutMs, type, authType, anthropic and a displayName.
- fx (vercel-labs/fx configured_provider.zig): reviewer_model was lost,
  and a tool_choice_mode of "omit" went back to "send". auth stays
  magpie's whole, since fx refuses an env beside type none.
- Hermes (hermes_cli/config_providers.py): `hermes model` itself writes
  default_model into providers.magpie. That was lost, as were key_cmd,
  the timeouts, extra_body, a name and extra headers. This held in every
  profile spread() writes.
- omp (models-config-schema-bundle.ts): modelOverrides, discovery,
  disableStrictTools, headers and compat flags were lost. auth and
  apiKey stay magpie's, or go, so a loopback's auth: none never sits
  beside a WSL key.
- Kimi Code (configSection.ts ProviderConfig): SetTOMLTable replaced
  [providers.magpie], losing inline custom_headers, env and
  default_model. Its three keys are now set in place.
- Cline (local-provider-registry.ts): models.json lost the provider's
  other keys, and the per-model overrides that the VS Code model editor
  writes. A model magpie no longer lists still goes.
- Goose (declarative.rs): the custom provider file was rewritten whole,
  losing display_name, timeout_seconds, toolshim, other headers and the
  like. Goose's own editor carries those keys over.
- ZCode (provider-data-schema.ts, strict): the provider rule lost
  providerName, logo, visibility, api.headers and
  access.apiKeyManagementUrl. Only keys already in the file, which ZCode
  accepted, are kept.

Each merge lays magpie's block over what is there. magpie's parts (the
address, the key, the format and the model list) are named, and a key
magpie stops writing goes with them. The JSON ones use theirsKept or
mergeKept. A new yamlKept does the same for Hermes and omp.
agent-wiring.md lists what each one keeps.

Tests: Test{Qoder,Fx,Hermes,Omp,Kimi,Cline,Goose,ZCode}KeepsTheUsersSettings.
Each one:
- connects;
- sets the user's keys the way the app writes them, plus a stale
  address and a stale model;
- adds a provider, then syncs 3 times and picks again;
- checks that the user's keys stay, that magpie's parts are rewritten,
  and that the stale model is gone.

All eight fail on origin/main's agent code (each reports "the user's
settings not kept") and pass with this change.

Run, in a sandbox HOME, with GOCACHE in the scratchpad and Go 1.26.8:
- gofmt -l on the changed files: clean.
- go vet ./... (darwin), GOOS=linux go vet -tags nogui ./... and
  GOOS=windows go vet ./...: clean.
- go test -tags nogui -timeout 45m ./internal/agent: ok, 805s.
- go test -tags nogui -timeout 45m ./...: all ok.

Not tried: none of these apps was run against a real config written by
this change. Their schemas come from their source (Qoder's npm bundle,
fx, Hermes, oh-my-pi, kimi-code, cline, goose and ZCode at their current
heads), not from a live install.
2026-10-14 09:21:18 +08:00
yetone 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).
2026-10-13 07:07:18 +08:00
yetone 20582866a5 agent, gui: an agent's advice after a change reads in the window's language (#1508, NovaTrailX)
A Chinese window said "ZCode 已接入 magpie. ZCode reads its providers at
start-up — restart ZCode …": the notice an agent gives after a change
(state.notice) was English text written in place in each agent's file, and
i18n.js had no entry for any of them.

What changed:
- internal/agent/notice.go: a notice is a template registered with
  newNotice ("Restart {agent} to …"), filled with say(kv...); Notices()
  lists every one. All the agents' notices (claude, codex daemon, zcode,
  agy, cursor-local, wsl, AstrBot's added today, …) are now such templates, the issue's list
  being a sample of them.
- i18n.js: every template has a zh, zh-TW, ja and de translation, and
  NOTICES lists them. tNotice() reads a notice of several joined: longest
  template first, a {slot} never runs over a sentence's end, and a notice
  with any part that has no template (a plugin's own) reads as given
  rather than half in each language. withNotice() joins the status line
  and the notice with 。 in zh/ja.
- app.js: the six places that showed state.notice use withNotice.

Tests:
- TestEveryNoticeIsTranslated: every Notices() template is in NOTICES and
  in each language table, with the same slots. Fails with the zh ZCode
  line deleted from i18n.js (tried).
- TestNoticesAreTemplates: an AST scan for English written in place as a
  Notice. Fails with zcode.go's literal put back (tried).
- tests/agent-notice-lang.test.cjs: every template, filled, alone and
  joined, plus a plugin's notice, and connecting ZCode as the reporter
  did; en, zh, zh-TW, ja, de at 1100 and 420px, Chromium and WebKit:
  22/22. Its zh subtests fail without the zh line.

Run: go test -tags nogui ./internal/agent ./internal/gui; gofmt -l;
GOOS=linux and GOOS=windows go vet -tags nogui ./internal/agent
./internal/gui; the full GUI suite (node --test, both engines, -concurrency 6,
machine load ~140): 5130/5195, 64 failing in 22 files. Rerun alone, 16
files pass; mobile-web, old-webkit, panel-usage and routing-context/
group/keys-fold fail the same on the base commit, b6a263b9.

go test -tags nogui -timeout 40m ./... on the rebased tree: every package
ok but internal/gateway, whose TestQueuedStreamKeptAliveForTheMinute hit
its 1.5s read deadline at a machine load of ~130; it passes -count=3 run
alone, and this change touches nothing it runs.
2026-10-11 02:34:30 +08:00
yetone e77a373792 agent: every agent in a WSL distro under NAT is given the LAN sharing key, not "magpie" (whqtian on Discord) — v0.1.972 gave it to omp only, and OpenCode in WSL was still written "apiKey": "magpie" with Windows' address, which the gateway takes from loopback only. keyAt(gw) is the key for a gateway URL: the LAN sharing key when the URL isn't this machine's and sharing is on, else gateway.Token; OpenCode (and MiMo Code), Crush, Pi/omo, Codex, Claude Code, Kimi Code, Hermes, Grok, MiniMax Code, Droid, Morph, dsh, Qoder/Qoder CN and omp write it, their Checks compare against it (an old "magpie" there shows as drift), and ourKey still sees a LAN-keyed config as magpie's. TestGatewayKeyBeyondLoopback fails without the change. go vet ./..., go test -tags nogui ./internal/agent ./internal/gui ./internal/gateway ./internal/access ./internal/provider under a temp HOME, GOOS=linux/windows go build pass. 2026-10-05 15:19:09 +08:00
yetone 165fee0df5 agent: an agent's own provider named as one of magpie's isn't magpie's, in every agent that spells a model provider/model (the rest of #835) — OpenHanako's own deepseek/deepseek-v4-pro read as magpie's deepseek, and so did a model of any agent's own provider whose name magpie has a provider by: Pi's, Crush's, Hermes's, OpenCode's relay/glm-4.6 with magpie's relay had the row connected on the agent's own model, and Disconnect from magpie put that model back and left the row connected. An agent says how magpie's values are spelled in it (Spelled, replacing #835's Prefixed): magpie/<ref> for Antigravity CLI, Pi, OmO, Aside, Goose, Zed, VS Code, Crush, DeepSeek Harness, Command Code, fx, omp, Hermes, Mister Morph, Kimi Code, Empryo, MiniMax Code, Droid, Qoder, Qoder CN, Grok Build, AtomCode, Cline and OpenHanako, whose every Get spells magpie's so (a sandbox Set of magpie/relay/glm-4.6 read back as that in each); for OpenCode, MiMo Code and OpenChamber also a provider of the config's own that sends to magpie's gateway, as openCodeRef names a model there. A stopped WSL distro's agent keeps its live one's. Left as they are: Claude Code, Claude Desktop, Codex, Gemini CLI, Cursor, Copilot, Devin (magpie's are bare refs there), Muse Code (a model with / is magpie's by design: Meta's have none), Alma (its own are providerId:model), Air (magpie's only). TestOwnProviderNamedAsMagpies (26 agents: own relay/glm-4.6 not connected, Connect, Disconnect puts it back and the row is off) fails on the old code in each; TestOpenCodeGatewayProviderIsMagpies. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. 2026-10-05 06:49:45 +08:00
yetone dd70a4055a wsl: OpenCode, Kimi Code, omp and the other CLIs magpie sets up through a file in the home are set up in WSL distros too (#515: on Windows only Codex, Pi, OmO and Claude Code were found in a distro) — fourteen agents join wslKinds, each found by its folder under the distro's $HOME or its command on the distro's own PATH, and listed as <name> · WSL <distro> (opencode@wsl:Ubuntu…): OpenCode (~/.config/opencode, opencode), MiMo Code (~/.config/mimocode, mimo), Kimi Code (~/.kimi-code, kimi; the old kimi-cli's ~/.kimi where that is all there is, found by the command), omp (~/.omp/agent, omp), Crush (~/.config/crush/crush.json, Linux's place, not Windows' LOCALAPPDATA), Hermes Agent (~/.hermes), Grok Build (~/.grok, by its folder alone, as on this machine), Droid (~/.factory), fx (~/.fx, by its folder alone: fx is also the JSON viewer), Command Code (~/.commandcode), MiniMax Code's mcode (~/.minimax), Muse Code (~/.config/muse), Qoder and Qoder CN (~/.qoder, ~/.qoder-cn). Each is its host constructor at a place (opencodeIn, kimiIn, ompIn, crushIn, hermesIn, grokIn, droidIn, fxIn, commandCodeIn, miniMaxIn, museIn, qoderIn/qoderCNIn; the host's opencode(home, cfg) and the rest wrap them), so it writes the same keys and schema as on this machine, but the gateway as the distro reaches it (place.gw/v1: 127.0.0.1 when mirrored, Windows' address under NAT) in its provider, its Check and its Sync, and its folder at the default, as the distro's variables (OPENCODE_CONFIG_DIR, KIMI_CODE_HOME, HERMES_HOME, FACTORY_HOME_OVERRIDE, MINIMAX_DATA_DIR, QODER_CONFIG_DIR…) aren't read (place.getenv is "" there); OpenChamber, a Windows app, isn't looked at for a distro's OpenCode, and omp there, whose version isn't known, gets xhigh rather than a max an older omp refuses. Their notices are the restart advice of their own, as for Codex. A stopped distro's agent is built without looking at its files (place.cold: exists/isDir are false, so the defaults are taken), its options read none (wslOwnAsleep, kimiOwnOptions/ompOwnOptions/miniMaxOwnOptions without a file), and a pick, once the distro is started, builds the agent again warm, so it writes the file the agent reads — an opencode.jsonc already there, ~/.kimi for kimi-cli — not the default. Left out: Gemini CLI and Antigravity (a key lent through .env, a launch command), dsh (profiles and .env), Devin (no gateway; its model list from the devin command on this machine), Goose (no magpie routing; its name is pressly's goose too), Cursor and Copilot (no magpie routing), and the apps (Cline, Hanako, WorkBuddy, ZCode, Claude Desktop, OpenChamber, Alma, Cindy); and the library's skills, MCP and instructions for the new WSL agents, which wslTargetOf still gives only Claude Code, Codex, Pi and OmO. Nothing ran on Windows or in a real WSL. wsl_more_test.go, on fake distro roots under temp dirs with the host's variables pointed elsewhere: TestWSLProbeFindsMoreAgents (each folder and command in the probe, none for grok and fx, kimi-cli by its command), TestWSLMoreAgentsDiscovered (all fourteen listed, no command, UA or aliases), TestWSLMoreAgentsPick (each agent, mirrored and NAT: its file in the distro names the distro's gateway, no 127.0.0.1 under NAT, Check passes, Sync keeps it, the notice; this machine's home and the folders its variables name untouched), TestWSLMoreAgentsStopped (nothing asked nor opened, the last value shown, options, a pick starts the distro and writes there) fail without the change; TestWSLStoppedPickFindsItsFiles fails without the warm rebuild (the pick wrote a second opencode.json beside the .jsonc). go vet ./internal/..., go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build and vet ./internal/..., GOOS=windows go test -c ./internal/agent/ ./internal/library/, and go test -tags nogui -count=1 ./... under a temp HOME pass (TestFXInState failed once on its TempDir cleanup race, passes on the rerun; untouched). 2026-10-02 14:16:38 +08:00
cyxer000 f3b45634a3 agents: Droid, Qoder, OpenHanako, WorkBuddy, OpenCode and ZCode no longer get an output limit above the model's context window (#347) 2026-10-01 00:27:00 +08:00
yetone 4eead4d4e0 agents: the effort picked for Cline and Qoder is the one they use — Cline's reasoning is written {enabled:true,effort} ({enabled:false} for none), as its own pickers leave an enabled false that drops an effort beside it, and such a one reads as none; Cline's VS Code extension (4.x), which takes its provider, model, base URL and key from globalState.json and secrets.json before providers.json, has those set too where they are, stashed and put back on the way out, and $CLINE_DATA_DIR is honoured. Qoder (1.1.6x) keeps each model's effort in model.preferences and moves model.reasoningEffort there once: magpie sets the model's preference (a model id with dots too), carries the effort in use to a model with none of its own, and keeps reasoningEffort for older Qoders. Cline's desktop app keeps its composer's model and effort in its web view's storage, which magpie leaves alone; its notice says to pick there 2026-09-28 13:41:31 +08:00
yetone b87a3ce360 agents: Qoder is known as Qoder, not Bun — Qoder CLI is a Bun single-file build whose requests carry Bun's User-Agent and nothing of Qoder's, so magpie's provider in Qoder (and Qoder CN) now carries the key magpie-qoder (magpie-qoder-cn), which the gateway knows an agent by before its User-Agent: usage, the routing view and the models it is shown say Qoder. A Qoder wired before with the key magpie is still magpie's and gets the new key on the next sync, as magpie starts 2026-09-27 20:59:38 +08:00
yetone 55afcdd4bb agents: Qoder CN — qoderclicn, the China site's build of Qoder's CLI, is the same CLI with its own accounts and its settings in $QODERCN_CONFIG_DIR, ~/.qoder-cn by default; magpie wires it as it does Qoder, a magpie custom provider with every magpie model and model.name/model.reasoningEffort, as its own agent 2026-09-27 08:05:12 +08:00
yetone cae88f031c agents: Qoder — magpie's models in Qoder's CLI (1.1) as a "magpie" custom provider in ~/.qoder/settings.json ($QODER_CONFIG_DIR): picking magpie/<model> or a routing group writes the provider, with every magpie model, its context, output, images and the efforts it takes, and makes it model.name; the effort is model.reasoningEffort. The comments and entries of the user's settings stay, and stepping out of magpie takes its provider away and puts back the model the user had. Qoder offers custom providers only to a signed-in account whose plan has BYOK. It asks every model for enable_thinking, which OpenAI's API refuses, so that is dropped for openai.com. Tested live: magpie → settings.json → qodercli -p → magpie's gateway → upstream, the reply streamed back 2026-09-27 06:28:14 +08:00