ac4af582301a4e8a29245dbba767eba31334ddf9
327
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 |
||
|
|
c7ebb6f8d9 |
settings: Video generation picks the model Magpie Image makes videos with
The same Discord (#feedback) user: a custom provider's video model still couldn't be chosen. A custom provider's video model was already found (seedance, kling, veo, wan, hailuo ids by name, or marked by hand with right-click › Makes › Video model, #1399), but generate_video always used AutoVideomaker's pick, the first video model of the first provider, with nowhere to choose another, as Settings › Images does for images. settings.VideoGen (provider/model or a routing group) is now the model a request that names none makes its video with, while it resolves; else AutoVideomaker's, as before. Image generation turned off turns video off with it, as before. Settings › Models › Images gets a Video generation row under Image generation: Automatic (naming the automatic pick) and every model Magpie Image can make videos with. A pick that no longer makes videos (provider gone or off, model unmarked) says so and the automatic one is used in its place; the settings API refuses a model that makes none, and keeps the pick when a save doesn't send it. The row is drawn by videogen.js, imported when Settings draws Image generation, with one call in app.js: drawn in app.js it put the core scripts 616 bytes over TestCoreScriptBudget (1,534,418 > 1,533,802, found by the first full run), and the budget is not raised. Run on mote: - At this change on |
||
|
|
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 |
||
|
|
9451ad59f1 |
gateway: MAGPIE_PUBLIC_URL at a private address is the local network's, the Docker bridge's other containers', alike in Connect's menu
jiezhengj (Discord) runs magpie in Docker on a NAS, MAGPIE_PUBLIC_URL at the NAS's own 192.168.31.218. The web UI's Gateway list called that address "Public address" (公网地址), which reads as the internet's, and Connect's Base URL menu offered 本机 / 公网地址 / 局域网, where 局域网 was really the Docker bridge's 172.17.0.1 that other containers on the host use, while the list above it named that one "Other containers on this host". The classification itself was right (gateway.PublicIP never takes RFC 1918, CGNAT or ULA for the internet); the labels weren't: any MAGPIE_PUBLIC_URL was "Public address", and Connect's menu had its own three-way rule that knew nothing of the bridge or of internet addresses. - gateway.URLKind(u): "internet" (PublicIP), "local" (any other IP literal) or "" (a name, not looked up). /api/settings and /api/providers' gateway carry it as publicKind beside publicURL. - settings.js addrWho(g, u, others) is the one rule: this computer; the bridge address as other containers'; an internet address as such; MAGPIE_PUBLIC_URL by its kind (private: Local network; a name: Public address); anything else Local network. The Gateway list (each label said once for the lines it heads; local, then other containers, then internet), Connect's Base URL menu and About's MAGPIE_PUBLIC_URL row all use it. - "Public address" now only names a MAGPIE_PUBLIC_URL that is a host name; zh 公网地址 → 对外地址, zh-TW 公開位址 → 對外位址 (ja/de already neutral enough: 公開アドレス, Öffentliche Adresse). No new strings. Run, on mote (sandbox HOME, Go 1.26.8): - go test -run 'URLKind|PublicURL|LAN|Container|DefaultGateway|HostNetwork' ./internal/gateway ./internal/gui: ok, at |
||
|
|
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
|
||
|
|
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 |
||
|
|
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) |
||
|
|
ead0bf0059 |
agents, sessions: open in a terminal on Windows and Linux too, and copy any CLI agent's launch line
lileo0668 on Discord: clicking an agent should start it in a terminal,
and a history session should resume there. Opening a terminal was the
Mac app's only (Open in terminal on an Agents row, and Sessions' Open in
the selected terminal and Continue with another agent), and Copy launch
command was only for agy, Cursor (local) and Claude Science.
- terminal_open.go: openTerminal off a Mac.
- Windows: Windows PowerShell (the system default), PowerShell 7 and
Windows Terminal. The line, PowerShell's as Sessions already copies
it, goes as -EncodedCommand: no script file, so no execution policy,
no file encoding and no quoting in between. A shell gets its own
console through cmd's start (magpie's children are CREATE_NO_WINDOW);
wt is started directly, on pwsh or else powershell.
- Linux: $TERMINAL, then xdg-terminal-exec, then x-terminal-emulator,
then the first of GNOME Terminal, Konsole, Xfce Terminal, kitty,
Alacritty, Ghostty, foot, WezTerm, Terminator and XTerm, each with its
own words before the command. The line runs from a script of its own
in sh, then the user's shell, as the Mac's .command file does.
- A terminal that quits failing within a second says so, with what it
printed ("cannot open display").
- Settings' Session terminal row lists the terminals found on Windows and
Linux too; no row when none is found.
- Every agent row with a program now carries `command`, the line the
server builds (Launch, or the program quoted for this system's shell;
an agent in a WSL distro is started through wsl.exe on Windows). The
row menu (right-click or the grip) has Copy launch command after Open in
terminal, on the web build and in the panel too.
Run:
- mote (macOS 27, go1.26.8): go vet of internal/gui and internal/settings
for darwin, for linux with -tags nogui, and for windows; GOOS=windows
and GOOS=linux (nogui) builds of the binary; go test ./internal/gui
./internal/settings ./internal/agent. Everything passes except
TestMainWindowCorners/macOS_26_SDK, which is #3949.
- Windows (win-run, xiaomi-gpu): go test ./internal/gui ./internal/settings.
The new tests pass, among them TestAgentLineWindows, where real
PowerShell runs the encoded line on a claude.cmd in a folder named
`it's a $(New-Item made1) & New-Item made2 #` and runs nothing else.
The six reds are filed: TestLodyImportHandoff,
TestImportStatusUnreadableIsUnknown and TestAionUiImportRow (#4115),
TestUpdateThatWontStart (#1827), and TestPluginAgentMissingSaysSo and
TestGatewayHeldByAContainer (#5324).
- Linux (wsl-run, magpie-desktop): go test -tags nogui -timeout 45m
./internal/gui ./internal/settings: both ok (internal/gui 630s; at
the default 10m it timed out with nothing hung)
- Real use. A throwaway test called openTerminal, not committed.
- On xiaomi-gpu's console desktop (schtasks /IT): system default and
wt each opened a window and ran a line with ' and 中文. pwsh isn't
installed there and was refused by name.
- On magpie-desktop under Xvfb: the system default
(x-terminal-emulator, the xfce4-terminal wrapper) and xfce4-terminal
each ran it (TERM=xterm-256color, set by the terminal). xterm isn't
installed there and was refused. Without a display, xfce4-terminal's
"cannot open display" came back as the error.
- GUI (mote, Playwright Chromium and WebKit): agent-open-terminal (five
languages, 980px and 420px; Copy sends the server's line to /api/copy
unchanged), session-terminal (Win32 and Linux platforms at 420px, and
no row when nothing is found), settings-general, and the agent-*,
sessions-*, session-*, gui-de, gui-ja and gui-zh-tw files with
fold-show-grip, grip-inset, tap-click, menu-input-scroll and
click-scroll (102 files): 1689 pass, 5 fail. The fails:
menu-input-scroll, 4 of 4 red alone on origin/main
|
||
|
|
4f624241f7 |
codex: the ChatGPT app left on "hit a snag" after an app-server restart is reopened when idle (#4550)
ysm119 on Discord: each Restart of Codex in magpie left the ChatGPT desktop app on "ChatGPT 遇到了问题 / 请重试" till it was quit and opened again. magpie ends the app's own app-server cleanly (code 0); a signed-in ChatGPT 26.1021 then fails "Hosted AppServerManager identity is not ready" on the one it starts, logs fatal_error_broadcasted and shows the page. That is the app's bug; magpie now follows it up. - provider/codex_app_crash.go: for 60s after every end magpie makes (the watcher's step, RestartCodexApp, RestartSwitchedCodexApp) the app's logs are read for a whole fatal_error_broadcasted line stamped after the end. On one, with no request through magpie since or in flight and no Codex turn opened since, the app is quit and opened once. Otherwise it is left as it is and logged. Where it can't be reopened (Linux, an app that didn't quit) the Agents row says "The Codex app hit an error · quit it and open it again" (appSnag) until the app-servers seen then are gone or the app is closed. Unreadable logs reopen nothing. - agent/codex_app_crash.go: the logs as the app's file logger writes them (macOS ~/Library/Logs/com.openai.codex, Windows %LOCALAPPDATA%\Codex\Logs and the Store package's LocalCache, Linux $XDG_STATE_HOME/codex/logs; YYYY/MM/DD folders, tail-read, half lines dropped). The relaunch is the Agents row's: on macOS ChatGPT.app found by its bundle id, quit as ⌘Q does and opened once it has ended, never forced; on Windows codexAppReopen. - GUI line in en, zh, zh-TW, ja, de; docs/subsystems/agent-wiring.md. Run on mote (macOS) at this head on origin/main |
||
|
|
099d2b4612 |
agents: Codex back on ChatGPT after the reset says to restart its app, with a Restart
A bug report by mail (11-04): after the ChatGPT allowance reset, Codex was back on its account, but the Codex app still showed no account and no usage. The app's app-server was the one it started while magpie served Codex, and the app reads account/read only as that starts. With "Restart the Codex app when magpie switches its account back" off (the default, #4550), codexAppStep leaves it running, and nothing said so; the takeover's hover even said "It all comes back on its own at the reset". On Windows StaleCopies lists only the daemon, so no hint showed there either. - provider: codexAppStep remembers the app-servers it left running when magpie gave Codex its account back (c.out && !out, not magpie's own account switch, which codexAppLeft already says). CodexAppBack() is true till they are gone (rechecked every 30s; a failed listing keeps it), a route change clears it, and RestartSwitchedCodexApp clears it. - gui: /api/state's Codex row carries appBack (not for a WSL Codex). The Agents row says "Back on ChatGPT · restart the Codex app to see its account" with a Restart, and the row opened says why, with the same Restart; it posts codex/daemon/restart-app, as the Providers page's "still signed in as" Restart does. The takeover text now says the account and usage come back once the app-server restarts, and that this row offers it. - i18n: zh, zh-TW, ja, de for every new and changed string. Run (on mote unless named; rebased on origin/main |
||
|
|
083821dc96 |
plugins: a search entry can use the plugin's own sign-in, with its own rests
Asked for by axelburks on Discord. A plugin's search hook entry can name
a provider its own auth hook signs in to, `auth: "<provider id>"`. It then
takes no key. The host picks an account, renews it under `fresh` (the wait
counts within the search's time), runs the hook in `inScope`, and gives it
`ctx.getAuth()`, which returns that account's sign-in. A token the hook saves
with client.auth.set goes to the same account.
The gateway (askSearchSignedIn) asks one account at a time. It takes the
accounts that are on, in the order the provider's model requests take them
(accountsOn, now shared with fallback.go), and puts an account resting from
a search refusal last. A refusal rests only that account's search
(restSearchKey "account <key>"), never its models' rest (restingUntil). Every
attempt gets its own request-log row. An entry without `auth`, or naming a
provider the plugin doesn't sign in to, is a keyed entry as before, with no
getAuth. In Settings → Search, a bound entry shows "Signs in with {name}" in
place of the key field, and the row says whether it is signed in and how
many accounts are on (every language).
Docs: reference.md (with an example), plugin-runtime, plugin-tools and
provider-plugins.
Run on mote at
|
||
|
|
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
|
||
|
|
90bf96a23d |
search: a plugin can give a web search API (its search hook)
treeman on Discord #help asked for web search to be pluggable so users can
add search vendors. A plugin's `search` hook, {search: {<id>: {name, keysURL?,
keyOptional?, url?, execute({query, count, key, url}, ctx)}}}, adds an API to
Settings > Models > Web search as `<plugin>:<id>`. It is added, keyed, ordered,
switched off and removed like Tavily or Brave. The built-in APIs stay built in.
How: host.js collects the hook's entries (id [a-z0-9-], an execute) into
Loaded.Searches and runs one with the `search` op (timeout from ctx, an error
with a numeric status comes back as a refusal). The host notes them in
plugin-searches.json (internal/plugin/search.go); provider.AllSearchVendors
adds the noted ones of plugins that are on to SearchVendors, so Ready, check,
the CLI and the GUI list see them. askSearchAPI hands a plugin vendor to
askPluginSearch below askSearchAPIKeys, so keys, rest on 401/402/403/429,
order, the masked query and the request-log row are the built-ins' own.
Run (mote, on this tree, whose base
|
||
|
|
6673171595 |
update: the app and magpie web follow each other's update (visamzh on X)
visamzh on X: with the desktop app and magpie web both open, an update
from either side left the other still offering it ("↑ 更新") until it was
quit by hand.
Cause: the app and magpie web are two processes over one program, each
with its own updater (state, download, latest) in memory. One restarting
to update puts the new binary in; the other is told nothing. Its
replaced() (the binary on disk is no longer the one it started from) was
read only on a click of its own Update or on magpie update's gateway ask
(restartBeside), which reaches only the process serving the gateway. And
a browser's page reloaded (backAsNew) only after a restart it asked for
itself, so magpie web's tab kept the old page and its pill even once
the process under it was new.
Fix:
- followReplaced (update_beside.go): every updater stats its binary each
5 s and, once another magpie replaced it, restarts into it through
restartBeside, once: at once when idle, else after the gateway's
requests (waitIdle), as for magpie update's ask. Not for what this
process put in itself (installed, set by install, cleared by
wontStart), not twice (followed), not for a build that isn't a release
(make dev, go build rebuild in place). It stops with backendCtx, so a
copy left draining after a handover doesn't look.
- waitFor (update_wait.go): a wait for the gateway restarts into what
another magpie put in whatever the feed says now; before, a feed out
of reach or a "latest" answer ended the wait with nothing restarted.
- boot.js names the version that served the page (bootPrefs.version);
app.js's servedAnew reloads a browser's page (web) when /api/update's
current names another, on the reads it already made (load, focus, back
into view) and once a minute while shown. The app's own windows come
back with their new process and are left alone.
- docs/subsystems/gui-shell.md describes it.
Run (mote, through mote-run, at
|
||
|
|
6c201095d8 |
gateway: in Docker, other containers on the host are shown the host's Docker bridge address
jiezhengj (Discord #feedback) runs magpie in Docker on a NAS at 192.168.31.218. The web UI's host address, http://192.168.31.218:3425, works for other devices. Other containers on the NAS couldn't use it, and not the container's own 172.17.0.x either. What works for them is the host's Docker bridge address, http://172.17.0.1:3425. On Linux, host.docker.internal is there only in a container given extra_hosts. magpie showed no such address. - gateway.ContainerHostURL: in a container on a bridge network, the gateway of /proc/net/route's default route (172.17.0.1 on the default bridge, a compose network's own otherwise), on the gateway's port. It is "" outside a container and on the host's network (`network_mode: host`, told by the host's docker0/br-*/veth*/podman* interfaces). In that case ContainerAddrs is false too, since the addresses are the host's own. - The GUI gets it as /api/providers' gateway.containerHost, /api/settings' lanContainerHost and boot's sideGateway.containerHost. - settings.js lanShown is fed by the new gwLAN(g) for Gateway, Connect, the sidebar and the key page. Each case lists: - Opened at the host: the host's address first, then the bridge address, labelled "Other containers on this host". - At localhost: the bridge address alone, with that label, and a line that the host's own is MAGPIE_PUBLIC_URL's. - No default route: as before. The container's own 172.17.0.x is no longer offered beside them. The sidebar line and the key page prefer an address other machines reach. The scheme comes from the URL, not a hard-coded http. Three new strings are in zh, zh-TW, ja and de. - CLI: `magpie web` and the share banner print "other containers on this host <url>". - docs/reference.md and site docs/docker (en, zh, ja): the log example and a new "Other containers on the same host" paragraph. Run on mote, at this change on |
||
|
|
d10f377657 |
providers: Names & levels is Names, prices & levels, where a model's own price at one provider is set (ferock4669)
ferock4669 asked on Discord whether magpie has a screen to price each model, since one model can cost differently on each provider. It has: each row in a provider's per-model list has a price box (input, output, cache read, cache write, 1h cache write, long-context tier, $ / 1M tokens), saved in settings' ModelPrices under pid/model. It wins over the list price in Usage (usage.Pricer through provider.BasePriceIn) and in a key's spend cap (usage.KeySpent through NewCoster). Nothing has to be built; the button opening it said only "Names & levels", so nobody finds a price there. What changed: - The button, its panel's heading and fold, and every note that sends the user there say "Names, prices & levels" (zh 名称、价格与推理档位, zh-TW 名稱、價格與推理檔位, ja 名前・価格・推論レベル, de "Namen, Preise & Stufen"); the gateway's vision and compaction notes, the provider package's text, the subsystem pages and the site's start docs (en, zh, ja) follow. - The button's tooltip says it sets what each model costs at this provider; Usage's "estimated" tooltip says where a provider's own price is set and that it counts over the list price. Both in en, zh, zh-TW, ja and de. - Not changed: the Codex model description text in internal/codexcat (it goes to Codex, so a vendor sees it) and core_budget_test's history comment. - app.js: a comment above the price box is shortened so the core script stays under its budget, not raised (app.js 116 bytes under origin/main). Run at the pushed head (rebased on origin/main |
||
|
|
01de489de1 |
search: a ChatGPT account searches for another model by the backend's own search (lucy_85908)
A third-party model in Codex (DeepSeek, MiniMax, ...) had its web searches made by asking gpt-6-luna on the Codex account to search through /responses. A ChatGPT account now searches by the ChatGPT backend's /alpha/search, the request Codex's web.run sends by itself with no model turn (codex-rs ext/web-search): one search_query, the account's small model in "model", allowed_callers ["direct"], and external_web_access from the client's web_search tool (#5018: Codex's "cached" sends false; live by default). The output's pages are read by their 80-dash rule and ref_id; the private-use citation marks are dropped. Measured on a real Plus account (2026-11-03, token not refreshed): 151 alpha/search calls left the 5h window at the same percent, ~1.5-2.2s each; 51 searches by gpt-6-luna took 0% -> 1% of it, 7-15s each, ~9-17k tokens in (40 of them: 414,585 in, 10,313 out). The backend answered the same for any "model" (deepseek-v4 too) and any max_output_tokens. - Automatic (and searchInTurn) picks the backend's search for a ChatGPT account; Settings > Web search offers "<id>/@search" as "its web search". "<id>" and "<id>/<model>" saved before still search by that model, so a user's pick is unchanged. - When the backend's search fails, the account's small model searches (codexSearchBy). - Codex web.run's own search for a non-ChatGPT model (alphaSearchHere) and a Responses request's web_search tool pass their mode on. Run at this head (rebased on origin/main), on mote: - go test ./internal/gateway/... ./internal/gui/ ./internal/agent/ -timeout 45m: gateway and agent ok; gui red only on TestMainWindowCorners/macOS_26_SDK (#3949, macOS 27 on mote). After the rebase: the gateway's search tests again ok. - searcher-pick.test.cjs: 22/22, chromium + webkit, en/zh (+ the label is in zh, zh-TW, ja, de). - gofmt -l clean; GOOS=linux go vet gateway, provider; GOOS=windows go vet gateway, gui. - Whole GUI suite on the Linux box (wsl-run): not finished when pushed; its reds so far are WebKit pages this doesn't touch (add-provider, API key palette, Routing headers, click-scroll, Codex resets). Broken by hand, each red: the Automatic switch (TestCodexSearchesWith ItsCheapModel, TestChatGPTAccountSearchesByItsWebSearch), the responses.go mode (TestResponsesWebSearchModeKept), the body's mode, the fallback, and the picker option (searcher-pick). Not tried: a real search through magpie in a sandbox (the request shape was tried by hand against the backend); an account out of its allowance (does alpha/search still answer?); the model fallback still searches live when Codex asked cached. Suggested by lucy_85908 on Discord. |
||
|
|
1d8658abca |
routing: a group's model picker offers the providers' image models, and a group of them draws (jzw690 on X)
jzw690 on X: the Routing page's group editor ("Add a model") listed no
image models, so a group of image models, to draw at
/v1/images/generations and to pick in Settings > Images, couldn't be
made.
What changed:
- /api/groups gains `drawers`: each provider's image models
(gateway.Drawers, less ones unticked in its editor unless a group
names them), apart from the chat `models`. The picker offers them
after the chat models, noted "<provider> · Image model" (an existing,
translated key); a member row says so and offers no reasoning level.
Decision-model groups don't offer them. Image models stay out of the
chat catalog, so agents are not offered them.
- An image member drew only when its provider had no picks: picks are
of chat models, so membersFound dropped it as unpicked, and GroupDraws,
resolveDrawing, the group's turns and DrawerMissing all failed.
provider.FindDrawingGroup keeps such a member when drawsModel holds;
the image path uses it (drawingMembers), video keeps FindGroup.
DrawerMissing for a group ref asks GroupDraws.
- Routing card: such a member reads ready (groupsState), and Settings >
Images lists every group that draws, not only those reached through
Served.
- docs/subsystems/gateway-routing.md says so.
Tests:
- TestImageGroupOfUnpickedImageModelsDraws (gateway), from the
reporter's case: two key providers whose live lists hold gpt-5.5 and
gpt-image-2, one with gpt-5.5 picked. group/<id> draws at
/v1/images/generations (the first member's 502 moves on to the next),
as the Settings pick a request naming no model draws, and the model
gone from the list makes it missing.
- TestGroupEditorOffersImageModels (gui): drawers listed, an unticked
one not offered unless a group names it, none among chat models, the
group's members ready, Settings offers the group.
- group-pick-drawers.test.cjs: the picker offers it with its note, adds
it, no reasoning button, Save posts it; en and zh, Chromium and
WebKit.
Broken by hand: drawingMembers passing nil instead of drawsModel made
the gateway test red ("group/pix-images doesn't draw"); turning off the
groups.go drawer branch made the gui test red ("group not ready").
Run at
|
||
|
|
443e53d6b2 |
search: an AI Studio key that searches by googleSearch searches for other providers' models
cocoasoda on Discord: a Gemini AI Studio key provider searches natively
(googleSearch grounding, geminiKeySearches), but it never showed in the
search-for-other-providers (代搜索) list. searchRank knew only a Google
sign-in (googleAccount) at rank 5, so namedSearcherRank gave such a key
-1 and Searchers() left it out; autoSearcher never chose it.
searchRank now gives geminiKeySearches(p) rank 5 too: a saved key
provider, not a plugin, not Vertex, whose Gemini searches itself. That is
the same rank and the same googleSearch route as a Google sign-in, and
Searchers() marks it Own (it searches by its own tool, not a relay or a
search key).
Run on mote (macOS 27), at the rebased head e76db5515's tree:
- go test -count=1 ./internal/gateway -run
'AIStudio|GeminiKey|Searcher|WebSearch': ok; ./internal/gui -run
'Budget|Script|Search': ok; gofmt -l: clean.
- GUI: searcher-pick, searcher-then, search-instead, search-order,
provider-search (chromium + webkit): 84/84.
- Before the rebase, at
|
||
|
|
eb779ce92a |
gui: the tray icon's tooltip is in magpie's language (yi_time)
yi_time in #feedback: magpie set to Chinese on Windows, and the tray
icon's hover tooltip said "Today: 121K tokens (2.9K in · 180 out ·
118K cached)" and "3 requests" in English. The tray menu already
followed magpie's language (trayLang, #301); the tooltip's words were
hard-coded English in trayusage.go.
Now every tooltip is in trayLang(settings.Lang, systemLang), on
Windows, macOS and Linux alike. That covers trayIdleTip, magpie's
totals (trayTotalCard), and each subscription card (trayCardText: its
use or what is left, the pace, when it resets, until's d/h/m, "as of
…"). The words are in trayWords beside the menu's, for zh, zh-TW, ja
and de; English stays the key and the fallback. A window's name and an
error are still the card's own. A change of language in Settings now
also refreshes the tooltip (onTrayUsage); before, only the menu was
relabelled. The test-only trayUsageText and trayUsageView stay in
English, so the existing tests keep their strings.
Test: TestTrayTooltipFollowsMagpiesLanguage.
- yi_time's own numbers in zh: "magpie\n今天:121K token(输入 2.9K ·
输出 180 · 缓存 118K)\n3 个请求".
- The same numbers in en are unchanged.
- Covers the total card and a card's used, left, reset and as-of.
- For zh, zh-TW, ja and de, no English word in the idle, totals, card
(with pace) or combined tooltips.
Run at this head (rebased on
|
||
|
|
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
|
||
|
|
ed978e560f |
gui: the Quit question's Don't ask again, and Settings › General › Ask before quitting (zhujiu on Discord)
zhujiu (Discord #feedback) asked for a 不再提示 on the question a tray Quit asks while agents go through magpie ( |
||
|
|
1cb4d43013 |
profiles: a saved profile renames, in its details, the TUI and magpie rename (#2721, erlinerd)
erlinerd's patch on #2721 (profile.Rename, /api/state profile/rename, a Rename button in the details), reviewed against main and adapted: - profile.Rename trims both names, refuses an empty, taken or missing name and leaves profiles.json as it was, renames by case only (home -> Home), and keeps what the profile holds. - GUI: Rename turns the details' name into a field. Enter renames through profileAction, so the chip is renamed at once, pending, and rolled back with the error if magpie refuses; the details stay open under the new name, with In use kept. Escape or a click away puts the name back. The field lives in profilerename.js, imported on press, so the core script stays under its budget (no raise; 50 bytes under after comments in app.js were cut). While the field is open In use, Apply and Rename hide so a 360px panel's field has room. - TUI: ctrl+e on a profile renames it on the name line. - CLI: `magpie rename <old> <new>`; a flag is never taken for a name. - WebDAV: a rename syncs as the old name gone and the new one in (davsync test). Run on mote at 47672f11c (on |
||
|
|
4dfdd0cd63 |
provider: a provider switched off is asked for nothing, its plugin's model list included
ChangQiu on Discord switched a provider off long ago, and magpie still reached it. Routing, fallback, usage and balance reads, warmups, check-ins and keepalive were already held back (On(), leftAlone, KeepListsFresh). These were not: - The plugin host's providers listing ran every plugin's models hook, which asks the vendor, and its sign-in renewal (fresh), for every plugin provider, on or off. Go now passes the ids switched off (plugin.ListingOff, provider.pluginsOff: the provider's id and the plugin's own id, read from providers.json alone). host.js lists such an id without running a hook (info(..., quiet)), so its row stays and keepListed keeps the last list. - Sync (POST /api/sync, `magpie sync`) fetched every ready provider's list. Both now go through provider.RefreshLists, which skips one switched off. - Saving or switching on in the GUI fetched the list even for one left off; PrefillNewKeys asked one switched off too. What still asks one switched off, by the user's own click: the TUI's refetch, the provider Test button and `magpie provider models <id>` refetch. Tests: TestOffPluginProviderAskedNoModels (the fake plugin's models endpoint counts its hits: 0 while off, the list kept, asked again once switched on), TestPrefillAsksNoProviderSwitchedOff, TestPluginsOffNamesThePluginsOwnIDs and TestRefreshListsAsksNoProviderSwitchedOff. Run on mote at this head (first at |
||
|
|
da275848b6 |
tray: Windows shows a card's number in its icon (Benjaminliang_1 on X)
Windows' notification area shows no text beside an icon, so with a card in the tray the icon itself is now the first card's figure: the first row of the first card whose first row is a percentage, used or left as Allowance display has it, its digits alone (trayIconFigure). It is drawn in Segoe UI Semibold (Go's bold if the font can't be read) at SM_CXSMICON, white on a dark taskbar, near black on a light one, as tall as fits, centred by its ink, three digits narrowed into the square (trayNumberIcon). It is drawn again when the figure, the icon size or the taskbar theme changes (SystemThemeChanged wakes the loop); the tooltip still lists every card. A balance or magpie's totals are skipped; with no such card, or no cards at all, the icon is the bird as before. Settings > Usage > Tray icon number (settings.TrayNoNumber, Windows only, on by default, kept per computer) keeps the bird when off; Menu bar windows is now shown on Windows too, since it picks the row the number comes from. The number row sits after Menu bar cost, so the bird > pace > cost order the other tests pin holds. Linux and the Mac are unchanged. New words in zh, zh-TW, ja and de. app.js stays in the core budget with one comment shortened, no raise. Run at this commit on origin/main |
||
|
|
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 |
||
|
|
8826a15ea4 |
gui: a Quit while agents go through magpie asks first, naming them (Aisiverto on X)
Aisiverto on X (Windows, v0.1.2519) wired Codex to magpie and quit magpie. Codex then retried "unexpected status 502 Bad Gateway ... url: http://127.0.0.1:3425/backend-api/codex/responses" five times and gave up, and it took a long search to find magpie's openai_base_url in config.toml. A Quit the user chooses (the tray's Quit, the panel's and window's Quit, Command-Q on the Mac) now asks first when this process serves the gateway and agents are wired to it. The window comes up on a sheet (quitask.js, lazy-loaded) that names each agent cut off, says closing the window keeps magpie running (menu bar on a Mac, system tray elsewhere), and offers Quit (focused), Disconnect and quit, and Cancel. Disconnect and quit puts each agent back as its row's Disconnect does, then quits; a disconnect that fails keeps magpie open, named in the status line. A second Quit within a minute of the question quits, so a window that can't show it traps nobody. With nothing wired, or another magpie serving the gateway, Quit quits at once. Not asked: a restart to update, Uninstall, a browser's page (magpie web), logging out or shutting down, and the Dock's Quit (AppKit terminate:). Found while checking the report: - Closing the window on Windows hides it; magpie stays in the tray and the gateway keeps serving (tried for real, below). Not a bug. - Autostart is off by default on Windows. - The proxy / NO_PROXY in the report isn't magpie's to fix: the 502 is magpie's port with nothing behind it. Strings in en, zh, zh-TW, ja and de (existing terms: Agent, 退出). No native dialog, no <select>. TestCoreScriptBudget met without a raise: app.js gains two lines, the sheet is outside the core, and driftFix's comment block is cut to six lines (453 bytes back; main's core had grown to 258 bytes over with these lines in). Run, at this head (on origin/main |
||
|
|
5dfbca6274 |
cli: magpie settings list|get|set|reset, through the window's own save (#4745)
Stage 1 of #4745 (StringKe): every setting POST /api/settings saves can be read and set from the terminal. - internal/settingsapi holds the save the handler made: Merge (the carry of keys a page leaves out, moved verbatim from api.go, plus upstream's RouterNote line), the vision/imageGen/searcher checks, settings.Save's own checks, catalog.Touched. POST /api/settings and `magpie settings` both call settingsapi.Apply, so a value is checked and saved one way. It sits outside internal/gui so the nogui build has it. - `magpie settings` (list, the default, with value, default and choices; get; set; reset to settings.Defaults()), --json on list and get. Body sends the whole file with one key changed, so a key the save keeps when absent (noBird, refusalRetries, ...) is set even to off. A flag where a key or value goes, an unknown key (with near matches named) or a refused value writes nothing and exits 1; --help prints usage. - Parity guards: TestKeysAreWhatTheSaveWrites (each Settings field sent changed on its own; what the save takes must equal Keys), TestSettingsCLISetsWhatTheWindowSaves (every key the page's prefsKeep and savePrefs send is a key), TestEveryRouteHasACommandOrIsNamed (each /api route has a command or a reason in notYet, which later stages shrink; 36 have one now). - Item 3 of the stage (per-provider CLI-only fields in the window) is left for stage 2. - The open app's in-process follow-ups (fonts, Dock, tray menu, alerts, language, update re-check) run only from the window's save: #4752. Run (mote, at the pushed head |
||
|
|
344a59f9db |
gui: an unchanged Sessions poll answers Same without making the rows
The Sessions tab asks for every session each 15 s. When nothing had changed, the handler still copied the kept listing, made a row of each session, merged the gateway's sessions, read Codex's effort and the vias, encoded every row and hashed them, only to answer X-Magpie-Same. Over ~17k real sessions (69 GB of Claude Code and Codex history) that was ~140 ms of CPU and ~24 MB of garbage per poll. Now the handler keeps, per ?limit, what the last list it sent was made from: the sessions listing (sessions.ListUnless's number, which changes whenever the listing is made again, and at least once a minute), the usage log's version (usage.LogVersion), the user's usage aliases, and the agents' names and icons with the folders. An ask whose X-Magpie-Had is that list's tag, while all of these stand, gets X-Magpie-Same before any row is made or the listing copied. Anything else a row shows (a Codex thread's effort, a gateway title) follows within the minute the kept listing stands. writeJSONRows returns the tag it sent. Measured on the real history (a sandbox HOME with APFS clones of ~/.claude/projects and ~/.codex/sessions, 17,140 files), 30 polls of /api/sessions + stats + overview, the same script for both builds: before ( |
||
|
|
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 |
||
|
|
0516c18ca3 |
gui: writeJSONRows hands the encoder each row by pointer
Every Sessions poll encodes all ~17k rows for their hashes, even when
the page already has the answer. enc.Encode(rows[i]) boxed each row
into an any, a copy allocated per row per poll. &rows[i] encodes the
same bytes (no type in sessionJSON has a pointer-receiver marshaler)
without the copy.
TestJSONRowsNotCopiedEach: a 2000-row poll the page already has makes
at most 200 allocations. Broken by hand (back to rows[i]): red, "made
2022 allocations". TestWriteJSONRowsWritesWhatMarshalDid still checks
the bytes against json.Marshal per row.
Measured on mote's build against the real ~17k sessions (sandbox HOME,
APFS clones), 30 polls, heap diff alloc_space:
writeJSONRows 201 MB -> 98 MB
whole poll 854 MB -> 726 MB
CPU over 30 polls 4.46s -> 4.44s (no change past noise); /api/sessions
median 74ms -> 73ms.
Run on mote: go test -run JSONRows ./internal/gui ok.
Not run: the full suite (one-line change in writeJSONRows, its tests
run).
Then rebased onto
|
||
|
|
8d8df06399 |
plugin, gateway: a plugin reports its models' load, and busy models can go last (axelburks on Discord)
axelburks (Discord #feedback): an in-house vendor queues requests to
its busy models, and the plugin could only put the load in the model's
name, which changed only when magpie re-read the list.
- A provider plugin calls input.magpie.load(provider, {"<model id>":
0-100 | null}) whenever it likes, from its own timer. host.js
(reportLoad) clamps each number to 0-100, null clears a model, every
other value is dropped, at most 1000 a call, and it returns the count
taken. A provider that isn't a string or loads that isn't an object
throws a TypeError. It goes to Go as an unasked {event:"load"}.
- internal/plugin/load.go keeps each by provider and lowercased model
id. ModelLoad answers unknown once a load is older than LoadFresh
(5 minutes), never idle. model@size falls back to its model.
- The provider editor shows it by the model as a grey ctx badge
("87%", titled "87% busy now, as its plugin says").
- Settings > Network and sharing > Busy models last (settings.BusyLoad,
POST /api/settings/busy-load, Off by default, over 50/70/80/90% or
1-99 by hand): restLast puts a model reported over it behind the
ready candidates, ahead of the resting. The trace row has busy:<load>.
At a new turn affine moves a conversation off it (Why "busy",
busyBehind); within a turn it stays. after, readyForNew and leastHeld
skip it. Unknown load, a lone candidate, or all busy: nothing moves.
- Docs: site plugins page (en, zh, ja) "Model load" section and input
table; docs/subsystems provider-plugins.md and gateway-routing.md.
Run, all on mote via mote-run at a42736807's tree rebased on
origin/main
|
||
|
|
90c02326bb |
gui: an app takes the gateway over from its older copy once idle, and says any other version serving it (matrix0487)
matrix0487 on Discord: after an update, pi said 404 'magpie knows no model "kimi/k3.1-pro" ... add a provider in magpie first'. The app had written pi a model its older gateway didn't know, and updating the gateway fixed it. A magpie that finds another one serving the gateway used to log it and wait for that one to quit (watchGateway took the port only once nothing answered). Only the Gateway page said so. Now (otherServes, gateway_older.go): - An older released copy of the app (it says serves app or tray, and a pid) is this app's predecessor. Once its /v1/magpie/concurrency says nothing is in flight (gateway.ServedBusy; unknown is never idle), the app quits it the way the Gateway page's button does (quitMagpieOnPort: a magpie only, by its program) and serves the gateway. A stream through it runs to its end first. watchGateway looks again every 15s while another serves. At most three times a run; a quit that fails is left to the button. - Any other one (magpie serve or the service, magpie web, a TUI, a newer magpie, a build of its own) is left running. /api/state carries it as gatewayOther, and the Agents page says it above the list with what to do, plus the take-over button for an older one (gatewaySkewLine, in plugins/gateway/client.js so app.js stays under its budget). A dev build of this magpie says nothing. New strings in zh, zh-TW, ja and de. How the reporter's older gateway outlived the update isn't known: they never said whether one ran separately. A failed handover leaves the old app serving for up to 15m, and a magpie serve left running is another source. Both are covered now: the first is replaced, and the second is said. Known gap: a request that starts between the idle read and the quit gets the older app's short drain. A socket handover between two running apps (no gap) is not built. Run on mote at 0f8ea30bb (this change on |
||
|
|
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, |
||
|
|
d307aa6485 |
gui: /api/state is written one agent at a time, for the page and the kept sum at once
Each poll of the Agents page encoded the whole state (1.3 MB with real accounts) into json's buffer, and the GC between polls empties the pool that buffer comes from, so it grew to the state's size again each poll: 48 MB of what twenty rounds allocated (v0.1.2477 build, real-account sandbox), and 68 MB at v0.1.2463. writeStateJSON encodes the state without its agents twice (as sent, and as keepState keeps it, without the settings), and each agent once, straight to the response and to keepState's sha256, through one encoder. keepState is split so the handler hands it that sum (keepStateSummed). When the splice can't be made (no agents, or a field put before "agents"), it writes and sums the state whole, as before. Measured on this Mac with the real-account sandbox (abr.sh, 20 rounds of drift + state + providers): - v0.1.2477: writeJSON under /api/state 48 MB, 511 MB in all. - this change: writeStateJSON 15 MB, 477 MB in all. The /api/state bytes are identical to v0.1.2477's (cmp). Run on mote (mote-run, Go 1.26.8): - gofmt clean; go vet ok, also GOOS=windows. - TestStateWrittenAsEncoded (same bytes as Encode, same sum as keepState, for a large state, an empty agent list and none) and TestStateWriteGrowsNoBufferItsSize, with TestKeptState* and TestLast*: ok 3 of 3. - Broken by hand (the whole-state path always taken): red, "writing a 1614586-byte state allocated 4207139 bytes, want under half its size". - Not run before this push: the full internal/gui package; it runs next. |
||
|
|
d9845432f7 |
gui: a same-tagged answer is written twice, never held whole (#2278)
writeSame wrote each answer into a buffer to hash and send it, and kept
two such buffers between polls (answerLinger). The Sessions tab's stats
answers are ~6 MB each over a full history, so 12.5 MB of a warm start's
169 MB live heap was those buffers (heap profile, bytes.growSlice under
statsAnswer). Now write is given an io.Writer and called twice: once into
the hash for the tag, and once straight to rw (32 KB bufio) when the page
hasn't got that answer. statsAnswer encodes a part at a time into a small
buffer. The stats route still answers "same" from its kept tag without
encoding at all when nothing changed, so the second encode costs only on
a changed answer. answerBuffers, answerBuffer, keepAnswer go.
Run on mote (M5 Pro), from this tree:
- go vet ./internal/gui ok; gofmt -l clean.
- go test -count=1 ./internal/gui: FAIL only TestSettingsSaveKeepsWhatItDoesNotSend
(#4514) and TestMainWindowCorners/macOS_26_SDK (#3949), both filed, both
untouched by this change. TestStatsAnswerWritesWhatEncodeDid (bytes are
the whole Encoder's) and the new TestSameAnswerNotHeldWhole pass.
- Broken by hand: writeSame's bufio sized 64 MB, TestSameAnswerNotHeldWhole
red ("allocated 67117776 bytes for a 4194304-byte answer").
- Warm start on a copy of the owner's real history (11,925 Codex .zst,
4,696 Claude .jsonl, 5,000 listed sessions), the page's 10 reads every
5s, interleaved, load ~25-34:
before (
|
||
|
|
bb5eb83c3e |
gui: the Sessions list goes out a row at a time, never held whole (#2278)
writeJSONRows built the whole answer in a buffer to hash it and send it.
Over the owner's full history (16,600 sessions, 5.8 MB list) that buffer
grew to 25 MB, was kept between polls, and was 25 MB of a warm start's
183 MB live heap. Now a first pass encodes each row into one small
buffer for its hash and the answer's tag. What is sent is encoded again,
straight to the ResponseWriter through a 32 KiB bufio.Writer, and a delta
holds only the rows the page hasn't got. The bytes and the tag are the
same as before, so the page's delta and "same" answers don't change.
Run on mote (macOS 27), real history copy (~16,600 session files):
- warm start, 75 s of poll.sh (what an open window asks every 5 s):
- before (v0.1.2382): steady footprint 240-265 MB, live heap 183-193 MB;
- after: steady footprint 216-233 MB, live heap 168-178 MB.
- The phys_footprint peak is about the same (257-267 vs 264-289 MB over
3 interleaved pairs): a poll's own spike still sets it.
- /api/sessions from each binary on the same history: the same tag
06a661d3…, the same sha256 of 5,842,606 bytes, X-Magpie-Same on its
tag, and the full list for an unknown tag.
- TestJSONRowsNotHeldWhole is new: red on the old writeJSONRows (9.5 MB
allocated for a 4.2 MB answer), green now. TestWriteJSONRowsWritesWhatMarshalDid
(bytes and delta) is green.
- go test ./internal/gui: ok except three reds that are already filed.
TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and TestMainWindowCorners
(#3949) are red the same way with the old api.go in the same copy.
TestColdTurnsTaken (#4510) was red in the full run and passed 3 of 3
alone.
Not run: the GUI (Playwright) suite. app.js isn't touched and the
answer's bytes are the same.
|
||
|
|
a7b47d57ec |
accounts: removing the account Claude Code is signed in to switches it to another first (#4532)
StringKe (#4532): removing the signed-in Claude account was refused with SignedInError, while Codex's switched away first. ForgetLogin now does the same for Claude Code: nextOnForget picks another account (on first, then one whose sign-in holds), SwitchLogin signs Claude Code in to it, and only then is this one forgotten. If that switch fails, nothing is removed and the error says why. nextOnForget leaves out accounts Claude Code or Codex can't be signed in to (switchable: not a setup-token account, not a Codex account held in another folder). Claude Code is never signed out: when the account is the only one it can be signed in to, it is kept, with SignedInError{Only} (GUI code signed_in_only), which says to add another account first or sign out in Claude Code. The GUI gives the signed-in Claude row a Remove when another account it can use exists, and no Remove or Sign out otherwise. Claude Code's own credential is never deleted; forgetClaudeDir removes only the forgotten account's own folder and its folder's Keychain item, and claudeHolders' check of other records holding the same token is unchanged. Tests: TestForgetLiveClaudeSwitchesFirst, TestForgetOnlyClaudeIsKept (replacing TestClaudeInUseStillRefused, which held the old refusal); codex-signout.test.cjs gets three Claude cases (Remove with another; only + setup-token: no Remove, reason in zh/zh-TW/ja/de; the signed_in_only refusal in en/zh). Run (mote, sandbox HOME through the test helpers): - go test ./internal/provider ./internal/cli, vet and gofmt at the stack head: in the next commit's body (one tree, same run). - Broken by hand, each red: Claude not switched first (TestForgetLiveClaudeSwitchesFirst), Only left false, a setup-token account counted as another, nextOnForget unfiltered (TestForgetOnlyClaudeIsKept). - GUI on Linux (WSL magpie-desktop), Chromium and WebKit: codex-signout, own-signin-remove, saved-signedout-remove, login-import, claude-signin, account-alias and i18n-keys all pass but i18n-keys' "a plugin's words are its own", red on main (#4524). On mote, codex-signout passed in Chromium; its WebKit launches were killed with mote at load ~25 under other sessions' suites (#4125), so WebKit's record is Linux's. CLI in a sandbox HOME (WSL, file credentials): forget of the signed-in account by its name switched Claude Code to the other (.claude.json then says max@x.com); forget of the only one was refused with the message above and left it signed in. Not tried: a real Claude Code switch on removal with real accounts, or in the CLI against a live ~/.claude (sandbox only). |
||
|
|
ceeb73a0f1 |
app: the desktop app writes its log to app.log; magpie log and Settings › About › Log find it
rayem1w on X (0.1.2330, macOS) was asked for ~/Library/Logs/magpie/serve.log while chasing a Codex "hit a snag" through the gateway, and had no such folder. Only the launch agent (magpie daemon install, written by launchd) and a gateway magpie tui left running wrote a log; the app opened from the Finder, the Dock or the Start menu logged to a stderr nobody reads, on every system. Now runGUI and runPanel (magpie, app, tray, panel, a window view, a magpie: link) call applog.Start before gui.Run. It sends the standard logger (the gateway, the plugin host, providers and Wails' error handler all log through it) to app.log as well as stderr, and points debug.SetCrashOutput at it so a panic's trace is there too: macOS ~/Library/Logs/magpie/app.log Windows %LOCALAPPDATA%\magpie\logs\app.log Linux $XDG_STATE_HOME/magpie/app.log, else ~/.local/state/magpie/app.log portable data/logs/app.log app.log, not serve.log: on a Mac launchd writes serve.log for the service, another process. The file is 0600. At 5 MiB it becomes app.old.log (two files at most); when another magpie (an update's new process) rotated it already, it is only opened again; when it can't be moved it is emptied. stderr goes first, through a writer that never fails, since io.MultiWriter stops at a failed writer and an app opened from Explorer has no stderr. Secrets: the log calls name header names and paths without queries; no key or token was found logged (grep of log.Print* in gateway, provider, plugin, gui, agent). scrub masks bearer/basic credentials, key/token query parameters and sk-, AIza, gh?_ and JWT shapes anyway. How a user finds it: Settings › About › Log, with the path, Copy and an Open that shows its folder (POST /api/settings/log/reveal; the row is hidden in magpie web, which writes no file). magpie log prints where every log is (the app's, app.old.log, the service's, the tui's background serve.log); --path the app's alone, -n N its last lines, -f follows it across a rotation. Docs: reference.md, gui-shell.md, site start (FAQ "Where is magpie's log?" and the CLI table) and privacy (files on your computer), en/zh/ja. Run: At 227ce6074 on origin/main |
||
|
|
b09349d179 |
search: magpie can search for a model whose provider searches by itself too
cybercaius on Discord: "能否强制支持联网搜索的供应商模型走代搜 API". Nothing
did this before: a provider that searches by itself (Codex, Copilot and
Grok accounts on Responses, a relay marked Searches, the search hosts) was
always sent the client's web_search, and "provider search off" and
"Search APIs first" only order magpie's own search.
Settings › Models › Web search gets one row, "Models that search by
themselves": their own (as before, the default) or magpie's. On,
settings.SearchAll makes magpieSearches true while magpie can search
(canSearchFor), so searchedForIt and translate treat the model as one that
can't search: the searcher and the search APIs answer, and the provider is
sent no search tool. With nothing magpie can search with the provider keeps
its own, and the row isn't shown. magpie's own searcher request
(searchingKey) is never turned around. The value is set on its own
(POST /api/settings/search-all) and carried by a save of the rest of the
page, so app.js is unchanged and the core budget holds. With provider
search off and this on, the searcher's note says the APIs answer every
model.
Run:
- go test -run Search ./internal/gateway ./internal/settings; ./internal/gui
TestSettingsSearchAllSetOnItsOwn, TestSettingsSearchProviderOff,
TestSettingsPageSave*, TestCoreScriptBudget (on mote): ok.
- TestSearchAllTakesTheSearchFromAProviderThatSearches: on with no search
API, relayed as sent with web_search_20250305; off, native and Tavily not
asked; on, Tavily asked and no native tool sent.
- go vet darwin, linux, windows on gateway and settings, windows on gui; gofmt.
- GUI: search-all (new), search-first, searcher-pick, search-order,
i18n-keys in Chromium (47 pass), en zh zh-TW ja de, 1100 and 560px.
The WebKit run was still going at the push (owner: ship at once); any
red it shows is filed.
Broken by hand: magpieSearches returning false, and without the
canSearchFor guard, the gateway test goes red; without the merge line in
api.go TestSettingsSearchAllSetOnItsOwn goes red ("a save of the page
dropped searchAll"); the old settings.js and i18n fail 15 of 20 GUI cases.
search-first now reaches its row before clicking, since the new row moved
it below the fold.
Not tried: real Codex, Copilot or Grok accounts with it on. Codex sign-in
turns relayed as sent (codexAsSent) and sealed relays keep the native
search; the Routing page's webSearchOf still says native.
|
||
|
|
9345318ff7 |
gui: Codex's Long conversations lines fit the core budget, no raise (zgjfjfl on Discord)
|
||
|
|
5c637f17b2 |
gui: Long conversations says what makes Codex compact before it (zgjfjfl on Discord)
zgjfjfl set Long conversations to "Compact at 544K", and Codex still
compacted every conversation at about 128K. The model is gpt-6-A, with no
context size set on the provider, on v0.1.2281.
Codex 0.165 compacts at min(model_auto_compact_token_limit, 90% of the
window). magpie writes the model's window into the catalog and writes
auto_compact_token_limit only when Long conversations is below that
window. Two things put Codex under 544K, and the row said neither:
- ~/.codex/config.toml's model_context_window or
model_auto_compact_token_limit, at the top or in a profile, which
Codex reads before magpie's catalog. The row now names each key, with
its profile and value, and "Take it out" removes those lines
(agent.CodexCompactHeld, DropCodexCompactHolds,
POST /api/settings/codex-compact-held/drop). Nothing is removed unless
the user clicks.
- The model's own window. gpt-6-A isn't in models.dev, so its window
comes from the provider's own /models list (context_length). A relay
that lists it at 128K makes Codex compact at ~115K, and no Long
conversations value can raise that. The row now names the model Codex
runs (agent.CodexModel, from config.toml's model and the picked
profile) and the window magpie tells Codex, and says a larger one is
set in the provider's Context window (codexWindowUnder).
Which of the two the reporter has is not known: their config.toml and
their relay's list weren't seen.
Run (worktree at origin/main
|
||
|
|
03d21ab8e1 |
gui: a page's read and the warm-up collect at GOGC 10, not 25 (#2278)
tightGCPercent goes from 25 to 10. This is the GOGC that underTightGC (the
warm-up's reads) and every /api/sessions* and /api/usage* answer
(held) run under; it is put back once the last read ends.
Profiled on mote (heap dumps at each 8 MB of live heap, plus a goroutine
dump). After v0.1.2280 the first start's reads already take turns, so the
peak is one build at a time over what the indexes keep. The live peak is
~280 MB, and at GOGC 25 Go let the heap grow ~70 MB past that before a
collection.
Bench: the mote sandbox HOME with the real history (13k sessions, ~720k
gateway calls), MAGPIE_NO_STATS=1, a poll of ten answers every 5 s,
75 s per run, footprint peak (phys_footprint_peak):
- cold start (no caches), 3 runs each:
- v0.1.2280: 397/390/392 MB, 162–168 s user CPU, slowest first answer
29.8–30.6 s
- this change: 352/350/352 MB, 197–200 s user CPU, slowest first answer
31.9–32.4 s
- start with caches, 2 runs each:
- v0.1.2280: 321/304 MB, 7.6 s user CPU
- this change: 271/275 MB, 10.3 s user CPU, mean answer 0.12 → 0.13 s
Tried and dropped:
- 10 only until the warm-up ends: cold 372–374 MB, warm 301–306 MB.
- 10 only inside usage's big builds (a holdBigBuild hook): cold
373–395 MB, warm 304–312 MB. The peaks are not all big builds.
- Warming the heatmap as a fifth warm-up step: cold 395–401 MB, the same.
The goroutine dump shows the page asks already take their turns.
Run on mote, first at
|
||
|
|
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
|
||
|
|
f03ed8c26e |
agents: Open in terminal on a Mac's Agents row (coolmantou)
coolmantou on Discord asked to start an agent from magpie's Agents list.
In the Mac app's window, an agent row's menu (openRowMenu, the one the
grip and a right-click open) now has "Open in terminal". This includes a
row under Not set up. Clicking it posts POST /api/agents/open with only
{agent: id}. The server finds that exact id in agent.Detected() (not
agent.Find's prefix match) and builds the line itself: the agent's
Launch() where it has one (agy, Claude Science, Cursor local), otherwise
its program's path, single-quoted (BinPath, new in internal/agent).
openTerminal then opens that line with the user's Session terminal
choice. The command never comes from the page. Other systems, the web
build, WSL agents and desktop apps with no program are refused, and
their rows have no item (agentJSON.terminal). The tray panel's rows don't
have the item either. The label is "Open in terminal", not "Terminal",
because the user's terminal can be iTerm or Ghostty. The string is in
en, zh, zh-TW, ja and de. Windows and Linux are #4474.
The core budget had 39 bytes left on main, so no budget was raised.
Instead:
- the item says nothing on success; the terminal opening is the answer,
and a failure goes to statusErr;
- the omp roles' comment above OMP_UNSET was cut to what OMP_UNSET's
values don't already say.
app.js is now 22 bytes under main's size.
Run:
- go test ./internal/gui ./internal/agent on mote (macOS) and in
magpie-desktop (Linux, -tags nogui), both ok.
- TestAgentOpenRunsOnlyTheAgent puts claude in a folder named
"it's a' $(touch made1) `touch made2`; touch made3 #". It posts the
ids "claude; touch made4", "claude'$(touch made5)'" and "cl"; none
of them opens anything. It then runs the line made for claude
through /bin/sh and checks that only the program ran.
- After the rebase onto origin/main
|
||
|
|
a45a0f1c5d |
signin: Settings can keep sign-in pages out of the default browser (max2020)
max2020 on Discord signs in from a separate, fingerprint browser so the vendor never sees their default one. Every waiting sign-in already shows its link with Copy link (since |
||
|
|
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 |
||
|
|
7d4a631480 |
tray: pick which of a subscription's windows the menu bar shows (StrikingRaw on X)
Claude Pro's menu bar card drew its 5-hour and 7-day windows as two
small stacked numbers, and the user wanted one of them alone. Settings ›
Usage › Menu bar windows (under Allowances in the menu bar) lists a pill
per ticked subscription with two or more windows ("Claude Code · All
windows"), opening the app's menu: All windows, then each window. The
choice is settings.TrayWindows, by provider id (every account of it, the
in-use "|*" card too) and by window kind from the span ("5h", "1d", "7d",
"month", "15m", "name:<name>" when the span is unknown), so a vendor
reordering windows changes nothing. Unset shows every window as before;
a pick whose windows are all gone shows every window again, never an
empty card. Only the bar's rows and the Linux label are filtered; the
tooltip still says every window. One row draws at mpRowFont's 11pt
single-row size. Hidden on Windows (its tray shows no text). Per
computer through KeepOwn. The GUI learns kinds from trayKind on
/api/usage/quotas (withTrayKinds; model and aside windows get none). The
row's code is a lazily imported traywindows.js, so the core script
budget is not raised (app.js +4 lines for the call and the prefs keep).
Run:
- mote (macOS): go test -run 'TrayWindow|TrayUsage|WithTrayKinds|
CoreScriptBudget|AppScript|TrayImage' ./internal/gui/ ok;
./internal/settings/ ok; davsync TestSync ok. TestTrayImageOneWindow
draws through AppKit: Claude's card one line ("42%"), both windows two;
the PNGs were looked at.
- mote: gofmt -l empty; go vet ./..., GOOS=linux go vet -tags nogui
./..., GOOS=windows go vet ./... ok; go build, GOOS=linux go build
-tags nogui, GOOS=windows go build ok.
- magpie-desktop (Linux VM), --test-concurrency=1, BROWSER=chromium and
webkit: tray-windows (en, zh, zh-TW, ja, de; picking All; hidden on
Windows / single-window / no cards; 360px narrow), i18n-keys,
old-webkit, tray-usages, tray-logos, tray-cost, quota-pace: 43/43 each.
After rebasing on
|
||
|
|
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 |