Commit Graph
2171 Commits
Author SHA1 Message Date
yetone 7c1dc198d1 usage: a turn over the Responses WebSocket counts what the socket was sent, and says so
A Codex turn kept on a Responses WebSocket sends only the new items as a
delta, but the row's ↑ was the whole HTTP body magpie built before the
transport ran, so a long conversation read as ~13MB up per turn
(matrix0487 on Discord). overSocket now records what each socket write
carried (wroteSocket) and, when the turn went out on the socket alone,
replaces the HTTP figure with those bytes (sentOnSocket); a turn that fell
back to HTTP keeps the HTTP body and adds any socket write made before the
fallback. errCodexSocketAgain's retry on a new socket counts both writes.

The row remembers that it went over the socket: Record.Socket (json "ws"),
packed as Flags bit 16384 (rowSocket, added to TestRowFlagsApart). The
Requests table's protocol badge says "Responses · WS" and the details'
Protocol line "Responses · WebSocket".

Run on mote at this commit (rebased on origin/main b4a0a2a1a): gofmt -l
clean; GOOS=linux and GOOS=windows go vet of internal/gateway and
internal/usage; go test ./internal/usage ./internal/gui ok; go test
./internal/gateway -run 'Codex|UpBytes|Ledger|Socket' ok; node --test of
every ledger-*, usage-ledger* GUI file and i18n-keys, 502 of 511, both
engines. The reds are filed and untouched by this change: ledger-swipe
webkit (#5223) and usage-ledger's "newest live route needs no
return-to-live button" (#3104, #4078, #4626, #5048).

Broken by hand: without the deferred sentOnSocket,
TestCodexSocketRowCountsWhatTheSocketSent reads 50,360 B for a 253 B
delta; without the Flags set, TestRowKeepsSocket's packed rows lose
Socket.

Not tried: a real Codex Pro account over the socket, and the full suite
(it runs after the tag). There is no "saved by the socket" figure yet,
since PlainBytes isn't packed.

Reported-by: matrix0487 (Discord)
2026-11-10 03:44:19 +08:00
yetone 2c2bd15d71 memory: Tidy up every night, a switch in the Memory tab
The Memory tab gets a second row under Learn from conversations. It is
off by default. Switched on, the first tidy is due at the next 03:00.
Tidy now runs one at once, and Undo puts the last one back. While
distillation is off, the row has its own model picker; both rows share
one model.
Routes: POST /api/memory/dream {on}, /dream/run and /dream/undo.
GET /api/memory/distill carries "dreaming", so a tidy no longer shows
as conversations being read.

The prompt's stale rule is narrower. On the first real run it set aside
two decisions because "the work is done". Now only a note that later
notes contradict, one past its date, or one about a finished one-off
task is stale; a decision, direction or preference stays.
docs/subsystems/memory.md gets a Dreaming section.

Real run: a sandbox memory.json of 62 real distilled memories, 12 active
and one each user-written and pinned, with auto/claude-haiku-5-5 through
the live gateway.
- Before the prompt change: 12 changes in 48s, 10 merges and 2 set aside.
  Both set-aside notes were decisions.
- After: 12 merges in 46s, none set aside. Each merge joins real
  duplicates (three ~/.codex/sessions cleanup rules into one, the
  TestFlight 1.66/1.68 pair). One went into the fixed memory, whose text
  was kept word for word.
- Undo: 25 restored. memory.json's ids and statuses equal the backup
  taken before the run, and every merged memory is gone.

Broken by hand, each red:
- Undo not reloading the list: library-memory 22 failed.
- Ignoring DreamSince: TestDreamsOnceANight.
- A plan applied after an error: TestDreamFailureChangesNothing.
- Tidy's fixed guard and Untidy's status check: their memory tests.

Run on mote at this tree:
- go test internal/memory, memdistill, library: ok.
- internal/gui -run 'Distill|Dream|I18n|Budget': ok.
- library-memory.test.cjs: 22/22 in both engines.
- i18n-keys and i18n-en-no-cjk: 4/4 each.
- go vet (darwin), GOOS=linux -tags nogui, GOOS=windows: ok.
Not run yet: the full suite at this head.
2026-11-10 03:25:45 +08:00
yetone 4d12d44163 memory: Learn from conversations, a switch in the Memory tab
The Memory tab gets a row that reads finished conversations into
candidate memories (To review). It is off until switched on; switched
on it reads at once, then hourly (5 minutes after start, then every
hour), through the gateway this process serves under the agent
"memory", with the automatic model unless one is picked through the
app's menu. Read now runs it again; a run that stopped says why.

- memdistill: Keep (the hourly loop) and Running.
- gui: /api/memory/distill (GET, POST {on, model}), /distill/run;
  distillComplete posts /v1/messages to the served gateway's handler
  with the memory agent's token.
- library client: the row, its poll while a run goes, and the
  memories reloaded when it ends; strings in zh, zh-TW, ja, de.
- docs/subsystems/memory.md: a Distillation section.

Run (mote, at this tree):
- go vet ./internal/gui ./internal/memdistill ./internal/memory; GOOS=linux
  -tags nogui and GOOS=windows vet of gui and memdistill: clean.
- go test ./internal/gui ./internal/memdistill ./internal/memory
  ./internal/library: ok.
- node --test internal/gui/tests/library-memory.test.cjs: 22/22, Chromium
  and WebKit, 5 languages, 980 and 420.

Broken by hand:
- the memories not reloaded after a run: the GUI test is red waiting
  for the proposed memory.
- the token not the memory agent's (earlier): TestDistillCompleteThroughGateway
  red on the Trace's agent.

Not tried yet: a real model's run (next), the whole GUI suite (queued
behind the suite lock on mote), the full Go suite.
2026-11-10 03:25:45 +08:00
yetone 2b2ee49ded gui: the Library's Memory tab
A tab after Instructions lists what the agents remember, in use, to
review (what an agent only guessed) and archived, pinned first then
newest; searches it, narrows it by where it applies, and adds, edits,
pins, keeps, archives and deletes memories (Delete asks with a second
click). Kind and scope are picked from the app's menu, never a <select>.
A card on top switches the digest in the ticked agents' instructions on
or off and names those agents, and offers Magpie Memory while it isn't
in the Library.

/api/memory (GET; POST saves the user's own or edits by id),
/api/memory/remove and /api/memory/digest; a change publishes the digest
at once and its reply carries `problem` when that failed.

Words other code also says (Archived, Pin, Keep, the kinds…) are in core
i18n.js; the rest in the library plugin's, in zh, zh-TW, ja and de.
docs/subsystems/memory.md describes the layer.

Run (mote-run):
- node --test internal/gui/tests/library-memory.test.cjs, Chromium and
  WebKit, 5 languages, 980 and 420 wide: ok
- whole GUI suite: not run at this commit; it is queued on mote for the stack head (034f249af before the rebase)
- go vet ./internal/gui, GOOS darwin, linux, windows: ok
Broken by hand: the pinned sort read `b.pinned - a.pinned` (NaN for an
unpinned one) and the test was red in every language until `!!`.
Looked at: screenshots en light 980, zh dark 980, en 420.
2026-11-10 03:25:44 +08:00
yetone 9d4c338a67 gui: magpie web on a phone no longer scrolls sideways or keeps a band at its foot (#4943)
precis1onz (iOS Safari, dark, English, Usage) saw the page move sideways
and a dark band stay at the screen's foot.

- Sideways: Usage → Requests' "Split by" row (label and five choices) is
  one unwrapped span, 393 to 558px wide at 375 to 430px. It was the only
  thing wider than a phone in any view or language. On the phone layout
  it now wraps inside the screen (app.css, phone block only).
- The band: the Requests table's stand-in scrollbar (#799) is sticky at
  the view's foot, and a touch screen draws no bar in it, so it stood
  there as an empty 12px band. ledHScroll now leaves it hidden on
  (hover: none) and (pointer: coarse); a finger moves the table itself.
  A desktop keeps it as before.

New test, phone-no-sideways.test.cjs: every view (Agents, Sessions,
Providers, Routing, Groups, Gateway, Library, Plugins, Masking, each
Usage tab, Settings' tabs) on an iPhone at 375 in en, zh, zh-TW, ja, de
and at 390 and 430 in en, in Chromium and WebKit, with long ids, emails
and paths; nothing may be wider than the screen and no empty band may
stay sticky at a view's foot. ledger-swipe now expects no bar on a
phone, and that the swipe moves the table.

Run (mote, through mote-run):
- phone-no-sideways: red on the old assets (803d7747e) in every run,
  led-split too wide plus the empty #ledHScroll at the foot; green on
  the new in both engines, again at the rebased head with ledger-swipe
  and usage-ledger-leave.
- mobile-web 14/14 in both engines with a real git base in the copy,
  so the desktop layout matches the base.
- Every GUI file the change can reach (1485 tests, both engines): the
  reds are all red on base and filed: mobile-web desktop subtests in a
  copy without .git (#5013), phone-connect-menu 420 (#4706),
  usage-agents-hide (#2276), usage-computers sync tick in Chromium
  (#5224), usage-fold (#3415), usage-ledger Requests (#5048).
  ledger-swipe in WebKit flakes on base too (#5223).
- go test -tags nogui ./internal/gui ok (size budgets), also at the
  rebased head; gofmt clean; go vet for darwin, linux and windows ok.

Not run: the whole GUI and Go suites. The run was queued over two
hours behind mote's suite.lock and never started; the change touches
no Go code.
2026-11-10 03:00:30 +08:00
yetone 198c16d0c4 gui: a window set aside, counted of a total, takes a new cap of its own
9won on Discord: WorkBuddy's Credits and Extra credits (and the intl
build's) could not be given a cap. The plugin sets those two aside
(the account stops at "Total credits"), and 51bdc985b let a window set
aside keep a cap set on it before, but offered no new one. Routing
already holds at such a window's own cap (WindowCaps.own, allowanceOf),
so only the meter refused.

Now a window set aside with a total (limit > 0) is a button too. Its
menu has no "Account's cap" item, since such a window never counts the
account's cap: "No cap on this window" is first and posts 0, and the
note says it has no cap. A window set aside with no total (Loomy's
永久积分, a bare balance) stays plain: there is no share or spent
amount a cap could read.

app.js pays for itself by five comments cut shorter; no budget raised
(TestCoreScriptBudget ok again at the rebased head, on origin/main
c3f91f449).

Run on mote: node --test window-cap (chromium and webkit, 420 and 1100,
en zh zh-TW ja de): 120 pass; window-cap-pool 40, account-cap 16,
i18n-keys 4 pass. go test ./internal/gui: ok after the last comment cut
(TestCoreScriptBudget 5 bytes over before it, the only red).
Broken by hand: the old guard back, window-cap's new test 20 of 20 red.
Not tried: a real WorkBuddy account with a cap on Credits.

Reported-by: 9won_25273 (Discord)
2026-11-10 02:56:16 +08:00
yetone f2341e232a providers: the page says when subscription accounts are off, and leads to the switch
Subscription accounts (account discovery) are turned off in Settings ›
Privacy, and every subscription then stops working, but the Providers
page said nothing of it (the scattered settings audit after netube99 on
X). A line over the list, in the deprecation notices' quiet style, now
says they are off, with Settings › Privacy opening the switch, lit, and
Back to Providers. With MAGPIE_NO_ACCOUNTS set it says so instead. While
they are on there is no line. The core script budget is paid with three
comments cut, no raise.

Run on mote (macOS 27), Chromium and WebKit:
- new providers-discovery-off.test.cjs (every language, 1100 and 420
  wide), account-discovery, i18n-keys, settings-back: 76/76.
- TestCoreScriptBudget and the app.js budget: ok.
- every file touching #movable (deprecated-subscriptions,
  deprecation-notice, library-chip-fan, plugin-move, plugin-movable-review,
  retired-move): green. plugin-move-unserved's "Try again takes the models
  unticked" is red 4/4, the same 4 at a clean origin/main 0d99261dc copy
  (the editor's model chip never shows); not this change.
Broken by hand, each red: no line drawn; the link opening Sign-in pages'
row instead; the MAGPIE_NO_ACCOUNTS wording dropped.
Not tried: the real app window.
2026-11-10 02:52:51 +08:00
yetone 0d99261dcc sessions: the page leads to Settings › Privacy's session history
Which agents' session history magpie reads is set in Settings › Privacy,
and the Sessions page it is about led there only through its first ask's
words (the scattered settings audit after netube99 on X). Its head now has
a Settings › that opens Privacy at those rows, lit, with Back to Sessions.
Gateway mode reads no agent's history and has no such rows, so no link.

Two things it found on the way:
- Privacy's session-history rows are drawn again when their read comes
  back (loadSessionReads), which took the light off a row a link had just
  lit; in Chromium it was gone before it showed. The redraw now keeps the
  light on the row at the same place.
- The link takes ~70px of the head (en), and eight agents' tabs, which
  fit a 1200px page (面条 on Discord), had 34px to spare. The search
  now gives way to the tabs, down to its 110px least, before the agent
  menu takes them; a narrow window's grid head is as before. The fit
  watches the head, not the tabs' box the search's width changes, so no
  ResizeObserver loop.

New test sessions-to-settings.test.cjs: the link's words, inside the head,
over nothing, the page fits; it lights Privacy's row; Back returns to
Sessions; none in gateway mode. Every language, Chromium and WebKit, at
1100 and 420 wide. sessions-toolbar now counts the link among the head's
controls that must fit.

Run on mote: every Sessions GUI file (13), gateway-conversations,
gateway-mode-sessions, i18n-keys and settings-back: 192 of 192.
Broken by hand: without the link, sessions-to-settings red; without the
redraw keeping the light, red in Chromium (timeout on the lit row);
without the search giving way, sessions-toolbar red ("a wide window keeps
the one-click agent tabs").
Not tried: the real app window.
2026-11-10 02:33:07 +08:00
yetone a1f2c37ea8 gateway: a key's limit editor says Key limits is off and turns it on
A gateway key's limit is the Key limits built-in's (budget). With it
switched off, the editor under the key's row drew as usual, and Save was
refused with "turn the plugin on" without saying where (the scattered
settings audit after netube99 on X). The editor now has a line, shown
only while budget is off (data-feature-off), saying "Off in Plugins ›
Built-in" with a Turn on that switches it on in place; the line goes and
the editor stays open with its draft.

New test gateway-key-limit-off.test.cjs: off, the line shows inside the
editor with its words and the page fits; Turn on posts {id: budget, on:
true} once and hides it; on, it is hidden. Every language, Chromium and
WebKit, at 1000 and 420 wide.

Run on mote: gateway-key-limit-off 20 of 20; gateway-key-limit,
gateway-key-limits, gateway-key-cycle and i18n-keys 38 of 38.
Broken by hand: without data-feature-off the line shows when on, red;
without Turn on's call the line never goes, red (timeout).
Not tried: the real app window.
2026-11-10 02:17:02 +08:00
yetone b72256b599 gui: a Back in the title bar after a link into a setting, and a lit row keeps its corners
The owner (11-10): "点击设置链接跳转到设置页面之后,最好有一个返回按钮来返回到上一页,
类似于浏览器的返回按钮。" A link into a setting (openSettingsAt: the Usage
page's and Routing's Settings ›, the Gateway page's, a provider's, Plugins ›
Built-in's) and Plugins › Built-in's link to a page now leave a chevron
Back in the title bar, before the crumb (beside the sidebar) or after the
brand (the header's tabs), named "Back to {page}". It goes to that page:
the provider that was open, or Settings' tab and search. One step, like
a browser's first; going to another page by hand drops it. fitTop counts
it as the header's lead, so the tabs keep clear of it.

And (the owner, 11-10): "绿色边框的四个圆角会被切掉,这个很丑的". A lit row's
inset ring was square inside the list's rounded clip, so the first and
last rows lost their ring's corners. A lit row is rounded as the list is
inside its border (11px; 10px in the panel, whose lists have no border).

New test settings-back.test.cjs: Usage's Settings › lights the row with
rounded corners, Back shows with its name, fits, overlaps nothing in the
title bar, and goes back; Routing's the same; a page picked by hand drops
Back. Every language, Chromium and WebKit, 1100 and 420 wide.

The core's script budget pays for Back with five long comments in app.js
cut to a line each (Back's own, Built-in's rows, the refresh, its spin's
stop, a growing part's hold), no raise; TestCoreScriptBudget ok on mote.

Run on mote: settings-back, i18n-keys, settings-places, title-bar-tools:
53 of 54; the red is title-bar-tools' known WebKit flake (#2740, #4716),
red 1 run in 3 alone, the same at the base.
Broken by hand: without renderBack in show, settings-back red; without the
11px radius, red with row 0 vs list 11.
Not tried: the real app window.
2026-11-10 02:12:18 +08:00
yetone a8aeb2cad2 usage: picked days can start and end at a minute
blrbrzkj on Discord asked to see usage from one time to another, not
only whole days. The range menu has a start and an end time under its
month (empty is the whole day; 9:30, 0930 and 09:30 all read 09:30).
Picked with the days, the period is "2026-10-01T09:30..2026-10-01T18:00";
Enter applies new times to the days already picked. A time that isn't
one, or an end not after the start on one day, is marked and asks for
nothing. The opt says "Oct 1 09:30 – 18:00".

The backend reads either end as a date or a date with its minute
(usage.RangeOf, bounds); an untimed end is its next midnight. A timed
range of 48 hours or less is drawn by the hour from the first's hour.
CSV names drop the colons.

Run (mote): node --test usage-range-times (new, chromium + webkit, en +
zh), usage-range, i18n-keys, credit-days: 26/26 ok. go test
./internal/usage ./internal/gui ok (TestCoreScriptBudget fits, the
periodDays comment cut to pay for its regex); gofmt clean; go vet
native, GOOS=windows (usage, gui), GOOS=linux (usage) ok.
Broken by hand: a timed end read as its day's midnight turns
TestPickedMinutesArePeriod red. The page's own typedTime first clashed
with app.js's hhmm and stopped the Usage page mounting; the GUI run
caught it.
Not tried: the real app with a real ledger; ja/de/zh-TW screens.

Reported-by: blrbrzkj (Discord)
2026-11-10 02:01:37 +08:00
yetone 117f56c707 gui: a provider editor of many accounts opens without a layout an account (#5310)
With 600 accounts the Claude provider editor took 7.9s to open in WebKit
(2.3s in Chromium). Each account's segmented control placed itself, and its
thumb, in a microtask of its own: a read after the last control's write, so
every control laid the editor out again. The thumb's place was read from
offsetLeft/offsetTop, scrollLeft and getComputedStyle. In a long list WebKit
answers those by walking every sibling before the element (~0.3ms each at
600 accounts), where getBoundingClientRect, offsetWidth and client/scroll
sizes are cheap.

- segs() queues its control. One microtask (segsFlush) places every control
  due and slides them all together, with each container's controls counted
  once (segsPlace takes a shared map).
- slides() reads every thumb's target, then writes them all. thumbsPut puts
  them all with one reflow.
- thumbTo measures with rects (unscaled by offsetWidth) and reads scrollLeft
  or scrollTop only when the strip overflows.
- thumbNow trusts the place it last put (thumbPlaced) unless a glide is
  running, so it doesn't use computed style.

Measured at 600 accounts (time to open the editor, probe on mote):

| | WebKit | Chromium |
| --- | --- | --- |
| before | 7.9s | 2.3s |
| after | 1.13s | 0.58s |

What's left in WebKit is the editor's own two renders and openModal
(~670ms), which this commit doesn't touch.

The core scripts stay inside TestCoreScriptBudget: comments were cut to pay
for the code, and the budget wasn't raised.

New test: editor-thumbs-batched.test.cjs. It opens the editor with 40 and
with 160 accounts, in both engines and in en/zh/zh-TW/ja/de. It counts
forced layouts and the sibling-walking reads, holds 160 to 40's count +24,
and checks every thumb lies under its option within 1px.

Run at this head (rebased on ab3710de3), on mote:
- TestCoreScriptBudget: ok.
- editor-thumbs-batched, i18n-keys and quota-fit-batched: all ok, in both
  engines.
- tencent-cloud: the "strip scrolled" test is red 4 of 4, as it is on main
  (#4321). It fails before any click, at "the strip scrolls (0px)".

Run on the tree before the last comment trims (base 7e5cebb86):
- The 109 GUI files that touch thumbs, .segs, slide() or segsPlace, plus
  i18n-keys: 2,099 tests, 39 red.
- The 7 files with reds were rerun at both the fix and the base. They give
  the same reds on both (40 at fix, 39 at base; the extra one is skill-where
  webkit, which is red only at base). Each is filed: tencent-cloud #4321,
  settings-groups #5828, gateway-mode #3586, s3-sync #2448, skill-where
  #5154, and masking-records #5830 (new). The panel-usage reds are the same
  32 at fix and base.

Broken by hand, with the new test:
- Old assets: forced layouts 294 → 654 (WebKit), 296 → 656 (Chromium).
- thumbTo reading offsetLeft/offsetTop again: slow reads 650 → 1132
  (WebKit), 787 → 1267 (Chromium).
- thumbNow on computed style again: slow reads 290 → 415 and 352 → 456.
Each goes red.

Not tried: the real app with 600 real accounts. The numbers come from the
page under Playwright's WebKit and Chromium with fake accounts. Not tried
in WebKitGTK either; there is no new browser API and no new motion.
2026-11-10 01:54:04 +08:00
yetone 769a625548 gateway: its own settings sit under a Settings head, apart from the calls
The owner (11-09): "这两个卡片为什么贴在一起?" The Recent calls list and
the gateway's own settings card touched with no gap. The settings card now
has a Settings row-head of its own above it (the page's 14px head margin),
hidden with the card when the gateway built-in isn't found.

Run on mote: gateway-own-settings.test.cjs and i18n-keys.test.cjs, Chromium
and WebKit, every language, 1100 and 420 wide: 24 of 24.
Broken by hand: with the head and its hide line taken out, 20 of 20 red
(the head's text and the gap of at least 10px are checked).
Not tried: the real app window; the full GUI suite runs with the next commit.
2026-11-10 01:44:17 +08:00
yetone 3d49ac069e usage: a 24 hours period, and the period picked is kept
The Usage page's periods were Today, 7 days, 30 days and All. "Today"
starts at midnight, so early in the day it shows almost nothing
(mahiro233 on Discord). A "24 hours" period now sits after Today and
asks the server for its rolling window, last:24h (#2075), with an
hourly chart. Its empty state says "No calls in the last 24 hours."
(en, zh, zh-TW, ja, de). The menu bar's credit days count it as 2.

The period picked from the list is kept in localStorage and the page
opens on it next time. Picked day ranges aren't kept (they go stale),
and neither is a period the URL brings (?period=7d from the menu bar).

Tests: usage-24h.test.cjs (new; Chromium and WebKit, en and zh, 900px):
24 hours sits after Today and asks for last:24h, its empty note, a
reload opens on the kept pick, ?period=7d is not kept. Five usage
tests counted the period list by index and were moved one along.

Run on mote at be2d2db5c + this change: usage-24h, usage-range,
usage-phone-head, usage-ledger, usage-ledger-chart,
usage-ledger-open-settled, usage-refresh-flight, credit-days,
tray-totals, usage-head-steady: pass 148, fail 6. The 6 are
usage-ledger's "newest live route needs no return-to-live button"
(en/zh, both engines), which fail the same 6 on be2d2db5c without
this change (#3104). i18n-keys ok; go test -run "Budget|I18n|Script"
./internal/gui ok. No budget raised.

Broken by hand: none beyond the index shifts the old tests caught.
Not tried: the real app with a day of real calls.

Reported-by: mahiro233 (Discord)
2026-11-10 01:39:27 +08:00
yetone be2d2db5c3 gui tests: gateway mode's hidden alerts are read through their Alerts list
7d177985f put the four alert rows under an Alerts heading and hides the
heading and its list as one in gateway mode, not each row. gateway-mode's
agentRows still read each row's own hidden, so it went red in both engines
in the full GUI run ([false,true,true,true,true]). A row now counts as shown
when neither it nor its list and heading are hidden. What the user sees was
right; only the test read the old layout.

Run on mote: gateway-mode.test.cjs 6 of 6.
Broken by hand: with the heading and list left out of the gateway-mode
hide, chromium en and webkit en go red on "agents' rows in gateway mode".
2026-11-10 01:28:25 +08:00
yetone e21b401402 gui tests: group-editor-fits waits for the fold's label column to settle
The advanced fold takes its label column from edAlign, a ResizeObserver
that sets --ed-lab a frame or two after the editor opens. The test
measured the frame before: "the pattern field spans the models' column"
was red 1 of 3 runs on origin/main f37de8cc4 in chromium on mote (770 en,
333 vs 343). It now waits up to 2s for the pattern field and the models
to start at the same x, then asserts as before.

Run on mote: group-editor-fits.test.cjs 5 runs x both engines, 10/10 ok.
Broken by hand: the fold's column 10px narrower than --ed-lab, red.
2026-11-10 00:13:44 +08:00
yetone c6331b427c routing: a group bound to gateway keys is theirs alone (Xerxes754)
Xerxes754 on X asked to bind a routing group to one or two gateway
keys, so other keys neither see nor use it. Before this a key could only
be held to models from its own side (naming group/<id> in its Models);
a key with no limits reached every group, and nothing on a group could
keep it from one.

A group now has Keys (key ids). Set, only those keys, and keys issued
under one of them, may use it:
- groupBarred/groupGiven in key_models.go answer it for every route that
  reaches a group: chat, responses, messages, count_tokens, embeddings,
  images, video, the decider and the subagent and image MCP paths. Any
  other key gets 403 "bound to other gateway keys", naming the group and
  the Routing page, and nothing goes upstream.
- /v1/models and /v1/models/{id} leave it out for any other key, a key
  held to models that names it included. provider.GroupsBound keeps an
  unbound magpie's list as before.
- A keyless request from this computer uses it, as key limits never
  hold one; callerGuard now names a loopback request's key when it
  sends one, so a key used locally is held too.
- SaveGroup keeps the stored keys when a save doesn't name them (the
  CLI, the TUI, the card toggles); an empty list clears them. Ids are
  trimmed, deduped and capped. Sharing a group leaves its keys out;
  importing over one keeps them.
- GUI: Routing, a group's Edit, row "Gateway keys" (网关密钥) with a
  button "Any gateway key" (任意网关密钥) that opens the app menu of the
  user's keys (multi-pick); a bound key since deleted shows "key
  deleted" (密钥已删除). The row shows once there is a key to bind.
  /api/groups lists gatewayKeys (no browser, read-only or issued keys).
  zh, zh-TW, ja, de strings.
- Not covered: a bound group nested in another group is reached through
  the outer one (documented in gateway-routing.md).

Run (mote unless said), at this head rebased on ac4af5823:
- gofmt -l clean; go vet darwin for provider, gateway, gui; GOOS=windows
  go vet for those and access; GOOS=linux go vet -tags nogui; go build.
- go test ./internal/gateway (full package, 905s), ./internal/gui,
  ./internal/access, ./internal/provider: ok. One provider run died on
  workspaceSwitchReadsApart's concurrent map writes in its fake server,
  #5800 already open; the rerun was ok.
- New: TestGroupBoundToKeysIsTheirsAlone, TestGroupKeysKeptBySaves-
  ThatDontNameThem, TestGroupKeysListedAndSaved, and group-keys.test.cjs
  (5 languages x 2 widths x chromium + webkit, deleted key, hidden row).
- GUI on mote: group-keys, i18n*, rt-*, *routing*, *group*, *budget*
  files in both engines: ok. That run found a new group's editor
  throwing on its missing keys (group-editor-align red); the draft now
  gets keys like accounts. group-editor-fits was flaky on origin/main
  too and is fixed in the next commit.
- Whole GUI suite on the Linux box (wsl-run, concurrency 4): still
  running at push; its reds so far are in account-eye,
  accounts-own-signin and accounts-switch-alone (webkit), files this
  change doesn't reach.
- Real binary, sandbox HOME on mote, fake upstream, group bound in
  providers.json: key A lists and uses group/team; key B doesn't list
  it, gets 403 on chat (group/team and "team"), messages, count_tokens
  and responses, 404 on /v1/models/group/team, and still uses fake/m1;
  keyless local lists and uses it; upstream got 3 calls.

Broken by hand, each turned its Go test red: the issuer chain not
walked; an unheld key let through (groupGiven true); a held key's
groupAllowed ignoring the binding; SaveGroup not keeping nil keys.

Not tried: binding from the real app's window end to end (the e2e
bound by file), Windows and Linux runs of the Go tests; the CLI and TUI
can't set keys (they keep them).
2026-11-10 00:13:44 +08:00
yetone ecc16fe979 usage: the quick panel and the Usage page word unpriced calls alike
The quick panel's Cost said "15 个没有价格" while the Usage page's
said "15 次调用没有已知价格,未计入". Both now say "{n} calls unpriced"
("15 次调用未计价"), as the page's other cost heads already did, with
the whole sentence on hover.

Reported-by: tenacious_eagle on Discord

The Usage page's plugin already had the two count keys; they live in the
core's i18n.js now that the quick panel says them too (i18n-keys: no key
twice, a plugin's words are its own). The Overview calls tile says the
same words, so usage-unpriced-sum's tile wording follows.

Run on mote at origin/main fc9ce34d8 + this: gofmt -l internal clean;
node --test i18n-keys, i18n-en-no-cjk, panel-usage, tray-totals,
usage-unpriced-names, usage-unpriced-sum, usage-stat-sub-wrap, currency,
usage-compact-counts 126/126; go test ./internal/gui ok (TestCoreScriptBudget
under its budget, not raised). usage-ledger's "newest live route needs no
return-to-live button" is red alone on fc9ce34d8 too (#3104, #5048).
2026-11-10 00:13:32 +08:00
yetone 3b550a99c7 providers: a sign-in kept to its link leads to the setting that kept it
With Settings › Privacy › Sign-in pages' "Open sign-in pages in the
browser" off, adding an account says "magpie didn't open the sign-in
page, as set in Settings" and gave no way to that setting (the
scattered settings audit after netube99 on X). That line now ends in a
Settings › link that opens Privacy and lights the row. The row stays
in Privacy: it is there for max2020's reason, a vendor seeing which
browser a user signs in from.

app.js's core budget is met by one comment cut beside it, no raise
(38 bytes over before the cut).

Run (mote, through mote-run, Chromium and WebKit): signin-link-only
(every language, both a link-only and an opened sign-in, which has no
link), video-gen-pick and i18n-keys, 78 of 78; TestCoreScriptBudget ok
after the cut.
Broken by hand: no link, signin-link-only red in Chromium.
Not tried: a real sign-in in the app; the whole GUI suite runs after
the last of these changes.
2026-11-10 00:01:15 +08:00
yetone cedacf1aea settings: Video generation's how-to leads to the Providers page
With no model that makes videos, Settings › Models › Images' Video
generation says to right-click a model in its provider's Model settings
and mark it a video model, on another page, with no way there (the
scattered settings audit after netube99 on X). The line now ends in a
Providers › link that opens that page. It is drawn in videogen.js, so
the core script doesn't grow.

Run (mote, through mote-run, Chromium and WebKit): video-gen-pick
(every language it covers, 1100 and 400), signin-link-only and
i18n-keys, 78 of 78; TestCoreScriptBudget and the I18n Go tests.
Broken by hand: no onclick, video-gen-pick red in Chromium.
Not tried: the real app's window; the whole GUI suite runs after the
last of these changes.
2026-11-10 00:01:15 +08:00
yetone 8607a7a029 library: a skill GitHub's limit left unchecked leads to the token's row
A skill check that ran into GitHub's 60-an-hour limit says "Add a
GitHub token in Settings → Network and sharing", in a status line that
fades and a tag's tooltip, and nothing there went to Settings (the
scattered settings audit after netube99 on X). The Not checked tag is
now a link when the limit was the one without a token: it opens
Settings › Network and sharing and lights the GitHub token's row. A
token's own limit has nothing to add there, so its tag stays plain.

github-token.test.cjs swaps its route between rounds with
unrouteAll({ behavior: "ignoreErrors" }): the click leaves Settings'
lazy files being served, and the old unroute made the next round's
handler fulfil a route already handled.

Run (mote, through mote-run): github-token.test.cjs, Chromium and
WebKit, en and zh, 8 of 8; github-token plus every
library-*.test.cjs before the route fix: 1211 pass, the one red that
route race.
Broken by hand: the tag never a link, 4 of 8 red (each limited case).
Not tried: the real app's window; the whole GUI suite runs after the
last of these changes.
2026-11-10 00:01:15 +08:00
yetone 92be1d779b usage: the allowances' head opens Settings › Allowances
The Usage page draws the allowances, but how they are shown (used or
left, the menu bar's figures) and their alerts are set in Settings ›
Allowances, and nothing on the page said so (the scattered settings
audit after netube99 on X). The allowances' head now has a Settings ›
link, as the Routing page has, that opens that tab and lights the
Allowance display row (now #quotaLeftRow). Wired in the usage plugin,
so the core script doesn't grow.

Run (mote, through mote-run, Chromium and WebKit, every language, 1100
and 420): settings-places, mobile-web (with an origin/main baseline;
the button is taken out until the baseline has it, as rtToSet is),
account-mask, quota-curve, i18n-keys: 89 of 89, twice. A first run had
one red whose name a tail cut off; the next two runs of the same files
were 89 of 89, so it is unnamed and not seen again.
Broken by hand: no onclick, settings-places 2 of 2 red (no row lit);
no #quotaLeftRow, 1 of 1 red.
At the pushed head (rebased on f37de8cc4, which changed plugin pages and
the core budget): Budget and I18n Go tests ok; settings-places,
i18n-keys, plugin-page 30 of 30.
Not tried: the real app's window; the whole GUI suite runs after the
last of these changes.
2026-11-09 23:44:16 +08:00
yetone 623e797fde plugin pages: read a day's usage and share a picture they drew
A plugin's page can now read one day's usage and share an image it
drew. This is for the day card (JungleyYeh on X asked for a "daily AI
statement"); the card itself is an optional community plugin,
@magpie-community/page-day-card.

- A page that asks for the "usage:day" read gets that day as
  magpie.read("usage:day", {date, tz}): totals, each agent and its
  models, the streak and the average active day (usageapi/day.go,
  gui/pageday.go). The Plugins page names the read before it is granted.
- magpie.image.copy(png) and magpie.image.save(png, name) share a PNG
  of at most 16 MB. In the window they go through
  POST /api/plugin-pages/image (pageimage.go): copy puts the picture on
  the clipboard (clipimage.go: osascript PNGf on macOS, PowerShell
  PNG + Bitmap on Windows, wl-copy or xclip on Linux), and save writes
  it to Downloads under a name made safe. In magpie web, the browser
  saves or copies the picture itself.
- The window's side, pageshare.js, is imported the first time a page
  shares a picture. The core grows by its one call only, paid for by
  comments cut, so the budget is not raised.

Tests:
- New: TestDayOf, TestPluginPageReadsADay, TestPluginPageSharesAPicture,
  TestPageImageName and TestClipImageCommand. plugin-page.test.cjs
  covers the bridge, both engines and a refused SVG.

What was run (mote):
- gofmt, plus go vet on darwin, linux and windows: clean.
- Full go test ./... at the pre-rebase base: 369 packages ok, 3 FAILs.
  - TestEveryRouteHasACommandOrIsNamed and TestCoreScriptBudget were
    this change's own reds. The new route now has a parity entry, and
    the share code moved into lazy pageshare.js with no raise.
  - TestGatewayModeStatsNameTheGatewaySessions is #5690, the red in the
    first hour of the day (it ran at 00:32).
- GUI suite (affected and plugin files, both engines): 1160 of 1179
  passed. Every red is filed and none touches this change:
  - i18n-keys "a plugin's words are its own": #5332, #5426, #5482.
  - page-width-steady: #5013.
  - plugin-card-update in WebKit: #3079.
  - plugin-move-unserved "Try again": #4410.
- At this head, after the rebase on bc8b01d60:
  - gofmt clean; go vet ./internal/... on darwin, linux (nogui) and
    windows ok.
  - internal/usageapi, internal/plugin and internal/cli ok.
  - internal/gui: TestCoreScriptBudget, the TestPluginPage* tests and
    the TestPageImage/TestClipImage tests pass.
  - plugin-page and old-webkit (both engines): 12 of 12.

Real use:
- A sandbox HOME with a copy of real usage, through the real GUI
  server, in Chromium and WebKit, light and dark, en/zh/zh-TW/ja/de, at
  420 and 1100 px. The card showed 87.9M tokens, $9.85 and 4076 calls
  with a 22-day streak.
- Picking an earlier day and WebKit's Copy ("Copied") worked, with no
  page errors.
- Not tried at push: Chromium's Copy (its headless clipboard was
  denied) and magpie web's Save as a captured download. A second real
  run that grants both was still queued on mote's suite lock.
- Clipboard: checked live on macOS (osascript) and Windows
  (PowerShell). Not tried live on Linux: WSLg had no display.
2026-11-09 23:19:14 +08:00
yetone bc8b01d603 claude: the short system prompt is set in the Claude Code editor, not Settings › Replies
The scattered settings audit after netube99 on X. Short Claude system
prompt and Claude Code's interactive mode changed only Claude
subscription runs, yet sat in Settings › Models › Replies, while the
Claude Code editor already had its own "Claude Code runs as" switch for
the second, whose card said "Switched here or in Settings › Models ›
Replies".

Both rows now go in a claudeRunList in the Claude editor (PROV_PREFS), so
Settings' search still finds them and Open goes to the editor. In the app
the editor's own "runs as" switch is the one shown, and the duplicate
interactive mode row is hidden by CSS; in magpie web as a gateway, where
that switch is disabled, the row shows (the list gets a gw class from
renderReplies: body.gateway-mode is set only on a change, not at boot).
provPrefsField lets Claude's run list through in gateway mode, without
the warm-ups, which are this computer's. The card and the "off" reason
no longer name Settings (zh, zh-TW, ja, de written with them), and the
bridge's subsystem page names the editor.

Run (mote, mote-run, origin/main ddd6c649b as BASE_REF):
- claude-lean-prompt-setting, claude-tui-setting, claude-mode,
  provider-prefs, settings-places, i18n-keys, bare-ids and mobile-web,
  both engines: 170 of 170.
- go test -run 'Budget|I18n|Strings' ./internal/gui: ok.

Broken by hand (chromium):
- both rows back in Replies: claude-lean-prompt-setting and
  provider-prefs 18 of 18 red;
- the editor's duplicate row not hidden: claude-tui-setting 8 of 8 red;
- no gw class in gateway mode: claude-tui-setting 8 of 8 red.

Not tried: the real app with a real Claude subscription.
2026-11-09 23:14:57 +08:00
yetone a6e4cf7635 settings: what routing does sits under Models › Routing, and the Routing page opens it
The scattered settings audit after netube99 on X. Ask again after a
refusal, the Retry-After cap and the intent classifier's timeout were
under Models › Replies beside rows about a reply's content, and Busy
models last sat in Network and sharing, far from the routing it changes.
The four are now one Routing section under Models, after Replies, and the
Routing page's header has a Settings › button that opens Settings at that
section with its first row lit. The docs (reference.md, the site's
plugins page in en, zh and ja) name the new place.

Run (mote, mote-run):
- settings-places, retry-after-cap-setting, refusal-retries-setting,
  classify-timeout-setting, model-load, i18n-keys and bare-ids, both
  engines: all pass.
- mobile-web against origin/main fdabddeb4 (a git repo made in the copy
  from git archive, since mote-run carries no .git): 30 of 30. It now
  takes the new Settings › button out of the Routing page until main has
  it, as it does for other new rows.
- go test -run 'Budget|I18n|Strings' ./internal/gui: ok. gofmt clean.

Broken by hand:
- the three rows back in Replies and busyLoadRow left where it was:
  settings-places and retry-after-cap-setting 20 of 20 red (chromium);
- the Settings › button's click handler off: settings-places 10 of 10 red.

Not tried: the real app; the GUI suite beyond these files runs with the
rest of this audit's changes.
2026-11-09 22:42:58 +08:00
yetone 7d177985f6 settings › allowances: the alerts under an Alerts heading, and no empty Menu bar cost row in magpie web
The scattered settings audit after netube99 on X found Task done alert
filed among the allowances' display rows, with nothing saying why, and
magpie web drawing Menu bar cost as a row with no control (it has no
menu bar, and renderTrayUsage returns before filling it there).

- Allowance alert, Low balance alert, Reset reminder and Task done alert
  are now a list of their own under an "Alerts" heading (#alertHead,
  #alertList), after the display rows. Gateway mode hides the heading
  and the list, as it hid the four rows.
- #trayCostRow is app-only, as #trayUsageRow is.
- "Alerts" in zh, zh-TW, ja, de.

Run (mote, at this tree):
- settings-places (new), bare-ids, turn-done, usage-alert,
  reset-reminder, mask-alert, settings-search, i18n-keys:
  122 pass, 0 fail, both engines.
- go test -run "Budget|I18n" ./internal/gui: ok.
Broken by hand: without app-only, settings-places is red 10 of 10 on
"no Menu bar cost row in magpie web"; with the heading renamed, red 10
of 10.
Not tried: the real app; the row moves are markup only.
2026-11-09 22:42:58 +08:00
yetone 92e8edd7fc windows: magpie is listed in Installed apps, and its Uninstall puts every agent back
Jevik_AI on X uninstalled magpie and rebooted, and Codex's config.toml
still had openai_base_url = "http://127.0.0.1:3425/backend-api/codex";
Rk1ngggg asked whether an update cleans it. magpie's own uninstall
(Settings › About › Uninstall magpie, `magpie uninstall`) already
disconnects every agent and takes Codex's leftovers (#3866), but on
Windows magpie wasn't in Settings › Apps › Installed apps, so it was
removed the way Windows offers for a program it doesn't list: by
deleting the exe and folders, which runs no code.

shortcut.Ensure now writes
HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\magpie
(DisplayName, DisplayIcon, Publisher, InstallLocation, UninstallString,
URLInfoAbout, NoModify, NoRepair) at every installed start, beside App
Paths, and Remove (uninstall's System step) takes it out the same way:
only while it names this exe, or an exe that is gone. Its Uninstall
runs `magpie.exe uninstall --window` (shortcut.UninstallArgs). magpie.exe
has no console, where the terminal's `magpie uninstall` would refuse
for want of one to ask on, so those exact args open the app's window
(or forward to the running app, OnSecondInstanceLaunch) on Settings ›
About with Uninstall magpie's question asked (uninstallView,
?uninstall=1). It asks once: a redraw of Settings doesn't ask again,
and Cancel removes nothing. magpie web opened at that link asks
nothing. Deleting the app by hand still runs no code (macOS
drag-to-Trash included); agent-wiring.md says so.

Run on mote at the pushed head (rebased onto be9dbce02):
- gofmt -l clean; 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.
- go test -tags nogui ./internal/gui ./internal/cli ./internal/shortcut
  ./internal/uninstall: ok (TestCoreScriptBudget included).
- uninstall-settings.test.cjs and i18n-keys.test.cjs: 40 of 40
  (chromium and webkit; the new Installed-apps cases in en and zh at
  1100 and 420).
At d3f40bedd, the same change on c7ebb6f8d, under suite.lock:
- go test -tags nogui -timeout 45m ./...: ok, every package.
- The whole GUI suite (--test-concurrency=4): 22518 of 22800; the 282
  reds are in 53 files the change doesn't reach (model-chip-steady 40,
  usage-agents-hide 22, zero-priced-free 20, provider-fetch-again 14,
  ...), the full-suite reds of #5475; the numbers are on that issue.
  Their run at c7ebb6f8d alone is queued behind other sessions' suites.
- The first full run found the core scripts 147 bytes over
  TestCoreScriptBudget; the page's part was cut to one line (the
  budget is not raised).
On xiaomi-gpu (win-run): go test ./internal/shortcut, incl.
TestInstalledAppsEntry on the real HKCU registry under a test key: ok.

Broken by hand, each red:
- registerAppPath not calling registerUninstall: TestInstalledAppsEntry
  (UninstallString = "") on Windows.
- main.go not taking UninstallArgs to the window:
  TestInstalledAppsUninstallOpensTheWindow (unknown "--window").
- app.js not asking on ?uninstall=1: 4 of 4 Installed-apps GUI cases.
- app.js asking without its once guard (params.delete): the same 4
  ("asked again").

Not tried: a real Settings › Apps › Uninstall click on Windows with an
installed magpie (the test box's install belongs to other sessions); the
second-instance forward (OnSecondInstanceLaunch) has no test of its own.
2026-11-09 22:33:31 +08:00
yetone 39569d5604 claude desktop: an optional Claude Magpie app beside your own Claude (#5671)
baranwang on X asked to keep Claude Desktop's own (1P, Anthropic) sign-in
while using magpie. Turning on "Separate app" in Claude Desktop's row on
the Agents page (or `magpie claude-desktop launcher add`) moves magpie's
3P wiring into ~/Library/Application Support/Claude-Magpie-3p and adds
~/Applications/Claude Magpie.app. That launcher opens Claude.app with
--user-data-dir on that folder, so it runs side by side with the user's
own Claude.app. Its icon is Claude's icon with a magpie badge. Off is the
default, and turning it off (`launcher remove`) moves the wiring back
and removes the app. It is macOS only: Desktop's packaged app strips
CLAUDE_USER_DATA_DIR, and on Windows it hardcodes LOCALAPPDATA\Claude-3p.
The folder ends in -3p because Desktop adds -3p to any other name.
Restarting the isolated app ends only its own process (pkill on its
--user-data-dir) and opens the launcher again.

Run at 1b25cda26 (this change on origin/main be9dbce02); rebased onto
fdabddeb4 (catalog only), then go build ./..., vet and the budget and
launcher tests again: ok. All
on mote:
- gofmt -l clean; go vet ./internal/...; GOOS=linux go vet -tags nogui
  and GOOS=windows go vet on agent, cli, desktopiso, desktopdir, gui.
- go test (whole packages) desktopiso, desktopdir, settings, settingsapi,
  proc: ok. -run Isolated|TestDesktopInstance|TestAddStartsDesktopOnTheFolder|
  TestScript|TestAddLeavesTheirs|ClaudeDesktop|Restart in agent;
  TestClaudeDesktopLauncher|TestEveryRouteHasACommandOrIsNamed|Help in cli;
  TestCoreScriptBudget|TestSettingsSaveKeepsWhatItDoesNotSend|Budget|Desktop
  in gui and gateway: ok.
- An earlier full `go test ./...` at fef23255f had four reds, all from
  this change and fixed here: the route without a command (now in
  notYet), settings_keep's DesktopIsolated, os/exec instead of proc, and
  the core script budget (paid by sharing the switch helper with the
  largest-window line and cutting comments; no raise). A second full run
  of the touched packages queued ~7h on mote's suite lock behind other
  sessions and was stopped; the targeted runs above replace it.
- GUI on mote, both engines: desktop-isolated (new; en, zh, zh-TW, ja,
  de; 1100 and 640; aria-checked, posts, status text, no scroll, no
  select, absent without `isolated`), desktop-longest, click-scroll,
  plain-names, i18n-keys: ok. page-width-steady, panel-fold and
  zero-priced-free are red, the same 33 tests at origin/main be9dbce02
  (diffed): #4541/#5013, #5796, #5262. i18n-keys' "a plugin's words are
  its own" is red on main too (#5332).
- Whole GUI suite on WSL at an older head: 400 of 22778 red across
  ~100 files of other pages, in line with #5559 (478 of 21666 on main
  there). Not rerun on mote.

Real use, on mote in a sandbox HOME with Claude.app 4.23118 linked in:
`claude-desktop magpie`, then `launcher add`, moved the wiring to
Claude-Magpie-3p (deploymentMode 3p, mcpServers and locale carried).
Opening Claude Magpie.app started Claude with
--user-data-dir=.../Claude-Magpie-3p; it wrote configLibrary and
model-catalog there (3P mode) and no -3p-3p folder. A second, 1P Claude
ran beside it on its own sandbox folder. Opening the launcher again
kept one instance; the pkill pattern matched only the isolated pid; both
quit on SIGTERM. `launcher remove` put the wiring back and removed the
app.

Broken by hand: a folder without -3p (Desktop made -3p-3p), the
CLAUDE_USER_DATA_DIR env route (ignored by the packaged app), os/exec in
the quit (TestNoCommandBypassesProc red).

Not tried: a screenshot of the running app (screencapture fails over
ssh); a model request through a gateway from the isolated app; Windows
and Linux (not offered there). Known: the Dock shows Claude's own icon
for the running isolated app, and Chrome pairing is off in a moved
userData folder.
2026-11-09 22:31:16 +08:00
yetone be9dbce02c settings search: built-ins are found too, off or on, and Open goes to their row
A built-in's switch and the settings it keeps in Plugins › Built-in or on
its own page (Gateway's Recent calls at a time) were found by nothing in
Settings' search, and one switched off took its Settings tab and rows
with it, so searching "Observability" with it off said no setting
matched (the scattered settings audit after netube99 on X). The search
now lists, after Settings' own rows and under "Plugins › Built-in", each
built-in whose name, line or schema setting has the words, in the
language shown or English, one off saying Off. Open goes to Plugins ›
Built-in and lights that row, again when the list is drawn a second time
as the plugins are read.

The list is drawn by a lazy setfeats.js the first time a search runs,
and only when what it finds changes, as Settings' observer runs the
search again on each change under the view.

Run (mote, at f98e954ce's tree plus this): settings-search,
old-webkit, builtin-places, provider-prefs, i18n-keys: 170 pass, 0 fail,
Chromium and WebKit, every language; TestCoreScriptBudget ok. Broken by
hand: without the row's light, and with the match always false, the new
case went red in Chromium (7 pass, 2 fail each).
2026-11-09 22:11:00 +08:00
yetone 07a06617e1 quota: an early reset starts the Cycle chart though the card's reset has milliseconds
steven_4422 (Discord #feedback, 11-09): a weekly window refilled early at
Nov 9 02:00 kept its deadline, yet the Cycle trend began at Nov 4 10:40, the
vendor's own start. quotaCycle took the recorded early reset only when the
card's resetsAt equalled the last reading's exactly. History keeps whole
seconds and a vendor's deadline can drift a little between reads, so the
two rarely matched. Now a reset minutes apart counts as the same one.

Run (mote): new quotaCycle test red on the old code (actual
2026-11-04T10:40:00.437Z, the reporter's start), green after;
quota-curve.test.cjs 31/31; go test -run Budget ./internal/gui ok.
Not tried: the reporter's own account; the full GUI suite (mote's suite
lock queue is hours long).

Reported-by: steven_4422 (Discord #feedback)
2026-11-09 22:06:55 +08:00
yetone 89d8b4d5f9 settings search: a provider's settings are found only while that provider is added
Settings' search lists each provider's own settings (warm-ups, check-ins
and the like) as rows that open the provider's editor. It listed them
for every provider magpie knows, so a search for "warm up on reset"
offered ChatGPT and Claude to a user with neither, and Open did nothing
(the scattered settings audit after netube99 on X). A row now remembers
its providers and is left out while none is added, and a row whose
built-in plugin is off is left out as the others are.

Those rows are drawn by a lazy provlinks.js the first time a search
wants them, not on each Settings draw: app.js was 399 bytes over
TestCoreScriptBudget with the change, and is now 956 under its size at
the base, with the budget unchanged.

Run in the tree with this change and the rest of the audit's fixes
(mote, base cd0ba05c2): settings-search, provider-prefs, old-webkit,
i18n-keys, builtin-places: 168 pass, 0 fail, Chromium and WebKit;
TestCoreScriptBudget ok. Broken by hand: without the set-miss line the
new case was red with ['ChatGPT','Claude'].
2026-11-09 21:51:54 +08:00
yetone 4064c10362 routing groups: on while Routing is off, their Built-in row says their page went with it
Routing groups have no page of their own: theirs is on Routing. With
Routing off and Routing groups on, Plugins › Built-in showed the groups
switch on and nothing anywhere to set them, and the quick start's
routing step still counted groups alone (netube99 on X, and the
scattered settings audit after it). The groups row now says "Their page
is on Routing, which is off" with Turn on Routing, which flips Routing's
own switch on the same list, and the quick start's step leaves with
either one off.

The hook lives in a new plugins/routing/settings.js, loaded after app.js,
whose featWho it extends (plugin client files load before app.js; the
first try in client.js threw "featWho is not defined" in every test).

Run in the tree with this change and the rest of the audit's fixes
(mote, base cd0ba05c2): builtin-places, mask-alert, settings-search:
162 pass, 0 fail, Chromium and WebKit, every language, 1100 and 420
wide; i18n-keys pass. Broken by hand: the hook returning at once,
builtin-places' groups case went red in all 20 runs.
2026-11-09 21:51:53 +08:00
yetone 7cb437ee16 masking: its alert sits with its other settings, and its Built-in row says when nothing is masked
The Masking alert was the one masking setting on the Masking page, under
the request list, away from every other one in Settings › Privacy (and
in Settings › Usage before that, where nb5p looked for it). It is now
the first row of Privacy's "when a value is found" list, out in gateway
mode as before. The Masking page is the list of masked requests alone.

Masking turned on with no kind, no personal data and no word of the
user's masks nothing, and its Plugins › Built-in row said only where
its settings are. It now says "Nothing is masked yet" before the link
(the scattered settings audit after netube99 on X).

Run in the tree with this change and the rest of the audit's fixes
(mote, base cd0ba05c2): mask-alert, builtin-places, settings-search:
162 pass, 0 fail, Chromium and WebKit, every language, 1100 and 420
wide; i18n-keys pass. The builtin-places file committed here is the
one run minus the routing-groups case, which comes with its change.
2026-11-09 21:51:53 +08:00
yetone 17a94a1b00 gateway: its keys show for a web page listed in Settings, and Settings links to them
A web page listed under Settings › Network and sharing › Web pages that
may call magpie is refused without a gateway key, shared or not, and the
row says to use "a gateway key from Gateway". But the Gateway page drew
its keys only while Share on local network was on, so that user found a
line saying keys come with sharing and no way to make one (the scattered
settings audit after netube99 on X). The keys now show while sharing is
on or a web page is listed, the off line names web pages too, and the
Web pages row links to Gateway's keys once it has a page.

The guard in renderGatewayOwn's settings callback also redraws the whole
view only while its box is still in the page, as 5efe0e195 does for the
first draw.

Run in the tree with this change and the rest of the audit's fixes
(mote, base cd0ba05c2): gateway-keys-off, cors-origins,
gateway-own-settings, old-webkit, i18n-keys: pass in Chromium and
WebKit, every language, 1100 and 420 wide (72 of 72 for the first four).
Broken by hand: gwKeysShown limited to sharing alone, gateway-keys-off
went 20 pass / 20 fail.
2026-11-09 21:51:53 +08:00
yetone 88b541a25c images: every pointer names Settings › Models › Images, where the page is
The image models moved under Settings › Models, but the Library's Magpie
Image sheet, the MCP server's instructions to agents, the gateway's
"no image model" errors, the video tool's text and the docs still sent
users to "Settings › Images", a tab that no longer exists (the scattered
settings audit after netube99 on X). Every user-facing string now names
Settings › Models › Images in en, zh, zh-TW, ja and de, as do the site's
Qwen docs (en, zh, ja), llms-full.txt, the subsystem pages and comments.

Run in the tree with this change and the rest of the audit's fixes
(mote, base cd0ba05c2):
- go vet ./internal/gui ./internal/gateway ./internal/agent
  ./internal/provider ./internal/settingsapi: ok
- go test -run 'Image|Draw|Video|Hidden|Group|Settings' ./internal/gui
  ./internal/gateway ./internal/settingsapi: ok; ./internal/imagemcp,
  ./internal/library, ./internal/catalog: ok
- GUI: i18n-keys, i18n-en-no-cjk, image-models-hide,
  library-browser-setup: pass in Chromium and WebKit
- gofmt -l: nothing
Not tried: a real agent reading the new MCP instructions (text only).
2026-11-09 21:51:53 +08:00
yetone ffbc45eac5 usage: a breakdown row's second line wraps at every width, not cut at 180px
In a wide window a Usage breakdown row's name column is a fixed 180px
and the line under the name (the sign-in, calls, credits, failures,
TTFT, speed) was one line cut with an ellipsis there, so everything after
the provider was hidden. Only the narrow web layout let it wrap. It now
wraps at every width; the narrow rule that did the same is gone.

Reported-by: shusoyo (Discord #general, 11-09)

Run (mote): usage-stat-sub-wrap.test.cjs 8/8 (chromium, webkit; en, zh;
1440 and 1000px). Broken by hand: with the old app.css it is 0/8 ("the
line wraps, not cut").
2026-11-09 21:40:13 +08:00
yetone 331f4a1393 gui tests: a comment line doesn't say a plugin's words (#5332, #5327, #5426, #5482)
i18n-keys' "a plugin's words are its own" has been red on main since
73c98ebc2 and was filed four times with no owner. Each red was a Go
comment citing a word from the window: search_row_archive_test.go's
"(View routing, the …", trace.go's '"No session ID")' and
skills_shared_copy_test.go's "Use the library's sets …". A comment says
nothing to the window, so whole-line // comments in .go and .js are left
out of the scan. Words in code are still found.

Run on mote at this tree (on origin/main c9a1c557d):
- node --test i18n-keys.test.cjs: 4 pass, 0 fail (was 1 fail on
  e3f1efdaa, the same three words).
Broken by hand: a code line t("View routing") in app.js turns it red
("plugins/usage/i18n.js "View routing": internal/gui/assets/app.js says
it too").
2026-11-09 20:14:03 +08:00
yetone c9a1c557d0 plugins: every built-in's row leads to where it is used, and the Gateway page holds its own setting
netube99 on X: one feature's settings are spread over pages that don't
say where the rest are. Plugins › Built-in had six rows (Key limits,
Groups, Rotation, Warm-ups, Middleware, Tools) with no page and no link,
so a user who turned one on was left to find where it shows. And the
Gateway page's one setting, Recent calls at a time, was a form under its
row in Plugins › Built-in, two pages from the calls it is about.

- pluginrt.Manifest gets Opens: the window page a built-in without a page
  of its own is used on. budget → gateway (keys' limits), groups →
  groups, rotation and warmups → providers (a provider's editor),
  middleware and tools → plugins. builtinJSON sends it; featGo links to
  that page by its sidebar name, as for a page plugin.
- A plugin with a page draws its settings there, not under its row
  (renderBuiltins). The Gateway page draws its schema under Recent calls
  (renderGatewayOwn), saves through /api/plugins/builtin as before, and
  ends with a row "Port, allowed addresses and model ids" that opens
  Settings › Network and sharing at the gateway's rows (4 languages).

Tests:
- TestBuiltinSaysWhereItsSettingsAre holds SetAt, Page and Opens per
  built-in.
- builtins.test.cjs: no form in Built-in, and each Opens row's link says
  its page's sidebar name. Its row reached by the wheel now counts the
  window's bottom too, and frees a switch under the view's floating To
  the bottom button by wheeling toward the window's middle: the rows grew
  with their links, and WebKit de 420 left Usage's switch under it.
- gateway-own-settings.test.cjs (new): the setting under the calls,
  translated, 20, picking 50 posts {id: gateway, config: {callsPage: 50}},
  the row opens Settings › Network at #portList flashed; every language,
  Chromium and WebKit, 1100 and 420, nothing past the window.
- builtin-places.test.cjs: Library's row now leads to Library.

Run at this tree (on origin/main e3f1efdaa), on mote:
- gofmt -l: nothing. go vet ./internal/gui ./internal/pluginrt
  ./plugins/..., GOOS=linux go vet -tags nogui, GOOS=windows go vet: ok.
- go test -run 'TestBuiltin|TestCoreScriptBudget|Translat' ./internal/gui
  ./internal/pluginrt ./plugins/...: ok.
- node --test builtins builtin-places websearch-places gateway-own-settings
  gateway-keys-off i18n-en-no-cjk: 272 pass, 0 fail (both engines).
- i18n-keys: "a plugin's words are its own" red, the same on a clean
  origin/main e3f1efdaa (#5332, #5327, #5482, #5426); fixed next.
Broken by hand: without budget's Opens, TestBuiltinSaysWhereItsSettingsAre
fails (want "gateway"); without the renderGatewayOwn call,
gateway-own-settings is 0 of 10 in Chromium.
Not tried: the real app; the whole GUI suite (next, behind suite.lock).
2026-11-09 20:12:30 +08:00
yetone 7000b23b88 gui: a reset's time is said by a formatter kept per language, not made each call (#5310)
resetClock and resetText called toLocaleTimeString/toLocaleDateString/
toLocaleString, which build a new Intl formatter on every call. The Usage
page says every account window's reset on each render, so 600 accounts
made thousands of formatters per render.

dateFmt(opts) in i18n.js keeps one Intl.DateTimeFormat per intlLang() and
options. resetText's past time gives toLocaleString's default
fields (year/month/day/hour/minute/second numeric) by name, which is
what toLocaleString uses when given no options.

Probe (mote, 600 accounts open, W=520, names wrapping, 8 renders,
median sync ms, before → after):
  WebKit   ~431 → ~377
  Chromium ~327 → ~279

Test: reset-clock-formats.test.cjs compares resetClock and resetText
with what the old toLocale*String code said word for word. It covers a
time every 5h from a week back to eight days ahead, in en, zh, zh-TW,
ja, de and then system (a language switch after the cache is warm),
Chromium and WebKit, in a Tokyo time zone with an en-GB system. 2/2
green.

Broken by hand: a cache key without the language is red in Chromium
(zh said "02/11/2026, 20:29:01" for "2026/11/2 20:29:01").

Run at this change on 74017e0b8 (mote): TestCoreScriptBudget ok. The
40 GUI files that say a reset time ("Resets", "Reset time",
"tomorrow", 重置) plus i18n-keys: 770 tests, 3 red. The reds are
codex-auto-reset webkit de 1100/420 (red the same at its base 40cfae5d3,
#4790) and i18n-keys 'a plugin's words are its own' (#5327 #5332 #5426
#5482).

Not tried: the other ~37 toLocale*String calls in app.js. They run once
per page or row, not once per account window.
2026-11-09 19:21:46 +08:00
yetone 7a2a05c7a3 routing: Accounts and keys keeps each provider's heading while it says the same
freefcw on X (11-09, v0.1.3373 and v0.1.3375): magpie at 32% CPU with
2,250 idle wakeups and its webviews at 80 to 223MB; lemonkillergame and
laincatx say the same of CPU and memory.

The Routing page draws Accounts and keys again each second while it is in
sight (countdown: its rests and resets count down). Each drawing made
every provider's heading anew, icon <img> included, and patch then kept
the old heading in the page. But an <img> asks for its picture as soon as
its src is set, in the page or not, and the app's icons go out no-cache
(revalidated), so every provider's icon was asked for again each second:
through the Wails asset server in the app (a read and a sha256 of the
file each time), and each a new SVG document in the webview (~0.6MB, #909).
Over `magpie web` on mote, a seeded HOME with five providers on Routing:
322 requests a minute, 155 of them icons every 30s; every other page asks
for 4 to 13 in 45s.

A heading is now kept per provider while its icon, name and routing mode
are the same, and a heading with its first row are a list of nodes, no
longer a box they were moved into: the move took a kept heading or keys
row out of the page each second, so patch never found it in place.

Measured on mote (M5 Pro, load 50 to 90 from other sessions), the
0.1.3377 build vs this one, `magpie web` in Playwright WebKit on
?view=routing, 60s, twice each:
- requests: 322 and 325 a minute -> 7 and 7 (icons: 31 each per 30s -> 0)
- magpie's CPU: 0.78% and 0.73% -> 0.32% and 0.32%
- magpie's RSS: 225-227MB both

Test: routing-acts-idle.test.cjs, in Chromium and WebKit, en, zh, zh-TW,
ja, de at 1100px and en at 420px: a resting key's countdown redraws the
list, and over 3.5s no icon is asked for again and each heading is the
node drawn before. 14/14 pass; with client.js before this change 0/14
(each heading is a new node). Its icon count alone passes on the old code
there, since page.route's replies are kept in the browser's memory cache;
the real server's requests are the numbers above.

Run on mote:
- every GUI file that opens Routing (181 files, both engines, at
  origin/main 9a00bfed1 + this): 3337 pass, 16 fail in 8 files. Run again
  alone, at this change and at origin/main ff7d84b9b: the same 11 fail in
  both (ctx-session-line, filed #5801; routing-context-fold #5586,
  routing-row-swap #3799, routing-story-shrinks #3954); provider-mask,
  routing-model-rest and usage-compact-counts pass alone in both.
- at the pushed head (on 74017e0b8): routing-acts-idle and routing-acts-calm
  36/36; at 193d171b6: routing-acts-idle, routing-acts-calm,
  routing-acts-compact pass; i18n-keys' "a plugin's words are its own" is
  red, the same at origin/main 0eac4e6aa (#5332, #5426, #5482).
- go test -tags nogui -run 'Budget|Size|Routing|Asset' ./internal/gui: ok.

Not run: the whole GUI suite (only the 181 Routing files) and the full Go
suite (no Go file changes). Not reproduced: freefcw's 32%; the heaviest
seeded HOME here idled at 0.3 to 1.7% and the live heavy-user instance on
the owner's Mac at 0.9%. In the real app on mote the Routing window idled
at 0.3% with no ticking (its window not in sight on a headless session),
so the app's own numbers before and after are not measured, only
`magpie web`'s.
2026-11-09 19:12:45 +08:00
yetone 74017e0b87 gui: a card of many accounts is laid out once a render, not once an account (#5310)
fitQuota stacks each window's counts and gives side-by-side names one
height. It ran group by group: clear the names' min-height, then read
their offsetTop. Every read after a write lays the card out again, so
one Usage render with N accounts in full laid the card out N times,
O(N²). With 600 accounts at 520px wide and the names wrapping (a long
window name), one render held WebKit's WebContent at 100% CPU: 1.7-2.3s
of script and 10-13s to the second frame after it. Chromium took
1.2-1.4s.

fitQuota now takes every group. It reads all the sizes first, then
writes the classes and clears the heights. It reads each name's row and
height in one pass, then sets the heights. packUsage's heights() passes
the card's groups in one call; the ResizeObserver path already passed a
set.

Probe (600 accounts, all open, W=520, wrapped names), on mote:
  WebKit:   0.5s sync, 0.7s to two frames (was 1.7-2.3s, 10-13s)
  Chromium: 0.45s (was 1.2-1.4s)
  Wide layout, both engines: 0.3-0.4s before and after.
Scrolling 600 accounts was smooth before and after (2 frames ~30ms).

Test: quota-fit-batched.test.cjs counts the layouts forced in one
render: a read of a layout getter while MutationObserver records are
pending. The count must be the same at 160 accounts as at 40 (+4 room
for a frame's observer). It also checks that every group was drawn, the
names' heights were written, and each group was evened. Chromium and
WebKit, en/zh/zh-TW/ja/de, 10/10 green.

Broken by hand: the test pointed at HEAD's app.js (MAGPIE_FIT_ASSETS)
is red 10/10: 243 forced layouts at 40 accounts, 963 at 160, both
engines.

Run (mote, load ~30; first at base 40cfae5d3 + this change):
- 161 GUI files that touch quota/usage/panel, both engines, every
  language they cover: 2832 tests, 34 red in 9 files.
- Those 9 files again, on this change and on base 40cfae5d3 alone: 25
  red with the change, 30 on base. Every red on the change is also red
  on base except provider-mask, which times out in a different language
  each run on both trees (#5109).
- The reds on base are filed: codex-auto-reset webkit de (#4790),
  mobile-web (#3952, #5013), tray-cell-click (#5215), usage-fold
  'most on one screen' (#4790, #3415), and panel-fold (#5796, filed now).
- i18n-keys 'a plugin's words are its own' is red (#5327, #5332,
  #5426, #5482).
- At the pushed head (this change on origin/main c056b7c8c):
  TestCoreScriptBudget ok. quota-fit-batched 10/10, and usage-agents-hide,
  usage-compact-counts, usage-fold, usage-ledger and usage-ledger-search
  run beside it: 32 red, the same 32 as at c056b7c8c alone
  (usage-agents-hide #2276 #3414, usage-ledger Requests #5048, usage-fold
  #4790 #3415).

Not tried: the real app with 600 real accounts. The fixture's accounts
are Claude windows with one long name. Another layer is not changed:
the first layout after the rebuild, resetClock's Intl formatters, and
building the DOM, ~45ms each at 600 accounts.
2026-11-09 19:08:52 +08:00
yetone c056b7c8c3 provider: a Responses provider's turns may go over the Responses WebSocket (#5781)
A provider the user added with an http(s) Responses address can now send
its Responses turns over the Responses WebSocket that magpie already
speaks to chatgpt.com (codexSocket), with `socket=auto|on|off`:

- off, or absent: today's behaviour exactly. Provider.Via hides any
  socket value an outer context carried, so such a provider never dials.
- auto: tries the socket, falls back to HTTP when the handshake is
  refused or the socket ends before the reply, and speaks HTTP to a host
  for 10 minutes once it refused the handshake (codexShun).
- on: the same fallback, but never shuns; the socket is tried each turn.

Provider.Via puts the provider's Responses host and path in the request's
context (withSocket); codexSocket's gate is provider.SocketTurn, which
takes a ChatGPT turn as before, or a POST to that host at
<Responses>/responses. The rest is the ChatGPT leg's: the kept socket and
its delta (codexKeepKey now also hashes the scheme, X-Api-Key and
Api-Key), the error frames, 1009 handling. A provider's reply with no
Content-Type is marked text/event-stream, since it is read as one.
Routing, keys, limits, usage and masking are unchanged: only the
transport under the request differs.

Set with `magpie provider set <id> socket=auto|on|off` (refused on a
provider with an account, no http(s) Responses address, or Vertex,
TakesSocket), saved in providers.json as "socket", shown by `provider
show`, and in the editor's Advanced as a WebSocket tick beside HTTP
version (ticked saves auto, keeps a CLI's on, unticked saves off; shown
only while the Responses address is http(s) and there is no account).
docs/subsystems/providers-accounts.md describes it.

app.js pays for its rows by three long comments cut to one line
(renderMove, the vendors' status pages, header rows): the core's scripts
are 478 bytes smaller than on 0eac4e6aa (1,533,069 of 1,533,802); no
budget raised.

Run on mote at this change on origin/main 0eac4e6aa (since then main
added a39b63e88 and 7cabf0da9, internal/sessions only):
- gofmt -l clean; go vet (darwin) of provider, gateway, cli, gui, clean.
- go test -tags nogui ./internal/gui ./internal/cli: ok;
  ./internal/provider -run TestSocket: ok.
- go test ./internal/gateway -run 'TestResponsesProvider|TestCodexSocket|
  TestCodexKept|TestCodexTurn|TestHTTP1|TestInsecureTLS': ok. The new
  tests use an httptest WebSocket upstream: a turn over the socket, a
  provider without the field never dialling (and one on the same host
  with it), a refused handshake shunned on auto and tried again on on, a
  socket closed before the first event going over HTTP, the kept
  socket's delta on the next turn, and the reply being a stream.
- node --test provider-socket (new; chromium and webkit, en zh zh-TW ja
  de, 1100 and 420 wide), provider-http1, provider-insecure-tls,
  i18n-en-no-cjk: pass. i18n-keys' "a plugin's words are its own" is
  red for three words in files this doesn't touch, filed as #5327/#5332,
  #5426 and #5482.
- One rebase earlier (on 2a48974e8, the same change): GOOS=linux (nogui)
  and GOOS=windows go vet of the four packages clean, and the whole of
  ./internal/provider ok.
- Broken by hand, each red then green: SocketTurn codex-only (all six
  gateway tests red); a path-suffix gate in place of the context
  (WithoutSocketNeverDials, TestSocketTurn red); the never-shun case
  removed (RefusedOnTriesAgain red); the Content-Type line removed
  (ReplyIsAStream red).

Not tried: a real Responses upstream speaking the WebSocket (no network
in tests); the keep key's X-Api-Key/Api-Key separation has no test of
its own; the editor in the Linux app's WebKitGTK; the full suite (run
after the push).

Reported-by: matrix0487 (Discord)
Reported-by: faithleysath (#5781)
2026-11-09 18:57:29 +08:00
yetone 7cabf0da98 sessions: one place says which ids a ZCode request names, and drafts are one group (#5754)
On top of Flandern1211's cherry-picked fix (the commit before this one).
GatewayKeys gave the bare id of a ZCode session (sess_<id> in ZCode's
database, <id> in the gateway's record), but NativeIDs kept its own copy
of the keys: the management page still counted every ZCode session sent
through the gateway as a gateway-only session, its delete listed them,
and its search read them a second time. requestIDs is now the one place
that says which ids a request names a session by; GatewayKeys (Sessions
list, its spend, the stats' native set, viaOf, the manage search) and
NativeIDs (the manage page's count and delete) both read it.

ZCode runs a session started without a project in a folder it makes for
that session alone: <workspaceDirectory>/draft-<id> or <ms>-<uuid>, with
workspaceDirectory = ~/.zcode/workspace (read from ZCode 3.17.2's
out/host/index.js, downloaded from cdn-zcode.z.ai; never the live
~/.zcode). The reporter's group is renamed from "Scratch sessions" to
"Draft sessions" (草稿会话 / 草稿會話 / 下書きセッション /
Entwurfssitzungen), after ZCode's own word for them, with a GUI test of
its own. Comments no longer quote "Seen through the gateway", which
i18n-keys' plugin-words guard read as the core saying the word.

Run (mote, at this tree, rebased on 0eac4e6aa):
- gofmt -l: clean. go vet of sessions/gui/usage for darwin, linux
  (-tags nogui), windows; GOOS=linux -tags nogui and GOOS=windows
  go build: ok.
- go test -run 'ZCode|Gateway|Native|Manage|Merge|External'
  ./internal/sessions ./internal/usage ./internal/gui: ok.
- GUI, Chromium and WebKit: sessions-zcode-drafts (new, 5 languages x 2
  widths), sessions-folder-list, i18n-en-no-cjk: ok. i18n-keys' "a
  plugin's words are its own" is red at origin/main for three words not
  touched here, filed: #5332 (View routing), #5426 (No session ID),
  #5482 (Use the library's). The reporter's comments quoted "Seen
  through the gateway" and made a fourth; reworded.

Broken by hand:
- TestZCodeGatewayRowIsTheSessionItself on origin/main's raft.go,
  manage.go and external.go: red (keys lack zcode|main, fork_of_main,
  abc; NativeIDs lack them; 29 rows for 26 sessions).
- sessions-zcode-drafts on origin/main's Sessions client.js/i18n.js:
  red in every language and width.

Not tried:
- The full Go suite and the whole Sessions GUI set: queued behind other
  sessions on mote's suite lock; run after the push, reds filed.
- A real ZCode database: none on this machine; the reporter's own run
  over 1,105 sessions is in the issue.
- Windows/WSL GUI, and a ZCode data folder the user moved elsewhere
  (only ~/.zcode/workspace is matched).

Reported-by: flandern1211_58540 (Discord)
Refs #5754 (left open for the reporter)
2026-11-09 18:55:01 +08:00
yetone 2b8ad61468 routing: a group's header counts its members on, not who one request was held to
adorable_piglet on Discord: the group magpie found for GPT-6 Astra, In
order, three of its five members on (two on providers switched off),
read "GPT-6 Astra · routing group · 1 on" over a Codex request answered
by one member. The header counted the request's order, who that one
request was weighed among. A conversation held to one member (native
compaction, Strict, a sealed task, a key's models) has an order of one,
so the group read as having one on. It now counts the route's
group.members (GroupRef: the group's ready members as the request
came); why the request went to one alone stays the first line's to say.
Routing itself was not at fault: a gateway repro with five members, two
providers off, routed In order over all three on.

Run on origin/main 40cfae5d3 with this change (rebased onto 4da0aa027,
client.js untouched between):
- routing-group-on-count.test.cjs (new; chromium and webkit; en zh
  zh-TW ja de) on mote: 10/10. With the client.js change taken out by
  hand: 10/10 red, " · 路由组 · 启用 1 个", the reporter's text.
- No Go change: gofmt and go vet have nothing new.
Not run before this push: the 182 routing-*, panel-routing* and
i18n-keys GUI files (running on mote now, reds to be filed).

Reported-by: adorable_piglet (Discord)
2026-11-09 18:40:10 +08:00
yetone b62117287b gui: a moved plugin's first question offers its other ways, the API key among them
mahiro233 on Discord (v0.1.3372, Kiro plugin 0.1.34): Kiro's account
sheet asked "Choose a sign-in method" with three choices and Cancel, and
offered no API key. The plugin has one (its third way, "Kiro API key
(ksk_…)"), but a moved subscription opens its plugin's first way at once
(#777), and when that way asks a question first, as Kiro's does since
plugin 0.1.21, the question had no way to the others: "Other ways to sign
in…" and "Use an API key instead" are on the waiting box only, which the
question comes before. Kiro CLI's or IDE's sign-in was out of reach too.

The first question of a moved subscription's way, when the plugin has
other ways, now has "Other ways to sign in…" (already in every language),
which shows the way picker, as the waiting box's does. A later question
(Kiro's Start URL) doesn't: the user chose that way already.

Test: plugin-ask-ways.test.cjs, en and zh, Chromium and WebKit: the
question's choices and hint, the link, the picker with the key way, the
key field titled by its label, nothing signed in before a key, no link on
the Start URL question, and the plugin's words in Chinese where it gives
them.

Run on mote at the pushed head, Chromium and WebKit: plugin-ask-ways,
plugin-other-ways, -moved-signin, -key-hint, -password-prompt, -signin,
-keyless-signin, signin-paste-plugin, deprecated-subscriptions,
i18n-keys and i18n-en-no-cjk, 49 of 50 each; the one red is i18n-keys'
"a plugin's words are its own", the same 3 words on origin/main
2a48974e8 (#5327, #5426, #5482). TestCoreScriptBudget is red at both, as
below. Broken by hand: with origin/main's app.js,
plugin-ask-ways is red (en waits for the link, zh for the Chinese
question). Not tried: a real Kiro key (none entered anywhere).

Core script budget: the two commits add 1,284 bytes to app.js, paid for
by cutting the Add sheet's comments on retired built-ins (Cursor, Grok,
WorkBuddy, Command Code, Qoder, Devin, Zed, Factory, MiMo, Kiro) and
inLang's to one line: the core is 1,535,556, 260 under origin/main's
1,535,816, no raise. Main stays over 1,533,802 from 40cbdaa7e (#5795).
2026-11-09 18:36:07 +08:00
yetone 40cbdaa7e8 provider: an account's window can be capped at a fixed amount of its unit
A window magpie reads with a total and a unit (a day's 1000 credits, a
plan's requests) can now be capped at an amount of that unit, not only
a share: 9won_25273 asked to stop an account at 300 of its day's credits.

- AccountWindowAmounts keeps it per account and window (capId). An
  amount and a window's own share replace each other.
- WindowCaps.limitShare turns it into a share of the total for the mark
  and NearCap. CapHeld and capReached hold the account once the window's
  count reaches the amount (past), and rest it as the percentage cap
  does: the next account takes the request. cappedError and the trace
  say "has used 300 credits ... past its cap of 300".
- A reading with no total ignores the amount; the account's share
  applies.
- GUI: the window meter's menu has one more item, Amount..., typed in
  place (provider/windowcap with amount). It shows only on a window
  with a unit and total. Strings in zh, zh-TW, ja, de.
- CLI: magpie provider account-cap <id> <account> --window <name>
  --amount <n|off>.

Usage outside magpie counts: every cap reads the vendor's own count, so
what the account spent in the vendor's app or on another machine counts
from the next reading on. magpie can only hold back its own requests.

Run, at this head on Linux (wsl-run, magpie-desktop):
- gofmt -l: clean; go vet ./... for linux (-tags nogui) and windows: ok (darwin
  vet needs cgo, so it runs with the full suite on mote afterwards)
- go test -run 'Lang|ToolLoop|LoopGuard|Cap|Amount' ./internal/gateway
  ./internal/provider ./internal/cli: ok (TestWindowAmountCapHeld,
  TestSetWindowAmount, TestWindowAmountHoldsTheAccount, the CLI cases)
- GUI window-cap, window-cap-pool, account-cap in chromium and webkit,
  420 and 1100 wide, en zh zh-TW ja de: 78 of 78 in each engine. An
  earlier webkit run lost the amount test's page once ("Target page,
  context or browser has been closed"); it passed in 2 more full-file
  runs and 60 of 60 alone
- i18n-keys: only "a plugin's words are its own" red, words that aren't
  this change's (#5332, #5426, #5482)
Broken by hand: limitShare ignoring amounts (of < 0): TestWindowAmountCapHeld
and TestWindowAmountHoldsTheAccount go red.
Not tried: the full go test ./... at this head (queued on mote, runs
after); a real account at an amount cap.
iFlytek: 9won's 讯飞 overshoot isn't covered. Loomy's daily window sends
used as a count and amount as what is left (plugins#889); AStudio's
wallets tell a balance only, which no cap can hold (#5770).

Reported-by: 9won_25273 (Discord)
2026-11-09 18:19:02 +08:00
yetone f5f68b4335 routing: with routing groups switched off, their sidebar tab goes
yyddbds (Discord) turned Routing groups off in Plugins > Built-in and
the sidebar still showed its tab. The tab was tagged with the routing
plugin only (data-feature="routing"), so only switching Routing off hid
it. It is now tagged "routing groups", like Routing's own "Routing
groups >" button and the two "Make a routing group" buttons.

The page also holds each provider's accounts and keys (pools), which
stay editable with groups off. So with groups off:
- ?view=groups, or a page open when groups are switched off, opens
  Routing (offView in app.js), not Agents;
- the groups' section moves under Routing's requests, with the "turn on
  routing groups" note and the pools; turning them on opens the groups
  page again and moves the section back.
Every other sidebar tab (sessions, library, routing, gateway, usage,
masking) was already tagged with its own plugin; only groups was wrong.

Run, on mote (macOS 27):
- routing-groups-off.test.cjs (rewritten: 1200, 900 and 420px, both
  engines, every language): 12 of 18 red on the old code, 18 of 18
  green on this one.
- routing-groups-off, builtins, sidebar at the rebased head 3930a3917:
  green in Chromium and WebKit.
- Whole GUI suite at the old base c9d253e4a: 22,447 of 22,724 pass, 277
  red in 46 files. Those 46 files rerun at the rebased head (on
  bceeabd93): 258 red, every one in an open issue filed before this
  change (#5475 umbrella; #5392 routing-intent-entry, #5332 i18n-keys,
  #5232 provider-fetch-again, #3952 mobile-web, #4541 page-width-steady,
  #4720/#4721 vertex-editor, #5262 zero-priced-free, #4388
  model-chip-steady, #4644 account-weight, #3799 routing-row-swap,
  #3954 routing-story-shrinks, #5586 routing-context-fold, #3479
  header-centre, #4787/#5425 nav-timeout, #5215 tray-cell-click, #3415
  usage-fold, #2448 s3-sync, #4624 omarchy, #5048 usage-ledger, #4320
  recovered-file). None is in a test of the nav or the groups page.
- go vet ./..., GOOS=linux/windows go vet ./internal/gui and gofmt -l
  at the old base: clean (no Go file changes).
- TestCoreScriptBudget, worked out by hand at the pushed head (on
  b8270850d): the core's scripts are 1,533,791 of 1,533,802. The 526
  bytes this adds to app.js would be 351 over, so the comments it adds
  are cut to one line. No raise. node --check app.js passes.

Not tried: the real app; the GUI files rerun after the last rebase
(b8270850d; the only change since is comments in app.js); the panel's new-group path with groups off;
the same 46 files on a clean bceeabd93 (queued behind the suite lock
for over an hour; the reds above all predate this change).

Reported-by: yyddbds (Discord)
2026-11-09 18:11:53 +08:00
yetone ff7d84b9b2 gui: a built-in's switch, settings and page lead to each other (netube99 on X)
netube99 (X, 2119721422918742222): masking is switched on in Plugins ›
Built-in, set in Settings › Privacy and seen in Insights › Masking, and
none of the three leads to the others. Web search had the same split.
One pattern for every built-in whose switch, settings and page are apart:

- pluginrt.Manifest.SetAt ("privacy #redactList") says where Settings has
  its settings: redact, search, gateway and otel set one. builtins.go
  sends setAt and page (its nav.page Part).
- Its Built-in row (featGo): "Settings › <tab>" and, while on, its page
  ("Masking"). No settings link while off when those settings hide with
  the plugin (Observability).
- Its settings, while off (featOff): a first row "Off in Plugins ›
  Built-in", what being off means, and Turn on. Privacy and Web search
  use it; search's own off row went.
- Insights › Masking's head: "Settings › Privacy", unless Turn off
  already goes there. At 600px and under its buttons wrap below the title.
- docs/subsystems/plugin-runtime.md documents SetAt.

Proposal for the owner, not built: give each feature one home with its
switch, settings and page together. This commit only links the three.

Core budget: no raise. +~1.9KB of code is paid for by shortening six
app.js comments (logo mask shelf, copy, sidebar, account models,
fitSend, the hold room).

Run on mote at fe672ce69's tree (origin/main 2b22425b4 + these two):
- go vet ./internal/gui ./internal/pluginrt ./plugins/...;
  GOOS=linux -tags nogui and GOOS=windows vet of gui and plugins: clean.
  gofmt -l: clean.
- go test -run 'TestBuiltin|TestCoreScriptBudget|Translated'
  ./internal/gui ./internal/pluginrt: ok (budget passes after the cuts).
- node --test builtin-places, websearch-places, builtins, i18n-keys,
  i18n-en-no-cjk: 235 pass, 1 fail. The fail is i18n-keys "a plugin's
  words are its own" on plugins/usage "View routing", red on origin/main
  too (#5332, #5426, #5482).
  builtin-places and websearch-places cover en, zh, zh-TW, ja and de in
  Chromium and WebKit, at 1100 and 420 wide, nothing past the edge.
Broken by hand: featGo and featOff made to return at once, and 40
builtin-places subtests went red (42 fails with their parents). Round 1's
files reverted made websearch-places 102 of 142 red.

Queued, not waited for (owner: push each verified fix at once): the full
`go test -timeout 45m ./...` then `make test-ui` on mote behind
~/suite.lock; log at
~/workspace/projects/magpie-wt/websearch-surfaces-scratch/full.log. Any
red gets an issue.
Not tried: the real app on Linux/Windows; warm-ups have no SetAt (their
settings moved into the provider editor).
2026-11-09 17:58:11 +08:00
yetone 9dd7aabca8 gui: an account's refresh stays where it was pressed, and a sheet held low rises as it scrolls
墨雨藏锋 on Discord (#feedback, 11-09): pressing an account's quota refresh
in a plugin provider's sheet (MonkeyCode) moved the view down, and the
accounts showed only a few rows while the window had room.

The jump: every account's refresh shares the aria-label "Refresh this
card". openModal gave a redraw's focus back to the first element with that
label, which is the first account's, and the focusin listener then marked
the hold on that button. WebKit's fallback focus did the same. So the row
pressed was let go, and it moved with the rows above it as they grew
(186px in the test). And since quotaRefresh keeps the same button across
redraws, holdModal never took it as a copy, and cap() never scrolled the
list back to it.
Now openModal finds the focused element by its place among elements
with that label. A redraw giving focus back does not mark a new hold
(modalRefocus). The held element (or its redrawn copy) is handed to
holdModal (modalHold.copy), so it stands in and the list is scrolled to
hold it.

The short list: there is no fixed cap. A sheet pressed while short and
centred keeps its top (calc(100% - off)) when its content then grows to
the window's foot, so its one scroll box shows a few rows. Now scrolling
that box first lifts the sheet into the room above, its foot staying,
until it has what it needs (modalClimb); then the box scrolls. Nothing
moves on a click, and no CSS or layout changed.

Core budget: app.js 1,310,953, core 1,533,711 (budget 1,533,802), paid
for by comments cut in startImport, openProtoMenu, hold(), the click
handler and navMorph; no raise.

Run on 4314f4b77 plus this change, through wsl-run (Linux, Playwright
1.62.0); it is pushed on a6a99717e, whose two commits since touch no GUI
file:
- account-refresh-holds.test.cjs (new): Chromium and WebKit, 1000/560/390
  wide, en zh zh-TW ja de: 4 of 4 ok.
- click-scroll.test.cjs: ok in Chromium, and one WebKit subtest red, the same
  on origin/main a6a99717e run alone: "a wheel the page hears of after
  its scroll", #4385
- go test -tags nogui ./internal/gui -run 'Budget|I18n|Dates': ok
Red on the old code: the new test against app.js at c7ebb6f8d fails 4 of
4: "the pressed refresh moved 186.875px" and "the sheet rose as its
accounts scrolled (96 → 96)", in both engines.
A run of the 203 GUI files that reach #modal or hold/scroll/focus/refresh
is still going and is pushed without, per the owner's ship-at-once rule;
its reds get issues.
Not tried: the real Wails app on macOS, and mote (its suite queue was
long). The whole GUI suite (1298 files) was not run.

Reported-by: 墨雨藏锋 (Discord)
2026-11-09 17:35:44 +08:00
yetoneandsevtdy 136178803b gui: Escape closes a plugin's details dialog on Discover (#3779)
On Plugins › Discover, Escape left a plugin's details dialog open and
only showed Install's focus ring. detail() opened #modal without
setting confirmAsk, unlike every other dialog that borrows #modal
outside Providers, so Escape reached only the Providers page's
handler, which closes nothing there.

detail() now sets confirmAsk and its Close goes through
closeConfirmAsk. show() clears confirmAsk when leaving a page closes
the modal: the dialog's Sign in goes to Providers through show(), and
a leftover confirmAsk would take the next Escape there. This is
sevtdy's patch from the issue.

Side effect: cfgblocked.js steps back to the dialog under a Repair
only when confirmAsk is unset, so a Repair opened over the plugin
details no longer goes back to them, the same as over the other
confirmAsk dialogs.

New test: plugin-detail-escape.test.cjs (en, zh): Escape closes the
details twice, Close still closes them, and after Install, then Sign
in, then Providers, Escape closes the add sheet.

Run (mote, via suite.lock):
- plugin-detail-escape.test.cjs: chromium 3/3, webkit 3/3
Broken by hand:
- plugins.js and app.js at the base: red in both engines (the first
  Escape leaves the dialog open)
- only show()'s clear taken out: red in both engines (after Sign in,
  Escape on Providers leaves the add sheet open)
Wider GUI run (every plugin*, modal-*, i18n-keys, update-wait and the
files testing Escape on #modal: 114 files, both engines): running at
push time; any red gets its own issue.
Not tried: the real app (Wails webview) by hand.

Reported-by: sevtdy <16433683+sevtdy@users.noreply.github.com>
Co-authored-by: sevtdy <16433683+sevtdy@users.noreply.github.com>
2026-11-09 17:21:30 +08:00