ac4af582301a4e8a29245dbba767eba31334ddf9
96
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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 |
||
|
|
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 |
||
|
|
c7c05dcf2b |
settings: the routing groups' defaults are kept through a Settings save and known to be saved by the Routing page's own route
|
||
|
|
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) |
||
|
|
93d5c76c0d |
router: an agent with many tools is given them on demand
ArvinCharl on X: the MCP router's tools fill the context. An agent that
doesn't search its MCP tools itself (all but Claude Code, Claude
Desktop, Codex and Pi) sends every tool's whole schema on every
request. Given more than 10 router tools, such an agent now lists two in
their place: find_tools (matches by name and description, the first 5
with their inputSchema, 15 more by name) and call_tool (runs one by
<server>__<tool>, its bare name, or arguments sent as a string; an
unknown name is told the close ones). The instructions still name every
server and its tools, and a tool called by its own name still runs. The
request log names the tool call_tool ran. The address for any other app
lists every tool, since which app connects isn't known.
Library → MCP gains a "Tools on demand" toggle (settings
routerAllTools, kept by KeepOwn and the settings API); turned off,
every agent gets every tool whole as before.
Run on mote (after the rebase onto
|
||
|
|
3eb2bda4f2 |
settings: Codex, Claude Code and Grok Build each take a Long conversations of their own (molianyin4227 on Discord)
molianyin4227 (Discord #help): models differ, so one compaction size
for every agent fits none; they asked for Codex, Claude Code and Grok
Build to each have their own, falling back to the shared one.
- settings.AgentCompacts[agent] {At, Full} for the agents that write a
compaction window (CompactAgents: codex, claude, grok); Settings.
ForAgent(agent) lays it over CompactAt/FullContext for that agent's
readers only: codexcat.entriesAt, provider codexListed, Claude Code's
writeCompact and desktopPlan, grokModelTables, the route list's
buildModels, Codex's window line (api.go) and Tuned for you
(gui/tune.go, agent/tune.go). A model's or provider's own Compact at
still comes first. An agent with none follows the shared value, so
nothing new is written for it, and an agent outside the three has no
such key and is refused (provider.SetAgentCompact).
- POST /api/settings/agent-compact {agent, own, full, at}; own false
takes the agent's value away. settingsapi.Merge keeps the map.
- GUI: a row "Long conversations in <agent>" under Long conversations,
in the agent's opened row and its sheet: Every agent / Compact at N /
Full window (segs, no select), a size box when Compact at. It lives in
agentcompact.js, imported when the agent's settings hold Long
conversations, then put in synchronously (an async put-in after a
redraw moved the page in chromium: codex-memories-settings' scroll
check). It draws again only when its own values change. i18n in
zh, zh-TW, ja, de.
- Tuned for you's Use on an agent with its own value changes that one,
stashed under tune.long.compact.<agent>; Undo puts it back.
- codex-memories-settings' "no Codex" check counts Long conversations
alone again (:not(.agent-compact)) and waits for the new row.
- docs/subsystems/agent-wiring.md: a row for it.
Core size: app.js 1,311,919 bytes, 109 under origin/main
|
||
|
|
91379b9339 |
settings: a reply's model can be the vendor's own name again, the member, or the model asked for (ZoeCats)
ZoeCats (Discord #general): since v0.1.2473 a reply's model says the name the client asked for (a group or provider/model id), groups that aren't aggregates included, and the only way back to the vendor's own text was the X-Magpie-Response-Model header, which their client can't send. Settings › Models › Replies › Model name in replies (replyModel), picked from the app's menu, in en, zh, zh-TW, ja and de: - "" the model asked for (the default, as now); - member: magpie's provider/model that answered (what memberModel did; Claude Code, Claude Desktop and Codex still get the name asked for); - vendor: the vendor's own text, for every agent, the vendorNamed three included, as every agent got before v0.1.2473 and as the header's "vendor" already gave them. X-Magpie-Response-Model (asked, member or vendor) still picks for its request; an unknown value falls through to the setting, as before. memberModel is folded in without changing anyone's choice: a file with memberModel on reads as replyModel member, an explicit replyModel wins, and memberModel is written beside it as a mirror so an older magpie reads the same. An older page sending only memberModel changes the setting only when its switch moved (a vendor choice survives its saves). The CLI's set/reset goes through Keys/Choices (replyModel in place of memberModel). app.js's row is paid for by five comments in Settings' code cut down: app.js is 145 bytes under its base, no budget raise. Run on mote at this head (rebased on origin/main |
||
|
|
2ab9235711 |
agents: an agent's picks can be kept to this computer, as an MCP server can
chenxiang0010 on Discord: 「agent当前选择的模型可不可以像mcp那样 只对当前设备生效」.
Sync carries every agent's picks (model, effort...) between computers;
an MCP server has an opt-in "This computer only" that sync and backup
files never carry. Agents now have the same: the row's menu (right-click
or ...) has This computer only, off by default, so an upgrade changes no
pick on any computer.
- settings: AgentsHere, this computer's own (KeepOwn), and kept by a save
of the Settings page (settingsapi.Apply), which doesn't send it.
- davsync: each kept agent adds "<id>.*" to the own set (withHere, isOwn),
so a sync neither pushes its fields nor brings the server's; a Restore
from the server leaves them. sync-state.json records the list as of the
last sync (Here): hashes before a sync use it and after use the current
list, so turning it on or off is no change on either side, and a changed
list forces the sync past its early returns. Turned off, the next pick
goes up again. Other agents still sync both ways; the implicit own
fields (hayden4608) are unchanged.
- backup.Restore skips a kept agent in a backup file.
- gui: POST /api/agents/here; the row says "This computer only" beside
the version (hidden in the tray panel and in a narrow row), menu ticks.
Core words moved from the library plugin's i18n into core i18n
(zh/zh-TW/ja/de). Comments in renderAgents cut to pay for it under the
core budget (no raise).
- cli: the route is named under stage 3 (no command yet).
- docs/subsystems/sync-backup.md describes it.
Run on mote, at the base
|
||
|
|
ec104b8625 |
gateway: a Codex account can spend its credits before magpie moves to another account (jojonas_xyz on X)
jojonas_xyz on X: "我账号额度用完了自动给我切了别的号…找不到怎么关掉设置…你怎么知道 我不是想用 credits 呢". (Roughly: "my account ran out of quota and magpie switched me to another account by itself; I can't find a setting to turn that off; how do you know I didn't want to use the credits?") Cause. At 90% or 98% of a window, smart routing's tier put the account behind every account that still had room, whether or not it had ChatGPT credits. Codex's own sign-in (NextLogin / SwitchWhenSpent) moved at the spent share in the same way. The account's credits were spent only once every other account was used up, and the switch was a log line. The Use credits switches that existed (on, and "Only after other accounts" from |
||
|
|
b646a91277 |
gui tests: the Settings save guard sets BusyLoad (#4739)
TestSettingsSaveKeepsWhatItDoesNotSend has been red since
|
||
|
|
01ccbd40a0 |
library: an MCP router says which computer it is, so an agent can pick between two (packinggoodsllc_07668 on Discord)
Two magpies, one in China and one in Los Angeles, each serve the same tools through their MCP router (/mcp/magpie/hub). An agent connected to both saw two identical web fetches and couldn't pick the one in Los Angeles to reach Google. Each router now says where it is: - initialize's instructions end "This router: <name>. Each of its tools' descriptions starts with [<name>]; ...", and serverInfo.title is "Magpie MCP hub · <name>"; - each tool's description in tools/list starts "[<name>] " (once: a description that starts so already, another magpie's router behind this one, isn't given it twice). <name> is the user's words (settings.RouterNote, one line, 80 characters at most) to every caller. With none it is this computer's name, to callers on other computers only: an agent on this computer has one router at hand, and its prompts stay as they were. RouterNote is this computer's own (KeepOwn): library.json is synced, settings.json isn't, so a sync never brings the other machine's name. It is set in the Library's MCP tab, in a Router name row under the router's address (shown while the router is on): a plain field with the computer's name as placeholder, saved on Enter or leaving it, Escape puts the saved words back, an input method's Enter is its own. POST /api/settings keeps it. Translated in zh, zh-TW, ja, de. docs/subsystems/mcp-router.md has the rule. Run (mote, at |
||
|
|
4c815ac2a5 |
search: searchers picked to follow the one named, tried in their order when it fails (axelburks on Discord)
axelburks asked for more than one searcher, so that when one fails another provider searches. A searcher named in Settings gave way to no other provider before, only to the Search APIs. Automatic already fell back to up to three. - settings: SearcherThen, the searchers after the one named. Entries are trimmed. Blanks, "off", the named one and repeats are dropped. - gateway: when the named searcher fails (the context still live), modelSearch asks each of SearcherThen in order and skips one that can't search now or is the same model. The first that searches answers, and the call is marked searchingInstead, so the Routing row says why the named one didn't search. If all of them fail, their errors go back together, saying "the searchers picked ..., in their order", and webSearch goes on to the Search APIs as before. SearchFailure.Instead names the one that searched in its place. - gui api: searchFailed.instead. A save takes only searchers that Searchers() offers. A save without searcherThen keeps the list, since the page's prefsKeep doesn't send it, and [] clears it. - Settings › Web search (plugins/search/settings.js, outside app.js's budget): an "If it fails" row under a named searcher, with numbered chips and Add. A chip's picker changes the chip or removes it. The row is hidden for Automatic and Off. The failure line names who searched instead, or says the ones after it failed too. The help text says the same in en, zh, zh-TW, ja and de. - docs: gateway-routing's failing searcher, and gui-shell. Tests: - TestPickedSearchersInTheirOrder (gateway): one test where the named searcher answers without searching and one where it fails. A gone entry and one that can't search are skipped, and the third searches once. With no working entry, the error says so and Instead is empty. - TestSearcherThenSaved (settings) and TestSearcherThenFromSettings (gui): what is saved, kept and cleared; refusing an entry that can't search. settings_keep_test sets SearcherThen. - searcher-then.test.cjs: chromium and webkit, en, zh, zh-TW, ja, de, at 560 and 1000 wide. Checks the row's place and words, what Add offers, the posted lists, that the chips fit with no horizontal scroll, that no click moves the page, and both failure lines. Broken by hand: running no fallback turned TestPickedSearchersInTheirOrder red (both subtests: "ds2 searched []"). Not keeping the list on save turned TestSearcherThenFromSettings and the keep test red. Run on mote (mote-run): - At the pre-rebase tree (base |
||
|
|
9fdef3ea22 |
gui: keep SearchAll through a save of the Settings page (#4514)
TestSettingsSaveKeepsWhatItDoesNotSend is red since SearchAll came in
with
|
||
|
|
699ddf1524 |
gateway: a Codex account can spend its credits only after every other account, key and fallback (gokoshiki on Discord)
gokoshiki wants a Codex subscription first, then an OpenAI API key, then the subscription's credits. Until now an account at 100% that holds credits either kept its place and spent them there (on) or was held (off). This adds a third way per account, "last": - settings: CodexCreditsLast []string, empty by default, so a setting saved before it keeps its order. provider.CodexCreditsLast, CodexCreditsMode and SetCodexCreditsMode(user, on|last|off); SetCodexCredits(on) still means "in its place" and clears last. - gateway: candidate.creditsLast is true for such an account once a window for the model is used up and it is going on its credits (a call ChatGPT counts in no window stays in its place). restLast orders ready, then resting, then those, and marks Weighed.CreditsLast. restLast runs over the asides too, so such an account goes behind a provider's reserves (Accounts at once, |
||
|
|
7b09d2c951 |
provider: a model can be listed by an id of the user's at its provider, asked for by its own
zeewell on X (tweet 2116404121930432888): relays serve one model under
ids of their own (deepseek-v4.1-flash-1017, grok-4.6@500k). They want to
give each one their own id at the provider layer. magpie then lists,
routes, groups and finds groups by that id, and the upstream request
still carries the vendor's id.
Choice: a new per-model map, settings' ModelIDs
("<pid>/<local>": "<own id>"), served through the wire names that
already exist. ModelSameAs was not widened. It means "same as another
vendor's model": it lends specs and joins found groups. Making it rename
models everywhere would change every existing user's ids and refs.
ModelWires was not reinterpreted either, for the same reason. ModelIDs is
ModelWires turned round: a wire keeps magpie's id and changes the one
sent, and this keeps the one sent and changes magpie's. Settings.Wires()
merges each entry in as a wire name (wrapped by a "<pid>/*" wire). Every
place that sent a ModelWires name (gateway, usage ledger, request page,
UpstreamName, UpstreamNameAs) reads Wires(), so the upstream id needs no
new path. An explicit ModelWires entry for the same id wins.
- Listed by the local id: Available, liveIDs/liveByID, Serving and
ListPrice translate through OwnModelID. /v1/models, agents' lists,
Resolve, routing groups and found groups (auto/<local>, merged with
every other provider serving that id) all see the local id.
- Only a provider of the user's own (Account == nil) takes one. An
account's or a plugin's request is built from its list's id, which no
wire reaches.
- Two variants of one provider given one id: the latest given it wins,
and the earlier one is listed by its own id again. The CLI names it.
The editor refuses two rows given one id in one save. A model of the
provider's own id that a variant is listed by (plain grok-4.6 beside
grok-4.6@500k) is not listed while the variant has it.
- The user's values are never overridden. SetModelID moves picks,
contexts, fallbacks, groups' members/rules/fast/placed/off/weights/
classifier/pick, the pickers' lists, every per-model setting
(Settings.MoveModel) and gateway keys' models (provider.ModelMoved,
set by access) to the new id, but only where nothing is under the new
id yet. Agents' own files are not rewritten: an old provider/<own id>
still resolves and is sent as it is. Group match patterns and key
patterns stay as written.
- Key limits: a key held to either id passes for both (modelAllowed:
the ref, OwnModelID, ListedModelID). Group members use the same check.
- Usage: model = the listed id, served = the vendor's id from its reply.
The price is the own id's first.
CLI: magpie model id <provider/model> [<id>|--reset], magpie model ids.
GUI: Providers > a provider's editor > Names & levels > "Listed as",
beside Same as. It is staged with the editor's Save and taken back by
Restore default, in zh, zh-TW, ja and de. Accounts have no box.
Docs: providers-accounts.md, gateway-routing.md, and site start.html in
en, zh and ja.
Run (mote-run, at this tree rebased on
|
||
|
|
e647a1fd54 |
plugins: an npm registry of the user's own is used for installs and lookups (timwangdev on X)
timwangdev asked on X for plugins to take a custom npm registry. Zero-config
first: Registry() (internal/plugin/registry.go) takes, in order, the one set
in magpie (settings npmRegistry: `magpie plugin registry <url>|default`, or
Plugins › Discover's new npm registry row), BUN_CONFIG_REGISTRY /
NPM_CONFIG_REGISTRY / npm_config_registry in magpie's environment, then the
login shell's (cached probe only, proc.LoginEnvKnown, never waits on a
shell), install.registry in the plugins folder's or the user's .bunfig.toml,
registry= in the plugins folder's or ~/.npmrc, then the 国内镜像 switch's
npmmirror, then npm's own. The switch no longer puts npmmirror over a
registry the user named: before, bun was handed BUN_CONFIG_REGISTRY=npmmirror
whenever it was on, over the user's .npmrc. bun is told the registry only
where it wouldn't find it itself (magpie's setting, the shell's, the
switch's). magpie's own npm questions (latest version for the market,
Update and the hourly check, README, search) go to the same registry, a
package's @scope:registry= to that scope's, with the .npmrc's
//host/path/:_authToken (${VAR} expanded, longest prefix) sent to that host
alone, dropped on a redirect to another host, never logged or shown.
Download counts stay npm's. Only http(s) with a host, no userinfo, query
or fragment is taken; anything else is refused and not saved, and a bad
value hand-written into settings.json is passed over. /api/plugins says
which registry is in use and where it came from.
The GUI row is in registry.js, imported when Discover draws it, so the
core script budget isn't raised (plugins.js is 292 bytes smaller than
before, one long comment there condensed).
Left out: bunfig [install.scopes] for magpie's own lookups (bun reads them
for installs), .npmrc _auth and username/password, NPM_CONFIG_USERCONFIG
and npm's global npmrc, and internal/agent/cliupdate.go's agent CLI update
lookups, which still ask npm's own.
Run (mote and wsl-run). First at this change on
|
||
|
|
995f84a0f9 |
codex: how early an expiring reset is used is a setting
A Codex reset card that would run out unused was spent 30 minutes before it expired, a fixed resetExpiryLead. Now the lead is codexResetLead in settings.json (minutes, 15 to 1440). Unset, out of range or unreadable reads as 30m, never 0, and magpie never writes it unless the user does. - settings: CodexResetLead and Settings.ResetLead(); the menu's values are 15m, 30m (default), 1h, 2h, 3h, 6h, 12h, 24h. - provider: the spend (expiringResetSpent) and routing (Allowance.Restarts, through nextResetLook) read the same resetLead(), so they still agree (#717, #718). The "near" look cadence follows it: lead + 30m, at least 1h, so a look lands inside a long lead. - GUI: Settings > Usage, under the Codex auto-use rows, a row "Codex: how early before one expires" with an app menu (no <select>), and the sub text says spending earlier loses what the windows have left. The four "before it expires" strings say the chosen lead. POST /api/settings/codex-reset-lead; the general save keeps the field. en, zh, zh-TW, ja, de. - CLI: magpie quota auto-reset lead [30m|3h|<minutes>|default]. - app.js budget: the auto-use rows moved out to lazy autoresetown.js (painted in the same draw once loaded), so app.js and the core script stay under their budgets with no raise. The button sizes to its widest label (a grid of every label), so picking one never rewraps the row. Run (all on mote through mote-run): - go vet: darwin, GOOS=linux -tags nogui, GOOS=windows; nogui build. - go test -tags nogui -timeout 45m ./... at 3955adccf (this change before the paint and sizer fixes, which touch only GUI assets): 81 ok. go test ./internal/gui at this head: ok. - GUI, Chromium: codex-reset-lead, codex-auto-reset, codex-auto-reset-settings, segs-press-redraw, i18n-keys: 62/62. WebKit: every case of those files failed at browserType.launch (180s timeout) before a page loaded, both runs; mote's browser launches hang under #4125 (load ~26), so WebKit is not run. - Rebased onto |
||
|
|
2ec3453647 |
gui: the main window opens where it was left (jorbenzhu)
jorbenzhu on Discord: after every update and restart the panel is back in the middle of the screen. It is the main window: after an update magpie starts again with `magpie gui <tab>`, and Wails opens a window centred unless told otherwise. Its size and maximised state were kept; its place never was (gui-shell.md said "The window's position is not kept"), so nothing was lost on upgrade, there was nothing to restore. The tray's panel opens under the tray icon on the Mac and Windows, and where the click was on Linux, so it is not what moved. Now settings.WindowAt keeps the window's top left corner (system coordinates across every screen), per machine like Window (KeepOwn, and the Settings page's save carries it over). keepAt saves it once a move or resize has rested 500ms, unless the window is maximised, full screen, minimised or hidden; settings.Save writes through temp and rename, and an unreadable settings file is left alone. On the first show placeMain puts it back (putBack): openAt picks the screen holding most of the window and moves it fully onto that screen's work area; when no screen holds any of it (a monitor gone) or the screens or the file can't be read, it stays centred. Under Wayland a window can't place itself, so nothing is kept or restored there unless GDK_BACKEND is x11 (keepsPlace). Run: - mote, at 3f8f1d88b (on |
||
|
|
3bebc38393 |
gui: a key combination opens the quick panel from any app (ben hanks)
ben hanks on Discord asked for a global shortcut that opens the menu bar or tray panel. Settings › General has a new row, Quick panel shortcut, with none set by default. Clicking its field records the next combination: a letter, a digit, Space or F1–F20 with Ctrl, Alt/Option or Cmd/Win, or an F key on its own. Esc or a click elsewhere stops recording, and the cross clears the shortcut. It is shown the system's way (⇧⌘K on a Mac, Ctrl+Alt+K elsewhere). POST /api/settings/panel-shortcut checks the combination, has the running app bind it through Wails' GlobalShortcut (Carbon hot keys on the Mac, RegisterHotKey on Windows, XGrabKey on X11), and saves it only once it is bound. One the system refuses is not saved, the old one stays bound, and the status line says why. A pressed shortcut toggles the panel as a tray click does. The shortcut belongs to each computer (KeepOwn), the Settings page's own save leaves it alone, and the old Mac process lets go of it as it hands over. On Wayland no app may grab keys, so the field is turned off and the row names the command (`magpie panel`) to bind in the desktop's own keyboard settings. Every string is in en, zh, zh-TW, ja and de. No size budget was raised: app.js is 1,315,252 of its 1,315,316 after older comments were cut. Run at this head (rebased on origin/main |
||
|
|
9101bb8879 |
privacy: a request masking would change can go as written to a model you picked
jessyoungyu on X: when a masking rule hits, send the request to a self-hosted model instead, so a prompt like 「百度这家公司怎么样」 gets an answer about Baidu, not about a placeholder. Settings › Privacy › Instead of masking, send to (settings redactRouteTo). It is Off by default, and nothing changes for a user who leaves it Off. It is picked in the app menu, and only models whose every route is unmasked can be chosen: the provider is set to Send requests unmasked, it is on this computer or the network, it has no account, and any fallback or group member is unmasked too (gateway.MaskRoute, the same rule as provider.SkipsRedaction). The setting is saved on its own with POST /api/settings/redact-route, which checks it with MaskRoute. The general settings save keeps the value. Decisions: - When a value would actually be masked on an agent's turn (maskHits.n > 0), serve sends the request to the chosen model unmasked. Warn-only hits don't count, and Block still answers 400. - If that model fails, the request fails. It is never masked and re-sent to the model the agent asked for, and never goes to a cloud model with the unmasked text. Falling back to a masked cloud request would answer a different question in the background. The user picked this route because masking breaks the answer. - Streaming works the same as on any route. - The route is checked again on every request. A model that is gone or no longer unmasked, or that the caller's gateway key may not use, means the request is masked as before. - Covered: agents' Messages, Chat, Responses and Gemini turns (serve, marked by serveAgent), count_tokens, Codex magpie-model turns, and Codex own-sign-in /responses (codexMaskRoute). - Not covered: magpie's own asks (ownAsk clears the mark), embeddings, audio, images and video. These stay masked. GUI: redactRouteRow lives in plugins/redact/settings.js and wraps renderRedact, so app.js is byte-for-byte unchanged and the core budget is not raised. Strings are added in zh, zh-TW, ja and de. Docs: gateway-routing.md, gui-shell.md, and site/public/docs masking (en, zh, ja). Tests: internal/gateway/mask_route_test.go (TestMaskedRequestGoesToTheModelSet: unset, set, streamed, nothing to mask, local fails, falls back to a vendor, no longer unmasked, count_tokens; TestCodexSigninTurnGoesToTheModelSet; TestMaskRouteTakesOnlyUnmaskedRoutes; TestMaskRouteOnlyForTheAgentsTurn); internal/gui/redact_route_test.go; settings_keep_test.go; internal/gui/tests/redact-route.test.cjs (every language, chromium and webkit, 1100 and 640 wide). Broken by hand, each red: - serveAgent without the agent mark; - MaskRoute taking any route (TestMaskedRequestGoesToTheModelSet, TestMaskRouteTakesOnlyUnmaskedRoutes; at the pushed head); - the codex hook removed; - count_tokens without the mark; - ownAsk not clearing it; - no key check; - no reroute in serve; - the GUI: no keep in the general save, no MaskRoute check on save, and the picker listing every model; - the plugin script left out of index.html (redact-route.test.cjs 22 of 24 red; at the pushed head). Run on mote: - at 221ede767's tree, this change on |
||
|
|
af8f3a9399 |
sessions: a new install reads no agent's session history until the user allows it (RustCats on X)
RustCats on X: a fresh magpie showed every agent's session history on
the Sessions page before anyone agreed to it, and asked for a per-agent
choice instead.
- sessions.Reads(agent) (internal/sessions/access.go) is the one gate,
from settings.SessionReads {Asked, All, Agents}. Every lister asks it,
the aggregators (allFiles, callFilesWith, callSourcesWith,
traceLineFiles, wslFiles, DesktopDataDirs) filter by it again, and
readers of an already-listed session (TranscriptOf, ContentOf,
SearchSession, SubagentTranscript, CarryOver, ReadCallSource) return
ErrNotRead, so a cache from before a switch was turned off goes no
further. The Sessions list, stats, /api/sessions/overview, the call and
trace indexes, Usage's agent-file calls and the Codex/Pi title readers
all pass it.
- SettleReads decides once and saves: an install with sessions.json or
a calls-v* cache read sessions before and keeps all on; a fresh one
reads none, not asked. A saved value is never replaced; save, sync and
restore keep it (KeepOwn); only SetSessionReads writes it. An
unwritable settings.json reads nothing this run.
- GUI: GET/POST /api/sessions/reads. While not asked, the Sessions page
shows a consent card: each agent found (by a stat of its folder only)
with a switch, Allow selected and Allow all. Settings > Privacy >
Agents' session history has "Agents found later" and a row per agent.
Strings in en, zh, zh-TW, ja, de.
- CLI: magpie sessions read [on|off all|<agent>...]; magpie sessions
says on stderr when nothing is allowed yet; the TUI's empty Sessions
page says how.
Read either way, because none of it lists or shows a session: the
gateway's own usage ledger, its projections and the conversations it
recorded (magpie's own records, so usage and cost keep working); the
agents' config and sign-in files; Claude Code's and Codex's
history.jsonl last-used time and a session file's mtime for a quota's
first use; Codex's newest rollout's last line before magpie restarts
Codex (codexTurnOpen).
Tests: TestFreshInstallReadsNoAgentUntilAllowed,
TestSettleReadsKeepsWhatWasThere, TestSessionReadsRoutes,
TestSessionsRead, TestSessionsNotAskedSaysHow, sessions-reads.test.cjs
(26 cases: consent and Settings in 5 languages, Chromium and WebKit,
390 to 900 wide).
Run on mote:
- full Go suite (gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui,
GOOS=windows go vet, go build, go test -timeout 45m ./...) at this
change on
|
||
|
|
75a7db27b9 |
usage: an allowance card can be hidden from the Overview (whqtian_07012 on Discord)
whqtian wanted StepFun's plan card on Usage › Overview without its
balance card. Right-click a card (or long-press it on a touch screen)
and the app menu offers "Hide from Overview". With several accounts on
one card it says "Hide this account from Overview". A plan card that
carries its key's balance also offers "Hide its balance from Overview",
which keeps the plan. Each hidden card is saved as its tray card id plus
its kind (stepfun|balance, kimi|me@x|plan) in settings.UsageCardsHidden,
through POST /api/usage/arrange (cardsHidden). The Settings save keeps
it. Under the cards, a quiet "{n} hidden" line opens them, each with
Unhide, and Show all from two. It is the same pattern as the Agents
list's hide.
Display only: routing, caps, counting, the Accounts list, the tray
panel's Allowances (it has its own Arrange) and the menu bar cells
never see it. A cell clicked for a hidden card shows it until the page
is left (usagePeek). UI: the app menu, not a native select, no
coloured stripes, no new button on the cards.
Run at this head (rebased on
|
||
|
|
012c584cc1 |
usage: clear a model's usage, or all of it, from the Usage page
CrazyMouse_TT on X asked for a way to clear usage, all of it or one model's, to measure a local model fresh after deploying it. The Usage page's Models list has a "…" on each row (and a right-click menu) with "Clear usage…", and "Clear all usage…" sits under the lists below the "Counted from…" note. Each asks first, in a confirmation that says what is deleted, that it can't be undone, and that key spending limits and allowances still count the calls. A clear is a mark in settings (usageCleared: provider, model, unix ms), read at read time; usage.jsonl is never rewritten. The Overview hides calls up to the mark in summarizeFrom; the Requests page, heatmap and ledger/CSV hide them in Filter.keepsRow, their one choke point, and the request index's meta carries the marks so its cache is dropped. Key budgets, window holds and Codex reads go through usage.Visit and the raw log, so a clear never resets a key's spending limit or a quota. A later clear of the same model or of everything takes the place of an earlier one. The marks ride the settings part of a sync (sync-backup.md) and a save of the Settings page keeps them (api.go's keep list; the guard test TestSettingsSaveKeepsWhatItDoesNotSend caught it missing). gateway-sessions.md and sync-backup.md say so. Run on mote (mote-run) at this tree, rebased on origin/main |
||
|
|
ae03279458 |
masking: the local model is on by default; the rules mask alone until it is downloaded
The owner's plan (10-28, after the xuanwo/_kaichen reports under the
masking demo): with AstrLink Guard picked, the Chinese-name heuristic
is off and only nicknames like 小王/老李 stay a rule; with Privacy Filter
it is as before; every format rule stays; the model is on by default,
masks with the rules alone until its download finishes, and no longer
answers 503 for it.
- masking.ModelWanted(st): on when the user turned it on, off when the
user turned it off (new RedactModelOff, set by SetRedactModel(false),
remove, and cancelling the default's own download), on when the
default's download finished (RedactModelAuto). A settings file from
before this, with a model name picked or files on disk and the model
off, reads as the user's off: magpie's default doesn't override it.
- Until the picked model is installed, requests are masked by the rules
alone and fetch starts its download (one try per model per hour,
never under testing.Testing(), nothing where the model can't run).
When it finishes, settings.UseDefaultRedactModel records the default
(it refuses when the user has set anything) and the model warms.
- model(..., strict): a model that fails holds requests back (503)
only when the user turned it on; under the default the rules mask
alone. The Privacy page says which ("…the rules mask requests alone"
in en, zh, zh-TW, ja, de; /api/privacy-model has `chosen`).
- redact.Options.NamesByModel (AstrLink Guard picked): zhNameSpans
keeps only zhNick candidates (小/老 + a surname).
- KeepOwn and POST /api/settings keep both new fields.
- Docs: gateway-routing.md, site masking docs (en, zh, ja).
Run (mote, Go 1.26.8):
- gofmt clean; go vet of masking, settings, redact, gui; GOOS=linux go
vet of masking, settings, redact; GOOS=windows go vet of the four.
(GOOS=linux vet of internal/gui needs cgo, as on main.)
- go test -count=1 -timeout 45m ./... at base
|
||
|
|
ea7c0067e0 |
privacy: each local model's confidence threshold is the user's to set
Yayoi_no_yume on X asked for the privacy model's threshold to be adjustable: they read it as fixed at 0.5, and from their own use find 0.85-0.95 right for AstrLink. The 0.5 is Privacy Filter's (pf-serve's argv default); AstrLink Guard already masked at its publisher's 0.8. Both models now find at a floor of 0.5 (pii.Floor) and give each span its score: Guard's least token probability (rounded through float32, so a span read back from the cache file sits on the same side of a threshold), pf-serve's own. masking.model keeps the spans at pii.Threshold or over: settings.RedactModelScore[model] when it is in [0.5, 1), else the model's MinScore (Privacy Filter 0.5, AstrLink Guard 0.8). Settings -> Privacy shows a Confidence threshold row under the model (app menu, 0.5 to 0.95 and Default), /api/privacy-model takes do:"score". The setting is this computer's own, like the model. The defaults stay. TestMaskEval's cases, rules + model + magpie's checks, by threshold: Privacy Filter 0.5-0.8 masked 41/42 kept 112/113 Privacy Filter 0.85-0.95 masked 40/42 (a Chinese name lost) AstrLink Guard 0.5-0.7 masked 42/42 kept 112/113 AstrLink Guard 0.8-0.85 masked 41/42 (a phone in a tool result) AstrLink Guard 0.9 masked 40/42 AstrLink Guard 0.95 masked 40/42 kept 113/113 The model alone does raise fewer false alarms higher up (Privacy Filter's found-in-keep falls from 47 at 0.5 to 27 at 0.95, Guard's from 8 to 2), but the checks after it drop most of those already, so a higher threshold mostly costs values that should be masked. Cache file: found-<model>.bin is now "pfound02" with a float32 score per span. A "pfound01" file is still read, each span with score 1, so texts cached before mask as they did and aren't asked again. For those texts a higher threshold drops nothing and a lower one doesn't add a Guard span scored 0.5-0.8 until the cache turns over (20000 answers). merge() keeps the surer score of spans it joins. The eval recordings (eval-model.json, eval-astrlink.json) were made again with scores, from a scratch cache, the live found files untouched. Run in the worktree at |
||
|
|
a019f4ffc0 |
masking, settings, gui: the local model the user picks (#3578)
settings.RedactModelName holds the pick ("" for none, read by
pii.Choose), this computer's own like RedactModel, kept by KeepOwn and
by the GUI's settings save. /api/privacy-model returns the chosen
model's status and every model's, and takes {do: pick, model}: picked
while off it is saved for the next On; picked while on it is
downloaded, and once on disk it is saved and the other model stopped.
Remove deletes both. masking runs the picked model.
TestPrivacyModelPick and TestMaskingUsesThePickedModel fail on the old
code (no pick; Privacy Filter always).
Run: go test ./internal/settings ./internal/gui ./internal/masking
./internal/gateway -run 'Mask|Redact|Privacy|PII|Unmasked'
./internal/gwmw at the pushed head.
|
||
|
|
e219f699ca |
gateway: with no S3 bucket the request archive keeps calls on this computer, oldest removed past 1 GiB (CyberCaius)
CyberCaius on Discord: "请求存档只能存在 s3 存储桶里,不能保存在本地吗". The Usage page's Request archive switch refused without an s3:// sync. Now, with no bucket, the same switch keeps each call in <settings.Dir()>/request-archive/<date>/<id>.json: the same file the bucket gets, masked the same way (Archived, archiveRequest), written to a temporary file beside it, synced and renamed, 0600 in a 0700 folder. Past its size (RequestArchiveLocalMB, 1 GiB unless set) the oldest calls go first, down to a tenth under it; the call just written is never removed, empty day folders go, and a .part file an hour old is removed on the next scan. The running total is counted once and then added to, so a write walks the folder only once it is over. On by default or a switch: a switch, still off unless turned on. Bodies can hold secrets, so nothing is written to a disk where the user didn't ask. The local switch is its own field, RequestArchiveLocal, in KeepOwn with its size, so sync never turns it on at another computer, and RequestArchive synced from a computer with a bucket keeps nothing on one without (archiveDest). The GUI switch writes RequestArchive while sync has a bucket and RequestArchiveLocal while it has none; the tooltip names the folder and the size, and a failed write reads "Not saved" (en, zh, zh-TW, ja, de). GET /api/archive reads this computer's copy first, then the bucket. The Settings page's save keeps both fields (api.go). Docs: sync-backup.md and gui-shell.md say where the archive goes and why the switch is per computer; the privacy pages (en, zh, ja) say what the folder holds, that it is off by default, and how large it grows. The READMEs' Privacy is about what is sent and is unchanged. app.js stays under TestCoreScriptBudget (its comment was shortened, and one t() call folded); no budget raised. Run (worktree diff on |
||
|
|
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
|
||
|
|
7faea508f6 |
settings: Custom proxy brings back the last address and login (Zane)
Zane on Discord: in Settings' proxy, Off saves "direct" and Auto saves "", so the Custom address and its user and password were gone the next time Custom was picked. settings.Save now keeps the last proxy of the user's own as proxyCustom (set only from Proxy, never from the page; the POST /api/settings handler copies the saved one over what the page sends). It is stored as Proxy is: plainly in settings.json, as before, the same as the proxy itself, nowhere more plainly. KeepOwn keeps it this computer's own, as Proxy, so sync and restore never carry another computer's. Custom picked after Off or Auto fills its fields from it; nothing that reads settings.proxy changes, and Off and Auto still send requests as they did. Run at base |
||
|
|
b00c82acfa |
masking: each kind is masked, sent with a warning or held back; a Never mask list and Try it (#1977)
Settings › Privacy gets two sections under What to mask:
- When a value is found: Mask, Warn or Block per kind (redactActions;
a kind left out is masked). Warn sends the value as written and records
it with a placeholder nobody remembers, not counted as masked. Block
masks it as before and the gateway answers 400 naming the kind and the
value's hint, never the value, with nothing sent (maskBlocked); the
record is kept as Blocked. The secret kinds come first, the personal
ones behind Show all kinds. A Never mask list (redactAllow) lets a whole
value go as written in any case; a longer value it is part of is masked.
- Try it: POST /api/masking/preview masks a text as a request would
(redact.Preview) and remembers nothing: no placeholder stands for it
afterwards and its values aren't masked later as seen before. The page
shows the vendor's text, what was found and what would be done, and
keeps the text in no storage.
The masking card counts requests held back and values sent as written; a
call whose values only went as written gets an amber badge on Recent calls
and the Routing log. zh, zh-TW, ja and de throughout. Docs: gateway-routing
and gui-shell.
Broken by hand: the new GUI badge assertion fails on the old maskedBadge
(no .warn badge drawn); TestSettingsSaveKeepsWhatItDoesNotSend went red
until the two settings were in its fixture; "{n} held back" turned
i18n-keys red against the routing plugin's "{n} held" and was renamed.
Run at this tree (base origin/main
|
||
|
|
20c0688316 |
gateway: Claude Code processes are held to what the machine's memory holds; a full room is a 503 the next provider takes (#2956)
Cause: nothing bounded how many Claude Code processes magpie runs for
Claude subscriptions. Busy runs had no limit, idle ones were capped at 6
and parked ones at 16 per bridge, and one-off tests, warm-ups and /usage
reads were counted nowhere. The reporter's 512 MiB systemd service had 2
busy runs and 14 starting at once when the memory cgroup's OOM killer
ended them.
Measured (Docker arm64, real Claude Code 2.1.303):
- one idle run holds about 205 MiB RSS, 86-112 MiB of it anonymous;
- six runs under a 512 MiB memcg gave oom_kill 2 and a peak of 512 MiB.
Fix: claudeRoom (claude_room.go). Every Claude Code takes a place before
it starts and frees it when its process exits. That covers startRun and
runClaudeTree (tests, warm-up, /usage).
How many may run:
- the user's claudeRunsMost (`magpie claude-code runs N|auto`). It is
machine-local (KeepOwn), and the Settings page's save keeps it.
- otherwise, on Linux, (limit - 256 MiB) / 128 MiB, at least 1. The limit
is the least of MemTotal, cgroup v2 memory.max and memory.high up the
tree, and cgroup v1 memory.limit_in_bytes. The reporter's 512 MiB
cgroup gives 2, and 1 GiB gives 6.
- otherwise no bound: macOS, Windows, or limits that can't be read.
A full room first lets go of the oldest idle run. Its session is
shelved, so the next turn resumes it. Next it lets go of a run parked
past parkLongest. Busy runs are never let go. Otherwise it waits up to
2 minutes, then answers 503 with the reason and the command.
Routing treats that 503 as protected. No Claude account is rested or
asked next, since each would wait for the same room, and another
provider in the group answers.
Tests (each run red by hand on the broken code):
- TestClaudeRunsHeldToTheRoom: 6 conversations at room 2. With take
forced to always admit: "6 Claude Code processes were alive at once,
2 may be". Fixed: at most 2, and all 6 answer 200.
- TestClaudeRoomLetsAnIdleRunGoAndItResumes, TestClaudeRoomFullIs503 and
TestClaudeOneOffsTakeRoom went red with take forced open.
- TestClaudeNoRoomPassesOnAndRestsNobody went red with the routing
exemption off: both Claude accounts were tried and rested.
- TestClaudeMemRunsFromTheCgroup uses the reporter's literal meminfo,
cgroup path and memory.max.
- TestClaudeCodeRunsSetsTheUsersOwn went red with validation loosened.
- TestClaudeRunsMostIsMachineLocal went red without the KeepOwn line.
- TestSettingsSaveKeepsWhatItDoesNotSend (internal/gui guard) caught a
Settings page save clearing the value. It is kept now.
Run at this tree (macOS, go1.26.8):
- go test -timeout 45m -count=1 ./... with pipefail, under a load
average of 650-800 from other sessions: 61 packages ok. Three were not:
- internal/agent and internal/gateway hit the 45m timeout mid-test.
The stacks show no hang. Re-run at -timeout 120m: agent ok (2779s).
- In gateway, TestClaudeAccountsSpentFallBackToCodex hit its 30s wall
bound. No room wait was logged before it, and it passed 5 of 5
alone.
- In the same run TestClaudeRoomLetsAnIdleRunGoAndItResumes was red
because of its own check: a random request id in the fake's log
spelled "a1". It now reads only the fake's "told" lines. Flipped to
"a2", it goes red.
- internal/gui: TestPanelJoinsFullScreenSpaces (a macOS window test)
passes alone. TestSetAnswersWhileDevinAndProvidersHang has a 10s
bound, and at the base commit under the same load it failed 2 of 3.
- The touched packages again, -count=1: settings, cli and gui ok.
gateway: the room tests and TestClaudeAccountsSpentFallBackToCodex
ok at -count=5.
- gofmt -l: clean.
- GOOS=linux and GOOS=windows go vet -tags nogui ./...: clean.
Not tried:
- the Docker 512 MiB reproduction re-run with this build against real
Claude Code. The fix is shown with fake runs only.
- a real cgroup v1 host.
- the site's docker docs (en/zh/ja) don't mention `claude-code runs` yet.
|
||
|
|
2fd5529479 | gui: the core script budget makes room for Settings › Privacy's local model, and a Settings save keeps it (#1977) | ||
|
|
1978eabe58 |
agent: Codex's background compaction is turned on from Settings › Long conversations (#2490, #2493)
Codex 0.163 can compact a long conversation in the background while a
turn goes on ([features.async_compaction]). A new row under Long
conversations turns it on, with the share of the window it starts at
(empty: Codex's own 65%). magpie writes it into each Codex config it
routes (codex_async.go):
- [features.async_compaction] enabled = true and
model_async_compact_threshold_percent. Codex reads the threshold only
in that table; one at the top level is ignored (tried).
- capabilities = { remote_compaction = "v2" } on [model_providers.magpie].
Codex starts a background compaction only on a provider with v2, which
it gives OpenAI and Azure alone. Tried with Codex 0.163 against a
sandbox gateway and a fake upstream reporting 70% use: without the
capability, no compaction in a whole turn; with it, compaction_trigger
requests ran beside the turn's steps and the next step's input held
the summary. The capability is written for a feature the user turned
on by hand too (#2493 asked whether magpie supports it: it didn't).
putProvider carries the table's capabilities over when a model switch
writes it again.
- What magpie wrote is in the stash (codex.async). A value the user set,
or changed since, is never written over and stays when the switch is
turned off; a bare async_compaction = true, an inline or a dotted
table is the user's as written. A config that doesn't parse is not
written to.
Not tried: Codex signed in with ChatGPT (openai_base_url to magpie on
the built-in provider, v2 by default), only the custom provider path.
Tests: TestCodexAsyncCompactionWritten, ...KeepsTheUsers and
...KeepsUsersCapability (internal/agent), each red with the matching
part removed by hand (no writing; no capability carry-over; no
ownership check on enabled). codex-async-compact.test.cjs: Chromium and
WebKit, en/zh/zh-TW/ja/de, red with the 1-100 check removed;
compact-at, i18n-keys, settings-general, settings-search pass.
TestSettingsSaveKeepsWhatItDoesNotSend holds the two new fields.
gofmt clean; go vet -tags nogui on darwin, linux, windows.
Full suite: go test -tags nogui -timeout 45m ./... (pipefail, suite-lock) at the four #2494/#2504/#2505/#2490 commits on origin/main
|
||
|
|
ea3dee96a8 |
gateway: a URL magpie didn't choose is downloaded from public addresses only, wherever the request came from
|
||
|
|
e243937ca3 |
gateway: a fast pick can be sent as Ultrafast where the account offers it (#1954)
zhenghaowen0967 asked for an agent's fast pick of a ChatGPT model to go as
Codex's Ultrafast without the client asking for it. settings.UltraPicks
holds the agent's fast picks that are set to Ultrafast; each one is in
FastPicks too.
- The gateway marks those candidates `ultra` in fastPick.
- On Chat and Responses, a try sends service_tier "ultrafast".
- From Messages, a try carries withUltra to forwardTranslated, which
sets Request.Ultrafast for the ChatGPT backend.
- In every case, the #1784 check decides the account. One whose list
doesn't offer Ultrafast goes after a mate that does (tierMate). With
no mate left, it is sent priority.
- That check now covers Chat as well as Responses.
- Sibling fix: chat.go dropped a Chat client's own service_tier
"ultrafast" (Fast was false, Ultrafast unset). It now parses as
Responses does.
- provider: SetFastTier (""/priority/ultrafast) behind SetFastPick.
CanUltra and UltraModels say whether one of Codex's accounts lists
Ultrafast on the model. UltraPicks follow a provider rename
(renameModelPrefs) and survive a GUI settings save.
- GUI: an option gets ultraOk/ultra. Where ultraOk is set, the bolt in
the picker steps usual -> Fast -> Ultrafast -> usual, as a camera's
flash button steps its modes. Ultrafast shows two overlapped bolts, in
the row and after the field's model. Tooltips and the status line are
in en, zh, zh-TW, ja and de. POST /api/agent-fast takes `ultra`.
- No `:ultrafast` suffix for routing groups yet.
Tests, each broken by hand and seen red:
- TestUltraPickSentUltrafast covers omp/Responses with no tier asked
(acct-pro:ultrafast), the Pro account out (then acct-plus:priority),
another agent unchanged, opencode/Chat and claude/Messages picks, a
Chat client's own ultrafast, and switching back to Fast or off.
- Red with ultra forced false (4 cases).
- Red without withUltra (claude went priority).
- Red without the chat.go parse (2 cases).
- TestSetFastPick: red without UltraPicks in renameModelPrefs.
- TestSettingsSaveKeepsWhatItDoesNotSend: red without the api.go carry.
- fast-ultra.test.cjs (en zh ja de, window and 440px panel): red (9/9)
without the Ultrafast step.
Run (vet, gofmt, GUI and full suite at base 8b84dc902; the reruns
below at a rebase onto
|
||
|
|
b476dc5a93 |
agent, gateway, gui: Claude Desktop's subagents can have a reasoning effort of their own
After #2081 gave Desktop a subagent model, its effort still came from the request. Add subagent_effort beside that model, using the existing effort slider. The live setting DesktopSubagentEffort belongs to magpie; no Claude client file or binary is changed. Empty preserves the request's effort, including disabled thinking. A pick applies only to Desktop requests with an agent id and tools, independently of model replacement: unset, equal and unavailable model picks all work. Reuse the attempt-level fitting; fixed group-member efforts and reasonless models keep their existing precedence. count_tokens applies the pick after unmasked-body restoration. A Codex SubagentPick is not evidence of a Desktop tool turn. Route.Effort keeps the incoming level, SubagentEffort records the configured pick, and tries/usage keep the actual level. Routing explains the pick even without a model replacement. Options follow the target model; a saved level survives a model change. POST /api/settings preserves it. Disconnected preferences, Disconnect/reconnect and restored settings work; a Live pick gives restart advice only when it actually connects the agent. Codex's own settings and default-effort explanation are unchanged. Verification on |
||
|
|
00afcf97a1 |
provider, gui, cli: a Codex account's auto-use of its resets is two switches, its week used up and one about to expire (#2078, alanwalk)
alanwalk asked for "自动使用重置卡" to be split: they want a reset that is
about to expire used rather than lost, but a used-up week waited out rather
than spending a reset on it (and the other way round for others).
What changed:
- settings: codexAutoResetOnly narrows an account in codexAutoReset to
"week" or "expiring". An account with no entry keeps both, so every
existing config means what it meant: nothing to migrate, and no user
value is rewritten. Load drops entries for accounts not in the list or
with an unknown value.
- provider: CodexAutoResetWhen(user) reads both times. AutoUseCodexReset
(the week used up, called from the gateway's autoReset and
autoResetSignedIn through AutoResetsWeek) only acts when the week is on;
SpendExpiringCodexResets and routing's resetRunsOut only count on the
expiring reset when that is on. SetCodexAutoResetCase(user, when, on)
sets one time and keeps the other; SetCodexAutoReset still sets both.
Both off removes the account.
- gateway: POST /api/settings/codex-auto-reset takes an optional "when";
POST /api/settings keeps codexAutoResetOnly, which the page doesn't send.
- GUI: the account's card (Usage page and the menu bar panel) says
"Auto-use resets:" with each time on its own line and its own switch;
the brief account's one switch still sets both, its title naming each
time; Settings › Usage gives each account an Off/On per time. The status
line says which times are on now. "· auto-used before it expires" on
the resets held follows the expiring switch alone. Strings in zh, zh-TW,
ja and de.
- CLI/TUI: `magpie quota auto-reset <account> week|expiring on|off`; the
quota and accounts tables and the TUI say "auto", "auto when the week
runs out" or "auto before one expires".
What was run (worktree on origin/main
|
||
|
|
20350dafaf |
gateway, agent, gui: Claude Desktop's subagents can be held to one model, set in its row on the Agents page
Claude Code in a terminal holds every subagent to one model through
CLAUDE_CODE_SUBAGENT_MODEL (its "subagents" field), and Codex through
magpie's own setting (settings.CodexSubagentModel). Claude Desktop runs
its Code tab's Claude Code with CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST=1,
and Claude Code 2.1.295 then ignores CLAUDE_CODE_SUBAGENT_MODEL,
CLAUDE_CODE_SUBAGENT_MODEL_FORCE and the tier variables in its settings
files ("Ignoring … this session's provider routing is managed by the
host"). The env Desktop 2.31226 builds for the Code tab has no key for it
either. So Desktop's subagents ran on the lead's model or on a tier's, and
only the tiers could be picked.
Claude Desktop's row now has a "subagent model" square, the same square
and strings as Codex's. It is magpie's setting
(settings.DesktopSubagentModel), which the gateway applies
(desktopSubagentPick):
- Only a claude-desktop request with x-claude-code-agent-id and tools is
moved: a subagent's turn. The lead's turns, the tool-less helper calls
Claude Code makes inside a subagent (on the haiku tier's model),
terminal Claude Code and every other agent stay as asked.
- It is applied after desktopTurn, the tiers and the groups. A turn
already on the model set isn't marked as moved. Route.Subagent,
Route.Model and the ledger's Requested keep the model asked for; Kind
stays empty.
- The model set must be served by its exact id (Resolve takes any model
name under a provider that is on), enabled, and allowed to a gateway key
held to some models (groupAllowed for a group). Otherwise the subagent
stays on the model asked for and the trace says why, in the reasons
Codex's subagent model already has.
- count_tokens counts on the same model.
- It is read on each request, so Desktop needn't restart. The field is
Live (a new Field flag): /api/set and `magpie <agent> <field> <value>`
leave Desktop's restart notice out after it, unless the pick connected
Desktop. Codex's subagent model is unchanged.
- The getter follows a provider renamed since it was set (RenamedRef).
The setter takes any provider/model or group/<id>, also one not served
now (a restored profile), refuses a bare name, and keeps a Desktop
alias by its catalog id. Options are shown while Desktop is on magpie.
- POST /api/settings keeps it; a stopped WSL distro's field copy keeps
Live.
- The Routing page says why a Desktop subagent was moved or kept
(subagentWhy, for a route with a subagent pick and no kind). "it is
disabled in magpie" gets its zh, zh-TW, ja and de, which Codex's kept
reason lacked as well.
- Unset, the pick costs one held settings read (no body decode, no
catalog build).
Not changed: a Desktop on another computer that reaches magpie with a
named gateway key is read as Claude Code (agentOf), so none of Desktop's
routing applies to it, this included. There is no fallback when the model
set has a smaller window than the lead's.
Verified at this head, on
|
||
|
|
f074996d93 |
provider, gateway, gui: a model with none of its levels ticked is sent no reasoning field, on every route and in a routing group (yuexian7)
yuexian7 on Discord: models.dev lists their model as reasoning, and the
vendor answers any reasoning parameter with 422 while the same request
without it works. In a routing group they couldn't set an effort per
model, and the model editor refused to untick the last level ("Keep at
least one level"). The learned refusals (
|
||
|
|
2076943915 |
plugin: a plugin declares its own switches, shown in its provider's editor and read by the plugin (#2038, Vocllum)
Vocllum asked that a plugin can offer the user generic on/off options
without magpie knowing what each one is for. A plugin now declares them
on its auth hook, beside checkin:
auth.options: [{ key, label, description?, default?, confirm? }]
and reads the user's values through input.magpie.option(provider, key)
or input.magpie.options(provider). Each call reads the current values,
so a change reaches the plugin without a restart. magpie only keeps the
value and hands it over: nothing is scheduled or run when an option
changes. The check-in switch (settings.pluginCheckins) and the check-in
plugins are unchanged.
- host.js: optionsOf keeps a key matching [a-z0-9_-]{1,40} with a
non-empty label, drops repeats, caps the label at 60 characters and
the description and confirm at 300, takes default only when it is
true, and keeps at most 16. The values come at init and through
setProviderOptions.
- Go: plugin.Option, Provider.Options, OptionOn and SetProviderOptions
(sent only to a host that is running). settings.PluginOptions is kept
by the plugin's provider id, then the key. POST
/api/settings/plugin-option {provider, key, on} checks the key the same
way and hands the values to the host. The generic settings save keeps
them, as it keeps PluginCheckins. /api/providers' plugins[].options
carry each option's resolved `on`.
- GUI: a "Plugin options" field in a plugin provider's editor. Each
option is a segs Off/On beside the plugin's label and description, put
in with textContent. A confirm text is asked through confirmAction
before turning an option on. Changes wait for Save, which posts each
one before the provider. Strings are added for zh, zh-TW, ja and de.
- Docs: provider-plugins.md (a new section), reference.md, gui-shell.md
and the tests README.
Run:
- TestPluginOptions (a real host with testdata/options). Red with the
old host.js (no options listed) and red with setProviderOptions turned
into a no-op (the plugin still reads the old value).
- TestPluginOptionSetting and TestSettingsSaveKeepsWhatItDoesNotSend.
Both red with the generic save's PluginOptions line removed.
- plugin-options.test.cjs: 22/22 in Chromium and WebKit, at 1100 and 420
wide, in en, zh, zh-TW, ja and de. Red on the old app.js (no field).
The screenshots were looked at: long text wraps and the page has no
sideways scroll at 420.
- provider-concurrency, plugin-signin, plugin-checkin, provider-price-rate
and plugin-move-unserved: 68/68.
- go test ./internal/plugin/... ./internal/settings/... ./internal/gui/...
./internal/provider/..., gofmt -l, and go vet on darwin, linux
(-tags nogui) and windows.
Not tried with a real community plugin, since none declares options yet.
The check-in row doesn't take a plugin-declared label or hint; it is
left as it was.
|
||
|
|
60f896031e |
usage: a client the user counts as an agent is counted as it on Usage and Sessions (#1958, NorethSea)
NorethSea's bridge (hermes-codex-thread-bridge) starts Codex's
app-server under a User-Agent of its own, so its calls were a row
apart from Codex on Usage, and its threads weren't Codex's in Sessions.
Rather than learn one bridge's name, the user says which agent a client
counts as.
- settings: clientAgents, client name (lowercased) -> agent id.
ClientAgentsNow reads just that field through filememo, so a pass over
the ledger costs a stat.
- usage: ReportedAs(ua) is AgentOf, then the user's mapping. It is used
for what is reported only: the summary, the agents list and filters,
request rows and pages, priced blocks, direct, Vias and gateway
sessions. The gateway's routing, keys and caps still go by AgentOf,
the client's own name. The mapping is read once per ledger pass
(readLogSnapshot) and is part of the keys of the summary price cache,
the vias cache and the request page cache, so a change redraws the
history already counted. A request row keeps the client's own name in
a new "client" field, shown as "Client" in its details.
- gui: POST /api/usage/arrange takes {count:{client,as}}. It refuses a
client magpie already knows as an agent, "other" or magpie's own, and
an "as" that isn't a known agent or is magpie. as "" counts it on its
own again. /api/settings keeps the mapping it doesn't send. On the
Usage page an unknown client's "…" offers "Count as an agent…" (a
picker of the known agents), the agent's row says "with <client>",
and the agent's "…" offers "Count <client> on its own". Strings are
in all 5 languages.
Run:
- go test -count=1 ./internal/usage ./internal/settings ./internal/gui: ok.
- TestClientCountedAsAgent goes red with reportedAs broken, and with the
mapping left out of the vias key or the request page key. With the
summary key alone left out it stays green, because the settings stat
already moves it.
- TestUsageArrangeCountClient and TestSettingsSaveKeepsWhatItDoesNotSend
(ClientAgents added) pass.
- Playwright usage-count-client.test.cjs (new) and usage-agents-hide
(its menu now has two items for an unknown client) pass in Chromium
and WebKit, in all 5 languages, at 1100 and 420: 54/54. With
countable() forced false, the new test goes red.
- gofmt -l is clean. go vet is clean for darwin, linux -tags nogui and
windows.
Not tried: a real hermes bridge (the records' UA is from the issue), and
the Client line in a request's details has no GUI test.
|
||
|
|
ea1ba22c32 |
gateway, gui: Codex's composer predictions go where Settings › General says, Off among them (#1970)
pluo's Usage view showed Codex calls of kind composer_predictions at
133k-231k tokens each with no cache read: ChatGPT.app's Codex guesses the
user's next message with a hidden turn on a fork of the thread, on the
thread's own model, reading the whole conversation again each time. It
asks only when the thread's provider is "openai", so through Codex's own
ChatGPT sign-in (and a custom table pointed at magpie). The app's bundle
(fge) asks for {suggestion: string|null} and uses b.suggestion||null.
What changed:
- settings.CodexPredictions: "" as Codex sends it, "off", or a model id
(provider/model, group/<id>); anything else is refused on load.
- gateway: codexPredictionsTo + codexPrediction, wired beside the
descriptions at both entrypoints (gateway.go and codex_backend.go).
Off answers {"suggestion":null} from magpie and sends nothing (the
title Off path made generic as sentNowhere). A model's answer goes back
only as the object Codex asked for (predictionJSON: think tags and code
fences stripped, suggestion trimmed, blank = null). Plain text is never
taken as a suggestion, since Codex would put it in the user's composer
as their next message; it gives null and is recorded as a failure
("prediction: ...").
- usage: purpose "Prediction" for composer_predictions (purposes.js
regenerated).
- gui: POST /api/settings/codex-predictions, kept by the general save;
Settings › General row "Codex composer predictions" (Codex's own / Off /
magpie's models, the app's picker), hidden in gateway mode; Routing's
story for the kind says Codex's own switch (Settings › General › Show
predictions) and magpie's. i18n in zh, zh-TW, ja, de.
- docs: gateway-routing.md's Codex section, reference.md's gateway-mode
list. site/ docs left for the owner.
What was run:
- go test -tags nogui ./internal/gateway/ (full, -timeout 40m),
./internal/gui/ ./internal/settings/ ./internal/usage/: pass.
New: TestCodexPredictionsSetting (default to ChatGPT, off sent nowhere,
model routed, plain turn untouched, ledger kinds), TestNoPrediction,
TestCodexPredictionOnMagpie (/v1/responses and the backend path),
TestPredictionJSON; gui TestCodexPredictionsSetting.
- Broken by hand, each went red: backend wiring removed; plain text
accepted as a suggestion; the general save not keeping the setting;
the Routing story's kind check.
- Playwright codex-predictions.test.cjs: chromium + webkit, 1100 and 420
wide, en/zh/zh-TW/ja/de (20 pass). routing-kind (with the new kind),
codex-descriptions, codex-titles, i18n-keys, gateway-mode,
purpose-filter, routing-purpose-state, settings-general,
settings-sections, settings-search: pass.
- gofmt -l clean; go vet darwin, linux -tags nogui, windows.
Not tried: the real ChatGPT.app's predictions against magpie (the
feature is gated server-side by /wham/predictions/config and isn't on for
the owner's account); the reply shape is from the app's bundle.
|
||
|
|
7d6358ff6b |
gateway: /v1/models can list each model by its bare id too, for apps moved from another proxy (love1sbug on X)
love1sbug moved from CLIProxyAPI: their clients ask for gpt-5.6-sol, and magpie's /v1/models gave only codex/gpt-5.6-sol. "Provider in model names" ( |
||
|
|
a65f2131dd |
gateway: a provider's model can be marked a video or image model in its editor (#1399, shen-joe)
shen-joe's relay serves a video model (agnes-video-2.5-flash), but its
/models list doesn't say "kind": "video". magpie only took a base-URL
provider's video models from that field, and its image models from that
field or from the model's name. So the model could never be asked at
/videos. They asked to tag video models, either in Settings or when
adding the provider.
What changed:
- settings.ModelKinds holds "image" or "video" by "<provider>/<model>".
RenamePerModel carries it along with the other Model* maps.
- provider/modelkind.go:
- MarksKinds: only a provider with its own base URL can be marked. A
subscription, another magpie and a decision API can't.
- ModelKind, KindModels and SetModelKind. A model can be marked if the
provider serves it, or if its fetched list has it (a video model is
left out of the chat list).
- SetModelPrefs takes a "kind" with the model's other prefs.
- gateway:
- Drawers adds the models marked image and drops the ones marked video.
- customVideomakers adds the models marked video and drops the ones
marked image.
- The 400 for a model that can't make videos now says where to mark it.
- GUI: the model chip's right-click menu gets "Makes: Auto/Image
model/Video model…" (an app menu, not a native select). The pick is
staged until Save, and a marked model shows a small image/video tag.
Strings are in zh, zh-TW, ja and de.
- docs/subsystems/gateway-routing.md describes it.
- settings_keep_test sets ModelKinds, so a Settings-page save is checked
to keep it (that guard test went red until it did).
Why per model, in the provider's editor: the kind belongs to one model
of one provider, like the per-model API pref already set there.
Settings → Image/Video only pick the default model. This also covers
their "tag it on the provider" alternative.
Not done: Agnes's own video API (polling at /agnesapi?video_id=, the
finished video in "url") isn't OpenAI's GET /videos/{id}. Marking the
model gets the request to its /videos, but the poll won't match until
there's a mode for it. I've asked the reporter for real responses.
Run:
- go test ./internal/provider ./internal/settings ./internal/gui
./internal/gateway: ok (gateway 1658s).
- TestCustomProviderVideoTheUserMarks, which goes red with the
KindModels loop in video.go removed.
- GUI model-kind.test.cjs, 16/16 (en/zh/ja/de, 900/420, Chromium and
WebKit). It goes red with the menu item removed.
- Sibling GUI tests: model-api-gemini, model-copy-id, model-api-preset,
model-test-one/as/why, provider-detect-models, provider-typed,
i18n-keys, gui-ja and gui-de.
- gofmt, plus linux and windows go vet -tags nogui.
- Not tried against Agnes's real API (no key).
|
||
|
|
ab1006bb80 |
gui: each WorkBuddy, Trae CN, MiniMax, Qoder or plugin account's daily check-in can be turned off on its own (#1902, magicLaLa)
settings.CheckinOff lists the accounts left out, by their entry in the
vendor's check-in file ("workbuddy|<uid>", "trae-cn|<uid>", a plugin's
"<provider>|<account>"). checkinNow skips them, both in the loop and on
Check in now. provider.CheckinAccounts() lists every account a check-in
reaches; /api/settings carries it as checkinAccounts, and
POST /api/settings/checkin-account {key,on} turns one off or on. A full
/api/settings save keeps the list. Settings shows an Off/On switch per
account under each vendor's Daily check-in row when it has 2 or more
accounts; the Usage card says "Auto check-in is off for this account" and
offers no Check in now for it. en, zh, zh-TW, ja, de.
Run (on 63a361b5f's tree, then targeted again on
|
||
|
|
b6831d83e1 |
gateway, gui: Codex's thread descriptions go to a model picked in Settings, apart from its titles (#1198, congee949)
Codex asks its own model, through its ChatGPT sign-in, for each thread's description (thread_description), even while the conversation runs on magpie's models. Settings › General gets "Codex thread descriptions" beside "Codex thread titles". It defaults to Codex's own, which sends the request as Codex sent it, or it can name one of magpie's models or a routing group. The answer is wrapped as description-only JSON. The titles setting is untouched. Usage and Routing show these requests under their own Description purpose. The setting is kept across unrelated Settings saves. There is no Off yet, because Codex's handling of an empty description hasn't been checked. This is a first slice of #742. Squashed from the PR and merged onto current main. Conflicts resolved: - codex_backend.go: the description branch comes after the title branch, ahead of main's subagent pick. - gateway.go: main's CC Switch #1301 comment above the compaction block is kept; the PR had shortened it. - app.js: the gateway-mode list of hidden rows takes the new row. - i18n.js and settings_keep_test.go: both sides kept. - purposes.js: regenerated with go generate ./internal/usage. Run on the merged tree: - gofmt -l is clean. - go vet passes on darwin, linux -tags nogui and windows; the builds on all three succeed. - go test -tags nogui passes for ./internal/gateway, ./internal/gui, ./internal/settings and ./internal/usage. - GUI, chromium and webkit: codex-titles, gateway-mode, purpose-filter, routing-purpose-state, gui-de, gui-ja, gui-zh-tw, i18n-keys, settings-general/-groups/-sections/-search and click-scroll: 118/118. Broken by hand: with the description branch removed from codexBackend and handle, TestCodexDescriptionsSetting, TestCodexDescriptionFallbackOnMagpie and TestNoDescription fail. Not tried: a real Codex thread_description request, and whether Codex's sidebar takes the answer. |
||
|
|
841af36bfc |
gateway: models the user disabled are refused on every route, and leave every list (#1867)
oxsean asked for one place to turn a model (claude-fable-5) off for good:
not reached by a direct request, an old session, a routing group member,
a fallback, a sub-agent, count_tokens or a decision model.
What changed:
- settings.DisabledModels: patterns, an exact id or a glob (* any run, /
included; ? one), matched ignoring case against provider/model, the
bare id and its last segment (provider/disabled.go). Empty by default,
so nothing changes for anyone who doesn't set it.
- Lists: buildEntries (entriesOff) leaves a disabled model out of the
catalog, so /v1/models, agents' model files and pickers, Codex's list
and every group go without it; membersIn skips it as a member, Deciders
as a decision model; codexModels drops Codex's own disabled slugs and
codexListTag changes so Codex refetches.
- Requests (gateway/disabled.go): 403 "model <id> is disabled in magpie"
in each API's error shape, at #882's choke points: serve (idOff),
perKeyBarred (no candidate: group next member, provider Fallback),
count_tokens and Gemini :countTokens, serveSystemOne,
serveDecisionGroup and postDecide, draw/video/embeddings, and
codexBackend for Codex's own bare models. A group with a member left
goes on without it; one with none left is refused naming them. A bare
id the catalog no longer has is refused as disabled, not 404. A Codex
sub-agent pick onto a disabled model stays on its lead's model.
- An unreadable settings.json is never "none disabled": the list read
last stays; with none read, every request is refused; nothing is
written over the file.
- CLI: magpie model disable <model|glob>..., enable ..., disabled
(list-disabled).
- GUI: Settings > Models > Disabled models: each pattern with the models
it matches now and Enable; Disable... opens the model picker, which
also takes a typed glob. Says only requests through magpie are covered.
POST /api/settings/disabled-models; POST /api/settings keeps the list.
Strings in zh, zh-TW, ja, de.
- docs/subsystems/gateway-routing.md: Disabled models section.
What was run (worktree at origin/main
|
||
|
|
7a9490638d |
gateway, gui, settings: an IP / CIDR allow list for the gateway, from MAGPIE_ALLOW_IPS or Settings beside Share on local network (lc on Discord)
What changed: lc runs magpie in Docker on a public host and asked that
only some addresses reach it at all. With a list set, a request from an
address outside it is refused 403 ("magpie answers only the addresses on
its allow list ..., and this request came from <addr>: add it there to
let it in") before its gateway key is looked at, so a leaked key is no use from
elsewhere. No list is as before.
- internal/settings/allowips.go: SplitAllowIPs, ParseAllowIP (an IP or a
CIDR range, v4 or v6; zones dropped, v4-mapped unmapped), CleanAllowIPs.
Settings gets AllowIPs (allowIPs).
- internal/gateway/allow.go: MAGPIE_ALLOW_IPS (comma or space separated)
sets the list in place of Settings'. The address judged is the
connection's own (r.RemoteAddr); X-Forwarded-For and the rest are never
believed (magpie has no trusted-proxy list; MAGPIE_TRUST_PROXY never
reads forwarding headers, and this follows it). Loopback and this
computer's own interface addresses always pass. An entry that doesn't
read lets nothing in and is logged once, so a typo never opens magpie
to every address. lanGuard checks it after the OAuth callback and
before the rebound-Host and key checks; `magpie web` is wrapped with
AllowGuard too.
- GUI: Settings > Network shows an "Allowed addresses" row under Share on local
network when sharing is on, the page is open from another computer, or
the env var is set (then read-only, saying so). POST
/api/settings/allowips saves it, refuses it while the env var is set,
refuses an entry that doesn't read, and refuses a list that would shut
out the address the page itself is open from (KeepsOut). The generic
settings save keeps AllowIPs. Strings in zh, zh-TW, ja and de.
- Docs: the Docker page (en, zh, ja) lists MAGPIE_ALLOW_IPS with a note
that a request from the host itself arrives from the bridge's gateway
(172.17.0.1), that Docker Desktop and rootless Docker show clients as
one address of their own, and that behind a proxy every request comes
from the proxy; docs/reference.md and docs/subsystems/gateway-routing.md
describe it. The READMEs list no env vars, so they are unchanged.
Why: a gateway key is the only lock on a public host; an allow list keeps
everyone else from even trying it.
Run (machine load average 75-140 from other sessions, so the large
packages ran in slices of their top-level tests, each slice
-timeout 9m, private GOCACHE, sandbox HOME):
- New tests: internal/gateway/allow_test.go TestAllowList (allowed,
denied, CIDR v4/v6, IPv6 literal, link-local with zone, v4-mapped,
loopback and own address always in, on the list still needs a key,
a typo shuts everything out, env over settings), TestAllowListServed
(a real connection from loopback passes lanGuard under a list naming
nothing of this computer's; a request from elsewhere is 403 naming its
address and MAGPIE_ALLOW_IPS), TestKeepsOut; internal/settings/allowips_test.go
TestCleanAllowIPs; internal/gui/allowips_settings_test.go
TestAllowIPsSetting; internal/gui/tests/allow-ips.test.cjs (14/14 in
chromium and webkit, at a 390px panel, en and zh, keys in zh, zh-TW,
ja and de). Broken by
hand: with lanGuard's check removed TestAllowList and TestAllowListServed
FAIL; with KeepsOut skipped TestAllowIPsSetting FAILs; with renderAllow
not called the GUI test has 5 failures. Restored, all pass.
- internal/gui/settings_keep_test.go gains AllowIPs:
TestSettingsSaveKeepsWhatItDoesNotSend failed without it, as it should
for a new field.
- go test -tags nogui: every package ok. internal/gateway (4 slices),
internal/agent (4), internal/provider (3), internal/gui (2),
internal/plugin (2), the rest whole. GUI Network-settings test files
(11) 98/98 and i18n-keys ok, both engines.
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./... ok; linux and windows builds ok.
- Not tried: a real Docker container on a public host (the bridge note
is from Docker's docs, not checked here); behind a real reverse proxy.
|
||
|
|
3e88fc09dc |
agent, gateway: Claude Code on a model Anthropic doesn't review gets auto mode's server review turned off, so it no longer says magpie isn't eligible (1EFLOPS on X)
1EFLOPS runs Claude Code through magpie on Codex's gpt-6.1-sol. In auto mode, Claude Code 2.1.296 says "this session isn't eligible because your requests go through 127.0.0.1:3425 ... ask your gateway to implement https://code.claude.com/docs/en/auto-mode-classifier-billing". What the page asks of a gateway: pass the anthropic-beta header (dangerous-tool-use-2026-09-03), the request's `safeguards` field, and `safeguard_results` in the reply through unchanged, and leave tool-use ids alone. The results are verdicts from Anthropic's own safety classifier. For a gateway that can't provide them, the page's remedy is CLAUDE_CODE_AUTO_MODE_SERVER=0. Pro, Max and Team plans never see the notice. In the bundle, Claude Code falls back on server_unsupported, server_unavailable_disabled or server_no_result, and the notice shows whenever there's no real verdict. Only that variable removes it. Per route: - Claude subscription bridge, Anthropic API key, relays in front of Anthropic, Bedrock and Vertex: already pass the beta, `safeguards` and `safeguard_results` through ( |
||
|
|
e21ea07e47 |
gui: a client in the Usage page's Agents list can be hidden from it, and shown again from the line under it (ikunbots on X)
ikunbots asked to hide curl, Go-http-client, python-httpx and other clients
from the Agents list beside the agents they actually use.
What changed:
- Each Agents row has a "…" button that shows on hover (always on touch) and
opens the app's row menu (openRowMenu) with "Hide from this list".
Right-clicking the row opens the same menu. No native select.
- The hidden ids are saved by client id in settings.UsageAgentsHidden,
trimmed and deduped. They go through POST /api/usage/arrange
(agentsHidden), which changes only that field, and the Settings save
carries the field over.
- Hiding is display only. The ledger keeps the calls, and the totals, the
chart and every share still count them.
- When anything is hidden, a quiet "3 hidden" / "已隐藏 3 个" line sits under
the list. It opens the hidden rows, dimmed, each with "Unhide" / "取消隐藏".
No click scrolls the page: the scroll guard holds the clicked line in place.
- Where a pointer hovers, the "…" takes no room. Its margins give back its
width and gap, so a row at rest is laid out as on main (mobile-web's
desktop comparison is the same). It shows over the end of the share bar.
On phones (body.web) it has its own grid column.
- Translated into zh, zh-TW, ja and de. docs/subsystems/gui-shell.md
describes it.
What was run, in a worktree off origin/main:
- gofmt -l: clean.
- go build ./... and go vet ./...: pass.
- GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./...: pass.
- HOME=<scratch> go test -tags nogui ./...: 49 packages ok. Includes the new
TestUsageArrangeAgentsHidden, which covers saving, surviving a settings
save, narrowing and emptying.
- New usage-agents-hide.test.cjs: 32/32 in Chromium and WebKit. It covers
en, zh, zh-TW, ja and de at 1200, 560 and 390 (web). It hides by "…" and
by right-click, checks the POST body, unchanged totals and an unmoved
page, then unhides, reloads and checks the hidden rows persist.
- All 48 usage, panel-arrange and click-scroll GUI files: 503/503.
old-webkit and mobile-web: pass.
- Full GUI suite (6489 tests, concurrency 5): the reds outside this change
fail the same when run alone on origin/main
|