antigravity: each model's window reaches the app through its catalog; the notice names what a gateway turns off (YujunT46308)
YujunT46308 on X: wired through magpie, Antigravity 2.29.0 showed a
200K window for every model, and after a restart it lost /boost,
/teamwork, /plugin and /generative_ui.
The window. The app's backend (Resources/bin/language_server) resolves
models from models.list, then models.listSource (a remote catalog,
fetched with the gateway key), then <url>/v1/models, then its built-in
catalog. From /v1/models it reads the id alone; a model its catalog
doesn't know gets its family's defaults, maxTokens 200000. No field of
the OpenAI list (context_window, context_length, max_input_tokens) is
read. magpie now points models.listSource at
<gateway>/v1/models?format=antigravity, which answers {"list": [...]}
in the app's own fields (modelId, displayName, maxTokens,
maxOutputTokens, supportsImages, supportsThinking) for the models the
key may use. A field magpie doesn't know is left out. The user's own
listSource is stashed with their gateway and put back; Sync adds the
catalog to a file wired before, at the gateway's current address.
The picker now shows magpie's names, so NoNames is off for it.
The Google features. Not fixable on this route: on a gateway the app
uses no Google sign-in and its backend calls neither cloud_code_endpoint
nor api_server_url (headless run below), and Google's docs say a gateway
and a Google Account can't be used at once. The experiments and
commands Google's servers turn on for a signed-in account are off while
it is on magpie. No key in settings.json keeps both. The notice shown on
connecting (GUI toast, CLI) now names what is lost and that turning it
off gives it back, in en, zh, zh-TW, ja, de.
Run (mote, at this head unless said):
- go test -tags nogui ./internal/agent ./internal/gateway -run Antigravity:
ok. Broken by hand: the listSource writes taken out ->
TestAntigravityGateway, TestAntigravityCatalogSource,
TestAntigravitySyncAddsCatalog red; the ?format branch taken out ->
TestAntigravityCatalog red.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./..., go build, GOOS=linux go build -tags nogui,
GOOS=windows go build: ok.
- GUI (Chromium and WebKit): i18n-keys, i18n-en-no-cjk,
agent-notice-lang, about-notices, gui-de, gui-ja, gui-zh-tw,
name-suffix-no-names at the pre-rebase tree (only i18n.js differs in
the GUI): all pass except i18n-keys "a plugin's words are its own",
red the same on origin/main 18a9a2d88 (#5332, #5426, #5482).
- Real: the real Antigravity 2.29.0 language_server, headless, in a
sandbox HOME, against magpie built from this tree (sandbox HOME, port
3600) with a fake OpenAI vendor whose model has a 1048576 window.
`magpie antigravity magpie/up/big-ctx` wrote listSource; the backend
logged "Resolving models from Tier 2 (Remote catalog listSource)",
GetAvailableModels gave maxTokens 1048576, maxOutputTokens 65536 and
the label "big-ctx · up". A streamed chat with the app's key and UA
went through magpie. Turning it off left the file as it was ({}).
- Full go test -tags nogui -timeout 45m ./...: queued behind mote's
suite lock at push time; its result is recorded after the push.
Not tried: the Antigravity GUI app itself (only its backend, headless),
and a chat sent from the app's own composer.
This commit is contained in:
@@ -32,7 +32,7 @@ something else shows up as drift.
|
||||
| WSL folders that are links | Through `\\wsl.localhost` Windows can't follow a link the distro has: with `~/.codex` a link to `/mnt/c/Users/<user>/.codex`, a mkdir of it says it exists and nothing below it can be made, written, read or listed (#4502, linusxiong). The probe asks `readlink -f` there where each agent folder, its `skills` and the folders beside them lead (`wslLinkPaths`, `distro.Links`; a `$HOME` that is itself through a link is left as it was) and which drive each Windows mount is (`distro.Drives`). `distro.open` opens a path at or below a link where it leads: on a Windows drive the drive's own path (`C:\Users\<user>\.codex`), elsewhere in the distro through its root again; `native` spells such a path back through the link for the agent. A link `readlink -f` couldn't resolve is never guessed at: its agent is unreached (`Agent.Unreached`), says why in its notice and refuses each change and sync. Every writer goes through it: the agents' own files (`place.join`, `place.open`), the library's targets (`wslOpen`, a `wsl` problem per agent), RTK (`rtkAt`, `agent.WSLOpen`), the Sessions page's reads (`sessions.WSLHome.Open`) and the Copilot CLI's sign-in (`provider.CopilotWSLDirs`). Links deeper than the probed paths aren't resolved (`TestWSLOpenThroughLinks`, `TestWSLAgentFolderIsALink`, `TestWSLAgentFolderLinkUnresolved`, `TestWSLProbeLinks`, `TestWSLFolderIsALinkToC`, `TestRTKWSLFolderIsALink`). | [`wsl.go`](../../internal/agent/wsl.go), [`targets.go`](../../internal/library/targets.go), [`rtk_wsl.go`](../../internal/library/rtk_wsl.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`. Where Codex compacts, and Claude Code wherever magpie's own window is what it runs at, is one value with Long conversations in the agents' settings sheet (`settings.CompactAt`/`FullContext`, source `long`; 7eleven on Discord): the card reads it, Use sets it through `provider.SetCompactAt`, and Sync writes it into each agent's config as it does for the sheet; the note says it is Long conversations, shared by Codex and Claude Code (`compact-one-value.test.cjs`). 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 tokens against the setting now (fewer or more, the setting itself marked "Your setting now", hayden4608 on Discord), "Fewest tokens" beside the leanest, 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. One whose agent keeps the model a new session starts on in a file apart from its provider list says so with `startup` (`config`, `format`, `model`, and `keys` written beside the model as they are) and has no `model`: PiG keeps its providers in `models.json` and `defaultProvider`/`defaultModel` in `settings.json` (str_ on Discord: its row only listed models, where Pi's picks the one it starts on). Its field is `model` again; picking one of magpie's writes `connect`'s keys into `config` and the model and `startup.keys` into `startup.config`, each file stashed under its own `plugin:<id>:<path>` (the startup one marked by its first string key, so a model picked in the agent among magpie's, with `defaultProvider` still `magpie`, reads as magpie's). A model of the agent's own picked in it while `connect`'s keys are still in `config` is `Beside`: connected, not drift, and Disconnect leaves that pick and takes the rest out. A magpie without `startup` reads the same module as connect only (`TestPluggedStartupModel`, `TestPluggedStartupOwnPickKept`, `TestPluggedStartupRestoreGone`). `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`; a routing group's, `provider.GroupEndpoints`, the APIs every member relays as it is; 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. Antigravity CLI (agy) also gets a function `agy` in each shell's profile while it is on one of magpie's models, so typing `agy` in a new terminal starts it on magpie (bestony on Discord). The function runs `magpie agy run`, which starts the agy on PATH with `GEMINI_API_KEY`, `GOOGLE_GEMINI_BASE_URL` and `--model` (no `--model` when the user gives one) while settings.json's model is still magpie's, and unchanged otherwise. PowerShell's asks `magpie agy env` for them, since the Windows app is a GUI program PowerShell doesn't wait for. `Typed` says the function is there; the row then says plain `agy` works in a new terminal, and the `Launch` command is for a terminal open before. agy has no settings-only route: 1.4.7 refuses to start without `GEMINI_API_KEY` in the environment even with a key on the custom model. 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 (`pickedEfforts`, #1003). Antigravity's app has the same field while it is on magpie: its picker lists the gateway's models by id with no level of its own, so one of Antigravity's families of levels went at its default (MDX-Tom, #4838). | [`cursorlocal.go`](../../internal/agent/cursorlocal.go) |
|
||||
| Environment-only agents | Agents that read the gateway only from the environment get a `Launch` command. Antigravity CLI (agy) also gets a function `agy` in each shell's profile while it is on one of magpie's models, so typing `agy` in a new terminal starts it on magpie (bestony on Discord). The function runs `magpie agy run`, which starts the agy on PATH with `GEMINI_API_KEY`, `GOOGLE_GEMINI_BASE_URL` and `--model` (no `--model` when the user gives one) while settings.json's model is still magpie's, and unchanged otherwise. PowerShell's asks `magpie agy env` for them, since the Windows app is a GUI program PowerShell doesn't wait for. `Typed` says the function is there; the row then says plain `agy` works in a new terminal, and the `Launch` command is for a terminal open before. agy has no settings-only route: 1.4.7 refuses to start without `GEMINI_API_KEY` in the environment even with a key on the custom model. 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 (`pickedEfforts`, #1003). Antigravity's app has the same field while it is on magpie: its picker lists the gateway's models with no level of its own, so one of Antigravity's families of levels went at its default (MDX-Tom, #4838). | [`cursorlocal.go`](../../internal/agent/cursorlocal.go) |
|
||||
| Claude Science | Its daemon (`claude-science`) reads the API's address only from its environment's `ANTHROPIC_BASE_URL` and has no setting for it. Connect restarts the daemon with that variable set to the gateway (`scienceOn`: `stop`, then `serve --detached --no-browser` on the port `status` said it was on) and notes the daemon in `claude-science.json` (url, pid, port); Disconnect restarts it without the variable, one in magpie's own environment taken out too. No variable is set for the user and no file of the app's is written. Setting it again while magpie's daemon runs on this gateway does nothing (`Pick` sets the field after `connect`). `KeepClaudeScience` starts it again on the gateway, on its port, when it isn't running (a restart of the computer), each minute while magpie serves; it never stops one running. `Check` reads the daemon's `operon.lock`, not `status` (seconds for a 130 MB Bun program), and calls a daemon with another pid drift: the app's window, opened while none ran, starts its own without the variable. It is found in the Mac app's bundle (`Claude Science.app/Contents/Resources/bin`), `%LOCALAPPDATA%\Programs\ClaudeScience` on Windows, `~/.local/bin`, else on PATH. The app still needs its own Claude sign-in; the gateway never passes it on (see gateway-routing). | [`claudescience.go`](../../internal/agent/claudescience.go), [`science.go`](../../internal/gateway/science.go) |
|
||||
| Claude Code beside its own account | `claude-magpie` (baranwang on X) starts Claude Code through magpie while a plain `claude` stays on the user's own account, nothing switched back and forth. `magpie claude run [args…]` writes `<config>/claude-launch/settings.json` as `claude#launch`, an agent `claudeIn` makes at that folder (`place.dir`) and lists nowhere, so the Agents page, Check and Notice see only the user's settings.json: connected the first time as Connect would (`ConnectHow`), set again when the gateway's address or key moved (`claudeLaunchStale`, the LAN key included), synced after that, with `ANTHROPIC_API_KEY` and the cloud switches (`agentenv.ClaudeProviders`) blanked. It then runs `claude --settings <file> args…` as a child (not exec, so it can tidy after): Claude Code puts a --settings file's env and model over the user's settings.json, a claude.ai sign-in and the shell (tried on 2.1.318). `/model` saves to the user's settings.json, never the --settings file, so `ClaudeLaunchAfter` moves a magpie model picked there into the launch file and gives the user's file its model back while magpie isn't wired into it; it also undoes Claude Code's own one-time `opus` → `opus[1m]` rewrite (`migration_opus_to_opus1m`), which the launch file's 1M opus tier sets off. A Claude alias picked (`sonnet`) stays. On Unix a stopped child stops magpie too (^Z, fg), and its exit code is magpie's; on Windows magpie ignores Ctrl+C while claude runs. The command `claude-magpie` is a launcher beside the `magpie` command (`update.Launchers`): a `#!/bin/sh` `exec` of `Program()`, or on Windows a `.cmd` running `"%~dp0magpie"`. `AddCLI` writes it, and `magpie claude launcher add` puts it there for a command added before; a file by that name without `written by magpie` is never written over. StandIn falls back to the launch file's tiers. | [`claude_launch.go`](../../internal/agent/claude_launch.go), [`claude_launch_cli.go`](../../internal/cli/claude_launch_cli.go), [`claude_run_unix.go`](../../internal/cli/claude_run_unix.go), [`launcher.go`](../../internal/update/launcher.go) |
|
||||
|
||||
@@ -93,7 +93,7 @@ something else shows up as drift.
|
||||
- Kiro Crew (AWS's persistent agent: KiroCrew.app, the `kirocrew` CLI, its Gateway on :5476) has no model setting of its own: it runs every session on a harness over ACP, chosen by `agent.acp_backend` in `$KIROCREW_HOME/config.json` (default `~/.kiro/crew`; `""` is kiro-cli), and dispatched members by `agent.member_acp_backend` (`kirocrew` in [`kirocrew.go`](../../internal/agent/kirocrew.go); github.com/kirodotdev/KiroCrew v0.9.0, `src/kiro_crew/` `config/paths.py`, `config/loader.py`, `config/sections.py`, `agent_sdk/backends.py`). Connecting it sets both to an agent already connected to magpie (Codex, Claude Code, OpenCode, Pi or Goose; Pi can't take dispatch, so only the first key for it), preferring the one whose ACP adapter is installed (codex-acp, claude-agent-acp, pi-acp; looked for, never installed, and named in the notice when missing). When `agent.acp_backend` already names one of those five and that agent is installed but not connected, connecting Kiro Crew connects that agent too, in the same action, and runs Crew on it (wuping9525 on Windows: Crew on Claude Code, Claude Code not connected); the stash's `kirocrew.joined` records it, and Kiro Crew's Disconnect disconnects it again, unless the user disconnected it themselves since (`kiroCrewUserLeft` in `Agent.Disconnect`), and a disconnect the user had made before stays theirs. Otherwise, with none connected it refuses and says which to connect. On Windows the app is found by `~\.kirocrew-app\.venv\Scripts\kirocrew.exe` and an adapter also by npm's `.cmd`/`.exe` shim names. `config.local.json` is merged over `config.json` and wins, so a harness set there is the user's: magpie neither writes nor reads past it, and the row says so. The previous values are stashed and put back on Disconnect, only while each key still holds what magpie wrote; a file magpie made is removed when it is left empty. The row reads as connected only while the harness it names is still wired to magpie. Open sessions keep their harness; new ones take it.
|
||||
- OpenPencil (ZSeven-W/openpencil, the `openpencil-desktop` app) keeps the builtin agents its chat runs on in `settings.json` in Rust's `dirs::config_dir()` joined with `openpencil`: `~/Library/Application Support/openpencil` on a Mac, `$XDG_CONFIG_HOME` or `~/.config` on Linux, `%APPDATA%` on Windows (`openPencil` in [`openpencil.go`](../../internal/agent/openpencil.go); its `settings_io.rs` and `settings_payload.rs`). magpie adds one entry to `builtin_agents`, `id: magpie`, `kind: openai-compat` at the gateway's `/v1` with a key naming OpenPencil (its User-Agent isn't known), `preset: custom`, the picked models as OpenPencil writes a list: the first as `model`, `models` only for two or more, at most 64 (v0.8.4 reads `model` alone). The user's other entries and settings stay, and so do the `display_name` and `enabled` they give magpie's entry; a sync with nothing to change doesn't write. OpenPencil needs `"version": 1` (a file without it is set aside as corrupt and saving stops), so magpie writes it in a file it makes and leaves a file with any other version, or none, alone. Disconnect takes the entry out, and the file when only the version and an empty list are left. OpenPencil reads the file once at start and writes it back whole when it quits, so a change is refused while `openpencil-desktop` runs (Windows can't be asked, so the notice says to quit it first). The model is picked in OpenPencil's chat, so the field is whether magpie is in its picker (`ListsModels`). Detected by its settings folder, `~/.openpencil` (its CLI's), `OpenPencil.app` (`com.zseven-w.openpencil`), or `%ProgramFiles%\OpenPencil`. open-pencil/open-pencil, the other app of the name, keeps its providers in its webview's localStorage, so it is not a row: it reaches magpie through Pi or an ACP agent magpie wires.
|
||||
- OpenBot (nightly-labs/openbot, openbot.run; jiezhengj on Discord) keeps the OpenAI-compatible endpoints its model picker lists in `openbot-custom-providers-v1.json` in Electron's userData folder, app data joined with `OpenBot`: `~/Library/Application Support/OpenBot` on a Mac, `%APPDATA%\OpenBot` on Windows, `$XDG_CONFIG_HOME/OpenBot` or `~/.config/OpenBot` on Linux (`openBot` in [`openbot.go`](../../internal/agent/openbot.go); its `custom-provider-store.ts` and `opencode-config.ts`, v0.58.0). magpie adds one entry to `providers`, `id: magpie` at the gateway's `/v1` with `secret: null`: an entry's key and headers are one safeStorage ciphertext (the Keychain, DPAPI) that magpie doesn't open, so OpenBot hands the entry to OpenCode keyless, the gateway takes it as a request from this computer, and it counts as OpenCode's. OpenBot's list decoders fail closed (one entry or model it wouldn't take empties the list), so the models are the picked ones whose `magpie/<id>` OpenBot accepts (ASCII letters, digits and `._:/[],=-`, at most 160), at most 64, with a context window only inside 1,024 to 100,000,000. The user's other entries stay, and so do the `name`, `harness` and `secret` they give magpie's entry; a sync with nothing to change doesn't write. A file whose `version` isn't the number 1, or whose `providers` isn't a list, is one OpenBot itself refuses, so magpie leaves it alone. Disconnect takes the entry out, and the file when only the version and an empty list are left. OpenBot reads the file once at start and writes it whole only when an endpoint is saved, edited or removed there, so the notice (while it runs) says to restart it before doing that. The model is picked in OpenBot's picker (`ListsModels`). Detected by its userData folder, `OpenBot.app` (`app.openbot.desktop`), or `OpenBot.exe` under `%LOCALAPPDATA%\Programs` or `%ProgramFiles%`. Its MCP servers live in its SQLite database, which magpie doesn't write: magpie's `/mcp/magpie/…` servers are added there by hand as HTTP servers.
|
||||
- Antigravity, Google's desktop app (not Antigravity IDE, `com.google.antigravity-ide`), takes a gateway from `~/.antigravity/settings.json` from 2.15 on: Google's Antigravity Enterprise Gateway (docs.cloud.google.com/gemini/enterprise/docs/ai-developer-tools/connect-enterprise-gateway; `antigravity` in [`antigravity.go`](../../internal/agent/antigravity.go), ryougi_hachi on X). magpie writes `gateway` as `{enabled: true, url: <gateway>, apiKey: <key naming Antigravity>, wireProtocol: openai}` and the model it starts on as `models.defaultModelId`, and takes out `models.list`, which would narrow the picker to the user's own. On the openai protocol the app's backend (2.28.2) asks `<url>/v1/models` for its picker, labelled by id (`NoNames`, `ListsModels`), and streams `<url>/v1/chat/completions` with the key as a bearer token and a User-Agent of `antigravity/hub/<version>`. The user's gateway, default model and list are stashed and put back on disconnect, or when a model of their own is picked; `caCertPath` and the rest of the file are never touched, and a `Sync` keeps what the user added to magpie's block (`customHeaders`). On a gateway the app uses no Google sign-in. An organisation's `admin_settings.json` and the `AGY_LLM_GATEWAY_*` variables win over the file, so `Check` says when either sets a gateway. agy reads the same file below its own settings: an agy connected on its own row keeps its route, one that isn't follows the app's gateway, as the notice says. `~/.antigravity` is Antigravity IDE's and agy's too, so the app is found by its bundle at 2.15 or later (`desktopApps`) or `~/.gemini/antigravity/agyhub_summaries_proto.pb`, which only its backend writes. The app reads the file at start, so the notice asks for a restart. The Antigravity accounts magpie signs in (provider `antigravity`) are a separate thing: those send magpie's requests to Google.
|
||||
- Antigravity, Google's desktop app (not Antigravity IDE, `com.google.antigravity-ide`), takes a gateway from `~/.antigravity/settings.json` from 2.15 on: Google's Antigravity Enterprise Gateway (docs.cloud.google.com/gemini/enterprise/docs/ai-developer-tools/connect-enterprise-gateway; `antigravity` in [`antigravity.go`](../../internal/agent/antigravity.go), ryougi_hachi on X). magpie writes `gateway` as `{enabled: true, url: <gateway>, apiKey: <key naming Antigravity>, wireProtocol: openai}` and the model it starts on as `models.defaultModelId`, and takes out `models.list`, which would narrow the picker to the user's own. It also points `models.listSource`, the app's remote model catalog, at `<gateway>/v1/models?format=antigravity` (`gateway.antigravityModels`): `{"list": [{modelId, displayName, maxTokens, maxOutputTokens, supportsImages, supportsThinking}]}`, the models the key may use. The backend (2.29.0) resolves models from `models.list`, then `listSource` (fetched with the gateway key), then `<url>/v1/models`, then its built-in catalog. From `/v1/models` it reads the id alone, and a model its catalog doesn't know gets its family's defaults, a 200K window whatever the model's, so every magpie model had 200K (YujunT46308 on X); `context_window`, `context_length` and `max_input_tokens` there are not read. A bare array or `{"list": …}` is read; `{"models": …}` is not. A field magpie doesn't know is left out and the app's default stands. The picker shows `displayName`, so the names follow magpie's (`ListsModels`, not `NoNames`). `Sync` adds `listSource` to a file wired before, at the gateway's current address, stashing one of the user's. On the openai protocol the backend streams `<url>/v1/chat/completions` with the key as a bearer token and a User-Agent of `antigravity/hub/<version>`. The user's gateway, default model, list and `listSource` are stashed and put back on disconnect, or when a model of their own is picked; `caCertPath` and the rest of the file are never touched, and a `Sync` keeps what the user added to magpie's block (`customHeaders`). On a gateway the app uses no Google sign-in, and its backend asks Google for nothing (no `cloud_code_endpoint` or `api_server_url` call in a headless run): Google's docs say a gateway and a Google Account can't be used at once. What Google's servers turn on for a signed-in account, its experiments and the commands behind them (`/boost`, `/teamwork`, `/plugin`, `/generative_ui`, YujunT46308), is off while it is on magpie. No key in the file keeps both (`proxy` only routes the app's own HTTP), so the notice shown on connecting names what is lost and that turning it off gives it back. An organisation's `admin_settings.json` and the `AGY_LLM_GATEWAY_*` variables win over the file, so `Check` says when either sets a gateway. agy reads the same file below its own settings: an agy connected on its own row keeps its route, one that isn't follows the app's gateway, as the notice says. `~/.antigravity` is Antigravity IDE's and agy's too, so the app is found by its bundle at 2.15 or later (`desktopApps`) or `~/.gemini/antigravity/agyhub_summaries_proto.pb`, which only its backend writes. The app reads the file at start, so the notice asks for a restart. The Antigravity accounts magpie signs in (provider `antigravity`) are a separate thing: those send magpie's requests to Google.
|
||||
- NewMax (newmax.cc, an Electron app on the Claude Agent SDK) keeps its settings as JSON in the row `app` of the `settings` table of `newmax.db`, a SQLite database in WAL mode in `$NEWMAX_USER_DATA_DIR`, else `~/.newmax` on every system (`newMax` in [`newmax.go`](../../internal/agent/newmax.go); its main bundle's `configureAppDataPaths`, `loadPersistedAppSettings` and the renderer's `mergeProviders`, v1.1.22). magpie adds one entry to `providers` in the shape NewMax's own import writes, `id: magpie-gateway` (its own preset is `magpie`, its import's ids hold `%3A`), `apiFormat: anthropic` at the gateway's root (NewMax appends `/v1/messages`) with `ANTHROPIC_AUTH_TOKEN` and a key naming NewMax, at most 20 models (`MAX_MODELS`) as `models` and `enabledModels` with their context windows, and its id at the end of `providerOrder`. The row is edited in place in one immediate transaction, so every other byte stays; the user's `name` and `enabled` for magpie's entry and the fields NewMax adds to it stay through a sync, and a sync with nothing to change doesn't write. A row that isn't a JSON object, or whose `providers` or `providerOrder` isn't a list, is left alone. With no row (NewMax at its defaults), magpie writes one with its entry alone, as NewMax lays its defaults and presets under the row; with no database yet, it asks to open NewMax once. Disconnect takes the entry and the id out, sets a pick of it back to `default`, and takes the row out when only what magpie made is left. NewMax holds its settings in memory and writes the whole row back whenever one changes, so a change is refused while `NewMax` (`newmax` on Linux) runs (Windows can't be asked, so the notice says to quit it first). The model is picked in NewMax's model picker, so the field is whether magpie is in it (`ListsModels`). Detected by its data folder or `NewMax.app` (`cc.newmax.desktop`).
|
||||
- LiveAgent (Stack-Cairn/LiveAgent v2, a Tauri app) runs its models through K-brain, a Go backend it starts with its data folder, which keeps every provider in `config.json` there: `$LIVEAGENT_HOME`, else `$K_BRAIN_HOME`, else the folder `~/.liveagent/data-dir.json` points to (`{"path": …}`, set when the user moves LiveAgent's data), else `~/.liveagent` on every system (`liveAgent` in [`liveagent.go`](../../internal/agent/liveagent.go); LiveAgent's `data_home.rs` and `kbrain_backend.rs`, K-brain v0.107.12's `internal/config`). The file is JSONC in Pi's provider shape, decoded with unknown fields refused, so magpie writes only K-brain's fields. K-brain asks all of a provider's models on its one API, so magpie writes up to three providers and puts each model on the one of the API it is served on natively (`catalog.Model.APIs`, as dsh's routes): `providers.magpie-responses` for Responses and `providers.magpie` for every other OpenAI-side model (Chat Completions), each `type: codex` with `api` and `requestFormat` as LiveAgent's own settings write an OpenAI-compatible provider, `baseUrl` the gateway's `/v1` (K-brain appends only `/chat/completions` or `/responses`); `providers.magpie-anthropic` for Messages, `type: claude_code` and `api: anthropic-messages`, `baseUrl` the gateway's root (K-brain appends `/v1` and posts to `/messages` with `X-Api-Key`). LiveAgent's settings lock an Anthropic provider's API and let the user switch an OpenAI one between Chat Completions and Responses; a sync keeps the format they picked (Discord, xiaoxiaofei). A provider left with no model is taken out. Each has a key naming LiveAgent, `activeModels: null` (every model on), magpie's order as `modelOrder`, and `models` sorted by id as K-brain writes them, with each one's display name, context window, output limit and `input: [text, image]` when it takes images. Comments and every other key stay. Through a sync the user's name for each entry, the models they turned off (`activeModels`), their order and the fields K-brain adds (its `metadata`) stay; a model that moves to another of magpie's providers (a `config.json` from before, with every model on one Anthropic `magpie`) brings its name and off with it, and a pick of it follows; a model new to magpie's list is on and goes last, and a sync with nothing to change doesn't write. A default (or compact) model still K-brain's own, `model1` of its endpoint-less `demo` provider, becomes magpie's first; one the user picked stays. A file K-brain wouldn't read as providers (not an object, `providers` not an object, a top-level `models`, one provider written bare) is left alone. Disconnect takes magpie's entries out and a pick of them back to K-brain's default; a file left with no provider gets K-brain's `demo` back, since K-brain takes one with none as written over and restores `config.json.bak`, which can still hold magpie's; a file with nothing but what magpie made goes. LiveAgent's backend makes the file as `{}` when there is none (so a disconnect that takes the file away is undone the next start, harmlessly), reads it when it starts and writes it whole whenever a setting changes, so a change is refused while `liveagent` or `k-brain` runs (Windows can't be asked, so the notice says to quit it first). A model id another provider of the user's lists too has its metadata shared by K-brain, so a sync may write that model's limits back each time. The model is picked in LiveAgent's model picker, so the field is whether magpie is in it (`ListsModels`). Detected by its data folder, `LiveAgent.app` (`com.xiaofei.liveagent`) or its Windows install. Its logo is the app's own 64px icon (`src-tauri/icons/64x64.png`, MIT) in an SVG.
|
||||
- DevEco Code (Huawei's OpenCode fork, #1885) is wired as OpenCode is (`deveco` in [`agents.go`](../../internal/agent/agents.go)): magpie's provider goes into the first of `deveco.jsonc`, `deveco.json` and `config.json` in `~/.config/deveco` (the one DevEco merges last, so the one that wins), or in `$DEVECO_CONFIG_DIR` when that is absolute, read after them. 0.2.3 sends `deveco/0.2.3 ai-sdk/…` to a provider of its config, but much of the OpenCode code it keeps still sends OpenCode's own User-Agent (`opencode/<version>`), so its provider's key is `magpie-deveco` (`openCodeKeyAt`), not the plain `magpie` OpenCode and MiMo Code send, and Check asks for that key. Its npm package has no Linux binary, so no install command is offered there (`cliSpec.only`).
|
||||
@@ -206,6 +206,7 @@ go test -tags nogui ./internal/agent -run '^TestKiroCrew'
|
||||
go test -tags nogui ./internal/agent -run '^TestOpenPencil'
|
||||
go test -tags nogui ./internal/agent -run '^TestOpenBot'
|
||||
go test -tags nogui ./internal/agent -run '^TestAntigravity'
|
||||
go test -tags nogui ./internal/gateway -run '^TestAntigravityCatalog'
|
||||
go test -tags nogui ./internal/agent -run '^TestNewMax'
|
||||
go test -tags nogui ./internal/agent -run '^TestLiveAgent'
|
||||
go test -tags nogui ./internal/agent -run '^TestGrokApp'
|
||||
|
||||
@@ -15,9 +15,20 @@ package agent
|
||||
// User-Agent of antigravity/hub/<version> (auth_method=gateway). magpie's
|
||||
// gateway answers both, so what magpie writes is that block at its own
|
||||
// address, with a key that names the app, and the model the app starts on.
|
||||
// The user's own gateway, default model and model list are stashed and put
|
||||
// back when magpie steps out. On a gateway the app asks for no Google
|
||||
// sign-in and uses none: Google's docs say the two can't be used at once.
|
||||
// That list's models are read by id alone, so the app (2.29.0) gives each
|
||||
// one its built-in catalog doesn't know a window of 200K tokens, whatever
|
||||
// the model's (YujunT46308 on X). Its models.listSource, a catalog it asks
|
||||
// ahead of the list, with the gateway's key, takes one per model
|
||||
// (maxTokens), so magpie points it at the gateway's
|
||||
// /v1/models?format=antigravity. The user's own gateway, default model,
|
||||
// model list and catalog are stashed and put back when magpie steps out.
|
||||
//
|
||||
// On a gateway the app asks for no Google sign-in and uses none (Google's
|
||||
// docs: the two can't be used at once), and its backend asks Google for
|
||||
// nothing, so what Google's servers turn on for a signed-in account, its
|
||||
// experiments and the commands behind them (/boost, /teamwork, /plugin,
|
||||
// /generative_ui: YujunT46308), is off while it's on magpie. Nothing in
|
||||
// the file keeps both; noticeAntigravity says so where it is connected.
|
||||
//
|
||||
// The same file is read by agy (Antigravity's CLI) too, below its own
|
||||
// ~/.gemini/antigravity-cli/settings.json: an agy connected on its own row
|
||||
@@ -39,10 +50,17 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
antigravityModel = "models.defaultModelId"
|
||||
antigravityList = "models.list"
|
||||
antigravityModel = "models.defaultModelId"
|
||||
antigravityList = "models.list"
|
||||
antigravitySource = "models.listSource"
|
||||
)
|
||||
|
||||
// antigravityCatalog is the catalog Antigravity's app is pointed at: the
|
||||
// gateway's models, each with its window (gateway.antigravityModels).
|
||||
func antigravityCatalog() string {
|
||||
return gateway.URL() + "/v1/models?format=" + gateway.AntigravityFormat
|
||||
}
|
||||
|
||||
// antigravityAdmin is where an organisation's admin_settings.json is kept
|
||||
// on this system (Google's docs), whose gateway outranks the user's; under
|
||||
// a test's home in a test binary (proc.SystemDirs).
|
||||
@@ -69,6 +87,7 @@ func antigravity(home string) *Agent {
|
||||
path := filepath.Join(dir, "settings.json")
|
||||
model := jsonGet(path, antigravityModel)
|
||||
stashGateway, stashModel, stashList := "antigravity:"+path+":gateway", "antigravity:"+path+":defaultModelId", "antigravity:"+path+":list"
|
||||
stashSource := "antigravity:" + path + ":listSource"
|
||||
// wired: the file's gateway is on and carries a key magpie gave it
|
||||
wired := func() bool {
|
||||
on, _ := edit.GetJSON(path, "gateway.enabled")
|
||||
@@ -78,6 +97,15 @@ func antigravity(home string) *Agent {
|
||||
gatewayBlock := func() map[string]any {
|
||||
return map[string]any{"enabled": true, "url": gateway.URL(), "apiKey": agentKey("antigravity"), "wireProtocol": "openai"}
|
||||
}
|
||||
// keepSource stashes a catalog of the user's that a file wired before
|
||||
// magpie wrote one holds, to come back with their gateway
|
||||
keepSource := func() {
|
||||
v, _ := edit.GetJSON(path, antigravitySource)
|
||||
if v != "" && !strings.Contains(v, "format="+gateway.AntigravityFormat) && unstashPeek(stashSource) == "" {
|
||||
raw, _ := edit.GetJSONRaw(path, antigravitySource)
|
||||
stash(map[string]string{stashSource: raw})
|
||||
}
|
||||
}
|
||||
// putRaw writes back what was stashed as it was, or takes key out
|
||||
putRaw := func(key, raw string) error {
|
||||
if raw == "" {
|
||||
@@ -99,9 +127,9 @@ func antigravity(home string) *Agent {
|
||||
}
|
||||
return isFile(filepath.Join(home, ".gemini", "antigravity", "agyhub_summaries_proto.pb"))
|
||||
},
|
||||
// its picker lists the gateway's /v1/models as asked with its key,
|
||||
// by id
|
||||
ListsModels: true, NoNames: true,
|
||||
// its picker lists the gateway's models as asked with its key, by
|
||||
// the names its catalog gives them (antigravityCatalog)
|
||||
ListsModels: true,
|
||||
Notice: func() string {
|
||||
if wired() {
|
||||
return noticeAntigravity.String()
|
||||
@@ -112,7 +140,17 @@ func antigravity(home string) *Agent {
|
||||
if !wired() {
|
||||
return nil
|
||||
}
|
||||
return syncJSON(path, "gateway", theirsKept(path, "gateway", func() any { return gatewayBlock() }))
|
||||
if err := syncJSON(path, "gateway", theirsKept(path, "gateway", func() any { return gatewayBlock() })); err != nil {
|
||||
return err
|
||||
}
|
||||
// the catalog at the gateway's address, and on a file wired
|
||||
// before magpie wrote one, so its windows reach it too
|
||||
v, _ := edit.GetJSON(path, antigravitySource)
|
||||
if v == antigravityCatalog() {
|
||||
return nil
|
||||
}
|
||||
keepSource()
|
||||
return edit.SetJSON(path, edit.KV{Path: antigravitySource, Value: antigravityCatalog()})
|
||||
},
|
||||
Check: func() string {
|
||||
if !wired() {
|
||||
@@ -144,19 +182,23 @@ func antigravity(home string) *Agent {
|
||||
g, _ := edit.GetJSONRaw(path, "gateway")
|
||||
m, _ := edit.GetJSONRaw(path, antigravityModel)
|
||||
l, _ := edit.GetJSONRaw(path, antigravityList)
|
||||
stash(map[string]string{stashGateway: g, stashModel: m, stashList: l})
|
||||
c, _ := edit.GetJSONRaw(path, antigravitySource)
|
||||
stash(map[string]string{stashGateway: g, stashModel: m, stashList: l, stashSource: c})
|
||||
}
|
||||
// a list of the user's would hide magpie's models from
|
||||
// the picker; it is stashed with their gateway
|
||||
// the picker, and it is read ahead of the catalog that
|
||||
// gives each its window; it is stashed with their gateway
|
||||
if err := edit.DelJSON(path, antigravityList); err != nil {
|
||||
return err
|
||||
}
|
||||
// set again on magpie, what the user added to its block stays
|
||||
block := any(gatewayBlock())
|
||||
if on {
|
||||
keepSource()
|
||||
block = theirsKept(path, "gateway", func() any { return gatewayBlock() })()
|
||||
}
|
||||
return edit.SetJSON(path, edit.KV{Path: "gateway", Value: block}, edit.KV{Path: antigravityModel, Value: ref})
|
||||
return edit.SetJSON(path, edit.KV{Path: "gateway", Value: block}, edit.KV{Path: antigravityModel, Value: ref},
|
||||
edit.KV{Path: antigravitySource, Value: antigravityCatalog()})
|
||||
}
|
||||
if on {
|
||||
// back to what the user had
|
||||
@@ -166,6 +208,9 @@ func antigravity(home string) *Agent {
|
||||
if err := putRaw(antigravityList, unstash(stashList)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := putRaw(antigravitySource, unstash(stashSource)); err != nil {
|
||||
return err
|
||||
}
|
||||
if v == "" {
|
||||
if err := putRaw(antigravityModel, unstash(stashModel)); err != nil {
|
||||
return err
|
||||
@@ -222,7 +267,7 @@ func antigravityTidy(path string) error {
|
||||
|
||||
// what antigravity says after a change (notice.go)
|
||||
var (
|
||||
noticeAntigravity = newNotice("Antigravity reads its gateway at start-up — restart Antigravity to use magpie's models. On magpie it doesn't use your Google sign-in; turning it off here gives that back. An agy not connected on its own row follows it too.")
|
||||
noticeAntigravity = newNotice("Antigravity reads its gateway at start-up — restart Antigravity to use magpie's models. On a gateway it uses no Google sign-in, so what Google turns on for your account (its experiments, and commands such as /boost, /teamwork, /plugin and /generative_ui) is gone while it's on magpie; turning it off here gives that back. An agy not connected on its own row follows it too.")
|
||||
noticeAntigravityAdmin = newNotice("Antigravity's {path} sets a gateway of its own, which wins over ~/.antigravity/settings.json, so it doesn't reach magpie")
|
||||
noticeAntigravityEnv = newNotice("AGY_LLM_GATEWAY_URL is set to {url}, which wins over ~/.antigravity/settings.json, so Antigravity started with it doesn't reach magpie")
|
||||
)
|
||||
|
||||
@@ -94,8 +94,8 @@ func TestAntigravityGateway(t *testing.T) {
|
||||
if !strings.HasSuffix(gw["apiKey"].(string), "-antigravity") {
|
||||
t.Errorf("the key doesn't name the app: %v", gw["apiKey"])
|
||||
}
|
||||
if !sameJSON(string(file["models"]), map[string]any{"defaultModelId": "anth/claude-sonnet-5"}) {
|
||||
t.Errorf("models: %s (the user's list would narrow the picker)", file["models"])
|
||||
if !sameJSON(string(file["models"]), map[string]any{"defaultModelId": "anth/claude-sonnet-5", "listSource": gateway.URL() + "/v1/models?format=antigravity"}) {
|
||||
t.Errorf("models: %s (the user's list would narrow the picker, and with no catalog every model's window is 200K)", file["models"])
|
||||
}
|
||||
if string(file["caCertPath"]) != `"/etc/ssl/certs/cymbal-root-ca.pem"` {
|
||||
t.Errorf("caCertPath: %s", file["caCertPath"])
|
||||
@@ -332,3 +332,76 @@ func TestAntigravityEffort(t *testing.T) {
|
||||
t.Fatalf("back to the default: %v, kept %q", err, provider.AgentEffort("antigravity"))
|
||||
}
|
||||
}
|
||||
|
||||
// Antigravity's app reads the gateway's /v1/models by id alone and gives
|
||||
// a model its catalog doesn't know a window of 200K tokens (YujunT46308 on
|
||||
// X); its models.listSource, a catalog read first, takes one per model. So
|
||||
// magpie points it at the gateway's own, and a catalog of the user's comes
|
||||
// back with their gateway.
|
||||
func TestAntigravityCatalogSource(t *testing.T) {
|
||||
home := antigravityHome(t)
|
||||
path := filepath.Join(home, ".antigravity", "settings.json")
|
||||
own := strings.Replace(antigravityUser, `"list": [`, `"listSource": "https://models.cymbal.com/catalog.json", "list": [`, 1)
|
||||
os.MkdirAll(filepath.Dir(path), 0o755)
|
||||
os.WriteFile(path, []byte(own), 0o600)
|
||||
a := antigravity(home)
|
||||
f := a.Field("model")
|
||||
if err := f.Set("magpie/anth/claude-sonnet-5"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
src := func() string {
|
||||
var m map[string]any
|
||||
json.Unmarshal(antigravityFile(t, path)["models"], &m)
|
||||
s, _ := m["listSource"].(string)
|
||||
return s
|
||||
}
|
||||
if got, want := src(), gateway.URL()+"/v1/models?format=antigravity"; got != want {
|
||||
t.Fatalf("listSource %q, want %q", got, want)
|
||||
}
|
||||
if err := f.Set(""); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !sameJSON(readFile(path), json.RawMessage(own)) {
|
||||
t.Errorf("the user's catalog not back:\n%s", readFile(path))
|
||||
}
|
||||
}
|
||||
|
||||
// A file magpie wired before it wrote a catalog gets one on the next sync,
|
||||
// at the gateway's address as it is now; a catalog of the user's found
|
||||
// there is kept for when magpie steps out.
|
||||
func TestAntigravitySyncAddsCatalog(t *testing.T) {
|
||||
home := antigravityHome(t)
|
||||
path := filepath.Join(home, ".antigravity", "settings.json")
|
||||
a := antigravity(home)
|
||||
f := a.Field("model")
|
||||
if err := f.Set("magpie/anth/claude-sonnet-5"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// as an older magpie left it: no listSource, and one of the user's
|
||||
old := `{"gateway":{"enabled":true,"url":"http://127.0.0.1:1","apiKey":"` + agentKey("antigravity") + `","wireProtocol":"openai"},` +
|
||||
`"models":{"defaultModelId":"anth/claude-sonnet-5","listSource":"https://models.cymbal.com/catalog.json"}}`
|
||||
os.WriteFile(path, []byte(old), 0o600)
|
||||
if err := a.Sync(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var m map[string]any
|
||||
json.Unmarshal(antigravityFile(t, path)["models"], &m)
|
||||
if got, want := m["listSource"], gateway.URL()+"/v1/models?format=antigravity"; got != want {
|
||||
t.Fatalf("listSource after sync %v, want %v", got, want)
|
||||
}
|
||||
// a second sync changes nothing and keeps the stash
|
||||
before := readFile(path)
|
||||
if err := a.Sync(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if readFile(path) != before {
|
||||
t.Errorf("a second sync rewrote the file:\n%s", readFile(path))
|
||||
}
|
||||
if err := f.Set(""); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
json.Unmarshal(antigravityFile(t, path)["models"], &m)
|
||||
if m["listSource"] != "https://models.cymbal.com/catalog.json" {
|
||||
t.Errorf("the user's catalog lost: %s", readFile(path))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package gateway
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/yetone/magpie/internal/provider"
|
||||
)
|
||||
|
||||
// AntigravityFormat is the /v1/models format Antigravity's app reads as its
|
||||
// remote model catalog (its settings.json's models.listSource).
|
||||
const AntigravityFormat = "antigravity"
|
||||
|
||||
// antigravityModels answers /v1/models?format=antigravity: the models the
|
||||
// key asking may use, as Antigravity's app (2.29.0) reads a remote catalog,
|
||||
// {"list": [{"modelId", "displayName", "maxTokens", "maxOutputTokens",
|
||||
// "supportsImages", "supportsThinking"}]}, fetched with the gateway key as
|
||||
// a bearer token.
|
||||
//
|
||||
// Its gateway discovery (<url>/v1/models) reads a model's id alone and
|
||||
// gives one its built-in catalog doesn't know the defaults of its family,
|
||||
// a window of 200K tokens whatever the model's (YujunT46308 on X): no
|
||||
// field of the OpenAI list is read for it, context_window and
|
||||
// context_length included. Its catalog (models.listSource, or models.list
|
||||
// inline) is read first and takes a window per model as maxTokens, and a
|
||||
// name as displayName, which its picker shows. A field magpie doesn't know
|
||||
// is left out, and the app's family default stands for it.
|
||||
func antigravityModels(w http.ResponseWriter, r *http.Request) {
|
||||
shown := catalogFor(r)
|
||||
labels := provider.Labels(shown)
|
||||
list := make([]map[string]any, 0, len(shown))
|
||||
for i, e := range shown {
|
||||
m := map[string]any{"modelId": e.ID, "displayName": labels[i]}
|
||||
if e.Context > 0 {
|
||||
m["maxTokens"] = e.Context
|
||||
}
|
||||
if out := e.PublishedOutput(); out > 0 {
|
||||
m["maxOutputTokens"] = out
|
||||
}
|
||||
if e.Images {
|
||||
m["supportsImages"] = true
|
||||
}
|
||||
if e.Thinks() {
|
||||
m["supportsThinking"] = true
|
||||
}
|
||||
list = append(list, m)
|
||||
}
|
||||
writeJSON(w, 200, map[string]any{"list": list})
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package gateway
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http/httptest"
|
||||
"slices"
|
||||
"testing"
|
||||
|
||||
"github.com/yetone/magpie/internal/catalog"
|
||||
"github.com/yetone/magpie/internal/provider"
|
||||
)
|
||||
|
||||
// Antigravity's app reads /v1/models by id alone and gives a model its
|
||||
// catalog doesn't know a window of 200K tokens (YujunT46308 on X); its
|
||||
// models.listSource catalog takes one per model. magpie's, at
|
||||
// /v1/models?format=antigravity, is {"list": [...]} in the app's own
|
||||
// fields, the models the key may use, each with its window and name.
|
||||
func TestAntigravityCatalog(t *testing.T) {
|
||||
setup(t, provider.Anthropic, &fake{})
|
||||
if err := provider.Save(provider.Provider{ID: "ds", Name: "DS", Key: "k", Chat: "http://127.0.0.1:1/v1", Models: []string{"big", "plain"}}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := catalog.SaveLive("ds", "http://127.0.0.1:1/v1", []catalog.Model{{ID: "big", Context: 1048576, Output: 65536, Images: true, Efforts: []string{"low", "high"}}, {ID: "plain"}}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
get := func(path string) []byte {
|
||||
t.Helper()
|
||||
req := httptest.NewRequest("GET", path, nil)
|
||||
req.Header.Set("Authorization", "Bearer "+TokenFor("antigravity"))
|
||||
rec := httptest.NewRecorder()
|
||||
New().Handler().ServeHTTP(rec, req)
|
||||
if rec.Code != 200 {
|
||||
t.Fatalf("%s: %d %s", path, rec.Code, rec.Body)
|
||||
}
|
||||
return rec.Body.Bytes()
|
||||
}
|
||||
var got struct {
|
||||
List []map[string]any `json:"list"`
|
||||
}
|
||||
body := get("/v1/models?format=" + AntigravityFormat)
|
||||
if err := json.Unmarshal(body, &got); err != nil || got.List == nil {
|
||||
t.Fatalf("not the app's catalog: %s", body)
|
||||
}
|
||||
by := map[string]map[string]any{}
|
||||
var ids []string
|
||||
for _, m := range got.List {
|
||||
id, _ := m["modelId"].(string)
|
||||
by[id] = m
|
||||
ids = append(ids, id)
|
||||
}
|
||||
big := by["ds/big"]
|
||||
if big == nil {
|
||||
t.Fatalf("ds/big not listed: %s", body)
|
||||
}
|
||||
if big["maxTokens"] != float64(1048576) || big["maxOutputTokens"] != float64(65536) {
|
||||
t.Errorf("ds/big's window: %v", big)
|
||||
}
|
||||
if big["supportsImages"] != true || big["supportsThinking"] != true {
|
||||
t.Errorf("ds/big's abilities: %v", big)
|
||||
}
|
||||
if n, _ := big["displayName"].(string); n == "" {
|
||||
t.Errorf("ds/big has no name: %v", big)
|
||||
}
|
||||
// a window magpie doesn't know is left to the app's default
|
||||
if p := by["ds/plain"]; p == nil {
|
||||
t.Fatalf("ds/plain not listed: %s", body)
|
||||
} else if _, ok := p["maxTokens"]; ok {
|
||||
t.Errorf("ds/plain given a window: %v", p)
|
||||
}
|
||||
// the same models as the plain list asked with the key
|
||||
var plain struct {
|
||||
Data []struct{ ID string } `json:"data"`
|
||||
}
|
||||
json.Unmarshal(get("/v1/models"), &plain)
|
||||
var want []string
|
||||
for _, d := range plain.Data {
|
||||
want = append(want, d.ID)
|
||||
}
|
||||
slices.Sort(ids)
|
||||
slices.Sort(want)
|
||||
if !slices.Equal(ids, want) {
|
||||
t.Errorf("catalog %v, list %v", ids, want)
|
||||
}
|
||||
}
|
||||
@@ -1547,6 +1547,11 @@ func listKinds(r *http.Request) (chat, image, video bool, err error) {
|
||||
}
|
||||
|
||||
func (s *Server) models(w http.ResponseWriter, r *http.Request) {
|
||||
// Antigravity's app's catalog, each model with its window (antigravity_models.go)
|
||||
if r.URL.Query().Get("format") == AntigravityFormat {
|
||||
antigravityModels(w, r)
|
||||
return
|
||||
}
|
||||
if waitsForList(r) {
|
||||
// another magpie waiting for the list to change (models_wait.go)
|
||||
s.modelsOnceChanged(w, r)
|
||||
|
||||
@@ -4436,7 +4436,7 @@ const I18N = {
|
||||
"NewMax keeps its settings in memory while it runs and writes them all back when one changes — quit NewMax before changing this, then open it and pick a magpie model in its model picker.": "NewMax 运行时把设置放在内存里,任一设置变化时会全部写回 —— 请先退出 NewMax 再更改这里,然后打开它,在模型选择器中选一个 magpie 的模型。",
|
||||
"LiveAgent keeps its settings in memory while it runs and writes them all back when one changes — quit LiveAgent before changing this, then open it and pick a magpie model in its model picker.": "LiveAgent 运行时把设置放在内存里,任一设置变化时会全部写回 —— 请先退出 LiveAgent 再更改这里,然后打开它,在模型选择器中选一个 magpie 的模型。",
|
||||
"Pencil reads its custom models at start-up — restart Pencil to see magpie's models in its model picker.": "Pencil 启动时读取自定义模型,需重启 Pencil 才能在它的模型选择器中看到 magpie 的模型。",
|
||||
"Antigravity reads its gateway at start-up — restart Antigravity to use magpie's models. On magpie it doesn't use your Google sign-in; turning it off here gives that back. An agy not connected on its own row follows it too.": "Antigravity 启动时读取网关,需重启 Antigravity 才能使用 magpie 的模型。接入 magpie 时它不使用你的 Google 登录,在这里关闭即可恢复。未在自己那一行接入的 agy 也会跟着它走。",
|
||||
"Antigravity reads its gateway at start-up — restart Antigravity to use magpie's models. On a gateway it uses no Google sign-in, so what Google turns on for your account (its experiments, and commands such as /boost, /teamwork, /plugin and /generative_ui) is gone while it's on magpie; turning it off here gives that back. An agy not connected on its own row follows it too.": "Antigravity 启动时读取网关,需重启 Antigravity 才能使用 magpie 的模型。走网关时它不使用 Google 登录,所以 Google 为你的账号开启的功能(它的实验,以及 /boost、/teamwork、/plugin、/generative_ui 等命令)在接入 magpie 期间都没有;在这里关闭即可恢复。未在自己那一行接入的 agy 也会跟着它走。",
|
||||
"Antigravity's {path} sets a gateway of its own, which wins over ~/.antigravity/settings.json, so it doesn't reach magpie": "Antigravity 的 {path} 设置了自己的网关,它优先于 ~/.antigravity/settings.json,所以不会连到 magpie",
|
||||
"AGY_LLM_GATEWAY_URL is set to {url}, which wins over ~/.antigravity/settings.json, so Antigravity started with it doesn't reach magpie": "AGY_LLM_GATEWAY_URL 被设为 {url},它优先于 ~/.antigravity/settings.json,所以这样启动的 Antigravity 不会连到 magpie",
|
||||
"Qwen Code reads a session's model at start-up — start a new session, or /model anew, to use this.": "Qwen Code 在会话启动时读取模型,需开启新会话或重新执行 /model 才会生效。",
|
||||
@@ -9063,7 +9063,7 @@ const I18N = {
|
||||
"NewMax keeps its settings in memory while it runs and writes them all back when one changes — quit NewMax before changing this, then open it and pick a magpie model in its model picker.": "NewMax 執行時把設定放在記憶體中,任一設定變更時會全部寫回 —— 請先結束 NewMax 再變更這裡,然後開啟它,在模型選擇器中選一個 magpie 的模型。",
|
||||
"LiveAgent keeps its settings in memory while it runs and writes them all back when one changes — quit LiveAgent before changing this, then open it and pick a magpie model in its model picker.": "LiveAgent 執行時把設定放在記憶體中,任一設定變更時會全部寫回 —— 請先結束 LiveAgent 再變更這裡,然後開啟它,在模型選擇器中選一個 magpie 的模型。",
|
||||
"Pencil reads its custom models at start-up — restart Pencil to see magpie's models in its model picker.": "Pencil 啟動時讀取自訂模型,需重啟 Pencil 才能在它的模型選擇器中看到 magpie 的模型。",
|
||||
"Antigravity reads its gateway at start-up — restart Antigravity to use magpie's models. On magpie it doesn't use your Google sign-in; turning it off here gives that back. An agy not connected on its own row follows it too.": "Antigravity 啟動時讀取閘道,需重啟 Antigravity 才能使用 magpie 的模型。接入 magpie 時它不使用你的 Google 登入,在這裡關閉即可恢復。未在自己那一列接入的 agy 也會跟著它走。",
|
||||
"Antigravity reads its gateway at start-up — restart Antigravity to use magpie's models. On a gateway it uses no Google sign-in, so what Google turns on for your account (its experiments, and commands such as /boost, /teamwork, /plugin and /generative_ui) is gone while it's on magpie; turning it off here gives that back. An agy not connected on its own row follows it too.": "Antigravity 啟動時讀取閘道,需重啟 Antigravity 才能使用 magpie 的模型。走閘道時它不使用 Google 登入,所以 Google 為你的帳號開啟的功能(它的實驗,以及 /boost、/teamwork、/plugin、/generative_ui 等指令)在接入 magpie 期間都沒有;在這裡關閉即可恢復。未在自己那一列接入的 agy 也會跟著它走。",
|
||||
"Antigravity's {path} sets a gateway of its own, which wins over ~/.antigravity/settings.json, so it doesn't reach magpie": "Antigravity 的 {path} 設定了自己的閘道,它優先於 ~/.antigravity/settings.json,所以不會連到 magpie",
|
||||
"AGY_LLM_GATEWAY_URL is set to {url}, which wins over ~/.antigravity/settings.json, so Antigravity started with it doesn't reach magpie": "AGY_LLM_GATEWAY_URL 被設為 {url},它優先於 ~/.antigravity/settings.json,所以這樣啟動的 Antigravity 不會連到 magpie",
|
||||
"Qwen Code reads a session's model at start-up — start a new session, or /model anew, to use this.": "Qwen Code 在會話啟動時讀取模型,需開啟新會話或重新執行 /model 才會生效。",
|
||||
@@ -13692,7 +13692,7 @@ const I18N = {
|
||||
"NewMax keeps its settings in memory while it runs and writes them all back when one changes — quit NewMax before changing this, then open it and pick a magpie model in its model picker.": "NewMax は実行中に設定をメモリに保持し、設定が変わるたびにすべて書き戻します。ここを変更する前に NewMax を終了し、その後開いてモデル選択で magpie のモデルを選んでください。",
|
||||
"LiveAgent keeps its settings in memory while it runs and writes them all back when one changes — quit LiveAgent before changing this, then open it and pick a magpie model in its model picker.": "LiveAgent は実行中に設定をメモリに保持し、設定が変わるたびにすべて書き戻します。ここを変更する前に LiveAgent を終了し、その後開いてモデル選択で magpie のモデルを選んでください。",
|
||||
"Pencil reads its custom models at start-up — restart Pencil to see magpie's models in its model picker.": "Pencil は起動時にカスタムモデルを読み込みます。モデル選択に magpie のモデルを表示するには Pencil を再起動してください。",
|
||||
"Antigravity reads its gateway at start-up — restart Antigravity to use magpie's models. On magpie it doesn't use your Google sign-in; turning it off here gives that back. An agy not connected on its own row follows it too.": "Antigravity は起動時にゲートウェイを読み込みます。magpie のモデルを使うには Antigravity を再起動してください。magpie 経由では Google のサインインは使われず、ここでオフにすると元に戻ります。自分の行で接続していない agy もこれに従います。",
|
||||
"Antigravity reads its gateway at start-up — restart Antigravity to use magpie's models. On a gateway it uses no Google sign-in, so what Google turns on for your account (its experiments, and commands such as /boost, /teamwork, /plugin and /generative_ui) is gone while it's on magpie; turning it off here gives that back. An agy not connected on its own row follows it too.": "Antigravity は起動時にゲートウェイを読み込みます。magpie のモデルを使うには Antigravity を再起動してください。ゲートウェイ経由では Google のサインインは使われないため、Google がアカウントに有効にする機能(実験や、/boost、/teamwork、/plugin、/generative_ui などのコマンド)は magpie 接続中は使えません。ここでオフにすると元に戻ります。自分の行で接続していない agy もこれに従います。",
|
||||
"Antigravity's {path} sets a gateway of its own, which wins over ~/.antigravity/settings.json, so it doesn't reach magpie": "Antigravity の {path} が独自のゲートウェイを設定しており、~/.antigravity/settings.json より優先されるため、magpie に届きません",
|
||||
"AGY_LLM_GATEWAY_URL is set to {url}, which wins over ~/.antigravity/settings.json, so Antigravity started with it doesn't reach magpie": "AGY_LLM_GATEWAY_URL が {url} に設定されており、~/.antigravity/settings.json より優先されるため、これで起動した Antigravity は magpie に届きません",
|
||||
"Qwen Code reads a session's model at start-up — start a new session, or /model anew, to use this.": "Qwen Code はセッション開始時にモデルを読み込みます。反映するには新しいセッションを始めるか、もう一度 /model を実行してください。",
|
||||
@@ -18321,7 +18321,7 @@ const I18N = {
|
||||
"NewMax keeps its settings in memory while it runs and writes them all back when one changes — quit NewMax before changing this, then open it and pick a magpie model in its model picker.": "NewMax hält seine Einstellungen während der Ausführung im Speicher und schreibt sie bei jeder Änderung alle zurück – NewMax vor dieser Änderung beenden, dann öffnen und in seiner Modellauswahl ein magpie-Modell wählen.",
|
||||
"LiveAgent keeps its settings in memory while it runs and writes them all back when one changes — quit LiveAgent before changing this, then open it and pick a magpie model in its model picker.": "LiveAgent hält seine Einstellungen während der Ausführung im Speicher und schreibt sie bei jeder Änderung alle zurück – LiveAgent vor dieser Änderung beenden, dann öffnen und in seiner Modellauswahl ein magpie-Modell wählen.",
|
||||
"Pencil reads its custom models at start-up — restart Pencil to see magpie's models in its model picker.": "Pencil liest seine eigenen Modelle beim Start – Pencil neu starten, um magpies Modelle in seiner Modellauswahl zu sehen.",
|
||||
"Antigravity reads its gateway at start-up — restart Antigravity to use magpie's models. On magpie it doesn't use your Google sign-in; turning it off here gives that back. An agy not connected on its own row follows it too.": "Antigravity liest sein Gateway beim Start – Antigravity neu starten, um magpies Modelle zu nutzen. Über magpie nutzt es deine Google-Anmeldung nicht; hier ausschalten gibt sie zurück. Ein agy, das nicht in seiner eigenen Zeile verbunden ist, folgt ihm auch.",
|
||||
"Antigravity reads its gateway at start-up — restart Antigravity to use magpie's models. On a gateway it uses no Google sign-in, so what Google turns on for your account (its experiments, and commands such as /boost, /teamwork, /plugin and /generative_ui) is gone while it's on magpie; turning it off here gives that back. An agy not connected on its own row follows it too.": "Antigravity liest sein Gateway beim Start – Antigravity neu starten, um magpies Modelle zu nutzen. Über ein Gateway nutzt es keine Google-Anmeldung, daher fehlt, was Google für dein Konto freischaltet (seine Experimente und Befehle wie /boost, /teamwork, /plugin und /generative_ui), solange es über magpie läuft; hier ausschalten gibt es zurück. Ein agy, das nicht in seiner eigenen Zeile verbunden ist, folgt ihm auch.",
|
||||
"Antigravity's {path} sets a gateway of its own, which wins over ~/.antigravity/settings.json, so it doesn't reach magpie": "Antigravitys {path} setzt ein eigenes Gateway, das Vorrang vor ~/.antigravity/settings.json hat, daher erreicht es magpie nicht",
|
||||
"AGY_LLM_GATEWAY_URL is set to {url}, which wins over ~/.antigravity/settings.json, so Antigravity started with it doesn't reach magpie": "AGY_LLM_GATEWAY_URL ist auf {url} gesetzt, das Vorrang vor ~/.antigravity/settings.json hat, daher erreicht ein damit gestartetes Antigravity magpie nicht",
|
||||
"Qwen Code reads a session's model at start-up — start a new session, or /model anew, to use this.": "Qwen Code liest das Modell einer Sitzung beim Start – eine neue Sitzung beginnen oder /model erneut ausführen, damit es gilt.",
|
||||
@@ -18589,7 +18589,7 @@ const NOTICES = [
|
||||
"NewMax keeps its settings in memory while it runs and writes them all back when one changes — quit NewMax before changing this, then open it and pick a magpie model in its model picker.",
|
||||
"LiveAgent keeps its settings in memory while it runs and writes them all back when one changes — quit LiveAgent before changing this, then open it and pick a magpie model in its model picker.",
|
||||
"Pencil reads its custom models at start-up — restart Pencil to see magpie's models in its model picker.",
|
||||
"Antigravity reads its gateway at start-up — restart Antigravity to use magpie's models. On magpie it doesn't use your Google sign-in; turning it off here gives that back. An agy not connected on its own row follows it too.",
|
||||
"Antigravity reads its gateway at start-up — restart Antigravity to use magpie's models. On a gateway it uses no Google sign-in, so what Google turns on for your account (its experiments, and commands such as /boost, /teamwork, /plugin and /generative_ui) is gone while it's on magpie; turning it off here gives that back. An agy not connected on its own row follows it too.",
|
||||
"Antigravity's {path} sets a gateway of its own, which wins over ~/.antigravity/settings.json, so it doesn't reach magpie",
|
||||
"AGY_LLM_GATEWAY_URL is set to {url}, which wins over ~/.antigravity/settings.json, so Antigravity started with it doesn't reach magpie",
|
||||
"Qwen Code reads a session's model at start-up — start a new session, or /model anew, to use this.",
|
||||
|
||||
Reference in New Issue
Block a user