1ccacad63281094de8a3372d5a507d38f9969e5c
21
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
6b3a6d42c0 |
agent: VS Code's Agents window (vscode_agent_host) counts as VS Code, its turns as Codex's
justruman on Discord (#general, 11-01): VS Code's Agents window showed
in Usage as a raw "vscode_agent_host" row, 23 calls, 7 failed, beside
the "VS Code" row.
Why: VS Code's agent host runs `codex app-server` with clientInfo
{name: "vscode_agent_host"} (microsoft/vscode main at 8fb6054,
src/vs/platform/agentHost/node/codex/codexAgent.ts CLIENT_INFO; it
bundles @openai/codex 0.163.0). Codex sends that name as its
originator and at the head of its User-Agent, and it reads the user's
~/.codex config, so with Codex connected to magpie its turns come here
under VS Code's name. No agent's UA list had it.
- Usage: vscode_agent_host is in VS Code's UA list
(vscodeAgentHostUA), so those calls are VS Code's. Records are named
again at read time (ReportedAs -> AgentOf), so calls already logged
under the raw name fold into VS Code too. Insiders' and VSCodium's
agent host send the same name and are counted as VS Code (Stable):
nothing in the request tells them apart.
- Routing: fromCodex also takes vscode_agent_host (hostedCodex), so
every Codex rule holds for those turns. The one that fails without
it: one of Codex's own models asked there, which no account in
magpie serves, was answered 404 "magpie knows no model" instead of
going on Codex's sign-in (codexOwnOffMagpie). Also now applied:
spawn_agent's model list, compaction told in the stream on a byte
cap/overflow, Codex's headers to a keyed Codex-only relay.
- A test asked as Codex keeps only Codex's own names (codexNamed) as
Codex's shape: the agent host's headers never become it.
- VS Code's Copilot-proxied names (vscode_codex, vscode_claude_code) go
to GitHub, not magpie, and are not matched.
- docs/subsystems/gateway-routing.md says so.
Run on mote at this change rebased on origin/main 16ce5ed23; the
one commit since,
|
||
|
|
0cabaaf243 |
agent: a portable VS Code on a Mac is wired in its code-portable-data folder (#4151)
faketrader runs VS Code portable on a Mac: /usr/local/bin/code links into /Applications/Code/Visual Studio Code.app, and the build reads /Applications/Code/code-portable-data/user-data/User. magpie detected it but wrote ~/Library/Application Support/Code/User, which that build never reads. Their patch on #4151 is the base; this takes its rule and makes it VS Code's own (configurePortable in src/bootstrap-node.ts), on every OS: - A build is portable when its product.json has no `target` (an installer's build has one) and its data folder exists: on a Mac product.json's `portable`, else `<applicationName>-portable-data`, beside the .app; on Windows and Linux `data` beside the install, also for a build that updates into `<install>/<version>/resources/app`. - The build is the one the launcher on PATH is, through a Scoop shim and every symlink. A launcher whose product.json names another editor (a fork's `code`) isn't the build's. With no launcher of its own, a Mac reads the app folders and Spotlight and takes a portable bundle only when every bundle found is that one; beside an installed bundle, which one runs is unknown and nothing moves. - VS Code, Insiders and VSCodium each go by their own bundle and launcher. - User and extensions come from one place (vscodeDirs): connect, Sync, profiles and Disconnect use the portable User folder, and Zoo Code is found by its extension in <data>/extensions and writes its import file there. Windows' Zoo Code under Scoop looked in ~/.vscode/extensions. - Disconnect's preview is refused for a file in a portable data folder: the preview's child keeps PATH, and its launcher would reach the build's real files, not the copy. That also covers Scoop under home on Windows, which main previewed. - An installed build with no portable folder keeps the OS's folder and ~/.vscode/extensions, unchanged. #3260 and #4009 (Windows): |
||
|
|
cdfdb62c69 |
agent: a model field's list is joined with the catalog once while neither changed
Each agent's model field returned append(its own models,
viaMagpieShared(...)...), a copy of the whole catalog's options for
each field of each agent on every poll: Picks was 94.7 MB of 496 MB
over forty polls of the Agents page with real accounts. withVia keeps
the joined list per agent and prefix while the own models read the same
(sameOption, field by field) and the catalog's list is the very one
kept (same array), and joins it again when either changed. The list is
read only and clipped, as viaMagpieShared's is; every caller of a
field's Options reads it, Picks clones it before it drops anything.
The 52 `return append(own, viaMagpieShared(...)...)` sites call it.
omp's and Reasonix's planner edit the joined list after the append, and
Grok's writes Same into its copy, so they keep their own copies.
TestWithViaKeepsTheJoinedList: the same own models give the same array,
own models changed in a value or only an icon are joined anew, a
provider saved since is listed, and nothing joined is the catalog's own
list. TestSameOptionReadsEveryField sets each field of Option alone and
fails when sameOption doesn't see it. Broken by hand: never answering
from the kept list ("the same own models joined the catalog again"),
and FastFor left out of sameOption ("sameOption doesn't read
Option.FastFor").
Run on mote: both tests alone 3 of 3; internal/agent, internal/tui and
internal/cli ok; internal/gui red only on TestSettingsSaveKeepsWhatItDoesNotSend
(#4514) and TestMainWindowCorners (#3949); gofmt, vet and GOOS=windows
and linux vet clean. Real accounts in a sandbox HOME, forty polls:
Picks 94.7 MB -> 51.2 MB, state 190.8 MB -> 154.0 MB, state and drift
replies byte for byte the same as before. Footprint peak 136 MB.
|
||
|
|
bb478f0e50 |
agent: a look that only ranges over magpie's models reads the list kept
magpieModels gives each caller its own copy of the list it keeps per
agent. Most callers only range over it, or count it, and a range copies
each model anyway, so the copy guarded nothing for them (the models'
own lists were shared before too: the copy was shallow). sharedModels
is the list kept, read only; every `range magpieModels(` and
`len(magpieModels(` in internal/agent (39 files) takes it. Callers that
keep the list, append to it or hand it on still get their copy.
Real accounts (sandbox copy of the owner's HOME, network blocked), 40
polls of /api/state, /api/providers and drift, pprof alloc_space
between two heap snapshots,
|
||
|
|
dd7442f283 |
agent: a look at the via-magpie options shares the kept list
viaMagpie handed every caller its own copy of the options list it keeps per stamp, and a window poll asks for it from most agents' fields and pickers. In a real-account sandbox (abr.sh, 20 polls of drift, state and providers on v0.1.2463) those copies were 33.7 MB of slices.Clone, plus ~8 MB more on the way, of the 713 MB the polls allocated. viaMagpieShared returns the kept list itself, clipped, so an append makes the caller's own array. The 58 callers that only read it, or append onto it, now take it; viaMagpie (a copy) stays for the ones that change it. TestKeptListSharedWithoutACopy checks that 20 shared looks return the kept array, and that an append onto a shared look and a write into get's copy leave the kept list as it was. Run on mote at this tree: - gofmt, go vet (darwin, GOOS=windows, GOOS=linux with gateway), go build ./...: ok. - Broken by hand (shared returns slices.Clone): the test is red, "a shared look copies the kept list". - go test -count=1 ./internal/agent: ok (480s). Not run: internal/gateway and internal/gui packages on this tree. |
||
|
|
509d8e7d14 |
agent: a portable VS Code reads its User folder in its data folder
YOUIMARK's Windows has Scoop's VS Code 1.143, a portable build: magpie showed the editor, but its Dir stayed %APPDATA%\Code\User, which doesn't exist — code.cmd on PATH was detection enough — so the provider, models and settings.json magpie wrote went where the build never reads. Before: vscodeUserDir always took the OS's place for the User folder, %APPDATA% on Windows; only detection ever looked at the editor itself, by its launcher alone, so any portable build was found and then read and written in a folder it doesn't use. Now: a build whose launcher has a data folder beside it is portable, as VS Code itself takes a build for portable by that folder alone — a zip's own data folder, or Scoop's, whose apps\vscode\current\data is the persisted one, current a junction into apps\vscode. Its User folder is data\user-data\User there: found, wired, connected and disconnected there. The launcher is found as detection finds it, and a Scoop shim stands for the launcher the .shim beside it names, which proc.Unwrap doesn't read. Zoo Code, which keeps its settings in VS Code's User folder, is laid out by the same function and follows it. An installed build's launcher has no data folder beside it, and keeps the OS's place; so does a portable build before its first run, whose launcher alone is still detection enough, its writes then making the folder where it reads. VSCodium portable is left as it was: its data folder is named by its product.json, which no report asks after. This is the other half of the branch the Copilot-launcher fix came from (taken along with |
||
|
|
92f02d677b |
agent: a VS Code fork's own code launcher no longer lists it as VS Code too (ggbr on Discord)
Qoder IDE was listed twice, as Qoder and as VS Code. Qoder IDE ships a launcher named code in Contents/Resources/app/bin beside qoder (checked in the 2026-10-29 Qoder-IDE-darwin-arm64.dmg: product.json applicationName "qoder", nameShort "Qoder", com.qoder.ide), and its Windows installers put that bin folder on PATH. VS Code's detection falls back to a code on PATH, and vscodeCodeBinary ruled out only a product.json naming Cursor (#931), so any other fork's code counted as VS Code. The class fix: a code, code-insiders or codium launcher counts as VS Code, Insiders or VSCodium only when the product.json beside it (app/product.json, or resources/app/product.json on Windows and Linux) names that build in applicationName. With no applicationName, nameShort must be one of VS Code's own (Code, Code - Insiders, Code - OSS, Visual Studio Code, VSCodium). A wrapper with no readable product.json keeps the PATH fallback as before. This covers Cursor, Qoder IDE, Windsurf, Trae, Kiro, CodeBuddy, Antigravity and any other fork, on the mac, Linux and Windows layouts. A VS Code User folder still detects VS Code by itself: a user who has both has both rows. Run: - TestVSCodeDetected gains rows for Qoder (mac with the real build's product.json, linux, windows, symlink), Windsurf, Trae, Kiro, CodeBuddy, Antigravity, an Insiders product behind code, and nameShort-only products; TestVSCodeBuildLauncher checks each build's own command. Broken by hand: with the old vscode.go, 11 of the new TestVSCodeDetected rows fail (mac/linux/windows qoder, qoder symlink, windsurf, trae, kiro, codebuddy, antigravity, insiders product, qoder name). - Real Qoder IDE: on mote, the dmg's bin folder alone on PATH, vscodeCodeBinary(".../Qoder IDE.app/.../bin/code") = false and VS Code not Detected. - gofmt -l clean; go vet ./internal/agent for darwin, linux (-tags nogui) and windows on mote. - go test ./internal/agent -timeout 45m on mote: ok (171.6s) at this change on base |
||
|
|
efd4770015 |
agent: a reasoning effort picked in VS Code's Copilot Chat survives magpie's sync (chim3744 on Discord)
chim3744 (magpie 0.1.1318) picked "max" for a magpie model in Copilot
Chat's model picker, and requests went out at "low".
Cause: VS Code 1.142 keeps that pick inside the provider group, as
settings["<model id>"].reasoningEffort (languageModels.ts
setModelConfiguration). magpie's setGroup built its group with
vscodeGroupJSON, which has no settings key, compared the whole object
with sameJSON, and edit.SetJSONItem replaced the whole group. Every Sync
(catalog.Changed on start, a vendor list fetch, a provider edit) and
every magpie model pick in VS Code wiped the pick, and Copilot Chat fell
back to the model's first level ("low" of [low, high, max]).
Fix: vscodeGroupKept lays magpie's group over the one in the file with
mergeTheirs, as theirsKept does for the other agents (#2030). Every key
magpie doesn't write stays: settings, and anything else VS Code or the
user puts there, such as an apiKey reference. The models list stays
magpie's whole, so a model gone from the catalog still leaves it. The
settings of a model magpie no longer lists are kept, since they are the
user's values. When nothing magpie owns changed, the compare is a no-op
and the file is not written. This covers VS Code, VS Code Insiders and
VSCodium (customendpoint and customoai), every profile, since all go
through setGroup. agent-wiring.md lists what is kept.
Siblings checked:
- chatLanguageModels.json is written only by vscode.go. Cursor
(cursorlocal.go) writes nothing of Cursor's. magpie writes no
language-model groups for Windsurf, Trae or Kiro IDE.
- Every other syncJSON caller in internal/agent already merges through
theirsKept, piBlockKept, openCodeKept, mothxBlockKept, qoderKept or
t3Merged (
|
||
|
|
3c38fe5c99 |
agent: Zoo Code (VS Code) through its autoImportSettingsPath (wani on Discord)
wani on Discord (#feedback) asked for Zoo Code (zoocode.dev), a fork of Roo Code for VS Code and JetBrains. Route: Zoo Code keeps its provider profiles in VS Code's SecretStorage, which magpie can't write. The one file it reads is the one its zoo-code.autoImportSettingsPath setting names. On every activation (src/utils/autoImportSettings.ts, Zoo Code 3.90.0) it imports that file as Settings → Import does (importSettingsFromPath). magpie writes <User>/globalStorage/zoocodeorganization.zoo-code/settings/magpie-import.json with one profile, "magpie": apiProvider openai on the gateway's /v1 Chat Completions, key magpie-zoo-code, the chosen model, and an openAiCustomModelInfo built from the catalog (contextWindow, else Zoo's own 128000 default; maxTokens only when an output limit is known). It points the setting at that file in the default settings.json and in each VS Code profile's. A value the user set themselves is stashed and restored by Disconnect. The file sits outside magpie's folder so that a sync keeps an address the user moved (kept.away skips magpie's own folder). Requests say "ZooCode/<version>", and usage names them zoo-code. Limits (also in docs/reference.md → Zoo Code): - Zoo reads the file only at start: the notice asks for Developer: Reload Window. - While connected, each start switches Zoo back to the magpie profile. - Disconnect stops the import but can't delete the imported profile from SecretStorage. The user switches away from it or deletes it in Zoo. - VS Code Stable only. JetBrains is not wired. Zoo Code for JetBrains runs the extension in its own extension host, which is handed an empty configuration on every start (RPCManager.startInitialize in Zoo-Code-JetBrains), so the setting never reaches it. Its secrets sit in ~/.zoo-code/secrets.json, an internal store with no lock and no documented format. Neither is a clean route. Tests (internal/agent/zoocode_test.go): - TestZooCode: connect, model switch, a stale key that Check reports and Sync fixes, and disconnect putting the user's own import path back byte for byte with the file removed. - TestZooCodeFresh and TestZooCodeProfiles: VS Code profiles, including one made after connecting. - TestZooCodeDetectAndUA: Roo alone is not detected; ZooCode/3.90.0 maps to zoo-code. Broken by hand (the restore disabled): TestZooCode and TestZooCodeProfiles went red. The generated file was checked with bun against Zoo's own zod schemas (providerSettingsWithIdSchema, isProviderName; zod 4.6.7 from its repo): valid, every field kept, current profile in apiConfigs. Run, set -o pipefail, GOMODCACHE pinned, sandbox HOME: - First full run, with this change on |
||
|
|
0ad9661b60 |
agent: a Max output the user set reaches VS Code, Copilot JetBrains, ZCode, WorkBuddy and CodeBuddy as set (#2064)
DeepSeek V4.1 Flash with Max output 384k set in magpie reached VS Code
as 250000 (its context/4 trim) and WorkBuddy, CodeBuddy and ZCode as
128000 (zcodeOutput), so the number typed in magpie looked ignored.
Those trims are for a vendor's figure; a value the user set
(settings ModelOutputs, per model or per provider) is now carried as
provider.Entry.OutputSet -> catalog.Model.OutputSet, and outputOr hands
it on as it is (still within the window, as maxTokens keeps it). A
model nothing was set on gets the same numbers as before.
buddyModel no longer trims inside: the trim moved to its caller with
the others, so TestWorkBuddyEfforts' direct call now sees 500000.
Run: gofmt -l (clean); go vet for darwin, GOOS=linux -tags nogui and
GOOS=windows ./... (clean); go test -tags nogui ./internal/agent/
(-timeout 40m under load 200+; the first run hit the default 10m),
./internal/provider/ ./internal/catalog/ ./internal/gui/
./internal/codexcat/, all ok. New TestAgentsTakeTheUsersMaxOutput
checks every agent's written file with nothing set (old numbers) and
with 384000 set on the provider; with outputOr reverted it fails
("384k set, vscode-oai-in: 750000").
Not tried: real VS Code, CodeBuddy, WorkBuddy and ZCode reading the
files; whether Command Code's API serves max_tokens over 200000 (the
probe key was refused, UNAUTHORIZED).
|
||
|
|
8bfe33f1f4 |
agent, proc: where each command is on PATH is looked up once while its folders are unchanged, so a Windows page doesn't stat PATH per agent and per session (#1771)
oxyuan profiled every page's first load on Windows at seconds (4-7s), and Sessions, Usage → Sessions and Context at 26-45s: 96-98% of the samples were os.Stat under exec.LookPath and proc.FindTool. A failed lookup stats every PATHEXT candidate in every PATH folder (111ms there), and the pages asked once per known agent (Detected → binAt) and once per Pi session (sessions.carries → ompThere) on every request. proc.Look (new, look.go) is exec.LookPath with its answers kept. The proc.LookPath that |
||
|
|
bc320e249f |
agent: T3 Code, Air, OpenChamber and the rest send the LAN key to a gateway pinned beyond loopback (#1647, ggbdpq)
The gateway takes gateway.Token, and the keys that name an agent (gateway.TokenFor), only from loopback. When MAGPIE_ADDR pins the gateway to an address beyond loopback and sharing is on, keyAt gives the LAN sharing key, and most writers use it. T3 Code's instance still wrote gateway.Token, so every call it made got 401. Air's and OpenChamber's Checks compared against gateway.Token, so they said the wiring Sync had just written was off. The same mistake was in every writer that pairs gateway.URL() or gatewayV1() with a fixed token: - agy, Alma, Cindy, Claude Desktop, Copilot for JetBrains, Cursor's local agent, OpenHanako, Pencil, VS Code / Insiders / VSCodium, WorkBuddy-family models.json, ZCode (both files), Zed's credential, Aside's provider, and the legacy Claude token rename. - Fix: these now take agentKey(agent) or hereKey(), which are keyAt and agentKeyAt for gateway.URL(). On loopback they are unchanged. - Alma re-keys a provider that holds any of magpie's keys other than the one it should have now. - WorkBuddy and Aside also count the new key as theirs. - ZCode treats a saved address equal to the pinned gateway as this machine's, not another magpie's. What was run: - New tests: TestT3CodeKeyBeyondLoopback and TestAirAndOpenChamberChecksTakeTheKeyForTheGateway (from the reporter's patch), and TestPinnedGatewayKeyForEveryWriter, which covers the other writers. - With the product files reverted, all three are red. The T3 token reads "magpie", and each of the 11 writers shows its old key. They are green with the fix. - go test -tags nogui ./internal/agent/ is green. - gofmt -l and go vet are clean on darwin, linux and windows. Not tried with a real T3 Code, Air, OpenChamber or a real pinned MAGPIE_ADDR on a second machine. |
||
|
|
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,
|
||
|
|
c5a54bc74b | agent: VSCodium's magpie group is written for the provider its installed Copilot Chat declares, OpenAI Compatible (customoai) on the Marketplace's 0.48.1 (#1014, xybio: VSCodium's Chat picker showed only Auto) — VSCodium has no Copilot Chat of its own, and the last Marketplace Copilot Chat it can install, 0.48.1, declares no Custom Endpoint provider (its contributes.languageModelChatProviders: copilot, copilotcli, claude-code, anthropic, xai, gemini, openrouter, openai, ollama, customoai, azure), so the customendpoint group magpie wrote in chatLanguageModels.json was never read. magpie now reads the package.json of the github.copilot-chat installed under ~/.vscode-oss/extensions (vscodeChatOf: the one extensions.json lists, else the highest github.copilot-chat-<version> folder not in .obsolete) and writes customendpoint when it is declared, customoai when only that is: each model's window as maxInputTokens beside maxOutputTokens (0.48.1 adds them up), and the token as x-api-key, since 0.48.1 drops an Authorization in requestHeaders and its apiKey has to be a ${input:} secret; the gateway already takes a key from x-api-key, past an empty Authorization, so Usage still counts VSCodium. No extension found, or a package.json that can't be read, keeps customendpoint as before; one declaring neither is said in Notice and Check. Writing the group removes magpie's group for the other provider in the default's and each profile's file, and Disconnect removes both; the user's own groups, under either provider, stay. Sync (at magpie's start and on catalog changes) rewrites a group written for the other provider, and Check reports it until then. VS Code and Insiders, whose chat is built in, keep customendpoint unchanged. The Notice says 0.48.1 registers its providers only while signed in to GitHub with a personal Copilot plan (its BYOK registration is gated on the Copilot token's individual/BYOK flag). TestVSCodiumCopilotChatOpenAICompatible (the real 0.48.1 provider list installed in a temp ~/.vscode-oss: Connect writes customoai with x-api-key magpie-vscodium and no Authorization or contextWindow, the user's groups kept, Check empty; a Custom Endpoint group an older magpie wrote is flagged and rewritten by Sync; a Copilot Chat declaring customendpoint switches it back; one declaring neither is reported; Disconnect removes both) and TestVSCodeChatInstalledWithoutExtensionsJSON (folder scan, .obsolete, unreadable package.json) fail on main, which writes customendpoint, and pass; -race -count=10 on the VS Code tests, go test -tags nogui ./internal/..., go vet, gofmt -l, linux and windows (nogui) builds pass. No GUI change. Not tried with a real VSCodium. docs/subsystems/agent-wiring.md and docs/reference.md say it. | ||
|
|
2f15623e35 | feat: add VSCodium to vscode kinds (#926) | ||
|
|
1330b9660e |
agent: VS Code Insiders is an agent of its own, its Chat given magpie's models in Code - Insiders/User as VS Code's is in Code/User (wani on Discord)
vscode.go's agent is now one per build (vscodeKind): VS Code as it was, and VS Code Insiders, id vscode-insiders, its User folder Code - Insiders beside Code on the Mac, Windows and Linux, its binary code-insiders. Insiders' chat names itself GitHubCopilotChat as Stable's does, so it has no UA of its own: its models send the token magpie-vscode-insiders, which the gateway reads first, and its requests are its own in Usage while Stable's stay Stable's. Connecting one writes nothing of the other's. TestVSCodeInsiders fails without the change (unknown agent "vscode-insiders"). go vet, go build (GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass. |
||
|
|
88b87ac13f | fix(agent): reject Cursor launchers in VS Code detection (#931) | ||
|
|
11a2d359a1 | agent: VS Code's magpie models and default model go in each of its profiles too, so a window on another profile lists them in Chat (TJHHHH on Discord) | ||
|
|
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. | ||
|
|
21702d01ff |
Add German translation; harden paths against unset env vars (#770)
* Add German translation and harden paths against unset env vars Add a German locale to the GUI, tray menu, usage alerts and website home page, and refuse to start when the home folder is unset or relative so nothing is written under the working folder; the pi plugin no longer adopts the user's PI_CODING_AGENT_DIR, and an inherited APPIMAGE no longer selects portable mode. Scripts refuse to run from the wrong folder or empty a shared out folder, and a new internal/testenv sandboxes every test package from the user's real files, which also fixes the Claude picker and Termux installer tests on Windows. * Makefile: know magpie's folder by its go.mod, so paths with spaces work The check compared $(CURDIR) with $(dir $(abspath …)), which make splits on spaces, so a checkout under 'My Projects' or 'John Doe' refused every target. It now reads go.mod relative to the working folder and wants magpie's module there: make -C and a symlinked Makefile work, make -f from another folder still stops before any recipe runs. * i18n: German for the strings main added since, with a parity test 75 strings main added (group order, patterns, slow-start wait, usage caps, RTK savings …) get their German, and two that main dropped go. gui-de.test.cjs checks, as gui-ja does, that de has every zh string with its placeholders and tags, and that the window reads in German when picked or on a German system. * appdir: ignore relative folder variables when reading, keep them for children CheckEnv no longer unsets anything. magpie reads the XDG folders, APPDATA/LOCALAPPDATA and every agent's folder variable through appdir.Getenv/LookupEnv, which pass over a relative value; the environment stays as it is, so the agents magpie starts get the variable as the user set it. That covers what proc.UserPath lends from the login shell too, which is set after main's check and reached the desktop app unchecked. On Windows a path rooted on the current drive (\Users\x, Git Bash's /c/x) counts as usable, and magpie version and help answer without a home, before run makes any folder. * Sandbox the tests main added since internal/wslrun gets testenv's TestMain, and four tests main added that set HOME alone set their home with testenv.SetHome, so on Windows they don't read the runner's profile through USERPROFILE. * agentenv: PI_CONFIG_DIR and OPENCODE_DB take relative names on purpose omp puts $PI_CONFIG_DIR under the home and OpenCode a relative $OPENCODE_DB in its data folder, so neither depends on the working folder: appdir no longer passes them over. * i18n: German for the Library's multi-select and System One's decision API The 19 strings main added since (#791's skill multi-select, the decision API snippets) get their German; the one main replaced (four APIs → five APIs) goes. * appdir: tidy the import into magpie's group; say what Go makes of /c/x The appdir import joins the group of magpie's own imports where a file has one. rooted's comment now says that Go takes a Git Bash path like /c/x as \c\x on the current drive, not C:\x. |
||
|
|
a370877ca4 |
agents: VS Code's built-in chat (Copilot Chat) — switched on, magpie's models join Chat's model picker as a Custom Endpoint group in chatLanguageModels.json, with no key to enter and no Copilot sign-in needed (wani on Discord: 可以添加vscode自带的agent的配置吗)
VS Code Stable takes other vendors' models through its Custom Endpoint provider since 1.122 (customoai, the older OpenAI Compatible one, is Insiders only), signed in to GitHub or not. The provider groups live in chatLanguageModels.json beside settings.json in the default profile's User folder (~/Library/Application Support/Code/User, ~/.config/Code/User, %APPDATA%\Code\User), a JSONC array VS Code watches. magpie adds {"vendor":"customendpoint","name":"magpie","apiType":"chat-completions","models":[...]} with each catalog model at the gateway's /v1/chat/completions, toolCalling true (agent mode lists only tool-calling models), vision, contextWindow and maxOutputTokens (capped at a quarter of the window, as VS Code keeps the output budget out of the prompt's), and the model's efforts as supportsReasoningEffort. A group's apiKey is a secret property that VS Code reads from its secret storage only (languageModels.ts _resolveConfiguration), so it can't be written to the file; each model instead sends Authorization: Bearer magpie in requestHeaders, which CustomEndpointOAIEndpoint lets through and which stops it sending its own key header. The model a new chat starts on is chat.defaultModel in settings.json (matched by model id, so the catalog id); its old value is stashed and put back. The group is the agent's Joined: picking one of VS Code's own (auto) keeps magpie's models listed, and switching off (Unwire) takes the group out and puts chat.defaultModel back. Sync rewrites the group as the catalog changes, Check says when its url or header no longer reach the gateway, the Notice says where the models are and to reload the window if they don't show, and requests are credited to it by GitHubCopilotChat/<version>, a User-Agent a model's headers can't change.
internal/edit: SetJSONItem/GetJSONItem/DelJSONItem edit one element of a JSONC file's top-level array, found by its members, keeping comments, trailing commas and the other elements; SetJSON/DelJSON take a backslash-escaped dot as part of a key, as gjson does, for VS Code's flat "chat.defaultModel".
TestVSCode (connect keeps the user's settings and groups with their comments, the group's url/header/toolCalling/window and no apiKey or discovery url, Sync, Check, an own model keeping the group, disconnect back to the user's last own model), TestVSCodeRoundTrip (on and off leaves both files byte for byte; no files at all) and TestVSCodeUA; TestJSONItem, TestDelJSONItemAmongOthers and TestJSONEscapedDot. go vet ./internal/..., go build -tags nogui ./..., GOOS=windows and GOOS=linux builds pass; go test of internal/agent, edit, usage and gateway (each sandboxes HOME in TestMain) and internal/gui's page and agent connect tests pass; the full go test under a temp HOME was not run (the sandbox refused the HOME override). No GUI code changed (the generic connected wording fits), so no webkit test. VS Code itself is not installed here: not tried against a real VS Code.
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|