ac4af582301a4e8a29245dbba767eba31334ddf9
7
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
bb478f0e50 |
agent: a look that only ranges over magpie's models reads the list kept
magpieModels gives each caller its own copy of the list it keeps per
agent. Most callers only range over it, or count it, and a range copies
each model anyway, so the copy guarded nothing for them (the models'
own lists were shared before too: the copy was shallow). sharedModels
is the list kept, read only; every `range magpieModels(` and
`len(magpieModels(` in internal/agent (39 files) takes it. Callers that
keep the list, append to it or hand it on still get their copy.
Real accounts (sandbox copy of the owner's HOME, network blocked), 40
polls of /api/state, /api/providers and drift, pprof alloc_space
between two heap snapshots,
|
||
|
|
2eee900dc9 |
agent: eight more syncs keep what the user set on magpie's block (#2030's siblings)
|
||
|
|
016760e520 |
agent: Goose's requests show as Goose on Routing and in Usage, by a key that names it (#1083, EZN7L2C3)
Goose's HTTP client sends no User-Agent (reqwest's default in
crates/goose-providers/src/api_client.rs, checked on block/goose main), and
the custom provider magpie writes for it (custom_providers/magpie.json)
carried the plain gateway key. The gateway tells an agent by its key first,
then its User-Agent, so Goose's requests were "your agent" on Routing and
"other" in Usage. The file now carries agentKeyAt("goose") (magpie-goose on
this machine, the LAN key from a NAT'd WSL distro, as before), the same as
Alma, Hanako, Snow, AstrBot and Prime Agent, which also send no User-Agent.
Goose's Check compares the same key, so a file an older magpie wrote counts
as drift and Sync rewrites it. Goose reads custom_providers at start, so a
running Goose needs a restart (the existing notice says so).
Tests: TestGooseKeyNamesGoose (the key written, an older file's plain key
noticed by Check and replaced by Sync) and TestGooseRunsOnMagpie's key
assertion fail on the old code (Authorization = "Bearer magpie", want
"Bearer magpie-goose"). Breaking only the Check back to the plain key fails
both with "headers.Authorization (magpie.json) was changed". The gateway's
TestGooseAgentByKey records a request with no User-Agent and magpie-goose
as goose's (it passes on the old code: the gateway side already worked; it
guards the path end to end). go test ./internal/agent/ ./internal/gateway/
in a sandbox HOME. Not tried with a real Goose.
|
||
|
|
6f65ffb5ff |
agent: CodeBuddy Code, Cline, Gemini CLI, AtomCode, Goose and Reasonix installed in a WSL distro are found and wired there (lgtm on Discord: magpie 现在无法检测到安装在wsl中的codebuddy呀?)
wslKinds had none of these CLIs, so each was set up only on Windows. Each now has a place-aware constructor (codebuddyIn, clineIn, geminiIn, atomcodeIn, gooseIn, reasonixIn). It writes the distro's own config with the gateway as the distro reaches it (mirrored or NAT) and the key it takes from there. A distro reads none of Windows' variables (CODEBUDDY_CONFIG_DIR, CLINE_DIR, APPDATA...). Kinds are found by their folder or their command. 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. Reasonix also needs a native version (new wslKind.accept). Gemini CLI also counts a .env that names an old address with magpie's key as magpie's own. Before this, a WSL restart that moved the distro's address made it read "custom", and picking the model again stashed magpie's old address as the user's. Verified: - On the Windows test box (WSL2 magpie-desktop, NAT), with a sandboxed nogui magpie.exe (own USERPROFILE/APPDATA, port 3441), real CodeBuddy Code 2.161.4, Gemini CLI 0.63.0 and Cline CLI 3.0.68 were installed in the distro. `magpie ls` listed each as "· WSL magpie-desktop". Picking relay/glm-4.6 wrote ~/.codebuddy/models.json, ~/.gemini/.env + settings.json and ~/.cline/data/settings/providers.json in the distro at http://172.17.32.1:3441, and wrote nothing in the sandbox home's agent folders. The installs were removed afterwards. - Not tried for real: AtomCode, Goose and Reasonix in a distro, and a chat request from a WSL CLI through the gateway. - Tests: gofmt; go vet ./...; -race on internal/agent; the full `go test -tags nogui ./...`; GOOS=windows and GOOS=linux builds. TestWSLProbeFindsMoreAgents and the rest of TestWSLMore* panic with "no WSL agent codebuddy" on the old wsl.go. TestWSLGeminiAddressMoved fails ("auth custom") without the gemini routed change. |
||
|
|
94db53a847 | goose: the model is read and written in the layout Goose's config is in, active_provider and the providers map as well as GOOSE_PROVIDER/GOOSE_MODEL (a follow-up to #987: the reporter's Goose 1.53 has active_provider: magpie and its model in providers.magpie.model) — Goose 1.53 reads active_provider before GOOSE_PROVIDER and the active entry's model before GOOSE_MODEL (get_active_provider/get_active_model, crates/goose/src/config/providers.rs at v1.53.0), and on every write migrates the flat keys into the map and, once a map is there, deletes them (migrate_provider_config/cleanup_legacy_provider_keys, config/migrations.rs; load_write_config, config/base.rs). magpie read and wrote only the flat keys: on a migrated config it showed no model, its Check and the restart notice never saw magpie in use, and a model picked in magpie went beside a map goose read first, so goose kept its own and deleted magpie's at its next write. Now a config with a providers map or active_provider is written as goose's set_active_provider writes it (active_provider, providers.<id>: enabled, model, configured), other providers' entries and the user's other keys and comments kept, stale flat keys removed; an old config keeps the flat keys, which an older goose reads and a newer migrates. Taking Goose off magpie clears active_provider and the flat keys as goose's clear_active_provider does, and drops magpie's own entry with its custom provider. TestGooseModelInEitherLayout (the reporter's layout with another provider; switching to a native model, to magpie's and back off; a stale flat key beside the map; the old layout left old) fails on the old code ("model = \"\", want magpie/zhipu/glm-5.3") and passes; go test ./internal/agent/ ./internal/edit/, -race -count=5 on the Goose/pick/effort tests, go vet (darwin, windows) and darwin/linux(nogui)/windows builds pass. Not tried with a real Goose Desktop. | ||
|
|
09b235d8b3 | goose: the model list offers Goose's own providers only when this Goose is set up with them (#987, EZN7L2C3: a Goose on magpie alone listed OpenRouter and its hundreds of models, which magpie's show/hide list doesn't have and so couldn't hide) — Goose's model Options always added anthropic, openai, google and openrouter, whatever Goose had, with their models.dev lists. They now come from gooseConfigured, which reads what Goose itself records (block/goose source): the providers map's entries marked configured (set_active_provider, config/providers.rs), legacy <name>_configured markers (migrate_provider_config, config/migrations.rs), active_provider / GOOSE_PROVIDER, and a native provider whose API key is in the environment, which Config::get_secret reads before the keyring. A key only in Goose's keyring isn't read (magpie stays out of the keychain), but every provider Goose has been set up with has its configured entry. No other agent passes providers it doesn't have: Crush passes its config's providers, the rest none. TestGooseOffersOnlyItsConfiguredProviders (the reporter's config: magpie alone → no native groups; a configured entry and a legacy marker → those two, not an unconfigured openai or openrouter; OPENROUTER_API_KEY set → OpenRouter) fails on the old code with all four offered and passes. go test ./internal/agent/, -race -count=5 on the Goose tests, go vet (darwin, windows) and linux/windows builds pass. Not tried with a real Goose Desktop. | ||
|
|
2eb9266395 |
goose: runs on magpie as a custom provider that hands Goose each model's window and says which models Goose can send a thinking level (wani on Discord: goose gui不支持设置推理等级,而且上下文也不对)
magpie never wired Goose to its gateway: its model field offered only Goose's own providers, so a user had to add magpie by hand as a custom provider. Goose then treats every declared model as one that doesn't think (ModelInfo.reasoning defaults to false). With no context_limit, it guesses each window from its own registry by the model's name, or falls back to 128K. Goose's model field now offers magpie's models. Picking one writes custom_providers/magpie.json next to Goose's config.yaml (~/.config/goose, or %APPDATA%\Block\goose\config on Windows), then sets GOOSE_PROVIDER=magpie and GOOSE_MODEL. The file holds only keys Goose reads, from DeclarativeProviderConfig (crates/goose-providers/src/declarative.rs) and ModelInfo (crates/goose-provider-types/src/base.rs): - engine openai, base_url set to the gateway's /v1, Authorization: Bearer magpie as a header, api_key_env "" and requires_auth false; - dynamic_models false, so Goose uses this list rather than /v1/models, which has no windows; - skip_canonical_filtering, so models Goose's registry doesn't know stay in the list; - for each model, its context_limit (ContextLimitResolver takes it before anything but GOOSE_CONTEXT_LIMIT) and reasoning. reasoning is true only for the models Goose actually sends a level to on an OpenAI-compatible provider. Those are OpenAI's reasoning models, as is_openai_responses_model in crates/goose-provider-types/src/formats/openai.rs tells them (gpt-5/6, o-series). For every other model (Claude, GLM, DeepSeek, Gemini…) Goose keeps thinking_effort to itself and never sends it, so a Thinking Level shown for them would do nothing. Sync rewrites the file as the catalog changes. Check reports a base_url or header someone else rewrote. Picking no model removes the file. The Notice asks for a restart, because Goose loads custom_providers at start-up. GOOSE_CONTEXT_LIMIT is left alone: it is one global override, and it would beat every per-model window. What Goose itself can't do: - On an OpenAI-compatible provider, Goose sends no effort for a model that isn't OpenAI's. - The in-session thinking menu follows Goose's name heuristics and its registry, not the provider's reasoning. - Before a session starts, the desktop app's context ring prefers Goose's registry to the declared window. TestGooseRunsOnMagpie covers the options, the file's keys, the windows, reasoning for gpt-5.5 but not glm-4.6, Check, Sync and removal; the old code fails it. go vet, the builds (darwin, GOOS=linux -tags nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass, except TestProvidersAnswerWhileListsComeIn and TestSavedButSignedOutClaudeServed: these timing tests pass when run alone. Not tried against a real Goose. |