d3fc6f2bfada18e6ae7887b79ed1e4c650ca37e1
284
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b4a0a2a1ab |
cli: the Memory tab's routes wait for the library's stage of #4745
TestEveryRouteHasACommandOrIsNamed was red on this stack: the routes of /api/memory, /api/memory/distill and /api/memory/dream have no `magpie` command yet. They are the Library's Memory tab, so they are listed in notYet as L (stage 3: the library), as the other library routes are. Agents already reach memory without the GUI through `magpie mcp memory`. Run on mote: go test -count=3 -run TestEveryRouteHasACommandOrIsNamed ./internal/cli ok. |
||
|
|
eebb878977 |
cli: TestGroupSetID expects a renamed group's old id to find it
|
||
|
|
a28744c325 |
gateway: memory is an MCP server every agent can mount
memory_search, memory_save and memory_forget at /mcp/magpie/memory, served and guarded as the search server is (serveMCP): another computer reaches it only while magpie is shared, with a gateway key. A save through it is active at once, origin agent, kept everywhere, for the project (the git repository the agent works in, by its remote) or for the agent alone; without a folder or a client name it says it can't know rather than guess. - The Library's market offers it as magpie-memory, run as `magpie mcp memory` (browsermcp.RunMemory): stdio relayed to the gateway with the folder it was started in (X-Magpie-Cwd) and the client name from initialize (X-Magpie-Mcp-Client). - Behind the MCP router the hub keeps it on this computer (hereOnly) and passes the caller's roots and client in _meta (wantsCaller), as it does for magpie's own server. - OwnMCPPath lists it among magpie's own servers. - Judged as its sibling servers are: a gateway key's MaxConcurrency doesn't hold it (a tool call of a turn already held), and a read-only key is refused (memory_save writes). The first full gateway run was red on TestKeySlotEveryRoute and TestReadOnlyKeyEveryRoute until the route was listed. Run (mote-run): - go test -tags nogui ./internal/gateway: ok (881.5s) - go test ./internal/browsermcp ./internal/cli ./internal/memory: ok - go test ./internal/library: ok (130.9s) - go vet, GOOS darwin, linux, windows: ok; gofmt -l clean Broken by hand, each red, then green restored: - the hub not sending memory its caller (wantsCaller without isMemory): TestHubTellsMagpieMemoryItsCaller "roots asked false" - the relay not setting X-Magpie-Cwd: TestMemoryBridgeSendsFolderAndClient - the gateway ignoring X-Magpie-Cwd: TestMemoryMCPSharedAcrossAgents (a project fact kept everywhere) Not tried: a real Claude Code or Codex mounting magpie-memory. |
||
|
|
623e797fde |
plugin pages: read a day's usage and share a picture they drew
A plugin's page can now read one day's usage and share an image it
drew. This is for the day card (JungleyYeh on X asked for a "daily AI
statement"); the card itself is an optional community plugin,
@magpie-community/page-day-card.
- A page that asks for the "usage:day" read gets that day as
magpie.read("usage:day", {date, tz}): totals, each agent and its
models, the streak and the average active day (usageapi/day.go,
gui/pageday.go). The Plugins page names the read before it is granted.
- magpie.image.copy(png) and magpie.image.save(png, name) share a PNG
of at most 16 MB. In the window they go through
POST /api/plugin-pages/image (pageimage.go): copy puts the picture on
the clipboard (clipimage.go: osascript PNGf on macOS, PowerShell
PNG + Bitmap on Windows, wl-copy or xclip on Linux), and save writes
it to Downloads under a name made safe. In magpie web, the browser
saves or copies the picture itself.
- The window's side, pageshare.js, is imported the first time a page
shares a picture. The core grows by its one call only, paid for by
comments cut, so the budget is not raised.
Tests:
- New: TestDayOf, TestPluginPageReadsADay, TestPluginPageSharesAPicture,
TestPageImageName and TestClipImageCommand. plugin-page.test.cjs
covers the bridge, both engines and a refused SVG.
What was run (mote):
- gofmt, plus go vet on darwin, linux and windows: clean.
- Full go test ./... at the pre-rebase base: 369 packages ok, 3 FAILs.
- TestEveryRouteHasACommandOrIsNamed and TestCoreScriptBudget were
this change's own reds. The new route now has a parity entry, and
the share code moved into lazy pageshare.js with no raise.
- TestGatewayModeStatsNameTheGatewaySessions is #5690, the red in the
first hour of the day (it ran at 00:32).
- GUI suite (affected and plugin files, both engines): 1160 of 1179
passed. Every red is filed and none touches this change:
- i18n-keys "a plugin's words are its own": #5332, #5426, #5482.
- page-width-steady: #5013.
- plugin-card-update in WebKit: #3079.
- plugin-move-unserved "Try again": #4410.
- At this head, after the rebase on
|
||
|
|
92e8edd7fc |
windows: magpie is listed in Installed apps, and its Uninstall puts every agent back
Jevik_AI on X uninstalled magpie and rebooted, and Codex's config.toml still had openai_base_url = "http://127.0.0.1:3425/backend-api/codex"; Rk1ngggg asked whether an update cleans it. magpie's own uninstall (Settings › About › Uninstall magpie, `magpie uninstall`) already disconnects every agent and takes Codex's leftovers (#3866), but on Windows magpie wasn't in Settings › Apps › Installed apps, so it was removed the way Windows offers for a program it doesn't list: by deleting the exe and folders, which runs no code. shortcut.Ensure now writes HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\magpie (DisplayName, DisplayIcon, Publisher, InstallLocation, UninstallString, URLInfoAbout, NoModify, NoRepair) at every installed start, beside App Paths, and Remove (uninstall's System step) takes it out the same way: only while it names this exe, or an exe that is gone. Its Uninstall runs `magpie.exe uninstall --window` (shortcut.UninstallArgs). magpie.exe has no console, where the terminal's `magpie uninstall` would refuse for want of one to ask on, so those exact args open the app's window (or forward to the running app, OnSecondInstanceLaunch) on Settings › About with Uninstall magpie's question asked (uninstallView, ?uninstall=1). It asks once: a redraw of Settings doesn't ask again, and Cancel removes nothing. magpie web opened at that link asks nothing. Deleting the app by hand still runs no code (macOS drag-to-Trash included); agent-wiring.md says so. Run on mote at the pushed head (rebased onto |
||
|
|
39569d5604 |
claude desktop: an optional Claude Magpie app beside your own Claude (#5671)
baranwang on X asked to keep Claude Desktop's own (1P, Anthropic) sign-in while using magpie. Turning on "Separate app" in Claude Desktop's row on the Agents page (or `magpie claude-desktop launcher add`) moves magpie's 3P wiring into ~/Library/Application Support/Claude-Magpie-3p and adds ~/Applications/Claude Magpie.app. That launcher opens Claude.app with --user-data-dir on that folder, so it runs side by side with the user's own Claude.app. Its icon is Claude's icon with a magpie badge. Off is the default, and turning it off (`launcher remove`) moves the wiring back and removes the app. It is macOS only: Desktop's packaged app strips CLAUDE_USER_DATA_DIR, and on Windows it hardcodes LOCALAPPDATA\Claude-3p. The folder ends in -3p because Desktop adds -3p to any other name. Restarting the isolated app ends only its own process (pkill on its --user-data-dir) and opens the launcher again. Run at 1b25cda26 (this change on origin/main |
||
|
|
c056b7c8c3 |
provider: a Responses provider's turns may go over the Responses WebSocket (#5781)
A provider the user added with an http(s) Responses address can now send its Responses turns over the Responses WebSocket that magpie already speaks to chatgpt.com (codexSocket), with `socket=auto|on|off`: - off, or absent: today's behaviour exactly. Provider.Via hides any socket value an outer context carried, so such a provider never dials. - auto: tries the socket, falls back to HTTP when the handshake is refused or the socket ends before the reply, and speaks HTTP to a host for 10 minutes once it refused the handshake (codexShun). - on: the same fallback, but never shuns; the socket is tried each turn. Provider.Via puts the provider's Responses host and path in the request's context (withSocket); codexSocket's gate is provider.SocketTurn, which takes a ChatGPT turn as before, or a POST to that host at <Responses>/responses. The rest is the ChatGPT leg's: the kept socket and its delta (codexKeepKey now also hashes the scheme, X-Api-Key and Api-Key), the error frames, 1009 handling. A provider's reply with no Content-Type is marked text/event-stream, since it is read as one. Routing, keys, limits, usage and masking are unchanged: only the transport under the request differs. Set with `magpie provider set <id> socket=auto|on|off` (refused on a provider with an account, no http(s) Responses address, or Vertex, TakesSocket), saved in providers.json as "socket", shown by `provider show`, and in the editor's Advanced as a WebSocket tick beside HTTP version (ticked saves auto, keeps a CLI's on, unticked saves off; shown only while the Responses address is http(s) and there is no account). docs/subsystems/providers-accounts.md describes it. app.js pays for its rows by three long comments cut to one line (renderMove, the vendors' status pages, header rows): the core's scripts are 478 bytes smaller than on |
||
|
|
40cbdaa7e8 |
provider: an account's window can be capped at a fixed amount of its unit
A window magpie reads with a total and a unit (a day's 1000 credits, a
plan's requests) can now be capped at an amount of that unit, not only
a share: 9won_25273 asked to stop an account at 300 of its day's credits.
- AccountWindowAmounts keeps it per account and window (capId). An
amount and a window's own share replace each other.
- WindowCaps.limitShare turns it into a share of the total for the mark
and NearCap. CapHeld and capReached hold the account once the window's
count reaches the amount (past), and rest it as the percentage cap
does: the next account takes the request. cappedError and the trace
say "has used 300 credits ... past its cap of 300".
- A reading with no total ignores the amount; the account's share
applies.
- GUI: the window meter's menu has one more item, Amount..., typed in
place (provider/windowcap with amount). It shows only on a window
with a unit and total. Strings in zh, zh-TW, ja, de.
- CLI: magpie provider account-cap <id> <account> --window <name>
--amount <n|off>.
Usage outside magpie counts: every cap reads the vendor's own count, so
what the account spent in the vendor's app or on another machine counts
from the next reading on. magpie can only hold back its own requests.
Run, at this head on Linux (wsl-run, magpie-desktop):
- gofmt -l: clean; go vet ./... for linux (-tags nogui) and windows: ok (darwin
vet needs cgo, so it runs with the full suite on mote afterwards)
- go test -run 'Lang|ToolLoop|LoopGuard|Cap|Amount' ./internal/gateway
./internal/provider ./internal/cli: ok (TestWindowAmountCapHeld,
TestSetWindowAmount, TestWindowAmountHoldsTheAccount, the CLI cases)
- GUI window-cap, window-cap-pool, account-cap in chromium and webkit,
420 and 1100 wide, en zh zh-TW ja de: 78 of 78 in each engine. An
earlier webkit run lost the amount test's page once ("Target page,
context or browser has been closed"); it passed in 2 more full-file
runs and 60 of 60 alone
- i18n-keys: only "a plugin's words are its own" red, words that aren't
this change's (#5332, #5426, #5482)
Broken by hand: limitShare ignoring amounts (of < 0): TestWindowAmountCapHeld
and TestWindowAmountHoldsTheAccount go red.
Not tried: the full go test ./... at this head (queued on mote, runs
after); a real account at an amount cap.
iFlytek: 9won's 讯飞 overshoot isn't covered. Loomy's daily window sends
used as a count and amount as what is left (plugins#889); AStudio's
wallets tell a balance only, which no cap can hold (#5770).
Reported-by: 9won_25273 (Discord)
|
||
|
|
b475004d52 |
library: Pi's extensions and packages, switched and copied between Pis
leokon3 runs Pi on Windows and in WSL and asked for magpie's Library to manage Pi's extensions and packages. A new "Pi packages" tab in the Library lists each Pi here (this computer's and each WSL distro's), with the extensions and packages it loads, read by Pi's own rules (@earendil-works/pi-coding-agent 1.4.0). Each has a switch, written as `pi config` writes it, and a "Copy to…" menu for the other running Pis. - A package is copied as its settings.json entry; Pi installs it itself when it next starts. node_modules is never copied. A local package, and one the other Pi already has by Pi's identity (npm name, git host/path), is refused. - An extension file or folder is copied as files, without node_modules, .git or symlinks, never over one of the same name. The page says to run npm install there when it has dependencies. - A package that already picks some parts (filtered in `pi config`) shows its switch disabled. A settings.json that can't be parsed lists nothing and is never written; a stopped distro is never started; every write is backed up first. - GET/POST /api/library/pi, POST /api/library/pi/copy (notYet in the CLI parity list, stage 3: the library). Run at 29d63e2dd (this tree on origin/main c7ebb6f8d; rebased after onto |
||
|
|
608c1543e8 |
gateway: a bare model name goes to the asking agent's own subscription first
freefcw on X: Codex, started by Mirasim, asked for gpt-6-astra by its bare
name. Its own ChatGPT subscription serves it, but magpie sent it to Devin
through the group it found (auto-gpt-6-astra, soonest renewal first).
With found groups off it still went to another vendor: Resolve takes the
first provider in the Providers order, AutoStandIn and agent.Reseat did
the same.
Now:
- A bare model id the asking agent's own subscription in magpie serves (a
provider whose Account.Agent is the agent: Codex's ChatGPT accounts,
Claude's for Claude Code, Copilot's) goes there, found groups on or off
(gateway ownFirst, provider.OwnRoute). count_tokens counts it there too.
- Kept as they were: a group the user made or changed by that name; a found
group magpie set one of the agent's fields to (agent.SetToGroup over the
applied record, #750's bare spelling included, wired as
gateway.SetToGroup); a gateway key held to some models; ids with a
provider in them and group refs; clients magpie doesn't know as an agent.
- Found groups off: a bare id several providers serve, none of them the
agent's own, is refused for an agent that has a subscription of its own
in magpie, with a 400 naming the provider/model ids and
"magpie group auto on" (provider.OffSpread). Off, magpie picks no vendor.
- AutoStandInFor and Reseat's sameModel prefer the agent's own
subscription for a found group that is gone.
Docs: gateway-routing.md's Model resolution row and the bare-ids section.
Run (mote, at this tree on
|
||
|
|
8544d5fdb5 |
settings: Download source says usemagpie.ai first, GitHub when it fails
Since v0.1.3345 an update's files come from usemagpie.ai (R2) and go to
github.com only when that fails; a mirror stands in for github.com only.
Settings › About › Download source still showed "GitHub", said updates
come from GitHub, and its button "Use GitHub" (zh 恢复官方) read as
switching back to GitHub. Now it shows usemagpie.ai, says GitHub (or the
mirror) is the fallback, and the button is Remove mirror (不用镜像), in
en, zh, zh-TW, ja and de. `magpie update mirror` says the same.
Run on mote (update-mirror, i18n-en-no-cjk, i18n-keys and cli vet again at the rebased head: ok but #5332):
- update-mirror, i18n-keys, i18n-en-no-cjk and every GUI file that opens
About (19 files), chromium + webkit: update-mirror and i18n-en-no-cjk ok.
The reds, rerun one file at a time:
- i18n-keys "a plugin's words are its own" and segs-press-redraw
"clicks its new self once": red the same at origin/main
|
||
|
|
2a64b4bcb7 |
library: a skill router, one magpie-skills skill listing an agent's skills
Like the MCP router, for skills. With the Skills tab's new "Skill router" switch on (off by default), each agent's skills folder gets one skill of magpie's, magpie-skills, in place of a link of each skill ticked for it. Its SKILL.md lists them, each with its description and the path of its SKILL.md, and the agent reads that file when a task fits. An agent then carries one skill's description in its prompt however many the Library gives it. - The entry is a link to <settings dir>/skill-router/<hash of the folder>/, which holds SKILL.md and a hidden .skills/<name> link of each listed skill (hidden, so Codex, OpenCode and Pi don't find a skill twice). Its description stays within 1024 bytes (Codex's limit), cut on a whole character. - Every skill is listed unless it is kept direct (a button on the skill, or `magpie library skill router <name> direct`; carried by a sync), is only for the user to type (disable-model-invocation), is in ~/.agents/skills, is blocked, or the agent has its own by that name. Those keep their own links. - An agent whose folder can't take it keeps every link, and the page says why: given copies, a live agent picking its own, the shared ~/.agents/skills, a Library skill called magpie-skills, or a magpie-skills of the user's (never written over). - Claude Code 2.1.316 asks before reading outside its project, its skills folder too, so magpie adds Read rules for the entry and the folders behind it to permissions.allow, records them, and takes out only its own when they go (as permissions.deny does). - The switch is this computer's alone; `magpie library skill router on|off` sets it from the CLI. - Sessions count a routed read of .skills/<name>/SKILL.md as <name> (Claude Code, Alma, Droid), and calling up magpie-skills itself as no skill, so a use counts once. - docs/subsystems/skill-router.md, with a row in the index. Run at this tree (rebased on origin/main |
||
|
|
d1f8d8aae7 |
agent: Cherry Studio adds magpie through its providers link (plugins#865)
Cherry Studio (CherryHQ) shows on the Agents page, and with
`magpie cherrystudio`, on macOS, Windows and Linux. Its row is the link
its main process takes, cherrystudio://providers/api-keys?v=1&data=, with
the gateway at <gw>/v1 as an OpenAI-compatible provider named magpie and
the named key agentKeyAt("cherrystudio"). Cherry Studio asks the user to
confirm it. magpie writes nothing into its store. "Added" is read
untouched from its 2.x database (Data/cherrystudio.sqlite, user_provider),
in the default userData and every one boot-config.json moved it to. A
database or boot-config that can't be read, or a 1.x userData (Local
Storage, no database), is unknown. The data is standard base64, because
Cherry Studio swaps raw + and / before parsing and back after. /api/open
lets that link through. aionui's database status is generalized into
dbStatus{has} so both apps share it. Icon: Cherry Studio's own logo, not
cherryin-color (a different product).
Run (mote, at this change on origin/main c66cdbea9; then rebased on
|
||
|
|
8bba91e65a |
cli: GET /api/context/session is the window's own (TestEveryRouteHasACommandOrIsNamed)
|
||
|
|
b0926e81a2 |
import: a link can say where its key's balance is read (balance=, balance_path=, balance_method=)
A relay's "Add to magpie" link can now name the URL that tells a key its balance, where the amount sits in the reply, and GET or POST. magpie takes it only on the host of one of the link's own base URLs, over https, with no userinfo or fragment, so a link can't send the key anywhere its requests don't already go; anything else refuses the whole link. balance_path or balance_method without balance is an error. No header or token is taken from a link: an account-wide token is worth more than a key, and a URL stays in browser history. - provider.ParseImport: linkBalance checks and sets BalanceURL, BalancePath and BalanceMethod. - CLI: the import preview shows the balance URL and doesn't ask it before yes (showProviderAsking). - GUI: the import dialog shows method, URL and field (.imp-bal). - Docs: docs/import in en, zh and ja (table rows, a note on headers, the builder's three fields with the same host check, a security bullet); docs/reference.md's parameter table. Run on mote at this tree (rebased on |
||
|
|
e215d335a6 |
gateway: a gateway key can cap its requests at once; the rest wait their turn
young02036 on Discord: a provider can be given a concurrency, so why
can't a gateway key? A key now has an optional MaxConcurrency, from 1
to 1000. Left unset (every key today), nothing changes.
- access: Key and Change get MaxConcurrency, and Identity carries it, the
issuer's cap included. The concurrency-key action refuses a value
below 0 or above 1000.
- gateway (key_slots.go): every route that asks a model is held to the
key's cap, however the request came (loopback, LAN, a Remote magpie, a
Responses socket's turn). One request too many waits in the key's
queue in arrival order. It shows as "slot" in Active, and its wait goes
into the try's Queued. A request whose agent goes away while it waits
leaves the queue and sends nothing. A stream holds its slot until it
ends. serve's routes (chat, responses, messages, ollama, gemini, the
Codex backend) wait inside the try, after keepQueued, so a streaming
agent gets keepalives while it waits. The other model routes (images,
embeddings, rerank, audio, videos, search, decisions, native) wait
before their handler runs. forward and codexUpstreamOn take the slot
too, so nothing reaches a vendor without one. A key issued under
another waits for its own slot, then for its issuer's.
/v1/magpie/concurrency lists each capped key under "keys", and counts
its waiters in "waiting". A key's limit (key_limit) reports the cap.
Not held, as a provider's MaxConcurrency doesn't hold them: GET,
HEAD, OPTIONS, count_tokens, :countTokens and MCP.
TestKeySlotEveryRoute fails when a route is judged neither held nor
free.
- cli: magpie gateway-key concurrency <id> [<n>|off]. It refuses 0, a
negative, over 1000, a fraction, a word, --help or an extra argument
with its usage.
- gui: the key row gets a badge in the provider concurrency badge's
style. It opens the app's menu with No limit, 1/2/3/5/10 and Other…,
and Other… takes a number typed in place. A value that isn't a whole
number up to 1000 is refused and nothing is sent. Browser and
read-only keys have no badge. Strings are in en, zh, zh-TW, ja and
de. An unset badge, which a hover shows, gives way before the masked
key (flex-shrink 8). Without that, at 420px in en and de, the extra
badge squeezed the key until its copy button slid under the pointer
that came to drag the row, and gateway-key-arrange went red.
- docs/subsystems/gateway-routing.md describes it.
Run (on mote, at this tree on origin/main 0f8c3d867; rebased onto
|
||
|
|
37df73b1bb |
balance: a key holds several credits that expire, each added and removed on its own
tenacious_eagle_96548 (Discord, 11-08) has two promotional credits on one
key, one ending tomorrow and one the day after. v0.1.3305 kept one grant
per key, and its form showed the date only after Enter or a blur, with no
button to confirm.
- OwnBalance.Expiring is now a list (`expirings`, up to 20). Spending
goes to the grant that ends soonest first (ties by when it was typed),
and each grant drops out at its day. A write prunes ended grants.
- The pill and the menu say "Expires in N days" per grant, amber from 7
days. The menu has a Remove item per grant, "Add credit that
expires…" and "No credit that expires" to clear them all.
- The form shows the amount and the last day together, the day filled in
30 days ahead, with an Add button; Enter adds, Escape cancels, a bad
amount or a past day is refused in place. The app's own menu, no
native select, no stripes. A pill with two or more grants wraps at a
grant on a narrow row (a class, not :has(), for Safari before 15.4).
- CLI: `--expiring amount@day` can be given several times, `--expiring
off` clears all, `--expiring-remove [amount@]day` removes one. --help
prints usage; a day that isn't a date, or is past, is refused.
- /api/provider/keyexpiring adds `{expiring:{amount,until}}`, removes
`{expiring:{at,until},remove:true}`, clears `{expiring:null}`.
Old data: a v0.1.3305 single `expiring` grant is read as the first grant
and saved as `expirings` on the next write, for every user. An older
magpie reading the new file sees no grants (the balance itself stays).
Run on mote at
|
||
|
|
c736906b17 |
providers: part of a key's typed balance may expire on a day
tenacious_eagle_96548 (Discord, #general): some vendors split a balance
into money that stays and credit good until a date. A key's balance typed
by hand can now carry that part (`expiring`: {amount, until, at}, in the
balance's currency, until = the last day it counts).
- Spending order: the expiring part is spent first, as DeepSeek spends
its granted balance before money topped up. It takes the spend from its
`at` up to its end (midnight after `until`, local time) or now; only
what it took after `From` comes off the rest, so a refill or typing the
balance again doesn't count it twice.
- Left is the whole balance. From its end the remainder counts no more,
and unspent credit is gone.
- Typing the balance again keeps the part in the same currency and drops
it in the other, where its amount would mean another sum.
- A balance saved before has no part and reads exactly as it did
(TestTypedBalanceSavedBeforeExpiring).
- Set from the pill's menu: "Credit that expires…" asks the amount, then
the last day (a day gone by, or the other currency's sign, refused);
"No credit that expires" takes it off. GUI route provider/keyexpiring;
CLI `magpie provider key-balance <id> <key> --expiring amount@yyyy-mm-dd|off`.
- Shown: the pill "≈$100.00 left · $30.00 expires in 30 days", the Usage
page and panel line "Expires in 30 days ≈$30.00", amber from 7 days;
TUI and `magpie quota` "($30.00 until Dec 7)". New strings in zh,
zh-TW, ja and de.
Run (mote):
- go test of internal/provider, internal/gui, internal/cli (with
TestCoreScriptBudget: the days' lines in app.js are paid for by five
balance comments cut there, no raise; core 1,533,559 of 1,533,802); the new tests
again with TZ=UTC and TZ=Pacific/Kiritimati (every clock held);
gofmt -l clean; GOOS=linux and GOOS=windows go vet of those packages.
- GUI: key-balance-expiring.test.cjs 20/20 (chromium and webkit, 400px,
en/zh/zh-TW/ja/de), with every balance-*, key-*, i18n-* file: 768
pass, 6 red, each red the same alone on origin/main
|
||
|
|
7880a00ac6 |
models: a model of a key's provider can be asked on System One
axelburks on Discord: a relay serves its decision model under a name of its own (an Ark endpoint id). A key's provider with a System One URL beside a conversation URL can set a model's API to decide (System One in Model settings' API row, its chip's right-click, or `magpie model api <pid/model> decide`). The model is then a decision model there: asked on System One by its own name, offered to routing groups, kept out of the conversation models, and a turn for it is refused with 400 before the vendor is asked. Auto gives it back. A provider with no System One URL, with that URL alone, an account, a remote magpie and Vertex refuse it, saying why. Chat routing (apisAmong) ignores decide. Broken by hand: removing the decideSet check in DecidesModel turns TestModelSetToSystemOneIsADecisionModel and TestModelSetToSystemOneAskedThere red. Run, on this stack over origin/main |
||
|
|
7a6211d047 |
providers: a model's own headers, in Model settings
axelburks on Discord: a vendor routes one model by a header of its own. A key's provider (built-in or custom) can give each model headers (settings.ModelHeaders["pid/model"]). They go on that provider's requests for that model alone, after the provider's headers and after auth: a name both have is sent once, as the model's, so a user's value is never overridden by the provider's or magpie's key header. The gateway names the model (provider.WithModel) on every route that asks one: chat on each API, translated and streamed, count_tokens, System One's decision, embeddings, images, videos and the model test. A fallback provider serving the same model id gets its own headers only. Accounts and plugins carry their sign-in's headers and take none. The editor's "Name, price and reasoning level" panel is now "Model settings" (every language), with + Add header per model, staged and made with the Save; Restore default takes them away. The rows being typed are kept out of the draft's compare, so an untouched editor still closes without asking. Broken by hand: dropping WithModel from gateway.go turns TestModelHeadersReachTheirModelOnEveryRoute red; dropping the provider id check in modelOf turns TestModelHeadersStayWithTheirProvider red. Run, on this stack over origin/main |
||
|
|
ae58ec9b44 |
providers: a key's provider can have its model list off
axelburks on Discord: Ark's pay-as-you-go list names models that can't be asked for, and each one is asked by an endpoint id the user made. A key's provider can now have its list off (Provider.ListOff): nothing asks its vendor for a list (Fetch, Refetch, List, RefreshLists, a test, a new key's prefill, a resting key's probe), a list fetched before and models.dev's are not read, and only the ids added by hand are served. The editor shows it as "Fetch the model list", ticked by default; unticked, Fetch models and Forget go. A save that doesn't name listOff keeps it. CLI: `magpie provider set <id> list=off`. Accounts and plugins list as their sign-in does, so they don't take it. Broken by hand: ListAsks returning false for a list-off provider turns TestListOffAsksNoListAndServesTheIDsAdded red; dropping the keep in the save turns TestProviderSaveListOff red. Run, on this stack over origin/main |
||
|
|
cdf734757a |
agent: OpenMausBot gets magpie's models back, and a Restart for a list it hasn't read
maxleebeta (Discord #feedback, 11-08) picked Antigravity's models in
magpie, and OpenMausBot's model search didn't find them. magpie wrote them
correctly: a sandbox with an Antigravity sign-in lists
antigravity/gemini-3.8-flash[1m] and the others in config.json. OpenMausBot
loses them in three ways, each reproduced on the real app:
- it reads config.json once, at start, so a list magpie writes while it
runs never reaches its picker;
- a change to any engine in its Settings writes back every engine as it
held them since it started, so magpie's newer list is replaced by the
old one;
- an edit of magpie's engine there (updateClaudeEndpoint) keeps only the
model picked.
Nothing in magpie wrote the list again: a sync runs on a catalog change,
or when magpie starts.
- KeepOpenMausBotListed (gateway.WhileServing, every 30s) writes magpie's
list again when the file lists other models (ombListStale). The model
picked in OpenMausBot (ANTHROPIC_MODEL) and its other engines stay. It
isn't a Check drift: that reads as unwired, and a port change rewires
only agents without one.
- OpenMausBot gets a Restart on its Agents row (restartApps: OpenMausBot.app,
OpenMausBot.exe; appReads: ombPart = gateway, first model, list, not the
key), so one running on an older list is offered a reopen. Its own save
of the same engine after it starts doesn't count.
The same gap in NewMax, LiveAgent, OpenPencil, OpenBot, Pencil and ZCode
is #5662.
Run (mote, at this tree rebased on origin/main 00198b26e;
|
||
|
|
0fc3455e2a |
providers: a key's typed balance may be in yuan and refill each month or week
tenacious_eagle_96548 asked, after v0.1.3281's typed balance, to type it
in RMB and to have it refill (e.g. $10 a month, on the 1st).
- A balance may be typed in yuan ("¥100", "100元", or a bare number while
Settings shows costs in CNY). What magpie counts spent stays in USD and
is turned into yuan at fx.Known(): the rate internal/fx last fetched
(cached 12h, fetched again in the background, never on a request).
fx.Known never returns fx.Fallback, so with no rate fetched and
something spent, what is left is unknown (left null; the card says
why), not a guess.
- An optional refill: monthly on day 1-31 (past a month's end, its last
day) or weekly on a weekday, at midnight in the user's local time.
Nothing is stored on a refill: the spend counts from the last boundary
after the balance was typed. Typing the amount again keeps the refill.
- GUI: the pill's menu gains Refills each month… (a day, in place),
Refills each week… (the app's menu of weekdays) and Never refills;
provider/keybalancerefill; keyownbalance takes currency cny. CLI:
magpie provider key-balance <id> <key> [usd|¥cny|off]
[--refill monthly[:day]|weekly[:mon…sun]|off]. Strings in zh, zh-TW,
ja, de. docs/subsystems/providers-accounts.md updated.
Run on mote at this tree (base origin/main
|
||
|
|
d32a7a70cb |
remote magpie: once magpie updates, the Remote magpies it uses update too
nnlrl_75403 on Discord: a magpie used as another's Remote magpie stayed on
its old version after the local one updated, and had to be updated by
hand on the other computer. Now nothing needs setting up:
- provider.KeepRemotesUpdated (started by the app's updater and by
magpie serve) runs UpdateRemotes 30 s after start and hourly. A
released build with automatic updates on reads each Remote magpie's
version (GET /v1) and, when it is older, asks it through
POST /v1/magpie/update?version=<v> with the provider's key, at most
once in six hours per version. Off here, or a dev build: nothing asked.
- The remote updates as its own automatic update would: the app
downloads and restarts once idle (updater.updateAsked → download,
waitIdle); magpie serve puts the latest in where it runs from, one at
a time, never elevated, and serveFollow restarts into it. Automatic
updates or downloads off there: it answers "off" and stays.
- A copy that can't replace itself says why: a container (docker pull
ghcr.io/yetone/magpie:latest), a package manager's (its command), a
folder it can't write, a build from source. A magpie from before the
route answers 404 ("too old"), a read-only or held key is "refused".
The provider's row on the Providers page adds a short status to its
line ("updating to v…" for 30 min, or "can't update itself" etc.),
with the reason and the command in its tooltip. en/zh/zh-TW/ja/de.
- The route replaces the program, so it takes the Codex reset's
admission: another machine only while shared, never a browser page,
an enabled key with full access from loopback too (401 without one),
read-only 403 gateway_key_read_only, held 403 gateway_key_held. It is
in readOnlyRefused and the CORS route list.
App.js stays under TestCoreScriptBudget by cutting two comments; the
budget is not raised.
Run (on mote, at the tree committed here):
- gofmt -l internal/: clean. go vet of gateway, gui, cli, provider for
darwin, GOOS=linux and GOOS=windows: ok.
- go test -count=1 ./internal/gui ./internal/cli ./internal/provider
./internal/gateway: gui and cli ok but for #5644's two settings tests
(red on main since
|
||
|
|
c7c05dcf2b |
settings: the routing groups' defaults are kept through a Settings save and known to be saved by the Routing page's own route
|
||
|
|
f8525323dd |
providers: a key with no balance URL takes a balance typed by hand, counted down by magpie's own usage
Some API-key providers tell no balance magpie can read (no Balance URL, no relay query found), so their keys showed none. Now the user types what the vendor's page says is left, on the key's row in the provider editor (Set balance) or with `magpie provider key-balance <id> [key [usd|off]]`. The key's card shows that less what magpie's usage priced the calls it sent on the key since it was typed (usage.KeySpent, the spend caps' count), marked as an estimate: "≈$12.50", the pill "≈$12.50 left", its title saying what was typed, when, and what was counted since. Typing it again counts from then; No balance takes it off. A balance the vendor tells always wins: a provider with a Balance URL, a plan source, Cline's or OpenCode Zen's card takes none typed, and a relay whose query is found shows its own; when the probe finds none (errNoBalance) the typed one is shown. A typed balance stays saved as the user left it: the editor's save keeps it, a key's replaced value carries it. An estimate is never kept in the balance history and tells routing nothing (the routing allowances cache is left alone). keybalance.js is loaded by keyspend.js (itself loaded when the editor draws a key) for a provider that takes one, so app.js and the core's script budget are unchanged. Words in zh, zh-TW, ja and de. Run at this tree (mote): - go vet ./... (darwin), GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... at base 46b10af87; at this tree go vet of gui, provider, cli and usage; - go test -tags nogui -count=1 ./internal/gui ./internal/provider ./internal/cli ./internal/usage: provider and usage ok; gui and cli red only on #5644 below; TestCoreScriptBudget ok (1,533,747, as main) - the provider tests under -race -count=3; - GUI: key-own-balance (new: Chromium and WebKit, en zh zh-TW ja de, 900 and 400px, 20/20), key-spend-cap, old-webkit, i18n-keys, gui-de, gui-ja, gui-zh-tw, balance-found, key-balance-card, i18n-en-no-cjk: 104 pass, 1 fail, i18n-keys "a plugin's words are its own", red the same on origin/main |
||
|
|
710f0290cc |
masking: a masked value in a request opens Copy and Never mask
yew_fence on Discord: in Insights › Masking's diff of a request, a false positive can't be copied or put on the allow-list from there. Now a masked value in the request's text, as written here or as the vendor got it, opens the app's row menu (right-click on a value card under it): - Copy copies what the value was, through /api/copy (it is the user's own value, shown on this computer only). - Never mask posts the placeholder to the new POST /api/masking/allow. The server asks the masker for the value it stood for (so only a value masking masked can be added), reads settings with LoadChecked (an unreadable file is not written over), appends it to RedactAllow, the list Settings › Privacy's Never mask saves, and Save trims it and keeps one copy. allows() runs after the span memos, so the next request sends it as written. Off, with why, for a value already on the list and for one of the user's own Masked words. A value from before a restart is not in memory and opens nothing. Strings in plugins/redact/i18n.js for zh, zh-TW, ja and de. settings parity maps the route as S2. Run on mote at this tree rebased on |
||
|
|
c8eb7b3877 |
search: a search API's keys are a list, each switched off, moved and removed on its own
Web search took one key per API in one field (辰林鸭~ on Discord: only one
Tavily key). Settings › Models › Web search now lists an API's keys under
it as a provider's accounts are: each masked on its own row with a tick
(off / on), Show, Copy and Remove; several pasted at once (commas,
semicolons, lines), the reply saying how many were new and how many it
had; the order changed by dragging or Alt+↑/↓. A resting key says why and
until when on its row ("asked last until 14:05: rate limited"), from the
gateway's rest (SearchKeyRest, SearchQuota.Ref); rotation on 401/403,
402/432/433 and 429 (#1477) is unchanged.
provider.SearchAPI keeps Key as the keys on, comma-joined, so the gateway
and an older magpie never ask one switched off; keyList is written only
while a key is off. A Key that differs from the list (an older magpie, a
sync) wins, its keys on in its order, the list's off keys after. The last
key on can't be switched off or removed. The GUI names a key by
SearchKeyRef (a hash): POST /api/settings/search-keys (add, ref+on,
ref+remove, arrange) and /api/settings/search-key with ref. Saving an API
with no key keeps its keys, off ones too. Backup and WebDAV sync carry
the off keys, or leave them out with the rest. `magpie search` says
"+N off". docs/subsystems/gateway-routing.md has "The keys as a list".
Run (mote, at this tree, base
|
||
|
|
abe7b00631 |
gateway: a key+URL provider is sent the agent's own User-Agent by default, through a remote magpie too
nb5p runs a gateway of their own behind magpie and saw nearly every request arrive as "magpie/<version>". The agent's User-Agent now goes on as the agent sent it, wherever magpie isn't itself the client. What each path sends now: - Key+URL providers (official vendor keys and custom OpenAI/Anthropic compatible ones), on chat, Anthropic, Responses, Gemini, count_tokens, embeddings, images and videos: the agent's User-Agent, as sent. Before, this was the opt-in passUserAgent (#1851) and the default was magpie's. The opt-out is magpieUserAgent: `magpie provider set <id> user-agent=magpie`, or untick "Send the agent's own User-Agent" in the editor. passUserAgent is no longer a field, so a file that set it true reads the same as the new default. A provider someone turned back off after opting in can't be told apart from one never touched, and now sends the agent's too. - When the agent sent no User-Agent, and on magpie's own requests (classifier magpie-router/1, vision, search, the image tool, model lists): magpie's, unchanged. - A header.User-Agent the user set: still wins over both. - Subscription accounts (Claude, Codex, Copilot, Google, ZCode…), plugins, and OpenCode/Cline/Kilo: unchanged. Their signing sets the official client's UA (provider.PassesUserAgent still refuses an Account or OwnClient). - Claude Code and Codex header copies: unchanged. - Remote magpie: the near magpie still asks as magpie/<v>, because the far end trusts X-Magpie-Agent/Via only from that. It now adds X-Magpie-User-Agent (passOnUA, on forwardOnce, embeddings, draw and video; the classifier's decision request names none). The far end takes it only from a magpie/ request (callerFrom) and strips it on arrival (withCaller). agentUA/callerUA then hand it to userAgentFor, so the far vendor sees the agent's. A client that writes the header itself, straight to a magpie, is ignored. magpie's own UAs are never relayed (magpiesOwn). Vendor check: invalid-key requests with magpie/, claude-cli, a Chrome UA and pi's went to Anthropic, OpenAI, Gemini, DeepSeek, Moonshot, Kimi For Coding, Zhipu, OpenRouter, xAI, DashScope, MiniMax, Volcengine Ark, Groq and Mistral. Every vendor gave the same auth error for every UA, so no edge-level UA gating was seen. Kimi For Coding's agent allow-list sits behind a valid key, which wasn't tried. Run (mote): - go test -run 'UserAgent|RemoteMagpie|ZCode|Blocked' ./internal/gateway: ok - go test ./internal/provider ./internal/cli ./internal/gui: ok - node --test provider-user-agent, provider-native-compaction and i18n-keys (chromium and webkit; en/zh/zh-TW/ja/de; 900 and 440 wide): 123 of 124 pass. The red is i18n-keys "a plugin's words are its own" (plugins' words said in files this change doesn't touch), already filed as #5327/#5332, #5426 and #5482. - gofmt -l clean; go vet; GOOS=linux -tags nogui and GOOS=windows vet: ok at the rebased head (on |
||
|
|
da548b4548 |
codex: a reset about to expire can be used from 3 minutes before, or after any minutes typed (Custom…)
shangyuan0818 asked again, and the coordinator agreed: magpie runs the whole time, a reset's expiry is known to the second, and a user who is worried can pick a long lead. So the menu ends with Custom…, and the floor is now what the gateway needs, not 15 or 5 minutes. - settings: CodexResetLeadLeast 5 -> 3; the presets start at 3. The CLI (magpie quota reset-lead) and settings/codex-reset-lead check the same constant. Saved values stay valid: everything from 5 to 1440 still is. - Why 3: since v0.1.3204 the loop wakes at the lead's start (timer, at most 1s late), a try is bounded by the pass's 2 minutes, and a failure in the last 15 minutes is tried again a minute after it began, at once when that has passed. At 3 minutes a try hung to its bound ends at T-0:57 and a retry starts at T-0:56. At 2 minutes a hung try leaves no retry before expiry. - GUI (autoresetown.js): Custom…, the menu's last item, puts a field of minutes where the button was, at the button's size, so the row doesn't rewrap. Enter or leaving it saves. Escape keeps the lead. A number outside 3 to 1440 is shown as an error and not written. A redraw leaves the field alone while it is open. It uses the app menu and no native select. There is one new string, in all five languages. Tests: - TestShortLeadSpentInTime: at the least lead, for four phases, the reset is spent at T-3:00, and after a 2-minute hung try plus a 30s retry it is spent before expiry. - TestQuotaResetLeadCmd: 3m is taken and 2m is refused. - codex-reset-lead.test.cjs: 12 items, picking 3 min, and Custom… in every language at 1100 and 420. Typing 7 and pressing Enter posts 7. Typing 2 is said and not posted. Escape posts nothing, and leaving the field posts 12. Opening the field moves no page. Run on mote at this tree: - go test of the reset-lead, short-lead, reset-loop, expiring and quota-reset tests in provider, cli and settings: ok. - go vet: darwin, linux -tags nogui and windows on provider, settings and cli, plus darwin on gui: ok. - go test ./internal/gui: TestCoreScriptBudget ok with no raise (the field lives in the lazy autoresetown.js). TestMainWindowCorners is red, as in #3949. - GUI codex-reset-lead, codex-auto-reset-settings and i18n-keys in Chromium and WebKit: 49/50. The red is i18n-keys "a plugin's words are its own", filed as #5327, #5332, #5426 and #5482. Before the last comment trims, codex-reset-lead, codex-auto-reset-settings and providers-reset-use passed 86/86. Broken by hand, each red: - Floor at 2: the least-lead hung case goes red (one try, no retry), and so does the CLI (2m taken). - Floor at 5: the CLI refuses 3m. - The GUI range check removed: "2 isn't posted". - Escape saving: "Escape posts nothing". - The field at its own size (76x27) instead of the button's: WebKit ja and de at 1100 move the page 1px. Not tried: a real ChatGPT reset spent at 3 minutes, since none of my accounts has a reset about to expire. The redraw guard has no test of its own, because a click elsewhere blurs the field and saves first. Reported-by: shangyuan0818 (Discord) |
||
|
|
e484b4ff26 |
update: a slow download still moving is never ended by a total time; Bun, Claude Code and pf-serve too
#5572: since |
||
|
|
d4a221f79c |
codex: a reset about to expire can be used 5 or 10 minutes before it does
shangyuan0818 on Discord asked for leads under 15 minutes (1, 3, 5, 10, or
free seconds) for Codex's auto-use of the reset about to expire, to use
more of the windows first. The shortest was 15m because the gateway only
looked every 5 minutes after a pass ended (a pass is bounded at 2
minutes), so the gap between looks could reach ~7 minutes. With a 5-minute
lead, the reset could run out before any look landed inside it.
- provider: a look lands on the lead's start (nextResetLook takes the
sooner of +5m and until-lead), and the loop sleeps until the soonest look
due among the accounts its pass went over (expiringResets.wake: 5m at
most, 1s at least; an account the pass skipped wakes nothing). A read or
spend that fails inside the lead in the last 15 minutes is tried again
in 1 minute (retryResetLook), not 5; a long lead failing earlier keeps
the 5-minute cadence. A retry that came due while a hung pass ran is
made at once.
- settings: CodexResetLeadLeast 15 -> 5; choices 5m, 10m, 15m, 30m (default),
1h ... 24h. Saved values from 15 to 1440 stay valid; the default is
unchanged.
- GUI (app.js RESET_LEADS, resetLeadMinutes) and CLI (magpie quota
auto-reset lead) follow the same range. No new strings ("{n} min"
already exists). Still the app menu, no seconds field.
Why 5 and not 3 or 1: in the worst case a try hangs to the pass's 2-minute
bound. At 5m: try at T-5:00, hung until T-2:57, retried at T-2:56, so two
tries before expiry (four when ChatGPT refuses at once). At 3m a hung try
leaves no retry. At 1m one try cannot even run to its own bound, and
local-vs-server clock skew eats the rest.
Run (mote, via mote-run, at base
|
||
|
|
9ed0f1fa49 |
agents: Claude Code's prompt cache lifetime is picked in its settings
Linka (Discord) asked to set Claude Code's prompt cache TTL from magpie. Until now only Usage › Context's "Tuned for you" card wrote it, and that card offers nothing when the value is already the cheapest it found. Claude Code's opened row and settings sheet now have two rows under its own Long conversations: "Prompt cache · main conversation" and "Prompt cache · subagents". Each opens the app menu with Claude Code's default, 5 min and 1 hour. They write the keys the card writes, promptCacheTtl and subagentPromptCacheTtl in Claude Code's settings.json (agent.ClaudeCacheSet, POST /api/settings/claude-cache). Default takes the key out. A pick is the user's own: it forgets the card's stash, so the card's Undo leaves it. A variable that comes before the setting (FORCE_PROMPT_CACHING_5M, CLAUDE_CODE_PROMPT_CACHE_TTL, CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL, in settings.json's env or magpie's own) disables the row and names the variable, and the route refuses it, so a value the user set by hand is never written over. The names were checked in Claude Code 2.1.316's binary. Its resolver checks FORCE_PROMPT_CACHING_5M, then the env var, then the setting (enum "5m"/"1h"), then an agent's experimental.cacheTtl, then ENABLE_PROMPT_CACHING_1H. With nothing set, the main conversation gets 1h on a subscription within its limits and subagents get 5m. Run (mote, at this tree on |
||
|
|
30a0bfe889 |
gateway, provider, cli: search APIs marked mix are asked together, their pages merged (#2845)
A search asked the search APIs in order and gave the model the first one's pages. On #2845's 80-query benchmark no single API was best on both sets. The deduplicated union of two or three APIs' pages scored higher than the best single API and lost no query (60-query set: 108 to 114-117 of 120, sign test p <= 0.03). Off by default. When two or more search APIs are marked mix (SearchAPI.Mix), they are asked first, at once (askSearchAPIsTogether). Each uses its own keys and timeouts, as when it is asked alone (askSearchAPIKeys). Their pages go to the model in turn: each API's first page in the saved order, then each one's second. A page an earlier API already gave is left out by its address (pageKey). One that fails or finds nothing leaves the others' pages. When none finds anything, the APIs not mixed are asked in order. With fewer than two mixed APIs on and ready, a search runs in order as before. No text says which API found a page, so what a vendor sees reads as before. MixSearchAPIs marks the vendors named (two or more, set up, each once) and clears the rest; none clears all. SetSearchAPI keeps the mark, as it keeps off, since Settings sends an edit without it. Backup copies the whole entry, so the mark carries over. CLI: magpie search mix <api>,<api>, magpie search mix off, and magpie search lists a mixed one as mix. docs/subsystems/gateway-routing.md has a section on it. Ported from mdwsk88's 2966cce77 and reviewed line by line. What changed from it: - The cap follows the search's count (#5545, the commit before this): searchMixMost is 2 x the count a search asks for, at most 20 (searchHitsMost). The default stays 12 pages, as in the patch. TestSearchAPIsMixedCapped is a table over count settings and named counts. - The CLI keeps both search count and search mix. - No Settings toggle. The mode stays CLI-only, by the UI-restraint rule; the docs say so. Run (mote-run): - go test -count=1 -run "Search|Mix" ./internal/gateway/: ok; -race -run "TestSearchAPIsMixed|TestMixSearchAPIs": ok. - go test ./internal/provider/ ./internal/backup/: ok; ./internal/cli/ -run "TestSearchCLI|TestEveryRoute": ok. Broken by hand: with apiSearch's mixed branch turned off, TestSearchAPIsMixedAskedTogether fails (only the first API's pages) and TestSearchAPIsMixedCapped fails ("count set 0, named 0: 6 pages, want 12"). Restored, both pass. Not tried: a real search with two vendors' live keys. The tests use fake search APIs. Co-authored-by: mdwsk88 <11055210+mdwsk88@users.noreply.github.com> Reported-by: mdwsk88 (dawei on Discord) |
||
|
|
4e0e8e7933 |
gateway, settings, gui, cli: the results a search is answered with can be set, 1 to 20 (#5545)
Claude Code's WebSearch and Codex's web_search never name a count, so magpie answered every such search with searchHits, 6 pages (#5545, mdwsk88: more pages for research-heavy work, fewer to save context). settings.SearchCount holds the count. 0 means the default, 6 (SearchCountDefault), and the most is 20 (SearchCountMost), the most Brave and Tavily return. Save refuses a value out of range, so nothing is written. Settings.SearchPages reads it. The gateway's searchCount falls back to it when a search names no count. The web_search MCP tool still answers a named count with that count, and its schema's default says the count set. It reaches every search API (Brave, Tavily, Exa, You, the plugins' searchers), as a named count already did. - Settings › Models › Web search: "Results per search", segments 3, 6, 10, 15 and 20, plus a count set by hand in settings.json. POST /api/settings/search-count sets it alone. settingsapi.Apply keeps it as it keeps search-all, so a save of the Settings form doesn't put it back. - CLI: magpie search count says the count; magpie search count <n> sets it; magpie search count default puts 6 back. A bad value is refused and nothing is written. - docs/subsystems/gateway-routing.md says it. - New strings are in zh, zh-TW, ja and de. Run at this tree (mote-run, macOS): - go test -count=1: internal/settings, settingsapi, cli, gateway (TestSearchMCPCount, TestSearchCountReachesEveryAPI, TestSearchCountSetting), and gui (TestSettingsSearchCountSetOnItsOwn, and TestSettingsSaveKeepsWhatItDoesNotSend with SearchCount set): ok. internal/gateway whole: ok with -timeout 45m (847s). internal/gui whole: ok but TestMainWindowCorners/macOS_26_SDK (#3949, mote is on macOS 27). The first cli run was red on TestEveryRouteHasACommandOrIsNamed: the new route had no CLI entry. cliForRoute maps it to search count now. - Broken by hand: searchCount returning searchHits again makes TestSearchCountSetting fail ("set 11: a search naming no count asks for 6, want 11"). Restored, it passes. - GUI: node --test --test-concurrency=4 over routing-*, usage-*, ledger-*, panel-*, call-*, search-*, searcher-*, settings-*, i18n-* and gui-* (Chromium and WebKit; the files cover en, zh, zh-TW, ja and de), with #2398 and #5545 in one tree: 4961 of 5016 ok. The 55 reds are in 12 files. i18n-keys' "a plugin's words are its own" names other files' strings (#5327, #5426, #5482). The other 11 files were run alone at dc49feca9 (this tree without either change) and at this tree: 52 and 51 reds, the same tests. The one apart is usage-focus-steady, which flakes (#3501). Each is filed: #5392, #3414, #5048, #3799, #3415, #3954, #4627, #4628, #5223, #1529. routing-canceled-row.test.cjs: 10 of 10. With the .rt-req.gone rule taken out, its dot is the answered green rgb(24, 154, 88) and it fails. Restored, it passes. - Not tried: a real Claude Code WebSearch through this tree with a live search API key. The tests use fake search APIs. Co-authored-by: mdwsk88 <11055210+mdwsk88@users.noreply.github.com> Reported-by: mdwsk88 (dawei on Discord) |
||
|
|
d55881730d |
gateway: a key can be held to some MCP servers and tools
wakaka on Discord (#help, 11-06) asked for gateway keys limited to some MCP servers and tools, as keys already are to models (#882). A key's MCP list (caller-keys.json "mcp") holds entries "server" (every tool of it) or "server/tool"; "-" alone is no MCP server; an empty list is every server, as before. A key issued under another is held to its issuer's list too. Every MCP route checks it: - magpie's own servers (web search, vision, image, Magpie Browser, plugin tools) through serveMCP: initialize/tools/list/tools/call are refused or filtered per server and tool, and /v1/magpie/key-limits names "mcp"; - the Library hub ("magpie"): only the backing servers and tools the key may use are listed, and a call by name or by fallback is refused; - /mcp/<name> and /mcp/run/<name>: the server is refused, tools/list is filtered in JSON and SSE replies, tools/call refused; a reply the filter can't read (an encoded body) is a 502, never passed through. GUI: "MCP servers" in the key row's menu opens the app's own picker (no native select) with All, No MCP server, each server and its tools (GET /api/caller-keys/mcp lists magpie's own servers and the Library's). A key held to some shows a badge saying which, that opens the same list; a free key shows nothing more in its row, on hover either. A hover badge was tried first: it pushed the row past 560px (gateway-caller-keys) and squeezed the masked key under a drag at 420px (gateway-key-arrange). CLI: magpie gateway-key mcp <id> github fs/read_file | none | all. zh, zh-TW, ja, de strings; docs/reference.md and the gateway-routing and library subsystem pages. Not covered: a model's own built-in web search (a vendor tool, not MCP). GET /api/caller-keys/mcp is named in the CLI parity test's notYet (its list is what `magpie gateway-key mcp` takes; TestEveryRouteHasACommandOrIsNamed caught it at the rebased head). Run on mote (mote-run), at the pushed head: - go test ./internal/access ./internal/cli ./internal/gui ./internal/library ./internal/gateway at a9c40186d (this change on |
||
|
|
8cbaeecae9 |
providers: errors=pass sends a vendor's error to the agent as it came, asked once
ne9ko9 on Discord wants errors handled explicitly, not by inference, and a mode that passes them straight through. A custom or API-key provider (no account, an endpoint of its own, not a subscription) now takes `passErrors` in its config: "magpie handles" (the default, unchanged) or "Pass through". Nothing sets it but the user, and an edit that doesn't send it keeps the saved value. With it on, for that provider: - no rewriting: on the client's own API, upstream's status, Content-Type and bytes go out (passError); on another API, the client's shape is built with the vendor's own type, message and raw code and param (a numeric code stays a number). Retry-After and *ratelimit* headers go with it; - no too-long inference, no busy words, no 413 hint, no policy rewording (settle never runs: the try is passing); - no gateway retry: forward()'s Retries loop, refit, firstWait, the loop's re-asks, reloop, empties retry and streamTranslated's cont.again all stop; - no fallback and no rest: the candidate loop's one choke point, newHoldWriter(…, !pass && …), lets the try pass, so nothing after it is tried, and restAfterMarked answers By "off". magpie's own file-id re-ask (dsRetryGone) still runs, as it fixes magpie's own upload, not the vendor's answer. CLI: `magpie provider set <id> errors=pass|magpie`; a bad value is refused and keeps the old one; an account is refused. `provider show` says "errors pass". GUI: Edit → Advanced → Errors, a quiet app-menu picker (openProtoMenu, no native select) with "magpie handles" and "Pass through", shown only where takesPassErrors; zh, zh-TW, ja, de. It is drawn by passerrors.js, imported when the editor draws the row (old-webkit's lazy list names it), and app.js pays for its few lines by two comments cut, so app.js is smaller than before and TestCoreScriptBudget's numbers are unchanged. Tests: - internal/gateway/pass_errors_test.go: TestPassErrorsAskedOnce (503, 429, 404 with numeric codes, alone and as a group's first member: exact bytes and status, asked once, the second member never asked, no rest), TestPassErrorsNotInferred (a too-long 400 byte-for-byte), TestPassErrorsOtherAPI (Anthropic 403 code 20031 to a Chat client, streamed and not). - internal/provider/pass_errors_test.go, internal/cli/errors_cli_test.go. - internal/gui/tests/provider-pass-errors.test.cjs: every language, 1100 and 420 wide, Chromium and WebKit. Run, through mote-run at this commit: - go test -count=1 -timeout 45m ./internal/gateway ./internal/provider ./internal/cli ./internal/gui (at the parent 19c45d5d4's tree): gateway, provider, cli ok; gui red only in TestMainWindowCorners/macOS_26_SDK, mote's macOS 27 (#3949). TestCoreScriptBudget ok. - Rebased on |
||
|
|
e1eeeed734 |
browser: the extension's key connects Magpie Browser and nothing else; own needs this computer; a key turned off closes its browser
|
||
|
|
1f439ecc5e |
gateway keys: a limit can count only some models or providers (zola_xynb)
zola_xynb on X asked for a cap per model or per provider under one gateway key. A key limit can now name models (access.Limit.Models, "<provider>/<model>" or "<provider>/*"), so one key can have, for example, a month of $20 on openai/* next to a month for the whole key. Limits without models still cover the whole key, as before. - budget: sums are kept per window and scope, and count a ledger row only when its provider/model matches (any of the model's ids). reserve holds a request to a scoped limit only when the model it names is served there. windowsOf keeps every scope's sums, so the ledger is not read again on each request. - gateway: keyLimited puts the key's spent scopes on the caller (withSpent), count_tokens included. A direct request for a spent model gets a 429 with Retry-After and no X-Magpie-Limit-Reset, so a remote magpie rests only that model. A routing group, a provider's fallback and embedding/image/video/decision groups skip spent members (groupKeeps, allowedCandidates) and get a 429 only when none is left. System One, count_tokens and magpie's own calls for the key are held too. Model lists are unchanged. A refusal turned away before routing now records its ErrType in the ledger. - CLI: magpie gateway-key limit <id> add month --cost 20 --model openai/* (--model repeatable, --models a,b). - GUI: the key limit editor has a Models field that opens the app menu (multi-pick: All models, every model of a provider, each model). It has no <select> and no new screen. The badge, line and tabs name the models. Strings are in every language. - docs: reference.md and subsystems/gateway-routing.md. Run at d52725d32 (this change on |
||
|
|
4ef47b3f4d |
cli: the browser extension's download is named in the route parity list
|
||
|
|
f9e6061b85 |
claude: claude-magpie runs Claude Code through magpie, a plain claude left on the user's account
baranwang on X (11-06): `claude` stays on the user's own Claude account, `claude-magpie` goes through magpie, and nothing is switched back and forth. `claude-magpie` runs `magpie claude run [args…]`. That writes a settings file of magpie's own, <config>/claude-launch/settings.json, connected as Connect connects Claude Code (the gateway, its key, the shared LAN key when sharing is on, the model, the tiers) and starts `claude --settings <file> args…`. Claude Code puts a --settings file's env and model over the user's settings.json, a claude.ai sign-in and the shell's variables (tried on 2.1.318), so ~/.claude/settings.json is never rewritten. ANTHROPIC_API_KEY and the cloud switches (Bedrock, Vertex…) are blanked in the file, so neither the user's file nor the shell can take a request past magpie. The file is the agent `claude#launch`, listed nowhere: the Agents page, Check and Notice see only the user's file. It is set again when the gateway moved or its key changed. - /model in a claude-magpie session saves to the user's settings.json (Claude Code never writes a --settings file). After the session a magpie model picked there moves into the launch file, for the next claude-magpie, and the user's file gets its model back. A Claude alias (sonnet) stays. - Claude Code's own one-time `opus` -> `opus[1m]` rewrite of the user's file (migration_opus_to_opus1m), which the launch file's 1M opus tier sets off, is undone the same way. Found in the end-to-end run below. - claude runs as a child so that can happen: on Unix a stopped child stops magpie too (^Z, fg; proc.WaitFollowingStops reaps it with WUNTRACED, as cmd.Wait can't see a stop), and claude's exit code is magpie's. On Windows magpie ignores Ctrl+C while claude has it. - The command: a launcher beside the `magpie` command. Settings › Command line (AddCLI) writes it; `magpie claude launcher [add|remove]` adds it for a command put there before. It is a `#!/bin/sh` exec of magpie's stable path, or on Windows a .cmd running "%~dp0magpie". A file by that name without "written by magpie" is never written over. - Docs: agent-wiring.md, and the start page in en/zh/ja. Run at this commit (rebased on origin/main |
||
|
|
7e5a54147f |
gateway: a routing group's intent sureness is its own, intent-sure= (#5101)
Jev's sure of an intent had to reach jevSure, a fixed 0.4, for every
group. zminds measured 39 of 237 turns in one day (16.5%) refused at sure
0.153 to 0.395, and those turns went by the group's routing as if it had
no intent rules. A group can now set its own threshold: intentSure, from
0 (take Jev's likeliest intent however unsure) to 1. Missing keeps 0.4.
readJev keeps Jev's likeliest intent, its sure and Topic (an answer of
intents rather than levels). ruleFor applies the group's own sure through
intentOf, so two groups sharing one classifier and its cached answer each
judge it at their own. "none of these" is never an intent, at 0 too.
Levels and effort are as before.
Set from a terminal: magpie group set <group> intent-sure=0.25, empty to
unset. SaveGroup and the CLI refuse a value outside 0 to 1, NaN too: the
patch's `v < 0 || v > 1` let intent-sure=NaN through the CLI, which
SaveGroup then failed on as "json: unsupported value". cloneGroups copies
the new pointer, since TestCloneGroupsSharesNothing went red on it.
Changed from ggbdpq's patch on #5101:
- The group editor's "Intent sure" row is left out. Its hints were long
secondary text, it showed for every classifier when only Jev answers
with a sure, and it had no GUI test. The Routing page instead carries
intentSure through each save it makes of a group (the editor's Save,
the routing menu, the manual pick), so a value set from the CLI isn't
wiped by the next GUI save.
- Its i18n strings and site/public/docs/intent.html are left out. A
site/ change waits for the maintainer (docs/contributors.md). The site
diff was documentation text only: a paragraph id="sure", a sentence
in "Match the rules" and one table row. It had no links or scripts.
- docs/subsystems/gateway-routing.md has a bullet for IntentSure.
Run on mote (mote-run):
- gofmt -l internal/: clean.
- go vet -tags nogui, also with GOOS=linux and GOOS=windows, on
internal/gateway, internal/cli and internal/provider: clean.
- go test -tags nogui -run 'TestGroupIntentSure|TestJev|Rule|Classif|Decide'
./internal/gateway: ok.
- -run 'Group|Apply' ./internal/cli: ok.
- -run 'Group|Save|Clone' ./internal/provider: ok.
- go test -run Budget ./internal/gui: ok.
- node --test group-intent-sure (new), routing-group-strategy and
group-first-token, in Chromium and WebKit: 42 pass, 0 fail.
- i18n-keys has one red, "a plugin's words are its own". It fails the
same on origin/main
|
||
|
|
8fbf8e0af6 |
gateway: DeepSeek's own API gets an agent's images once, by file id, not on every turn (#5407)
DeepSeek's API is stateless, so every turn re-sent every inline image in
the history. Now, on api.deepseek.com only (never a relay or another
base), for a model with "flash" in its name (deepseek-flash sees images;
deepseek-v4-pro reads them as "[Unsupported Image]"), each base64 data:
image goes up once through POST /files (purpose=user_data, expires_after
a day) with the candidate's own key, and later turns name it by file id:
- Chat: {"type":"file","file_id":…} (flat, as DeepSeek's vision guide);
- Responses: input_image with file_id in place of image_url;
- Anthropic: source {"type":"file","file_id":…} plus anthropic-beta
files-api-2025-04-14.
Shapes checked against api-docs.deepseek.com files_api, vision,
responses_api and anthropic_api. The Anthropic guide names the "file"
source type and the beta; the field name file_id is Anthropic's Files
API's, which DeepSeek says it follows. Not confirmed with a real call.
Ids are kept per key hash + image sha256 in deepseek-files.json beside
providers.json (temp+rename, unparseable file moved to .bad), reuploaded
with under an hour left. One upload per image and key however many
requests want it; a request waits at most 8s for its uploads, and what
isn't up goes inline this turn. A failed upload leaves the image inline
and rests that key's uploads for 10 minutes. A 4xx naming a file-api id
or a missing/expired file forgets the ids, uploads again and asks once
more; refused again, the request goes inline. detail:low stays inline.
`magpie provider set <id> image-files=off` turns it off (kept on GUI
save). Doc: docs/subsystems/gateway-routing.md.
Run (mote, at this tree on
|
||
|
|
9d143eacab |
uninstall: install.sh --uninstall disconnects every agent first, a deleted magpie too
whimsical_wolf_15477 (Discord): after uninstalling magpie, Codex didn't go back to its own config. `install.sh --uninstall` deleted the magpie command and app and left every agent wired to a gateway that no longer runs: Codex kept openai_base_url (or model_provider = "magpie" and model_catalog_json) pointing at 127.0.0.1. A magpie deleted by hand undid nothing either, and `--purge` refused with no magpie left to run. - `magpie uninstall --keep-data` (uninstall.KeepData): every agent disconnected and its own values put back from stash.json, the service, autostart, shortcut, scheme and helpers removed, magpie's settings, providers and usage kept. - install.sh --uninstall runs `magpie uninstall --yes --keep-data` (--purge: `--yes`) before deleting anything, and stops if it fails. With no magpie of its own (deleted by hand) but magpie's config left, it fetches the newest release into a temporary folder, checks its sha256, runs that, and deletes it after. An older magpie without --keep-data gets the newest one for this too. A magpie on PATH that the script didn't install is left to its own `magpie uninstall`, and said so. - MAGPIE_UNINSTALL_SCRIPT=1: under the script magpie doesn't ask to delete a path that the script deletes next. - docs (en/zh/ja start.html #uninstall) and READMEs: what the line does, that it works for a magpie already deleted, and Codex's lines by hand. Run (WSL magpie-desktop; mote's disk is full, nothing run or deleted there): - go test -tags nogui -run "Uninstall|Help|TestKeepData" ./internal/cli/ ./internal/uninstall/: ok. node --test site/install.test.mjs: all pass. - The new install tests against the old install.sh: 5 red. Broken by hand (--keep-data case removed, Data() back in KeepData): TestUninstallKeepData and TestKeepData red. - Real e2e: magpie built from this tree, Codex wired in a sandbox HOME (not signed in, and ChatGPT signed in), magpie installed and deleted by hand; install.sh --uninstall with a local feed. config.toml's diff before wiring vs after is the [model_providers.magpie] table only (kept on purpose for threads started on magpie); model, effort, openai_base_url, model_provider and model_catalog_json are the user's again; settings kept. - gofmt -l clean; go vet GOOS=windows/darwin/linux (nogui) for the two packages; sh -n and dash -n install.sh. Not tried: macOS's zip path for a deleted magpie run for real (tests cover it with fakes), Termux, Windows (no install.sh there; docs say download magpie again and use Settings › Uninstall). The full internal/cli package timed out at 10m under WSL load in providers_unreadable_cli_test (not touched here); see the full suite record. |
||
|
|
47d5839397 |
library: sync and backup files carry the hooks
VincentChan on Discord (v0.1.3005) said part of the Library doesn't reach his other computer through sync. Checked kind by kind what the library part of a bundle carries: instructions (each set's text, a linked set's file text, the agents ticked, each agent's own addition), MCP servers, skills and subagents all go. Hooks didn't: library.Bundle had no field for them, so a hook made on one computer never reached the other, by WebDAV/S3/GitHub sync or a backup file. - library.Bundle.Hooks (*[]*Hook): name, description, event, matcher, command, timeout, agents ticked. Collect always sets it, empty too. Applied.Hooks (the entries magpie wrote into each agent here) stays out: each computer writes them on the sync Put runs, beside the user's own hooks, and records its own entries, so an entry the user edited there stays theirs. - Put replaces the hooks with the bundle's, so one taken out on one computer goes from the others. A nil list (a bundle from a magpie before this) keeps this computer's. - check refuses a hook with no name, no command, or named twice. The event and agents are carried as they come: an event a newer magpie knows is a problem on the agent here, not a refused library. - davsync: an empty list hashes as before the field, so upgrading with no hooks syncs nothing. - The CLI's backup line counts hooks; the GUI's sync/export/import ticks say "instructions, MCP servers, skills, hooks and subagents" in every language. - library.md and sync-backup.md updated, and they now name what stays this computer's own: projects, skill groups, CopySkills/SkillHow, SharedSkills, MCPHub. Instructions: two sandbox computers through the fake DAV server carried a named set and a change to it, a set linked to ~/.agents/AGENTS.md and a hand edit of that file, both computers having their own text first, an agent's own addition, and an agent installed after the first sync. All reached the second computer's CLAUDE.md/AGENTS.md (exploration tests, not kept). So no instructions change here; what VincentChan saw is not reproduced yet. Run (worktree at 0e55a7593; origin/main bf60ea596's two commits touch none of these files): - mote: go test -tags nogui ./internal/backup ./internal/davsync ./internal/cli ./internal/library ok; go vet -tags nogui for darwin, GOOS=linux and GOOS=windows on the four packages ok; gofmt -l clean; go test ./internal/gui -run 'TestCoreScriptBudget|Words|I18n|Builtins' ok - GUI (wsl-run, Linux): i18n-keys, github-sync, s3-sync, sync-*, webdav-settings-refresh, library-backups-top, gui-de, gui-ja, gui-zh-tw: 187/187 Broken by hand: with Collect not setting Hooks, Put ignoring them and the hash not dropping an empty list (the old code), TestCarryHooks, TestCarryOldBundleKeepsHooks, TestCarryNewerHooks, TestBackupFileCarriesHooks, TestSyncHooks and TestNoHooksHashAsBefore went red. Not tried: a real WebDAV/S3/GitHub remote between two real computers; Windows and Linux runs of the Go packages. |
||
|
|
234903cb23 |
cli: magpie model api sets the API a model is asked on, as the editor's picker does (yew_fence_931206)
A relay with many models behind one key can now have each model's API
set from a script, not only in the provider editor's Names, prices &
levels ("API this model is asked on"):
magpie model api <provider/model>... chat|responses|anthropic|gemini|auto
magpie model api <provider/model>... --reset (auto)
magpie model api <provider/model> what it is asked on
magpie model apis [<provider>] the settings; with a
provider, every model
It saves through provider.SetModelPrefs, the editor's Save, into
settings' modelAPIs, so a running gateway reads it on the next request
and the agents' model lists are told once. Choices are those the editor
offers (modelAPIs in app.js): the APIs the provider has a URL for, when
it has two or more; Vertex AI none. --help anywhere prints the usage. A
flag in place of a model, an unknown API, a model the provider doesn't
list, or an API it has no URL for is refused; several models are all
checked before any is written. A saved setting for a model the vendor
no longer lists can still be reset. Documented in docs/reference.md
("The API a model is asked on") and the gateway-routing page.
Run (mote, via mote-run, at this tree on
|
||
|
|
8e97e26d67 |
providers: WorkBuddy's sign-in warns that Tencent may ban the account first
NancyTom on X (11-04): WorkBuddy accounts used from DeepSeek Harness through magpie were banned, the international build's (WorkBuddy AI) most; repliers saw the same. Changing DSH's prompt isn't a fix: the plugin already rewords DSH's opener and moves the system prompt into the first user turn (REFUSED.md), and the bans came anyway. So magpie says it before an account is added, as it does for Claude, Zed, Qoder, Factory, MiMo and Command Code. - app.js: WorkBuddy and WorkBuddy AI carry risk with WORKBUDDY_RISK. A moved subscription (every user's now) gets it through subOf, so the plugin's sign-in waits behind "Sign in anyway" too. - i18n.js: zh, zh-TW, ja, de. - CLI: `magpie accounts add workbuddy|workbuddy-ai` asks the same (provider.WorkBuddyRisk, the window's words; a GUI test checks the two are equal). - Core script budget: no raise; the SUBS header comment was cut down. Run (mote, at |
||
|
|
9d0c9b41ea |
serve: follow an update put in where it runs from; a replaced magpie.real is magpie
acezan on Discord (Linux 5.15, 0.1.2959 to 0.1.2960): `magpie web` as a system unit updated /root/.local/bin/magpie.real, and the user unit's `magpie serve` (`magpie daemon install`) ran on for good from "magpie.real (deleted)". The panel said an older magpie served the gateway, and its "close it here" then said the port holder "isn't magpie" and left it. Why serve stayed old: the app and `magpie web` follow the program they started from (gui's followReplaced) and restart into an update; plain `magpie serve` had no such look, and answered `magpie update`'s restart ask (gateway.RestartPath) "unsupported". Nothing else can restart it reliably: a system unit doesn't reach the user's `systemctl --user`, and on a Mac the launch agent's serve (#4335) is the same serve. So serve now looks itself (internal/cli/serve_follow.go): every 5s it checks its program with update.Replaced; once replaced, it waits until the gateway is idle (nothing in flight, 10s since the last end, as gui's idle rule; after an hour, nothing in flight is enough), ends the plugin hosts and runs the new program in its own place (update.Reexec: exec in place on Unix, same PID, so systemd and launchd keep tracking it; a new process on Windows). The restart ask now answers restarting/waiting/current. A build that isn't a release never does it. Why "not magpie": proc.IsMagpie judged the file name, and "magpie.real" (the program the installer's wrapper script runs) didn't match. It now trims ".real". And proc.RunsMagpie, used by the takeover and the port check, also reads Go's build info of the running program (on Linux through /proc/<pid>/exe, which still reads after the file is replaced) and calls it magpie when its main package is github.com/yetone/magpie. A process that isn't magpie is still never ended (the existing "other-server" case passes unchanged). Tests, each red on the old code: - cli TestServeRestartsIntoAnUpdate: a copy of the test binary named magpie.real runs `serve` on a free port; a script renamed over it is run in its place with the same pid and args, and the old port stops answering. Old code: "serve ran on as the old version" after 40s. - cli TestServeFollowWaitsForIdle: current / waiting / tool-chain gap / waitMost with a request in flight / idle / non-release. - gui TestGatewayFixQuitsAReplacedMagpieReal: a fake older gateway named magpie.real, its file removed after start, is quit and the gateway served here. Old code: {OK:false Reason:not-magpie}, acezan's case. - proc TestIsMagpie magpie.real case; TestRunsMagpieByItsBuild: a copy named server.real, its file removed, is told by its build (Linux /proc/<pid>/exe), and is not magpie with the real main path. Run: the targeted tests above on Linux (wsl-run, magpie-desktop, -tags nogui) and macOS (mote-run), all pass. Broken by hand on Linux: dropped the ".real" trim, made RunsMagpie only IsMagpie, and set serve's follow to nil; all four new tests went red (output above), restored after. gofmt -l clean; go vet (darwin, GOOS=linux -tags nogui, GOOS=windows) and builds on mote. Not tried: a real systemd user unit or launch agent with a real update; the Windows restart path (Reexec starts a new process) beyond vet; the macOS TCC part of #4335 (this restarts the launch agent's serve into the new bundle path only if that path is where it started from). #4335 stays open, and ggbdpq's daemon.RestartReplaced patch there is not applied. |
||
|
|
00d8aac596 |
routing: Free quota by expiry spends the soonest-lapsing free quota first (wowbbs)
wowbbs (and shamen_xiaohong) keep check-in free accounts in one group:
WorkBuddy CN x2, MiniMax Code, TraeCode CN and Qoder CN. They asked that
the group spend the free quota that lapses soonest first, go on to the next
when one is used up or has lapsed, and use a paid account only when no free
quota is left.
This adds `expiring` (provider.FreeExpiring, routes.FreeExpiring). It is a
group's only, picked in the Routing page's group menu, with
`magpie group set <g> routing=expiring` or in the TUI. Nothing changes for a
group or provider that doesn't pick it. A provider keeps refusing it, as it
refuses `cheap`.
- routes: Seat.FreePlan and Strategy.ByPlan. FreeExpiring has three tiers:
- free seats (Free, a model at no cost, or FreePlan) by Expires, the
earliest of the window renewals and Lapse, to the hour; an unknown
expiry goes last and ties keep their listed order;
- then the paid seats, as Smart orders them;
- then the spent and resting seats, by when they come back.
- provider.FreePlan reads an account's plan word: free, trial, 免费, 试用,
体验, 體驗.
- gateway: weighRouted fills FreePlan when the strategy asks. The trace's
Weighed rows gain `expires`, so the Routing page's story can say "its free
quota is lost soonest, in 1d 2h". There are also lines for "a free one with
no expiry told" and "no free quota left, so the paid one".
- GUI: an option in the group menu, the mode line, the story lines, and
i18n in zh, zh-TW, ja and de. app.js only adds `expiring` to ROTATION,
paid for by a shorter comment beside it, so the core is 11 bytes smaller
than at its base.
- docs: gateway-routing.md (order of keys and accounts) and
plugin-runtime.md (Seat and Strategies).
Plugins whose usage doesn't say when their free quota lapses got issues
rather than edits:
- magpie-community/plugins#718: Trae sums its packs; the soonest end comes
from any pack, spent or past, and there is no runsOutAt.
- magpie-community/plugins#719: Qoder's plan is the raw userType
personal_standard, which doesn't read as free, and its add-on, shared and
dedicated pools have no expiry.
WorkBuddy (Free plan, resetsAt and runsOutAt) and MiniMax (Free, runsOutAt
on credits) already report what this needs.
Run, all on mote via mote-run at this tree (base
|
||
|
|
6b47bce670 |
cli: magpie model compact <agent> sets an agent's own Long conversations
|