Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
gateway: WSL under NAT reaches the Windows gateway with sharing off
yetonea1c1b7053b41
diff --git a/docs/subsystems/agent-wiring.md b/docs/subsystems/agent-wiring.mdindex 7d482d488..47a9fdbbc 100644--- a/docs/subsystems/agent-wiring.md+++ b/docs/subsystems/agent-wiring.md@@ -23,7 +23,7 @@ something else shows up as drift.| Restarting a desktop app | Claude Desktop and WorkBuddy (WorkBuddy AI on macOS) read magpie's settings only as they start (微雨南山 and stones on Discord). `AppBehind` names one running here that started more than a second before magpie last changed what it reads (`changedAt`, which puts a change no file's time shows, such as Claude Desktop's gateway model list, at when it is first seen); only for an agent connected in magpie or disconnected in it. The row's Restart asks first in magpie's own dialog (`confirmRestart`), then `POST /api/agents/restart/{id}` runs `RestartApp`. On macOS (`restartApps`, the bundle found by id under `appFolders`, its `CFBundleExecutable` matched in `pgrep`) it quits as ⌘Q does and waits for every process of the bundle (`reopenBundle`); one still open after `appQuitWait` (a "Save?" question) is left as it is and not opened again (`noticeRestartStillOpen`). On Windows (`claude.exe` under `AnthropicClaude` or its Store package, `WorkBuddy.exe` outside the WorkBuddy AI folder) its processes are asked to close (`taskkill` without `/F`); a tray app still there after `appCloseWait` has its tree ended, and it is opened again through its Store id or Squirrel's stub. The Codex app's own Restart (`ReopenCodexApp`) asks first too. Codex on Windows, WorkBuddy AI on Windows and Linux aren't restarted: their process names aren't known. | [`apprestart.go`](../../internal/agent/apprestart.go), [`apprestart_windows.go`](../../internal/agent/apprestart_windows.go), [`connectinfo.go`](../../internal/agent/connectinfo.go) || Codex background compaction | Long conversations' Codex background compaction, in Codex's opened row on the Agents page (`CodexAsyncCompact`, `CodexAsyncCompactPercent`, #2490) writes `[features.async_compaction]` `enabled = true` and `model_async_compact_threshold_percent` (Codex 0.163 reads it only in that table) into each Codex config magpie routes, on every `Sync`. The table is written only when every Codex that reads the config is 0.163.0-alpha.8 or later (`codexReaders`: the CLI on PATH, the Mac app's bundled `codex-cli/codex-package.json`, the Windows Store app and an editor's `openai.chatgpt` extension, whose versions aren't known, a WSL distro's CLI): an older Codex takes every unknown `[features]` entry for a bool and won't load a config with the table ("invalid type: map, expected a boolean"). Otherwise, or with no Codex found, magpie writes the bare `[features]` `async_compaction = true`, which every Codex loads, and no threshold; a table magpie wrote before is taken out on the next `Sync`, and Settings' row names the Codex that held it (`CodexAsyncHeld`). Codex starts a background compaction only on a provider whose `capabilities.remote_compaction` is `"v2"`, which it gives OpenAI and Azure alone, so `[model_providers.magpie]` gets `capabilities = { remote_compaction = "v2" }` too, also when the user turned the feature on by hand (#2493); `putProvider` carries the table's capabilities over when it writes it again. What magpie wrote is in the stash under `codex.async`: a value the user set, or changed since, is never written over and stays when the switch goes off; a bare `async_compaction = true` the stash doesn't name as magpie's (`bool`), an inline or dotted table is the user's as written. | [`codex_async.go`](../../internal/agent/codex_async.go) || Named omp profiles | omp keeps a profile's settings under `~/.omp/profiles/<name>` (or under `PI_CONFIG_DIR`), each with its own `config.yml` and `models.yml`. Every such profile is an agent of its own — `omp#<name>` on Windows, `omp#<name>@wsl:<distro>` in a distro — so each can be connected, drifted and disconnected on its own. They share omp's model lists (`ListsFor`), and the default `omp` row is the folder `ompDir`/`ompIn` already pick, so an `OMP_PROFILE` that row is already pointed at is not listed twice. A name omp refuses is not a row: `default`, a trailing dot, or a Windows reserved device name (`aux`, `nul`, `com1`, `lpt9.x`, `con.work`), on every platform (`ompProfileOK`). A distro's profile names come from its probe and are kept in `wsl.json`; a stopped distro is never started to list them, its profile rows showing what was last seen (`asleep`). | [`omp.go`](../../internal/agent/omp.go), [`wsl.go`](../../internal/agent/wsl.go) |-| WSL twins | On Windows each running distro is probed once, without starting a stopped one. The `wslKinds` agents found there become agents of their own, `<id>@wsl:<distro>`, edited through `\\wsl.localhost\<distro>`. A kind is found by its folder under the distro's home or by its command there (not one on a Windows drive). Where another tool shares one of them, the kind leaves it out: Gemini CLI is found by its command alone, because Antigravity keeps `~/.gemini` too. Goose is found by its folder alone, because a `goose` command can be pressly's migration tool. Reasonix also needs the version its command gives (`accept`), because the old npm client is named `reasonix` too. The gateway address and key follow the distro's networking: mirrored or NAT (`place`, `keyAt`). `ListsFor` keeps a twin's model picks under the Windows twin's id (#927). | [`wsl.go`](../../internal/agent/wsl.go), [`gatewaykey.go`](../../internal/agent/gatewaykey.go) |+| WSL twins | On Windows each running distro is probed once, without starting a stopped one. The `wslKinds` agents found there become agents of their own, `<id>@wsl:<distro>`, edited through `\\wsl.localhost\<distro>`. A kind is found by its folder under the distro's home or by its command there (not one on a Windows drive). Where another tool shares one of them, the kind leaves it out: Gemini CLI is found by its command alone, because Antigravity keeps `~/.gemini` too. Goose is found by its folder alone, because a `goose` command can be pressly's migration tool. Reasonix also needs the version its command gives (`accept`), because the old npm client is named `reasonix` too. The gateway address and key follow the distro's networking: mirrored or NAT (`place`, `keyAt`). Under NAT the key is the gateway's WSL key (`gateway.WSLKey`, `-<agent>` after it where the agent's key names it), sharing on or off; the gateway listens at that address itself (gateway-routing's WSL under NAT). `ListsFor` keeps a twin's model picks under the Windows twin's id (#927). | [`wsl.go`](../../internal/agent/wsl.go), [`gatewaykey.go`](../../internal/agent/gatewaykey.go) || Settings tuned from use | Usage › Context's "Tuned for you" advises, per agent, the settings that would have spent the fewest tokens on the user's own calls of the range, and puts one in on a click. Package `tune` replays the calls `sessions.Calls` reads from the agents' session files under each candidate value (`Compact`, `CacheTTL`); `tuneOf` picks the agents and models (Claude Code per model, Codex pooled). `TuneRead`, `TuneApply` and `TuneUndo` know where each setting lives: Claude Code's `modelSettings.<model>.autoCompactWindow` (where its `/autocompact` saves), `promptCacheTtl` and `subagentPromptCacheTtl` in `~/.claude/settings.json`; Codex's top-level `model_auto_compact_token_limit`. The advice is weighed by tokens alone: it is labelled "Fewest tokens", and a compaction window it would change says it doesn't measure how well the agent keeps the task after a compaction, and that a lower window compacts more often (#1854, `context-tune.test.cjs`). A compaction row's "Other window…" opens the app menu with every value of the curve, each with its estimated extra tokens over the fewest and about how many compactions it would have made (`Point.compacts`, from the same replay), and puts the one picked in like Use (#1860). An agent whose files time its compactions also has their wait weighed (HirotaNagai on X): Claude Code's `compact_boundary` line says `compactMetadata.durationMs`, which `sessions` puts on the first call after it, and Codex compacts by a call of its own (the record a `compacted` line names, in rollouts since 2026-09), whose time is the compaction's (`Call.Compact`; an older rollout's compaction has no call and stays untimed). With 3 or more timed for a model (`minTimed`), `Facts.took` is their median seconds, each window says its wait (`Point.wait`, its compactions × `took`), and the row says what a compaction took, the wait at the advice against the window now, and the cheaper window the advice passed over for waiting longer (`Compaction.cheapest`, `wait_cheapest`) when it saves 3% or more; the advice is labelled "Tokens + wait", its caveat says tokens and waiting only, and the picker says each window's wait with "Fewest tokens" on the cheapest (`context-tune.test.cjs`). An agent or model with fewer timed reads and is advised as before. | [`internal/tune`](../../internal/tune/tune.go), [`tune.go`](../../internal/agent/tune.go), [`internal/gui/tune.go`](../../internal/gui/tune.go) || Agents a plugin adds | A plugin's `magpie.agent` module (or a `*.agent.js` file) says where an agent magpie has no setup of its own keeps its model (`config`, `format`, `model`, `prefix`), and its `connect` returns the other keys to write. One with no `model` is connect only (#2374): its one field is `provider`, magpie or nothing, as an app whose one setting is magpie as its provider; `connect` is called without a model, must return keys, and is called again on a catalog change (`Sync`); `ListsModels` is set, so its list is the models picked for it. `agentplug` compiles each in moejs (via `jsmod`, as gateway middleware is), reloads it when plugins.json or the file changes, and keeps why one didn't load. `plugged` makes each an `Agent` with `Plugin` set, listed after magpie's own; an id one of magpie's own agents has is refused (`PluginErrors`). `connect` is given each model as `magpieModels` builds it, with `/v1/models`' `native_endpoints` (`provider.NativeEndpoints`, carried as `catalog.Model.Endpoints`) and `pricing` (`catalog.OpenRouterPricing` of the same `EntryPricer` price), each left out when not known ([`plugged_connect_facts_test.go`](../../internal/agent/plugged_connect_facts_test.go)). | [`agentplug.go`](../../internal/agentplug/agentplug.go), [`plugged.go`](../../internal/agent/plugged.go) || Environment-only agents | Agents that read the gateway only from the environment get a `Launch` command. Cursor Private Inference instead gets user-level variables (`cursorLocalOn`, `KeepCursorLocalEnv`), and magpie writes none of Cursor's own files. It is found by its product.json in the apps folders, in the folder Windows' list of installed programs names (`cursorLocalInstalls`, any folder picked in its installer), or as its Linux AppImage (`Cursor_Private_Inference-…AppImage`) in the folders downloads are kept in (#1254). Its effort field is kept in magpie (`provider.AgentEffort`) and asked by the gateway, its levels those of the models it lists (`cursorLocalEfforts`, #1003). | [`cursorlocal.go`](../../internal/agent/cursorlocal.go) |@@ -103,7 +103,7 @@ something else shows up as drift.- A value an agent spells as its own provider's model is never taken for one of magpie's, even when magpie has a provider of the same name (`Spelled`, #835).- The other way round, a value that names one of magpie's models the agent isn't shown (kept from it by `magpie visible` or a model not ticked for it), a model of one of magpie's providers that isn't on its list (a remote magpie's group added there since the list was fetched), or a `group/…` magpie has no group for, is refused by `Spell` (`notOffered`), and nothing changes. It used to be written as the agent's own: Pi read `remote/group/smart` as its own provider `remote` and model `group/smart`, and was taken out of magpie (#2376). A model shown the agent that a field offers fewer of (Claude Desktop's tiers) is still taken, and so is a value whose provider part one of the agent's own models goes by (`openai/…` in Pi) ([`agent.go`](../../internal/agent/agent.go), `TestSpellRefusesMagpieModelNotOffered`).- `Reapply` on `unwired` sets again every field on one of magpie's models and every field set to magpie itself (`magpieID`, as `Wired` takes it): Claude Desktop's drift shows on a tier, and its `provider` field is what writes the gateway back (dumplings on Discord). Claude Desktop's `Check` judges only the set of folders whose Claude-3p it ran in last (`desktopRead`, by `desktopdir.LastRun`), every set when it ran in none: magpie writes both of an MSIX install's sets, and 2.31226 reads the real `%LOCALAPPDATA%\Claude-3p`, so the package's copy being emptied is not Desktop off magpie.-- `unreachable` never sets anything: the config is right, and the page's pill only says what has to listen. The exception is an address a WSL distro reached Windows at before (`distro.Was`, kept in `wsl.json`) while it reaches Windows at another now: the pill offers that one, and `Reapply` moves the config there (`Agent.move`, Codex's `codexMoveGateway`). An address no distro was seen at is the user's own and is never moved. An unknown answer (no probe yet) and a gateway down on loopback too are not drift. Tests stub `reachProbe` in `TestMain`.+- `unreachable` never sets anything: the config is right, and the page's pill only says what has to listen. The exception is an address a WSL distro reached Windows at before (`distro.Was`, kept in `wsl.json`) while it reaches Windows at another now: the pill offers that one, and `Reapply` moves the config there (`Agent.move`, Codex's `codexMoveGateway`). An address no distro was seen at is the user's own and is never moved. An unknown answer (no probe yet) and a gateway down on loopback too are not drift. Tests stub `reachProbe` in `TestMain`. A WSL twin's address on a WSL network is asked from inside the running distro (`reachFrom`, `wslReach`: curl, wget or bash's /dev/tcp), never from Windows, where the gateway's own listener answers whatever the firewall keeps out. A distro that can't connect is told the firewall rule that lets it in (`wslFirewallCommand`). A stopped distro is never run to be asked, and one with nothing to ask with is not drift.- `proxied` (Muma102kMichael on X: every project and every new chat 502 after magpie took Codex over) is this machine's Codex sending its requests for the gateway through a proxy that doesn't pass them on, while the gateway answers here ([`codex_proxy.go`](../../internal/agent/codex_proxy.go)). Codex's reqwest takes `HTTP_PROXY`, else the system's proxy for `http://` (macOS' HTTP entry alone, never its HTTPS or SOCKS one; Windows' `ProxyServer` only when it is one address for every protocol), else `ALL_PROXY`, and lets only an exact IP or a CIDR in `NO_PROXY` (on Windows, with no `NO_PROXY`, the bypass list with `*.` taken out) keep 127.0.0.1 off it: `127.*` and `localhost` don't, and macOS' exceptions aren't read. With `[features] respect_system_proxy` it asks the system alone, matching its list itself, wildcards and `<local>` included, and goes direct when no proxy is set there; a macOS SOCKS entry alone it can't use, and takes `HTTP_PROXY`/`ALL_PROXY` then (codex-rs `outbound_proxy`; tried with codex-cli 0.162.1). Its reqwest has no SOCKS, so a `socks5://` proxy is spoken to as an HTTP one, and the probe does the same. The environment is Codex's: the login shell's `*_PROXY` (`proc.LoginEnv`, which a terminal's Codex and the ChatGPT app's both have; only exported ones, as the probe asks a child `/bin/sh` for them, so fish's unexported universal `http_proxy` doesn't count, #2627) over magpie's own, which a magpie opened from the Dock lacks (liu_dyj on X: a `NO_PROXY=127.0.0.1` in the profile, or a macOS proxy with no HTTP entry, warned while Codex went direct). `codexProxyFor` works out that proxy the same way, and a `GET /` through it must come back as magpie's (`proxyProbe`), tried as `reachable` is. Its pill says how to fix it, as `unreachable`'s does, naming the proxy and the variable it was read from, `http_proxy` or `HTTP_PROXY` as it is (`Addr`, `Detail`), through `netproxy.Redact`, without its user and password (#1886), while the probe goes through it whole, and the dialog has Disconnect from magpie. Account failover, which magpie writes uninvited, waits for that probe (`codexProxyOK`) and isn't written while the proxy doesn't pass Codex on, and one it wrote goes again. Tests stub the env, the system proxy and `proxyProbe` in `TestMain`.- Listing never starts a stopped WSL distro. A stopped distro's agent shows what was last seen there (`asleep`, `wsl.json`); setting one of its fields writes its files, which starts the distro.- Codex's sign-in (`login`) is ChatGPT (`""`, the default), Always ChatGPT (`chatgpt`) or magpie API (`api`). With ChatGPT, magpie's models join Codex's own beside the sign-in (`openai_base_url`), and while the Codex app holds the ChatGPT account Codex is signed in to (`codexUsedUp`, `provider.CodexUsedUp`: OpenAI no longer allows the account and it has no credits left, a workspace still within its overage excepted), magpie is made Codex's provider (`codex.out`): the Codex app sends nothing at all on an account it holds, a magpie model's turn included (#540), and as a provider of its own magpie is past that. A window at 100% with credits left doesn't count, and Codex stays signed in. Sync puts it back beside the sign-in once the account has room. Always ChatGPT never does that: Codex stays in its ChatGPT state, and the Codex app may send nothing till the account has room, while Codex CLI's turns still reach magpie by the base URL, and its routing and other accounts serve them. With magpie API, Codex's `getAuthStatus` returns no token (its provider has no `requires_openai_auth`), so its Chrome control turns away; the option's note says to pick ChatGPT to keep it (#1824). While magpie is Codex's provider (magpie API, or `codex.out`), `Joined` reports false although the `codex.joined` mark stays for Sync's way back: the Agents row said Codex's own models stay in `/model` beside magpie's, the ChatGPT state the Codex app blocks sending in, and the app only leaves that state once it is restarted (#2267, `TestCodexProviderIsNotJoined`). A Codex that reaches the gateway from another machine (a WSL distro under NAT, or `MAGPIE_ADDR` pinned beyond loopback, `onAnotherMachine(at.gw())`) is wired as one with no ChatGPT sign-in (`chatGPT()` is false there): never joined or beside, since beside its sign-in it would send its ChatGPT token to `/backend-api/codex`, and from there the gateway takes a named key alone, so every request was a 401 (#2145, `TestCodexBeyondLoopbackNotJoined`). magpie is its provider and it sends `gwKey()`, the LAN sharing key; one of its own models picked goes straight to OpenAI on its sign-in.diff --git a/docs/subsystems/gateway-routing.md b/docs/subsystems/gateway-routing.mdindex 8c9f5b466..bfab7958d 100644--- a/docs/subsystems/gateway-routing.md+++ b/docs/subsystems/gateway-routing.md@@ -27,6 +27,7 @@ backfilled; see [Gateway Session Aggregation](gateway-sessions.md).| Part | Responsibility | Source || --- | --- | --- || Address and caller | `DefaultAddr`. The local token `magpie` and the per-agent `magpie-<agent>` (`TokenFor`). `agentOf` tells which agent asked, first by token, then by User-Agent. Claude Science, whose User-Agent is the Anthropic SDK's, is told by its client's `X-Anthropic-Surface: operon` (`isClaudeScience`). It is listed every model as `claude-magpie-<number>` (`scienceModels`; its picker keeps only a `claude-` id whose name isn't a lower-case slug), and a Claude id magpie doesn't serve (its default before a pick, its haiku side tasks) goes to the model its last turn with tools was on, else the first it is listed (`scienceTurn`, kept in `claude-science.model`). | [`gateway.go`](../../internal/gateway/gateway.go) |+| WSL under NAT | On Windows, while the gateway listens on loopback alone, `serveWSL` also serves it, in plain HTTP, at each address Windows has on a WSL network (`WSLNets`: the `vEthernet (WSL…)` adapters, looked for every 10s, since WSL's VM brings its adapter up and down). That is where a distro in NAT networking reaches Windows, and what `place` writes into its agents (zaidu259434 on X: Codex in WSL failed with sharing off). `lanGuard` takes a request there as this computer's (`fromWSL`) only when it arrives at that address, from inside that network, with the WSL key: `WSLKey`, a `wsl-` secret in magpie's folder (`wsl-key`, 0600), optionally followed by `-<agent>`. It becomes a loopback request carrying `magpie` or `magpie-<agent>` (`asFromLoopback`). Anything else there, a Docker Desktop container on the same network included, is judged as another machine's. Windows' firewall still decides whether WSL gets in: WSL's network is a Public one. | [`wsl.go`](../../internal/gateway/wsl.go) || TLS | `--tls-cert`/`--tls-key` (`MAGPIE_TLS_CERT`, `MAGPIE_TLS_KEY`) make `ListenAndServe`, `Relisten` (both through `Server.listen`) and `magpie web`'s page (`ServeTLS`) wrap the listener in `tlsListener`. A connection from another computer is `tls.Server` at once, so its plain HTTP gets net/http's 400. One from this computer (`fromThisComputer`: loopback, or a peer address equal to the local one) is sniffed on its own goroutine, 10s at most (`sniffWait`), and 0x16 makes it TLS, so `URL()`, the agents, MCP servers, `ServedBy` and the healthcheck keep `http://127.0.0.1`. `certFiles.get` reloads the pair when either file's mtime or size changes; a pair that doesn't load keeps the one served (logged once per change). `tlsConfig` refuses half a pair or files that don't load before binding. HTTP/1.1 only over TLS (hijack, Codex's websocket). `Scheme()` gives the scheme of `LANURLs`, a scheme-less `MAGPIE_PUBLIC_URL` and the page's network links. Host and Origin checks (`foreignPage`, `rebound`) don't depend on the scheme. | [`tls.go`](../../internal/gateway/tls.go), [`lan.go`](../../internal/gateway/lan.go) || HTTP surface | `Handler` routes `/v1/chat/completions`, `/v1/responses`, `/v1/messages` (each also without `/v1`), `/v1/models`, Gemini's `/v1beta/models/…`, the Codex backend path, `/v1/codex/models` (Codex's catalog shape for a Codex elsewhere with a gateway key, `codexCatalog`, kept to the key's models by `keyAllowed`; #1281), Ollama's `GET /api/version`, `GET /api/tags` and `POST /api/show` (`ollama.go`, for a client that takes a custom endpoint only as an Ollama server: Visual Studio's and VS Code's Copilot, wani on Discord; the list is `catalogFor`'s, so a key's models alone, `/api/show` tells `capabilities` (`completion`, `tools`, `vision` from `Images`, `thinking` from `Thinks`) and `model_info` with `general.architecture` `magpie`, `general.basename`, `magpie.context_length` (32768, VS Code's own default, when the window isn't known, since VS Code would take a 0) and the `general.parameter_count` and `magpie.embedding_length` the ollama CLI before 0.7 reads unchecked; a name ending `:latest`, as the ollama CLI asks, is the bare id unless a model is really called that (`ollamaName`); the client then chats on `/v1/chat/completions`, or on Ollama's own `POST /api/chat` and `POST /api/generate` (`ollama_chat.go`, Zed's Ollama provider, super_lalalalala on Discord), which `ollamaChatBody` turns into a `/v1/chat/completions` body handed to the same `handle(provider.Chat)` on a clone of the request, so they are routed, held to a key's models and counted as it is: `messages` with `images` (base64, its type sniffed, as data-URL parts; a tool message's in a user message after it), an assistant's `thinking` as `reasoning_content` and its `tool_calls` given ids where Ollama sent none, a tool result matched to its call by `tool_call_id`, else `tool_name`, else in order (one with no call is a 400), `tools`, `format` (`json` or a schema), `think` (a level is `reasoning_effort`), and `options`' `temperature`, `top_p`, `seed`, `stop`, the two penalties and a positive `num_predict` as `max_tokens` (`num_ctx`, `top_k` and the rest of Ollama's own are dropped); `ollamaWriter` turns the reply into Ollama's NDJSON lines (streamed unless `stream:false`, then one object), tool calls with their `arguments` as an object and an `id`, and a last `done` line with `done_reason` and the token counts, and an error into `{"error":"…"}` with the status `/v1` would give; a request with no messages or prompt is answered `done_reason:"load"`, as Ollama does to warm a model), `/mcp/{name}`, `/mcp/magpie/web-search`, `/mcp/magpie/vision` and `/mcp/magpie/image` with its `/mcp/magpie/image/files/{name}` (magpie's own web search, image recognition and image generation as MCP servers, below) and the `/v1/magpie/*` status endpoints. `/v1/magpie/heap` (`heapProfile`, [`heap.go`](../../internal/gateway/heap.go), for `magpie heap`) is held tighter than the rest by `heapRefused` in the handler itself, so it holds where `Handler` is served without `lanGuard` too: only a loopback caller that isn't proxied (`local`), carries no browser mark (`fromBrowser`) and names a loopback `Host` (`loopbackHost`) gets the profile; a gateway key never lets anything else in. `/v1/magpie/cpu` (`cpuProfile`, [`cpu.go`](../../internal/gateway/cpu.go), for `magpie cpu`) records a CPU profile for `?seconds=` (30, from 5 to 120) and is held to the same callers by `cpuRefused`, which shares `profileRefused` with `heapRefused`; one profile records at a time (`cpuRecording`), a second is answered 409, and a caller that hangs up stops it. `/v1/magpie/goroutines` (`goroutineDump`, [`goroutines.go`](../../internal/gateway/goroutines.go), for `magpie goroutines`, #3362) answers every goroutine's stack and wait as text (`runtime/pprof`'s `goroutine` profile at debug 2) to the same callers, through `goroutinesRefused`. `/v1/alpha/search` (also without `/v1`, and on the Codex backend path for a magpie model) is Codex's web.run search (`alphaSearch`, `codex_search.go`): a ChatGPT account's model goes to the ChatGPT backend's `/alpha/search` on the account's sign-in, the next account asked on 401, 403, 429 or 5xx; any other model's `search_query` is searched by `webSearch`, and when nothing answers the reason is a 200 with `output`, since Codex ends the turn on any failed web.run (anton on Discord). A GET on `/v1/responses` (a client opening Responses over a WebSocket) is answered 426, a plain one 405: Responses is relayed over HTTP only. Every route is wrapped in `counted`, `corsGuard`, `callerGuard`, `withCaller` and `keyLimited`; `/v1/messages`, `/messages` and `/v1/messages/count_tokens` in `keepsSignIn` too. `corsGuard` (#1051) serves CORS only to the origins listed in Settings › Network › Web pages (`settings.CORSOrigins`, cleaned to `scheme://host[:port]` by `settings.CleanOrigins`, which refuses a wildcard). A browser extension's own pages, popup and service worker are listed the same way by their origin, which is the browser's scheme and the extension's id: `chrome-extension://<id>` (Chromium, the id 32 letters a–p), `moz-extension://<uuid>` (Firefox, the Internal UUID about:debugging shows, not the add-on id) and `safari-web-extension://<uuid>` (Safari, which picks a new UUID on each launch, so a listing lasts until Safari restarts); the id must have that browser's shape, cased any way, and nothing else is taken — no bare scheme, no wildcard, no path (SkyAerope on Discord: an extension without host permissions is held to CORS like a page). A content script's fetch carries the page's origin, not the extension's. A listed extension is treated exactly as a listed page, below; one not listed passes as before (other schemes, below) with no CORS headers. For a listed origin it answers the preflight (204) and adds `Access-Control-Allow-Origin`, and every other request from it needs an enabled gateway key (`access.Authenticate`), even on loopback, or gets a 401. It takes the key from the caller `lanGuard` recorded too, since on the running server `lanGuard` has already put magpie's own token in the key's place. Any other web page is refused 403 on every route (`foreignPage`): on loopback a call needs no key and the body's Content-Type isn't checked, so a page the user visits could otherwise send a "simple" `text/plain` POST and spend their subscriptions blind. Only an `http`/`https` Origin is judged, and one on this computer (`localhost`, `*.localhost`, `127.0.0.0/8`, `[::1]`, any port) or the request's own origin (its host and port equal to `Host`, such as a page on the gateway's LAN address) passes, as does usemagpie.ai on `/v1/magpie/omarchy`. Other schemes (`app://`, `file://`, `tauri://`, `vscode-webview://`, `chrome-extension://`) come from desktop apps, webviews and extensions that don't enforce CORS, and pass keyless as before; `null` is not one of them, since any web page sends it from a sandboxed frame and an opened file sends it too, so a call with it needs an enabled gateway key as a listed origin's does, and is answered 403 without one (no CORS headers either way, so a frame or a local page still reads no reply). A page at a subdomain of localhost (`localhostSubdomain`, #2256) needs a key the same way: Chrome and Firefox resolve `*.localhost` to loopback themselves, but Safari and other WebKit views ask the system resolver, which before macOS 26 asks the network's DNS (WebKit bug 160504), so a resolver that answers serves such a page from anywhere. `tauri.localhost` and `wails.localhost` stay keyless on Windows only, where Tauri's and Wails' webviews serve themselves at those names; on macOS and Linux those apps use `tauri://` and `wails://`. A request with no Origin (every agent's) passes through with no CORS headers, as before. A page whose own name resolves to 127.0.0.1 (DNS rebinding) would count as same-origin here, so `lanGuard` refuses it first (`rebound`, 403): a loopback request carrying a browser's marks (`Origin`, `Sec-Fetch-Site`/`Sec-Fetch-Mode`, a `Mozilla/` user agent) whose `Host` isn't this computer's (an IP, `localhost` but not a subdomain of it, which WebKit asks the DNS for (#2256), a container runtime's name for the host such as `host.docker.internal`, `MAGPIE_PUBLIC_URL`'s or `MAGPIE_ADDR`'s host, the machine's own name) needs an enabled gateway key. Agents send none of those marks and pass under any name. Before any of that, `lanGuard` lets in one request without a key from anywhere: `POST /_magpie/claude-mcp/<token>` with the token of a Claude subscription run now live (`ownCallback`, see [the Claude subscription bridge](claude-subscription-bridge.md)), the run's MCP helper calling back to a `MAGPIE_ADDR` that isn't loopback (#1546). Next, before the key or `rebound` is looked at, the allow list (lc on Discord, magpie in Docker on a public host): with `MAGPIE_ALLOW_IPS` or Settings › Network › Allowed addresses (`settings.AllowIPs`, this computer's own, never brought by a sync or restore: see [sync and backup](sync-backup.md#what-stays-on-each-computer); the variable wins and the page then only shows it) naming IPs and CIDR ranges, a request whose connection (`RemoteAddr`, IPv4-mapped IPv6 unmapped, zone dropped) is outside them is refused 403 naming its address, even with an enabled gateway key (`refuseNotAllowed`). Loopback and this computer's own interface addresses always pass. A forwarding header is never taken for the address, so a proxy or tunnel on this computer passes (it arrives from loopback) and its clients are limited at the proxy. An entry that doesn't parse lets nothing in and is logged once; the list stays on. Settings' list is read with `settings.LoadChecked`: a settings.json that can't be read, or doesn't parse with no last good generation, is unknown, never "no list", so the list read last in this process stays in force (`lastAllow`), and with none read yet only this computer passes, the 403 saying settings.json couldn't be read; logged once. No file, or an empty one, is no list. The Settings page's saves read with `LoadChecked` too and refuse such a file, as `settings.Save` does. `magpie web`'s server is wrapped in the same check (`AllowGuard`), and its port hands the gateway's client routes (`ClientPath`) to `Server.Front`, the same lanGuard-over-Handler the gateway's listener serves, so every route there is judged as on the gateway's port (`TestClientPathCoversHandler` fails when a route Handler adds is in neither `ClientPath` nor its list of routes that stay on the gateway's port). Settings refuses a list that would leave out the address the page saving it is open from (`KeepsOut`); the page names that address, which behind Docker or a proxy is the proxy's, and offers to add it to the refused list (`allowSays`, Mathresearcher on Discord). | [`gateway.go`](../../internal/gateway/gateway.go), [`allow.go`](../../internal/gateway/allow.go), [`internal/settings/allowips.go`](../../internal/settings/allowips.go), [`cors.go`](../../internal/gateway/cors.go), [`codex_catalog.go`](../../internal/gateway/codex_catalog.go), [`ollama.go`](../../internal/gateway/ollama.go), [`ollama_chat.go`](../../internal/gateway/ollama_chat.go), [`internal/settings/origins.go`](../../internal/settings/origins.go) || Model resolution | `serve` resolves the model the agent asked for: Claude tier stand-ins, a routing group (`provider.GroupFor`: its id, the model's id however a vendor spells it, else the one group whose name it is, unless a provider serves a model by that id; the user's own groups only while the `groups` plugin is on, [the plugin runtime](plugin-runtime.md#gateway-extension-points-p3-router-strategy)), auto stand-ins, the agent's own stand-in (`StandIn`: Codex's config.toml `model` when magpie is its provider, for a name it sends that magpie doesn't serve, such as its auto-review's `codex-auto-review`), itself taken through `GroupFor` and auto stand-ins so a config naming a group bare reaches it, then `provider.Resolve`. A Codex memory call or auto-review (`x-openai-subagent: guardian`, or `codex-auto-review`) that still names no served model goes to the model Codex's last turn was answered on (`codexMemoryStandIn`, per agent and gateway key), so a Codex on magpie through another provider table, a profile or another computer isn't answered 404 (Adam on Discord, `TestCodexAutoReviewReachesItsTurnsModel`). A bare model id several providers serve (MOMO on Discord: `glm-5.3` under opencode-go and a6api) is never refused: with found groups on (the default) `GroupFor` takes it to the group magpie found for it (`auto-<slug>`), its members in the Providers order, routed and failed over as any group, a conversation staying with the member that answered it while its cache is worth it (affinity); with them off, `Resolve` takes the first provider in the Providers order that exposes it, with no fallback. magpie writes only `provider/model` ids into agents' configs (`magpieModels`), so a bare id is one the user wrote. `/v1/models` lists bare ids only when the user asks for them ([Model ids without the provider](#model-ids-without-the-provider)). Every reply says who answered in `X-Magpie-Provider` and `X-Magpie-Model` (`noteMember`), and the usage log and the Routing page keep it. A model id with `~` and no slash that resolves as nothing else is the one served id (a provider's model or a group) whose slashes it spells as `~` (`unflat`, `provider.Unflat`; MiniMax Code's spelling, #1387), taken back in `validateModel` before key limits, middleware and usage see it; two ids spelled alike are neither. A Claude model id whose version is dashed (`relay/claude-opus-4-6-us`, with or without `:level` and `[1m]`) that is not served as spelled is the one served id it dashes (`provider.ClaudeUndashed`; the spelling magpie gives Claude Code, which reads a dotted version as Claude Opus 4), taken back in `validateModel` and `unprefixed` the same way. An unknown model gets a 404 naming why: a switched-off provider, a disabled group or an empty group. Otherwise it names up to three ids nearest to what was asked (`provider.Closest`: words of a model's display name count before words of its id, and a provider's id or name only alongside them, so "Zen-Space-Bunny" is told `opencode-zen-free/space-bunny-free`, MOMO on Discord), then the ways a model can be named, then every id (`unknownModel`; chat and embeddings). | [`gateway.go`](../../internal/gateway/gateway.go), [`internal/provider/group.go`](../../internal/provider/group.go), [`internal/provider/flat.go`](../../internal/provider/flat.go), [`internal/provider/claudedash.go`](../../internal/provider/claudedash.go) |diff --git a/internal/agent/agent.go b/internal/agent/agent.goindex 1151cfebc..1b55ad146 100644--- a/internal/agent/agent.go+++ b/internal/agent/agent.go@@ -278,6 +278,11 @@ type Agent struct {// it where that is kept apart from Gateway (this machine's Codex at an// address of the user's, #816): Drift tries it (see reach.go).reach func() string+ // reachFrom, when set, tries base from where the agent runs (inside+ // its WSL distro), as reachable does from here: the last answer, and+ // whether there is one. A WSL network's address answers from Windows+ // whatever its firewall lets in from WSL, so only this tells.+ reachFrom func(base string) (ok, known bool)// move, when set, points the agent's config at to where it names the// gateway at from: an address of WSL's that changed (#1013).move func(from, to string) errordiff --git a/internal/agent/gatewaykey.go b/internal/agent/gatewaykey.goindex 4217bc441..9771540d4 100644--- a/internal/agent/gatewaykey.go+++ b/internal/agent/gatewaykey.go@@ -12,9 +12,17 @@ import (// from this computer only; from another machine — a WSL distro under NAT,// which asks Windows' address — the gateway turns a request without a// named key away, so it is the LAN sharing key, while sharing is on-// (whqtian on Discord: omp, then OpenCode, in WSL were refused).+// (whqtian on Discord: omp, then OpenCode, in WSL were refused). At the+// address Windows has on a WSL network, which the gateway listens on while+// it is on loopback, it is the WSL key (gateway.WSLKey), sharing or not+// (zaidu259434 on X: Codex in WSL failed with sharing off).func keyAt(gw string) string {if onAnotherMachine(gw) {+ if gateway.OnWSLNet(gw) {+ if k := gateway.WSLKey(); k != "" {+ return k+ }+ }if k := access.LANSecret(); k != "" {return k}@@ -32,7 +40,11 @@ func (p place) gwKey() string { return keyAt(p.gw()) }// agentKeyAt is keyAt for an agent whose key on this machine names it// (gateway.TokenFor), for requests that carry nothing else of it.func agentKeyAt(agent, gw string) string {- if k := keyAt(gw); k != gateway.Token {+ k := keyAt(gw)+ if wk := gateway.WSLKeyMade(); k == wk && wk != "" {+ return wk + "-" + agent // the gateway reads it as TokenFor(agent)+ }+ if k != gateway.Token {return k}return gateway.TokenFor(agent)@@ -47,13 +59,14 @@ func hereKey() string { return keyAt(gateway.URL()) }// agentKey is agentKeyAt for the gateway's own address, as hereKey.func agentKey(agent string) string { return agentKeyAt(agent, gateway.URL()) }-// ourKey says k is a key magpie gives an agent: gateway.Token, or the LAN-// sharing key one that reaches the gateway from elsewhere is given.+// ourKey says k is a key magpie gives an agent: gateway.Token, the LAN+// sharing key one that reaches the gateway from elsewhere is given, or the+// WSL key one in a WSL distro under NAT is.func ourKey(k string) bool {if k == gateway.Token {return true}- return k != "" && k == access.LANSecret()+ return k != "" && (k == access.LANSecret() || k == gateway.WSLKeyMade())}// gatewayTakes says the gateway would authenticate a request carrying k: a@@ -70,7 +83,11 @@ func gatewayTakes(k string) bool {// gateway.Token, the LAN sharing key, or one naming the agent// (gateway.TokenFor).func gatewayKey(want string) bool {- return ourKey(want) || strings.HasPrefix(want, gateway.Token+"-") && !strings.ContainsAny(want, "/:")+ if ourKey(want) || strings.HasPrefix(want, gateway.Token+"-") && !strings.ContainsAny(want, "/:") {+ return true+ }+ wk := gateway.WSLKeyMade()+ return wk != "" && strings.HasPrefix(want, wk+"-") && !strings.ContainsAny(want, "/:")}// keyHolds says the value v an agent's config has where magpie wrote wantdiff --git a/internal/agent/reach.go b/internal/agent/reach.goindex d544d9eab..69975eea1 100644--- a/internal/agent/reach.go+++ b/internal/agent/reach.go@@ -6,6 +6,7 @@ import ("net""net/http""net/url"+ "os""runtime""strings""sync"@@ -233,13 +234,27 @@ func (a *Agent) unreachable(on Field, now string) *Drift {return nil}// both asked at once, so one round of probes settles it- ok, known := reachable(addr)+ inside := a.reachFrom != nil && gateway.OnWSLNet(addr)+ var ok, known bool+ if inside {+ ok, known = a.reachFrom(addr)+ } else {+ ok, known = reachable(addr)+ }up, upKnown := reachable(gateway.URL())if ok || !known || !up || !upKnown {return nil}d := &Drift{Kind: "unreachable", Field: on.Key, Now: now, Want: now, Addr: addr}host := strings.TrimPrefix(strings.TrimPrefix(addr, "http://"), "https://")+ if inside {+ // magpie listens there itself (gateway/wsl.go): what keeps WSL out+ // is Windows' firewall+ d.Detail = a.Name + " is pointed at magpie at " + addr + ", where magpie listens for WSL, but nothing answers there from WSL " + a.WSL + ": Windows' firewall keeps WSL out. " ++ "Allow magpie in when Windows asks, or, in PowerShell as administrator: " + wslFirewallCommand() + ". " ++ "On Windows 11, networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig lets WSL reach magpie at 127.0.0.1 instead."+ return d+ }d.Detail = a.Name + " is pointed at magpie at " + addr + ", where nothing answers from this computer, though magpie answers at " + gateway.URL() + ". "if a.WSL != "" || runtime.GOOS == "windows" {d.Detail += "Under WSL's NAT networking, Windows as WSL sees it reaches magpie only while something listens on " + host +@@ -256,6 +271,18 @@ func (a *Agent) unreachable(on Field, now string) *Drift {return d}+// wslFirewallCommand lets magpie in from WSL's networks through Windows'+// firewall, for an administrator's PowerShell. WSL's network is a Public+// one, so a rule for Private networks only (what Windows' own prompt+// offers ticked) doesn't do.+func wslFirewallCommand() string {+ exe, err := os.Executable()+ if err != nil || exe == "" {+ exe = "magpie.exe"+ }+ return "New-NetFirewallRule -DisplayName 'magpie (WSL)' -Direction Inbound -Action Allow -Profile Any -InterfaceAlias 'vEthernet (WSL*)' -Program '" + strings.ReplaceAll(exe, "'", "''") + "'"+}+// wslMovedFrom is the address a WSL distro reaches Windows at now, when// base is on one it reached Windows at before (its networking's address// changed since, or it is in mirrored or consomme networking now, wherediff --git a/internal/agent/wsl.go b/internal/agent/wsl.goindex 86ef535d3..17aeb618d 100644--- a/internal/agent/wsl.go+++ b/internal/agent/wsl.go@@ -7,6 +7,7 @@ import ("fmt""log""net"+ "net/url""os""path/filepath""runtime"@@ -653,6 +654,19 @@ func wslAgent(k wslKind, d distro) *Agent {a := k.in(d.place(id))a.ID, a.Name, a.Aliases, a.Bin, a.UA, a.WSL = id, k.name+" · WSL "+d.Name, nil, "", nil, d.Namea.Gateway = d.base+ a.reachFrom = func(base string) (ok, known bool) {+ if !d.live() {+ return false, false // never started to be asked+ }+ key := "wsl " + d.Name + " " + base+ return probed(key, func() bool {+ if !d.live() {+ return true // stopped since: never started to be asked+ }+ ok, told := wslReach(d.Name, base)+ return ok || !told // can't tell: taken as answering+ })+ }if d.Running {a.Home = d.local(d.Home)}@@ -916,6 +930,51 @@ var wslOn = runtime.GOOS == "windows"func wslLooks() bool { return wslOn && !settings.Load().NoWSLAgents }// wslRun runs wsl.exe; a var for tests.+// wslReachScript asks, inside a distro, whether anything answers at $1+// (http://host:port) on host $2, port $3: "ok" when it does, "no" when the+// connection is refused or times out, "?" when the distro has nothing to+// ask with.+const wslReachScript = `u="$1"; h="$2"; p="$3"+if command -v curl >/dev/null 2>&1; then+ curl -s -o /dev/null -m 3 "$u/v1/models"; c=$?+ case $c in 0) echo ok;; 7|28) echo no;; *) echo '?';; esac; exit 0+fi+if command -v wget >/dev/null 2>&1; then+ wget -q -O /dev/null -T 3 -t 1 "$u/v1/models"; c=$?+ case $c in 0|8) echo ok;; 4) echo no;; *) echo '?';; esac; exit 0+fi+if command -v bash >/dev/null 2>&1 && command -v timeout >/dev/null 2>&1; then+ if timeout 3 bash -c 'exec 3<>/dev/tcp/'"$h"'/'"$p" 2>/dev/null; then echo ok; else echo no; fi; exit 0+fi+echo '?'`++// wslReach is whether base answers from inside the running distro name,+// and whether that could be told.+func wslReach(name, base string) (ok, known bool) {+ u, err := url.Parse(base)+ if err != nil || u.Hostname() == "" {+ return false, false+ }+ port := u.Port()+ if port == "" {+ port = map[string]string{"https": "443"}[u.Scheme]+ if port == "" {+ port = "80"+ }+ }+ out, err := wslRun(10*time.Second, "-d", name, "-e", "sh", "-c", wslReachScript, "sh", strings.TrimSuffix(base, "/"), u.Hostname(), port)+ if err != nil {+ return false, false+ }+ switch strings.TrimSpace(string(out)) {+ case "ok":+ return true, true+ case "no":+ return false, true+ }+ return false, false+}+var wslRun = func(timeout time.Duration, args ...string) ([]byte, error) {ctx, cancel := context.WithTimeout(context.Background(), timeout)defer cancel()@@ -1441,8 +1500,8 @@ func wslSetting(cfg, key string) (val string, ok bool) {// what an agent in WSL says after a change, besides its kind's restart// (notice.go)var (- noticeWSLNotMirrored = newNotice("WSL {distro} is in {net} networking, not mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; that answers only while the gateway listens beyond loopback and Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.")- noticeWSLNoMode = newNotice("magpie couldn't ask WSL {distro} its networking mode (it has no wslinfo) and %UserProfile%\\.wslconfig doesn't set it to mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; that answers only while the gateway listens beyond loopback and Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.")+ noticeWSLNotMirrored = newNotice("WSL {distro} is in {net} networking, not mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; magpie listens there for WSL, and it answers once Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.")+ noticeWSLNoMode = newNotice("magpie couldn't ask WSL {distro} its networking mode (it has no wslinfo) and %UserProfile%\\.wslconfig doesn't set it to mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; magpie listens there for WSL, and it answers once Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.")noticeWSLNoRelay = newNotice("WSL {distro} is in {net} networking with localhostForwarding=false in %UserProfile%\\.wslconfig, so 127.0.0.1 there, where its {agent} was pointed, isn't relayed to Windows, where magpie listens. Remove localhostForwarding=false under [wsl2] (it is on by default) and run wsl --shutdown.")noticeWSLAsleep = newNotice("WSL {distro} isn't running: magpie shows what it last saw there, and starts it only to change something."))diff --git a/internal/agent/wsl_nat_test.go b/internal/agent/wsl_nat_test.gonew file mode 100644index 000000000..725cea569--- /dev/null+++ b/internal/agent/wsl_nat_test.go@@ -0,0 +1,127 @@+package agent++import (+ "net"+ "slices"+ "strings"+ "sync"+ "testing"+ "time"++ "github.com/yetone/magpie/internal/gateway"+)++// fakeWSLNet makes cidr the WSL network Windows has an address on.+func fakeWSLNet(t *testing.T, cidr string) {+ t.Helper()+ ip, n, err := net.ParseCIDR(cidr)+ if err != nil {+ t.Fatal(err)+ }+ n.IP = ip+ old := gateway.WSLNets+ gateway.WSLNets = func() []*net.IPNet { return []*net.IPNet{n} }+ t.Cleanup(func() { gateway.WSLNets = old })+}++// zaidu259434 on X: Codex in WSL (NAT) failed to connect with magpie's+// sharing off. At Windows' address on the WSL network, where the gateway+// now listens itself, every agent is given the WSL key, sharing on or off,+// and Codex, signed in or not, has it as its provider's key. Elsewhere off+// loopback it is the LAN key as before, and on loopback the token.+func TestWSLAgentsGetTheWSLKey(t *testing.T) {+ home, read := codexHome(t, `{"OPENAI_API_KEY":"sk-x"}`, "model = \"gpt-5.5\"\n")+ fakeWSLNet(t, "172.20.0.1/20")+ nat := "http://172.20.0.1:" + gateway.Port()+ k := keyAt(nat)+ if k == gateway.Token || k != gateway.WSLKey() || !strings.HasPrefix(k, "wsl-") {+ t.Fatalf("key at the WSL network: %q", k)+ }+ if keyAt(gateway.URL()) != gateway.Token || keyAt("http://192.168.1.5:3425") != gateway.Token {+ t.Error("the WSL key given beyond the WSL network")+ }+ if !ourKey(k) || !gatewayKey(k) || !gatewayKey(agentKeyAt("qoder", nat)) || agentKeyAt("qoder", nat) != k+"-qoder" {+ t.Errorf("WSL keys not known as magpie's: %q", agentKeyAt("qoder", nat))+ }+ if oc := magpieProviderJSONAt("opencode", "opencode", nat).(map[string]any)["options"].(map[string]any); oc["apiKey"] != k {+ t.Errorf("OpenCode in WSL: %v", oc["apiKey"])+ }++ a := wslCodex(fakeDistro(home, false))+ if err := a.Fields[0].Set("fake/m1"); err != nil {+ t.Fatal(err)+ }+ cfg := read()+ if !strings.Contains(cfg, `experimental_bearer_token = "`+k+`"`) {+ t.Fatalf("Codex in WSL not given the WSL key:\n%s", cfg)+ }+ if c := a.Check(); c != "" {+ t.Fatalf("check: %s", c)+ }+}++// What answers at Windows' address on the WSL network is asked from inside+// the distro, never from Windows, where the gateway's own listener answers+// whatever the firewall lets in from WSL: a distro that can't connect is+// told so, with the firewall rule that lets it in; one that can, or can't+// tell (nothing to ask with), isn't. A stopped distro is never run.+func TestWSLReachAskedInsideTheDistro(t *testing.T) {+ home, _ := codexHome(t, `{"OPENAI_API_KEY":"sk-x"}`, "model = \"gpt-5.5\"\n")+ fakeWSLNet(t, "172.20.0.1/20")+ nat := "http://172.20.0.1:" + gateway.Port()+ // from Windows both answer: only the distro's answer can tell+ fakeReach(t, map[string]bool{gateway.URL(): true, nat: true})+ var mu sync.Mutex+ inside, runs := "no", 0+ was := wslRun+ wslRun = func(_ time.Duration, args ...string) ([]byte, error) {+ mu.Lock()+ defer mu.Unlock()+ if slices.Contains(args, wslReachScript) {+ runs+++ if args[1] != "Ubuntu-24.04" || !slices.Contains(args, nat) {+ t.Errorf("asked %v", args)+ }+ return []byte(inside + "\n"), nil+ }+ return nil, nil+ }+ t.Cleanup(func() { wslRun = was })+ d := fakeDistro(home, false)+ a := wslCodex(d)+ if err := a.Fields[0].Set("fake/m1"); err != nil {+ t.Fatal(err)+ }+ dr := driftSettled(t, a)+ if dr == nil || dr.Kind != "unreachable" || dr.Addr != nat || !strings.Contains(dr.Detail, "firewall") || !strings.Contains(dr.Detail, "New-NetFirewallRule") || !strings.Contains(dr.Detail, "-Profile Any") {+ t.Fatalf("blocked from WSL: %+v", dr)+ }+ for _, said := range []string{"ok", "?"} {+ mu.Lock()+ inside = said+ mu.Unlock()+ reachForget()+ if dr := driftSettled(t, a); dr != nil {+ t.Errorf("WSL says %s: %+v", said, dr)+ }+ }+ // stopped: never run to be asked+ mu.Lock()+ inside, runs = "no", 0+ mu.Unlock()+ reachForget()+ d.up = func() bool { return false }+ off := wslCodex(d)+ if off.reachFrom == nil {+ t.Fatal("no probe")+ }+ if _, known := off.reachFrom(nat); known {+ t.Error("a stopped distro's answer known")+ }+ time.Sleep(50 * time.Millisecond)+ mu.Lock()+ defer mu.Unlock()+ if runs != 0 {+ t.Errorf("a stopped distro was run %d times", runs)+ }+}diff --git a/internal/gateway/gateway.go b/internal/gateway/gateway.goindex 07da5e70e..624aeb076 100644--- a/internal/gateway/gateway.go+++ b/internal/gateway/gateway.go@@ -635,6 +635,9 @@ func (s *Server) ListenAndServe(ctx context.Context) error {for _, f := range WhileServing {go f(ctx)}+ // and, on Windows, serves WSL distros under NAT at Windows' address on+ // their network (wsl.go)+ go s.serveWSL(ctx, srv)drained := make(chan struct{})go func() {defer close(drained)diff --git a/internal/gateway/lan.go b/internal/gateway/lan.goindex 3dad39418..ae783663a 100644--- a/internal/gateway/lan.go+++ b/internal/gateway/lan.go@@ -249,6 +249,11 @@ func lanGuard(next http.Handler) http.Handler {next.ServeHTTP(w, r)return}+ // a WSL distro's agent, at the address Windows has on its network+ // (wsl.go), is one of this computer's+ if fromWSL(r) {+ r = asFromLoopback(r)+ }// the allow list comes before the key: one that leaked is of no// use from an address left out of itif refuseNotAllowed(w, r) {diff --git a/internal/gateway/wsl.go b/internal/gateway/wsl.gonew file mode 100644index 000000000..039de085c--- /dev/null+++ b/internal/gateway/wsl.go@@ -0,0 +1,299 @@+package gateway++import (+ "context"+ "crypto/rand"+ "crypto/subtle"+ "encoding/hex"+ "errors"+ "log"+ "net"+ "net/http"+ "os"+ "path/filepath"+ "runtime"+ "slices"+ "strings"+ "sync"+ "time"++ "github.com/yetone/magpie/internal/edit"+ "github.com/yetone/magpie/internal/settings"+)++// A WSL distro in NAT networking (WSL's default) reaches Windows at the+// address Windows has on the WSL network (vEthernet (WSL), 172.17.32.1 for+// a distro at 172.17.38.240), not at 127.0.0.1. magpie wrote that address+// into the distro's agents, but the gateway listened on 127.0.0.1 alone, so+// Codex and the other CLIs there were refused or timed out until the user+// shared magpie on the local network (zaidu259434 on X: "启动codex这些cli连接+// 会失败,没自动启动magpie的网关"). Now, while the gateway is on loopback, it+// also listens on each address Windows has on a WSL network, and a request+// that arrives there from that network with the WSL key (WSLKey, which+// magpie writes into those agents only) is this computer's, as it is from a+// distro in mirrored networking, whose 127.0.0.1 is Windows'. Anything else+// arriving there is judged as a request from another machine: a container+// of Docker Desktop's, which shares that network, has no key.++// WSLNets are the networks Windows has an address on that WSL distros reach+// it through: the IPv4 addresses of the vEthernet (WSL) adapters (named+// "vEthernet (WSL)" or, with the Hyper-V firewall, "vEthernet (WSL (Hyper-V+// firewall))"), there while WSL's VM runs. None off Windows. A var for the+// tests.+var WSLNets = wslNets++func wslNets() []*net.IPNet {+ if runtime.GOOS != "windows" {+ return nil+ }+ ifs, err := net.Interfaces()+ if err != nil {+ return nil+ }+ var out []*net.IPNet+ for _, i := range ifs {+ if i.Flags&net.FlagUp == 0 || !strings.Contains(i.Name, "(WSL") {+ continue+ }+ addrs, _ := i.Addrs()+ for _, a := range addrs {+ if n, ok := a.(*net.IPNet); ok && n.IP.To4() != nil && !n.IP.IsLinkLocalUnicast() {+ out = append(out, n)+ }+ }+ }+ return out+}++// OnWSLNet says base (an agent's gateway URL) names an address Windows has+// on a WSL network: where a distro under NAT reaches the gateway.+func OnWSLNet(base string) bool {+ h := base+ if i := strings.Index(h, "://"); i >= 0 {+ h = h[i+3:]+ }+ if i := strings.IndexAny(h, "/?#"); i >= 0 {+ h = h[:i]+ }+ if hh, _, err := net.SplitHostPort(h); err == nil {+ h = hh+ }+ ip := net.ParseIP(strings.Trim(h, "[]"))+ if ip == nil {+ return false+ }+ return slices.ContainsFunc(WSLNets(), func(n *net.IPNet) bool { return n.IP.Equal(ip) })+}++// wslKeyPrefix starts the WSL key. Neither sk-magpie- (a named gateway+// key's, looked up among the keys) nor magpie- (the token with an agent's+// id after it, agentOf).+const wslKeyPrefix = "wsl-"++var wslKey struct {+ sync.Mutex+ v, at string // the key, and the file it was read from+}++func wslKeyPath() string { return filepath.Join(settings.Dir(), "wsl-key") }++// WSLKey is the key magpie gives the agents of a WSL distro that reaches+// the gateway on the WSL network (OnWSLNet): made once, kept in magpie's+// folder, readable by this user only. "" when it can't be read or made, and+// the agent is given the gateway's token as before.+func WSLKey() string {+ wslKey.Lock()+ defer wslKey.Unlock()+ path := wslKeyPath()+ if wslKey.v != "" && wslKey.at == path {+ return wslKey.v+ }+ b, err := os.ReadFile(path)+ if err == nil {+ if k := strings.TrimSpace(string(b)); strings.HasPrefix(k, wslKeyPrefix) && len(k) > len(wslKeyPrefix)+16 {+ wslKey.v, wslKey.at = k, path+ return k+ }+ } else if !errors.Is(err, os.ErrNotExist) {+ return "" // unknown: never written over+ }+ buf := make([]byte, 24)+ if _, err := rand.Read(buf); err != nil {+ return ""+ }+ k := wslKeyPrefix + hex.EncodeToString(buf)+ if err := os.MkdirAll(settings.Dir(), 0o700); err != nil {+ return ""+ }+ // made 0600 first, so the write keeps that mode+ if f, err := os.OpenFile(path, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0o600); err == nil {+ f.Close()+ } else if !errors.Is(err, os.ErrExist) {+ return ""+ }+ if err := edit.WriteAtomic(path, []byte(k+"\n")); err != nil {+ return ""+ }+ wslKey.v, wslKey.at = k, path+ return k+}++// WSLKeyMade is the WSL key when one was made, "" when not: for telling+// whether a key is it without making one.+func WSLKeyMade() string { return wslKeyHeld() }++// wslKeyHeld is the WSL key as the gateway takes it: the one in magpie's+// folder, read again when the cache is empty (another magpie made it).+func wslKeyHeld() string {+ path := wslKeyPath()+ wslKey.Lock()+ v, at := wslKey.v, wslKey.at+ wslKey.Unlock()+ if v != "" && at == path {+ return v+ }+ if _, err := os.Stat(path); err != nil {+ return ""+ }+ return WSLKey()+}++// wslToken is what v, a key a caller sent, stands for when it is the WSL+// key: the gateway's token, with the agent's id after it when the key has+// one (WSLKey()+"-codex" is Token+"-codex", TokenFor). "" when it isn't.+func wslToken(v, k string) string {+ v = strings.TrimSpace(v)+ if k == "" || len(v) < len(k) {+ return ""+ }+ head, rest := v[:len(k)], v[len(k):]+ if subtle.ConstantTimeCompare([]byte(head), []byte(k)) != 1 {+ return ""+ }+ if rest == "" {+ return Token+ }+ if id, ok := strings.CutPrefix(rest, "-"); ok && id != "" {+ return Token + "-" + id+ }+ return ""+}++// fromWSL: r came to an address Windows has on a WSL network, from that+// network, with the WSL key.+func fromWSL(r *http.Request) bool {+ peer, _, err := net.SplitHostPort(r.RemoteAddr)+ if err != nil {+ return false+ }+ ip := net.ParseIP(peer)+ la, _ := r.Context().Value(http.LocalAddrContextKey).(net.Addr)+ tcp, ok := la.(*net.TCPAddr)+ if ip == nil || ip.IsLoopback() || !ok || tcp.IP.IsLoopback() || tcp.IP.IsUnspecified() {+ return false+ }+ if !slices.ContainsFunc(WSLNets(), func(n *net.IPNet) bool { return n.IP.Equal(tcp.IP) && n.Contains(ip) }) {+ return false+ }+ k := wslKeyHeld()+ return k != "" && slices.ContainsFunc(callerKeys(r), func(v string) bool { return wslToken(v, k) != "" })+}++// asFromLoopback is r as a request from this computer: from loopback, its+// WSL key put back as the gateway's token, so it is judged, counted and+// routed as an agent on this machine's is.+func asFromLoopback(r *http.Request) *http.Request {+ k := wslKeyHeld()+ r2 := r.Clone(r.Context())+ _, port, _ := net.SplitHostPort(r.RemoteAddr)+ r2.RemoteAddr = net.JoinHostPort("127.0.0.1", port)+ if a := strings.TrimSpace(r2.Header.Get("Authorization")); len(a) >= 7 && strings.EqualFold(a[:7], "Bearer ") {+ if t := wslToken(a[7:], k); t != "" {+ r2.Header.Set("Authorization", "Bearer "+t)+ }+ }+ for _, h := range []string{"x-api-key", "x-goog-api-key"} {+ if t := wslToken(r2.Header.Get(h), k); t != "" {+ r2.Header.Set(h, t)+ }+ }+ if q := r2.URL.Query(); q.Has("key") {+ if t := wslToken(q.Get("key"), k); t != "" {+ q.Set("key", t)+ r2.URL.RawQuery = q.Encode()+ }+ }+ return r2+}++// wslWatch is how often the gateway looks for WSL networks come or gone:+// WSL's VM, and its adapter with it, starts with the first distro and goes+// with wsl --shutdown, often on another address.+var wslWatch = 10 * time.Second++// serveWSL serves srv on each address Windows has on a WSL network, while+// the gateway listens on loopback alone, until ctx ends.+func (s *Server) serveWSL(ctx context.Context, srv *http.Server) {+ if runtime.GOOS != "windows" && !wslServeEverywhere {+ return+ }+ lns := map[string]net.Listener{}+ defer func() {+ for _, ln := range lns {+ ln.Close()+ }+ }()+ look := func() {+ want := map[string]bool{}+ if s.onLoopback() {+ for _, n := range WSLNets() {+ want[net.JoinHostPort(n.IP.String(), Port())] = true+ }+ }+ for a, ln := range lns {+ if !want[a] {+ ln.Close()+ delete(lns, a)+ }+ }+ for a := range want {+ if lns[a] != nil {+ continue+ }+ ln, err := net.Listen("tcp", a)+ if err != nil {+ log.Printf("gateway: can't listen for WSL at %s: %v", a, err)+ continue+ }+ lns[a] = ln+ go srv.Serve(ln)+ }+ }+ look()+ t := time.NewTicker(wslWatch)+ defer t.Stop()+ for {+ select {+ case <-ctx.Done():+ return+ case <-t.C:+ look()+ }+ }+}++// wslServeEverywhere lets the tests serve WSL networks off Windows.+var wslServeEverywhere = false++// onLoopback: the gateway listens on loopback alone now — not shared on+// every address, nor at an address MAGPIE_ADDR pins beyond loopback.+func (s *Server) onLoopback() bool {+ s.lnMu.Lock()+ ln := s.ln+ s.lnMu.Unlock()+ if ln == nil {+ return false+ }+ a, ok := ln.Addr().(*net.TCPAddr)+ return ok && a.IP.IsLoopback()+}diff --git a/internal/gateway/wsl_test.go b/internal/gateway/wsl_test.gonew file mode 100644index 000000000..ec4b9a334--- /dev/null+++ b/internal/gateway/wsl_test.go@@ -0,0 +1,178 @@+package gateway++import (+ "context"+ "io"+ "net"+ "net/http"+ "net/http/httptest"+ "os"+ "strings"+ "sync/atomic"+ "testing"+ "time"+)++// fakeWSLNet makes nets the WSL networks Windows has an address on.+func fakeWSLNet(t *testing.T, cidrs ...string) {+ t.Helper()+ var nets []*net.IPNet+ for _, c := range cidrs {+ ip, n, err := net.ParseCIDR(c)+ if err != nil {+ t.Fatal(err)+ }+ n.IP = ip+ nets = append(nets, n)+ }+ old := WSLNets+ WSLNets = func() []*net.IPNet { return nets }+ t.Cleanup(func() { WSLNets = old })+}++// zaidu259434 on X: Codex in a WSL distro under NAT, pointed at Windows'+// address on the WSL network (172.17.32.1), failed to connect with+// sharing off. A request that reaches that address from the WSL network+// with the WSL key is served as one from this computer, its key the+// gateway's token (with the agent's id when the key has one); without the+// key, from elsewhere, or at another of this computer's addresses, it is+// judged as one from another machine and refused while magpie isn't+// shared.+func TestWSLCallerServedWithSharingOff(t *testing.T) {+ fresh(t)+ t.Setenv("MAGPIE_ADDR", "")+ fakeWSLNet(t, "172.17.32.1/20")+ key := WSLKey()+ if !strings.HasPrefix(key, wslKeyPrefix) || strings.HasPrefix(key, Token) {+ t.Fatalf("key %q", key)+ }+ if fi, err := os.Stat(wslKeyPath()); err != nil || fi.Mode().Perm()&0o077 != 0 && os.PathSeparator == '/' {+ t.Fatalf("key file: %v %v", fi, err)+ }+ var seen *http.Request+ h := lanGuard(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { seen = r }))+ call := func(from, at string, set func(*http.Request)) (int, string) {+ seen = nil+ r := httptest.NewRequest("POST", "http://172.17.32.1:3425/v1/responses", nil)+ r.RemoteAddr = from+ ip, port, _ := net.SplitHostPort(at)+ p := 0+ for _, c := range port {+ p = p*10 + int(c-'0')+ }+ r = r.WithContext(context.WithValue(r.Context(), http.LocalAddrContextKey, &net.TCPAddr{IP: net.ParseIP(ip), Port: p}))+ if set != nil {+ set(r)+ }+ w := httptest.NewRecorder()+ h.ServeHTTP(w, r)+ return w.Code, w.Body.String()+ }+ bearer := func(v string) func(*http.Request) {+ return func(r *http.Request) { r.Header.Set("Authorization", "Bearer "+v) }+ }+ const distro, win = "172.17.38.240:51000", "172.17.32.1:3425"++ if code, body := call(distro, win, bearer(key)); code != 200 || seen == nil {+ t.Fatalf("WSL key: %d %s", code, body)+ }+ if !local(seen) || seen.Header.Get("Authorization") != "Bearer "+Token {+ t.Errorf("served as %s with %q", seen.RemoteAddr, seen.Header.Get("Authorization"))+ }+ if code, _ := call(distro, win, bearer(key+"-codex")); code != 200 || agentOf(seen) != "codex" {+ t.Errorf("WSL key for codex: %d, agent %q", code, agentOf(seen))+ }+ if code, _ := call(distro, win, func(r *http.Request) { r.Header.Set("x-api-key", key) }); code != 200 || seen.Header.Get("x-api-key") != Token {+ t.Errorf("x-api-key: %d", code)+ }+ for name, c := range map[string]struct {+ from, at string+ set func(*http.Request)+ }{+ "no key": {distro, win, nil},+ "the token": {distro, win, bearer(Token)},+ "a wrong key": {distro, win, bearer(key[:len(key)-1] + "x")},+ "the key, extended": {distro, win, bearer(key + "x")},+ "another network": {"192.168.1.20:5000", win, bearer(key)},+ "another address": {distro, "192.168.1.5:3425", bearer(key)},+ } {+ if code, body := call(c.from, c.at, c.set); code != http.StatusForbidden || !strings.Contains(body, "isn't shared") {+ t.Errorf("%s: %d %s, want refused as another machine's", name, code, body)+ }+ }+}++// The gateway on loopback also listens at each address Windows has on a+// WSL network, comes or goes with it, and stops when sharing puts it on+// every address anyway. [::1] stands for the WSL network's address here.+func TestServeWSLListensBesideLoopback(t *testing.T) {+ fresh(t)+ ln, err := net.Listen("tcp", "127.0.0.1:0")+ if err != nil {+ t.Fatal(err)+ }+ t.Cleanup(func() { ln.Close() })+ t.Setenv("MAGPIE_ADDR", ln.Addr().String())+ if l6, err := net.Listen("tcp6", "[::1]:0"); err != nil {+ t.Skip("no IPv6 loopback")+ } else {+ l6.Close()+ }+ old, oldW := wslServeEverywhere, wslWatch+ wslServeEverywhere, wslWatch = true, 20*time.Millisecond+ t.Cleanup(func() { wslServeEverywhere, wslWatch = old, oldW })+ var nets atomic.Pointer[[]*net.IPNet]+ setNets := func(n []*net.IPNet) { nets.Store(&n) }+ setNets(nil)+ oldNets := WSLNets+ WSLNets = func() []*net.IPNet { return *nets.Load() }+ t.Cleanup(func() { WSLNets = oldNets })++ s := &Server{}+ s.ln = ln+ srv := &http.Server{Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { io.WriteString(w, "ok") })}+ ctx, cancel := context.WithCancel(context.Background())+ done := make(chan struct{})+ go func() { s.serveWSL(ctx, srv); close(done) }()+ t.Cleanup(func() { cancel(); <-done; srv.Close() })++ at := "http://" + net.JoinHostPort("::1", Port()) + "/"+ answers := func() bool {+ c := &http.Client{Timeout: time.Second}+ res, err := c.Get(at)+ if err != nil {+ return false+ }+ res.Body.Close()+ return true+ }+ waitFor := func(want bool, what string) {+ t.Helper()+ deadline := time.Now().Add(10 * time.Second)+ for answers() != want {+ if time.Now().After(deadline) {+ t.Fatalf("%s: %s answers = %v", what, at, !want)+ }+ time.Sleep(10 * time.Millisecond)+ }+ }+ if answers() {+ t.Fatal("answering before any WSL network")+ }+ setNets([]*net.IPNet{{IP: net.ParseIP("::1"), Mask: net.CIDRMask(128, 128)}})+ waitFor(true, "WSL network up")+ setNets(nil)+ waitFor(false, "WSL network gone")+ setNets([]*net.IPNet{{IP: net.ParseIP("::1"), Mask: net.CIDRMask(128, 128)}})+ waitFor(true, "WSL network back")+ // shared: the gateway listens on every address itself+ all, err := net.Listen("tcp", "0.0.0.0:0")+ if err != nil {+ t.Fatal(err)+ }+ t.Cleanup(func() { all.Close() })+ s.lnMu.Lock()+ s.ln = all+ s.lnMu.Unlock()+ waitFor(false, "shared on every address")+}diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.jsindex 15e79d680..d1e694fff 100644--- a/internal/gui/assets/i18n.js+++ b/internal/gui/assets/i18n.js@@ -3784,7 +3784,7 @@ const I18N = {"Reasonix Studio 2.x and the native 1.39.x/2.x CLI read global settings at startup. Start a new process to load changes. Project/session models can override Executor and Plan.": "Reasonix Studio 2.x 和原生 1.39.x/2.x CLI 在启动时读取全局设置,需启动新进程才会加载改动。项目或会话的模型可以覆盖 Executor 和 Plan。","Snow CLI reads its profile at start-up — restart open snow sessions to use this.": "Snow CLI 启动时读取配置档,需重启已打开的 snow 会话才会生效。","WSL {distro} is in {net} networking with localhostForwarding=false in %UserProfile%\\.wslconfig, so 127.0.0.1 there, where its {agent} was pointed, isn't relayed to Windows, where magpie listens. Remove localhostForwarding=false under [wsl2] (it is on by default) and run wsl --shutdown.": "WSL {distro} 使用 {net} 网络模式,且 %UserProfile%\\.wslconfig 中设置了 localhostForwarding=false,因此其中 {agent} 指向的 127.0.0.1 不会转发到 magpie 所在的 Windows。请删除 [wsl2] 下的 localhostForwarding=false(默认开启),然后运行 wsl --shutdown。",- "WSL {distro} is in {net} networking, not mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; that answers only while the gateway listens beyond loopback and Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.": "WSL {distro} 使用 {net} 网络模式而不是 mirrored,因此其中的 {agent} 指向 Windows({url})而不是 127.0.0.1;只有网关监听回环以外的地址、且 Windows 防火墙放行 WSL 时才能连通。若要使用 127.0.0.1,请在 %UserProfile%\\.wslconfig 的 [wsl2] 下设置 networkingMode=mirrored 并运行 wsl --shutdown,然后重新选择模型。",+ "WSL {distro} is in {net} networking, not mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; magpie listens there for WSL, and it answers once Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.": "WSL {distro} 使用 {net} 网络模式而不是 mirrored,因此其中的 {agent} 指向 Windows({url})而不是 127.0.0.1;magpie 会在该地址为 WSL 监听,Windows 防火墙放行 WSL 后即可连通。若要使用 127.0.0.1,请在 %UserProfile%\\.wslconfig 的 [wsl2] 下设置 networkingMode=mirrored 并运行 wsl --shutdown,然后重新选择模型。","WSL {distro} isn't running: magpie shows what it last saw there, and starts it only to change something.": "WSL {distro} 未运行:magpie 显示的是上次看到的内容,只在需要修改时才启动它。","ZCode reads its providers at start-up — restart ZCode to see magpie's models in its picker.": "ZCode 启动时读取供应商,需重启 ZCode 才能在它的模型选择器中看到 magpie 的模型。","AstrBot reads cmd_config.json at start-up and writes it back whole when its WebUI saves settings — restart AstrBot to use this, before saving anything in its WebUI.": "AstrBot 启动时读取 cmd_config.json,并在其 WebUI 保存设置时整份写回——请重启 AstrBot 以使用此设置,且在此之前不要在其 WebUI 中保存任何内容。",@@ -3792,7 +3792,7 @@ const I18N = {"dsh reads its config at start-up — restart open dsh sessions to use this.": "dsh 启动时读取配置,需重启已打开的 dsh 会话才会生效。","dsh's web search goes through magpie, which has nothing to search with yet: set up a provider that searches by itself (DeepSeek, Claude, Codex, …) or a search API under Settings › Web search.": "dsh 的联网搜索经过 magpie,而 magpie 目前还没有可用的搜索方式:请添加一个自带搜索的供应商(DeepSeek、Claude、Codex 等),或在“设置 › 联网搜索”中配置搜索 API。","fx reads its settings at start-up — restart open fx sessions to use this.": "fx 启动时读取设置,需重启已打开的 fx 会话才会生效。",- "magpie couldn't ask WSL {distro} its networking mode (it has no wslinfo) and %UserProfile%\\.wslconfig doesn't set it to mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; that answers only while the gateway listens beyond loopback and Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.": "magpie 无法获取 WSL {distro} 的网络模式(其中没有 wslinfo),且 %UserProfile%\\.wslconfig 未将其设为 mirrored,因此其中的 {agent} 指向 Windows({url})而不是 127.0.0.1;只有网关监听回环以外的地址、且 Windows 防火墙放行 WSL 时才能连通。若要使用 127.0.0.1,请在 %UserProfile%\\.wslconfig 的 [wsl2] 下设置 networkingMode=mirrored 并运行 wsl --shutdown,然后重新选择模型。",+ "magpie couldn't ask WSL {distro} its networking mode (it has no wslinfo) and %UserProfile%\\.wslconfig doesn't set it to mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; magpie listens there for WSL, and it answers once Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.": "magpie 无法获取 WSL {distro} 的网络模式(其中没有 wslinfo),且 %UserProfile%\\.wslconfig 未将其设为 mirrored,因此其中的 {agent} 指向 Windows({url})而不是 127.0.0.1;magpie 会在该地址为 WSL 监听,Windows 防火墙放行 WSL 后即可连通。若要使用 127.0.0.1,请在 %UserProfile%\\.wslconfig 的 [wsl2] 下设置 networkingMode=mirrored 并运行 wsl --shutdown,然后重新选择模型。","magpie restarted the app-server codex sessions share, which none was on, so new codex sessions have this; restart the Codex app, if it is open, to see it there.": "magpie 已重启 codex 会话共用的 app-server(当时没有会话连着它),新的 codex 会话已生效;如果 Codex 应用开着,需重启它才能看到。","magpie's models are in Copilot Chat's model picker in your JetBrains IDE, under magpie, once the IDE restarts. They need Copilot signed in to GitHub on a plan with Bring Your Own Key: Copilot Free, Pro and Pro+ have it, Business and Enterprise when the organisation's policy allows it.": "JetBrains IDE 重启后,magpie 的模型会出现在 Copilot Chat 模型选择器的 magpie 分组下。前提是 Copilot 已用支持 Bring Your Own Key 的方案登录 GitHub:Copilot Free、Pro 和 Pro+ 都支持,Business 和 Enterprise 需组织策略允许。","magpie's models are in {agent}'s Chat model picker under magpie, from GitHub Copilot Chat {version}'s OpenAI Compatible provider, which it offers only while it is signed in to GitHub with a personal Copilot plan.": "magpie 的模型在 {agent} Chat 模型选择器的 magpie 分组下,来自 GitHub Copilot Chat {version} 的 OpenAI Compatible 供应商;只有用个人 Copilot 方案登录 GitHub 时它才提供这个供应商。",@@ -7732,7 +7732,7 @@ const I18N = {"Reasonix Studio 2.x and the native 1.39.x/2.x CLI read global settings at startup. Start a new process to load changes. Project/session models can override Executor and Plan.": "Reasonix Studio 2.x 和原生 1.39.x/2.x CLI 在啟動時讀取全域設定,需啟動新行程才會載入改動。專案或會話的模型可以覆蓋 Executor 和 Plan。","Snow CLI reads its profile at start-up — restart open snow sessions to use this.": "Snow CLI 啟動時讀取設定檔,需重啟已打開的 snow 會話才會生效。","WSL {distro} is in {net} networking with localhostForwarding=false in %UserProfile%\\.wslconfig, so 127.0.0.1 there, where its {agent} was pointed, isn't relayed to Windows, where magpie listens. Remove localhostForwarding=false under [wsl2] (it is on by default) and run wsl --shutdown.": "WSL {distro} 使用 {net} 網路模式,且 %UserProfile%\\.wslconfig 中設定了 localhostForwarding=false,因此其中 {agent} 指向的 127.0.0.1 不會轉發到 magpie 所在的 Windows。請刪除 [wsl2] 下的 localhostForwarding=false(預設開啟),然後執行 wsl --shutdown。",- "WSL {distro} is in {net} networking, not mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; that answers only while the gateway listens beyond loopback and Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.": "WSL {distro} 使用 {net} 網路模式而不是 mirrored,因此其中的 {agent} 指向 Windows({url})而不是 127.0.0.1;只有閘道監聽回環以外的位址、且 Windows 防火牆放行 WSL 時才能連通。若要使用 127.0.0.1,請在 %UserProfile%\\.wslconfig 的 [wsl2] 下設定 networkingMode=mirrored 並執行 wsl --shutdown,然後重新選擇模型。",+ "WSL {distro} is in {net} networking, not mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; magpie listens there for WSL, and it answers once Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.": "WSL {distro} 使用 {net} 網路模式而不是 mirrored,因此其中的 {agent} 指向 Windows({url})而不是 127.0.0.1;magpie 會在該位址為 WSL 監聽,Windows 防火牆放行 WSL 後即可連通。若要使用 127.0.0.1,請在 %UserProfile%\\.wslconfig 的 [wsl2] 下設定 networkingMode=mirrored 並執行 wsl --shutdown,然後重新選擇模型。","WSL {distro} isn't running: magpie shows what it last saw there, and starts it only to change something.": "WSL {distro} 未執行:magpie 顯示的是上次看到的內容,只在需要修改時才啟動它。","ZCode reads its providers at start-up — restart ZCode to see magpie's models in its picker.": "ZCode 啟動時讀取供應商,需重啟 ZCode 才能在它的模型選擇器中看到 magpie 的模型。","AstrBot reads cmd_config.json at start-up and writes it back whole when its WebUI saves settings — restart AstrBot to use this, before saving anything in its WebUI.": "AstrBot 啟動時讀取 cmd_config.json,並在其 WebUI 儲存設定時整份寫回——請重啟 AstrBot 以使用此設定,且在此之前不要在其 WebUI 中儲存任何內容。",@@ -7740,7 +7740,7 @@ const I18N = {"dsh reads its config at start-up — restart open dsh sessions to use this.": "dsh 啟動時讀取設定,需重啟已打開的 dsh 會話才會生效。","dsh's web search goes through magpie, which has nothing to search with yet: set up a provider that searches by itself (DeepSeek, Claude, Codex, …) or a search API under Settings › Web search.": "dsh 的聯網搜尋經過 magpie,而 magpie 目前還沒有可用的搜尋方式:請新增一個自帶搜尋的供應商(DeepSeek、Claude、Codex 等),或在“設定 › 聯網搜尋”中設定搜尋 API。","fx reads its settings at start-up — restart open fx sessions to use this.": "fx 啟動時讀取設定,需重啟已打開的 fx 會話才會生效。",- "magpie couldn't ask WSL {distro} its networking mode (it has no wslinfo) and %UserProfile%\\.wslconfig doesn't set it to mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; that answers only while the gateway listens beyond loopback and Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.": "magpie 無法取得 WSL {distro} 的網路模式(其中沒有 wslinfo),且 %UserProfile%\\.wslconfig 未將其設為 mirrored,因此其中的 {agent} 指向 Windows({url})而不是 127.0.0.1;只有閘道監聽回環以外的位址、且 Windows 防火牆放行 WSL 時才能連通。若要使用 127.0.0.1,請在 %UserProfile%\\.wslconfig 的 [wsl2] 下設定 networkingMode=mirrored 並執行 wsl --shutdown,然後重新選擇模型。",+ "magpie couldn't ask WSL {distro} its networking mode (it has no wslinfo) and %UserProfile%\\.wslconfig doesn't set it to mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; magpie listens there for WSL, and it answers once Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.": "magpie 無法取得 WSL {distro} 的網路模式(其中沒有 wslinfo),且 %UserProfile%\\.wslconfig 未將其設為 mirrored,因此其中的 {agent} 指向 Windows({url})而不是 127.0.0.1;magpie 會在該位址為 WSL 監聽,Windows 防火牆放行 WSL 後即可連通。若要使用 127.0.0.1,請在 %UserProfile%\\.wslconfig 的 [wsl2] 下設定 networkingMode=mirrored 並執行 wsl --shutdown,然後重新選擇模型。","magpie restarted the app-server codex sessions share, which none was on, so new codex sessions have this; restart the Codex app, if it is open, to see it there.": "magpie 已重啟 codex 會話共用的 app-server(當時沒有會話連著它),新的 codex 會話已生效;如果 Codex 應用開著,需重啟它才能看到。","magpie's models are in Copilot Chat's model picker in your JetBrains IDE, under magpie, once the IDE restarts. They need Copilot signed in to GitHub on a plan with Bring Your Own Key: Copilot Free, Pro and Pro+ have it, Business and Enterprise when the organisation's policy allows it.": "JetBrains IDE 重啟後,magpie 的模型會出現在 Copilot Chat 模型選擇器的 magpie 分組下。前提是 Copilot 已用支援 Bring Your Own Key 的方案登入 GitHub:Copilot Free、Pro 和 Pro+ 都支援,Business 和 Enterprise 需組織策略允許。","magpie's models are in {agent}'s Chat model picker under magpie, from GitHub Copilot Chat {version}'s OpenAI Compatible provider, which it offers only while it is signed in to GitHub with a personal Copilot plan.": "magpie 的模型在 {agent} Chat 模型選擇器的 magpie 分組下,來自 GitHub Copilot Chat {version} 的 OpenAI Compatible 供應商;只有用個人 Copilot 方案登入 GitHub 時它才提供這個供應商。",@@ -11682,7 +11682,7 @@ const I18N = {"Reasonix Studio 2.x and the native 1.39.x/2.x CLI read global settings at startup. Start a new process to load changes. Project/session models can override Executor and Plan.": "Reasonix Studio 2.x とネイティブの 1.39.x/2.x CLI は起動時にグローバル設定を読み込みます。変更を読み込むには新しいプロセスを起動してください。プロジェクトやセッションのモデルが Executor と Plan を上書きすることがあります。","Snow CLI reads its profile at start-up — restart open snow sessions to use this.": "Snow CLI は起動時にプロファイルを読み込みます。反映するには開いている snow セッションを再起動してください。","WSL {distro} is in {net} networking with localhostForwarding=false in %UserProfile%\\.wslconfig, so 127.0.0.1 there, where its {agent} was pointed, isn't relayed to Windows, where magpie listens. Remove localhostForwarding=false under [wsl2] (it is on by default) and run wsl --shutdown.": "WSL {distro} は {net} ネットワークで、%UserProfile%\\.wslconfig に localhostForwarding=false があるため、{agent} の接続先である 127.0.0.1 は magpie が待ち受ける Windows に中継されません。[wsl2] の localhostForwarding=false を削除し(既定でオン)、wsl --shutdown を実行してください。",- "WSL {distro} is in {net} networking, not mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; that answers only while the gateway listens beyond loopback and Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.": "WSL {distro} は mirrored ではなく {net} ネットワークのため、{agent} の接続先は 127.0.0.1 ではなく Windows({url})にしました。これはゲートウェイがループバック以外でも待ち受け、Windows のファイアウォールが WSL を通す間だけ応答します。127.0.0.1 にするには %UserProfile%\\.wslconfig の [wsl2] に networkingMode=mirrored を設定して wsl --shutdown を実行し、モデルを選び直してください。",+ "WSL {distro} is in {net} networking, not mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; magpie listens there for WSL, and it answers once Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.": "WSL {distro} は mirrored ではなく {net} ネットワークのため、{agent} の接続先は 127.0.0.1 ではなく Windows({url})にしました。magpie はそこで WSL 向けに待ち受けており、Windows のファイアウォールが WSL を通せば応答します。127.0.0.1 にするには %UserProfile%\\.wslconfig の [wsl2] に networkingMode=mirrored を設定して wsl --shutdown を実行し、モデルを選び直してください。","WSL {distro} isn't running: magpie shows what it last saw there, and starts it only to change something.": "WSL {distro} は起動していません。magpie は最後に見た内容を表示し、変更するときだけ起動します。","ZCode reads its providers at start-up — restart ZCode to see magpie's models in its picker.": "ZCode は起動時にプロバイダを読み込みます。モデル選択に magpie のモデルを表示するには ZCode を再起動してください。","AstrBot reads cmd_config.json at start-up and writes it back whole when its WebUI saves settings — restart AstrBot to use this, before saving anything in its WebUI.": "AstrBot は起動時に cmd_config.json を読み込み、WebUI で設定を保存するとファイル全体を書き戻します。これを使うには、WebUI で何かを保存する前に AstrBot を再起動してください。",@@ -11690,7 +11690,7 @@ const I18N = {"dsh reads its config at start-up — restart open dsh sessions to use this.": "dsh は起動時に設定を読み込みます。反映するには開いている dsh セッションを再起動してください。","dsh's web search goes through magpie, which has nothing to search with yet: set up a provider that searches by itself (DeepSeek, Claude, Codex, …) or a search API under Settings › Web search.": "dsh のウェブ検索は magpie を経由しますが、magpie にはまだ検索手段がありません。自前で検索するプロバイダ(DeepSeek、Claude、Codex など)を追加するか、「設定 › ウェブ検索」で検索 API を設定してください。","fx reads its settings at start-up — restart open fx sessions to use this.": "fx は起動時に設定を読み込みます。反映するには開いている fx セッションを再起動してください。",- "magpie couldn't ask WSL {distro} its networking mode (it has no wslinfo) and %UserProfile%\\.wslconfig doesn't set it to mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; that answers only while the gateway listens beyond loopback and Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.": "magpie は WSL {distro} のネットワークモードを取得できず(wslinfo がありません)、%UserProfile%\\.wslconfig でも mirrored に設定されていないため、{agent} の接続先は 127.0.0.1 ではなく Windows({url})にしました。これはゲートウェイがループバック以外でも待ち受け、Windows のファイアウォールが WSL を通す間だけ応答します。127.0.0.1 にするには %UserProfile%\\.wslconfig の [wsl2] に networkingMode=mirrored を設定して wsl --shutdown を実行し、モデルを選び直してください。",+ "magpie couldn't ask WSL {distro} its networking mode (it has no wslinfo) and %UserProfile%\\.wslconfig doesn't set it to mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; magpie listens there for WSL, and it answers once Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.": "magpie は WSL {distro} のネットワークモードを取得できず(wslinfo がありません)、%UserProfile%\\.wslconfig でも mirrored に設定されていないため、{agent} の接続先は 127.0.0.1 ではなく Windows({url})にしました。magpie はそこで WSL 向けに待ち受けており、Windows のファイアウォールが WSL を通せば応答します。127.0.0.1 にするには %UserProfile%\\.wslconfig の [wsl2] に networkingMode=mirrored を設定して wsl --shutdown を実行し、モデルを選び直してください。","magpie restarted the app-server codex sessions share, which none was on, so new codex sessions have this; restart the Codex app, if it is open, to see it there.": "magpie は codex セッションが共有する app-server を再起動しました(接続中のセッションはありませんでした)。新しい codex セッションには反映されています。Codex アプリが開いている場合は、再起動すると反映されます。","magpie's models are in Copilot Chat's model picker in your JetBrains IDE, under magpie, once the IDE restarts. They need Copilot signed in to GitHub on a plan with Bring Your Own Key: Copilot Free, Pro and Pro+ have it, Business and Enterprise when the organisation's policy allows it.": "IDE を再起動すると、JetBrains IDE の Copilot Chat のモデル選択に magpie の下で magpie のモデルが表示されます。Copilot が Bring Your Own Key のあるプランで GitHub にサインインしている必要があります。Copilot Free、Pro、Pro+ にはあり、Business と Enterprise は組織のポリシーが許可している場合です。","magpie's models are in {agent}'s Chat model picker under magpie, from GitHub Copilot Chat {version}'s OpenAI Compatible provider, which it offers only while it is signed in to GitHub with a personal Copilot plan.": "magpie のモデルは {agent} の Chat のモデル選択の magpie の下にあり、GitHub Copilot Chat {version} の OpenAI Compatible プロバイダから来ています。このプロバイダは個人の Copilot プランで GitHub にサインインしている間だけ提供されます。",@@ -15632,7 +15632,7 @@ const I18N = {"Reasonix Studio 2.x and the native 1.39.x/2.x CLI read global settings at startup. Start a new process to load changes. Project/session models can override Executor and Plan.": "Reasonix Studio 2.x und die native 1.39.x/2.x-CLI lesen globale Einstellungen beim Start. Einen neuen Prozess starten, um Änderungen zu laden. Projekt- oder Sitzungsmodelle können Executor und Plan überschreiben.","Snow CLI reads its profile at start-up — restart open snow sessions to use this.": "Snow CLI liest sein Profil beim Start – offene snow-Sitzungen neu starten, damit es gilt.","WSL {distro} is in {net} networking with localhostForwarding=false in %UserProfile%\\.wslconfig, so 127.0.0.1 there, where its {agent} was pointed, isn't relayed to Windows, where magpie listens. Remove localhostForwarding=false under [wsl2] (it is on by default) and run wsl --shutdown.": "WSL {distro} nutzt {net}-Netzwerk mit localhostForwarding=false in %UserProfile%\\.wslconfig, daher wird 127.0.0.1 dort, worauf sein {agent} zeigt, nicht an Windows weitergeleitet, wo magpie lauscht. localhostForwarding=false unter [wsl2] entfernen (standardmäßig an) und wsl --shutdown ausführen.",- "WSL {distro} is in {net} networking, not mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; that answers only while the gateway listens beyond loopback and Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.": "WSL {distro} nutzt {net}-Netzwerk, nicht mirrored, daher zeigt sein {agent} auf Windows ({url}) statt auf 127.0.0.1; das antwortet nur, solange das Gateway über Loopback hinaus lauscht und die Windows-Firewall WSL durchlässt. Für 127.0.0.1 networkingMode=mirrored unter [wsl2] in %UserProfile%\\.wslconfig setzen, wsl --shutdown ausführen und das Modell erneut wählen.",+ "WSL {distro} is in {net} networking, not mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; magpie listens there for WSL, and it answers once Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.": "WSL {distro} nutzt {net}-Netzwerk, nicht mirrored, daher zeigt sein {agent} auf Windows ({url}) statt auf 127.0.0.1; dort lauscht magpie für WSL, und es antwortet, sobald die Windows-Firewall WSL durchlässt. Für 127.0.0.1 networkingMode=mirrored unter [wsl2] in %UserProfile%\\.wslconfig setzen, wsl --shutdown ausführen und das Modell erneut wählen.","WSL {distro} isn't running: magpie shows what it last saw there, and starts it only to change something.": "WSL {distro} läuft nicht: magpie zeigt, was es dort zuletzt gesehen hat, und startet es nur, um etwas zu ändern.","ZCode reads its providers at start-up — restart ZCode to see magpie's models in its picker.": "ZCode liest seine Anbieter beim Start – ZCode neu starten, um magpies Modelle in seiner Auswahl zu sehen.","AstrBot reads cmd_config.json at start-up and writes it back whole when its WebUI saves settings — restart AstrBot to use this, before saving anything in its WebUI.": "AstrBot liest cmd_config.json beim Start und schreibt sie ganz zurück, wenn seine WebUI Einstellungen speichert – AstrBot neu starten, um dies zu nutzen, bevor in seiner WebUI etwas gespeichert wird.",@@ -15640,7 +15640,7 @@ const I18N = {"dsh reads its config at start-up — restart open dsh sessions to use this.": "dsh liest seine Konfiguration beim Start – offene dsh-Sitzungen neu starten, damit es gilt.","dsh's web search goes through magpie, which has nothing to search with yet: set up a provider that searches by itself (DeepSeek, Claude, Codex, …) or a search API under Settings › Web search.": "Die Websuche von dsh läuft über magpie, das noch nichts zum Suchen hat: einen Anbieter einrichten, der selbst sucht (DeepSeek, Claude, Codex, …), oder eine Such-API unter Einstellungen › Websuche.","fx reads its settings at start-up — restart open fx sessions to use this.": "fx liest seine Einstellungen beim Start – offene fx-Sitzungen neu starten, damit es gilt.",- "magpie couldn't ask WSL {distro} its networking mode (it has no wslinfo) and %UserProfile%\\.wslconfig doesn't set it to mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; that answers only while the gateway listens beyond loopback and Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.": "magpie konnte WSL {distro} nicht nach seinem Netzwerkmodus fragen (es hat kein wslinfo), und %UserProfile%\\.wslconfig setzt ihn nicht auf mirrored, daher zeigt sein {agent} auf Windows ({url}) statt auf 127.0.0.1; das antwortet nur, solange das Gateway über Loopback hinaus lauscht und die Windows-Firewall WSL durchlässt. Für 127.0.0.1 networkingMode=mirrored unter [wsl2] in %UserProfile%\\.wslconfig setzen, wsl --shutdown ausführen und das Modell erneut wählen.",+ "magpie couldn't ask WSL {distro} its networking mode (it has no wslinfo) and %UserProfile%\\.wslconfig doesn't set it to mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; magpie listens there for WSL, and it answers once Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.": "magpie konnte WSL {distro} nicht nach seinem Netzwerkmodus fragen (es hat kein wslinfo), und %UserProfile%\\.wslconfig setzt ihn nicht auf mirrored, daher zeigt sein {agent} auf Windows ({url}) statt auf 127.0.0.1; dort lauscht magpie für WSL, und es antwortet, sobald die Windows-Firewall WSL durchlässt. Für 127.0.0.1 networkingMode=mirrored unter [wsl2] in %UserProfile%\\.wslconfig setzen, wsl --shutdown ausführen und das Modell erneut wählen.","magpie restarted the app-server codex sessions share, which none was on, so new codex sessions have this; restart the Codex app, if it is open, to see it there.": "magpie hat den App-Server, den codex-Sitzungen teilen, neu gestartet (keine war verbunden), neue codex-Sitzungen haben es also; die Codex-App, falls offen, neu starten, um es dort zu sehen.","magpie's models are in Copilot Chat's model picker in your JetBrains IDE, under magpie, once the IDE restarts. They need Copilot signed in to GitHub on a plan with Bring Your Own Key: Copilot Free, Pro and Pro+ have it, Business and Enterprise when the organisation's policy allows it.": "Nach einem Neustart der IDE stehen magpies Modelle in der Modellauswahl von Copilot Chat in Ihrer JetBrains-IDE unter magpie. Dafür muss Copilot bei GitHub mit einem Plan mit Bring Your Own Key angemeldet sein: Copilot Free, Pro und Pro+ haben es, Business und Enterprise, wenn die Richtlinie der Organisation es erlaubt.","magpie's models are in {agent}'s Chat model picker under magpie, from GitHub Copilot Chat {version}'s OpenAI Compatible provider, which it offers only while it is signed in to GitHub with a personal Copilot plan.": "magpies Modelle stehen in der Chat-Modellauswahl von {agent} unter magpie, über den OpenAI-Compatible-Anbieter von GitHub Copilot Chat {version}, den es nur anbietet, solange es mit einem persönlichen Copilot-Plan bei GitHub angemeldet ist.",@@ -15867,7 +15867,7 @@ const NOTICES = ["Restart Zed if it still asks for an API key: magpie has configured its gateway credential in the system credential store.","Snow CLI reads its profile at start-up — restart open snow sessions to use this.","WSL {distro} is in {net} networking with localhostForwarding=false in %UserProfile%\\.wslconfig, so 127.0.0.1 there, where its {agent} was pointed, isn't relayed to Windows, where magpie listens. Remove localhostForwarding=false under [wsl2] (it is on by default) and run wsl --shutdown.",- "WSL {distro} is in {net} networking, not mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; that answers only while the gateway listens beyond loopback and Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.",+ "WSL {distro} is in {net} networking, not mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; magpie listens there for WSL, and it answers once Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.","WSL {distro} isn't running: magpie shows what it last saw there, and starts it only to change something.","ZCode reads its providers at start-up — restart ZCode to see magpie's models in its picker.","agy takes magpie's gateway and model only from how it is started — start it with {command}",@@ -15876,7 +15876,7 @@ const NOTICES = ["dsh reads its config at start-up — restart open dsh sessions to use this.","dsh's web search goes through magpie, which has nothing to search with yet: set up a provider that searches by itself (DeepSeek, Claude, Codex, …) or a search API under Settings › Web search.","fx reads its settings at start-up — restart open fx sessions to use this.",- "magpie couldn't ask WSL {distro} its networking mode (it has no wslinfo) and %UserProfile%\\.wslconfig doesn't set it to mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; that answers only while the gateway listens beyond loopback and Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.",+ "magpie couldn't ask WSL {distro} its networking mode (it has no wslinfo) and %UserProfile%\\.wslconfig doesn't set it to mirrored, so its {agent} was pointed at Windows ({url}) rather than 127.0.0.1; magpie listens there for WSL, and it answers once Windows' firewall lets WSL in. For 127.0.0.1, set networkingMode=mirrored under [wsl2] in %UserProfile%\\.wslconfig and run wsl --shutdown, then pick the model again.","magpie restarted the app-server codex sessions share, which none was on, so new codex sessions have this; restart the Codex app, if it is open, to see it there.","magpie's models are in Copilot Chat's model picker in your JetBrains IDE, under magpie, once the IDE restarts. They need Copilot signed in to GitHub on a plan with Bring Your Own Key: Copilot Free, Pro and Pro+ have it, Business and Enterprise when the organisation's policy allows it.","magpie's models are in {agent}'s Chat model picker under magpie, from GitHub Copilot Chat {version}'s OpenAI Compatible provider, which it offers only while it is signed in to GitHub with a personal Copilot plan.",