1ccacad63281094de8a3372d5a507d38f9969e5c
7507
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
0e68455863 |
memory: pick how far back conversations are read, and the model's reasoning level (RealZeroP27 on X)
Learn from conversations read the last 7 days only (Back, fixed at switch-on) and asked its model with no reasoning level. Its row now has two more pickers, beside the model: - How far back it reads: 7 days (default), 30, 90, 1 year or All (State.Days; 0 stays 7 days, so an existing distill.json keeps its own Since until a range is picked). A longer range reads at once. Every range reads from the latest 400 conversations (memdistill.Listed) at 10 an hour (PerRun), so All is ~240 requests a day at most until the backlog is read; All's menu note says so. - Thinking: Default (none sent, as before) or one of the model's own levels, fitted and sent with room to think the way Vision and Searcher do (gateway.WithSideEffort over sideEffort/replyRoom/withFixedEffort). The nightly tidy uses the same level, and its row shows the picker when distilling is off. Fixed on the way, as the longer ranges depend on it: a conversation's mark was dropped after 30 days while Since stayed put, so anything older than 30 days inside Since was read again every hour. A mark is now dropped once it is before Since, or older than 30 days and past the oldest conversation listed. POST /api/memory/distill takes effort and days; a bad one is a 400. docs/subsystems/memory.md says all of this. Run (mote; first at base |
||
|
|
e697e7ddf6 |
tray: a plugin's menu bar card draws its stored picture, not its name's letter (#5772, guoxudong_ on X)
A plugin's quota card carries its picture as a stored "file:…" name (PluginIcon → StoreIcon), and the Usage page draws it. trayIconFile, which reads the menu bar card's logo, refused every name with a ':' in it, so the card fell back to the name's first letter. A picture the user gave their own provider was refused the same way. trayIconFile now reads a "file:" name as pageIconOf, its sibling for the day page, does: through provider.IconServed (IconFile's check, 16 hex digits and a picture's ending, so no path of the caller's own; the scaled copy for a big PNG/JPEG/WebP), at most maxPageIcon bytes, an SVG's arc flags spaced out as the bundled ones are. Anything else with a ':', '/' or '\' stays refused. Ported from sunny0826's fork (tray-plugin-logo, 080c11f98), reviewed for harm first: no new dependency, network, or path outside the icons folder. Changed from the fork: IconServed with the size cap and SVG arc flags in place of a raw IconFile read; the refusal test writes each file a refused name could reach, so it tests the check, not a missing file. Siblings: pageIconOf (day page) already reads stored pictures; app.js's icon() does too; only the macOS tray draws cell logos, and every tray goes through trayIconFile. Run (mote, darwin arm64, at this tree): - go test ./internal/gui ./internal/provider: ok. - gofmt -l internal/gui: clean. go vet (darwin), GOOS=linux -tags nogui, GOOS=windows on internal/gui and internal/provider: ok. - win-run TestTrayIconFileStored on xiaomi-gpu: ok (internal/gui, -run TestTrayIconFileStored). Broken by hand: - trayusage.go at origin/main: TestTrayIconFileStored and TestTrayImageStoredIcon fail (0 bytes for the stored picture). - IconServed swapped for filepath.Join(IconDir(), own): the test reads "file:mine.png", "file:../providers.json" and "file:0123456789abcdef.exe" and goes red. Not tried: a real plugin's card in the built app's menu bar (the fork's author reports it drawn, light and dark); the full suite runs after the tag. Co-authored-by: Xudong Guo <24563928+sunny0826@users.noreply.github.com> |
||
|
|
8287e24c79 |
usage: a card is as tall as what it holds, none stretched to the tallest (jen_celeus on X)
jen_celeus: the Usage cards didn't size to their content but filled the whole height, leaving a large empty space. packUsage gave the last card in each column a min-height down to where the tallest column ended (ikunbots on X, |
||
|
|
add47afd82 |
usage: a card's ⋯ opens its menu, Hide from Overview where it is seen (jen_celeus on X)
jen_celeus asked to hide providers with no usage information, OpenCode
Zen and the like, from Usage. The hide was already there
(UsageCardsHidden, Hide from Overview, the "n hidden" line with Unhide
and Show all), but it sat behind a right-click, a long press or the drag
handle's menu, and nobody found it. Each card's head now has a ⋯ button
(quotaCardMore), the Agents row's pattern: shown on hover and keyboard
focus, always shown where nothing hovers, opening the same menu
(quotaCardMenu, now anchored on the ⋯), a second click closing it. On a
phone it keeps 22px with a 44px-high hit area that stops at the card's
edge (an even -11px inset spilled past it: usage-accounts-fold,
usage-keys-fold and usage-shared-balance said "card spills"). The long
press leaves the ⋯ alone. Its label reuses "Actions for {name}", already
in every language.
Run (mote): usage-card-more.test.cjs (new: Claude beside a Zen card with
a plan and no windows; en, zh, zh-TW, ja, de at 1200, 560 and a 390 web
phone; chromium and webkit): the ⋯ is there with its label, hidden at
rest where hover is, shown on hover, never over the head's text where
nothing hovers, menu = Hide from Overview, toggles, the hide posts
{cardsHidden:["opencode-zen-free|plan"]}, no scroll, the "1 hidden"
line's Unhide brings it back, no page errors. The 154 GUI files that
load the Usage page plus i18n-keys, both engines: see the next commit's
record. gofmt; go vet darwin, linux -tags nogui, windows;
go test ./internal/gui/ (budgets) ok.
Broken by hand: without head.append(quotaCardMore(...)) the new test is
red in every subtest (chromium 0 of 16).
Not tried: the real app's WebKitGTK and Windows WebView2 windows; the
web page on a real phone.
|
||
|
|
4bfac12683 |
plugins: downloads take a proxy of their own, apart from the vendors' (JonahFu on X)
JonahFu on X: GitHub is unreachable without a proxy, while API requests may go direct, so plugin downloads' proxy should be set apart from the one model requests take. Before: plugin downloads already followed the global proxy (fetches through http.DefaultClient and netproxy.Func, bun add and git through netproxy.Env), so nothing ignored it; there was only no way to give them a different one. Now Settings › Network has a Plugin downloads row under Proxy: Same as above (the default, unset: downloads follow the global proxy as before), Direct, or Custom with its login, remembered as pluginProxyCustom as Proxy's Custom is. The CLI takes it as `magpie settings set pluginProxy <url|direct|"">`. It covers the plugins list and Discover's lists (fetchJSONFrom), a user's own npm registry (fetchRegistry), Bun's download (getURLFrom), bun add/update/remove and the git commands of GitHub-installed plugins (dlEnv). The plugin host (bun run) keeps the global proxy: its requests are the vendors'. Both fields belong to this computer (KeepOwn) and are left out of auto-backups, since a proxy URL may hold a password. Settings' Proxy row and the new one are drawn by one helper (proxyRow); the core's script budget is met by cutting the proxy rows' comments, no raise. Run (mote, through mote-run): gofmt -l clean; go vet of the touched packages (darwin), GOOS=linux -tags nogui ./..., GOOS=windows of the touched packages; go test -count=1 internal/settings, settingsapi, backup, netproxy, plugin, gui, cli all ok (gui after the comment cut; its first run had TestCoreScriptBudget 1,352 bytes over). GUI, chromium and webkit: settings-plugin-proxy (new, 5 languages x 2 widths), settings-proxy-remember, settings-proxy-auth, proxy-test, settings-sections, proxy-login-fields and the i18n files: 102 pass, 0 fail. plugin-proxy-page, proxy-own-wording, account-proxy, provider-proxy, routing-proxy, provider-many-keys-proxy and signin-proxy: 104 pass, 2 fail, both signin-proxy's "a subscription with no proxy offers the global one" at 380px in Chromium, red the same way on origin/main |
||
|
|
b596da773a |
gui: the core back in its budget after the check-in time (times_ang on X)
|
||
|
|
c0c5a4a892 |
gui tests: the Library's tab strip has Memory second and billion-context after RTK (#5850)
|
||
|
|
1cfea01695 |
sessions: Codex's per-poll name and twin sets are kept from poll to poll (#2278)
Each Sessions poll lists every Codex rollout (~13k here) and made two maps over them anew: distinctCodexFiles' first file of each name, and codexFilesIn's set of plain rollouts a compressed twin defers to. Both are now taken from a shelf, as pathSets are, and given back cleared; the shelf lets them go after it idles. Run on mote (M5 Pro, macOS 27), with a copy of the real accounts: - go vet ./internal/sessions; go test ./internal/sessions: ok. - TestDistinctCodexFilesKeepsItsSet (new): a call over 4,000 rollouts makes at most 4 allocations. Broken by hand (a new map each call): 47, red. The twin set has no test of its own; it uses pathSet as is. - /api/sessions and /api/sessions/stats?days=30 from a fresh start, real history: byte-identical to v0.1.3503's code. - 40 /api/sessions polls with X-Magpie-Had: 185.5 MB allocated before, 152.4 MB with this; distinctCodexFiles is gone from the profile. |
||
|
|
6ce663c0ce |
check-in: a time of day every daily check-in waits for (times_ang on X)
times_ang asked on X: 可以调整自动签到的时间吗. Before this, the daily
check-in had no time to choose. The loop first looks 2 minutes after start,
asks every 30 minutes, and asks as the Beijing day (UTC+8) turns. So an
account was checked in at the first look after 00:00 Beijing, on whatever
clock the computer kept.
settings.CheckinAt ("15:04", local time) is one time for every check-in:
the built-in WorkBuddy, Trae, MiniMax and Qoder ones and the plugins'
auth.checkin.
- checkinGate puts it on the Beijing day the account is checked in for:
the first HH:MM on the computer's clock at or after that day's start.
- The loop holds each account's first ask of a Beijing day until then,
and wakes at it.
- Within the day nothing changes: a vendor's own turn (a plugin's until),
retries and the before-noon recheck. So a vendor day is never skipped.
- Unset keeps today's behaviour.
- A press (Check in now, `magpie accounts checkin`) is never held.
Where to set it:
- The editor's check-in groups get a Check-in time row (Off/On and a time
box, as the warm-ups do), drawn by checkinnow.js so the core stays in
its budget.
- The Usage card's not-yet line says "checks in from 09:00".
- From the CLI: `magpie settings set checkinAt 09:00`.
Run (on mote unless named):
- go test ./internal/provider ./internal/gui ./internal/tui; settings,
settingsapi and cli.
- The check-in tests again with TZ=UTC and TZ=Pacific/Kiritimati.
- TestCheckinAt*/TestCheckinGate on Windows (win-run).
- TestCoreScriptBudget at the rebased head: 1,533,673 of 1,533,802.
- gofmt; go vet for darwin, linux (nogui) and windows.
- GUI: checkin-at.test.cjs (chromium and webkit, 1100 and 420 wide, en,
zh, zh-TW, ja, de) plus 27 more files the change reaches (check-in,
warm-at, provider-prefs, settings, i18n, gui-de/ja/zh-tw).
New tests, with the zone held in UTC+8 and in UTC-5:
- One ask per Beijing day, at the set time, with no day skipped.
- A press goes ahead of the time.
- A vendor whose day turns at 10:00 gets one ask a day at 20:00.
- Save refuses 25:00.
Broken by hand:
- The gate off: the Beijing 09:00, New York 23:30, press and vendor-day
cases went red.
- The row not drawn: checkin-at 0 of 40.
Not tried:
- Real vendor accounts.
- The real Linux app.
- The whole GUI suite; the full Go suite runs after the tag.
|
||
|
|
ef73a0b1ca |
claude bridge: a tool whose schema has a oneOf at its root reaches the model (Lee931018 on X)
Through the Claude subscription bridge, Codex desktop's browser tool mcp__cua_repl__js never reached a Claude model; mcp__cua_repl__js_reset did. The tools.json the run's Claude Code is handed carried each inputSchema as the client sent it, and cua_repl__js's is a oneOf of objects at the root, which Anthropic's API refuses, so Claude Code left the tool out. bridgeTools, the one place the bridge's tools are built (the first tools.json and the tools a ToolSearch loads mid-turn), now folds each schema with objectSchema / provider.ObjectRoot, as every Messages request magpie builds already is (anthropic.go) and as the gateway does for relays and xAI (object_root.go): the variants' properties merged, a field every variant requires stays required, allOf's required all kept. A schema with an object root goes byte for byte as it came. The checks of a call against the original schema (answer tool) are unchanged. Paths checked: Messages built from a translated request (objectSchema in anthropic.go), a Messages body passed through (objectRootsBody, folded for every upstream), Chat/Responses to relays (foldsRoots + retry on rootUnionRefusal), Grok (grokBody). The bridge was the only one left. Run (mote, at 48bea11dc): gofmt; go vet ./internal/gateway on darwin, linux (nogui, CGO off) and windows; go test -run 'TestClaudeBridge|ObjectRoot|OneOf|BridgeTools|ToolNames' ./internal/gateway: ok. Broken by hand: without the objectSchema line in bridgeTools, TestClaudeBridgeToolsHaveObjectRoots fails (oneOf/anyOf/allOf kept at the root, type missing). Not tried: a real Codex desktop with the cua browser plugin and a real Claude Code run; the whole internal/gateway package is queued behind mote's suite lock and runs after the tag. |
||
|
|
60f0433d1b |
dsh: a model of its own for DeepSeek Harness's compaction (Musikrv77852 on X, #5395)
DSH compacts on the session's latest model (compaction-basic with no summarizationModel). A session on magpie/workbuddy/deepseek-v4.1-flash switched to another model compacted on WorkBuddy first, got 429, and the switch failed. DeepSeek Harness's opened row on the Agents page now has a "compaction model" square (compact_model), offered once dsh is on magpie's route. It is magpie's own Live setting (settings.DshCompactModel), so nothing is written into dsh's profiles and no restart is needed. The gateway moves a dsh compaction to it (dshCompactTo, Route.Moved why "dsh-compact") when the model is enabled, served by its exact id and allowed to the key; else the compaction stays as asked with a log line. The Routing page says why. On magpie's llm-pi-ai routes DSH sends no x-deepseek-harness-compact mark, so its compaction is now known by compaction-basic's own ask (@deepseek-ai/dsh-compaction-basic 0.0.1-rc.3, the latest) in compactAsks. As a result DSH compactions show as Compaction in Usage and Routing, and a group's Compact rule reaches them too. The options are spelt magpie/<id> like the model field's, so `magpie dsh deepseek/flash` still sets the model (fieldForValue gives a bare value to the first field offering it). CLI: `magpie dsh compact_model magpie/deepseek/flash`; API: /api/set. zh, zh-TW, ja and de strings added. Run (mote): go test -count=1 -timeout 45m on internal/gateway, provider: ok at the base before the rebase on 0842bc517; agent, gui, settings, settingsapi, and the gateway's TestDsh/TestCompacting/ TestRuleCompact: ok at this head. The first agent run caught the square reading dsh's profiles at a stopped WSL distro (TestWSLColdPlaceOpensNothing, #3896); its options now look at nothing at a cold place. go vet on darwin, GOOS=linux -tags nogui and GOOS=windows: clean. gofmt clean. GUI in chromium and webkit: dsh-compact-model (new, 5 languages x 2 widths), desktop-subagent-model, codex-subagent-model, routing-moved-why, i18n-keys, i18n-en-no-cjk, claude-subagent-effort-row, codex-start-model-field, model-test-why and agent-connect-no-models: 140 of 140 pass; after the rebase (i18n.js changed upstream) i18n-keys, i18n-en-no-cjk, dsh-compact-model and routing-moved-why 48 of 48. Broken by hand, each red: dropping the compactAsks line (TestCompacting, TestDshCompactMoved on all three protocols), skipping the move in serve (TestDshCompactMoved), dropping the agent check (TestDshCompactLeft's other agent), taking the square out of extra() and dropping the routing story's case (dsh-compact-model.test.cjs). Not tried: a real DeepSeek Harness desktop app (none on this Mac or on mote); the compaction text was checked against the npm package's source. DS Bot's requests can't be told from dsh's, so its compactions follow the same setting, though it has no square of its own. |
||
|
|
0842bc517e |
gateway keys: a key may keep some accounts out and use every other, later ones too (LeiWang_2000 on X)
A gateway key could only be held to accounts picked one by one, so an account signed in after the key was saved was never used. An entry "<provider>/!<account>" (access.ExcludeMark) now keeps that account out: the key uses every other account of the provider, one added later too, and never the one kept out. - access: AllowsAccount refuses a kept-out account first, and counts only the entries naming accounts to use for "the providers it names", so a provider with only kept-out entries serves every other account. HeldModels and AccountModels ignore kept-out entries (keeping one out holds the key to no model). An issued key keeps out what its issuer does (foldAccounts). CleanAccounts resolves the ref after the mark and refuses an account both used and kept out. ReplaceAccount moves kept-out entries too. AccountsShown renders "X; every account but Z" for the CLI and the gateway's refusals. - CLI: `magpie gateway-key accounts <id> relay/!Second` prints "every account but relay/Second"; list and models read it. - GUI: the key row's menu has "Keep accounts out", which opens the app's menu (openProtoMenu, no native select); a badge names what is kept out and opens the same menu; an account the key was held to and is now kept out leaves the held ones. Strings in zh, zh-TW, ja and de. - docs: reference.md and providers-accounts.md. Run (mote, at this tree): - gofmt -l internal/ clean; go vet darwin, GOOS=linux -tags nogui and GOOS=windows of access, cli and gateway: clean. - go test -count=1 ./internal/access ./internal/cli ./internal/gateway: ok. New: TestKeptOutAccounts, TestKeptOutFolded, TestKeptOutReplaced; TestGatewayKeyKeptOutAccountsKeyedRoutes (chat, messages, responses, count_tokens, images, videos, System One and /v1/models over a key provider, a remote magpie and a Decide provider: the kept-out key never asked, every account kept out asks nothing, a key added after the gateway key was saved is used); TestGatewayKeyKeptOutCodexAccounts (Codex sign-ins, one signed in later used); TestGatewayKeyKeptOutQuotaCards; TestGatewayKeyAccountsCLI extended. - GUI: gateway-key-kept-out.test.cjs, chromium and webkit, 1100 and 440 px, en zh zh-TW ja de: 20 of 20. Every gateway-*.test.cjs and i18n-*.test.cjs file in both engines: 496 of 516, the 20 red all gateway-card's count of the row menu's items (5, now 6), updated here; then gateway-card, api-key-theme, gateway-connect-keys, gui-de, gui-ja and gui-zh-tw: 39 of 39. - Again after rebasing onto |
||
|
|
7c0a103eb1 |
sessions: a file's modification time is unix nanoseconds, 80 bytes a file (#2278)
A Sessions poll copies every session file's `file` into several slices (distinctOf, listedRollouts, listCCFiles, distinctCodexFiles), and rolloutsSeen keeps one of every Codex rollout. Its time.Time was 24 of its 96 bytes. mod is now a modTime (int64 nanoseconds, 0 for none) with the few methods the package used; a time.Time going in is modOf(t), one coming out is .Time(). UnixNano keeps the zero time's own value, so a parse kept on disk for a file with no time still matches. Run on mote (M5 Pro, macOS 27), with a copy of the real accounts: - go vet ./...; GOOS=linux and GOOS=windows go vet ./internal/sessions: ok. - go test ./internal/sessions ./internal/gui ./internal/usage: ok. - TestFileFitsEightyBytes (new) holds the size and the round trip of a time and of none. - /api/sessions and /api/sessions/stats?days=30 from a fresh start, real history (~23k files): byte-identical to v0.1.3499's code (8,068,574 and 623,801 bytes). - 40 /api/sessions polls with X-Magpie-Had: 208 MB allocated before, 185.5 MB with this. |
||
|
|
b922e51685 |
agents: nanobot gets magpie as a provider of its own (Niapyaya on X)
nanobot (HKUDS/nanobot, pip install nanobot-ai) is now an agent magpie connects. Its config is read from its own source (5c72ced, 0.4.1): ~/.nanobot/config.json, camelCase or snake_case keys, any extra key under providers an OpenAI-compatible endpoint whose name is stripped from the model. magpie adds providers.magpie (apiBase at the gateway's /v1, its key, and extraHeaders User-Agent nanobot), and sets agents.defaults provider magpie, model magpie/<id> and contextWindowTokens when the window is known. What the user had there, both spellings, and a modelPreset that would go over magpie's model, is stashed and put back on disconnect, the window as a number. A file magpie made goes again. Also in WSL distros, with a notice in every language, the icon (a tile in app.css's rule), READMEs, site list, docs/reference.md and agent-wiring.md. Run: - real nanobot 0.4.1 on mote in a sandbox HOME (~/nbsb), a sandbox gateway on 47812 over a fake OpenAI upstream: `magpie nanobot magpie/fakeup/m1` wrote the config and kept the user's relay provider and channels; `nanobot agent -m ping` answered "pong from fake upstream"; the upstream saw POST /v1/chat/completions, model m1, UA nanobot; `magpie nanobot default` put relay/glm-4.6 back exactly. - go test ./internal/agent ./internal/gui ok; ./internal/gateway and ./internal/cli -run 'Client|UA|Agent|Empryo' ok; go vet darwin, linux -tags nogui, windows ok; gofmt -l clean. - GUI, chromium 110/110 and webkit 65/65: i18n-keys, i18n-en-no-cjk, agent-notice-lang, gui-de, gui-ja, gui-zh-tw, icon-one-tone, icon-tile, routing-client-icons, usage-agent-filter-icons, agent-connect, agent-models, agent-layout. Broken by hand, each red in TestNanobot: modelPreset not stashed (preset left over magpie's model), the made file not removed, and the window restored as a string. Not tried: a real vendor behind the gateway (fake upstream only), nanobot's long-running `nanobot gateway`/WebUI picking the change up live, and WSL. |
||
|
|
4869d0c966 |
library: an MCP server switches off for every agent and app, and on again as it was (swang20201 on X)
An installed server in Library could only be removed. Each server row
now has a switch after its agent chips. Per-agent chips already
existed, but in Docker gateway mode there are none, and the MCP router
gives every server to any app at its address, so nothing could turn a
server off there.
ServerOn (POST /api/library/servers/on, `magpie library mcp off|on
<name>`) reuses the Hidden/Paused pair a plugin's hidden server
already has. Off: Hidden, with its agents kept in Paused. On: those
agents get it back, or none when it had none, so the router gives it
to other apps again. Its command, env, headers, sign-in, DisabledTools
and note stay in library.json. Off, it is also left out of every
project's files (syncProjectMCP) and of subagents' mcpServers
(renderSubagent), which before had only skipped a server gone from
the library. The router's held process ends on the next prune,
because Hidden/Paused are in its hubKey. An off row is dimmed, its
chips take no click, and it is health-checked only on a click.
Strings are in zh, zh-TW, ja and de. docs/subsystems/library.md has
a row for it, and mcp-router.md names it.
Run (mote):
- go test ./internal/library ./internal/cli ./internal/gui: ok.
- go vet ./..., GOOS=linux -tags nogui, GOOS=windows: ok.
- gofmt -l: empty.
- GUI: the 145 files that touch the Library, i18n-keys and gui-*, in
chromium and webkit. 2798 of 2881 passed.
- i18n-keys was red because the key "{name} on" also matched core's
"{name} on magpie". The key is now "Turn {name} on or off", and
i18n-keys and library-mcp-on are green (26/26).
- Nine files are red the same way on a clean origin/main
|
||
|
|
2545bce6e7 |
gui: an update keeps the Mac's menu bar icon where the user put it (imty42 on X, #3873)
imty42 on X, #3873 (wei9312, hey-yx, EXHades): after every update the
menu bar icon the user had Cmd-dragged (or Ice had put in its visible
section) went back to the default spot, far left, which in Ice is the
hidden section. EXHades' defaults after an update held only "magpie tray
brought back after a handover", no "NSStatusItem Preferred Position
Item-0".
Cause:
|
||
|
|
217d778481 |
dirent: each folder keeps its listing before last as room for its next (#2278)
A Sessions poll lists every Codex day folder and Claude Code project. The few rooms given back were shared by all of them, so a small folder's room went to a large one and was grown again, entry by entry, on every poll: 78 MB of 40 unchanged polls with the real page's X-Magpie-Had, the largest single site. Each folder now keeps the listing before its last, cleared, as its own room (keepSpare), inside the same keptEntries bound; the shared rooms are left for folders seen the first time. Run on mote (M5 Pro, macOS 27), with a copy of the real accounts: - go test ./internal/dirent ./internal/sessions: ok. - TestListingsOfDifferentSizesMadeOnce (new): five folders of 1 to 600 files read ten times allocate under 64 KB. Broken by hand (taken never hands back the spare): 394,808 bytes, red. - 40 /api/sessions polls with X-Magpie-Had, real history (~23k session files): 282 MB allocated at v0.1.3492's code, 208 MB with this; the dirent.entry append is gone from the profile. Not changed: distinctOf's slice (1.6 MB a poll). Holding it would keep as much resident as it saves in garbage. |
||
|
|
0549e5301a |
masking: Send requests unmasked is found from Settings › Privacy and holds on every route (CrazyMouse_TT on X)
CrazyMouse_TT runs a model of their own and wanted masking off for it.
The switch already existed (the provider editor's Advanced › Send requests
unmasked, provider.Unredacted), but nothing near masking pointed to it,
and it held only on chat-shaped routes.
- Settings › Privacy has a "Sent unmasked" row: each provider set so is a
button that opens its editor with Advanced open; with none, the row says
where the switch is (settingsJSON.UnmaskedProviders, redact plugin's
unmaskedRow).
- Images (draw.go), videos (video.go) and Ark's own API (native.go) go as
written when every model they may go to is such a provider
(unmaskedMembers); a group with one member left on stays masked, as a
chat's route does (unredactedRoute).
- A Remote magpie may be set so too (SkipsRedaction no longer refuses
it): it is sent the request as written with no X-Magpie-Masked-As, so
it masks by its own Settings and switches, once, before any vendor
(1d6d263ee's hop). Left off, it is masked here, as before. The editor
says so for a remote magpie.
- Default stays off for every provider: nothing changes for anyone who
hasn't ticked it.
app.js stays under TestCoreScriptBudget by a shorter unmaskRow call and
three trimmed comments (app.js -51 bytes vs base).
Run (mote, at this tree): gofmt -l clean; go vet darwin, GOOS=linux
-tags nogui, GOOS=windows clean; go test -count=1 ./internal/gateway
./internal/provider ./internal/cli ./internal/masking ./internal/gui ok.
GUI (chromium + webkit, 5 languages, 1100/440px):
provider-unmasked, unmasked-providers, i18n-keys, i18n-en-no-cjk,
redact-route: 126 pass, 0 fail. masking-records.test.cjs is red the same
on origin/main
|
||
|
|
9309e28ced |
plugins: a plugin's provider in front of a vendor's API is that vendor to the gateway (songlairui on X, #5462, #5464)
A plugin whose provider's `api` is on a vendor's preset host (a Mistral Vibe plugin's https://api.mistral.ai/v1) got none of what magpie does for that vendor, since its Host() is the plugin's id. An earlier turn's thinking went to the plugin's fetch as reasoning_content, and Mistral turned the whole request away (422 extra_forbidden); the plugin had to rewrite the body itself. provider.VendorHost and VendorPreset now resolve a plugin's declared `api` host to the preset that names it (every Chat, Responses and Anthropic base of every preset and region; local and remote magpie presets excluded, and an api on loopback, a private address, .local or .localhost names no vendor). For every other provider, and a moved subscription, they are Host() and Preset as before. The gateway's vendor checks read them: 38 p.Host() sites, Mistral's, OpenRouter's, DeepSeek's, Kimi's and DashScope's preset checks. Host() stays the plugin's id where calls are kept and shown; requests still go only to the plugin's fetch. Search and the video plan check are unchanged. No community plugin's api is on a preset host today (checked at plugins 7b52e3fc), so none changes. Any plugin gets this with no new field; documented in docs/subsystems/provider-plugins.md and the plugin docs (en, zh, ja). Run (mote): go vet ./... darwin, GOOS=linux -tags nogui, GOOS=windows; go test -count=1 -timeout 45m ./internal/provider ./internal/plugin ./internal/gateway: ok (provider 209s, plugin 182s, gateway 1002s). gofmt -l clean. Broken by hand: pluginVendor resolving nothing (the old behaviour) turns TestPluginVendor red, and TestPluginInFrontOfMistralIsMistral red on both halves: the translated Claude Code turn is answered Mistral's 422 extra_forbidden, and the relayed Chat request carries reasoning_content. Not tried: a real Mistral Vibe key through the reporter's plugin; Windows and Linux runs of the tests (no OS-specific code). |
||
|
|
b75aff1073 |
library: billion-context for Zed through its /bili/ prefix (CoMi6818 on X)
billion-context's README lists Zed, but Library's billion-context tab offered only Pi, omp, OpenCode and Claude Code. Zed has no plugin of bili's. Upstream gives it two routes: `bili zed`, a Linux-only launcher that leaves a provider on loopback direct (so it never passes magpie's gateway), and, on every system, the /bili/ prefix its docs give any client whose model address can be edited, with `bili start` answering on 8787. Zed is now a URL lane (biliURLLanes, internal/library/bili_url.go). Switched on, magpie has bili start answer (one the user runs is used; else magpie runs its own under KeepLinked's context, logged to bili-start.log, and starts it again at magpie's start while Zed is on), then agent.ZedThrough sets the magpie provider's api_url to http://127.0.0.1:8787/bili/<gateway>/v1 and saves the key for that address in the credential store, where Zed looks it up by address. A pick and a sync keep the prefix while magpie answers through it (zedReach, #1985's proxy recognition). Off puts api_url back on the gateway and ends magpie's bili start when nothing goes through it. Zed must be on magpie first; the error says to pick a magpie model. Run: - bili 0.1.213 on mote: bili start --port N, then /bili/http://127.0.0.1:<fake magpie>/v1 forwarded GET /, GET /v1/models and POST /v1/chat/completions with Authorization kept and bili's tools injected (repro/zedroute.sh). - mote: go test -tags nogui ./internal/library ./internal/agent (full packages), go vet darwin, GOOS=linux -tags nogui, GOOS=windows. - mote: library-bili, i18n-keys, i18n-en-no-cjk GUI tests (chromium and webkit). - win-run: go test ./internal/agent ./internal/library -run 'TestZed|TestBili'. - gofmt -l clean. Broken by hand: SetBili without the URL-lane dispatch, and zedReach without the proxy keep: TestBiliZedThroughPrefix and TestZedThroughBili go red; restored, green. Not tried: a real Zed app through bili (no Zed on mote), and the real keychain write (zedCredential stubbed in tests, as before). Other clients upstream lists (Cline/Roo/Kilo, Continue, OpenHands, Void, Cursor, Warp, launcher-only lanes) are not added here. |
||
|
|
ffc69f0244 |
codex: an account can keep its access token only, never renewed (EastonXvii on X)
A Codex account can now be imported, or ticked later, as "Access token only". magpie uses the access token it was given and never refreshes it. The refresh token is never spent or rotated, so another computer signed in to the same ChatGPT account stays signed in. - Every renewal of a saved account goes through renewSaved. For an access-only account it calls accessOnlyToken, which hands out the token until it runs out and never calls codexRefresh. That covers requests, usage reads, the idle read, models, resets, warm-up, the 401 recovery and the keep-alive, which also skips such accounts. - Once the token runs out, the account is marked Lapsed with refreshRefused. The provider editor shows "Access expired" and "Import again", which opens the import with the tick set. A new import or sign-in replaces the entry and clears both. - Such an account is never switched into Codex, since Codex would renew it. That applies to switchable, switchSavedLogin, NextLogin, keep-as and signInToFirst. The live or held account can't be made access-only (errAccessOnlyHeld). Its row says "magpie only". - Import: ImportCodexAccessOnly accepts files that have only an access token, refuses an expired token or a missing id_token, and makes no refresh call. CLI: `magpie accounts import codex --access-only`, `magpie accounts access-only codex <email> [on|off]`. GUI: the import box tick, the row tick and POST /api/login/access-only|renewed. - The core scripts stay within budget: app.js is smaller than main's. This change's own comments and nine sign-in/import comment blocks were cut, with no raise. Run (on mote): - gofmt -l clean; go vet for darwin, linux (nogui) and windows ok. - go test ./internal/provider ./internal/cli ./internal/gui ok. - GUI files in chromium and webkit, en and zh: codex-access-only (new), login-import, account-return, i18n-keys, account-row-line, agent-switch-accounts and signin-paste-import: 64/64 at the final tree. In an earlier grouped run, signin-paste-import failed once on its Import button's wait. It then passed 6/6 alone and in the rerun. Broken by hand: - With the renewSaved branch and the keep-alive skip taken out, TestCodexAccessOnlyNeverRefreshed went red: the keep-alive renewed the account. TestCodexAccessOnlyRunOutLapses went red too: a run-out token was handed out. - With the branch and the import path taken out, a forced renewal went through and an expired-token import was "added". Both tests went red. Not tried: a real ChatGPT account, so I did not check that another computer stays signed in. No Windows run, since nothing here differs by OS. |
||
|
|
3aa55065a3 |
library: Claude Code keeps its auto-compaction beside billion-context (Kling__Lab on X)
Kling__Lab's Claude Code stopped after a little use with "Prompt is too long", every message answered at once (作業時間 0s) with nothing sent. bili's Claude Code install writes DISABLE_AUTO_COMPACT=1 into the shared ~/.claude/settings.json. A session bili doesn't fold then has nothing to keep it under the window: the Claude desktop app's Code tab runs Claude Code on that settings.json with its own ANTHROPIC_BASE_URL, past bili's proxy (bili's own #2290), and a window bili takes larger than the one magpie serves lets the session reach it first. With auto-compaction off, Claude Code blocks locally at about window-3000 and returns "Prompt is too long" without a request. magpie now writes "0" in place of bili's added "1" right after the install. bili leaves a value that isn't "1" as the user's, through its SessionStart hook and a reinstall, and its remove takes only a "1". So auto-compaction stays on as a backstop at the window magpie wrote (CLAUDE_CODE_AUTO_COMPACT_WINDOW), which bili, when it does fold, keeps the session under. A DISABLE_AUTO_COMPACT the user had before the install is left as theirs. A plugin magpie installed before this is mended from KeepLinked at start, and its bili-plugins.json record says "0" too, so switching it off still puts the file back as it was. Reproduced on mote with Claude Code 2.1.321 and billion-context 0.1.213 against a fake gateway reporting 195000 input tokens on a 200000 window: with DISABLE_AUTO_COMPACT=1 the second turn is "Prompt is too long" with no request sent; with 0 it compacts and goes on. Run (mote-run): go test -tags nogui ./internal/library -run 'TestBili|TestParseBiliList' -v, all ok, including the new TestBiliClaudeKeepsAutoCompact (on and off, the user's own value, a plugin installed before), then the whole package (go test -tags nogui ./internal/library ok, 154s). gofmt -l clean; go vet ./internal/library ./internal/gui/..., GOOS=linux -tags nogui and GOOS=windows go vet ./internal/library ok. Broken by hand: biliKeepCompact returning at once. The new test's "on and off" and "installed before" went red (DISABLE_AUTO_COMPACT = 1 after the install / after magpie started), "the user's own" stayed green. Not tried: the real Claude desktop app's Code tab, and a real bili install on a real account; the fake bili in the test copies bili 0.1.213's "1 only when absent or 1" rule, read from its source. |
||
|
|
9430c53093 |
docs: the host's own renewal backoff and held refused lists (JZGiVvkSOA75376 on X)
Run for this stack ( |
||
|
|
16dcfa504a |
plugin: a models hook that refused a sign-in isn't asked again for it at once (JZGiVvkSOA75376 on X)
Two dead Zed sign-ins were listed ~30 times a minute, each listing asking Zed for a model token and getting 401 again. A models hook that throws with signIn "expired" is now held for that sign-in (its access, refresh or key): the listing falls back as it did, with the same error, and the hook isn't asked until the same backoff as a failed renewal (30s doubling to 30 minutes) has passed. Signing in again asks at once. This is in the host, so it holds for every plugin, not only Zed. Run: go test -run 'TestRefusedListIsNotAskedAgain|TestFetchBuildsInfoOnce| TestPluginRenewsSignIns|TestRenewRetryBacksOff' ./internal/plugin on mote: ok. Broken by hand: skipping the hold makes TestRefusedListIsNotAskedAgain red (3 listings asked 3 more times). |
||
|
|
6e2dcc4a10 |
plugin: a sign-in that won't renew is asked again later and later, not at once (JZGiVvkSOA75376 on X)
Two dead ima accounts (magpie-ima-auth 0.3.0) were renewed ~80 times a minute: its auth.refresh catches ima's "sign in again", warns and gives back undefined, and the host took that as "nothing to do" without noting a failure, so every request, models listing and usage read asked again. A refresh that gives nothing back while the sign-in is due now counts as a failed renewal. A failed renewal of the same sign-in waits 30s, then doubles each time up to 30 minutes, for every plugin; a new sign-in starts afresh, and one the vendor turned away for good is still never tried again. Run: go test -run 'TestPluginRenewsSignIns|TestRenewRetryBacksOff|TestAuthLock' ./internal/plugin on mote: ok. Broken by hand: dropping the failure note on an empty refresh makes TestPluginRenewsSignIns red (r-none renewed three times); a flat 30s retry makes TestRenewRetryBacksOff red. |
||
|
|
1b078d404b |
gui: a state poll encodes into buffers kept from the last one, and Codex's own models are read without a copy
Each /api/state poll json.Marshal'd the state without its agents twice (to send it and for keepState's sum) into fresh slices, and made a new 32KB writer; ownCodex cloned Codex's whole model list for a caller that only reads it. One set of buffers and the writer is now kept between polls (an atomic slot, not a sync.Pool, which a GC between polls empties; a poll that finds it taken makes its own, and buffers over 4MB are dropped), and ownCodex reads catalog.CodexShared. Run on mote at this tree: go vet ./internal/gui ./internal/agent; go test -run "State|Settings|Allow" ./internal/gui, the same -race for StateWritten, -run "Codex|OwnCodex|Pick" ./internal/agent: ok. TestStateWrittenAsEncoded now writes big after small and small after big; with encodeTo's Reset taken out by hand it is red (a stale tail). Real accounts, 40 polls of /api/state, alloc_space: 27.8 and 26.1 MB before, 18.4 and 22.7 MB after. Not tried: Windows and Linux runs (no OS-specific code). |
||
|
|
f90414f884 |
usage: the chart tests know the Traffic metric (ca5e537ec)
|
||
|
|
47f70a077f |
perf: the allow list and state read settings without a copy of their own
Every request served by the GUI and the gateway goes through AllowGuard, and AllowGuard read the allow list through settings.LoadChecked. That call reflect-copies the whole Settings each time. /api/state did the same through Load, then only encoded the result. Changes: - New settings.SharedChecked(). It is Shared plus LoadChecked's error. While settings.json parses whole it returns the settings parse already keeps, with no copy. Otherwise, or while a write is in progress, it falls back to loadChecked, so an unreadable file is still unknown, never an empty list. - allowList reads AllowIPs through SharedChecked. - state() reads settings through Shared. Nothing in gui writes into stateJSON.Settings (grepped for field, map and append writes). Measured on mote with the real-account sandbox, allocations under Settings.clone/deepCopy over 40 /api/state polls: - before: 1.5 MB and 1 MB - after: 0 and 0 The totals vary run to run (t32 34.6-35.1 MB, t33 24.8-30.8 MB). Run on mote: - go vet on settings, gateway and gui. - go test, all of internal/settings. - go test, internal/gateway -run "Allow|Remote|LAN|Lan|Origin|Guard". - go test, internal/gui -run "State|Settings|Allow". All ok. New test: TestSharedCheckedReadsOnceAndKnowsUnknown checks that a change is read and that a file that doesn't parse is an error. With the shared path broken by hand (made to fall through to loadChecked), it goes red: 24 allocations against LoadChecked's 24. Not tried: the full gateway and gui suites. |
||
|
|
1d6d263ee0 |
gateway: a hop to a Remote magpie masks once and isn't retried over the remote's own retries (YeYaka88 on X)
YeYaka88 on X: with magpie desktop using another computer's `magpie
serve` as a Remote magpie, the gateway, routing and masking all ran
twice. Reproduced with two sandboxed magpies on mote (old binary, a fake
OpenAI vendor behind the remote, the same masking settings on both):
- masking: the request reached the vendor masked once, but the remote
ran its masker again over the already-masked body (masking_ms on the
remote's usage row; with the local model on, a second model pass).
- routing: with the vendor answering 503, ONE agent request asked the
vendor 35 times over 174s. The remote ran its 7 tries (~33s) and
answered 503; the local magpie's same-one retries and patience then
asked the remote again, 5 times, each running all 7 again. The remote's
ledger got 6 calls for one request.
What changed:
- Retries: a failure the remote answered after its own routing (its
reply names its provider, X-Magpie-Provider, kept by keepRetry as
answeredThereHeader) is not retried on the same remote by passing()
(same-one retries, keptAgain) nor put in patience's next round
(routedThere). This magpie's other members are still asked; a remote
that can't be reached, or refuses before routing (its key, the key's
limit), is retried as before.
- Masking stays on the sending computer, on purpose: the values never
leave it (not on the wire, not in the remote's session records), and an
older remote still gets a masked request. After masking, serve and
countTokens note what they masked by (ownMaskedAs: this build's version
plus masking.Fingerprint, a hash of every setting that changes what is
masked, the local model and its threshold included, never the words),
and passOnCaller sends it as X-Magpie-Masked-As. The remote skips its
own pass only when the value equals its own, and passes it on to a
further magpie. Different settings or build, no header, a request not
a magpie's (magpieAsks) or a remote with a masked-request route
(RedactRouteTo) mask again: two sets of rules are both applied, on
purpose. The header is stripped on arrival (withCaller) and from every
vendor request. A client holding a key can send it only for its own
request, so it can only leave its own text unmasked.
- Usage is still recorded on both sides (each computer's ledger), by
design.
Run:
- mote-run go test -timeout 45m ./internal/gateway ./internal/masking:
ok (gateway 982s, masking 1.7s)
- new tests TestRemoteMagpieMasksOnce,
TestRemoteMagpieMasksWhatItIsNotToldWasMasked,
TestRemoteMagpieRoutedFailureNotAskedAgain, TestFingerprint
- broken by hand (maskedBefore always false, routedThere always false):
the three gateway tests went red ("masked 2 times", "masked again 1
times", "asked 15 times"), green restored
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows
on ./internal/gateway ./internal/masking
- the two-instance run on mote, new binary: busy vendor asked 7 times in
33s (was 35 in 174s), remote ledger 1 failed call with tries 7 (was 6),
remote usage rows carry no masking_ms (was masked again), vendor still
got {{TERM_…}}/{{API_KEY_…}} placeholders and the agent its values back
Not tried: a remote on an older magpie (it masks again, as before, and
its 503 carries X-Magpie-Provider since remoteModelRest); the local model
masker on both sides with a real model; images/embeddings/video hops,
which still mask on both sides; GUI untouched.
|
||
|
|
65f93ac27d |
routing: a group's member may be pinned to one account, tried in the group's order (EastonXvii on X)
EastonXvii asked for a group like Codex/Astra on account A, then Astra on B, then Sol on C, tried strictly in that order, with the same model on two accounts as two members. Before this, Group.Accounts held the whole group to a set of accounts with no order among one provider's accounts, so the only way was one group per account. A member id may now end with the account: provider/model[:effort][:fast]#<account> (provider.MemberAccount, groupaccount.go). - Every list keyed by a member's spelling (rules, Fast, Off, Weights, Placed, EffortMaps, Pick) and membersFound's dedup key include it, so the same model on two accounts is two members. The vendor is still asked for the model's own id. A group saved before has no "#" and reads as it did. - SaveGroup stores the account's stable id (a typed name is resolved by ResolveAccount). It refuses an account on group/ and auto/ members, and a new account magpie doesn't have. One the stored group had already that is gone since stays, matching nothing. - Gateway: planLevel's keys() leaves the provider's other accounts out for such a member (memberHeld; Held rows with HeldOwn in the trace). Fallback goes to the next member, never to another account under the same member. count_tokens counts on the resolved member's account (heldByGroupAt). Images and videos: drawingTries keeps one try per member account, and each try runs on a request held to that account (memberOn). - Sharing and importing a group drop members' accounts. - GUI: Routing → edit a group → each model row has an account chip (openPicker menu): "Any account", each account, and "Also on another account…", which adds the model on a free account as a member of its own after the row. Strings in en, zh, zh-TW, ja, de. - CLI: models=relay/m#B,relay/m#A,other/m (by name or id); show prints "on <name> alone". TUI effort cycling keeps the account. Run (mote, at the pushed head after rebasing on |
||
|
|
40d39e1176 |
provider: Codex's account is read every 30 minutes while Codex sits idle
dludream on Discord: with Codex signed in, magpie asked chatgpt.com every
five minutes, 288 times a day, used or not, and they worry about ban
risk. KeepOnAnAccountWithRoom read the account Codex is signed in to
(/wham/usage, through SwitchWhenSpent, CodexUsedUp and the app-left
restart) on every full look, every loginSwitchEvery.
Now a full look reads Codex's accounts only when codexDue says so:
- while no Codex session file was written in 30 minutes
(codexSessionsQuiet over CODEX_HOME/sessions) and the account isn't
near out, the next read is codexIdleLookEvery (30m) later;
- a session written again makes the next full look (5 minutes at most)
read it;
- near out or held, it is codexNearOutEvery (1m) as before;
- a sessions folder that can't be read counts as written, so the
cadence stays 5 minutes.
Claude's looks, the proxy sync and noteCodexGoneNow keep their cadence.
Requests magpie sends on the account keep its windows current from the
reply headers (NoteCodexLimits), so routing doesn't lean on the poll.
docs/reference.md says the new cadence.
Run at this tree (origin/main
|
||
|
|
079da3a785 |
perf: a state poll lists dsh profiles once, and skips work for Codex's models and gateway base
Each /api/state poll redid work for each agent row. That work is now done
once, or skipped:
- dsh's profile list is held for the request (dshProfilesHeld). dshModern,
Joined and dshLead each globbed profiles/*/cordis.patch.yml again.
Writers still call dshProfiles.
- CodexSignInGone reads the record first. With nothing on record for the
home, the usual case, it no longer parses auth.json and hashes the
refresh token on each look. A record that can't be read answers as
before.
- Codex's effort field reads catalog.CodexShared(), which doesn't copy.
With both lists, they are joined into one presized slice.
- codexViaMagpieFor builds one presized slice instead of two that grow
and are then joined.
- onAnotherMachine answers a plain loopback base (localhost, 127.0.0.1,
[::1], digits-only port, no user info) without url.Parse. Anything
else still goes through url.Parse.
Measured on mote with the real-account sandbox, allocations over 40
/api/state polls, two alternating pairs:
- before (
|
||
|
|
5c47d59b56 |
gui tests: settings-groups waits for a pill's thumb to be refitted (#5839)
thumbsUnderPicks measured each pill's thumb once, straight after the editor opened. The thumb is refitted by a ResizeObserver (thumbFit) once the editor sizes its pill, so on a busy machine the measurement could come first: "codex/wb: the pills' thumbs under their picks, 1 !== 0", 3 of 13 runs beside other GUI files on mote. It now waits up to 3s for every thumb to sit under its pick, then asserts as before. Run (mote, at this tree): settings-groups, editor-chips-wheel and provider-models-rest at --test-concurrency=4, 8 times: settings-groups green every time (provider-models-rest's reds are #4396). Broken by hand: thumbFit's refit turned off, settings-groups red (codex's thumbs, 4 subtests), then put back. |
||
|
|
62a9ab743f |
update: Stable's "Up to date" names the newest version out (ylspcm on X)
ylspcm (macOS) on X: Check for updates always says up to date, but the
installed version is behind, so they reinstall from the site each time.
On Settings' Stable channel the feed answers Stable's weekly version.
An app installed from the site is newer than that, so every check
answered "Up to date" while newer releases were out on Every version,
and the Version row never named the channel. `magpie update` already
said "up to date on the stable channel"; the app didn't.
Now, on Stable with nothing newer there, the check also asks the feed
on every version (update.LatestEvery, before u.mu is taken).
/api/update says channel "stable" and, when it is newer than this one,
newest. The Version row reads "Up to date on Stable · {v} is out on
Every version" with Switch to Every version, which saves the channel
and the existing channel-change path checks again. With nothing newer
it says "Up to date on Stable". On every version nothing changes, and
there is no second request. en, zh, zh-TW, ja, de. reference.md's
Update channel section says so. The row's code fits in the core
script budget with four of renderUpdate's comments cut, no raise
(1,533,753 of 1,533,802).
The cause is inferred, not confirmed: the tweet gives no channel or
version. The live feed has every version at 0.1.3476 and Stable at
0.1.3078. The rest of the check (semver compare, bundle, mirrors, the
worker's 5-minute cache) gave "Up to date" only for a feed answering a
version at or below the running one.
Run on mote at this change on
|
||
|
|
3cfbc19b05 |
gui: the wheel over a short model list scrolls the provider editor on
A provider's model chips held the wheel with overscroll-behavior: contain on .mchips itself. Chromium holds the wheel in such a box even when it doesn't overflow, so with the pointer over a short list (the chips fit) the editor's body never scrolled on to the Advanced fields under it. The chips now hold the wheel only while they overflow, through the app's :where(.holds) (set by holds() on pointerover and wheel), like every other scrolling list. A long list still scrolls on its own and keeps the wheel at its ends. Test: editor-chips-wheel.test.cjs, Chromium and WebKit at 900x700. Three chips: the wheel over them scrolls the editor's body, the page never. Two hundred: the chips scroll to their end, then three more wheels leave the body where it was. Broken by hand, each red, then put back: - the old .mchips rule: Chromium red, the body stayed at 0 under the short list. - .holds not given to the chips (contain removed with nothing in its place): red both engines, the body ran on 173 -> 353 past the long list's end. Run (mote, at this tree on |
||
|
|
216ac6f850 |
edit, agent: Grok Build's own model tables are read in one pass with nothing built, and its efforts read the shared list
What /api/state still allocated for Grok Build with real accounts, forty
polls on mote (t30):
- grokOwnOptions asked GetTOMLTable for each [model."<id>"] table of
~/.grok/config.toml: a stat and a fresh map a table on every look
(4.6 MB). edit.EachTOMLTable walks the file's kept parse once and
hands each ordinary table, in TOMLTables' order, with Scalar reading
a key as GetTOMLTable's map has it (the last of a key written twice).
- the model field's efforts took magpieModels("grok"), a copy of the
whole list per look, to read one entry (4.5 MB). It reads
sharedModels; catalog.Efforts already returned a slice of the shared
entry.
Measured on mote, sandbox HOME with the owner's real account data, 5
warm-up then 40 calls, paired runs:
/api/state t30 42.3 / 43.2 MB -> t31 33.2 / 38.1 MB (-16%)
No GetTOMLTable, grokOwnOptions or magpieModels frame is left in t31's
top list.
Tests:
- TestEachTOMLTableAgreesWithGetTOMLTable: 200 model tables, an array
table and a plain one; names match TOMLTables, every Scalar matches
GetTOMLTable's map, a look allocates at most 5 times, a missing file
has no tables and no error.
Run on mote at this tree: gofmt -l clean; go vet of edit and agent;
go test -count=1 of internal/edit and internal/agent (247s): ok.
Not run: the full ./... suite and the GUI suite; no JS changed.
|
||
|
|
ca5e537ecb |
usage: traffic over time in Requests' chart, and how fast it flows now (songlairui on X)
songlairui on X asked for the gateway's bandwidth: many LLM calls, base64
images above all, weigh on the network. Each request's row already kept
its bytes up (UpBytes) and down (DownBytes), shown in its details and as
the period's "↑ · ↓" under the Requests card. What was missing was
bandwidth over time and right now.
- The Requests chart's metrics take Traffic: each hour's/day's bytes up and
down, stacked by model, provider or agent. Its axis is in bytes ("4 MB"),
its tooltip splits a column into "↑ up · ↓ down", and the ranking's
values are bytes with the same split under each. A period with none
says "No traffic counted in this period". A chart point's Part now
carries up_bytes/down_bytes, from rows (Part.add) and from the request
page's cells (Part.plus). The cells already kept Totals, so no cache
version bump is needed.
- While requests are in flight, the Requests card says how fast traffic
flows now: "↑ 1.0 MB/s · ↓ 40 KB/s", over the last ~3s, read from the
new GET /api/usage/traffic a second apart. That route reports the
gateway's running totals (Server.Traffic) and its requests in flight.
The totals are atomics added where a row's bytes are added (sentUp,
downCount.Read). So a stream counts as it arrives, nothing is buffered
or scanned, and the totals and rows count the same bytes once. Polling
runs only while Usage → Requests is shown and the window is visible.
The line goes when nothing is in flight and nothing flowed. When another
magpie serves the gateway, the route answers {} and the page shows no
rate.
A Codex turn on the Responses WebSocket (
|
||
|
|
e364d27fce |
agent, provider, profile: a state poll builds no agents per profile, keys dsh entries without joining them, and works out renames once a change
What /api/state still allocated with real accounts, forty polls on mote
(t29, 76 and 83 MB):
- profile.Details built every agent again for each profile listed
(7 MB). DetailsIn takes the agents the page already holds for its
request; Details keeps its signature for other callers.
- dshNodeShared joined an entry's lines into a string to key its parsed
node (5.7 MB). It now hashes the lines with maphash and checks them
against its own copy, so a hit allocates nothing; a caller changing
its slice in place still gets the new text.
- dsh's Joined check read and parsed the first profile's list each poll
(5.2 MB). It uses dshLook, the parse shared until the file changes;
dshOver only changes a copy of the items.
- provider.UsageRenames parsed the whole providers.json for each
profile's in-use check (5.1 MB). It is worked out through filememo
once per change; a file that doesn't decode goes through read's own
last-good path as before.
Measured on mote, sandbox HOME with the owner's real account data, 5
warm-up then 40 calls, paired runs:
/api/state t29 82.9 / 76.0 MB -> t30 38.1 / 47.4 MB (-46%)
/api/drift t29 7.3 / 5.5 MB -> t30 9.7 / 7.1 MB (512 kB sampling
noise: no dsh or renames frame in either top list)
Tests:
- TestUsageRenamesParsedOnceAChange: 60 providers, a look at unchanged
renames allocates at most 10 times, a rename since shows at once.
Red on the old rename.go (424 allocations).
- TestDshLookParsesAnEntryOnce now asks dshNodeShared alone for 0
allocations and checks a slice changed in place. Red on the old
dsh.go (1 allocation).
Run on mote at this tree: gofmt -l clean; go vet of agent, provider,
profile, gui; go test -count=1 of internal/agent (390s), provider
(256s), profile, gui (174s) and usage: all ok.
Not run: the full ./... suite and the GUI (JS) suite; no JS changed.
|
||
|
|
16a2dfac9c |
lan: a LazyCat app offers the box's LAN address, or says how to forward the port
mtoolstec on X (after v0.1.3432) runs magpie from the magpie-lzcapp
package on a LazyCat box. Settings -> Share on local network offered
https://magpie.<box>.heiyu.space/v1, which only devices with LazyCat's
client reach, and http://172.28.3.65:3425/v1, the container bridge,
named "Other containers on this host", which nothing off the box
reaches. Other devices on his LAN wanted http://192.168.0.100:3425/v1.
The package runs magpie on the app's bridge network, and LazyCat
publishes an app's ports only on heiyu.space, not on the box's LAN
address. Its env names the app's domain, never the box's LAN IP.
- On the box's own network (network_mode: host, as LazyCat's Emby, Lucky
and LAN Sheriff run), magpie now finds the box's LAN addresses. It sees
the box's bridges/veths, or host.lzcapp is one of its own addresses, and
takes the IPv4 of the default route's interface, minus host.lzcapp.
LANURLs lists them first and the app domain after. A MAGPIE_PUBLIC_URL
of the user's own (not the domain) stays first, and a pinned
MAGPIE_ADDR still serves only that address. The sidebar names the box
address, not the domain.
- On a bridge network that address can't be known. The domain is listed
alone, named "LazyCat client", and the container-bridge address is no
longer offered under LazyCat (ContainerHostURL ""). The row under the
address, in Settings and on the Gateway page, says to forward the port
with LazyCat's "LAN port forwarding" app (局域网端口转发工具). The CLI
banner (serve, web) says the same.
- New settings/gateway fields: lanLazyCat, lanLazyCatBox; lazyCat,
lazyCatBox (and boot.js's sideGateway). Strings are in zh, zh-TW, ja
and de.
- host.lzcapp is looked up only under LAZYCAT_APP_DOMAIN, with a 2s
timeout and no lock held. An answer is kept; a failure is retried after
a minute.
Package side: the magpie-lzcapp package (lazycat-contrib, czyt) needs
network_mode: host plus host.lzcapp upstreams and the net.* permissions,
or its usage needs the port-forward steps. An issue is filed there.
Run (mote, macOS, at this tree on origin/main ce6ae593c; then rebased
onto ab084fdf2; api.go, providers.go and i18n.js changed there too and
merged clean):
- gofmt -l: clean. go vet: darwin for gateway/gui/cli; CGO_ENABLED=0
GOOS=linux -tags nogui ./... and GOOS=windows ./...: ok.
- go test -timeout 45m ./...: ok (before the string reword; after it,
internal/cli and internal/gateway again: ok).
- wsl-run (Ubuntu 24.04): the LazyCat/default-route/LAN tests in
internal/gateway and internal/cli: ok.
- GUI: lan-lazycat (new: 2 engines x 5 languages x 1100/420px, 20 tests),
i18n-keys, i18n-en-no-cjk, gui-de/ja/zh-tw, lan-docker and
side-gateway-lan: 85 pass, 0 fail. A wider set (lan-*, gateway-*, connect-*,
key-page, sidebar, phone-*, remote-magpie and others; 835 tests) was
run before the reword. Its reds were the i18n placeholder check
(fixed: no <box IP> in the string), and phone-connect-menu 420 (#4706,
#4707) and remote-magpie (#4398). Those last two are red the same alone
on origin/main
|
||
|
|
ab084fdf25 |
gateway: a model's own system prompt, added after the agent's on every route (liucl on X)
liucl asked for a system prompt per model rather than per agent. A provider's editor now has a System prompt box in each model's Model settings row (Providers > a provider > Model settings). The gateway adds the text after the agent's own system prompt on every request for that model, whatever agent sends it. Empty, the default, sends the body byte for byte as before. It is only ever appended. Codex's base_instructions, Claude Code's identity block and any agent's prompt stay first and unchanged (withModelSystem in internal/gateway/model_system.go), in the agent's protocol, in serve's candidate loop after triedOn, so before translation and before a plugin's fetch: - Anthropic: string system + "\n\n" + text; a block array gets one more text block; none gets system. - Chat: the last leading system/developer message gets it after a blank line (or one more text part); none gets a system message first. - Responses: a developer message after the leading system/developer items, instructions untouched; a string input becomes that message plus the user's; none when previous_response_id is set (the turn it follows had it). - Gemini: systemInstruction / system_instruction gets one more part. count_tokens counts it (countOn). magpie's own asks (search and vision side calls, Codex titles, the router's classifier) get none. A fallback to another model gets that model's own, or none. Stored as settings.modelSystemPrompts["pid/model"] (SetModelSystemPrompt: trimmed, at most 64KB, no NUL, a model the provider serves), saved through modelPrefs[id].system; renames carry it (perModelFields). The Restore default title now says it takes the system prompt away too; the four tests that pin that title follow it. app.js stays in its budget with one comment cut, no raise. Run, on mote at this head: - TestModelSystem* (every wire format with exact bytes, empty unchanged, own asks skipped, messages/chat/responses/gemini/count_tokens routes, another model sent byte for byte as before, a plugin's model), TestProviderSaveModelPrefs, settings keep test. - Broken by hand, each red then restored: no call in serve, no call in countOn, prepend in Anthropic, empty not guarded, own asks included, any model of the provider; SetModelPrefs ignoring system; the GUI not staging it. - GUI: model-system-prompt.test.cjs (Chromium and WebKit, en zh zh-TW ja de, 1200 and 420px), model-limits, model-headers, provider-same-as, provider-detect, provider-listed-as, i18n-keys. - Real run: Claude Code 2.1.321 -p in a sandbox HOME and CLAUDE_CONFIG_DIR, through a sandbox `magpie serve` built from this tree, to a fake Anthropic upstream recording bodies. Its /v1/messages system had 3 blocks, Claude Code's own first, the prompt once, at the end of the last block; count_tokens sent "Be terse.\n\nAlways answer in Chinese." - gofmt; go vet ./...; GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./...: clean. - The full go test -timeout 45m ./... and the whole GUI suite were queued on mote at this head and run after the tag (the owner's ship-now rule); what they find goes in follow-up commits. Not tried: Codex or any agent other than Claude Code for real; a real vendor upstream; the Responses, chat and Gemini shapes only through the gateway tests' fake upstreams. |
||
|
|
fdc96dfe4d |
library: a billion-context tab switches its plugin on per agent and restores each file exactly
@Kling__Lab on X asked for billion-context (npm billion-context, CLI bili, github.com/ranxianglei/billion-context) beside RTK. The Library gets a billion-context tab after RTK, a card like RTK's: - No bili: its README's `npm install -g billion-context --prefix=~/.local` and Install billion-context (InstallBili; biliPath finds bili in ~/.local/bin when it isn't on PATH). - Installed: its version, a note that an agent switched on here can't also run billion-context-pi or opencode-acp, and a switch per agent that runs `bili plugin install|remove <agent>` (SetBili), read back from `bili plugin list`. - Offered for Pi, omp, OpenCode and Claude Code, the lanes that keep magpie in front: Pi/omp/OpenCode load it in process and still send to magpie; Claude Code goes through bili's proxy, which forwards to magpie's gateway. Not offered: Codex (MCP only), ZCode (routes only its own provider), Kimi Code (renames default_model to bili-kimi), dsh (its install failed through dsh's pnpm), Hermes (can't be tried in a sandbox HOME), and agents in WSL. bili's remove doesn't restore a file: it leaves `"packages": []` in Pi's settings and `extensions:` in omp's config, and after magpie rewrote Claude Code's settings.json it deleted ANTHROPIC_BASE_URL (Claude Code then went to Anthropic, not magpie) and put back DISABLE_AUTO_COMPACT. So switching on records each file before and after (bili-plugins.json in magpie's config folder), and off writes the before bytes back when the file is unchanged since, else merges JSON three ways; with no record (bili set up outside magpie) only a Claude Code ANTHROPIC_BASE_URL the remove took out is put back. bili's .bili-bak/.bili-last files go too. `GET/POST /api/library/bili`, `POST /api/library/bili/install` are named in the CLI parity list beside RTK's. Docs: site library pages (en, zh, ja) and docs/subsystems/library.md. Run: - go test ./internal/library -run 'TestBili|TestParseBiliList' on mote: ok (a fake bili mimicking pi/claude lanes, .bili-bak re-backup and claude's buggy remove; a fake npm for the install). - Full `go test -timeout 45m ./...` on mote at 16c67965f (this commit before the body was written, same tree): every package ok but internal/gateway's TestBurstTellsNoSpeed/responses_from_chat_burst (804ms burst read as a speed, load ~50 after a mote reboot); passes -count=3 alone at the same head; recorded on #2719, same test. An earlier full run at 8c8c63537 was all ok. - GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., go vet ./... at 16c67965f: ok. gofmt -l: nothing. - GUI at 16c67965f: library-bili, i18n-keys, i18n-en-no-cjk, library-memory, library-rtk-gain, library-pi-extensions, Chromium and WebKit (library-bili: every language, 1100 and 420 wide). 80 of 80 pass. - The whole GUI suite is still running on mote at this head, started before the tag; two earlier whole-suite runs were cut short (mote ran out of disk mid-run, then rebooted), so their reds are not a record. Its result goes in a follow-up. - Real, in a sandbox HOME (named dir, bili 0.1.213 installed there, magpie web built from this branch on 3486/3487): through magpie's API, Pi and Claude Code switched on; `claude -p` and `pi -p` each answered "pong" through magpie's gateway (Claude Code via bili's proxy on 18788 -> 127.0.0.1:3486); switched off: Pi's settings.json, Claude Code's settings.json and .claude.json byte-identical to before, no .bili-* files left, commands/acp-cache.md gone; claude -p answered again straight to the gateway. Earlier, with bili run by hand, Pi, OpenCode, omp, Claude Code and Kimi each sent a request through a recording relay with bili's tools/headers on it. Broken by hand: skipping biliRestore turned TestBiliOnOffExact, TestBiliClaudeKeepsMagpiesRoute and TestBiliOffWithoutRecord red; dropping the no-record URL fix turned TestBiliOffWithoutRecord red; removing the tab turned all 22 library-bili cases red; removing the zh note string turned the zh cases red in both engines. Each put back. Not tried: Kimi, dsh, Hermes, Codex, ZCode lanes (not offered); WSL; Windows (the %APPDATA%\npm lookup and npm without --prefix are untried on the Windows box); OpenCode and omp switched through magpie's API (switched by hand with bili before); a real npm install from the button (sandbox had bili already; the test fakes npm). |
||
|
|
5e1a6a20bd |
agent: Grok Build's model list keeps magpie's rows and reads models_cache.json once a change
Grok Build's model field cloned magpie's rows for every look to mark the ones on its own account Same, appended them onto its own models, and read and walked models_cache.json again each time. The marked list is now kept as viaMagpieShared keeps its own (grokVia, under the same stamp), joined with Grok's own models through joinedVia, and the cache's shown models are read through filememo. TestGrokFoldsItsOwnAccount now has a models_cache.json of 300 hidden models beside a shown one, checks only the shown one is offered, and that a look again within a request gives the list kept. Broken by hand (grok.go as before): "a look again made the list again", red; green restored. Run on mote: go vet ./internal/agent, go test -run TestGrok. |
||
|
|
e99993fcac |
gui, provider: a page builds the agents once a request, and preset hosts are gathered once
The Providers page built agent.All for Detected beside the one accountLabel looks names up in (provider.Held), and the state built it twice (Clients, Detected). They now share the request's held list (heldAgents; agent.DetectedIn, agent.ClientsIn), as /api/drift does. notProbed gathered every vendor and local preset's bases for each provider of each poll; it now asks a set made once (presetHosts). Run on mote (darwin): go vet and go test of internal/agent, internal/gui and internal/provider: agent and gui ok; provider red only in TestMoveToPlugin's TempDir cleanup (#5524, passes alone). TestNotProbedSetMatchesThePresets: broken by hand (set rebuilt per ask) it measured 44 allocations an ask, red; 0 restored. |
||
|
|
b03a374763 |
gui: a subscription's resets, warm-up, check-in and Claude run are its editor's own fields under Advanced
The owner (11-09): the block of cards these lists made under Routing took most of the provider editor. Each list is now a field of the editor's Advanced, beside its own label (Resets, Warm up, Check in, Claude Code), first in it, and a field with nothing to show is hidden from the first draw, before the prefs have loaded. Settings' search still finds them: the hit opens the editor with Advanced open, brings the row into sight and lights it. In the editor's narrower column a row's name and control share the first line and its description goes under both (a grid), so a description that grows after a click moves nothing under the pointer. An account's own warm-up time goes under its Same/Own/Off picks, not before them, so picking Own at 440 wide no longer pushes the picks a line down. Tests: - In the editor a click holds what was pressed where it was (modalHold), and the editor may scroll to do it, so checkin-account, warm-at-own and codex-reset-lead check the pressed row's place on the screen, and that the page itself never scrolls, instead of every scrollTop. Each target is brought into sight first, so Playwright's own scroll before a click isn't counted. - reader.cjs's inEditor scrolls the editor's body with the wheel until the element is inside it and not covered, and checks again after the editor draws anew. - settings-groups: Claude's editor has Claude Code's run row too; the Usage part names alertHead and alertList (missed by |
||
|
|
da8480326f |
agent: detection's remaining stats make no os.FileInfo on darwin and linux
After statKind ( |
||
|
|
783cd0f840 |
agent: OpenClaw's file is made plain JSON once a change for a look
The model's Get and Check are asked on every drift poll, and each one copied openclaw.json (edit.Read clones it), copied it again, blanked its comments, ran json.Valid and parsed it to see it is an object. They now go through openClawLook: filememo.Read keeps the checked plain JSON while the file is unchanged, shared and read only. A not-there file is nil, as before. Wire, unwire, connect, Set and Sync still read the file fresh (openClawRead), since they write from it. Run (mote, at this tree): - go test -count=1 ./internal/agent: ok (207s) - go vet ./internal/agent for darwin, linux, windows: clean - TestOpenClawLookReadsAnUnchangedFileOnce: green (0 allocations held, another program's write and a broken file seen, a gone file nil); with openClawLook put back on openClawRead by hand it is red (5 allocations), restored - Real accounts (sandbox HOME copy), 40 /api/drift calls, paired runs: openClawRead 0.5/0.5 MB before, gone after; totals 17.4/21.4 MB before, 17.5/15.5 MB after (sampling noise is about +-15%). Not tried: Windows and Linux runs of the package (vet only). |
||
|
|
ce6ae593c5 |
agent: applied.json is parsed once a change for drift
appliedOf is asked for every agent on every drift poll (the GUI asks /api/drift every 15s while visible), and each ask read and decoded the whole applied.json. It now goes through filememo.Read: an unchanged file is parsed once and its map shared (every appliedOf caller only reads it). appliedSave calls filememo.Look so magpie's own record is read at once, even inside a held request. Writers (record, appliedLoad's other callers) still decode a fresh map. Run (mote, at this tree): - go test -count=1 ./internal/agent ./internal/filememo: ok (227s) - go vet ./internal/agent for darwin, linux, windows: clean - TestAppliedOfParsesAnUnchangedFileOnce: green; with appliedOf put back on appliedLoad by hand it is red (25 allocations), restored - Real accounts (sandbox HOME copy), 40 /api/drift calls, paired runs: appliedLoad 2.0/3.1 MB before, gone after; totals 26.1/20.6 MB before, 18.9/18.2 MB after. Not tried: Windows and Linux runs of the package (vet only). |
||
|
|
e3ab7f3bf7 |
agent: isDir, isFile and Taken make no os.FileInfo on unix
Detection asks isDir, isFile and Taken of about a thousand paths on each of the window's 15s /api/drift asks. os.Stat made an os.FileInfo on the heap for each, a fifth of what forty asks allocated with real accounts. statKind calls syscall.Stat into a Stat_t on the stack (retrying EINTR, following links as os.Stat does); only the path made a C string is left. Windows keeps os.Stat (statkind_other.go). Run: - TestStatKindAnswersWithoutAFileInfo: folder, file, gone, a path under a file, "" and a link to a folder answer as os.Stat did; two looks take 2 allocations. Broken by hand (statKind through os.Stat): red, 4. - go test ./internal/agent on mote; go vet ./internal/agent for darwin, windows and linux. - Real accounts (sandbox HOME on mote, 40 /api/drift asks), paired: os.Stat's allocations 4.6 and 4.1 MB before (t24), 1.0 and 1.5 MB after (t25); totals 25.0 and 22.6 MB before, 18.4 and 22.0 MB after. |
||
|
|
b93dd12441 |
github: bug and feature issue templates, with a known-issues link
A bug report asks for the version, surface (GUI/TUI/CLI), OS, agent and provider, steps and the exact error, so a report can be reproduced without a round of questions. config.yml links open bug issues as the known-issues list, and Discord for questions. Asked for on X by AskarKerey (2119903378700403104). Run: the three files parse as YAML (python yaml.safe_load); the labels bug and enhancement exist. No code changes, nothing else to run. |
||
|
|
91fb441843 |
antigravity: effort stays selectable in the app's own picker
YujunT46308 on X: "antigravity 接入 magpie 会导致模型的 effort 不可选".
Antigravity's picker (main.js served by its 2.29.0 language server)
offers effort only by grouping catalog entries named "<name> (Low)",
"(Medium)", "(High)", "(XHigh)", "(Max)" under one row with an effort
submenu, two levels or more. magpie's listSource catalog listed each
model once, so no model of magpie's had an effort control.
Now /v1/models?format=antigravity lists a model with two or more of
those levels once a level, "<id>:<level>" named "<name> (<Level>)".
The app sends the chosen entry's id, and the gateway's existing
":level" suffix handling sends that level upstream, ahead of the row's
pick and of the app's own reasoning_effort (low whatever was chosen,
in a 2.29.0 run). models.defaultModelId names one of those entries
(gateway.AntigravityModel: the row's effort fitted, else medium, else
the lowest), since an id the catalog doesn't list starts the app on
its first model; Sync moves a file written before onto a level. The
row's effort sets the start level and still applies to models with
fewer than two levels. The model field shows the id without the level.
Run:
- Real Antigravity 2.29.0 language server + its UI in Playwright
Chromium on mote, sandbox HOME, magpie built from this tree serving
a fake upstream listing g3 with low/medium/high: `magpie provider
add`, `magpie antigravity magpie/up/g3` wrote defaultModelId
"up/g3:medium"; the picker shows one "g3 · up" row with Low, Medium,
High (starts on Medium); picking High and sending "ping" reached the
upstream as model g3 with reasoning_effort "high" (the app's title
call went at medium, the start level). `magpie antigravity default`
left {} as before.
- go test -tags nogui ./internal/agent ./internal/gateway -run
Antigravity on mote; gofmt -l; go vet of both packages;
GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./...
- Full suite on mote, go test -tags nogui -timeout 45m ./... at this
commit on origin/main
|