f2eb56c6bbde1300dddc402861b59cd4e45e0215
282
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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 |
||
|
|
bed604efb3 |
gui: the Sessions list and stats answers are written into buffers kept between polls, the stats a day at a time (#2278)
With the Sessions tab open, every poll grew each long answer's buffer
from nothing: writeJSONRows' `whole` (~8 MB of rows) and writeJSONSame's
buffer plus encoding/json's own encodeState for the stats (~6 MB of
days), which the Encoder grows to the whole value after each
collection. In 90 s of polls while an agent worked, writeJSONRows was
245 MB and the stats' writeJSONSame 209 MB of 2702 MB allocated.
- answerBuffer/keepAnswer keep two buffers, dropped 30 s after the last
answer (as the usage scratch lingers). A ResponseWriter copies what
it is written, and only the rows' sums outlive the call, so nothing
reads a buffer once it is put back.
- writeSame is writeJSONSame over a write func; writeJSONRows and the
stats handler use the kept buffers.
- statsAnswer encodes the stats a Day at a time, byte for byte the
Encoder of struct{ sessions.Stats; Agents } (the page's tag rests on
those bytes).
Bench (mote, ~/r2278/full, hmw.sh: a gateway call every 3 s, 10
endpoints polled every 5 s with X-Magpie-Had; second runs compared),
e13 =
|
||
|
|
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 |
||
|
|
7db0810b03 |
sessions: stats asked again unchanged are not encoded again; lists made at their size (#2278)
The Sessions page asks for /api/sessions/stats (7, 30 and every day) and the list every poll. On a full history (52G Codex + 13G Claude) the stats for every day are ~6 MB of JSON, encoded and hashed again on each ask even when the page already had them, because the read behind every 10s replaced the kept stats with an equal copy. - statsKept has a gen, kept when the read behind finds the same stats (sameStats: From, To, Keys, Days, what is sent). The handler keeps the tag last sent per ?days with its gen and agent names, and an ask with that tag is answered X-Magpie-Same without encoding. Only the 32-char tag is kept, no body. - MergeExternalStats grows Sessions once for every external session; a Clip and then an append a session copied the whole list over and over. - listSessions makes its page and its latest map at their size. Run on mote at this head (rebased on |
||
|
|
c7ae24f0a6 |
gui: the warm-up's usage read sets no memory limit, a cold start stops collecting nonstop (#2278)
The warm-up's QueryPage(All) and Codex effort ran under tightenGC(true): GOGC 25 and a soft memory limit at what Go held when the read began. On a cold start the heap reached that limit all live, and gctrace showed a collection every ~160 ms from ~11 s to ~24 s, heap = live = limit, about one core the whole time. Now the read takes GOGC 25 only, as a page's request already did, and tightenGC lost its limit parameter and heldMemory. Measured on mote (M5 Pro), cold start with no caches, 390k calls in usage.jsonl plus a growing Codex rollout, 10 endpoints polled every 5 s, 60 s each (coldx.sh: footprint each second, gctrace, ps cpu time): - before (v0.1.2111 head): CPU 3:39.33, 1166 GCs, phys_footprint_peak 855 MB - after: CPU 2:05.86 / 2:04.60 / 2:02.78, 618 GCs, peak 860 / 835 / 863 MB The cold start reads no request index, so it builds one from every session, the case the limit was added for; its peak is unchanged. Tests at this head, through mote-run: - go vet -tags nogui ./... for GOOS linux, windows and darwin: ok - go test -timeout 45m ./internal/gui/ ./internal/usage/ ./internal/sessions/: usage, sessions ok; gui only TestMainWindowCorners/macOS_26_SDK, #3949. TestUnderTightGCLimitsMemory became TestUnderTightGCSetsNoMemoryLimit; the old code set a limit below MaxInt64, so it would be red there (not run on the old code: tightenGC's signature changed). |
||
|
|
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 |
||
|
|
5be581a1c3 |
gui: a magpie folder the user can't write gets a one-click Repair (YouWhat)
YouWhat on Discord (macOS): adding a custom provider failed with "mkdir ~/.config/magpie: permission denied". ~/.config wasn't the user's (a command run under sudo makes it root's), so magpie couldn't make its folder. The app still ran because reads of a missing file mean "none", but every save failed. The GUI saves showed the raw error; the background writes (usage, quotas, caches) dropped theirs. Now: - appdir.Blocked() names the folder that keeps magpie from writing its config or cache folder: the folder itself, or the first one above it when it doesn't exist yet. Only folders inside the home folder are named. Unix only; on Windows it is "". - /api/state carries configBlocked. A failed save whose error is a permission refusal comes back with code config_blocked. The window asks once a load, and again over the editor whose save failed. "Not now" returns to that editor as it was left. The tray panel doesn't ask. - Repair (POST /api/config/repair): a folder the user owns gets u+rwx with no prompt. Another user's folder is chowned to the user, through the system's password prompt (update.AsAdmin, the updater's: osascript on a Mac, pkexec on Linux). That chown is not recursive for ~/.config, so the other apps' folders inside it stay as they are; magpie's own folder is chowned -R, since everything in it is magpie's. magpie web shows no prompt; it names the sudo command instead. Data never moves: every reader keeps the one path, so nothing splits. - Words in en, zh, zh-TW, ja and de. - The core-script budget goes up by 1,112 bytes (app.js stays under its own), with no room added. Run (on mote via mote-run, at this tree, based on |
||
|
|
8e5567161e |
settings: an older settings.json with no Dock choice keeps Hide
v0.1.2060 ( |
||
|
|
1407c9a3bb |
gui: the Mac's window is in the Dock and Command-Tab while it is open, by default (ShouguangCao on X)
ShouguangCao on X: on the Mac, with the window (Settings) open, magpie wasn't in Command-Tab, so going back to it to paste an API key copied in another app took the menu bar. Cause: Settings > Show in Dock already had "With window" (#101: Regular activation policy while the main window is up, Accessory once it closes, in openMain/hideMain through inDock and setDock), but the default was Hide, so out of the box magpie stayed Accessory with its window open. The main window is magpie's only window besides the tray panel, so no other window kind needed it. Change: With window is now the default. inDock is `s.Dock || !s.DockNever && shown || fullscreen`; Hide is a choice of its own, settings.DockNever (KeepOwn, like Dock and DockWindow), and the page reads the choice through dockChoice (With window unless Show or Hide was chosen) and saves dockNever with it. DockWindow is still written when chosen, so an older magpie reading the file keeps With window. The tray panel never calls dock(), so it is unchanged; Windows and Linux have no Dock (setDock is a no-op there) and are unchanged. For existing users: Hide was the default and was stored as nothing, so a user who picked Hide before can't be told from one who never chose; both now get With window, and choosing Hide again sticks (dockNever). Run on mote at origin/main |
||
|
|
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
|
||
|
|
96a703a591 |
uninstall: magpie uninstall and Settings › Uninstall magpie put every agent back before magpie's files go
Jevik_AI on X (Windows, portable magpie) deleted magpie's folders by hand. ~/.codex/config.toml kept openai_base_url on 127.0.0.1:3425, and every Codex turn then failed with a 502, with nothing left that knew why. Deleting magpie's files never puts an agent back, so there is now an uninstall that does. - internal/uninstall: Run goes in this order. System removes the background service, opening at login, the Start menu shortcut (shortcut.Remove, with its App Paths key), the magpie:// links and the privacy model's helper. Agents ends Codex's account failover, then runs each connected agent's own Disconnect, or its offline disconnect for an app that is closed. That is the same code as the Agents page, so a value the user changed by hand since Connect stays theirs ( |
||
|
|
1198cff601 |
gui: a model picker's row says how fast its provider answered this week, fastest first under a search
axuhere on X: with several providers serving one model, the list and the model picker should show each one's speed and sort by it. Each row of an agent's model picker now carries a quiet tag from the usage ledger's last seven days: tokens a second, or the first token's wait when only that was timed (title: "first token in Xs, N tokens a second"). Under a search, rows that match equally go fastest first by about how long a 200-token reply takes, the untimed last. Without a search the rows keep catalog order, grouped by provider. "Fastest first" for a routing group already existed as Speed first ( |
||
|
|
d9cf85ae8b |
images: a routing group can be Settings > Images' image model (7up6666 on X)
Settings > Images > Image generation now offers each routing group with a member that draws (gateway.GroupDraws: a member among its provider's Drawers), with no provider of its own, so the picker puts it under Routing groups as the Image recognition picker does. Picked, "group/<id>" is what a request naming no model draws with, the Magpie Image MCP's included: the gateway already drew on a group member by member in its routing's order (drawingGroup, #2005), it was only never offered. A picked group none of whose members draws any more (all removed, or a group of chat models) is DrawerMissing (drawerMissing): the row says the pick is missing and Automatic draws in its place, as for a removed model. Before, a group of chat models would have been sent the drawing. ListedDrawer and DrawerHidden leave a group ref as it is. Run: - mote, at this change on |
||
|
|
ded4935745 |
providers: an image model can be unticked in its provider's editor, and leaves the lists (321sssrt on X)
A provider's editor lists its image models as chips under "Image models"
("图像模型"); a click unticks one, and Save keeps it as the provider's
HiddenDrawers, a deny list beside the Models allow list. An unticked
model leaves Settings > Images' picker, Automatic's choice (and so the
Magpie Image MCP's when nothing is picked), the gateway's /v1/models
image entries and Aside's image options (gateway.OfferedDrawers).
A hidden model still draws when a request names it (resolveDrawing reads
Drawers), and a Settings > Images pick made before it was hidden stays
the pick: it is still listed, as picked, and the row says it is unticked
in its provider and leaves the list once another is picked
(ImageGenHidden), so a pick never stops drawing in silence. A Save that
leaves hiddenDrawers out keeps them; [] clears them. Strings in en, zh,
zh-TW, ja, de. docs/subsystems/gateway-routing.md has the section.
Run, at this and the next commit on
|
||
|
|
1801c96bfb |
warm-up: Warm up now sends one account its warm-up at once (Codex and Claude)
A Windows user on Discord asked for a manual warm-up of a Codex account.
Settings > Warm-up and check-in now ends both the ChatGPT and the Claude
tab with a "Warm up now" row. Its text button sends the account's warm-up
right away. With one account it sends straight off. With several it opens
the app menu ("Warm up which account"), not a select. The row then says
"Warmed up {who} {when}", or "Couldn't warm up {who}: {why}" in red, and
the status line says the same.
What is sent: provider.WarmNow(agent, user) sends the scheduled warm-up's
own request to that one account and to no other. For Codex that is
warmCodexLogin; for Claude it is warmClaudeLogin over the gateway's
warmClaude (Claude Code's run in that account's config directory), set
through WarmClaudeVia. It works whether the warm-ups are on or off. An
account whose sign-in lapsed is refused with the reason. Afterwards the
allowance is read again (StaleAllowance / claudeWarmedNow), as after a
scheduled warm-up. The schedule's file is left to the schedule. The
Codex prompt, identity and base_instructions are unchanged: it is the
same body. The route is POST /api/warm-now, and /api/settings carries
claudeUsers beside codexUsers.
Claude gets the item too. It shares the warm-up engine and the same tab,
and the send is the same warmClaude the schedule uses.
No size budget was raised.
Run:
- WSL (wsl-run), Chromium and WebKit, with the GUI test
warm-now.test.cjs in en/zh/zh-TW/ja/de at 900px and 440px: 22/22.
The pressed button stays in place within 1px after two frames.
- WSL, the related files (warm-now, warm-at-own, warm-at-times,
warm-reset-asleep, settings-groups, settings-search, i18n-keys):
102/102.
- WSL, the other files that touch these lists (checkin-account,
checkin-reason, checkin-reason-once, plugin-checkin, segs-press-redraw,
settings-sections, usage-checkin): 169/170. The red is segs-press-redraw
"webkit ja 440px: every Settings option..." with "could not bring the
option into view" after 103s under load. It passed 3/3 alone and is
filed as #4189.
- mote (macOS) at the final tree: go vet for internal/gui, provider and
gateway; go test -run 'WarmNow|Budget|Warm' ./internal/gui
./internal/provider: ok. An earlier mote run, before the route move,
ran go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go
vet ./..., go build ./... and the budget tests: ok.
- Windows (win-run): go test -run 'TestWarmNow|TestCodexWarm|TestClaudeWarm'
./internal/provider/ ./internal/gui/: ok.
- WSL: go vet -tags nogui ./... is ok and gofmt -l is empty.
go test -tags nogui -timeout 45m ./...: 75 packages ok, including
internal/gui and internal/provider. internal/agent has 4 reds on the WSL
box (TestInstalledVersion, TestGrokInstalled,
TestCursorFolderFromTheEditorIsNotTheCLI, TestOmpDetectedWithPiDir). They
are already filed as #4033 and #3548 (fake binaries hit WSL interop).
internal/gateway has 1 red, TestUnroutedRequestShownThenAnswered: giveUp
answers the 504 before it marks the route done. That is not this change,
and it is filed as #4200.
At the head rebased on origin/main
|
||
|
|
29185e3bbc |
gateway: a request held too long before routing leaves a report its user can copy
Jason on Discord (#general, v0.1.1995, AirbuildEnvironment over Codex's
/backend-api/codex/responses) got the 2m 504: "magpie held this request
for 2m0s without routing it to any provider ... report it with magpie's
log". The desktop app runs the gateway in-process and logs only to
stderr, so there is no log for him to send.
giveUp now writes a report of the held request to a small file in
magpie's cache (held/, folder 0700, temp file renamed into place, the
newest 5 kept). It holds the time, version, OS, the method and path, the
model and agent, how long it was held, each named wait with its time and
whether it was still under way (noteWait now takes a kind: body, body
room, decision model, image description, plugin hooks, JS middleware,
Codex reset, masking), the body room's state, the requests in flight,
and a goroutine profile (function names and lines only, cut at 128KB).
It holds no body and no headers. Route.Held names the file. On the
Routing page, the request's story then says a report was saved, with
Copy Report and Open Folder (Open Folder is left out in magpie web).
GET /api/gateway/held/{name} reads only a report's own name. The 504's
text no longer points to a log: it names Copy Report on the Routing page
and the folder. The log line names the waits too. i18n is in zh, zh-TW,
ja and de, and docs/subsystems/gateway-routing.md has the section.
What held Jason's request is not known from what he sent. The waits that
count before routing are: the body arriving (idle deadline only), body
room (up to 100s, then 503), the decision model (see the next commit),
plugin hooks (11s), JS middleware (250ms a hook), image description
(bounded by the request) and the Codex reset (20s). Slots, RPM and
upstream come after the route begins. A WebSocket upgrade gets a 426.
The report names the wait, so the next one says which.
Run:
- mote, at 57b21abd9 before the rebase: go test ./internal/gateway
-run 'Unrouted|Held|...' passed. The full go test ./... -timeout 45m
was cut off when mote dropped off the network (2 packages ok). The
full suite then went to the Windows box (see the next commit).
- xiaomi-gpu (Windows), node --test: routing-held-report 50/50 in
chromium and webkit, 5 languages, 1100/420px, app and web.
routing-held-request and i18n-keys pass. All routing-* and i18n*:
1742 tests, 94 reds, none in i18n*. The same files are red alone at
origin/main
|
||
|
|
5eab14a8cc |
plugin pages: magpie web reaches a page's local service on its own address, so the chat page works from another computer
aigcfree (Discord DM) runs `magpie web --addr 0.0.0.0:3430` on an Ubuntu
server behind nginx and opens it from a Windows PC. Plugins -> 对话
(@magpie-community/page-chat) showed "127.0.0.1 refused to connect": the
page sends its frame to the chat server on 127.0.0.1, which in that
browser is the Windows PC.
A plugin now declares its page's service (package.json
magpie.page.service {port, option}: the port, or the plugin option that
holds it, from its plugins.json options; plugin.ServiceSpec). Served to a
browser (isWeb), /api/plugin-pages gives the page `service`:
_magpie/service/ under its token, and the bridge hands the frame
magpie.service as an absolute address. The desktop window and slot pages
get none, and the routes answer 404 there, so the local path is as before.
servePageService reverse-proxies /_magpie/plugin/<token>/_magpie/service/…
to 127.0.0.1:<port>. The service stays on loopback. The way in is the
page's own: the per-run token that only a signed-in /api hands out,
behind AllowGuard. Nothing is weakened:
- Host is set to 127.0.0.1:<port>, which the service's rebinding check
wants.
- The window's cookie is taken off.
- Origin must be absent or null (403 otherwise).
- Set-Cookie is dropped.
- Every reply is sandboxed (sandbox allow-scripts; frame-ancestors
'self'), with Referrer-Policy no-referrer and nosniff.
- The gateway's own port is never served, since a request from this
server is loopback and the gateway takes that without a key.
- Event streams flush as they come (FlushInterval -1, X-Accel-Buffering:
no for nginx). webCompressed no longer gzips text/event-stream, which
held a stream back until gzip's buffer filled.
- A redirect to the service's own address is made relative.
- The entry starts the plugin host as the page's HTML does (pageHost).
- A service not up yet answers its frame with a 502 page that tries
again in 2s.
page-chat 0.1.2 (magpie-community/plugins 4a46212, on dist) declares the
service, goes to magpie.service when given one (else 0.1.1's path:
127.0.0.1 on loopback, the SSH-tunnel note from elsewhere), and asks
api/… by relative address.
Docs: plugin-runtime.md P4 (the page row), gui-shell.md (no gzip for event
streams).
Tests: TestPluginPageServiceListedToBrowserOnly, TestPluginPageServiceSpec,
TestPluginPageServiceProxied (through webHandler: Host, cookie, Set-Cookie,
CSP, escaped path and query, foreign Origin 403, made-up token 404,
redirects, SSE first event before the end and not gzipped),
TestPluginPageServiceDown, TestServiceLocation; plugin-page.test.cjs
checks magpie.service in a browser page and its absence in a slot.
Run at 276683d85, this change on origin/main
|
||
|
|
f463a8aaf7 |
gui: Settings has Loading bird, which keeps magpie's bird off skeletons and stops looking for them
Yayoi_no_yume on X, agreed by GymlinZhu: they run magpie on a 1-core,
1GB server and asked for a way to turn the loading bird off. The owner
wanted the bird, so it stays on by default. Settings -> General now has
"Loading bird" (Off / On), below Reduce motion.
- settings.json keeps noBird (omitted when the bird is on), and boot.js
passes it. A POST that leaves it out keeps it, as with the other prefs.
theme.js sets data-bird="off" on <html> before the first paint, and
applyPrefs changes it.
- skelBird (app.js): with the bird off, nothing looks for skeletons at
all. No 250ms interval and no observer run. Turning it off mid-hop ends
the hops, and the bird flies off.
- With the bird on, the look is driven by events. Before, the 250ms
setInterval ran forever, scanning the DOM for .skeleton whether or not
one existed. Now a MutationObserver watches for an added node that is or
holds a skeleton, the 250ms look runs only while one is in the page,
and the look stops itself once none are left.
- The README's bird (plugins.js bounceLoader): with the bird off, the four
lines stand straight with no bird, and the box goes when the README
comes.
- Strings are in en, zh, zh-TW, ja and de. App.js is 1,294,016 bytes, under
its budget, which is not raised.
Tests:
- skeleton-bird.test.cjs adds three tests:
- with no skeleton left, the look stops, and a skeleton added later
starts it again;
- with the setting saved off, no bird, no dip and no look ever starts
(setInterval is wrapped to count the look);
- the Settings row shows On by default; Off posts noBird:true, stops a
running look, and a skeleton added after that starts none; On posts
false and the look starts again.
- plugin-readme-bird.test.cjs: with the setting off, the lines stay
straight, no .sk-bird is drawn, and the box goes at once.
- settings-general: #birdSegs is in the list of bare rows.
- TestSettingsNoBird: off by default, kept by a POST that leaves it out,
cleared by false, in settings.json and boot.js.
Run at this head (rebased on
|
||
|
|
628ac36fc9 |
agents: Add magpie says when nothing here opens the app's import link (sungt)
sungt (Discord #feedback, Windows, magpie 0.1.1976, Cindy 0.1.119, Cindy
open): on the Agents page Cindy's 添加 magpie "spins, no response".
What magpie got wrong: Cindy, AionUi and Lody take magpie only through
their import link, which magpie hands to rundll32 / open / xdg-open and
never waits on. A link nothing opens did nothing, the button never awaited
/api/open nor caught its error, and `magpie cindy add` printed "opened"
whatever happened.
- agent.OpenAppLink asks the system, without opening anything, whether
something opens the link's scheme: Windows' HKCR\<scheme> (what
Electron's setAsDefaultProtocolClient writes) and then the user's
UrlAssociations UserChoice; macOS Launch Services (cgo builds); Linux
`xdg-mime query default`. Only "none", or a registered program whose
full path is gone, refuses the link (NoLinkHandlerError); anything
unknown hands it over as before.
- /api/open (Cindy, AionUi, Lody after OpenLody) answers
code no_link_handler with app, exe and said, an i18n.js key from
linkSaid that api() puts through t() as it does bunSaid's.
- The import button now waits for /api/open and shows the result: "Sent
to {name}: confirm adding magpie there", or the reason in the
reader's language.
- The CLI's add returns the same error.
This is not verified as sungt's cause. Cindy was open, and Cindy
registers cindy:// at every start, so the check most likely passes on
their machine. If so, the spinner is Cindy's own import dialog
(previewProviderImport / fetching magpie's /v1/models). Cindy 0.1.119
wasn't available here. We still need Cindy's log around "received deep
link" from sungt.
Run (worktree at origin/main
|
||
|
|
5637cca141 |
settings: a notification when masking swaps a value for the first time (Must2333 on X)
Must2333 on X: "我还希望能即时的知道发生了替换,但不是通过随时监控网关的方式".
They want to know when magpie masks something without watching the
gateway or the 脱敏 page.
Settings › Usage has a new row, "Masking alert" (zh 脱敏提醒), after the
task done alert. Off/On, off by default. When on, a value masked for the
first time gives a system notification through the same notifier as the
other alerts. It says only how many new values, each kind and its count,
and the agents that sent them (two named, "+N" for more). It never says
the value, any piece of it, or the Head hint the 脱敏 page keeps. A click
opens the 脱敏 page on the latest record (clickView, "masking&key=<key>").
Why off by default: every other notification in this group is off until
turned on; turning one on asks macOS for notification permission; for
most users a notice each time masking works is noise, since masking's
expected behaviour is quiet protection. It is one row, in the group that
already holds the alerts, hidden while masking is switched off
(data-feature="redact") and in gateway mode.
Staying quiet:
- First time only: maskrec.Fresh says which values a record has that no
record before it had. A conversation sends its whole history each turn,
so a value is masked again every turn after its first. The index is by
placeholder (HMAC-stable across restarts), filled from memory and from
the days kept on disk, so a restart doesn't make a history new again.
The days are read off the lock, since Hold takes it on the request's
way. Values sent as written (Action "warn") are left out.
- A burst is one notification: records gather for 3s (maskGather).
- At most one every minute (maskGap); what comes in between is said
together after it. At most 5000 records wait.
- With the setting off, nothing is kept.
The gateway tells the app through gateway.OnMasked, after maskrec.Hold,
with Snips and Back taken out; nil under `magpie serve`.
Strings: en, zh, zh-TW, ja, de, in i18n.js (the row) and in
mask_alert.go (the notification's title and kind names, the 脱敏 page's
own words for the kinds). docs/subsystems/gateway-routing.md has the
bullet. The core script budget isn't raised: main's 10-29 budget leaves
room for the row's 287 bytes.
Tests, each broken by hand and seen red:
- TestMaskAlertFirstTimeOnly: masks through redact.Mask as the gateway
does; the history masked again says nothing, a new email in turn 4 is
said alone. Red when flush counts r.Values instead of the fresh ones.
- TestMaskAlertNeverSaysTheValue: no 4-character piece of the key, email
or phone, and no Head, in any of the 5 languages. Red with the Head
added to the kind's name.
- TestMaskAlertCoalesces: a burst of 5 from 3 agents is one wait of
maskGather and one notification ("+1"); two more 10s later wait
maskGap-10s and are said as one; off keeps nothing. Red without the
waiting check (5 waits) and without the maskGap wait ("waits 3s want
50s").
- TestFreshOnlyTheFirstTime, TestFreshHeldWhileReading (maskrec). Red
with loadFirst skipping the disk read (the history new after a
restart), and with the index broken (both).
- TestDismissedAlertOpensNothing covers the mask notice's click.
- mask-alert.test.cjs: every language at 900 and 380px, both engines:
the row after the task done alert, Off at first, On saves maskAlert,
another save keeps it, Off saves false, no click moves the page, no
left border, gone with masking switched off. Red with maskAlert taken
out of prefsKeep, and with data-feature taken off the row.
Run:
- This change on main
|
||
|
|
97b6a36c5b |
gui: the sidebar's gateway names the LAN address while it is shared
coeo91 on Discord: with "Share on local network" on, the sidebar's line still said "Gateway 127.0.0.1:3425". Shared, it now names where other machines reach it: MAGPIE_PUBLIC_URL if set, else the address picked in Settings (magpie.lanAddress), else the first LAN address. Its tooltip names that and this computer's url. Not shared, it is unchanged. - api.go: boot.js's sideGateway carries lan and lanURLs when shared, so the first paint is right. - plugins/gateway/settings.js: sideLAN() picks the address and redraws the boot line once loaded (it loads after app.js); turning sharing on/off re-reads /api/providers and redraws, and picking an address redraws. The choice lives in the plugin so app.js and the core script budget stay under their limits (TestCoreScriptBudget passes); no budget raised, no new strings. - app.js renderSideGw: uses self.sideLAN?.(g), tooltip adds " · " + url. Run at this commit's tree, rebased on |
||
|
|
581d64b7d0 |
gateway: sharing lists this network's addresses first, and names one on the internet
The user whose network card holds a static public address (203.236.50.70, |
||
|
|
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
|
||
|
|
9e33962c05 |
gui: Settings has Reduce motion, stilling magpie as the system's does (#3813)
CupOfBread asked for a switch that turns magpie's motion off to save
resources on the desktop, and linull24 saw the Routing page keep a
phone's browser busy. magpie already stills its animations under the
system's Reduce Motion: 46 @media (prefers-reduced-motion: reduce)
rules across app.css and the plugins' styles, and calm() in the
scripts. Settings -> General now has "Reduce motion" (Off / On) that
does the same without the system setting.
- settings.json keeps reduceMotion; boot.js passes it; a POST that
leaves it out keeps it, as the other prefs.
- theme.js's holdStill(on) sets data-motion="reduce" on <html> and sets
the media of every stylesheet rule written for reduced motion to
"all" (and back when turned off), so the same rules apply and no CSS
is written twice. layout.js calls it before the first paint when the
saved setting is on; applyPrefs calls it on a change.
- calm() is true when data-motion is reduce too, so the scripts'
motion (Routing's stage, Library, Usage) holds still with it.
- routing.css: the reduced-motion rule for the live dot was
.rt-livedot, which lost to .rt-livedot.on's animation; it is now
.rt-livedot.on, so the dot stands still with either setting.
Measured on mote (Chromium 390x844, 4x CPU throttle, live Routing
traffic, CDP Performance over 10s, two runs each): main-thread task time
0.18 and 0.22 s/s with it off, 0.090 and 0.085 s/s on; style recalc
0.021/0.025 off, 0.008/0.011 on.
Tests: reduce-motion.test.cjs (new, both engines): saved on, the
reduced-motion rules apply from the start (a probe's live dot has no
animation, calm() is true); Off restores them and posts false; On again
posts true. TestSettingsReduceMotion: off by default, kept by a POST
that leaves it out, cleared by false, in settings.json and boot.js.
The Settings row is in settings-general's list of rows.
Run on mote at this head (rebased on
|
||
|
|
e8c7dddcb4 |
notices: the release carries the third-party licence notices
The owner asked for the licence notices in the release package (moejs alpha.11 compiles Intl's data in, which carries its own notices). THIRD_PARTY_NOTICES is embedded in the binary (main.go, //go:embed) and handed to internal/notices; `magpie licenses` prints it, GET /api/notices serves it, and Settings › About has an Open-source licenses row that opens it in a dialog, in every language. `make app` copies the file into the .app's Resources too. The core's scripts are 1,527,245 bytes, their budget raised to it with no room added; app.js stays under its own. Run at this head (rebased on origin/main): - win-run (Windows 11): go vet -tags nogui . ./internal/notices ./internal/cli; go test TestNoticesFollowMoejs (.), ./internal/cli, TestCoreScriptBudget (./internal/gui): ok. - wsl-run (Ubuntu 24.04): go vet -tags nogui ./..., go build -tags nogui: ok. Run at the pre-rebase head 14e2d13fb, on mote (macOS): - gofmt; make app's copy byte-identical to the file; `magpie licenses` output equal to the file; GOOS=linux/windows vet and build; go test . ./internal/cli: ok. ./internal/gui: only TestMainWindowCorners red, the same on origin/main (#3949). - about-notices.test.cjs: chromium and webkit, en zh zh-TW ja de, 1100 and 420px: all ok. Broken by hand: TestNoticesFollowMoejs red with the embedded file cut. Not run: the GUI suite at this head. The rebase met main's cancelAsk helper where showNotices sat, and the dialog's Done now uses it (the same stopPropagation + closeConfirmAsk). The whole GUI suite at 14e2d13fb was cut off when mote went down at load ~50: the files it reached outside About had reds, most of them 180s browser-launch timeouts, the rest passing in other languages or the other engine; they are run again once mote is back, and any that stay red are filed. |
||
|
|
6af83172d3 |
gui: the masking demo shows no video where WebKitGTK can't play one (avk458 on X)
On Omarchy (Arch + Hyprland) without gst-plugins-good, opening Masking's
"How masking works" aborted WebKitWebProcess about 3s later: WebKitGTK
2.52.6 gives every <video>, muted ones too, an autoaudiosink, which lives
in libgstautodetect.so ("no such element factory autoaudiosink", then a
SIGABRT). The window was left frozen on its last frame ("一点就崩溃再点
magpie就卡死了").
Cause: b90e81da1's noVideo was only in GET /api/settings. The page's
state.settings comes from /api/state, which never carried it, so a demo
opened before Settings was visited set the webm src. The GUI fixture put
noVideo into /api/state's settings and hid it.
Now boot.js says noVideo (app only, not a browser tab) before the page
paints, and demo.js reads window.bootPrefs.noVideo; the poster shows
instead. Also, for BoyC338's memory question: folded, or with the page
left, the video lets go of its source (removeAttribute src + load), so
no decoder or buffer is held; opened again it goes on from where it was.
Run:
- mote: GUI masking-demo, masking-records, i18n-keys in Chromium and
WebKit: 116 pass, 0 fail.
- mote: go test -run 'TestBootSaysNoVideo|TestBoot|TestSettings|
TestFontSettingsAPIAndBoot|Budget' ./internal/gui ok; gofmt -l none;
vet for darwin, GOOS=windows, GOOS=linux -tags nogui ok.
- WSL magpie-desktop: go test -tags gtk3 -run 'TestBootSaysNoVideo|
TestGstAutodetect|TestWebkitDefaults|TestSettings' ./internal/gui ok.
- Real app on omarchy, v0.1.1840 release: Masking > demo row aborted
WebKitWebProcess (coredump 07:10:10 UTC), window frozen. Built this
tree with make release-linux in WSL and ran it there: demo opens with
the poster and animates, fold/reopen, Agents and back to Masking all
respond; no coredump, no autoaudiosink line, both web processes alive.
These ran at base ea53eb126; rebased onto
|
||
|
|
7b63feb908 |
gui: a browser tab's font rows show on a nogui magpie, and Text size no longer flashes
Norcleeh (Discord #general, after v0.1.1788): in magpie's web GUI the interface-font and code-font rows "flash once and disappear" on refresh. Cause, reproduced on a real nogui `magpie web` on mote in Chromium and WebKit, at 127.0.0.1, localhost and the LAN address: a nogui build (Docker, magpie-cli) has fonts.Available false, so boot.js carried no `fonts` flag and app.js never showed the font rows at all. What flashed was the Text size row: index.html shows it, and renderSettings hid it for a browser tab 40-120ms later (`#textSizeRow.hidden = web`). Fix: - A browser tab always gets the font rows. Its /api/fonts answers the server's families plus a common list (Arial, Menlo, Consolas, PingFang SC, Microsoft YaHei, Noto Sans CJK SC, JetBrains Mono, ...) and never errors for a tab; fonts.js keeps only what this browser can draw, and "System default" is always offered, so with nothing kept the rows still show with it. - The app-only rows (Text size, tray, login, tray usage) carry .app-only, which `body.web .app-only` hides before first paint, so none of them paints in a tab. - The boot `fonts` flag is gone. app.js and core both got smaller; no budget changed. - docs/subsystems/gui-shell.md "Desktop fonts" says so. Run (mote-run, at this head rebased on |
||
|
|
833f51adcf |
gui: a browser tab has the font rows too, with its own choice
Norcleeh on Discord: magpie opened in a browser had no font setting in Settings > General, while the app does. The rows were hidden on purpose: /api/fonts answered 404 to a browser page and boot sent it no choice, since the list is the fonts of the computer magpie runs on and the tab can be on another one. Now a browser tab (magpie web, or the app's page in a browser) has both rows wherever magpie can read its fonts (boot's fonts; a nogui build can't, and keeps them hidden). Its list is /api/fonts less the families this browser doesn't draw (fonts.js here(): text in the family measures apart from monospace's or serif's on a canvas), so another computer's fonts and Safari's user-installed ones aren't offered. The choice is the browser's own, in localStorage (magpie.fonts), applied by fonts.js before the first paint; it neither changes nor takes the app's settings.UIFont/CodeFont, and a settings save from a browser still keeps the app's. Run on mote at this tree (on |
||
|
|
b90e81da14 |
gui: on Linux without gst-plugins-good the masking demo shows her poster
On stock Omarchy (Arch + Hyprland, WebKitGTK 2.52.6, GStreamer 1.28.6
with gst-plugins-base and -bad only), opening the masking demo aborted
WebKitWebProcess about three seconds in, so the app's window went blank.
WebKitGTK gives every video, a muted one too, an audio sink it makes with
autoaudiosink ("GStreamer element autoaudiosink not found", then a NULL
g_signal_connect, then SIGABRT); that element is in gst-plugins-good.
canPlayType can't tell: an Ogg Theora copy, "probably" playable there,
crashed the same way, so no other format would do.
The Linux app now looks for libgstautodetect.so in GStreamer's plugin
folders (its variables' and the system's): GStreamer's core there and
autodetect in none of them means no video (webkitPlaysVideo). Settings
state says noVideo then, in the app only (magpie web plays in the user's
own browser), and the demo sets no src: she is her poster and the sheets
move on the frame clock, as when the video can't load. No GStreamer folder
found says nothing, and video stays on.
Run at this head (origin/main
|
||
|
|
dc1af8231b |
ghtoken: a Settings token GitHub refuses is said, and requests go without one (#3926)
A GitHub token in Settings → Network and sharing that GitHub refused (401, expired or revoked) failed every plugin and skill check, so a stale token was worse than none. Now it is treated as an environment token already was: the request is asked again without it, the token isn't sent again while magpie runs or until the field changes, and the anonymous answer (60 an hour) is the one taken. This overturns the package comment and TestSettingsTokenRefusedStaysAnError: the token being the user's choice is a reason to tell them, not to fail the check. The page stays honest about it: - Settings › Network and sharing still shows the token, masked, with Remove, and says in red that GitHub refused it and requests go without one until it is replaced (/api/settings githubTokenRefused). Before, a refused token simply read as none being set. - After a Settings token's refusal requests go anonymous, not with GITHUB_TOKEN/GH_TOKEN: the user put the Settings one ahead of those, and the page says "without one". Patch by MYCF711 (fix/settings-token-fallback, 7d93f1b5): the ghtoken change and its tests. Changed from it: the notice is in Settings' row, where the token lives, instead of the patch's Plugins page note, which cost ~630 bytes of core script the budget (28 bytes of room at |
||
|
|
e056779a67 |
gui: the app serves its page to a browser, behind its key (Settings › Browser access)
jiakun_zhao on X ran `magpie web` in a terminal beside the desktop app, to manage it through a Cloudflare tunnel. Settings › Network and sharing › Browser access now has the app serve the same page itself: Off, This computer (127.0.0.1, for a tunnel or SSH forward) or Local network. Access is magpie web's, unchanged: the key in the link is traded for the cookie (webGuard), the allow list holds, and the gateway's client routes on the page's port need a gateway key (onePort). A rebound Host and Origin: null get no cookie. There is no way to serve it without the key. The key and choice live in web-page.json (0600) beside settings.json, so a sync never carries them. GET/POST /api/web-page are the app windows' alone: a browser on the page can't read the key or turn the page off. A busy port (magpie web, the magpie before an update) is tried every 4s; `magpie web` on the same port opens the app's link instead. Run at d43b7c40d (this change on |
||
|
|
8b0132b3d2 |
codex: the Codex app sends again on every system as soon as magpie takes a used-up ChatGPT account over, and gets it back at the reset
Ethereal499 and Isdavexxx on X, MasterYi on Discord, #540. The Codex app greys Send for every model, magpie's too, while the ChatGPT account it is signed in to is used up. Its composer's gate (ChatGPT.app 26.1013) reads authMethod "chatgpt" plus rate limit allowed=false, and it asks account/read only when its app-server starts. |
||
|
|
7aeae59670 |
privacy: masked words can match as whole words only, by a switch under Masked words (acmilan_)
Settings › Privacy's masked words (脱敏词) were found anywhere: ABC masked
the ABC inside XABCD, and 123456 the middle of 91234567 or 0.123456. A
new row under "Masked words in any case", "Whole words only" (仅完整单词
匹配), makes each word match only where no letter, digit or _ is beside
it, and for a number no "." and digit either, so a decimal counts as one
value: ABC masks "ABC IS xxx" and name='ABC' but not XABCD or ABCDEF;
123456 masks a 123456 of its own but not 91234567, 0.123456 or 123456.78
("the code is 123456." still is). Chinese and Japanese letters count as
no letter there, since those scripts put no spaces between words: 张三
is still found in 我的同事张三今天来了, and ABC in 用ABC做. It is
independent of any case and works with it (xabc then Abc! masks only
Abc). A match inside a longer word is passed over one letter at a time,
so a whole one after it is still found. Off by default and for every
existing user: settings.json without redactWordsWhole reads false, and a
page from before it that saves without the field keeps what was set
(api.go, as redactWordsAnyCase). Each match goes as {{TERM_…}} and comes
back as written. Translated in zh, zh-TW, ja, de.
redact.Options.WordsWhole (wholeWord, wordRune); settings.RedactWordsWhole
(redactWordsWhole) reaches it through internal/masking; prefsKeep sends it
on every Settings save. docs/subsystems/gateway-routing.md has a bullet
for the user's own words, any case and whole words.
Tests, each red when its part is broken by hand:
- TestWordsWhole (internal/redact), the reporter's literal examples plus
CJK and any case: with the whole-word check skipped, 10 cases FAIL
"1 masked, want 0"; with the decimal check off, FAIL on 0.123456 and
123456.78; with Han/kana counted as letters, FAIL on 张三, 用ABC做 and
これはABCです. Every case round-trips through Restore.
- TestWordsWholeJSON: a request body and a tool call's escaped
arguments; with the check skipped, FAIL "XABCD not kept as written".
- TestCountTokensRedacted/words_whole (internal/gateway): with
masking.go not passing the setting, FAIL "redaction off changed
content: …X{{TERM_…}}D…"; words_inside holds the default unchanged.
- TestSettingsRedactWordsWholeKept (internal/gui): with the not-sent
guard removed, FAIL "…redactWordsAnyCase…: whole words false".
- redact-words-whole.test.cjs: 20 of 20 (Chromium and WebKit, en, zh,
zh-TW, ja, de, 1100 and 640px); with prefsKeep's field removed,
WebKit fails "a later save keeps it".
Run, in worktree magpie-wt/redact-wholeword at base
|
||
|
|
83368d9946 |
codex: thread descriptions can be turned off, as titles can (cybercaius)
cybercaius on Discord asked to turn Codex's thread descriptions off.
Titles and predictions had an Off; descriptions only had "as Codex
sends it" or a model.
Codex's settings on the Agents page now offer Off for "Thread
descriptions", worded as the titles' Off ("Off", "no description,
nothing sent", in zh, zh-TW, ja and de too). settings.CodexDescriptions
takes "off", /api/settings/codex-descriptions accepts it, and the
gateway answers a thread_description side turn itself through
sentNowhere, as titles' Off does: a finished response.completed with no
output, nothing sent upstream, and Routing/Usage recording it as
answered by magpie with the reason. Both routes take it (the Codex
backend path and /v1/responses).
Why an empty reply is enough: in ChatGPT.app's app.asar the
thread_description helper reads the reply's {"description"}; with no
message it records an "empty" result, not an error, and the thread's
description is left as it was.
The docs (gateway-routing.md) say each of titles and descriptions has
its own Off and neither turns off the other. No CLI change: titles' Off
isn't settable from the CLI either. docs/reference.md doesn't list
these settings.
Run:
- gofmt -l: nothing. go vet: darwin ./..., GOOS=linux -tags nogui
./..., GOOS=windows ./...: ok.
- go test -timeout 45m ./internal/gateway ./internal/gui
./internal/settings before the rebase: gui ok, settings ok; gateway
had TestDisabledCodexModels ("no space left on device") and
TestHistoryKeepsDaysAndDropsOld red during a moment the disk was
full; both pass -count=5.
- Rebased on
|
||
|
|
353519f557 |
gui: a Sessions or Usage poll's reads are collected under GOGC 25, and two reads under it at once put back what was set before
An open Sessions or Usage window polls every 15 s, and a poll's reads allocate ~330 MB to keep ~105 MB. At GOGC 100 the heap grew to twice what it kept before a collection, so Activity Monitor showed ~280-360 MB during each poll. Each /api/sessions* and /api/usage* GET now runs under GOGC 25, the warm-up's usage read's setting, without the memory limit that read also takes: held at heldMemory, every poll collected over and over and the window spent 5x the CPU. underTightGC put back what it found, so two reads at once ended with the second's 25 for good when the first ended first. A count now holds it: the first read sets GOGC (and the limit, for the warm-up), the last puts back what was there before the first. Measured in a sandbox HOME over the real session and usage data (6 GUI polls 15 s apart after a warm start, footprint right after each poll / 10 s later; CPU over the 6 polls): - origin/main: 326 326 326 290 364 281 MB / 188-217 MB; 5.2 s - GOGC 25 + memory limit: 190 176 172 161 216 186 / 149-172; 20.7 s - this (GOGC 25 only): 278 217 220 197 248 214 / 186-209; 5.6 s /api/sessions 495 ms vs 653 ms on main, the other routes the same. TestTightGCOverlappingReads ends two overlapping reads in either order; with the count taken out (each read putting back what it found) it is red, "one read still in flight under GOGC=100, want 25". Run at this head ( |
||
|
|
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 |
||
|
|
5215108e53 |
gui: magpie web shows MAGPIE_PUBLIC_URL at the sidebar's foot and in About's Gateway URL, as the Gateway page does (noahhrreion on Discord)
noahhrreion runs magpie in Docker and sets the gateway's address with MAGPIE_PUBLIC_URL; the address at the foot of the page didn't show it. Since #1551 a page other machines open (magpie web) shows MAGPIE_PUBLIC_URL, while they are let in, as the gateway's address on the Gateway page, starts Connect and its snippets at it, and uses it for Settings' MCP addresses. Two places still said the container's loopback: - the sidebar's gateway line (renderSideGw): it drew providers' and boot.js's `url` only. It now draws `publicURL` in magpie web, and boot.js's `sideGateway` carries it (same rule as settingsState: shared, or MAGPIE_ADDR on the network, as the image's 0.0.0.0 is) - Settings › About's Gateway URL: in magpie web it is the public URL, and the separate Public address row, then the same, is left out In the app on this computer both stay the local address that agents here are pointed at, as before. The address list in Share on local network already gives MAGPIE_PUBLIC_URL alone, and Connect and the copy buttons were already at it. Run (worktree at origin/main |
||
|
|
ecd0638276 |
gui: the Sessions list is encoded once, into the answer it is sent as
writeJSONRows marshalled each row on its own, joined the rows, and wrote the join into a buffer that grew from nothing: three copies of the ~8 MB list on every 15 s poll. The rows are now encoded straight into the answer, whose buffer is made the size of the last answer of that key; each row's bytes (for its sum and for a delta) are a slice of it. The answer is byte for byte what it was, so tags and deltas are unchanged. A/B on the same live history (rss-bin ab5.sh, 8 polls 15 s apart, |
||
|
|
94a70f1a0d |
gui: what a Sessions or Usage poll threw away goes back once the page rests
An open window's Sessions and Usage polls allocate ~330 MB every 15 s to keep ~105 MB, and Go's scavenger hands the freed pages back only slowly, never while the next collection's goal covers them: between polls the footprint sat at 336-392 MB. The gateway already hands its requests' pages back once it rests (#3472), but the window's reads go through the GUI's handler, not the gateway's, so nothing ever did that for them. held now counts the /api/sessions and /api/usage reads (readingPage), and once none has been in flight for 3 s (a poll's reads come within a second of one another) it calls debug.FreeOSMemory, as the warm-up does after its reads. Measured on a copy of the owner's real history (rss-home, 3581/3582, 8 GUI-like poll cycles 15 s apart, footprint 10 s into each rest), at |
||
|
|
9ae7912210 |
agent: plain agy starts Antigravity CLI on magpie in a new terminal
agy takes magpie's gateway, key (GEMINI_API_KEY, GOOGLE_GEMINI_BASE_URL)
and --model only from how it is started, so a user on magpie had to copy
the launch command at every start (bestony on Discord). Now:
- magpie agy run [args…] execs the real agy with the env and --model when
agy's settings.json is on magpie's model (a --model/-model the user
gives wins), and runs agy untouched otherwise. On Windows agy is a child
through proc and its exit code is passed through. It refuses when "agy"
on PATH resolves to magpie itself. magpie agy env prints what run adds
(PowerShell's function reads it, since the desktop exe has no console).
- update.ShellFunction puts a function named agy in a marked block
(# >>> magpie agy >>> … # <<< magpie agy <<<) of each shell profile
cliShells finds: .zshrc (ZDOTDIR), the bash profile a terminal reads
(.bash_profile, or .bash_login/.profile on macOS when that is missing),
config.fish once its folder exists, and the PowerShell 7 / Windows
PowerShell profiles where the execution policy runs them. Only the block
is written, in place, temp-and-rename, CRLF and BOM kept; a profile that
can't be read is not written; only files inside the home are. The
function falls back to `command agy` when the magpie it names is gone.
- Set to a magpie model writes the block, stepping out takes it out (the
file comes back byte for byte), and Sync at start writes it for users
already wired.
- Notice, Launch tooltip and the connect panel say plain agy works in a
new terminal, with the command for a terminal open now. Strings in
i18n.js for zh, zh-TW, ja, de. docs/reference.md and
docs/subsystems/agent-wiring.md updated.
Run at this head (base
|
||
|
|
8bc72bf10a |
gui: the Sessions tab's 15 s reads send only what changed, not the ~8 MB list
Every 15 s the Sessions tab read /api/sessions (7.9 MB over a long
history, 5000 rows) and /api/sessions/stats (0.7 to 5.7 MB), parsed both
and ran JSON.stringify over the old and new answers to find them the
same. While an agent works one row changes, so it was all of it, every
poll, in the WebView.
- writeJSONSame (api.go) tags an answer with a hash of its bytes. An ask
whose X-Magpie-Had is that tag gets X-Magpie-Same and no body, and the
page keeps the object it has. Used for the stats.
- writeJSONRows does the same for the list, and keeps each row's hash
for the last 4 lists it sent. Asked with the tag of one of those, it
sends X-Magpie-Delta: sessions and a list of only the new rows, each
run of old rows written [from, count].
- api() in app.js sends the tag it has, rebuilds a delta on the rows it
holds (the same objects), and remembers each answer's tag. The tab
compares answers by tag, so it no longer stringifies 8 MB twice.
- Not an ETag and a 304: on Windows Wails strips If-None-Match from
WebView2's requests and turns a 304 into a 505.
Run at this head (macOS, go1.27, parent
|
||
|
|
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.
|
||
|
|
4a33cf0a98 |
update: a Stable channel in Settings → About, and magpie update channel
ssharpcc on X reads every changelog before updating, for fear of a ban
when behind, and with many releases a day that is a lot of reading.
Settings → About → Update channel (zh: 更新渠道, 稳定版 / 每个版本) picks
Every version, the default and today's behaviour, or Stable: one version
a week, the newest that had been out three days as the week began
(Monday 00:00 UTC), and an urgent release at once. usemagpie.ai chooses
it from the release list (the previous commit); a release is urgent when
a line of its notes starts with "**Urgent release:**", which
magpie-releases' release run writes from an `Urgent: <why>` trailer
(magpie-releases 73f6cff).
- settings: updateChannel, "" or "stable"; anything else is refused.
- update: on Stable the feed is asked with channel=stable; What's new
shows every release since the installed one (up to 1500) instead of
the newest 40, so a week's notes read as one list.
- gui: the row is segs, never a <select>; a save that doesn't send the
channel keeps it; switching asks the feed again at once, and a
download from every version newer than Stable's pick is dropped,
never restarted into. What's new's notes are kept per channel.
- cli: magpie update channel [stable|every] ("all" too), and it says
which with nothing after it.
- docs: reference.md's Update channel (the rule and the marker); the
privacy pages (en, zh, ja) name ?channel=stable on /api/latest.
The full Go and GUI suites were not run: the disk was at 3 GB free and
other sessions had GUI suites and a 45-minute gateway run going the
whole time.
Run, at this tree before the rebase:
- gofmt -l (clean); go vet on darwin, GOOS=linux -tags nogui and
GOOS=windows for ./internal/update/... ./internal/cli/...
./internal/settings/... ./internal/gui/.
- go test -count=1 ./internal/update/... ./internal/cli/...
./internal/settings/...: ok. ./internal/gui -run
'TestUpdateChannelSwitch|TestWhatsNewKeyedByChannel|TestCoreScriptBudget':
ok (the app.js budget passes).
- GUI, chromium and webkit: update-channel (22: en, zh, zh-TW, ja, de at
900 and 420 wide: default lit, Stable saved, kept by another save,
kept over a reload, Every saved back, no click scrolls, no sideways
scroll at 420), i18n-keys, gui-ja, gui-de, gui-zh-tw and every
update-*.test.cjs: 253 of 253 pass.
- The live feed: /api/latest?channel=stable answers 0.1.1327 (out
2026-10-22 21:55 UTC, the last before Friday 10-23 00:00) with 15
assets after the first real cron run filled the ledger (400 releases
back to 10-10); /api/notes 0.1.1200..0.1.1327 gives 124 notes, none
empty (1213 and 1218 were never published).
After rebasing on
|
||
|
|
a1174674da |
codex: subagents and memories follow the session's magpie model; auto-review can too (cybercaius on Discord)
Codex's side calls ask for one of Codex's own models by its bare name
whatever the conversation is on: a subagent goes on the model the lead
names in spawn_agent, memories on gpt-5.6-luna/terra, auto-review on
codex-auto-review. With Codex signed in to ChatGPT and the conversation
routed onto one of magpie's models, each of those went to the ChatGPT
account instead (cybercaius: "can't pick follow the main model").
- gateway (codexFollowTo, codexLeads): a collab_spawn or memory call
that asks for a bare model, with nothing set for it (no magpie
subagent model, no [agents] default_subagent_model, no [memories]
extract/consolidation_model in Codex's config), goes on the model its
conversation's own turns go on (parent thread, own thread, else the
key's last turn), when that is a magpie model the key may use. A task
the ChatGPT backend sealed stays on ChatGPT. The trace shows a
subagent's pick as {asked -> to}.
- agent.CodexSideSet reads Codex's config.toml for those keys; an
unreadable config counts as set (leave as sent).
- Auto-review gets "Same as the session" (settings value "session"):
codexcat writes each magpie entry's own id as its
auto_review_model_override. Not the default: codex-auto-review runs
free on a ChatGPT sign-in (#1593).
- GUI: the option in all languages; Memories' default text says it
follows the session. app.js stays under its budget by folding five
identical writingPrefs then/catch chains into prefWrite.
Ran (sandbox HOME, -tags nogui -count=1 -timeout 45m):
- go test ./internal/gateway ./internal/agent ./internal/codexcat
./internal/settings ./internal/cli ./internal/gui: ok.
./internal/provider: FAIL with "close of synctest channel from outside
bubble" in filememo.Forget (TestUnreadLoginsWriteErrorsKeepCredentials),
which is #3632 on main; this change touches nothing there.
- TestCodexSubagentFollowsTheSession and TestCodexMemoriesFollowTheSession
go red with codexFollowTo returning "" (broken by hand).
TestCodexSideCallsKeepTheConfigsModel, TestCodexSideCallsStayOnChatGPT,
TestCodexSideSet, TestCodexAutoReviewFollowsTheSession pass.
- GUI (playwright 1.62.0, chromium + webkit): codex-auto-review (en, zh,
zh-TW, ja, de), codex-memories, codex-memories-settings, codex-titles,
codex-predictions, codex-descriptions, settings-general, agent-prefs,
i18n-keys: 120/120 pass. TestCoreScriptBudget passes, budget unchanged.
- gofmt -l clean; go vet -tags nogui for linux, windows and darwin ok.
Again after rebasing on origin/main
|
||
|
|
c26a418d23 |
agent: an import app's status magpie can't read is unknown, not "not added"
Agent.Added now returns (added, known). Cindy's reader turned any
failure (a locked, corrupt or unreadable cindy-local-v1.db) into "Not
added", which told a user who had added magpie that they hadn't. Now
an unreadable database is unknown: /api/agents leaves `added` out and
the row shows the "confirm it there" hint, as it does for Lody. A
stopped WSL distro's app is unknown too, not "not added".
Cindy's database is also read without writing beside it. A mode=ro
open of a WAL database while Cindy was closed made cindy-local-v1.db-wal
and -shm in Cindy's own folder. It now goes through
sessions.OpenUntouched, which is what the Cursor reader already did
(immutable with no log, from a copy with one), moved out of
openCursorStore so both share it.
The CLI's list still offers `magpie cindy add` when the status is
unknown; it never said magpie was missing.
Run: go test ./internal/agent ./internal/sessions ./internal/cli ok;
go test ./internal/gui -run 'Import|Lody|Cindy|Agents' ok.
Broken by hand: Cindy's reader put back on the mode=ro open made
TestCindyHasClosedWALAndUnreadable red ("Cindy's folder changed:
cindy-local-v1.db -> cindy-local-v1.db,cindy-local-v1.db-shm,
cindy-local-v1.db-wal"); api.go ignoring `known` made
TestImportStatusUnreadableIsUnknown red. Both restored, both green.
Not tried: a real Cindy install; the read is tested on fixture
databases only.
|