Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
agent: a VS Code fork's own code launcher no longer lists it as VS Code too (ggbr on Discord)
yetone92f02d677baa
diff --git a/docs/subsystems/agent-wiring.md b/docs/subsystems/agent-wiring.mdindex 94591ce95..265733eb7 100644--- a/docs/subsystems/agent-wiring.md+++ b/docs/subsystems/agent-wiring.md@@ -133,7 +133,7 @@ something else shows up as drift.- PenguinHarness's file is `$PENGUIN_HOME` (else `~/.penguin/data`, on Windows too) `/<project>/.project_config.toml`, the Project `$PENGUIN_PROJECT_ID` when it is a folder's name (`agentenv.NotPaths`, so a relative name isn't dropped as a path), else `default_project`; a WSL distro's is its `~/.penguin/data/default_project` ([`penguin.go`](../../internal/agent/penguin.go)). Magpie's models are `[[models]]` array entries with `provider = "magpie"`, replaced together where the first one was by `edit.SetTOMLArrayTables`, which leaves the user's entries, the blank lines between them and the file's time alone when nothing changed (Penguin's server reads the file again on every mtime change). `default_model` is spelled `{ provider = …, model_id = … }` as Penguin's own writer (smol-toml) spells it; that writer rewrites the whole file, so Disconnect takes out magpie's provider, entries and a vision model on them rather than putting back a copy. A default naming no entry is refused by Penguin, so entries go in before `default_model` and out after it. PenguinHarness's desktop app (`PenguinHarness.app`, bundle id `com.prismshadow.penguinharness`; on Windows `PenguinHarness\PenguinHarness.exe` under `%LOCALAPPDATA%\Programs` or the folder its installer registered, `desktopApps`) runs its server on the same root and needs no CLI, so with it installed the agent is detected before the app is first opened (`sign`) and never shown as gone; Connect then writes `default_project`, which the app's server adopts without overwriting (rankyurky_80676 on Discord, `TestPenguinDesktopAppDetected`, `TestPenguinDesktopOnlyConnects`).- CodeBuddy is one row for the CodeBuddy Code CLI and the CodeBuddy IDE (Tencent's VS Code fork; 4.12.2's `CodeBuddy.app`, `com.tencent.codebuddy`, from codebuddy.ai, and `CodeBuddy CN.app`, `com.tencent.codebuddycn`, from codebuddy.cn; both are `desktopApps["codebuddy"]`, the second as one of its `more` builds) ([`codebuddy.go`](../../internal/agent/codebuddy.go)). The IDE's genie extension (`CustomModelsProductProvider`, with `CustomModelsJSON` on in its `product.json`) reads `<home>/.codebuddy/models.json`, the file magpie writes for the CLI, skips an entry without a string `id` and `url`, takes `availableModels` as a whitelist when it has one, and lists each model in its own picker; it ignores `$CODEBUDDY_CONFIG_DIR` and settings.json's `model`. With only the IDE installed the row is detected (`sign`), shows the IDE's version and is never "CLI not found" (bjzhangwn on X; `TestCodeBuddyIDEIsCodeBuddy`, `TestCodeBuddyIDEReadsMagpieModels`). The IDE's Windows and Linux install folders aren't known, so there it is found by `~/.codebuddy` alone (never gone on Windows, as every `desktopApps` agent).- Zoo Code's provider profiles are in VS Code's secret storage, so magpie writes a settings file for it (`magpie-import.json` in Zoo Code's `globalStorage/zoocodeorganization.zoo-code/settings`, not magpie's folder, so a sync keeps an address the user moved it to) and points Zoo Code's `zoo-code.autoImportSettingsPath` at it in VS Code's `settings.json` and each profile's, a user's own path stashed and put back ([`zoocode.go`](../../internal/agent/zoocode.go)). Zoo Code imports it on each start (`importSettingsFromPath`), merging it over the user's profiles and making `magpie` the current one. Disconnect stops the import and deletes the file; the profile already imported stays in Zoo Code, where magpie can't reach it.-- An agent is detected by its config file, its folder, or its command on magpie's PATH (`Detected`). That PATH is the login shell's plus the folders users' tools go in (`proc.UserPath`: `~/.local/bin`, npm's prefixes, the Node nvm's default alias resolves to (the highest installed when it names none), bun, Homebrew, ...; on Windows the registry's PATH plus the Node fnm's default alias names, `%APPDATA%\fnm\aliases\default` or under `FNM_DIR`, which fnm puts on a terminal's PATH from the shell profile and never in the registry, #2685), so a CLI a terminal doesn't find can still be found and listed: an npm install under a Node the terminal no longer uses. `/api/agents/cli` then gives where it is (`path`) and `offPath` when the login shell's PATH (`proc.LoginPath`) lacks its folder, and the Agents row says "Not on your terminal's PATH", its tip naming the file (悠悠哥 on Discord: Codex 0.162.1 listed with no codex on PATH and no `~/.codex`). An unknown login PATH says nothing. A folder another tool writes too doesn't count (`dirShared`): Pi's for omp, `~/.copilot` for the Copilot CLI, which GitHub Copilot's JetBrains and VS Code plugins also write, and Qoder's and Qoder CN's, which Qoder's JetBrains plugin fills, and `~/.cursor` for Cursor CLI, which the Cursor editor makes on its own (`TestCursorFolderFromTheEditorIsNotTheCLI`, @G_Z_Y on X); only `cli-config.json` or `cursor-agent` finds Cursor CLI. A config file another tool writes first counts only when `pathOwn` says it is the agent's: Qoder's `settings.json` holding `enabledPlugins` alone is the plugin's (`qoderPluginOnly`; #1495, `TestCopilotFolderFromAnIDEPluginIsNotTheCLI`, `TestQoderSettingsFromAnIDEPluginIsNotTheCLI`). The Qoder app (the desktop app, which runs Qoder's CLI as its agent with the same folder) is found by the `.qoder-app-status.json` it writes there (`sign`, `qoderApp`; #2138, `TestQoderAppIsQoder`), as its `settings.json` can be its bundled plugin's `enabledPlugins` alone. Only the GUI and `daemon install` widen the PATH so; `magpie serve`, `web`, `tui` and the CLI keep the one they were started with, so an agent's CLI (`cliBin`, which its version and `omp`'s max effort are read from) is looked for in those folders (`proc.FindTool`) on every system when it isn't on the PATH, not only on Windows (whqtian on Discord: omp under `~/.bun/bin` on Ubuntu read as no version and offered xhigh in place of max; `TestOmpVersionOffPath`).+- An agent is detected by its config file, its folder, or its command on magpie's PATH (`Detected`). That PATH is the login shell's plus the folders users' tools go in (`proc.UserPath`: `~/.local/bin`, npm's prefixes, the Node nvm's default alias resolves to (the highest installed when it names none), bun, Homebrew, ...; on Windows the registry's PATH plus the Node fnm's default alias names, `%APPDATA%\fnm\aliases\default` or under `FNM_DIR`, which fnm puts on a terminal's PATH from the shell profile and never in the registry, #2685), so a CLI a terminal doesn't find can still be found and listed: an npm install under a Node the terminal no longer uses. `/api/agents/cli` then gives where it is (`path`) and `offPath` when the login shell's PATH (`proc.LoginPath`) lacks its folder, and the Agents row says "Not on your terminal's PATH", its tip naming the file (悠悠哥 on Discord: Codex 0.162.1 listed with no codex on PATH and no `~/.codex`). An unknown login PATH says nothing. A folder another tool writes too doesn't count (`dirShared`): Pi's for omp, `~/.copilot` for the Copilot CLI, which GitHub Copilot's JetBrains and VS Code plugins also write, and Qoder's and Qoder CN's, which Qoder's JetBrains plugin fills, and `~/.cursor` for Cursor CLI, which the Cursor editor makes on its own (`TestCursorFolderFromTheEditorIsNotTheCLI`, @G_Z_Y on X); only `cli-config.json` or `cursor-agent` finds Cursor CLI. A command another app ships under the agent's name doesn't count either: VS Code forks put a `code` launcher in their own bin folder (Cursor; Qoder IDE beside `qoder`), which their Windows installers put on PATH, so a `code`, `code-insiders` or `codium` counts as VS Code, Insiders or VSCodium only when the `product.json` beside it names that build (`applicationName`), or names none (`vscodeCodeBinary`; ggbr on Discord: Qoder IDE listed as VS Code too, `TestVSCodeDetected`, `TestVSCodeBuildLauncher`). A config file another tool writes first counts only when `pathOwn` says it is the agent's: Qoder's `settings.json` holding `enabledPlugins` alone is the plugin's (`qoderPluginOnly`; #1495, `TestCopilotFolderFromAnIDEPluginIsNotTheCLI`, `TestQoderSettingsFromAnIDEPluginIsNotTheCLI`). The Qoder app (the desktop app, which runs Qoder's CLI as its agent with the same folder) is found by the `.qoder-app-status.json` it writes there (`sign`, `qoderApp`; #2138, `TestQoderAppIsQoder`), as its `settings.json` can be its bundled plugin's `enabledPlugins` alone. Only the GUI and `daemon install` widen the PATH so; `magpie serve`, `web`, `tui` and the CLI keep the one they were started with, so an agent's CLI (`cliBin`, which its version and `omp`'s max effort are read from) is looked for in those folders (`proc.FindTool`) on every system when it isn't on the PATH, not only on Windows (whqtian on Discord: omp under `~/.bun/bin` on Ubuntu read as no version and offered xhigh in place of max; `TestOmpVersionOffPath`).- Detection goes by an agent's folder, which an uninstall leaves behind, so an agent found by that alone is shown as gone (`CLIMissing`; #843, #2177, #2173): its CLI is on no PATH and in none of `proc.FindTool`'s folders nor where its own installer puts it (`~/.claude/local`, `~/.codex/packages/standalone`, `~/.opencode/bin`, Hermes' `hermes-agent` checkout), and nothing else that reads the folder is here (`cliHeld`): its desktop app (`HasApp`), an editor's extension (`~/.<editor>/extensions/<id>-*`: `anthropic.claude-code`, `openai.chatgpt`, `saoudrizwan.claude-dev`), Claude.app, OpenCode.app and Goose.app on a Mac, a JetBrains IDE's settings (its AI Assistant's agents and Cline's plugin) or Zed's `external_agents` (its Claude Code and Codex adapters). Where magpie can't tell (every shared folder, `cliShared`, on Windows, whose readers can be a Store app, a portable editor or a PATH only a shell profile sets, #1482, and there too one a desktop app of the agent's reads, `desktopApps`: DeepSeek Harness Desktop installs to any folder and puts its `dsh.cmd` in one the user picks, #2300, #2304; OpenCode and Goose off a Mac, Gemini, an agent detected its own way or by a command name other tools share, one with no install command but `cliOnly`'s Hermes), it is never gone. A gone row in the GUI shows "CLI not found" and none of its settings, nor Apply again; while connected it keeps its switch and Disconnect, and it folds under Not set up once not. Get started never offers it (`connectKind` is "no"). The TUI leaves it out and `magpie ls` says "CLI not found" (`TestCLIMissing*`, `agent-cli-missing.test.cjs`, `getting-started.test.cjs`).- Tests never touch the real machine. `TestMain` uses `testenv`, which points HOME, USERPROFILE, the XDG folders and APPDATA into a temporary folder, clears `agentenv.Vars` and puts failing stand-ins for keychain tools and agent CLIs on PATH. Agent-specific side effects (Aside, the Zed keychain, Codex's usage check) are also stubbed in `TestMain`.- Pi, OmO and Prime Agent write a Gemini-capable model as `google-generative-ai` at the gateway's `/v1beta` (`piModelJSON` in [`agents.go`](../../internal/agent/agents.go)); each one's Google client takes the version path from `baseUrl` (pi-ai's and senpi-ai's `apiVersion = ""`, Prime Agent's `pa-ai` `providers/google.rs`). StepCode keeps such a model on Chat (`stepcodeProvider`): it registers no `google-generative-ai` stream, only `anthropic-messages`, `openai-completions` and `openai-responses` (Step-Code `packages/providers/src/compat.ts`), though its docs list it. `magpieModels` in [`route.go`](../../internal/agent/route.go) includes Gemini and Code Assist capabilities when no native Chat, Responses or Messages API was selected; this includes a plugin model declaring `@ai-sdk/google`. Requests keep going through the gateway and the plugin's sign-in and fetch, with the gateway's usual translation where needed. A normal model sync updates existing entries. Routing groups retain their existing API choice, and Pencil remains on Chat. Pi resolves a level there to one of Gemini's four (minimal, low, medium, high) and throws on any other, so a level the model names otherwise is set to null in `thinkingLevelMap` (`TestPiGoogleThinkingLevelsAreGeminis`).diff --git a/internal/agent/vscode.go b/internal/agent/vscode.goindex ab82f69d7..164b166e8 100644--- a/internal/agent/vscode.go+++ b/internal/agent/vscode.go@@ -225,7 +225,7 @@ func vscodeKindAt(k vscodeKind, dir string) *Agent {return true}bin, err := proc.Look(k.bin)- return err == nil && vscodeCodeBinary(bin)+ return err == nil && vscodeCodeBinary(bin, k.bin)},Notice: func() string {if joined() {@@ -335,9 +335,16 @@ func vscodeKindAt(k vscodeKind, dir string) *Agent {}, path, models, stashPath())}-// Cursor can install its own launcher as code. Only a known product identity-// rules it out: wrappers without readable metadata keep the PATH fallback.-func vscodeCodeBinary(bin string) bool {+// Forks of VS Code ship a launcher named code beside their own, in the+// same bin folder: Cursor's, Qoder IDE's (Contents/Resources/app/bin/code+// beside qoder), and Windows' installers put that folder on PATH. Such a+// code is the fork, not VS Code (ggbr on Discord: Qoder IDE listed as VS+// Code too). So a launcher counts as the build whose command is app only+// when its product.json names that build (applicationName code,+// code-insiders or codium); one that names any other product is ruled+// out. A wrapper without readable product metadata keeps the PATH+// fallback.+func vscodeCodeBinary(bin, app string) bool {resolved, err := filepath.EvalSymlinks(bin)if err != nil {return true@@ -360,13 +367,24 @@ func vscodeCodeBinary(bin string) bool {if err != nil || json.Unmarshal(b, &product) != nil {continue}- if strings.EqualFold(product.ApplicationName, "cursor") || strings.EqualFold(product.NameShort, "Cursor") {- return false+ if name := strings.TrimSpace(product.ApplicationName); name != "" {+ return strings.EqualFold(name, app)+ }+ if short := strings.TrimSpace(product.NameShort); short != "" {+ return vscodeNameShort(short)}}return true}+// vscodeNameShort reports whether a product.json's nameShort is one of VS+// Code's own builds (Code, Code - Insiders, Code - OSS, Visual Studio Code,+// VSCodium) rather than a fork's (Cursor, Qoder, Windsurf, Trae, Kiro…).+func vscodeNameShort(short string) bool {+ s := strings.ToLower(short)+ return s == "code" || strings.HasPrefix(s, "code - ") || strings.HasPrefix(s, "visual studio code") || s == "vscodium"+}+// vscodeProfiles are the settings.json and chatLanguageModels.json of the// profiles made in VS Code besides its default (whose are in dir): a window// opened on one reads that profile's own, so a group only in the default'sdiff --git a/internal/agent/vscode_detect_test.go b/internal/agent/vscode_detect_test.goindex 8519997ef..28ed20956 100644--- a/internal/agent/vscode_detect_test.go+++ b/internal/agent/vscode_detect_test.go@@ -22,6 +22,21 @@ func TestVSCodeDetected(t *testing.T) {{name: "windows code", layout: "windows", product: `{"applicationName":"code"}`, want: true},{name: "windows cursor", layout: "windows", product: `{"applicationName":"cursor"}`},{name: "cursor name", layout: "mac", product: `{"nameShort":"Cursor"}`},+ // Qoder IDE ships bin/code beside bin/qoder (ggbr on Discord); its+ // product.json as the 2026-10-29 macOS build has it+ {name: "mac qoder", layout: "mac", product: `{"nameShort":"Qoder","nameLong":"Qoder","applicationName":"qoder","dataFolderName":".qoder","darwinBundleIdentifier":"com.qoder.ide","win32DirName":"Qoder IDE"}`},+ {name: "linux qoder", layout: "linux", product: `{"applicationName":"qoder","nameShort":"Qoder"}`},+ {name: "windows qoder", layout: "windows", product: `{"applicationName":"qoder","nameShort":"Qoder"}`},+ {name: "qoder symlink", layout: "mac", product: `{"applicationName":"qoder"}`, link: "single"},+ {name: "mac windsurf", layout: "mac", product: `{"applicationName":"windsurf","nameShort":"Windsurf"}`},+ {name: "windows trae", layout: "windows", product: `{"applicationName":"trae","nameShort":"Trae"}`},+ {name: "linux kiro", layout: "linux", product: `{"applicationName":"kiro","nameShort":"Kiro"}`},+ {name: "windows codebuddy", layout: "windows", product: `{"applicationName":"codebuddy","nameShort":"CodeBuddy"}`},+ {name: "mac antigravity", layout: "mac", product: `{"applicationName":"antigravity","nameShort":"Antigravity"}`},+ {name: "insiders product", layout: "mac", product: `{"applicationName":"code-insiders","nameShort":"Code - Insiders"}`},+ {name: "qoder name", layout: "mac", product: `{"nameShort":"Qoder"}`},+ {name: "code name", layout: "mac", product: `{"nameShort":"Code"}`, want: true},+ {name: "visual studio code name", layout: "windows", product: `{"nameShort":"Visual Studio Code"}`, want: true},{name: "unbranded product", layout: "mac", product: `{}`, want: true},{name: "invalid product", layout: "mac", product: `{"applicationName":"cursor",`, want: true},{name: "missing product", layout: "mac", want: true},@@ -129,3 +144,31 @@ func vscodeTestSymlink(t *testing.T, target, link string) {t.Fatal(err)}}++// Each of VS Code's builds is told by its own command's name in its+// product.json, and a fork's launcher of the same name is not it.+func TestVSCodeBuildLauncher(t *testing.T) {+ for _, tt := range []struct {+ app, product string+ want bool+ }{+ {"code", `{"applicationName":"code","nameShort":"Code"}`, true},+ {"code-insiders", `{"applicationName":"code-insiders","nameShort":"Code - Insiders"}`, true},+ {"codium", `{"applicationName":"codium","nameShort":"VSCodium"}`, true},+ {"codium", `{"applicationName":"code"}`, false},+ {"code-insiders", `{"applicationName":"qoder"}`, false},+ {"codium", `{"applicationName":"cursor"}`, false},+ {"codium", `{"nameShort":"VSCodium"}`, true},+ {"code", `{"nameShort":"Code - OSS"}`, true},+ {"code", `{"nameShort":"Windsurf"}`, false},+ } {+ root := t.TempDir()+ app := filepath.Join(root, "Editor.app", "Contents", "Resources", "app")+ writeFile(t, filepath.Join(app, "product.json"), tt.product)+ bin := filepath.Join(app, "bin", tt.app)+ writeFile(t, bin, "#!/bin/sh\n")+ if got := vscodeCodeBinary(bin, tt.app); got != tt.want {+ t.Errorf("vscodeCodeBinary(%s, %s) = %v, want %v", tt.app, tt.product, got, tt.want)+ }+ }+}