2ff85f8a2bc33f87aa1fdfefce580433afff76e3
143
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
df9376592d |
routing: a group's member may offer several reasoning levels for the agent to pick among
Garydesu on X: "能不能让路由组里的模型设置多个可选推理强度,现在只能选一个或者整个 路由组的". A member was one fixed `:effort` or followed the group's levels. A member's suffix may now join several levels with "+", `provider/model:low+xhigh`, kept lowest first, each once. provider.MemberLevels splits it into Member.Levels and leaves Effort empty, so the member isn't fixed; one level is a fixed effort as before. The whole stays the member's id, so rules, fast, off, weights, share and the CLI key it as any member. The gateway fits the agent's ask to the member's own levels (groupLevels returns the candidate's levels first; ofMember, the quiet check and the trace see them), and the group lists them to agents (buildGroupEntries), intersected with the other members' as usual. In the Routing page's group editor the member's reasoning menu has "Several levels…", a menu that stays open with each level ticked or not; a fixed level picked from the first menu replaces the old one as before. i18n in zh, zh-TW, ja, de; CLI help and docs/subsystems/gateway-routing.md say it. Run on mote (mote-run). Rebased on |
||
|
|
e8c7dddcb4 |
notices: the release carries the third-party licence notices
The owner asked for the licence notices in the release package (moejs alpha.11 compiles Intl's data in, which carries its own notices). THIRD_PARTY_NOTICES is embedded in the binary (main.go, //go:embed) and handed to internal/notices; `magpie licenses` prints it, GET /api/notices serves it, and Settings › About has an Open-source licenses row that opens it in a dialog, in every language. `make app` copies the file into the .app's Resources too. The core's scripts are 1,527,245 bytes, their budget raised to it with no room added; app.js stays under its own. Run at this head (rebased on origin/main): - win-run (Windows 11): go vet -tags nogui . ./internal/notices ./internal/cli; go test TestNoticesFollowMoejs (.), ./internal/cli, TestCoreScriptBudget (./internal/gui): ok. - wsl-run (Ubuntu 24.04): go vet -tags nogui ./..., go build -tags nogui: ok. Run at the pre-rebase head 14e2d13fb, on mote (macOS): - gofmt; make app's copy byte-identical to the file; `magpie licenses` output equal to the file; GOOS=linux/windows vet and build; go test . ./internal/cli: ok. ./internal/gui: only TestMainWindowCorners red, the same on origin/main (#3949). - about-notices.test.cjs: chromium and webkit, en zh zh-TW ja de, 1100 and 420px: all ok. Broken by hand: TestNoticesFollowMoejs red with the embedded file cut. Not run: the GUI suite at this head. The rebase met main's cancelAsk helper where showNotices sat, and the dialog's Done now uses it (the same stopPropagation + closeConfirmAsk). The whole GUI suite at 14e2d13fb was cut off when mote went down at load ~50: the files it reached outside About had reds, most of them 180s browser-launch timeouts, the rest passing in other languages or the other engine; they are run again once mote is back, and any that stay red are filed. |
||
|
|
08b02cf18c |
providers: a pool stops at its caps and reads usage again near them (plugins#349)
What was adopted on magpie-community/plugins#349 (1939869736luosi): one
place, in the GUI and the CLI, for a subscription's account pool, and an
opt-in conservative mode.
- Stop at the caps (Provider.CapStop, off by default): once every account
in use is held at its cap, the request is answered 429 rather than going
on to the provider's fallbacks (plan returns restLast). Off, as before.
- Check usage again near a cap (Provider.CapCareful, off by default,
internal/gateway/cap_careful.go): before planning, a capped account's
usage is read again when its reading is over 15s old within 5 points of
a cap, or over 5m old at all; the request waits at most 10s, and a
failed account is asked again at most every 15s. An account whose usage
was never read, whose last read failed, or whose reading is still that
old is then held as one at its cap is (capHold "unread", traced as
Weighed.Unread, named in the 429 with "--careful off"). Generic: it
goes by provider.UsageRead/ReadUsageNow, so every subscription that
reports usage windows (Codex, Claude, plugins) gets it.
- provider: usedCache records each account's read state; a failed read
keeps the last good reading's time. ReadUsageNow no longer reports
false when the read had already finished on the first ask.
- GUI: under the provider's account list, once an account has a cap (or
either is on), two ticks for the above, and a note naming the accounts
in use with no cap ("used to 100% of each window"). Accounts, order and
caps stay where they were in that list. zh, zh-TW, ja, de added.
app.js 1,309,658 within its 1,310,460 budget, unraised: addRow and a
per-row forgetOf replace 3 add-button and 5 Remove-button builds.
- CLI: magpie provider pool <id> [--accounts a,b,…] [--cap percent|off]
[--stop on|off] [--careful on|off] shows and sets the whole pool.
- docs: gateway-routing.md and providers-accounts.md.
Run (mote, before the rebase at
|
||
|
|
8bade6c5e2 |
provider: a plugin's usage window can be a prepaid wallet's balance (#3950)
SuperMagic's accounts (mycf_711's magicrew plugin) are prepaid wallets of
points with no total. A plugin can now send a usage window as
{name, balance: 6291, unit: "积分"} with no used or limit.
- host.js passes a finite balance on (at least 0), anything else as null.
plugin.UsageWindow.Balance and provider.QuotaWindow.Balance are *float64.
- quotaOfPlugin keeps the figure and does not make the window Text or
Aside, so routing knows the account with no Used invented. allowanceOf
copies it into Limit.Balance; an empty wallet counts as used up.
Allowance.Left(model) is the least balance of the windows that count
the model.
- weighRouted fills routes.Seat.Left and Seat.LeftIn (the account's
provider and unit). Smart, pace and usage (least used) put the seat
with more left first where they would otherwise tie (byLeft), only
when every seat with a balance shares one LeftIn: balances in two
units or two providers are never compared. Tiers still come first.
- The Usage card, the Routing page (Weighed.Balance: the small row's
text, no bar, a why sentence, the account list), magpie accounts and
the status line show the figure, "6,291 积分 left", never a share.
- Docs: provider-plugins (new section), gateway-routing,
providers-accounts, plugin-runtime, host.js typings and the site's
plugins page (en, zh, ja).
Run, at base
|
||
|
|
e056779a67 |
gui: the app serves its page to a browser, behind its key (Settings › Browser access)
jiakun_zhao on X ran `magpie web` in a terminal beside the desktop app, to manage it through a Cloudflare tunnel. Settings › Network and sharing › Browser access now has the app serve the same page itself: Off, This computer (127.0.0.1, for a tunnel or SSH forward) or Local network. Access is magpie web's, unchanged: the key in the link is traded for the cookie (webGuard), the allow list holds, and the gateway's client routes on the page's port need a gateway key (onePort). A rebound Host and Origin: null get no cookie. There is no way to serve it without the key. The key and choice live in web-page.json (0600) beside settings.json, so a sync never carries them. GET/POST /api/web-page are the app windows' alone: a browser on the page can't read the key or turn the page off. A busy port (magpie web, the magpie before an update) is tried every 4s; `magpie web` on the same port opens the app's link instead. Run at d43b7c40d (this change on |
||
|
|
add927e604 |
codex: the Codex app beside the ChatGPT sign-in lists magpie's models too
laddieyao (Discord #general, 10-27): with Codex joined to magpie beside its ChatGPT sign-in, the Codex desktop app's model picker showed OpenAI's GPT models alone, while the Codex CLI listed magpie's. The /models request does reach magpie's gateway and its answer holds magpie's models. ChatGPT.app 26.1013's picker then narrows app-server model/list to the models a Statsig config (107580212, use_hidden_models / available_models) names, while Codex is on its built-in provider, unless Codex reads its list from a file (model_catalog_json, hasConfiguredModelCatalog) or names a provider of its own. The CLI has no such filter. Where the Codex app is installed (codexReaders has an "app"), and only joined/beside the sign-in (not magpie as Codex's provider, not account failover alone), magpie writes the list it hands Codex at /backend-api/codex/models to ~/.codex/magpie-desktop-models.json and names it with model_catalog_json. Codex is still on its built-in provider. With a catalog named Codex asks for no list, so magpie asks the backend itself, with Codex's live sign-in (provider.CodexLiveList): its entries go in verbatim, base_instructions and all, merged as the gateway merges them (codexMerged, factored out of codexModels: picked, hidden, window, V1, AutoReview edits), magpie's models after them. - A list not known (not asked yet, or the backend failing) is unknown: the file as it was stays, never an empty list; a key naming a file that is gone goes, as Codex loads no config then. - Written via temp+rename at Join, set, settle and every Sync (so a change of magpie's models, picks or hidden models rewrites it, as SyncCatalog runs on them); the backend list is asked again hourly (5 min after a failure) and a change syncs again. - A model_catalog_json of the user's own stands; none is written beside. - magpie API, the app gone, or unwire take the key and the file out; unroute never restores the desk file as the user's catalog. - connectinfo counts the file, so a running app on an old list reads as needing a restart. - CLI-only machines: unchanged, the live /models path as before. Run: - Real account, sandbox HOME (copy of auth.json, chatgpt Pro; live ~/.codex untouched): Join wrote model_catalog_json and the file with the real backend's 10 entries (gpt-6.1-sol ... codex-auto-review, each with base_instructions) plus relay/claude-opus-5.5 and relay/claude-sonnet-4-5. Then the real app-server bundled in ChatGPT.app (codex 0.163.0-alpha.10.2, CODEX_HOME sandbox, base URL pointed at a dead port) model/list returned all 12, relay models visible, and config/read showed model_catalog_json set, which is what the app's picker checks to skip its filter. - New tests: TestCodexDesktopListBesideSignIn, ...CLIOnly, ...KeepsTheirs (internal/agent), TestCodexDesktopCatalog (internal/gateway). - Broken by hand, each went red: deskList a no-op (all three agent tests), the user's-own branch removed (KeepsTheirs), the gone-file branch removed (KeepsTheirs), the keep-last-good rule broken in codexDeskRefresh (TestCodexDesktopCatalog). - go test -tags nogui -timeout 45m ./internal/agent ./internal/gateway ./internal/provider ./internal/cli at bc0a99bb6 (on |
||
|
|
ca8a6f346a |
agent: a renamed routing group moves its agents, and the Codex app reloads a changed catalog
lucis0116 on X: renaming a provider or a group in magpie didn't reach
every agent.
Display names already reached the agents' files: store and SaveGroup
drop the catalog, and SyncCatalog writes the new "<model> · <name>" and
"<group> · routing group" labels into Codex's model_catalog_json, Claude
Code's picker, OpenCode and Pi (checked in a sandbox HOME). Two gaps
were left:
- A routing group given another id (Routing page, `magpie groups
rename`, TUI) left every agent on group/<old>, which magpie no longer
has. The CLI even said "agents set to group/from need group/to now".
agent.RenameGroup now moves each agent field on group/<old> to
group/<new>, spelled as the agent spells it. It goes through
renameRefs, the move RenameProvider already made, now shared by both,
then SyncCatalog. The GUI, CLI and TUI call it in place of
provider.RenameGroup.
- The Codex app's own app-server reads model_catalog_json only as it
starts, and KeepCodexAppOnItsProvider restarts it only when
codexAppRoute changes. The route named the catalog's path, not what
the file holds, so a renamed provider or group, or a model added,
stayed on the old list until the user quit the app. The route now
carries a hash of the catalog's bytes (codexCatalogTag, read again
only when the file's size or time changes). The restart goes through
the existing idle gate: no Codex request in flight, 10s idle, no turn
open. A write of the same bytes is no change.
Run, in a sandbox HOME only:
- TestRenameGroupMovesTheAgentsOnIt (new): Codex, Claude Code, OpenCode
and Pi on group/smart, renamed to clever: each said moved and each
file on group/clever, none naming group/smart.
- TestCodexAppRouteFollowsTheCatalog (new): the route changes when a
renamed provider rewrites the catalog, and stays put when the same
bytes are written again.
- Broken by hand: RenameGroup's match turned off makes the first test
red (no agent moved, every file on group/smart). The catalog line
dropped from codexAppRoute makes the second red ("a provider renamed
left the Codex app's route as it was").
- At aded9beea (base
|
||
|
|
7f827b3b0b |
claude: magpie claude-code runs lists the Claude Code processes and says what they are
@Candydidi3 on X: with Opus in Claude Code, "magpie里拉起很多子进程". On a Claude account each conversation is answered by a real Claude Code (`claude -p`) with magpie's MCP helper (`magpie claude-mcp-helper`) as its child. Claude Code's parallel subagents are conversations of their own, so a session that starts N of them has N pairs running. idleMost (6) pairs are kept for an hour so the next turn reads the prompt cache, and runs waiting on tool calls stay up to 30 minutes. On macOS and Windows nothing bounds the total unless the user sets `magpie claude-code runs N`. A task manager names them "2.1.311" (Claude Code's binary is named by its version) and "magpie", and nothing told the user what they were. No leak was found. With the bridge's fakes, 12 concurrent conversations left 6 runs when they ended their turns, 12 when they were parked on tool calls and never answered (bounded by the 30-minute timer), and 0 right after they were cancelled. Real Claude Code 2.1.311, run with the bridge's args, exits within 0.1s of stdin EOF and when its parent is killed, and its helper exits with it. So nothing about which processes run changes. They become visible instead: - GET /v1/magpie/claude-runs (claude_runs.go) lists each run with its pid, model, account, state (answering, idle for its next turn, or waiting on tools), since when, when magpie lets it go, and its RSS, plus claudeRoom's live count. It is loopback only, refused like the heap profile, and served no-store. - `magpie claude-code runs` prints that list under the bound and says what the processes are and how long they are kept. - runs record when they started, when the current turn began, and the timer's deadline (endIn wraps every timer.Reset). The literal 30-minute timeouts become runTimeout. Tests: - TestClaudeRunsNamesEachProcess: idle, tools and answering runs are listed with the pids that are alive, and dropped once they end; every caller profileCallersRefused lists is refused. It went red with the route taken out (404), and with the guard off 3 callers got the list. - TestClaudeCodeRunsListsTheProcesses covers the CLI's lines and the case with no magpie running. The existing CLI test now stubs the gateway, so it never asks the live magpie on :3425. - oneport_test knows ClaudeRunsPath. Real run (10-27): a sandbox HOME with a made-up Claude sign-in in its own CLAUDE_CONFIG_DIR (no keychain item was written for it), `magpie serve` on 127.0.0.1:47820, and a `claude` wrapper that exec'd real Claude Code 2.1.311 against a mock Anthropic API. 8 concurrent subagent-like requests left 6 Claude Code, each with its helper. `magpie claude-code runs` listed the same 6 pids ps showed, idle, ends in 59m, about 160 MB each. SIGTERM to the sandbox serve ended all 12 within a second. Run (go1.26.8, -tags nogui, private GOCACHE): - At 184b4b8ba (this change on origin/main |
||
|
|
e4552cca9f |
library: a cargo RTK upgrades on Windows, and says why when it can't
新v学员 (Discord #feedback, 10-27): upgrading an RTK installed with cargo
failed silently on Windows. Four causes, each fixed:
- No cargo on magpie's PATH (magpie started before Rust was installed,
or from a shortcut whose PATH rustup never touched): rtkUpgrader gave
no upgrade, so Upgrade was greyed with only a tooltip, which a click
never shows. Now the cargo rustup put beside rtk is run by its path;
with no cargo anywhere, the card (and the CLI) says it was installed
with cargo, to install Rust from rustup.rs or run the command shown
(RTKView.NoUpgrade, Manual), and UpgradeRTK's error says the same.
- CARGO_HOME (D:\Rust\.cargo is common) moved cargo's folder: an rtk
there wasn't cargo's to magpie. cargoBins reads it, for finding rtk
and for the upgrade; on Windows the folder matches whatever its case.
- cargo install --git built rtk-ai/rtk's default branch, develop, whose
Cargo.toml says 0.49.0 while v1.1.0 is out from master: the upgrade
left rtk as it was, or older, on every OS. It now names --branch
master, as rtk's own installation guide does.
- Windows refuses cargo's move over a running rtk.exe ("failed to move
… (os error 5)", exit 101, after the whole build), and an agent runs
rtk for every command. On that refusal the rtk is renamed aside
(rtk.exe.old-<pid>, which Windows allows), a copy put in its place,
and cargo run again; its build is kept in magpie's CARGO_TARGET_DIR,
so the retry builds nothing. Old copies are removed on the next
upgrade.
A failed cargo now says its first error with the cause, and what to do
for the common ones (rtk in use, link.exe/dlltool missing, GitHub
unreachable), not its last three lines, which only said the build
failed and where its files were left.
Run:
- Real Windows (10.0.0.132, sandbox CARGO_HOME/RUSTUP_HOME/USERPROFILE,
rustup + cargo 1.99.1, removed after): plain cargo install over a
running rtk.exe fails with "拒绝访问。 (os error 5)" exit 101; a
Windows build of this package's tests (GOOS=windows go test -c, a
scratch test calling ReadRTK/UpgradeRTK, not committed) with no cargo
anywhere gave NoUpgrade "cargo" and the new error; with cargo only
beside rtk (not on PATH) and the old rtk.exe running, UpgradeRTK
built rtk-ai/rtk master and went 1.0.0 -> 1.1.0 in 3m26s, the running
rtk kept running, rtk.exe.old-<pid> was left and removed once it
exited. The build used the gnullvm toolchain with llvm-mingw; the
gnu toolchain failed with "error calling dlltool" and lld's missing
-lgcc_eh, which is the output the tests use.
- New tests (rtk_cargo_test.go) and the updated
TestRTKUpgradeCargoNamesThePackage are red on origin/main
(
|
||
|
|
2afacd7d18 |
windows: a terminal waits for magpie, through a magpie.com beside the app (#3737)
The Windows app is linked with -H windowsgui so a double click opens no console, and PowerShell and cmd don't wait for a GUI program. The prompt came back before magpie printed, and `magpie plugin login`'s password keys went to the shell as well as to magpie (tom047784 / TomXPRIME on Discord, 10-27; the handle error in the same report was |
||
|
|
3ec3cb704b |
plugin: turning an agent plugin off or removing it puts the agent's config back first (#3810)
An agent a plugin adds is known only while the plugin is on. Turning the plugin off or removing it (CLI `magpie plugin off/rm`, or the Plugins page) left the agent's config on magpie, and `magpie <agent> default` then said `unknown agent`, with nothing to put it back. - provider.SetPluginOff (off) and provider.RemovePlugin first call provider.PluginAgentGoing, set by internal/agent to UnwirePlugin: the agent is disconnected as `magpie <agent> default` does (Disconnect), while the plugin still loads. A plugin off already is read from its module as it is; one whose module is gone puts back each file whose stash names its spec. If that fails, the plugin is left as it was and the error says why. - The stash now records the plugin's spec and the file's format, so `magpie <id> default` for the agent of a plugin deleted on disk puts the file back from the stash alone (agent.RestoreGone; an older stash's format comes from its file's name, agentplug.FormatOf). A file that no longer holds magpie's gateway key is the user's and is left alone; one that can't be read is unknown: nothing is written, the stash is kept. With the plugin only switched off, `default` says the agent is off magpie already instead of "unknown agent". - Turning the plugin back on (or installing it again) does not rewire the agent by itself: its config stays as the user had it. Connecting it (its switch on the Agents page) puts back the model it was on, through Disconnect's `.reconnect`. The CLI says so when it turns off or removes a plugin whose agent was on magpie. Run (this change on origin/main |
||
|
|
9ae7912210 |
agent: plain agy starts Antigravity CLI on magpie in a new terminal
agy takes magpie's gateway, key (GEMINI_API_KEY, GOOGLE_GEMINI_BASE_URL)
and --model only from how it is started, so a user on magpie had to copy
the launch command at every start (bestony on Discord). Now:
- magpie agy run [args…] execs the real agy with the env and --model when
agy's settings.json is on magpie's model (a --model/-model the user
gives wins), and runs agy untouched otherwise. On Windows agy is a child
through proc and its exit code is passed through. It refuses when "agy"
on PATH resolves to magpie itself. magpie agy env prints what run adds
(PowerShell's function reads it, since the desktop exe has no console).
- update.ShellFunction puts a function named agy in a marked block
(# >>> magpie agy >>> … # <<< magpie agy <<<) of each shell profile
cliShells finds: .zshrc (ZDOTDIR), the bash profile a terminal reads
(.bash_profile, or .bash_login/.profile on macOS when that is missing),
config.fish once its folder exists, and the PowerShell 7 / Windows
PowerShell profiles where the execution policy runs them. Only the block
is written, in place, temp-and-rename, CRLF and BOM kept; a profile that
can't be read is not written; only files inside the home are. The
function falls back to `command agy` when the magpie it names is gone.
- Set to a magpie model writes the block, stepping out takes it out (the
file comes back byte for byte), and Sync at start writes it for users
already wired.
- Notice, Launch tooltip and the connect panel say plain agy works in a
new terminal, with the command for a terminal open now. Strings in
i18n.js for zh, zh-TW, ja, de. docs/reference.md and
docs/subsystems/agent-wiring.md updated.
Run at this head (base
|
||
|
|
a3d4f8c5c4 |
cli: magpie serve and magpie web give what they start the user's node too (#3803)
|
||
|
|
1885c607e2 |
gateway: Antigravity answers Codex's switched threads and Hermes' old persona with no setup
Antigravity answers some agents' system prompts with a fake 429 "Resource
has been exhausted", whatever quota is left. Jodiezzzzzz on X (10-27): a
Codex thread begun on GPT-5.x and switched to an Antigravity model got 429
again and again. zgoodz on X: "antigravity在Hermes里一样429". v0.1.1625
told the Codex case as a 400 with "start a new chat", which isn't zero
setup.
What Google matches, each tried on a real Antigravity account on 10-27
(in the system instruction, any case):
- "x-anthropic-billing-header:" (Claude Code)
- "built on Anthropic's Claude Agent SDK" ("running within the Claude
Agent SDK" goes through)
- "You are Codex, an agent based on GPT-5" / "..., a coding agent based
on GPT-5"
- new: "Hermes Agent, an intelligent AI assistant created by Nous
Research", Hermes' earlier default SOUL.md, kept by anyone who edited
their SOUL.md. Hermes' current default ("You are Hermes Agent, built by
Nous Research") goes through.
Each goes through with a zero-width space after its first letter.
"You are Hermes Agent, an intelligent..." still fails, so the
break goes inside the matched phrase itself.
Now codeAssistBody puts that zero-width space into each matched line
(antigravityCloak), in the system instruction only, and only for an
Antigravity account. Gemini CLI's account on the same envelope, and
every other provider and protocol, get the prompt as the agent wrote
it. The text added names nothing; it is one U+200B per line.
`magpie provider set antigravity prompt=as-written` (PromptAsWritten,
kept through Save/withPicks and the GUI's save) turns it off. Then the
v0.1.1625/#2156 fallback stands: a 400 with a hint (now one for Hermes
too, in the Routing page's five languages) and Antigravity skipped for
6h in a group.
Default-on, as the community antigravity-cloak middleware's README
says, changes what Google is sent so a request it means to refuse goes
through. That may be against Antigravity's terms. The owner asked for
it ("破解过 antigravity 提示词让其可以在别的 agent 中使用"), and it is
scoped to Antigravity accounts with an off switch.
Run at this tree (rebased on origin/main):
- go test -count=1 -timeout 45m ./internal/gateway/ ./internal/provider/
./internal/cli/ ./internal/gui/: gateway, cli and gui ok; provider
died in TestUnreadLoginsWriteErrorsKeepCredentials ("close of synctest
channel from outside bubble" in filememo.Forget), #3632, red on main
since 091153bf; with -skip of that test, provider ok.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...: ok. go build: ok.
- GUI (node --test, Playwright 1.62, chromium and webkit):
routing-ag-turned-away, i18n-keys, gui-ja, gui-de, gui-zh-tw,
routing-js, panel-routing: 45 pass, 0 fail.
- Broken by hand: with the cloak skipped, TestAntigravityAnswersHermes
AndCodexByDefault and TestOnlyAntigravityIsSentThePromptBrokenUp go
red; without withPicks' line, "prompt=as-written isn't kept".
- Real account, sandbox HOME with only the Antigravity login copied,
this build on 127.0.0.1:3496:
- real Hermes Agent (AIAgent, sandbox SOUL.md = the old persona plus
one line): "OK", 200. With prompt=as-written: 400 with the Hermes
hint. Back on default: 200.
- real Codex 0.162.1: a thread begun on gpt-5.5 (against a local
fake Responses server), then `codex exec resume <id> -m
antigravity/gemini-3-flash` through this build: "OK". With
prompt=as-written: 400 with the Codex hint.
- a synthetic switched Codex Responses thread, with and without
web_search: 200.
- opencode, droid, kimi, pi, gemini-cli, qwen, crush, goose, amp and
openclaw identity sentences: never refused, as written.
Not tried: Claude models on Antigravity (the sandbox account's Claude
quota is spent, so the Claude Code lines were checked on Gemini 3
Flash only); other agents' whole prompts, only their identity lines;
the Windows box; the whole GUI suite.
The plugins repo's antigravity-cloak 0.1.2 adds the Hermes line for
magpies before this one.
|
||
|
|
d56c14e953 |
gateway: a single provider's busy or briefly rate-limited reply is waited out, for its own Patience (zoecats)
zoecats on Discord: a request to one provider (not a group) got a local
relay's short 429 straight back in Claude Code once the few same-one
retries were spent. A group would have held the agent and asked again.
A plain provider now takes the group's replan path (patience.go: replan,
pauseAlive, the held writer) once passing's same-one retries are spent:
its accounts take turns as members do, each pause never shorter than the
Retry-After, and a streaming agent gets keepalives past keepHeldAfter.
- Zero-config: unset, it waits singlePatience, PatienceDefault (60s),
counted from when the agent would have had the error.
- The user's value wins: Provider.Patience, the same values as a group's
Patience, set with `magpie provider set <id> patience=2m|off|default`
(at most 4m). The provider editor has no row for it (no new UI), and its
save keeps it. A group the provider is in keeps the group's own.
- Not retried: a Retry-After past the budget, quota/credit/plan limits,
401/403, refusals, response protection, didNotStream, and an agent
that has gone (499, try marked Gone).
- The try is traced with Again alone, so the Routing page tells it as
"tried again in …".
- codexReset (ChatGPT's 503 for a large request) is left out of the
plain-provider replan, so Codex still gets its 503 with advice.
- Codex's own one-account relay (codexUpstreamOn) does not join. It is
relayed outside the candidate loop, and its backend 429 is always the
plan's usage limit (codexBusy never retries one), so the short rate
limit this waits out doesn't arise there. Its overloads keep
lastRetries and then fallbacks.
longestPause became a var so tests can scale it. Tests updated for the
new count (1 + retries + replanRounds when it never clears):
- TestLastOneLeftIsTriedAgain
- TestRateLimitIsWaitedOut
- TestQueuedStreamFailureIsTheStreamsError
- TestOverflowTheVendorDidntSay
New tests, through the server with a fake upstream and injected
durations, waiting on trace state, not a duration:
- TestSingleProviderWaitsOutAShortRateLimit (stream and whole: 200,
keepalive before the answer, asked twice)
- TestSingleProviderPassesALongLimitThrough (an hour, quota, 401)
- TestSingleProviderAgentGoneInTheWait
- TestSingleProviderOwnPatienceWins (off, shorter and longer than the
default)
- TestPatiencePair (cli)
- TestProviderSaveKeepsPatience (gui)
Broken by hand, each red, then restored:
- singlePatience fallback 0 for a plain provider: WaitsOut stream and
whole got 429, and AgentGone never paused.
- replan's budget check off: PassesALongLimitThrough/an_hour, "magpie
waits to ask again".
- pauseAlive's ctx.Done case removed: AgentGone, "route done false
status 0".
- The gateway ignoring Provider.Patience: OwnPatienceWins off, shorter
and longer all red.
- The GUI save not keeping Patience: TestProviderSaveKeepsPatience,
"patience 0 … want -1 kept".
Run in this tree, before the rebase:
- go test ./internal/gateway ./internal/cli ./internal/gui: ok.
- ./internal/provider: ok with -skip TestUnreadLogins. That test crashes
with "close of synctest channel from outside bubble", the known #3632,
in filememo and not touched here.
- gofmt -l: clean.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go
vet ./...: all 0.
- go build for darwin, linux (nogui) and windows: ok.
Run again after rebasing on origin/main
|
||
|
|
d9a8148d7c |
routing: Speed first sends a request to the provider or key that answered the model fastest lately
joeliu96872540 on X: when one model is reachable through several API
channels, they want an option that sends each request to whichever has
been answering fastest, because they compare channel speeds by hand
today. Speed first (`fast`; `fastest` and `speed` also work) is a new
routing beside Free first. It applies to a provider's keys and accounts
(provider editor › Routing) and to a group of one model on several
providers (Routing page › group › Routing).
How it decides. When a streamed answer ends, gateway/speed.go records two
numbers for that account or key and model (restID): the time to first
token and the output tokens per second, as usage.DecodeOf computes them
for the Requests page. Each is a decayed average with a 20m half-life.
After an hour with no answer the record goes stale, and the store holds
at most 4096 records. This is O(1) at the answer choke point, beside
servedCandidate. For a pool routed by BySpeed, weighRouted reads one map
entry per candidate, and only for that pool. The usage history is never
read on a request.
routes.Fastest ranks each awake seat by its estimated time to a
200-token reply: TTFT + 200/TPS. A seat that reported no TPS gets the
median TPS of the others. Seats within 10% of the fastest in their band
keep their listed order, so near-ties don't swap on every request.
Seats with no recent measurement go after the measured ones. One request
in five, counted per pool, goes first to an unmeasured seat, rotating
among them, so each gets measured again. Resting seats go behind the
awake ones, and used-up seats behind those. Rests and failover are the
same as for every other routing.
The request trace gets lateTtft and lateTps, and the row-story sentence
says "answered m fastest lately: first token in 0.8s, 60 tokens a
second". It has a variant for a probe turn and one for when no seat has
been measured yet. i18n covers zh, zh-TW, ja and de. Also updated: the
CLI (`magpie group|provider set <id> routing=fast`, plus a new
`routing=` pair on provider set that refuses manual), the TUI name, the
rotation plugin's Sub, docs/subsystems/gateway-routing.md,
plugin-runtime.md, docs/reference.md and site start.html (en, zh, ja).
There is no new layout: it is one more item in the existing pickers.
app.js stays under its budget with no raise.
Tests:
- routes/fastest_test.go:
- ordering: fastest first, slow writer loses, alike keep order,
resting and used-up, median pace, none measured;
- the probe turn at 5, 10, 15 and 20, rotating between seats;
- a resting seat never gets a probe turn.
- gateway/speed_test.go:
- decay, staleness and per-model records, with an injected clock;
- a group of slowv and fastv routed fast: after the speeds are
measured and seeded, the request goes to fastv with lateTtft set;
- the same group routed in order still goes to slowv.
- cli: parseRouting and the provider routing= pair.
- GUI routing-speed-first.test.cjs: the row story for measured,
no-pace, probe and none, in en, zh, zh-TW, ja and de, in chromium and
webkit: 40/40.
Broken by hand:
- Fastest returning the listed order: the routes tests and the gateway
group test go red.
- noteTrySpeed removed: "the streamed answer wasn't measured".
- The client.js case renamed: routing-speed-first 0/20 in chromium.
Run at b5a5caff2 (base
|
||
|
|
5b4dec58e4 |
providers: a vendor's keys saved a provider each are one provider with those keys
yuluo_yx on X: "NVIDIA #595"…"#600" at integrate.api.nvidia.com and "Mistral #0001"… at api.mistral.ai were a provider each on the Providers page and a row each on Routing, and with thousands of keys magpie started slowly. They came from an app that keeps an entry a key (CC Switch) imported in one batch: ImportFromApps only offered "add as another key" against providers that existed before the batch, so each entry became a provider of its own (nvidia, nvidia-2…). Fold (internal/provider/fold.go): - FoldCopies runs in startUp, before anything lists the providers, so every user who has such copies already finds them folded. Automatic, not a one-click offer: they are the same account's keys at the same address, what the user wanted is one provider (zero-config rule), and nothing is lost: each copy's id goes in the provider's Was, so its calls count with it by key (ProviderKeyID is the key's fingerprint, unchanged) and a model picked by the old id still resolves. - Only copies by name fold at start-up: a base name and that name with a number after it (" #12", or freeName's " 2"), at least one numbered. They must also be alike in all but the key: the provider with id, name, keys and on/off left out, their per-model settings, and every place that names them (Visible, picked/hidden/ordered models, groups, fallbacks). A copy shown to one agent alone, given its own models or settings, or named by the user ("Home relay" / "Work relay") stays apart. Subscriptions, hidden ones, Vertex and StepFun-signed ones are never folded. - The first copy that is on takes the rest; it is named the base name ("NVIDIA") and its key keeps its old name. Others become keys in the providers' order, named as they were, off if they were off. - Group members, weights, rules, classifier, pick and fallbacks name the provider once; per-model settings and fetched lists of the folded ids go; balance and window history kept by their id moves to their key's name, where a provider with several keys reads it. - A providers.json that doesn't parse is left alone (read() would have given its .bak, and a fold would write that over it). - ImportFromApps folds what one import added by shape alone, whatever the entries are called. Routing needed no change: a provider's keys for one model already fold into one row ("2400 keys"), opened on click (FOLD_AT, #1319). Numbers, sandbox HOME with 2400 NVIDIA + 600 Mistral copies (gen.py, NVIDIA preset + 2 models, Mistral 15 models), `magpie web`, every outgoing request through a dead proxy: - before (origin/main |
||
|
|
9298d2a7c3 |
cli: prompts read the stdin Windows' console init reopens, not the one package init saw
tom047784 (Discord, Windows desktop build): `magpie plugin login` in a
terminal failed with "read /dev/stdin: The handle is invalid". The
desktop build is a GUI-subsystem binary; console_windows.go's init
attaches the parent console and reopens CONIN$/CONOUT$ into os.Stdin,
os.Stdout and os.Stderr. But `var stdin = bufio.NewReader(os.Stdin)` in
backup_cmd.go is a package variable, set before any init runs, so it
kept the invalid handle.
That one reader serves every CLI prompt, so all of them broke the same
way: plugin login (askPrompt, askNumber, the code and pasted callback
lines), backup/WebDAV passphrases and passwords piped in (secret), the
library and quota confirmations. stdin is now a func that makes the
reader over os.Stdin as it is when read, and remakes it if os.Stdin
changed; one reader still serves a run, so a second piped secret is
still the second line.
Sibling of the same class: lipgloss's default renderer (termenv's
default output) is made over os.Stdout at its package init, before the
reattach, so the desktop build's CLI printed every style without colour.
The init now points that renderer at CONOUT$ in place; the styles made
at package init hold it. A grep for package-level os.Stdin/os.Stdout/
os.Stderr found no other one in the repo (writers like fmt.Println and
json.NewEncoder(os.Stdout) inside functions resolve at use time).
webdav_cli_test's piped() swapped both os.Stdin and the reader, which is
why no test caught this; it now swaps os.Stdin only.
Run (at this tree, worktree off origin/main
|
||
|
|
4a33cf0a98 |
update: a Stable channel in Settings → About, and magpie update channel
ssharpcc on X reads every changelog before updating, for fear of a ban
when behind, and with many releases a day that is a lot of reading.
Settings → About → Update channel (zh: 更新渠道, 稳定版 / 每个版本) picks
Every version, the default and today's behaviour, or Stable: one version
a week, the newest that had been out three days as the week began
(Monday 00:00 UTC), and an urgent release at once. usemagpie.ai chooses
it from the release list (the previous commit); a release is urgent when
a line of its notes starts with "**Urgent release:**", which
magpie-releases' release run writes from an `Urgent: <why>` trailer
(magpie-releases 73f6cff).
- settings: updateChannel, "" or "stable"; anything else is refused.
- update: on Stable the feed is asked with channel=stable; What's new
shows every release since the installed one (up to 1500) instead of
the newest 40, so a week's notes read as one list.
- gui: the row is segs, never a <select>; a save that doesn't send the
channel keeps it; switching asks the feed again at once, and a
download from every version newer than Stable's pick is dropped,
never restarted into. What's new's notes are kept per channel.
- cli: magpie update channel [stable|every] ("all" too), and it says
which with nothing after it.
- docs: reference.md's Update channel (the rule and the marker); the
privacy pages (en, zh, ja) name ?channel=stable on /api/latest.
The full Go and GUI suites were not run: the disk was at 3 GB free and
other sessions had GUI suites and a 45-minute gateway run going the
whole time.
Run, at this tree before the rebase:
- gofmt -l (clean); go vet on darwin, GOOS=linux -tags nogui and
GOOS=windows for ./internal/update/... ./internal/cli/...
./internal/settings/... ./internal/gui/.
- go test -count=1 ./internal/update/... ./internal/cli/...
./internal/settings/...: ok. ./internal/gui -run
'TestUpdateChannelSwitch|TestWhatsNewKeyedByChannel|TestCoreScriptBudget':
ok (the app.js budget passes).
- GUI, chromium and webkit: update-channel (22: en, zh, zh-TW, ja, de at
900 and 420 wide: default lit, Stable saved, kept by another save,
kept over a reload, Every saved back, no click scrolls, no sideways
scroll at 420), i18n-keys, gui-ja, gui-de, gui-zh-tw and every
update-*.test.cjs: 253 of 253 pass.
- The live feed: /api/latest?channel=stable answers 0.1.1327 (out
2026-10-22 21:55 UTC, the last before Friday 10-23 00:00) with 15
assets after the first real cron run filled the ledger (400 releases
back to 10-10); /api/notes 0.1.1200..0.1.1327 gives 124 notes, none
empty (1213 and 1218 were never published).
After rebasing on
|
||
|
|
ea1f9492bc |
cli: magpie tools lists, and magpie tool calls, the tools magpie's MCP servers give agents (iwinux)
iwinux on Discord (#feedback) wanted magpie's image generation, image recognition and web search without going through an agent's MCP, and had written a Python script for generate_image. magpie now has it: magpie tools [<name>] magpie tool <name> [--<param> <value>…] [<words>…] [-o <file|folder>] [--json] Both ask the running gateway's own MCP servers (gateway.OwnMCPServers: image, vision, web-search, plugin tools) over HTTP, with the local token and the magpie-tool/1 User-Agent, so the tools, schemas, models from Settings and usage counting are the ones an agent gets. Nothing is started besides (#3318: the cases sit before startUp, beside mcp). - Parameters are read against the tool's inputSchema: types (integer, number, boolean, array given once per item, object as JSON), enum, - and _ alike, --p v or --p=v. The words left over are the tool's one required text, else its prompt. An unknown flag or parameter, a missing required one, a bad value, a value given twice or both words and the same --param are refused with "nothing was called"; no request is sent. - A file path a parameter takes (its description says file and path) is made absolute, since the gateway doesn't know the current folder. - --help prints toolUsage (static): help is handled before anything runs. - A still-being-made answer is waited on with generation_result (1s between asks, 30 min at most). The gateway's image server now says so in _meta too: usemagpie.ai/pending is the id, usemagpie.ai/files the files made ({url, inline}); an older gateway is read from its text. - Images and videos are saved through imagemcp.Target (now exported): -o file or folder, else the current folder named from the prompt, numbered when more than one, never over a file that is there; a file not inline is downloaded by its path from the gateway asked (the token goes nowhere else). --json prints the raw answer and saves nothing. - No magpie at the address: "magpie isn't running at <url>: open the app or run magpie serve". MAGPIE_GATEWAY=<url> points at another. Docs: usage lines in magpie help, docs/reference.md (Use), the gateway routing subsystem page (_meta and the CLI), README en/zh, site docs start page en/zh/ja. Tests (internal/cli/tool_cli_test.go, never the network; every test sets MAGPIE_GATEWAY to its own httptest server): - TestToolsListsTheServersTools, TestToolReadsParameters, TestToolRefusesWhatItDoesntKnowAndCallsNothing (no tools/call, no file), TestToolHelpCallsNothing (no request at all), TestToolSavesTheImage, TestToolWaitsOnWhatIsStillMade (pending _meta, then the old text form, download with the key from the gateway asked, not the URL's host), TestToolErrorIsSaid, TestToolSaysMagpieIsntRunning, TestToolDrawsThroughTheGateway (the real gateway.New().Handler() with a fake vendor: lists, draws, saves the vendor's PNG). - TestImageMCPDrawsAndServesTheImage, ...SlowDrawingIsWaitedOn and ...MakesVideos now check the _meta. Red on the old behaviour: with withMeta setting nothing (what main answers) all three fail ("_meta map[], want pending img_…"). - Broken by hand: dropping the unknown-parameter check makes TestToolRefuses… red (the --model call was made); saving an inline image by its URL instead makes TestToolSavesTheImage red. Both restored. - TestHelpOnEveryCommandDoesNothing covers tool and tools. Run with this change on origin/main |
||
|
|
a1174674da |
codex: subagents and memories follow the session's magpie model; auto-review can too (cybercaius on Discord)
Codex's side calls ask for one of Codex's own models by its bare name
whatever the conversation is on: a subagent goes on the model the lead
names in spawn_agent, memories on gpt-5.6-luna/terra, auto-review on
codex-auto-review. With Codex signed in to ChatGPT and the conversation
routed onto one of magpie's models, each of those went to the ChatGPT
account instead (cybercaius: "can't pick follow the main model").
- gateway (codexFollowTo, codexLeads): a collab_spawn or memory call
that asks for a bare model, with nothing set for it (no magpie
subagent model, no [agents] default_subagent_model, no [memories]
extract/consolidation_model in Codex's config), goes on the model its
conversation's own turns go on (parent thread, own thread, else the
key's last turn), when that is a magpie model the key may use. A task
the ChatGPT backend sealed stays on ChatGPT. The trace shows a
subagent's pick as {asked -> to}.
- agent.CodexSideSet reads Codex's config.toml for those keys; an
unreadable config counts as set (leave as sent).
- Auto-review gets "Same as the session" (settings value "session"):
codexcat writes each magpie entry's own id as its
auto_review_model_override. Not the default: codex-auto-review runs
free on a ChatGPT sign-in (#1593).
- GUI: the option in all languages; Memories' default text says it
follows the session. app.js stays under its budget by folding five
identical writingPrefs then/catch chains into prefWrite.
Ran (sandbox HOME, -tags nogui -count=1 -timeout 45m):
- go test ./internal/gateway ./internal/agent ./internal/codexcat
./internal/settings ./internal/cli ./internal/gui: ok.
./internal/provider: FAIL with "close of synctest channel from outside
bubble" in filememo.Forget (TestUnreadLoginsWriteErrorsKeepCredentials),
which is #3632 on main; this change touches nothing there.
- TestCodexSubagentFollowsTheSession and TestCodexMemoriesFollowTheSession
go red with codexFollowTo returning "" (broken by hand).
TestCodexSideCallsKeepTheConfigsModel, TestCodexSideCallsStayOnChatGPT,
TestCodexSideSet, TestCodexAutoReviewFollowsTheSession pass.
- GUI (playwright 1.62.0, chromium + webkit): codex-auto-review (en, zh,
zh-TW, ja, de), codex-memories, codex-memories-settings, codex-titles,
codex-predictions, codex-descriptions, settings-general, agent-prefs,
i18n-keys: 120/120 pass. TestCoreScriptBudget passes, budget unchanged.
- gofmt -l clean; go vet -tags nogui for linux, windows and darwin ok.
Again after rebasing on origin/main
|
||
|
|
41b0445ccf |
provider: a local server's address is a field shown first, and address= on the command line (LM Studio on another computer)
mengxiangziyou on X: "供应商里的LM Studio只能用本地的,怎么用局域网里其他机器 上的LM Studio, baseUrl 不能改". Moving a local preset (Ollama, LM Studio, oMLX, MLX-Serve) to another host has worked since #1165, but the window put the Address in a "Server address" fold under the key, while the Endpoints row showed http://localhost:1234/v1 as plain text. Reproduced in a sandbox: Add > LM Studio shows the URL and nothing to change it with unless the small fold is found. - GUI: the Server address field is shown first, above the key, never folded, for a new provider and a saved one alike (its label and hint are the strings the fold used, so no new i18n keys). Saving still sends the URLs moved only when the address was changed. - CLI: `magpie provider add|set <id> address=<host:port>` moves every URL the provider has (chat, Anthropic, Responses, decision), each keeping its path; from the preset's when it was saved with none, and `address=` alone puts a local server back at its preset's. A provider of the user's own moves its own URLs. Vertex refuses it as it does url=. Before, Ollama on another computer needed url= and anthropic=. - TUI: unchanged (asked on adding, `w` after). - docs/subsystems/providers-accounts.md: Local servers row. Security: only upstream URLs move. The gateway's own loopback/origin guards are about inbound requests and don't read them; the one rule that looks at an upstream being on the LAN (Unredacted) stays the user's own switch. Run at this tree (origin/main |
||
|
|
fba554c7f8 |
library: magpie library mcp add without agents= says the server went to no agent
A server added with no agents= is kept in the library and given to no
agent, but the command printed "✓ every agent already has it". It now
says "<name> is in the library, given to no agent yet" and names
`magpie library mcp agents <name> <a,b…>`. With agents=, and for
`mcp agents`, the output is as before ("written into claude").
Found while trying the magpie-setup skill's commands in a sandbox HOME.
Not changed (#3598): `library instructions set` with no agents chosen still
prints "every agent already has it" while no agent is given it.
Instructions have sets, so its check needs the active set's agents.
Run: go test ./internal/cli -run TestLibrary -count=1 ok; the new
TestLibraryMCPAddNoAgents fails on the old library_cli.go (reverted by
hand: "✓ every agent already has it") and passes with it. go vet
./internal/cli and gofmt -l clean.
|
||
|
|
6bffcfe178 |
gateway-key: a key's monthly limit can be set from the CLI again
`magpie gateway-key limit <id> month --cost 5` (and `add month`) failed with "an N-hour cycle is a whole number of hours …: \"month\"": parseKeyLimit cut an h off any window ending in one before it looked for a named period, and month ends in an h. A named period (day, week, month) is now taken as itself before the <N>d and <N>h forms are read. Found while trying every command for the magpie-setup skill in a sandbox HOME. Run: go test ./internal/cli -run TestGatewayKey -count=1 ok; the new month cases in TestGatewayKeyLimitCLI fail on the old parseKeyLimit (reverted by hand) and pass with it. Tried the built binary in a sandbox HOME: limit <id> month --cost 5 sets "this month". |
||
|
|
c888ef2725 |
routing: a rule's hours are kept in the zone they were set in (gaubeebangeel on X)
magpie on a cloud server in UTC read a routing group's rule hours on the
server's clock, so a Beijing user's 09:00-18:00 held at 17:00-02:00
Beijing time, with nothing saying so.
- provider.TimeWindow carries the IANA zone its hours were set in
("zone": "Asia/Shanghai", omitempty). Holds reads From, To and Days in
that zone (time.LoadLocation, cached; Go's embedded tzdata, so Windows
knows them too). A window with no zone, every one saved before this,
stays on magpie's own clock (time.Local) as before. A zone magpie
doesn't know is refused on save (clean); one in a file edited by hand
makes the window never hold, so the rule is as if absent, never always
on and never hours off. Text() adds " (Zone)"; Line() writes tz=.
- GUI: changing a rule's hours or days in the editor saves the browser's
zone (Intl resolvedOptions().timeZone); hours left alone keep theirs.
/api/groups gives magpie's clock (clock: zone, offset in seconds), and
when its offset differs from the hours' zone the Routing page tells the
zone beside them, on the group's rules and in the editor: "Asia/Shanghai
time" (zh "Asia/Shanghai 时间"), or "server time, UTC+0" (zh "服务器时间
UTC+0") for hours with no zone. Nothing is added when the clocks agree.
zh, zh-TW, ja, de.
- CLI and TUI: time=09:00-18:00@Asia/Shanghai or tz=Asia/Shanghai; with
none, this computer's zone ($TZ, time.Local, the /etc/localtime link)
when it has an IANA name, otherwise none (magpie's clock). An unknown
zone is refused with what one looks like; tz= alone needs time= or
days=. Usage text updated.
- docs/subsystems/gateway-routing.md: the zone rules.
Older magpie reading a shared or synced group ignores zone and reads the
hours on its own clock, as before.
Run in a sandbox HOME with pinned Go caches, first at base
|
||
|
|
1dfa284840 |
usage: a plugin's row of text alone shows its text, not "· 100% left"
AutoClaw's 积分余额, Cline's balance, Cursor's Auto + Composer note and
the other plugin rows that are only words come to magpie as a window set
aside with a display and nothing counted (used 0, no amount, no limit).
Every surface read that used 0 as a share: the usage card said
"1,234 积分 · 100% left" (or "· 0% used") beside an empty meter, the
panel drew an empty ring, the TUI an empty bar, `magpie accounts` and
`magpie quota` "积分余额 0% (1,234 积分)", and the status line
"积分余额 0%".
provider: QuotaWindow.Text (json "text") marks such a row in
quotaOfPlugin: aside, a display, used/amount/limit all 0. Aside is
required: Cursor's On-demand "$0 / $20" isn't set aside and is a real
0%. QuotaSpan carries it to /api/quotas.
GUI (app.js): quotaText gives the display alone; the account row's
meter, the Usage page's track and the panel's rings leave the row out;
a panel card with only such rows shows their text on its line, as an
Unlimited card does. The tray's menu-bar text already skips aside rows.
TUI quotaCell, the CLI's quotaCell (accounts, quota) and statuslineCard
write the name and the text.
app.js stays under its budget (1,322,289, not raised; now 1,322,275):
to make room, the 8 copies of Math.max(0, Math.min(100, x)) are one
to100(x), and 8 one-line [..].filter(Boolean).join("\n") tooltips are
tipLines(..). Same results; the GUI files below cover those callers.
Readings cached before this release have no text flag and show as
before until the account is read again (a minute's cache, or Refresh).
Run, at this commit's tree (rebased on origin/main
|
||
|
|
c26a418d23 |
agent: an import app's status magpie can't read is unknown, not "not added"
Agent.Added now returns (added, known). Cindy's reader turned any
failure (a locked, corrupt or unreadable cindy-local-v1.db) into "Not
added", which told a user who had added magpie that they hadn't. Now
an unreadable database is unknown: /api/agents leaves `added` out and
the row shows the "confirm it there" hint, as it does for Lody. A
stopped WSL distro's app is unknown too, not "not added".
Cindy's database is also read without writing beside it. A mode=ro
open of a WAL database while Cindy was closed made cindy-local-v1.db-wal
and -shm in Cindy's own folder. It now goes through
sessions.OpenUntouched, which is what the Cursor reader already did
(immutable with no log, from a copy with one), moved out of
openCursorStore so both share it.
The CLI's list still offers `magpie cindy add` when the status is
unknown; it never said magpie was missing.
Run: go test ./internal/agent ./internal/sessions ./internal/cli ok;
go test ./internal/gui -run 'Import|Lody|Cindy|Agents' ok.
Broken by hand: Cindy's reader put back on the mode=ro open made
TestCindyHasClosedWALAndUnreadable red ("Cindy's folder changed:
cindy-local-v1.db -> cindy-local-v1.db,cindy-local-v1.db-shm,
cindy-local-v1.db-wal"); api.go ignoring `known` made
TestImportStatusUnreadableIsUnknown red. Both restored, both green.
Not tried: a real Cindy install; the read is tested on fixture
databases only.
|
||
|
|
0152f66966 |
provider: a Remote magpie's model list follows the other magpie's, fetched every 10m (6igsteven on Discord)
6igsteven (Discord, 10-24/10-25): GLM-5.3-Trial and GLM-5.3-Flash-Trial are listed on the magpie that runs the ZCode plugin, and not on the magpie that uses it as a Remote magpie. The trial entries come from the ZCode plugin once it reads the account's gift (zcode 0.1.26), and the other magpie's /v1/models lists them as it lists every catalog entry. But a Remote magpie is a provider of keys: its list was fetched when it was added and then only when Fetch models was pressed in its editor (KeepListsFresh asks only providers with a RefreshEvery, FetchNew only accounts). So anything listed there later (the trial models, a new provider, plugin or routing group) never reached this magpie. A Remote magpie with no RefreshEvery now has a 10m schedule (RemoteMagpieEvery, RefreshSchedule), so KeepListsFresh refetches it through the same Refetch as Fetch models. `magpie provider refresh-every <id> off` on a Remote magpie is kept as "off" rather than "" so the user's off isn't read as unset. CLI show/refresh-every print the schedule in force. Other providers are unchanged: no schedule means only when asked. Run: TestRemoteMagpieListFollowsTheOtherMagpie (new) with TestKeepListsFreshFetchesWhatIsDue, TestParseRefreshEvery, TestSaveKeepsTheListsScheduleAndRules: ok, sandbox HOME, Go caches pinned. Broken by hand: RefreshSchedule returning RefreshEvery alone (the old behaviour) fails the new test with "asked [], want [office]"; restored, ok. gofmt -l clean. Then, at this commit: go test ./internal/provider ./internal/cli ok (140s, 58s); go vet ./... on darwin, GOOS=linux -tags nogui and GOOS=windows ok; darwin, linux (nogui) and windows builds ok. Not run: go test ./... - the machine's disk had under 1GB free (other sessions' work) and load ~200, so a full suite would not fit. Not tried: a real two-computer setup with a live ZCode gift. A Remote magpie whose user curated its picks (left a listed model unpicked) still doesn't take new models by itself (withNewlyListed, by design). |
||
|
|
4dfd88206e |
agent: Lody on Linux is run with its import link, which xdg-open turned away (Atlas on Discord)
Atlas (Discord #help, 10-25, Linux): Lody was running, and adding it
from magpie said "failed to open uri". magpie handed the
lody://provider/import link to xdg-open, as every OS's opener.
Cause, shown with the real Lody 0.108.1 AppImage in an amd64 Ubuntu
24.04 container (Xvfb, no update-desktop-database, as on many
desktops): Lody writes ~/.local/share/applications/ai.lody.desktop.desktop
with MimeType x-scheme-handler/ai.lody.stable and x-scheme-handler/lody,
but runs `xdg-mime default` for ai.lody.stable only. lody:// then rests
on the desktop database cache, which nothing built, so
`xdg-open lody://...` answers "gio: lody://...: Operation not supported"
(rc 4) while ai.lody.stable:// opens. With update-desktop-database run,
both open. The same on GNOME and XFCE with a fake handler at that entry.
Fix: on Linux agent.OpenLody runs what xdg-open would have run, the
Exec line of Lody's own desktop entry (ai.lody.desktop, then
ai.lody.desktop.nightly, then dev.loro.lody.oss; $XDG_DATA_HOME before
$XDG_DATA_DIRS, the first file of a name decides), with %U as the link.
An entry whose program is gone, no entry, or a start that fails falls
back to the opener as before. macOS (Info.plist claims lody:) and
Windows (Lody registers lody itself) are unchanged. The GUI's
/api/open and `magpie lody add` both go through it.
Tests: TestOpenLodyRunsItsDesktopEntry and TestDesktopExec
(internal/agent), TestLodyImportRunsLodyOnLinux (internal/gui, Linux
only). The GUI test is red on the old providers.go in golang:1.26.8
docker ("the link went to xdg-open: lody://..."), green on this one.
TestLodyImportHandoff now sets XDG_DATA_HOME/XDG_DATA_DIRS to its
sandbox, and XDG_DATA_DIRS is in TestFolderVarsAreListed's notAnAgent
(the system's data folders; the first run of internal/agent was red on
it until then).
Not covered, and Lody's to change: magpie on a machine Lody Desktop
reaches as a remote (Atlas's later detail: Lody on their own computer
connected to the host magpie runs on). Lody 0.108.1 imports only into
the desktop's own machine (the renderer writes the configs with
machineId = its local machine and needs __LODY_ELECTRON__), and the
link's payload takes only kind/id/name/auth/endpoints with a loopback
gateway, so no link names another machine. Lody Desktop opened on that
host shares the agent's ~/.lody/machine-id, so the import lands on the
same machine; docs/subsystems/agent-wiring.md says so.
Run:
- real Lody 0.108.1 AppImage in docker: agent.OpenLody reached a
running Lody (its log: "handleDeepLink accepted deep link {protocol
'lody:', host 'provider', pathname '/import'}", "sending deep link to
renderer") and a stopped one ("pending deep link sent to renderer
after did-finish-load"); xdg-open on the same link: rc 4.
- golang:1.26.8 docker, -tags nogui: agent and gui Lody tests ok.
- macOS: HOME=<sandbox> go test -timeout 45m -count=1 ./internal/agent
./internal/gui ./internal/cli: gui ok (124.9s), cli ok (48.6s), agent
FAIL on TestFolderVarsAreListed (XDG_DATA_DIRS, fixed here); agent
again after the fix: ok (213.5s).
- rebased on origin/main
|
||
|
|
f99d27abc2 |
routing: a rule names several models, tried in order
monkeyin_92 on X: "can a rule take several models? Otherwise one rule
with several models is several rules." A rule now takes more than one
model (Rule.More after Rule.Use; `more` in the group's JSON, use=a,b
typed). They go first in that order: when the first fails or rests the
rule's next takes the request, ahead of the models the later matching
rules name and the group's others.
Every reader of Rule.Use goes through Uses/SetUses/MapUses/Without/Names
in grouprule.go:
- cleanRules: each must be the group's, each named once; a pause names one.
- gateway: ruleFor's turn hold, tool rounds and outgrown turns, compaction
(the rule's first that takes the summary, the others in Small),
ruleMembers/ruleOver/applyRule, nestedRules and ruleLed (the one a
nested group's turn stays on), modelRuled, ruleEffort (useEffort asked
of each), ThenUses (leaves out all of the rule's own). RuleHit.More is
in the trace; Instead from More has Unready false, one from a later
rule Unready true, as before.
- ruledEntry: what the group takes is what every one of them takes.
- provider rename, auto/ refs, groupfast, a member's removal (a rule
goes with its last), ShareGroup and its import (one this magpie hasn't
is left out of the rule).
- CLI `group rule add use=a,b` and its listing; `group models-=` keeps a
rule's other models. The TUI shows them joined and keeps the rule when
one is deleted.
- GUI (plugins/routing): a chip per model, a + for the next one, an ×
on each while there is more than one, a chip picks another in its place
(app menu, no native select); the card's tooltip and the trace's why
("…so c/mini, which the rule names after it, goes first"), nested too;
en, zh, zh-TW, ja, de.
Old data: a rule of one model writes no `more`, so groups saved before
read and save unchanged (TestRuleMoreOnDisk). An older magpie reads `use`
alone: its requests go to the first model, the others are plain group
members in group order; if it saves the group, `more` is dropped.
Tests: TestRuleSeveralModelsInOrder, TestRuleEffortReachesTheRulesNextModel,
TestRuleCompactPassesOverTheRulesSmallModel (gateway); TestCleanRulesSeveralModels,
TestRuleMoreOnDisk, TestRuleWithout, TestParseRuleSeveralModels,
TestThenUsesLeavesOutTheRulesOwn, TestRuledEntrySeveralModels,
TestSharedGroupRuleSeveralModels, TestRuleMoreRenamedAndKept (provider);
TestGroupRuleSeveralModelsCmd (cli); TestGroupTakeOutKeepsARulesOtherModels
(tui); routing-rule-models.test.cjs. Broken by hand: ruleMembers on Use
alone turns the first two gateway tests red.
Run at this head:
- gofmt -l clean; go vet -tags nogui clean with GOOS=linux and GOOS=windows
for provider, gateway, cli, tui.
- go test -tags nogui -timeout 45m: internal/provider, internal/cli,
internal/tui ok; internal/gateway ok (384s); the new gateway tests
again after; internal/gui budgets ok.
- GUI: every routing-*.test.cjs plus i18n-keys, click-scroll and
group-member-drag, chromium and webkit (en, zh, zh-TW, ja, de where the
file has them): 1319 pass, 57 red. routing-rule-models passes in both.
The reds are in files that are red the same on origin/main
|
||
|
|
5b2b3d3f50 |
providers: a switched-off provider says how to turn it on, after a sign-in too
Atlas (Discord) signed in to WorkBuddy AI with `magpie plugin login
workbuddy-ai`, and `magpie providers` then showed "○ switched off" with
nothing saying why or how to undo it. magpie never sets Provider.Off by
itself; only the user's own switch does, and a sign-in rightly keeps it.
So the setting stays as the user left it, and magpie now says how to
change it:
- `magpie plugin login <id>` and `magpie accounts add <id>` (plugin and
built-in paths), finishing for a provider that is switched off, print
"! <Name> is switched off in magpie, so agents aren't given its models
· turn it on: magpie provider on <id>". One that can't be found says
nothing (not known to be off).
- `magpie providers` puts "magpie provider on <id>" in the switched-off
row's last, unpadded column, so the key column keeps its width.
- The TUI's Providers row notes "o switches it on" (its `o` key).
- The GUI row already shows a "Switched off" badge and its own switch,
and the editor says how to switch it on: left alone.
Run, at this tree (base
|
||
|
|
00d44d6928 |
routing: Codex's composer predictions story says their model is picked in Codex's row on the Agents page (#3425, chiperman)
Routing's Kind description for composer_predictions still sent users to Settings › General › Codex composer predictions. That setting moved to Codex's row on the Agents page. chiperman's commit (5e372e168) fixed the Routing text in five languages. It is ported here with their zh, zh-TW and ja; the de wording is mine. Grepping for other texts that still name the old Settings place for a setting that moved into an agent's row found four more, now fixed: - app.js compactField, the provider editor's "Compact at": empty follows Long conversations, now "in their settings on the Agents page (else in Settings)". The field's text is one string now, and the header comment no longer repeats it, so app.js stays inside its budget (unchanged). - gateway sealedWayOut: "Codex subagents on any model" is in Codex's settings on magpie's Agents page, not "magpie's Settings". - gateway codex_titles: "Codex composer predictions are off" and "Codex titles are off" answers name the same place. - cli `magpie model` help text. Each gateway message has a test that fails on the old wording, and the GUI files assert the new place and the absence of the old one. Run on origin/main |
||
|
|
a2ff7e6cab |
plugin: add takes a community plugin's name (WorkBuddy, think-tags, qoder-cn)
Atlas on Discord (#help, 10-25, Linux): `magpie plugin add WorkBuddy`
said "isn't an npm package name". Worse, a bare `workbuddy` passed the
npm-name check and installed npm's unscoped workbuddy@latest, not
@magpie-community/opencode-workbuddy-auth.
plugin.Add, which the CLI, the Plugins page's field (/api/plugins/add)
and the movers all go through, now resolves a bare name first
(internal/plugin/resolve.go). Case aside, a name one community listing
goes by is its package, at the version given: the package or its bare
name, the short name (workbuddy, think-tags), the shown name (WorkBuddy,
Command Code), a provider id it serves or the subscription it replaces,
and a retired subscription's id through its mover (qoder-cn; provider
sets plugin.SubscriptionPlugin = MovePackage). The CLI says which
package it picked. A name two listings go by, or none that isn't an npm
name, is refused with the community plugins listed. A name no listing
goes by is npm's own package (opencode-gemini-auth keeps working), but
only when the list was fetched within the six hours: when the fetch
fails, the copy kept or built in may not name a newer plugin, so the
name is refused with why, and npm:<name> installs npm's package as
written. market() now says whether its list is a fresh fetch (marketErr).
Scoped names, paths and git specs are unchanged. A backup's or a sync's
plugins go in by their own spec (plugin.AddExact via addPluginExact),
never resolved, so a restore isn't held by GitHub being unreachable.
Update, Upgrade and InstallMissing use add with stored specs, unchanged.
Tests (fake registry over httptest, fake bun; no network):
TestResolveCommunityNames, TestResolveRefusesWhatItCantName,
TestResolveListUnread, TestAddByCommunityName. TestUpdateAllUpdatesAPinnedPlugin
adds an unscoped third-party name, so it now serves a registry.
Broken by hand: Add without resolve -> TestAddByCommunityName red with
the reporter's own error ("WorkBuddy" isn't an npm package name) and
workbuddy -> workbuddy@latest. The unread-list rule turned off (valid
name goes to npm regardless) -> TestResolveListUnread red.
Real use, sandbox HOME, built binary, real npm and GitHub:
`plugin add WorkBuddy` -> installed @magpie-community/opencode-workbuddy-auth@latest,
listed workbuddy and workbuddy-ai; `think-tags` -> middleware-think-tags;
`opencode-gemini-auth` -> npm's, google-plugin listed; `qoder-cn` with
MAGPIE_PLUGIN_MARKET=off -> opencode-qoder-auth; "Work Buddy Pro" ->
refused with the 38 community plugins listed; `twinz` with the list off
or at a dead URL -> refused, saying why and npm:twinz.
Run at this head (rebased on origin/main
|
||
|
|
40a0b442c0 |
cli: the image MCP, Claude's MCP helper and statusline skip the start-up moves (#3318)
Every magpie subcommand ran the start-up moves before its own work:
RenameLegacy and the effort moves list every provider and account,
which starts the bun plugin host and runs claude auth status, a full
claude -p /usage, cursor-agent about and devin auth status. Claude Code
starts `magpie mcp image` for each session and `magpie statusline` on
every message, so a machine with 16 Claude sessions held 16 plugin
hosts beside the GUI's (~1.3GB footprint), and each status line took
5s. These three talk to the running gateway and nothing else; they are
now dispatched before the moves, which become startUp so a test can
tell whether they ran.
Run at
|
||
|
|
0d2a101160 |
gateway: the Codex app's titles, descriptions and summaries go to the magpie model picked, not ChatGPT (atom_Ray on X)
atom_Ray on X: with a third-party model picked in the Codex app through
magpie, an hour of use still took 2% of the ChatGPT account's 5-hour
window, and at 0% left it could not be used at all.
The cause is the app's hidden side turns. ChatGPT.app 26.1013.40934 asks
for a thread's title, description and one-line summary
(ThreadMetadataGenerationService.generateTitle/generateDescription/
generateSummary in .vite/build/main-CLu1A25j.js; R0/z0/B0 via H0 and Jq
in src-DsLVGakC.js) on ephemeralGenerationModel, gpt-6-luna by default,
whatever model the conversation is on. A summary is asked after each
user and assistant message (bAu in app-initial). With magpie's model
beside the ChatGPT sign-in (openai_base_url), these reach
/backend-api/codex as gpt-6-luna. codexTitlesTo and codexDescriptionsTo
left an unset setting on the model Codex asked for, and thread_summary
had no route at all, so all three went to ChatGPT on the user's sign-in.
Now, with Codex's config model one of magpie's and magpie not Codex's
provider (agent.CodexSideModel, through gateway.CodexSideModel),
codexSideTo sends titles, descriptions and summaries on the Codex
backend path to that model. On Codex's own model nothing changes, and a
model the Titles or Descriptions setting names still wins. Summaries get
the same wrapper as descriptions (codexShaped): the plain answer is
handed back as the {"summary": ...} the schema asks for, with
compactSummary filled and cut to its maxLength (summaryJSON). This also
covers a summary on magpie's own API, where a Chat model's plain answer
was dropped by the app. No prompt, instructions or base_instructions are
changed: the request is sent to another model as Codex wrote it.
Run (this change on origin/main
|
||
|
|
71fd92ddf7 |
saves: a routing group or provider saved answers before the agents' files are synced
CyberCaius on Discord (native Windows): "路由组和供应商编辑保存有时候保存会卡 很久才保存成功", at least 3s, while an agent's request runs. Cause: every write of providers.json ends in catalog.Touched -> Changed, which was agent.SyncCatalog, run inside the HTTP request. It rewrites every agent's model list that differs. On Windows, a file another program holds open refuses the rename over it, and steady.Rename retries for 0.5s before giving up. So each such file costs a group save half a second, and a provider save, which stores several times, costs more. In WSL the same sync goes through wsl.exe and \\wsl.localhost. Fix: catalog.Changed is agent.SyncCatalogSoon, which runs SyncCatalog in the background (it already folds overlapping runs into one more round). A CLI command waits for those rounds at the end of run() (SyncCatalogSettled), so `magpie group add` still ends with the files written, and run() puts catalog.Changed back for tests. The GUI's direct SyncCatalog calls in providers.go (arrange, keeplogin, switchonly, login actions, sign-in import) use SyncCatalogSoon too. Run at the pushed head (parent |
||
|
|
b18a6a080b |
gateway, cli: magpie goroutines writes the running magpie's goroutine stacks to a file (#3362)
#3362's second ask: an app stuck at something could only be read by killing it, which ends what was stuck. magpie heap and magpie cpu already ask the running gateway for a profile over loopback; magpie goroutines asks it for every goroutine's stack. That works on Windows too, where there is no SIGUSR1. GET /v1/magpie/goroutines (goroutines.go) answers the callers /v1/magpie/heap answers (profileRefused: a program on this computer over loopback, no browser mark, a loopback Host; a gateway key lets nothing else in) with runtime/pprof's goroutine profile at debug=2, the form a crash prints: each goroutine's state and wait ("[select, 4320 minutes]"), its frames with source lines, and who started it. It is text/plain and no-store, and X-Magpie-Goroutine-Stats names the process (pid, program, version, window, uptime, goroutine count). Arguments are words in hex, never what they point at, so the dump holds no keys, prompts or messages; it does name magpie's source files and the program's path, which the usage says. magpie goroutines [<file>] writes it to <file>, else magpie-goroutines-<date>-<time>.txt in this folder, 0600 and never over a file there, then prints the file and the process. --help, -h and help print the usage and ask nothing; a flag it doesn't take, "-", a blank name or a second file are refused before the gateway is asked. A magpie older than this one answers 404 and is told to update; with none answering, it says so. The refused callers TestHeapProfileOnlyToThisComputer listed move into profileCallersRefused, which the CPU test and the new one share. Run on |
||
|
|
137187a401 |
gateway: Claude Code's auto mode classifier follows a /model switch at once
CyberCaius on Discord: after switching models, the first auto mode permission check went to the previous model. The model is Claude Code's choice, not magpie's. Claude Code 2.1.310 ($Xe/BB) names ANTHROPIC_DEFAULT_SONNET_MODEL for the classifier, not the session's model. magpie's sonnet tier follows the main model only once Follow runs (the GUI's state poll), and Claude Code reads env again only on its next start. So right after /model the classifier named the old main model. At the gateway, a classifier request (recognised from its body: a <transcript> and a <block>/<severity> verdict, no tools) on a sonnet tier that follows a main model settings.json no longer has goes to the tier the new main model gives it (followAt, keeping the tier's effort). It is left alone when the user set CLAUDE_CODE_AUTO_MODE_MODEL, when the sonnet tier is their own, when the base URL isn't magpie's, or when the main model hasn't moved. WSL distros are read the same way. Only the classifier is rerouted: a turn naming the old model may be another open session that is still on it. The haiku, opus and subagent siblings are #3474. Run (sandbox HOME; packages at |
||
|
|
ed91aa04ef |
checkin: an inactive or ineligible check-in shows the plugin's reason (plugins#304)
Qoder's plugin 0.2.32 (magpie-community/plugins 74be632) says why no check-in was offered: it asked with this machine's own device identity and Qoder offered no campaign, and Qoder desktop can claim one it shows. magpie dropped a hook's message for inactive and ineligible and showed only "No check-in event now". Now: - GUI: the Usage card's row reads "<label> · <message>", wrapped under the label rather than cut off with "…" (data-why, as a failed row's reason wraps, #821); Settings' check-in line under the plugin's switch carries it too. A result without a message reads as before. No new i18n keys: the message is the plugin's own text, as for failed rows. - TUI: the Usage cell is too narrow, so it adds "c says why"; c's flash carries the message (checkinWhy). - CLI: `magpie accounts checkin` prints it after the label. - The Qoder mover's min is 0.2.32 (npm view --prefer-online: 0.2.32). - docs/subsystems/provider-plugins.md says how the message is shown. Run at this tree (based on origin/main |
||
|
|
a3b45eb91e |
provider: a re: pattern matches in any case, as a glob does (usrname1833 on Discord)
A routing group's patterns (Group.Match) and a provider's auto-include rules both compile through compilePattern. A glob compiled with (?i) and a re: pattern without it, so re:gpt-.* missed GPT-5.5 while gpt-* took it. A re: pattern now compiles as (?i)^(?:…)$; (?-i) inside it makes case matter again from there on (re:(?-i)gpt-.*). The Routing page's editor works out a pattern's models in JS (patternRe in plugins/routing/client.js) and refused what JS can't read. It now reads re: with the i flag too, and takes Go's leading flag group ((?-i), (?s), ...) as JS flags, so re:(?-i)OR/B is taken and matches as the gateway will. A flag group further in is still refused there (JS has no bare (?-i)); the CLI takes it. Said in groupmatch.go's comments, magpie group's and magpie provider auto-include's help, and providers-accounts.md (Routing groups, List schedule and rules). No GUI hint said a pattern's case, so none changed and no string was added. Run: - TestRegexpPatternIgnoresCase (new): ok. With compilePattern's (?i) taken off by hand: FAIL, "re:GPT-.* ~ gpt-5.5: false, want true" and three more cases. - group-patterns.test.cjs, chromium and webkit, en and zh: 4 of 4 ok. With patternRe put back to the old re: line by hand: 4 of 4 red, "(?-i) keeps case 0 !== 1" (old JS refused re:(?-i)OR/B). - gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: clean. - go test -tags nogui -timeout 45m ./internal/provider ./internal/cli ./internal/gateway under a sandbox HOME at 1a956129c's tree: ok, ok, ok (380s). go build for darwin, linux (nogui) and windows: ok. - A full ./... run was started and stopped: the machine's disk was full (1GB free), and internal/agent's tests failed on "no space left on device" in TempDir, not on this change. No full suite ran. Not tried: the full suite (above); a real provider's auto-include fetch with mixed-case ids; the Linux app's WebKitGTK; a (?-i) further into a re: in the GUI. |
||
|
|
edff2f819a |
provider: levels kept of a model's own narrow only what is offered again (#92)
|
||
|
|
4a3e07f1cf |
model: magpie model spec sets a model's window, output, vision and levels at once
Dani Ariyanto on Discord (#feedback, 10-24): a custom provider's models (kenari/*:free) had no window, reply limit, vision or reasoning known, and there was no one place to say them. magpie model spec <provider/model> what it has, and whose each value is magpie model spec <provider/model> [--context <n>] [--output <n>] [--vision on|off|auto] [--reasoning <levels>|off|auto] magpie model spec '<provider>/*' --context <n> --output <n> magpie model spec <provider/model> --reset magpie model specs It writes the stores magpie model context/output/images/efforts write (providers.json contexts; settings.json modelOutputs, modelImages, modelEfforts, modelReasonless), so every reader that went by those goes by a spec: entryFor/EntryOf/Served, /v1/models, max_tokens, the GUI's /api/providers badges and chips, and the agents' model lists. Every part is checked before anything is written; a refused command writes nothing. Agents are told once. Readers that bypassed the stores and now honour them: - provider.Efforts returns the kept levels, so the gateway fits a request to them (fitEffort): xhigh asked of a model kept to low-high goes as high. This reverses #92 ( |
||
|
|
ea9454d2d8 |
usage: count two ids of one model as one, magpie model alias (SlouchyQuill507 on Discord)
A vendor names one model two ways (deepseek-v4.1-flash and deepseek-flash),
and Usage, Usage > Sessions and `magpie usage` showed two rows. Now:
magpie model alias deepseek-v4.1-flash deepseek-flash
magpie model alias deepseek-v4.1-flash (what it is counted as)
magpie model alias deepseek-v4.1-flash --reset
magpie model aliases
kept as settings.json "usageAliases" {from: to}. Off until one is written.
Ids match as routing groups match them (provider.sameModel: vendor/ prefix,
case, "_", snapshot date), at every provider; a chain is followed to its
end; an alias to itself, a loop, or a flag as an id is refused. A loop
written into the file by hand counts each model under its own id.
Display only: requests, agents' model lists, /v1/models, routing groups,
Same as and prices never read it. Each call is priced by the id it was
made under and only then counted under the alias; the alias's own price
is never put on the other id's calls, and a merged row is priced only
when every id in it is. Applied in usage summarize/direct (Models
groups), the gateway sessions projection (alias read before
gatewayCache's lock; the cache key hashes usageAliases), and
sessions.List/Get/Find/Stats (read before storeMu/mu, merged into new
slices so the memo is untouched; ModelEffort rows merged too). A failed
settings.json read keeps the last aliases read, and SetUsageAlias refuses
to write over an unreadable file (EditUsageAliases under fileMu). The GUI
settings save carries usageAliases. No GUI control.
Not aliased: the Requests ledger's per-request model and its model
filter, which show each call's own id.
Run (worktree at
|
||
|
|
45fa29973c |
checkin: an early "already checked in" is asked again, not kept for the day (#3326)
connoryang331 (v0.1.1328, Windows): at 00:00:28 Beijing 14 of 29 plugin
check-ins (AutoClaw CN x5, WorkBuddy x2, CodeArts, Trae x3, MiniMax,
Raccoon x2) answered "already" (done). magpie kept that as the day's
result and never asked again, and Check in now answered from the record
without asking. A real claim at 10:54 paid +200: the vendors' days turn
later than Beijing midnight, so 00:00's "already" was yesterday's.
The class, in the checkiner every check-in shares (built-in and plugin):
- A done, inactive or ineligible answered before noon Beijing
(checkinSureHour) for an account magpie hasn't seen claim that Beijing
day is provisional. The loop asks it again 30 minutes (wbCheckinEvery)
after the answer, until a claim or an answer from noon on: at most 24
more asks a day per such account, none once magpie claims.
- A press (soon) asks again at once for done, inactive and ineligible,
whatever the hour. own-app (Trae 9074) and captcha still stand.
- A claim stamps Claimed, carried over while later answers that day say
done, so a done after magpie's own claim is settled (Qoder's claim then
done case).
- The record goes out with again: true (worked out when shown, never
kept). The card says "{name} says already checked in; its day may not
have turned yet, so magpie asks again later" and keeps Check in now;
Settings, TUI and CLI say the same. en, zh, zh-TW, ja, de.
- Qoder's recheck (#2696, pluginRechecks) is unchanged: its tests pass
as they were.
The plugins repo does not cache "already": autoclaw reads the task list
or calls dailySignin each time, codearts, minimax, raccoon and trae ask
the server each call (read at magpie-community/plugins origin/main
652f06d). No plugin change, publish or mover min.
Tests:
- TestPluginCheckinEarlyDoneAskedAgain (the reporter's 00:00:28: loop at
+29m no ask, +30m asks then claims; a press at 10:54 claims; done all
day is 25 asks and settles at noon; done after magpie's claim settled)
and TestWorkBuddyCheckinEarlyDoneAskedAgain.
- TestPluginCheckinOthersSettledForTheDay now answers at 12:00 Beijing
and checks a press asks again (claimed still settled);
TestPluginCheckinRunsAsTheBuiltinsDo, TestTraeCheckinAnswers and the
WorkBuddy nothing-to-claim/refused tests follow the new rule.
- TestCheckinAgainNotShownAsToday (TUI words and cell).
- checkin-early-done.test.cjs: again card's wording, data-state wait,
Check in now asks plugin-checkin {provider: autoclaw-cn}; a kept done
is "Checked in today +50" with no press. Chromium and WebKit, 5
languages, 900 and 440px, 20/20.
Red on the old code: with the non-test change reverse-applied (fields
kept so it compiles), TestPluginCheckinRunsAsTheBuiltinsDo,
TestPluginCheckinOthersSettledForTheDay (inactive, done, ineligible) and
all 4 subtests of TestPluginCheckinEarlyDoneAskedAgain fail; with
origin/main's app.js, checkin-early-done fails ("Checked in today").
Run at this tree:
- gofmt -l clean; go vet ./... (darwin), GOOS=linux go vet -tags nogui
./..., GOOS=windows go vet ./... clean.
- go test -tags nogui ./internal/provider/ -run 'Checkin|CheckIn',
./internal/tui/ -run 'Checkin|OwnApp': ok.
- GUI: checkin-account, checkin-early-done, i18n-keys, plugin-checkin,
qoder-checkin-recheck, usage-card-refresh, usage-checkin: 177/179. The
2 reds are usage-checkin's "webkit en/zh: Settings has a Qoder check-in
tab", red the same alone on origin/main
|
||
|
|
4f6498f822 |
routing, usage: an account renamed in magpie reads by its new name (magpie-community/plugins#310, molvqingtai)
molvqingtai renamed a Kiro (plugin) account from "example@gmail.com (foo)" to "example@gmail.com (bar)", and the Routing page kept saying "(foo)" on every request made after. Cause: the Routing page never looked up the user's name at all. A trace's `who` is the vendor's account name (Weighed.Who), and plugins/routing/client.js showed it as it was. Usage records (ProviderAccount) keep the vendor's name the same way, and the Usage page's Accounts, the request log's Account filter, `magpie usage`, a gateway key's accounts (AccountNames, /api/caller-keys) and Routing's "Several accounts" pools (onOf) all showed it raw too. This affected built-in and plugin providers alike. Records still keep the vendor's name. It is the key the user's name is stored under (providers.json AccountNames, in lower case), so it stays the identity: Routing still groups and ranks by `who`. The name is looked up when it is shown: provider.AccountShown / AccountShownOf / AccountRef.Shown in Go, and userShown (accountNameOf over /api/providers' accountNames) on the Routing page. So requests from before the rename read by the current name too, and a cleared name goes back to the vendor's. A key's name and an unnamed account read as before. Already right before this change: quota cards and the menu bar (Alias), `magpie accounts`, and the editor's account row. Record for this push: 13 commits on origin/main |
||
|
|
c417b1f4e3 |
library: a skill removed from its source is said so, and every such skill goes in one click, asked first
スライム on Discord (#help, 10-22): taste-skills took some of its skills
out, Update all reported each of them as a failure, and the only way
out was to delete them one by one.
An update or a check that reads the source whole and finds the skill's
folder (or its SKILL.md) gone now calls it removed upstream, not a
failure. GitHub tarballs and other git repositories both work this way.
- UpdateSkill returns *GoneError.
- UpdateSkills and UpdateSomeSkills list it in Result.Gone, not
Unupdated.
- A check gives status "gone".
- Each marks Skill.Gone. The mark is cleared when a check or an update
finds the skill there again.
- A fetch that failed, a skill left out of a fetch as too big, and a
folder that can't be read stay unknown, never gone (goneFrom).
Nothing is deleted by itself. RemoveGoneSkills takes the named skills
out, or every marked one when none are named, through RemoveSkills, so
the folders go to the backups. A skill found in its source again is
kept and said so.
- GUI: a "Removed upstream" tag replaces Update available and the
update icon. Update all says gone skills apart from failures. "Clean
up N" sits in the group heading, or in the bar when there is one
group, and opens a sheet naming each skill. One changed here carries
"Changed here". Strings are in en, zh, zh-TW, ja and de.
- CLI: `magpie library skill rm --gone [--yes]` asks at a terminal and
refuses without --yes otherwise. It names the ones changed here.
update and status print the hint.
- TUI: the row says "removed from <repo> · d takes it out".
- API: POST /api/library/skills/remove-gone {names}.
- Docs: the Skill updates row and Verification in
docs/subsystems/library.md.
Record for this push: 13 commits on origin/main
|
||
|
|
5871f02dd6 |
plugins, provider, gui: a keyless plugin sign-in needs no key, and a single-identity plugin has one account (#2695, LoKi)
LoKi's patch (lokic7123-star), picked onto origin/main |
||
|
|
f5b0157420 |
gateway: a tool Claude Code's tool search loads goes to OpenAI's Responses API where it was loaded (#2660)
Through /v1/messages translated to a Responses provider, every deferred
tool ToolSearch loaded joined the top-level tools on the next request, so
the prompt changed from its first bytes and the cache missed on each load
(maximia's probe: cached tokens dropped on every request after a load).
Now, where Request.LoadedInPlace is set, a deferred tool (defer_loading,
Tool.Deferred) that a tool_result's tool_reference names (toolRefs,
Part.Loads) goes in an {"type":"additional_tools","role":"developer",
"tools":[...]} item right after the run of tool outputs that loaded it,
once, and not in tools (buildResponses). Parallel results and one result
naming several share one item; a tool named again isn't repeated; the
output's text is as before. A history whose loading result is gone
(compaction, edits) puts the tool back in tools: a new prefix, expected.
Scope (loadsInPlace): OpenAI's own API with a key (api.openai.com,
*.api.openai.com), whose tool search guide documents the item and says
its tools load at the end of the context so the cache is kept; and a
provider the user sets with `magpie provider set <id> additional-tools=on`
(Provider.AdditionalTools, kept by the GUI's save like codexAsSent).
Nothing else: xAI answers the item 422 (#350), the ChatGPT backend has
been seen taking it only for Codex's Responses Lite, Azure, plugins and
relays are untried. An upstream that refuses a request holding the item
with a 400/422 naming additional_tools is asked again with every tool in
tools, logged ("turned away additional_tools ... loaded tools go in tools
from now on") and not sent the item again while magpie runs.
Not handled: a tool a tool_addition block in a system message loads (MCP
late tools, the advisor) stays in tools. Not tried against a real
upstream: no OpenAI key or custom Responses relay was used; the item's
shape and position follow OpenAI's docs, and the fixtures follow
maximia's three-request probe (Claude Code 2.1.302) and the
tool_reference shape Claude Code 2.1.306's binary writes.
Tests: TestLoadedToolsKeepThePrefix (top-level tools and instructions
identical across the three requests, each input a prefix of the next),
TestLoadedToolsInOneItem (parallel, batch, repeat), TestLoadedToolsWhereNotTaken
(unsupported upstream unchanged; compacted; non-deferred),
TestLoadsInPlaceScope, TestLoadedToolsThroughTheGateway (off by default on
a relay, on with the flag, refusal retried without the item and not sent
again), TestAdditionalToolsPair (CLI). Broken by hand: with the
buildResponses placement disabled, the first two and the gateway test go
red; with the refusal retry disabled, TestLoadedToolsThroughTheGateway
goes red.
Run at cff7dc67d (this change on
|
||
|
|
1bd99194ea |
provider: Claude Code stays listed, signed out, when every saved account's sign-in is gone
LeeHom on Discord: two Claude Pro accounts vanished from Providers, and
signing one in again showed the other as "needs sign in again". While
Claude Code is signed out, the claude provider is built on
claudeStandIn's account. claudeStandIn skips an account whose sign-in
Claude Code let go of (claudeLoggedOut's claudeLogoutLapse) or that is
still Held. With every saved account like that, it returned "", no claude
provider was made, and the subscription and both accounts left the GUI,
the TUI and `magpie providers` at once.
claudeStandInAccount and Logins now ask claudeListed: the stand-in, else
the signed-out account seen last. A Held account is never listed this way,
because the sign-in Claude Code left on disk would then be served
(TestClaudeSignedOut still holds). The listed account's token still fails
with the lapse reason (claudeSavedDir), so nothing is served on it.
claudeStandIn itself is unchanged, since addLogin and logins_on rely on
it.
The app's row already said "{user} is signed out" when every login in use
had lapsed. Provider.SignedOut is that rule in Go. With it, `magpie
providers` says "○ <user> is signed out · sign in again" and the TUI says
"○ <user> is signed out", instead of a green "signed in". The CLI's key
column moved into keyColumn so it can be tested. The providers-accounts
doc row says this.
Tests:
- TestClaudeAllSignedOutStaysListed: signed in, a second account
logout-lapsed, then Claude Code signed out. It fails on the old code
("Claude Code left the Providers list with every account signed out:
false") and with SignedOut returning false (both broken by hand).
- TestProvidersSaySignedOut, in cli and tui: a signed-out account reads
as signed out and a signed-in one still reads as signed in.
Run: gofmt -l clean; go vet ./... (darwin), GOOS=linux go vet -tags
nogui ./..., GOOS=windows go vet ./...; go build for all three.
Then go test -timeout 45m ./... under a sandbox HOME at base
|
||
|
|
5fadf6aceb |
gui: Settings' gateway row is titled an address, and says only its port is typed here (Chicring on Discord)
Chicring: Settings showed "网关端口" (gateway port), but the row showed
MAGPIE_ADDR's host:port.
What the field takes, from the code: renderPort posts to
/api/settings/port, and setPort (internal/gui/port.go) accepts only a port
from 1024 to 65535 (settings.CheckPort). The gateway listens on that port,
on 127.0.0.1, or on 0.0.0.0 while shared on the LAN. When MAGPIE_ADDR is
set, it is the whole host:port and comes first. The row then shows its
value and is disabled. So the row is the gateway's address, but only its
port is typed here; it isn't a second way to write MAGPIE_ADDR.
The row is renamed in every language: Gateway address / 网关地址 / 閘道位址 /
ゲートウェイのアドレス / Adresse des Zugangspunkts. The new hint says "Only
the port is set here, 1024 to 65535; MAGPIE_ADDR=host:port sets the whole
address instead. Agents magpie connected move with it. Now {url}". With
MAGPIE_ADDR set, the hint says "MAGPIE_ADDR={addr} sets the gateway's whole
address, host:port: unset it to set the port here". The CLI help (cpu,
healthcheck, heap, quota, statusline) and setPort's comment named
"Settings' Gateway port". They now say "the port in Settings' Gateway
address".
Test: gateway-port.test.cjs pins the new name and hints in en and zh. With
MAGPIE_ADDR set, it now also checks that the field shows 127.0.0.1:3426
and that the row's name and aria-label say the address. gui-zh-tw, gui-ja,
gui-de and i18n-keys cover the other languages. Broken by hand: on the old
app.js it is red, "not ok 1 - en expected: 'Gateway address' actual:
'Gateway port'", and zh red against '网关地址'.
What was run. The whole suites ran at dcf7eeae3, which was these two commits
on origin/main
|