Commit Graph
86 Commits
Author SHA1 Message Date
yetone 6fc0e93176 gui: the tray panel's Routing rows tell how fast a finished request wrote (#2050)
A finished request that didn't fail now shows its speed after its tokens
and time, "12.4k tokens · 1.5 s · 1667 tok/s", from the same speedOf the
Routing page's rows use, so it is left out where that page leaves it out
(no first token, a burst at the end, a failure). The string "{n} tok/s" is
already translated in every language.

With the speed the totals no longer fit beside where a request went in
the 440px panel: the "served …" mark was cut to "served gpt-…", and when
the totals were let shrink, the speed was cut instead. Where it went and
its totals now share a wrapping line (.pr-line), and the totals go under
it, at the right, when both don't fit. A row whose provider and account
alone are too long now has its totals under them rather than beside.

Not done: a live rate on a request still being answered (part 2). The
trace has no token count until the reply ends, so there is nothing to
show a rate from.

Run:
- panel-routing, panel-routing-providers, routing-reroute-title and
  number-units in Chromium and WebKit: 13/13 each.
- panel-routing now checks the speed is on the finished row only and no
  row's totals are cut. Dropping the speed line turns it red; dropping
  flex-wrap turns it red (the served mark is cut).
- Looked at the panel's screenshot at 440 in both engines.
Not run: other languages than en and zh in this test (the string itself
is translated in all five).
2026-10-14 09:29:59 +08:00
yetone 195a1009b0 gui: a routing group's Slow to start takes minutes of your own, beside Wait, 30 s, 1 min and 2 min (Kismet Alan on Discord)
The group editor's "Slow to start" (迟迟不出字) row offered only Wait,
30 s, 1 min and 2 min. Kismet Alan wanted a longer time of their own.

What changed:
- routing.js: the row gets a Custom segment, the same pattern as the
  Context row's Custom: picking it shows a small minutes box beside the
  segments (5 from Wait, else what was picked), focused to type in.
  Decimals are taken (2.5 is 150 s; a comma is read as a point). Anything
  else marks the box aria-invalid and the hint says "{v} is not a number
  of minutes"; the last good value is kept. A saved time that is none of
  the presets opens as Custom with its minutes. firstToken is still sent
  in seconds, and the card's "Next after 150 s without a first token"
  and the gateway are unchanged (provider.Group.FirstToken takes any
  seconds >= 0).
- routing.css: the box and its "min" unit inside the existing ctx-wrap.
- i18n.js: Custom was already there; "e.g. 5", "Minutes", "min" and the
  error in zh, zh-TW, ja and de.
- group-first-token.test.cjs: now five languages (en, zh, zh-TW, ja, de)
  at 1100 and 420 wide in Chromium and WebKit. It adds the Custom flow:
  no box until Custom, 5 to start and focused, "abc" refused with the
  hint naming it, 2.5 saved as 150 and shown on the card, reopened as
  Custom 2.5, back to 1 min hides the box, and the row stays inside the
  editor with no horizontal scroll. At 420 the editor runs past the
  window's foot and WebKit doesn't scroll the page's scroller to a
  click, so the test wheels each control into view.

What was run:
- NODE_PATH=<playwright@1.62.0> node --test group-first-token.test.cjs:
  20 of 20 pass (2 engines x 5 languages x 2 widths).
- Break check: with routing.js at the old code the test fails waiting
  for the Custom segment.
2026-10-14 08:28:08 +08:00
yetone e7e2d522f0 gui: on a phone a routed request's account keeps a few letters, not a sliver
06ff45fed (#1926) let a request's account give way down to 2.5em so the
model that answered stays whole. At 360px that is ~32px of
"OpenRouter International", and phone-rows.test.cjs's "a row at 360px
keeps its text and its controls" has been red on main since, in both
engines and every language (seen on 71f796069 and a75de4c21). Under 600px
the account now keeps 40px, the sliver line phone-rows draws; wider, it
still gives way to 2.5em, as routing-request-model needs at 1920px, where
a 40px floor cuts the model.

Run: phone-rows and routing-request-model (Chromium and WebKit, every
language, 20/20), routing-columns, routing-request-metrics, old-webkit.
A 40px floor at every width instead turns routing-request-model red in
all 10.
2026-10-13 20:39:39 +08:00
yetone 06ff45fed5 gui: a request's row on Routing keeps the model that answered readable beside its metrics, and the accounts column gives up its spare room (#1926, hibaliqya-yonma)
What changed:
- The request list's columns were time, asked, to (minmax(0, 1fr)) and
  the metrics (auto). Rows share their columns (subgrid), so the metrics
  column took the widest row's whole line for every row, and "to" got
  what was left. Now "to" keeps at least 14em (30% of a narrower list)
  and the metrics take at most 40%, wrapping inside it (they already
  wrap); asked is held to 32% (was 36%). The no-subgrid fallback gets
  the same columns.
- "to" said "<account> · <model>" in one box that gave way before the
  reasoning level, so it read "· hi…". It is now two boxes: the account
  gives way first (down to 2.5em), the model stays whole when it fits,
  and the said box keeps at least 9em before the level is cut. The
  text is the same, so tests and titles that read it see no change.
- Side by side (1150px and wider), the accounts column is clamp(260px,
  28%, 360px), was clamp(280px, 32%, 400px): in a page kept to 1200px
  (61a0a69b) it gave the requests ~47px more.

Why: since 61a0a69b kept Routing to 1200px, the requests' column beside
the accounts is ~800px, just over the 760 where rows stack, so each row
stayed on one line and the model that answered was squeezed to nothing
while the metrics kept their width. Reproduced with the reporter's
shape of row in Chromium and WebKit: at 1920 the served model's box was
0px of 226.

Run:
- new routing-request-model.test.cjs: chromium and webkit, en zh zh-TW
  ja de, at 1920, 1320, 1240, 1100, 900 and 420: the model whole beside
  its account (its text's own unrounded width: WebKit cut a box a
  fraction narrower than its text, with an ellipsis scrollWidth doesn't
  show), no metric clipped or outside its row, no overlap, no sideways
  scroll. 10/10. Red with the old grid ("the model that answered is 0px
  of 30"), red without the split ("the model is cut (123px of 226)"),
  and red in WebKit with the model's box allowed to shrink.
- routing-columns.test.cjs: the accounts column's bound is now 260..360.
- routing-*.test.cjs (69 files), page-width and click-scroll, both
  engines, at load ~150: 835 passed, 1 failed. The one,
  routing-upstream's chromium en, passed 4/4 when run again. Two files,
  routing-group-fold and routing-mode-goes, ran out of the 240s per-file
  limit and passed 40/40 each when run again. After rebasing onto
  97751188e: routing-request-model 10/10, group-classifier-failed 20/20,
  routing-columns 4/4, routing-request-metrics 4/4, routing-upstream 4/4,
  routing-mode-goes 40/40, i18n-keys 1/1.
- Go, on this series at 04ff9a775: go test -tags nogui for usage,
  provider, cli and gateway (-timeout 45m), and go test ./internal/gui/,
  all ok. gofmt -l is clean. go vet passes on darwin and with -tags nogui
  on linux and windows. After rebasing onto 97751188e, the vets, usage,
  cli and gui were run again, all ok. Rebased again onto 15105161e, with
  the same results: gofmt is clean, all three vets pass, go test for
  usage, provider, cli, gateway and gui is ok, and routing-request-model
  10/10, group-classifier-failed 20/20, routing-columns 4/4 and i18n-keys
  1/1 pass. Rebased onto 54ba9042d (main had touched i18n.js,
  routing.js and the gateway): gofmt and all three vets are clean; go
  test passes for usage, for gateway and provider with -run
  Classif|Intent|Decide|MLX, and for gui; routing-request-model,
  group-classifier-failed, routing-columns, routing-request-metrics,
  routing-save-keeps-the-row and i18n-keys pass.
- Screenshots before and after at 1920/1320/1100/420 in both engines.

Not verified: a real WebView2 window on Windows; Chromium stands in for
it here.
2026-10-13 16:39:29 +08:00
yetone 08b1a60c03 gateway, gui: a routing group whose classifier fails says so on its card, and the log says why (#1929, versun)
What changed: the gateway keeps, per classifier model, why it couldn't
say the last time it was asked (an error from the request, or an answer
that was no number of the list) and when, until it answers again
(gateway.ClassifierFailure). The first failure, and each one that says
something new, is written to the log once ("routing: the classifier X
couldn't say: ..."). /api/groups sends it as a group's classifierFailed,
and the group's card on Routing shows a line "Classifier failed 3 min
ago: <why>" with an amber dot (no stripe); its title says that until the
classifier answers, no rule with an intent matches and turns reason as
the agent asked. Strings in en, zh, zh-TW, ja and de.

Why: versun's MLX-Serve answered its Clef decision model, asked as a
chat model, with a 400. The only place that said so was each request's
own details; the group's rules with an intent quietly never matched,
which read as the routing working. The preset itself is fixed in the
commit before this one (versun's, cherry-picked).

Run:
- go test: TestClassifierFailureIsKept (gateway: a 400, kept while
  resting, "not a number", cleared by an answer) and
  TestGroupsSayAClassifierThatFailed (gui: only the failing group's JSON
  has classifierFailed). Each went red with its line removed by hand
  (the record in classify(), the fill in groupsState).
- group-classifier-failed.test.cjs: chromium and webkit, en zh zh-TW ja
  de, at 1100 and 420: 20/20; with classifierFailed dropped from the
  fixture's reading in groupRow, 10/10 of one engine red. i18n-keys
  passes.
- go test -tags nogui ./internal/provider ./internal/usage ./internal/cli:
  ok. ./internal/gateway hit the 10m default timeout at load ~150-190
  (other sessions); rerun with a longer timeout before the push, below.
- go test ./internal/gui: TestDockJoinLeadsCommandTab (Command-Tab order
  had kitty in front) and TestMainWindowCorners (measuring killed under
  load) failed; both are desktop-window tests this change doesn't touch.

Not verified: a real MLX-Serve; versun ran his own.
2026-10-13 16:34:59 +08:00
yetone eba7187368 gateway, provider, cli, gui: a group can route By weight, each member's share set beside it (#1910, DD on Discord)
DD asked for weighted round robin as a group routing, next to In turn.
A provider's keys could already route by weight (#841). Groups could not.

What changes:
- provider: Group.Weights maps a member's spelling to its weight, 1 to
  1000. A member left out, or set to 0, weighs 1. SaveGroup accepts
  routing "weight". It also cleans weights the way it cleans fast and
  off: it strips :fast, drops weights of members that are gone and of
  members weighing 1, and refuses a weight below 0 or above 1000.
  Weights follow a member when it is renamed (RenameMember, Rename,
  RenameGroup) and survive Share/Import.
- gateway: planLevel treats each member of a weight-routed group as one
  unit: a model with its keys in its provider's order, or a nested group
  routed its own way. weightedUnits orders the units by smooth WRR on a
  round per group ("group/<id>"), sharing wrrPick with the keys. The
  round's pick goes first and the rest stay in member order for
  failover. A unit whose head is resting leaves the round. When a
  conversation is kept on another member (session/turn/cache/strict),
  the charge moves to that member (wrrSeat, wrrMove).
- cli: routing=weight (also weighted, wrr). weight=<model>=<n>[,...]
  sets weights and keeps the rest; weight= on its own clears them. The
  group view shows "· weight N" for each member.
- tui: By weight is in the group routing list.
- gui: the group editor offers By weight. Each member then shows
  "Weight N · S%", its share among the members that are on. Clicking it
  edits the number in place: Enter or blur keeps it, Escape cancels,
  and a value outside 1 to 1000 shows a warning. The trace header uses
  group wording for a weight-routed group. Strings are added in zh,
  zh-TW, ja and de.
- docs: reference.md, gateway-routing.md, and site start pages in en,
  zh and ja.

Run:
- go test -tags nogui ./internal/provider ./internal/cli ./internal/tui:
  ok.
- ./internal/gateway: ok in 988s with -timeout 45m. The first run hit
  the default 10m timeout at load average ~170. The test running at
  that moment had been running for 2s; it was not a hang.
- go vet -tags nogui on those packages, for darwin, GOOS=linux and
  GOOS=windows: clean. gofmt -l: clean.
- New group-member-weight.test.cjs: 8/8 in Chromium and WebKit, en and
  zh at 1100, en and de at 420. The WebKit de 420 case also passed six
  runs at once.
- gui-zh-tw, gui-ja, gui-de, i18n-keys, routing-*, group-*,
  panel-routing*, settings-groups and agent-model-groups: all green
  except two.
  - routing-steady (WebKit) is #1804. It is red 2/3 alone on origin/main
    e1b70c13d too.
  - routing-save-blank (chromium en) was red under load only, and 3/3
    green alone. The overshoot in its wheel loop is filed as #1924.

Broken by hand, each red, then restored:
- byWeight forced false:
  --- FAIL: TestWeightedGroup (weighted_group_test.go:69 its turn ...)
- cleanWeights call skipped:
  --- FAIL: TestSaveGroupWeights (groupweight_test.go:39 weights map[...
  an/claude-opus-5-5:0 ... oa/gpt-6.1-sol:high:fast:3 ...])
- CLI weight case renamed:
  --- FAIL: TestGroupWeightCLI (unknown field "weight")
- GUI chip not appended: group-member-weight chromium en 1100 timed out
  on the weight button.
- Not red: the test's "moved nothing" check. A scroll forced on click,
  or padding added above, did not turn it red, because the view's own
  scroll guard and scroll anchoring hold the clicked row in place. It
  only shows that the row stays under the pointer.

Not tried: real accounts through a running gateway. The routing is
proven by the plan-level test with synthetic providers only.
2026-10-13 13:10:30 +08:00
yetone 0801c7bb02 gui: Routing's Accounts and keys has a refresh beside its heading that reads the accounts' allowances again, by hand only (#1834)
The windows each account shows (#1833) are the Usage page's readings,
read the ordinary way when Routing opens. To see them fresh one had to go
to Usage and back. The icon button beside "Accounts and keys" makes the
asked read Usage's Refresh now makes (loadQuotas(true),
/api/usage/quotas?asked=1). It turns while the read is on its way, a
click then asks nothing more, and the rows are drawn from what comes
back. There is no timer: nothing reads again by itself, as #1518 has
allowances read only when asked. It shows only live, with a subscription
account listed. Its tooltip is new ("Read the accounts' allowances
again", in zh, zh-TW, ja, de), and its label reuses "Refresh now".

docs/subsystems/gui-shell.md: under Routing account windows.

Run: tests/routing-read-allowances.test.cjs (new), chromium and webkit,
en, zh, zh-TW, ja, de at 1100 and 420px: title and label, on the heading's
line, opening reads only unasked, one asked read on click with the
button busy until it lands, a second click while busy asks nothing, the
windows show the new reading, the view doesn't move, and no asked read
in 2.5s after. A list of keys only has no button. 24/24 pass, and 11 of 12
fail with routing.js, routing.css and i18n.js as before. gui-ja,
gui-zh-tw, gui-de, i18n-keys and routing-account-windows pass. Looked at
in screenshots at 1100px (en) and 420px (ja). Not tried with a real
account.
2026-10-13 02:36:12 +08:00
yetone 6627ddd54b gui: a subscription account in Routing's Accounts and keys shows each of its windows and when each resets, as the Usage page read them (#1833)
The list said one figure for an account, the window routing went by. A
Claude account's 5 hours and 7 days, or Codex's, each with its reset, are
now on a line under it ("5 hours 40% used · resets in 2h"). cardOf matches
the route's account to app.js's quotas: a subscription card of this
computer (no from) whose provider is the account's agent (a plugin's
provider id) or its provider, and whose user is the account's, ignoring
case. Nothing new is read from vendors: opening Routing asks
/api/usage/quotas in the ordinary way when the readings are missing or
over a minute old, never ?asked=1. A kept day's list shows none, as its
requests were weighed by readings long gone.

loadQuotas now treats an answer that isn't a list of cards as a failed
read and keeps what it had. Routing reading quotas showed it: a page given
{} stored it and renderQuotas threw on quotas.some.

docs/subsystems/gui-shell.md: Routing account windows.

Run: tests/routing-account-windows.test.cjs (new), chromium and webkit,
en, zh, zh-TW, ja, de at 1100 and 420px: exact window lines, none for an
account whose only card is another computer's, no overflow, no asked
read. 22/22 pass; fails with app.js, routing.js and routing.css as
before. Looked at in a screenshot at 1100px (en) and 420px (de). All 60
routing-*.test.cjs and click-scroll: 636 pass, 5 fail, all in WebKit in
routing-group-fold (en, ja, de) and routing-sessions (en), which fail the
same alone on the old assets at 7a9490638 and are filed as #1672.
Not tried with a real Claude or Codex account.
2026-10-13 02:36:12 +08:00
yetone 0fcf563e61 routing: a pause rule can hold by folder, in some or outside them (#1606, Ti800)
Ti800 keeps a subscription's quota for one long task in one folder and
wants every other request kept off it (their option A). A pause rule
held by hours, days and agents only; it now holds by folder too.

What changed
- provider.Rule gains ExceptFolders (json exceptFolders, CLI
  except-folders=, aliases except-folder/not-in/outside): the folder the
  agent works in is in none of them. An agent that says no folder isn't
  known to be in one, so except-folders holds for it; folders= still
  never matches an unknown folder. Both conditions are allowed on send-to
  and pause rules (Rule.ByFolder, inFolders); cleanRules cleans and
  dedupes both and lets a pause hold by time, days, agents and folders.
- PausedOut takes the request's folder. The gateway reads it (workDir)
  only when a pause by folder is on the way (PausesByFolder); embeddings
  and System One's decision calls pass none. Paused carries Folder and
  ByFolder for the trace. ruleFor reads the folder for except-folders
  rules too.
- Group sharing drops every rule by folder, except-folders included.
- CLI usage, TUI hint, ParseRule/Line round-trip except-folders.
- GUI: the rule editor has a "not in folder" condition beside "in
  folder", both shown on a pause and kept when a rule turns into one; a
  folder that isn't a whole path and a pause with no condition are
  refused; the group's rule and the trace say "not in …", and a paused
  reason says the folder read or that the agent said none. Strings in
  zh, zh-TW, ja, de.
- Docs: gateway-routing.md, site start.html (en, zh, ja).

What was run
- go test -tags nogui ./internal/provider ./internal/gateway (folder,
  pause, share, rule tests); full go test ./... before pushing.
- Broke it by hand: with the gateway's folder read replaced by nothing,
  TestPauseByFolder fails (in-task requests went to the other member).
- GUI: routing-pause-folder.test.cjs (new), routing-pause,
  routing-folder, i18n-keys and 10 other rule-editor tests in Chromium
  and WebKit, en/zh/zh-TW/ja/de, at 1100px and 390px.
- gofmt -l; GOOS=linux and GOOS=windows go vet of the touched packages.

Not tried: a real Claude Code subagent's request against a live group;
by the documented rule a request without a folder is paused off the
kept member, which is what the reporter asked for.
2026-10-11 21:24:10 +08:00
yetone 1cb136ec76 gui: every row's grip stands 4px inside its card's edge, as the Agents row's does (#1581, real-jacket)
On the Usage page a card's hover grip stood on the card's left border:
its ::before sat at left -8px inside a 12px card padding, while the
Agents and Providers rows' sits at -7px in 14px, 4px inside the list.
Each grip copied its `left` while the box around it had its own padding.

Measured in Chromium and WebKit (grip left minus the inner side of the
nearest box drawing a border or a shadow) on the old CSS:
- Usage card: 1px (the issue's 2px is from the border's outer side)
- tray panel's agents: 2px; tray panel's Arrange rows: 3px
- Routing groups: 3px in the window, 1px on the narrow browser page
  (whose rows there have 12px padding all round)
- Agents, Providers: 4px; a group's members in its editor and an
  agent's model order are far inside (no edge beside them)

Now: Usage -5px, panel agents -8px, panel Arrange -8px, Routing groups
-7px, and the browser page's narrow Routing rows keep 14px on the left.
Every one is 4px in, in both engines, every language, 980px and 420px.
The grips still show only on hover.

New test internal/gui/tests/grip-inset.test.cjs: for each grip kind
(Agents, Providers, Usage, Routing groups, group members, model order,
panel agents, panel Arrange), en/zh/zh-TW/ja/de, 980px window and 420px
browser page, Chromium and WebKit: the grip is hidden away from the row,
drawn on hover, and grip-left minus edge >= 4px.

Run:
- grip-inset.test.cjs on the old app.css/routing.css: 80 of 160 cases
  fail (Usage 1px, panel agents 2px, panel Arrange 3px, Routing 3px/1px);
  on the new: 162/162 pass.
- node --test (both engines) agent-grip, fold-show-grip, provider-order,
  usage-arrange, group-arrange, group-member-drag, group-duplicate,
  group-bulk-remove, panel-arrange, codex-model-order, zhipu-team,
  mobile-web, phone-web, phone-rows, view-no-sideways, gui-de, gui-ja,
  gui-zh-tw, routing-group-fold, panel-usage, panel-fold, grip-inset:
  383/383 pass.
- go test -tags nogui ./internal/gui (temp HOME): ok.
- GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gui: ok.
Not run: the whole GUI suite.
2026-10-11 14:31:15 +08:00
yetone 3f57024211 provider, gui: a routing group is shared as text and imported into another magpie (laincatx on X)
A group row's menu has Copy to share: the group as JSON marked
"magpie": "routing-group" with a format version (provider.ShareGroup),
holding its members as it names them, patterns, routing, rules,
classifier and settings. A group holds provider/model ids only, so no
key, account or address goes with it; derived matches and the
found/hidden/off flags stay behind.

The Routing page's Import (by New group) opens a box the text is pasted
into, words or a code fence around it allowed. POST /api/groups/import
(provider.ImportGroup) adds it under a free name, never over a group.
A member whose provider the importer has is kept; else the same model
under one of their providers (listed as used instead); else it is left
out and listed, with the rules that send to it and its off/fast place;
a classifier gone takes the intent rules and auto effort. Nothing is
added when no member is left. Other text, a newer format or none is
refused in the reader's language (provider.ShareError, code "share").

Run:
- go test -tags nogui ./... (gateway failed once on a full disk, then
  passed alone); new TestSharedGroupRoundTrip/MissingMembers/BadText and
  TestGroupShareAndImport; the version check broken by hand turns them red
- gofmt -l; go vet ./...; GOOS=linux go vet -tags nogui ./...;
  GOOS=windows go vet ./...; go build
- group-share.test.cjs in chromium and webkit, en/zh/zh-TW/ja/de, 420px;
  every group-*, settings-groups, filter-ime, panel-routing GUI test
  (210 pass); routing-* (550/557: webkit fold tests timed out only under
  --test-concurrency=6 and pass alone; a webkit routing-* run under the
  same load fails one test on origin/main too, a different one each run)
- real use: the owner's 12 groups from a sandbox copy of providers.json
  each shared (no key in the text) and imported back whole
2026-10-11 10:33:45 +08:00
yetone ae70d8eac8 routing: a group's rule can hold by the folder the agent works in (Cario0x on X)
Cario0x on X asked to route by the project being worked on. A group's rule now has a
"folders" condition: it matches when the request's working folder is one of the listed
folders or inside one. It combines (AND) with the existing conditions: tokens, images,
intent, time, agents and quota.

- gateway/workdir.go reads the folder each agent states in its own request:
  - Claude Code: "Primary working directory", including "(was …)" after a move.
  - Codex: <environment_context><cwd>.
  - Pi: <cwd>.
  - OpenCode: <env> "Working directory".
  The last one stated wins. Assistant text and tool results are ignored. A request
  that states no folder matches no folder rule: unknown, never empty.
- provider/rulefolder.go matches a folder only at a path boundary.
  - ~ is the home folder.
  - C:\x is the same folder as /mnt/c/x, and \\wsl$\Distro\x as /x.
  - Case is ignored on macOS and Windows, and always for a drive.
  - A rule's folder must be a whole path. Pause rules can't have folders.
- The trace's RuleHit.Folder makes the Routing page say "The agent works in …".
- GUI: an "in folder" condition in the group editor, hidden on pause rules. Strings in
  zh, zh-TW, ja and de.
- CLI: `magpie group rule add … folders=~/oss,"~/My Project"`. The TUI shows the
  condition.
- Docs: docs/subsystems/gateway-routing.md and site start.html (en, zh, ja).

Fixtures are real requests from Claude Code 2.1.296, Codex 0.162.0 and Pi 1.1.0, run in
a sandbox from a folder named "a&b <c> 中文" or "My Proj", with the sandbox path
replaced.

Run at this head:
- go test ./... green.
- gofmt -l clean.
- go vet green for darwin, GOOS=linux -tags nogui and GOOS=windows.
- GUI routing-folder.test.cjs: chromium and webkit, en, zh, zh-TW, ja and de, 1100px
  and 390px (no horizontal scroll). It fails on the old routing.js.
- Related routing, group and i18n GUI tests: 85/85.
- Full GUI suite: 5611/5631 under --test-concurrency=6. Rerun alone, every failure
  passes except:
  - skill-install-agents-all (chromium, 420px), which is red on origin/main too: #1554.
  - The menu-scroll track flake, which flakes on main as well: #1550.
- e2e: a sandbox HOME, a dev build and fake upstreams, with real Claude Code 2.1.296
  (`claude -p --model group/fd`).
  - From proj/acme/web, rule 1 matched and the request went to kb.
  - From proj/acme-old, no rule matched and the request went to ka. The trace and UI
    showed the folder.
2026-10-11 10:17:16 +08:00
yetone 1f6519f9b3 gui: Safari 15.0 keeps the Usage refresh at the edge and the hover on the range menu and routing chips
old-webkit.test.cjs was red on main. Safari before 15.4 can't parse
:has(), and it drops a whole selector list that holds :focus-visible,
hover included:

- dbf0fefc6 put `.usage-head:has(> .usage-cost:empty)` in app.css (the
  commit that turned the test red, by bisect).
- 6d3bc9183 (range menu .rm-span, .rm-day) and 3d7acfb40 (routing's
  .rt-go chips) wrote `:hover, :focus-visible` lists, so on Safari 15.0
  those took no hover either.

The :has() rule is now a `no-sum` class on the Usage head, which app.js
keeps with a MutationObserver on #usageCost (it is filled and emptied in
many places). Each :focus-visible list is split into its own rules. What
a current browser shows is unchanged.

Run: old-webkit.test.cjs, chromium and webkit, 6/6 each. An earlier
layout probe over 40 cases per engine found no difference from main in
current engines.
2026-10-11 02:34:20 +08:00
yetone 1b8cb53e3f gui: on a phone a row's trailing parts take a line of their own, so a provider's, a gateway key's, a model's, a call's and a routed request's text isn't cut to a letter (zaidu259434 on X)
zaidu259434 on X: 移动端适配真的希望优化下. At 360-430px in a phone browser
(a remote or shared magpie, body.web), rows kept their desktop one-line
layout:
- Providers: the name and host squeezed to a letter or two beside the key
  pill and agent icons; the switch pushed past the card.
- Gateway: the status line, each key's name and masked key, a model's
  badges, and a call's model and path cut to slivers.
- Routing: a request's reasoning ("medium") cut to "m…" beside its upstream.

Fixed at the shared choke points, inside the body.web phone media blocks
of app.css and routing.css only, so the desktop and app window are
unchanged. An empty ::after flex line break puts the trailing pills of
.row.provider, .row.model, .row.gw and .call on a second line. A key's or
account's buttons go under its name, and its hover-only controls are shown,
since nothing hovers on a phone. The upstream tag gets its own line.
routing.js is not touched.

phone-rows.test.cjs: at 360px, on Providers, Gateway and Routing, nothing
runs off the side, no text in a row is cut to a sliver (<40px wide for over
twice that), and every control is inside its row.

Run:
- phone-rows: 10/10 pass (chromium and webkit x en, zh, zh-TW, ja, de).
- On the old assets (a5114d93) phone-rows fails on all three pages in both
  engines.
- Also pass in both engines: phone-web 6, mobile-web 30 (its desktop
  screenshots compared against main), routing-upstream 4,
  gateway-caller-keys 4, gateway-key-limit 4, gateway-key-models 4,
  click-scroll 20, upstream-status 8, api-key-usage 4.
- Audited every page at 360/390/430 in both engines with real data:
  providers and gateway went from 28/33 crushed texts to 0, no horizontal
  page scroll anywhere.
2026-10-10 20:08:47 +08:00
yetone ad136426d2 gui: the context window's 400 cells and other entrance animations let go of their layers once played (#1481, hoffman24)
hoffman24's macOS app had a WebKit WebContent process over 1GB, 866MB of
it IOSurface graphics buffers for ~1,600 compositing layers. One clear
cause is ours: entrance animations played with fill "both" stay in effect
for good once finished, and an element with a finished transform/opacity
animation held keeps its compositing layer. The context window card's
waffle is 400 cells, each with ctx-cell (opacity + scale) and fill both,
so every card on Routing kept 400 layers alive.

Every one of these keyframes only says where the element starts (from),
or ends where its own style already is, so "backwards" draws the same
before and during the animation and lets go after:
- context.css: ctx-cell (waffle cells), ctx-grow (cache bar), ctx-arc
  (ring), ctx-draw (tune chart), ctx-pop (tune dots)
- library.css: lib-skel-in, .mk-card content-in (a market card's hover
  lift now shows too: the held animation overrode its transform)
- routing.css: .masking .pii rtpii

Measured on Routing with one context card (origin/main assets vs these):
- document.getAnimations(): 412 -> 13 (WebKit), 412 -> 15 (Chromium)
- Chromium CDP LayerTree: 421 layers -> 21

held-animations.test.cjs opens Routing with three traced requests,
waits for the cells to finish and asserts no finished animation is held
and the card looks the same (every cell opacity 1, no transform, cache
bar grown). It fails on origin/main ('ctx-cell': 400 held) in all four
cases and passes here: Chromium and WebKit at 420 and 1100px.

Run: the GUI tests touching ctx-/mk-card/lib-skel/masking/Routing/
Library (116 files): Chromium 576/576, WebKit 574/576. The two are one
case of routing-pointer-pin.test.cjs, whose card moved 588.56 -> 590px
under the full run's load; alone and 4-up it passed 3/3 and 36/36 here,
and 12/12 on origin/main's assets 4-up. Filed with the purpose-filter
WebKit 1px drift.
2026-10-10 20:00:38 +08:00
yetone 3d7acfb40f routing: the mode chip leads to where the routing is set, and a lone key names none
xczzhh on X: "这个路由策略能自己选吗,我的一直是smart,也改不了好像". The
Routing page's hub chip and the Accounts and keys heading said Smart for
every provider, even one with a single key on, where there is nothing to
route, and nothing on the page said where it changes.

Now, where routing can be changed (a group, or a provider listed in
/api/groups' pools: two or more accounts or keys on), the chip and the
heading are .rt-go controls (goTo/goRouting): a click or Enter brings the
group's card or the provider's row under Several accounts or keys into
view via scrollOnPurpose, marks it (rt-found, off under reduced motion)
and focuses its routing picker. A provider with one on names no routing,
and the mode paragraph says to turn on a second in the provider's editor
(LONE, in zh, zh-TW, ja and de). The header is drawn again when the
groups arrive (headOf).

routing-weight-chip's fixture now lists its two-key relay in pools, as
/api/groups does.

Run: routing-mode-goes.test.cjs 40/40 (chromium+webkit, en/zh/zh-TW/ja/de,
1100px and 420px); all 20 chromium cases fail on the old routing.js. All
routing-*, quota-pool*, rate-limited-sink, panel-routing, click-scroll,
view-scrollbar-drag and i18n-keys tests pass (group-fold, keys-fold,
flood and context-fold failed only under a 6-way parallel full run and
pass alone, as on main). go test -tags nogui ./internal/gui ok.
2026-10-10 19:49:14 +08:00
yetone e70e7ed46a routing: a routing group is made from a template in one click, of the user's own models: hard turns to the strongest and easy ones to a cheap one, cheap first, or never stuck
Making a group took the whole editor (owner, 10-10). Three templates are
made from the models the user has (provider.Templates, grouptemplate.go):

- smart (smart-split): an ordered group of the strongest model and a cheap
  one; a classifier sends a hard turn to the strong one and an easy turn or
  a compaction to the cheap one, images to a model that sees them. The
  classifier is the decision API when there is one, else the cheapest
  priced model that doesn't reason.
- thrifty (cheap-first): two cheap models of different providers, then the
  strongest, which also takes high reasoning.
- steady (never-stuck): the strongest model of up to three providers, each
  failing over to the next.

A model weighs by its maker's list price, else its provider's, else by its
id's size words; one over $100 a million output tokens is never picked. A
template that can't be made says what is missing. AddTemplate saves it
under a name and id no group has (freeGroupName, now shared with
CopyGroup), never over one.

GUI: before the user has a group of their own, the Routing page shows the
templates as cards (models, Add, Edit first); after, a Templates menu by
New group. CLI: `magpie group template [kind] [name]`, no args to list.
Pricing goes through priceOf with the served entry's provider, so
/api/groups pays ~75ms for templates on 203 models, not ~600ms.

Run, at this head rebased on origin/main 4e584faa: go test ./... green;
gofmt -l clean; go vet on darwin, GOOS=linux -tags nogui and GOOS=windows.
GUI: group-template.test.cjs and group-duplicate.test.cjs (Chromium and
WebKit, 5 languages, 420px) 30/30, the template test 3 runs in a row; it
skips WebKit's "ResizeObserver loop" notice as two other tests do. The
group-*/routing-* GUI tests ran before the rebase: 628/635, the 7 being
WebKit flights in routing-group-fold and routing-keys-fold, one Chromium
routing-proxy, and the ResizeObserver notice above; run alone at this head,
routing-proxy passes and the two fold files pass twice on WebKit, as on
origin/main. Real data in a sandbox HOME: `magpie web` on 3561, the
Templates menu added smart-split as GPT-6.1 Sol → GPT-6 Luna with 3 rules.
No real request was routed through the new group.
2026-10-10 19:46:58 +08:00
yetone 666c0fa4fd routing: the context window holds still while requests stream in, and the prompt-cache card shows the last request's hit, dimmed, or a dash with the reason instead of "——命中" and an empty bar (dumplings on Discord)
dumplings reported that on Routing, every new request made the context
window jitter and flash, and that the prompt-cache card read "——命中",
glued together, with an empty bar under it.

Causes, measured with a frame sampler while requests stream through
start/read/done:
- A live request's story is shorter than a finished one's. "Is
  answering…" becomes "answered in 4.0 s…", which wraps onto two lines
  at phone width. The log head also gains View usage and Replay once the
  request is done. So the card under it moved up and back down on every
  request: 45px at 420px wide, 6px at 900px.
- The state pill ("Live" or "Counted") changed width, which moved the
  model name beside it by about 11px.
- While a request was under way the cache card dropped to "—" with a
  0% bar, then came back. That was the flash.
- A flex item's leading space is dropped, so " hit" and " / 272K" were
  glued to the figure before them.

Fix:
- routing.js holdStory keeps the log head and steps at the tallest
  height seen while following live, at this width and language. A
  picked request, a replay or a past day is drawn at its own height. A
  ResizeObserver on the steps measures again as soon as the width
  changes. Without it, a scrollbar appearing before the first request
  left a stale height and a 6px shift (seen in WebKit under load).
- context.js stacks all three state words in one grid cell and shows
  only the current one, so the pill keeps one width.
- While the next request is under way, the cache card keeps the last
  request's figure, dimmed (.was), with "The last request's · this one
  is on its way". When there is nothing to show, it gives a faint "—"
  and the reason ("Read once the vendor answers" or "The vendor didn't
  say"). The bar stays hidden but keeps its space. The remembered
  figure resets when the agent or session changes.
- .ctx-big gets a gap. Width and opacity transitions are turned off
  under reduced motion.
- The three new strings are added in zh, zh-TW, ja and de.

Verified:
- The new tests/routing-ctx-still.test.cjs streams two requests and
  checks that the card, model, state, used, cache, figure, bar, grid,
  legend and foot rects never move by more than 0.5px. It also checks
  the figure-to-word gap and both empty states.
- It runs in Chromium and WebKit, at en 420/1100, zh 420/1100,
  zh-TW 900, ja 900 and de 420. It narrows the viewport by 10px after
  load.
- On the old assets it fails 16 of 16 (the card moves 6–52px). It also
  fails with only the ResizeObserver removed.
- routing-live-patch now expects the held figure ("97%") on live steps
  instead of "—".
- Under --test-concurrency=4 in both engines: 578/578 pass across
  routing-*, context-*, click-scroll, group-context, panel-routing and
  gui-de/ja/zh-tw.
- go test -tags nogui ./internal/gui passes.
- GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gui are
  clean.
2026-10-10 10:13:43 +08:00
yetone 55544f09f6 routing, gui: a provider's accounts and a group in the group fold on the Routing page, long ones folded at first, what the reader picks kept (Aiirobyte on Discord)
Aiirobyte: a routing group of many accounts took so much of the page that
editing the groups below it was a long scroll. The stage folded only runs
of three or more API keys (#1319).

Now:
- Three or more accounts of one provider side by side for one model fold
  into one row the way keys do: the count, the lit one and what it does,
  how many are available and resting. A request to a folded account flies
  to the fold.
- A group in the group's heading folds from a click, Enter or Space (it is
  a button now, with a chevron). Folded, it says "{n} on" and what its
  seats do together; requests under it fly to the heading and a failure
  tags it.
- Accounts and keys sums a provider's accounts up in one row too.
- Keys start folded as before. Accounts and group headings start open
  under six, folded from six. What the reader opens is kept in
  magpie.routingKeysOpen as before, what they fold in the new
  magpie.routingFolded, so both directions survive a reload.
- Redraws go through steady(), so a click keeps the page where it is.
- Strings in en, zh, zh-TW, ja, de. Display only: the gateway's order and
  choice don't change.

routing-account-order now opens the relay's key fold by :not(.open),
since the account folds there start open.

Run: new internal/gui/tests/routing-group-fold.test.cjs (defaults, click
and Enter in place with the page not moving, kept across reloads both
ways, a live request to a folded group heading with its tag, Accounts and
keys folds, 420px fit) in Chromium and WebKit, en/zh/zh-TW/ja/de, 40/40.
On origin/main's assets it fails (no account fold, heading not foldable).
All routing-* tests, panel-routing, click-scroll, gui-ja, gui-de,
gui-zh-tw and i18n-keys: 255/255 in Chromium and 255/255 in WebKit. Not
tried in the real window with a live gateway.
2026-10-09 11:10:11 +08:00
yetone 8db24fd62f gui: Routing folds three or more of a provider's keys for one model into one row that shows the count and their state, and opens in place to each key (#1319, tkhs101)
53 agnes-3.0-flash keys were 53 near-identical stage rows and 53 rows
under Accounts and keys. Now three or more keys of one provider standing
together for one model (same fixed effort, fallback and group-in-group
heading) fold into one stage row: "Agnes 53 keys agnes-3.0-flash", then
the lit key and what it does, "51 available · 2 resting". A request on a
folded key flies to the fold; a key failing and the next answering show
there (its 429 tag too). A click, Enter or Space opens it in place: each
key keeps its own row, state and wire, drawn from the fold. Accounts and
keys folds the provider's keys into one row with their summed tally and
models, and opens the same way. Open folds are kept per reader in
localStorage magpie.routingKeysOpen. Two keys stay two rows; one key is
as before. Display only: the gateway's order and choice don't change.
New strings in zh, zh-TW, ja and de. docs/subsystems/gui-shell.md says how.

routing-account-order's relay has three keys, so it now opens their fold
to read their order.

Run: routing-keys-fold.test.cjs (32: folded, open/persist/Enter, live
updates folded and open, Accounts and keys, 440px; Chromium and WebKit;
en, zh, ja, de) — fails on main (no fold). All routing-*.test.cjs,
panel-routing, click-scroll, fold-show-grip, gui-ja, gui-de, gui-zh-tw,
i18n-keys: 409 pass. Every other test that opens Routing (29 files, 152
tests) passes but purpose-filter's WebKit "returning focus does not scroll
the page", which fails the same alone on origin/main (off by 1px).
go vet -tags nogui ./internal/gui (darwin, GOOS=linux, GOOS=windows).
2026-10-08 22:20:22 +08:00
Zhu Wang f00ed2901c routing: filter by several purposes with checkboxes (#1247)
* routing: filter by several purposes with checkboxes

Ticking a purpose immediately shows the union of the selected purposes while keeping the menu open. All purposes, Clear filter and removing the last selection restore every purpose. Counts, the story and history follow the same list.

Live menus ignore renderer-induced scrolling while deliberate outside scrolling still dismisses them. Update the GUI shell reference and browser coverage for multi-purpose counts, keyboard toggling, history, aliases and narrow windows in five languages.

Verified 115 isolated Playwright checks in Chromium and WebKit, JavaScript syntax and git diff --check. The new checkbox case fails against the old assets with 0 checkbox choices instead of 5; restoring the old menu scroll handler separately detaches the menu during selection in WebKit.

* routing: All purposes returns keyboard focus to its button

Address the keyboard-focus regression reported in PR #1247. Choosing All
purposes closes its menu and focuses the purpose button without scrolling.
Unticking the last purpose keeps the live menu and its checkbox focused.

The expanded checkbox test fails without the focus restoration in Chromium
and WebKit: All purposes returns keyboard focus to the purpose button
(false !== true). With the fix, 162 isolated Playwright checks pass across
both engines, including five locales, narrow widths, purpose state,
history, request/session grouping, Usage and scroll/menu regressions.
JavaScript syntax and git diff --check pass. The full GUI/Go suites and the
packaged desktop app were not run.
2026-10-08 16:02:17 +08:00
yetone 6485f5ecb5 gui: the Routing page, and Usage's Context tab with a session open, scroll to their end in WebKit: their narrow and wide layouts go by classes set from each box's width, not container queries (#1249)
In WebKit (the macOS app's WKWebView, and Playwright's WebKit) the Routing
page stopped well short of its bottom (wizzy-yang on #1213). Each time the
page was drawn again while it was scrolled near its end, WebKit cut its
scrollTop back to a shorter range. The page has query containers in it
(.rt, .rt-accts, .rt-more, .rt-col), and the cut happens during a redraw.
Seen at 440x620: 575 of 585, and up to a whole screen short when a part
was redrawn. Chromium is unaffected. With container-type set to normal on
those boxes the page reaches its end, and the cut goes away. Replacing a
container with its clone at the end reproduces it in WKWebView too.

Each box's width now sets a class, the same way container queries would
have chosen a layout:
- routing.js sets the classes from a ResizeObserver: max560 on .rt and
  .rt-accts, max460 on .rt-accts, max520/min1150 on .rt-more, and
  max440/max760 on each .rt-col.
- context.js does the same for each .ctx-card: max520 and max420.
- A rule that names the box goes through :where(), so it keeps the
  specificity it had inside its query.
- The class is set on the next frame, as quotaFit does: set in the
  observer's own call, it changes the box's height, and WebKit reports
  that as a ResizeObserver loop.
- A redrawn ctx-card starts with the width the last card in its place had
  (routing or session). It doesn't lay out wide for a frame and then
  narrow, which would itself pull the page up.
- The Safari 15 @supports fallbacks are dropped. They chose a layout by the
  window's width, and ResizeObserver covers that Safari.

Sibling: Usage → Context, with a session open, has the same bug. Each
timed read redraws the card, and WebKit pulled the page up by up to 946px
at 420 wide (682px at 1100). It is fixed the same way. The other query
containers were checked at their end with a synthetic redraw and were not
affected: Library's .lib-row.with-agents and Agents' .row.agent .who.
Sessions (.sess-pane) also jumps in WebKit as it refreshes, but it still
does with its container removed, so the cause is something else. It is
left alone here.

Run:
- routing-scroll-end.test.cjs (new): 440x620, 600x700, 900x500, 1200x600
  and 1400x700, en and zh, Chromium and WebKit, with the trace redrawing
  the page. It also checks the stage, request and column layouts. On the
  old CSS all 10 WebKit cases fail (twice); with the fix it passes 22/22
  (four runs).
- context-scroll-end.test.cjs (new): 420, 700 and 1100 wide, en and zh,
  across a timed read. On the old CSS the WebKit cases fail ("958 of
  1891"…); with the fix it passes 14/14.
- Layout compared with the old CSS: every element's rect on the Routing
  page (group editor closed and open) and in the Context card. Widths
  360–1700, en/zh/zh-TW/ja/de, Chromium and WebKit: 220 + 100
  configurations, none differ, and there are no page errors.
- The macOS WKWebView: a part redrawn at the end left the page 200–238px
  short before the fix and 0 after, at 440 and 1100.
- gui-ja, gui-de, gui-zh-tw and i18n-keys pass.
- Full GUI suite (concurrency 4): 3719/3733.
  - Pass alone: azure-endpoint, remote-magpie, signin-again and
    routing-sessions.
  - mobile-web compares with origin/main, which had moved on; against
    this commit's parent it passes.
  - panel-arrange fails the same way on the parent.
  - context-window's chromium 1100px hover flakes under load on the parent
    too: 5 of 16 parallel runs, against 1 of 16 here.
- go test ./internal/gui; GOOS=linux and GOOS=windows go vet
  ./internal/gui.

Not run: the reporter's own machine, or an old Safari 15 WebKit.
2026-10-08 15:57:08 +08:00
yetone 685fa5dc61 gui: a routing group's rule by intent has its own entry, "Route by what it asks for" beside Add a rule, and a group whose effort Jev picks offers it under the classifier (CherryL1quor on X: 模型路由能不能用 jev,现在只有思考强度能用 jev)
An intent was one of a rule's seven conditions, so a reader who had Jev
picking the effort took it for that alone. "Route by what it asks for"
adds a rule with its intent box focused. Jev is picked as the classifier
when there is one, as the effort's Picked per turn already did, and the
classifier row shows at once, before anything is typed. Typing an intent
into any rule picks Jev too when no classifier is set. A group whose
effort Jev picks, with no intent yet, says under the classifier "It can
pick the model too: add a rule with an intent", which adds the same rule.
Translated in zh, ja and de.

routing-intent-entry.test.cjs (Chromium and WebKit, en and zh, 1100 and
440 wide) checks that both buttons stay inside the editor and that the
clicked one stays under the pointer as the rule comes in above it. It
also checks the focus, that Jev is picked, the save as
{use: b/flash, intent} with classifier typesafe/jev-latest, and the offer
under an effort-only Jev. It fails on the old assets (no such button).
gui-ja, gui-de, i18n-keys, click-scroll, routing-compact, -time, -save,
-save-blank, -effort-row, -effort-change, -levels, -days-fit and every
group-* suite pass (159 tests). Not tried with a real TypeSafe key.
2026-10-08 03:42:22 +08:00
yetone d2aa2e1f4e gui: Settings' "Codex's own pick" chips draw their OpenAI mark at the chip's 14px, not the row's 18–22px (duanckham on X) 2026-10-07 05:43:53 +08:00
yetone 5d8717239d routing: accounts sit beside the requests only where each request still keeps to one line (#860, huoranxuanyuan: 宽窗口下变成两栏,请求行折成三行)
The two columns (0281df4d, an agent's call; the owner's 614d5179 asked only that they line up) began at an 860px Routing area, where the requests' column is under 760px and each request breaks into three lines. They now begin at 1150px, where the requests' column stays over 760px; narrower, the accounts go below and each request reads on one line. routing-columns.test.cjs: at 940 and 1100 one column with one-line requests (fails on the old CSS: '940px: one column'), at 1440 and 1920 side by side, aligned, with one-line requests. routing-account-identity, routing-sessions and routing-served pass, Chromium and WebKit, en and zh.
2026-10-07 00:29:47 +08:00
tsuixl bd33e575f1 gui: let users choose installed interface and code fonts (#1007)
* gui: choose installed interface and code fonts and styles

Discover installed styles through DirectWrite, CoreText and Fontconfig. Keep choices per computer, apply them before paint and notify both desktop webviews after saving; defaults retain platform and Omarchy fallbacks.

Verified seven focused Go tests, including real Windows discovery (90 families, 276 styles), 14 font browser cases in Chromium/WebKit, 68 settings/zoom/Omarchy/web cases, go vet, Windows amd64/arm64 and Linux nogui builds. Against the original assets, the new UI test fails with Settings must offer an interface font picker (0 != 1). Full Windows suites have separately reproduced upstream failures; macOS/Linux native discovery is covered by the added CI step.

* gui: retain bundled Mac fonts and variable style precision

Only filter an undownloaded CoreText face when it is explicitly downloadable; bundled fonts are installed without being downloaded. Use resolved font names when descriptors omit them. Preserve fractional weights and nonnegative CSS widths for named variable styles.

* gui: restore the authored font cascade when returning to defaults

Apply family-only trait overrides only while a custom face is active. The browser regression catches code under a bold parent becoming 700 instead of its original 400. Keep the compatibility shim first, and apply boot fonts before visible content.

* gui: keep font picker review separate from CI integration

Leave the native test sources and manual verification command with the feature. Move the added workflow step to a follow-up so the font picker can take the normal review path requested on PR #1007.
2026-10-06 19:32:56 +08:00
yetone 5bff5a261d gui: Routing › Requests' day bar shows the days that fit and keeps the rest under its last pill, "Earlier days" (#961, emo172: Windows 200%, text size 150%, the bar cut off at the right and the older days out of reach) — the bar scrolled with its scrollbar hidden, so with the 30 days the gateway keeps the later pills were cut at its edge and a mouse wheel (vertical) couldn't scroll it. fitDays hides the oldest pills until the bar fits (on each redraw and on resize), and the last pill opens the app menu (openProtoMenu) listing each hidden day with its count; the day looked at stays in sight: picked from the menu, the pill is named by it and pressed. A pick in an app menu (in body, outside any view) now counts as a click on the pill that opened it for the click hold in app.js, so what the day brings in above the bar doesn't push it down (~138px before). zh/ja/de added. routing-days-fit (30 days at 1100, 733 = 1100 at 150%, and 440px: nothing cut, the menu holds the rest, the oldest picked is asked for, names the pill, the bar held; 3 days no pill; narrowed then widened) passes in Chromium and WebKit, en/zh/ja/de, and fails without the fix (10/12; with only app.js reverted, 8/12 on the bar moving). click-scroll, menu-scroll, proto-menu-overflow, purpose-filter, routing-purpose-state, i18n-keys, gui-ja, gui-de and the other tests opening an app menu pass, except sessions-talk's WebKit omp case, which fails the same on origin/main (184 vs 179), and gateway-key-accounts, which failed 2 of ~26 runs while other test runs loaded the machine (badge read before its redraw) and then passed 25/25 (origin/main 20/20). 2026-10-06 11:49:25 +08:00
2cc663d0a2 gui: protect unsaved edits and confirm destructive actions (#820)
* gui: edited forms ask before they are discarded, removals ask before they take effect, and the header keeps its first layout — Cancel, Escape, the backdrop and a page change could throw away a provider's draft, and several account, key, plugin and library removals took effect at once. Modified provider, settings, library and routing forms now ask before discarding; unmodified forms still close without asking, and refresh or closing the browser tab uses its leave confirmation. Removal and discard confirmations are in-app dialogs over the intact editor, centered, with Cancel focused first, Tab kept inside, Escape canceling and focus returned afterwards; destructive buttons have readable foregrounds in light and dark themes. Text and connection settings have Save/Cancel rather than saving on blur; simple switches still save at once. Editors associate labels and help with fields, make the background inert while open and keep focus through redraws; navigation keeps browser back/forward history and its current-page state, errors remain until dismissed or replaced, and focus and validation can scroll into view. Mobile settings tabs have larger targets, fields use 16px text and page zoom stays available. layout.js applies mode and platform before the header paints, theme.js applies the saved text size before styles, and mode-specific window controls stay hidden while app.js downloads. zh/ja/de strings added. routing-shape's global .rt-day selector selected the hidden By session button on WebKit; its history click now stays in .rt-days. ux-safety covers unchanged and modified closes, canceled and confirmed removals, Escape, backdrop, modal focus, light/dark centering and button contrast, explicit saves, browser history and sync-form discard. Rebased onto upstream/main 2f183c4c. Chromium and WebKit each pass 31 related browser tests in en and zh; gui-ja and gui-de pass all 6 browser and translation-parity tests. go vet -tags nogui ./..., go build -tags nogui, go test -tags nogui ./internal/gui, JavaScript syntax checks and git diff --check pass.

Co-authored-by: XYenon <register@xyenon.bid>

* gui: edited providers, routing groups and library forms ask before their drafts are discarded, and only immediate removals ask before taking effect — Settings keep saving on Enter and blur, switches save at once, and the reader's scroll position is restored after an unasked-for scroll. Header rows, fallback models, group members, patterns and rules stay ordinary reversible draft edits. The confirmation dialog keeps its own readable destructive colors; the window's text selection, muted and faint colors, timed status messages, replaceState navigation and iOS viewport policy stay as before. The keyboard scroll assertion is restored, and click-scroll's date buttons are scoped to .rt-days .rt-day so WebKit cannot pick a hidden request-grouping button. The safety tests cover dirty editor closes and page changes, immediate provider deletion, labels, modal focus, Escape and backdrop cancellation, with the withdrawn settings, history and persistent-error assertions removed. First-paint layout and the saved theme/text size remain early.

Co-authored-by: XYenon <register@xyenon.bid>

* gui: old WebKit gets its layout before the header paints, and browser tests answer the new discard and removal questions — compat.js runs before layout.js, whose viewport setup uses ES5; the confirmation uses vh rather than Safari 15.4 dynamic viewport units. Opening a provider from its address keeps the editor pending until its page loads, and fields keep their own nested labels when Names & levels is reopened. An empty model preference map is compared as Save sends it, so opening model settings without changing anything closes without a question. Removal tests assert nothing is sent before confirmation; draft tests answer Discard and retain their Save and Cancel assertions. Plugin migration uses the reader’s wheel rather than a scripted scroll, keeping every scroll assertion. Targeted WebKit regressions pass 40/40, Chromium regressions pass 41/41, and the model-setting and editor-safety checks pass in both engines. go vet -tags nogui ./..., go build -tags nogui, JavaScript syntax checks and git diff --check pass.

Amp-Thread-ID: https://ampcode.com/threads/T-01a108b0-c6a0-768d-ad6a-9a571a10a847
Co-authored-by: XYenon <register@xyenon.bid>

* gui tests: the upstream model list keeps folding with the new discard question — models-fold answers Discard only after picking another model; the short list and an unchanged folded list still close without asking. ux-safety waits for its Relay row rather than matching loading placeholders. Rebased onto upstream/main c353f7bd, including the new model-list expansion. models-fold passes in WebKit and Chromium, as do the English and Chinese editor-safety checks; the related model drafts and first-paint phone tests pass on WebKit.

Amp-Thread-ID: https://ampcode.com/threads/T-01a108b0-c6a0-768d-ad6a-9a571a10a847
Co-authored-by: XYenon <register@xyenon.bid>

* gui: an editor redraw keeps its removal confirmation and menus interactive — Only a fresh modal makes the existing background inert, and closing restores exactly the elements it changed. A redraw no longer disables a confirmation or popup appended over the editor; elements already inert and overlays added later retain their own state. The original background is retained if a new editor interrupts the closing animation. ux-safety redraws Relay twice under its Remove confirmation, clicks Cancel, and verifies no deletion was sent; it also picks a menu item after an editor redraw and checks background restoration. The regression reproduced on WebKit before the fix. All 8 English and Chinese safety checks pass on WebKit and Chromium. The related WebKit removal, draft, routing and phone checks pass, with account-arrange passing separately after a detached-element race in the concurrent run. go vet -tags nogui ./..., go test -tags nogui ./internal/gui, go build -tags nogui, JavaScript syntax and git diff --check pass.

Amp-Thread-ID: https://ampcode.com/threads/T-01a108b0-c6a0-768d-ad6a-9a571a10a847
Co-authored-by: XYenon <register@xyenon.bid>

* gui tests: editor safety uses the page's boot preferences, not its settings — gateway in boot.js is now the gateway-mode flag, whereas settings.gateway is the gateway's URL. Spreading settings into the fixture boot data mistook the URL for gateway mode and redirected a dirty editor's attempted page change back to Providers. The fixture now emits the same language, theme, text size and web fields as the server. The 8 English and Chinese editor-safety tests pass on Chromium and WebKit; gateway-mode, plugin middleware and plugin-market pass on WebKit, and phone-web passes separately after a scroll race under concurrent load. Rebased onto upstream/main 2f135ed4 with gateway-mode navigation and initialization retained. go vet -tags nogui ./..., go test -tags nogui ./internal/gui, JavaScript syntax and git diff --check pass.

Amp-Thread-ID: https://ampcode.com/threads/T-01a108b0-c6a0-768d-ad6a-9a571a10a847
Co-authored-by: XYenon <register@xyenon.bid>

* gui: upstream's new removals and fields follow the editor-safety rules too — Audited GUI changes from the original PR base 2f183c4c through upstream/main 9debc583, including earlier rebases. Bulk group removal uses the in-app consequence dialog rather than a second click, and clearing middleware options asks before deleting saved options. Cancel sends nothing and keeps the selection or editor. Custom group context, Settings' compact threshold, the inline key-weight input and middleware JSON have accessible names; the JSON note/error and group context hint are linked, and invalid input is exposed. The copy-out-of-date skill action is a keyboard button supporting Enter and Space. A skill's immediately saved per-agent transfer choices update the modal baseline, so Done, Escape and navigation no longer ask to discard already saved changes. Settings save behavior, draft-only removals, scroll guard, viewport and themes stay intact. Chinese, Japanese and German consequence strings added; obsolete bulk-removal armed styles and strings removed. The six affected browser files pass across Chromium and WebKit in English and Chinese (54 tests after scoping compact-at to its provider rather than skeletons). Additional provider price, key import/weight, group member/first-token, caller-key, purpose and gateway-mode regressions pass on WebKit; key-weight also passes in Chromium, with a concurrent status-message race passing separately. go vet -tags nogui ./..., go test -tags nogui ./internal/gui, go build -tags nogui, JavaScript syntax and git diff --check pass. The Chinese bulk confirmation was rendered and inspected on WebKit.

Amp-Thread-ID: https://ampcode.com/threads/T-01a108b0-c6a0-768d-ad6a-9a571a10a847
Co-authored-by: XYenon <register@xyenon.bid>

* gui: new upstream key removals and nested group jumps keep the editor-safety rules — Bulk deletion of failing, off and matching keys uses the app's consequence dialog, with Cancel and Escape sending nothing and a redraw leaving its buttons interactive. The shared group-editor entry asks before replacing a dirty draft, and nested navigation waits for acceptance before upstream's explicit scroll. Codex's Sign out uses its existing confirmation once. Group and key filters have accessible names. A focused model-price input is included in leave protection before its change/blur parser runs, and reverting the raw value is clean. Settings saving, scroll protection, draft-only removal, viewport and themes retain their upstream behavior. The affected flows pass in Chromium and WebKit, English and Chinese; Names & levels also passes in Japanese and German. The price fixture focuses before filling because the previous blur normalizes sibling fields, a race reproduced on upstream. go vet -tags nogui ./..., go test -tags nogui ./internal/gui, go build -tags nogui, JavaScript syntax and git diff --check pass. The Chinese bulk-key dialog was rendered and inspected on WebKit.

Co-authored-by: XYenon <register@xyenon.bid>
Amp-Thread-ID: https://ampcode.com/threads/T-01a108b0-c6a0-768d-ad6a-9a571a10a847

* gui tests: Codex's newly removable active account waits for the consequence question (#820) — The latest upstream multiaccount Remove path uses accountAction's immediate-removal dialog. Its test now verifies that the first click sends nothing, Cancel keeps the account, and accepting sends exactly one login/forget request. The original account, status and translation assertions remain. Rebased onto upstream/main 8d3cf5f8; the final Codex, nested-group, bulk-key, focused-price and editor-safety tests pass 48/48 across Chromium and WebKit in English and Chinese. Upstream's new quota, skill-group, hit-rate and translation checks pass; search-first's detached-element failure reproduces on isolated upstream. The complete WebKit suite ran 1413 tests before this final upstream delta, with 1289 passes and 124 failures; failing files were compared with upstream or rerun separately. Syntax and diff checks, go vet and the nogui build pass.

Co-authored-by: XYenon <register@xyenon.bid>
Amp-Thread-ID: https://ampcode.com/threads/T-01a108b0-c6a0-768d-ad6a-9a571a10a847

* gui: the Sessions agent strip reports which reused button is selected (#820, #929) — Rebased onto upstream/main 1330b966, retaining the strip's own scrolling, visible selected agent and preserved buttons. Each redraw updates aria-pressed for the selected agent and clears it for the previous selection. The regression checks All initially, the unselected alternatives, then Zed selected with All cleared; on unmodified upstream it fails with null instead of true. Both strip files pass 8/8 across Chromium and WebKit in English and Chinese, including narrow and wide layout and scroll assertions. The latest ChatGPT API, Codex and editor-safety browser checks pass 32/32. Final GUI, Agent, Provider and Gateway Go checks, go vet -tags nogui ./..., Linux nogui and Windows builds, syntax and diff checks pass. Linux native GUI build is blocked by the orb's GTK 4.8 lacking APIs used by Wails beta.24. The complete WebKit run finished with 1289 passes and 124 failures; all failing files were checked against upstream or rerun separately, with details retained in the review artifacts. The full Go suite's sole sessions rewrite failure also reproduces on upstream.

Co-authored-by: XYenon <register@xyenon.bid>
Amp-Thread-ID: https://ampcode.com/threads/T-01a108b0-c6a0-768d-ad6a-9a571a10a847

* gui: closing editors immediately give clicks back to the page (#820, #944) — Restore the background when the close animation starts and protect it again when an editor reopens. Both New group buttons and the model entry ask before replacing a dirty routing draft; creating a group from a provider waits for navigation to be accepted. The GUI shell reference describes these transitions.

The real mouse click during closing fails without the change in all four engine/language combinations, with null instead of received. The unguarded New group and model entries fail waiting for the discard question; the old model navigation creates a routing draft even after Cancel. ux-safety, provider-remove, click-scroll and group-new-head pass 50/50 in Chromium and WebKit, English and Chinese. Closing/reopening also passes five additional rounds, 20/20. After the final upstream translation and TUI additions, i18n-keys, Japanese/German, ux-safety and group-new-head pass 23/23. Ten Chromium update-wait runs have no no-click-scroll failure; two fail on the Restarting status assertion, also reproduced on upstream.

The complete WebKit run finished with 1,307 passes and 141 failures across 1,448 tests, with no skips or cancellations. It is not green: failures in 63 of its 70 failing files also occur on upstream; the other seven files pass separate PR reruns. The complete suite preceded the final upstream translation deduplication, whose resolved keys and values are unchanged, and the TUI/docs additions. go vet and the Linux GUI build with the Makefile's gtk3 tag, Linux nogui and Windows builds, GUI/TUI Go tests, syntax and diff checks pass. Full nogui Go tests are not green: the sessions same-size rewrite check and the final run's WebDAV slow-transfer stall both reproduce on upstream with -race -count=20 under an isolated HOME with pinned caches.

Co-authored-by: XYenon <register@xyenon.bid>
Amp-Thread-ID: https://ampcode.com/threads/T-01a108b0-c6a0-768d-ad6a-9a571a10a847

---------

Co-authored-by: Amp <amp@ampcode.com>
2026-10-06 06:57:49 +08:00
yetone 69665a6960 gui: styles hold up in Safari 15.0–15.3 again (macOS 12, #220) — no :has(), and :focus-visible kept out of selector lists
old-webkit failed on main: app.css and routing.css had :focus-visible inside
selector lists (.quota-refresh, .sess-go, .acap, .alane, .us-handle, the
routing group and member grips) and inside :is() (.am-or's grip). Safari
before 15.4 drops the whole rule, so the hover reveal went too. Those parts
now sit in rules of their own. library.css and routing.css used :has().
A library row with agent chips is now marked .with-agents by agentChips,
and a request whose tag says where it went upstream is marked .upstreamed.

The keys-row collapse (#841) and the library chips' rings kept a control
out with :not(:focus-visible), which Safari before 15.4 also drops whole.
Each now has an @supports not selector(:focus-visible) copy on :focus.
old-webkit's checker now splits a selector list on its own commas, not
those inside :is()/:not(). It also wants that fallback wherever
:not(...:focus-visible...) is used.

The new old-webkit fails on origin/main's assets (12 findings) and passes
with this change in Chromium and WebKit. account-cap, lane-limit,
fold-show-grip, group-member-drag, library-all, library-items, pick-skills,
skill-name-many-agents, routing-upstream, usage-arrange, usage-card-refresh
and click-scroll pass in both. group-arrange fails in Chromium en the same
way on origin/main.
2026-10-06 05:07:13 +08:00
yetone 9f78d74507 gui: the Routing page's head has New group, by Hide accounts, which opens an empty routing group's editor and brings it into view (#944, mintonight) — the groups' New group sat only at their own head, below the live stage and the requests, out of sight on a first look, so a user used the groups magpie finds for days without knowing one of any models could be made. The head's New group has a plus and a tooltip saying what a group is (zh/ja/de); its click opens the editor, scrolls to it only through scrollOnPurpose and focuses the name without a scroll of its own. The groups' own New group has the plus too. group-new-head.test.cjs is new (Chromium, WebKit; English, Chinese) and fails 4/4 without the change. go vet, go build (GOOS=linux nogui, GOOS=windows), go test -tags nogui ./... under a temp HOME and the group-* and click-scroll GUI tests pass. 2026-10-06 03:03:11 +08:00
Zhu Wang 4c5a30dc0e gui: Routing shows request cache rates and output speeds, with metrics chosen as they are ticked (#941)
Keep the compact request rows, add weighted session rates and token breakdown tooltips, and give the request list more room beside accounts.

Verified with Chromium and WebKit in English and Chinese: request metrics, columns, effort rows and changes, burst speeds, session estimates, and shared menus. The request-metrics test fails on main because the cache-rate metric is absent.
2026-10-06 02:23:28 +08:00
wizzy-yangandwizzy-yang b358a5ca83 gui: a routing group in a routing group says what agents are told of it, and where its reasoning is set (#915)
A member that is itself a routing group read as a blank row in the group
editor. provider.groupsState leaves groups out of groups.models, so the
page's modelOf found nothing for "group/<id>" and the row drew no chips at
all: no reasoning levels, no image badge, no window. Which nested group
takes images, how long a conversation it holds and what it reasons at could
only be found out by sending one.

Its own memberInfo already carried what agents are told of it — the window
the largest of its models has, whether any of them sees images, and
imagesUnknown when nothing said either way. The levels every model in it
has (provider.groupEntries' Efforts) were the one thing missing, so
memberJSON carries them (efforts) and the editor reads the whole row from
memberInfo when the member is a group, as it reads a model's from
groups.models. modelInfo already said a group's images are one of its
models' and its window the largest of its models'; the levels now say the
same.

Such a member takes no reasoning of its own, on purpose: its models reason
as the group says (provider.SaveGroup refuses "group/<id>:<level>" — "its
models reason as it says, so it takes no effort of its own" — and the
gateway has nowhere to put one). So where a model's row has its own
reasoning picker, a group's row now names the group it follows and opens
that group's card, rather than leaving the slot empty with nothing to say
where the levels are set. The chip takes the room it needs and gives it
back when the row is tight, since the desktop app's member row doesn't
wrap (only body.web's does). en/zh/ja/de.

TestGroupMemberThatIsAGroupCarriesWhatAgentsSee is new — a group in a
group carries the largest window of its models, images because one of them
sees, and the levels every one of them has; a group whose models share no
level offers none and is not called unknown; a plain member is unchanged;
groups.models holds no group — and fails without the change.
group-member-info.test.cjs gains the nested case (Chromium and WebKit, en
and zh: the chips, the wording that they are its models', the follows chip
and its title, the click that opens the inner group's editor, and the plain
member beside it keeping its own picker), which fails without it too.

go build, go vet and go test ./internal/gui (the three group tests) pass
under a temp HOME, as do the routing, group and click-scroll browser tests
in Chromium: 176 of 178. The two failures are routing-try-fixed's "a try
sent at an effort its member isn't fixed at flies to the member's row" in
en and zh, which fails 2 of 4 runs on main without this change. gui-ja and
gui-de's completeness checks fail on this base before this change:
43a65950's "{agent} is signed in to {user} now: sign it in to another of
its accounts first…" has {agent} twice in ja and once in the key. Neither
is touched here.

Co-authored-by: wizzy-yang <wizzy-yang@users.noreply.github.com>
2026-10-05 22:49:23 +08:00
yetone 74c67785c8 gui: a group's model picker ticks a member with its reasoning fixed and takes it out on a click, and the routing groups can be filtered by name and model (#907, Moody-Sin; PAMI on Discord)
Picker. In a group's Add a model picker, a model already in the group as a member with fixed reasoning (deepseek/deepseek-v4-pro:max) was not ticked. Clicking it added deepseek/deepseek-v4-pro a second time. The picker matched members by their exact id. A model is now matched by the member it is in the group as, itself or with an effort. That member is ticked, and a click takes it out, together with its fast/off/rules entries, as for any member. A member that a pattern put in still gets the warning. The note naming the other groups a model is in (since v0.1.989) is cut off by its ellipsis when there are several groups, so it now shows in full on hover (title).

Groups filter. With many routing groups one was hard to find. A filter now sits over the list, beside Select and New group, whenever there are two groups or more. It keeps the groups that match every word typed, against the name, the id, a member's id and its provider and model names, and a pattern. The keyboard stays in the box as the list is redrawn. Escape clears it, and when nothing matches the list says so. The group being edited stays listed whatever the filter. Select's "all" picks only the groups shown. A move (Alt+↑/↓ or the menu) goes past the card listed next to it. en/zh/ja/de.

Tested in a sandbox HOME with magpie web (this build, port 3511, no gateway): five groups over DeepSeek, Kimi and GLM. "kimi" kept Main, Long context reasoning heavy and Backup. In Main's picker, deepseek-v4-pro (in Main as :max) and kimi-k3 were ticked, and each note named the other groups, whole in its title.

group-pick-filter.test.cjs is new (WebKit and Chromium, en and zh). It covers the tick and the click out for a:two:max with no duplicate saved, the note's tooltip, the filter by model name, id, every word and name, none matching, Escape, the keyboard kept, no scroll, no select and no left border. It fails without the change. With only the picker matching put back, it fails on "a member with its effort is not ticked".

The group-*, routing-effort*, routing-manual, routing-save*, routing-steady, routing-compact, click-scroll, claude-picker-fold and agent-model-groups tests pass in WebKit (77). go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass. internal/gateway failed once in the full run under load and passed alone.
2026-10-05 21:51:18 +08:00
yetone 55be06ea24 gui: whether "· routing group" follows a group's name is set over the groups on Routing, for all of them, not in one group's editor (PAMI on Discord) — #868 put the agents' lists names setting (Settings' Provider in model names) in each group's editor too, where it read as that group's alone though it is one setting for every group and every provider's models. It now sits over the groups, under Find groups on their own, with its three choices and what it sets; a group's editor says only what its group will be called and that "· routing group" is set above, and follows a pick there with its unsaved name kept. Provider Names & levels keeps its choices. name-suffix-where-named (WebKit, en and zh) fails without the change; group-found-off and group-fold follow the new row. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass (internal/provider crashed once on a concurrent map write in TestCloudflareDecideModelsTested's test server, and passes alone). 2026-10-05 17:22:04 +08:00
yetone 4dab45e3ff gui, provider, gateway: a group's models are dragged into order, a group can be switched off, several models are added at once, and a page shows a scrollbar on the Mac (PAMI on Discord) — in a group's editor a model went up one step a click and only up; its number is now a handle (grip on hover) that drags it, Alt+↑/↓ moves it from the keyboard, and Up and Down stay beside it; a pattern's members follow the named ones. A group of the user's has a switch on its card: off, agents aren't offered it, a request to it is turned away with 404 "the routing group … is switched off", a group that has it in it goes on to its next member, a save from the editor leaves it off, and one that classifies for another can't be switched off (a found group is removed instead, as before). Each member already had its own switch. The editor's Add a model picker stays open: each model clicked is added and ticked, clicked again taken out, and each says the other groups it is in. Pages, dialogs and framed editors had their scrollbar hidden everywhere (width 0); on the Mac they now have a thin 8px thumb, elsewhere the 10px one other lists have. TestSwitchGroup, TestSwitchedOffGroup, group-member-drag, group-switch-add-many and view-scrollbar (WebKit, en and zh) fail without the change. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass (TestProvidersAnswerWhileListsComeIn is flaky on origin/main as well). 2026-10-05 16:46:59 +08:00
zzzpyyy e957230629 fix: keep purpose-filtered routing state consistent (#784) 2026-10-05 14:26:23 +08:00
yetone e5981040dc gateway, gui: a request an aggregator passed on says which provider answered it behind it, "Upstream: DeepInfra" (leslie_luo on Discord: 像 CPA 那样指出实际供应商) — through OpenRouter a request was only "OpenRouter · deepseek/deepseek-chat", with no word of the provider (DeepInfra, StreamLake, Novita…) OpenRouter had sent it on to. OpenRouter names it in its replies, as tried with the owner's real key: Chat's body and every chunk of its stream have a top-level "provider", Messages' body has one and its stream's message_start a message.provider; its Responses replies and every reply's headers name none. The gateway now reads it (upstreamOf) from a body relayed as it came and from each event of one it translated, Chat, Messages or Responses, streamed or not, and keeps it on the request's try and route (upstream) and in the usage ledger (Record.Upstream; the CSV export's last column, searched as the rest). The Routing page's Requests list says Upstream: DeepInfra beside where it went, giving way after the provider's name when short of room, with its story saying the aggregator passed it on; a request's details on the Usage page have Upstream provider. A reply naming none says nothing. zh, ja, de strings. ClinePass and Cline weren't tried (no account); Vercel's gateway documents no such field in its replies, and a vendor whose reply has a top-level "provider" string is read the same way. In a sandbox magpie with the owner's real OpenRouter key: Chat, Messages and Responses (translated to Chat), streamed and not, all six said StreamLake in the trace, the ledger and on the Routing page. TestUpstreamRecorded (6 paths × streamed or not: the route, its try, Recent and the ledger) fails on the old code, TestUpstreamOf; routing-upstream.test.cjs (Chromium and WebKit, en and zh: the tag inside its row, the story, the Usage details, a click moves nothing, no left-border accent) fails on the old assets. ledger-hscroll, request-archive-usage, usage-ledger and usage-ledger-detail pass on WebKit; routing-served fails the same on origin/main (its swap wording). go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass but for TestTranslatedStreamKeepsClientAlive, which passes alone 5 times here and on origin/main. 2026-10-05 14:08:08 +08:00
yetone bbb9729748 gui, provider: where a model or routing group is named, it says what agents' lists will call it and offers dropping the suffix there; a group the user made counts as a name they set (#868)
The reporter's screenshot was Codex's model menu, where a long name plus " · Relay" or " · routing group" is cut off. Magpie can't widen an agent's menu. What it can do is shorten the label. Models can already be renamed (provider editor › Names & levels), groups have a Name, and Settings › Provider in model names (#335) can drop the suffix. The reporter found none of these.

Changes:
- The provider editor's Names & levels and a routing group's editor now each have the three choices: Off, Not on names I set, On.
- Each says what the agents' lists will show, e.g. "My Sol · Relay" or "Fast · routing group".
- The line follows the name as it is typed and the choice as it is picked.
- A pick posts settings/plain-names once and doesn't scroll.
- "Not on names I set" now covers routing groups the user made or changed (Entry.Named = !g.Auto) as well as renamed models, still only where the name is unique in the list. A group magpie found keeps its suffix.
- zh, ja, de strings.

Tests:
- TestPlainOwnNamesGroups fails on the old code.
- name-suffix-where-named.test.cjs (WebKit, en and zh) fails 4/4 on the old assets.
- group-fold.test.cjs: viewport raised to 1500 for the taller editor.
- Pass on WebKit: group-context, plain-names, provider-same-as, provider-levels-save, gui-ja, gui-de, click-scroll, agent-models, agent-model-groups, group-* and routing-*.
- Fail the same on origin/main: group-from-model-add at 600x420, provider-levels-scroll.
- go vet passes. The darwin, GOOS=linux nogui and GOOS=windows builds pass. go test -tags nogui -count=1 ./... passes under a temp HOME.
2026-10-05 14:03:51 +08:00
yetone a84f1052e0 groups: several routing groups are removed at once, and the found ones removed are one folded line rather than listed (lc on Discord: 路由组可否关闭自动发现,并且可编辑批量移除,已经移除的不要显示,或者用移除组来替代,这样干净整洁,并且可以彻删) — groups could only be removed one at a time from each editor, and every found group removed stayed under the list as a chip of its own. Select, by New group, puts a box on each group's card: a click on a card picks it, the bar's box picks all or none, and Remove (a second click to confirm, Remove 2? Click again) posts groups/delete {ids}, which provider.DeleteGroups removes all or none: refused before any goes when one isn't there or a group left holds one as a member or classifier, and a group held only by another being removed goes after it. A found group removed stays removed (magpie doesn't make it again), now one line under the list, 3 found groups removed, whose app menu brings one back; with found groups off it isn't shown. magpie group rm takes several ids. Turning found groups off altogether was there already (Find groups on their own, v0.1.603). zh, ja, de strings. TestDeleteGroups, TestGroupsDeleteSeveral; group-bulk-remove.test.cjs (WebKit, en and zh: picking, the two clicks, the post, the folded line and its menu, no click moves the page), failing on the old code (the chips). group-found-off, group-arrange, group-fold, settings-groups and click-scroll pass on WebKit. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. 2026-10-05 03:37:03 +08:00
yetone 399e5db63d gui, groups: a group's editor sets the context agents are told — its largest model's, its smallest model's, or one typed (Mikan on Discord: 路由组可以支持自定义上下文长短或者支持用户选择按照上下文长度最短的供应商还是上下文长度最長的供应商吗?) — a group told agents its largest member's window (#712), and another could only be set from the CLI. The group editor now has a Context row under Slow to start: Largest model's (as before), Smallest model's, or Custom with a box (200k, 1m, 128000), its hint naming the window agents will be told from the members' own, redrawn as members are added or taken off; a length that isn't one says so and isn't saved. Smallest is kept as smallest (Context -1, ContextSmallest), worked out as the members change, so the agent compacts before any member would turn a conversation away; a conversation too long for one member still goes on to one with room. magpie group set <id> context=smallest|largest|272k does the same. zh, ja, de strings. TestContextSetByUser (smallest, then smallest after a member leaves) fails on the old code; TestApplyGroupPairs covers context=. group-context.test.cjs (WebKit, en and zh): Largest by default with no box, Smallest saves -1 and reopens so, Custom starts at the smallest member's, a bad length shows its error, 300k saves 300000 and reopens, Largest saves 0. group-first-token and group-patterns get a taller window, the editor having grown under the fixed footer; they, group-arrange, fold, member-off, member-fast, rate-limited-sink, routing-compact, manual, levels, steady, time, unlisted-models and settings-groups pass on WebKit. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. 2026-10-05 03:00:34 +08:00
Zhu Wang c1f919ca09 fix(routing): simplify the request purpose filter (#795) 2026-10-04 23:30:01 +08:00
yetone 56d5341636 routing: an open group folds back into its row from its editor's heading (ARNO on Discord: 路由组详情现在可以单击展开,是否可以再加上单击收起) — a group's row opened its editor on a click, and only Cancel closed it. The editor's heading of an existing group is now a button (pointer, "Click to fold it", aria-expanded, Enter or Space from the keyboard) that folds it back while nothing in it has changed; with a change it stays open and says to Save or Cancel first, so a stray click never throws an edit away. Folding saves nothing. zh and ja strings. group-fold.test.cjs (WebKit, en and zh: click, Enter, a change kept with the warning, Cancel, nothing posted) fails on the old code. group-first-token, group-arrange, group-member-off, group-patterns and gui-ja pass on WebKit; group-from-model-add's 600x420 case fails the same on origin/main. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./internal/gui/ under a temp HOME pass. 2026-10-04 21:50:16 +08:00
zzzpyyy 57e80efbf4 feat: filter usage and routing requests by purpose (#771) 2026-10-04 20:46:46 +08:00
yetone 7f6e2c99ed routing: a group's stack of logos stays in its handle, inside its card and clear of its name (ARNO on Discord: the new routing groups' icons spilled past the left edge, over the text) — the handle #779 made of a group's logos had width auto in .rt-group .rt-ghandle, but body.window .ag-handle (28px, from the Agents page) outweighs it, so in the app's window a stack of two or more logos was held to 28px and centred over its edges. The selector now has .ag-handle too. The narrow web layout's 20px first column is auto, for the same reason. group-arrange.test.cjs (WebKit, en and zh) checks a two-logo stack lies inside its handle, the handle in its row and left of the name; it fails on the old CSS. agent-grip, click-scroll and the group-*/routing-* GUI tests pass in WebKit, but for group-from-model-add's two narrow-window cases, which fail on main as well. 2026-10-04 20:31:39 +08:00
yetone 855e7985f2 routing: the groups are put in an order of the user's, as the Agents page's rows are, and /v1/models lists them so (#779)
The Routing page's group list followed the order the groups were made in, found ones after, so a group used every day couldn't be put first, though /v1/models lists the groups in that order and agents' pickers (Claude Desktop's 3P list among them) show it and some clients probe its first model. A group row's logos are now its handle, as an agent row's logo is (#57): dragged (dragRows, the Agents page's sorter) it moves the row, clicked, or the row right-clicked, it opens Move up and Move down (openRowMenu, with the Agents menu's arrows, now MOVE_UP/MOVE_DOWN), and Alt+↑/↓ moves it from the keyboard, which stays on it. The grip in the row's margin is drawn only while the row is under the pointer, dragged, or its handle is focused or its menu open, as on the Agents page. The list is drawn in its new order at once and put back if the save fails; a later move wins over an earlier one still saving.

The order is kept in providers.json as groupOrder (provider.SetGroupOrder, POST /api/groups/arrange), beside the providers' own order (#499), and applied in groupsIn, which every list of the groups is made from: the Routing page, Catalog and so /v1/models, magpie group ls and the TUI's routing page. A found group, which isn't stored until changed, can be put among the user's this way, which reordering the groups array couldn't do. A group not named (one made or found after) goes last; a renamed one keeps its place. Backup and sync carry the order as they do the providers' (MirrorGroupOrder).

TestGroupOrder (Groups and the catalog follow SetGroupOrder, providers.json has it, a new group last, a rename in place, bad orders refused, a synced order first) fails on the old code. group-arrange.test.cjs (WebKit, en and zh): the grip hidden with the pointer away and shown on the hovered row only, in its margin; right-click Move down with Move up off on the first; Alt+↓ and Alt+↑ with focus kept; the handle's click opens the menu, not the editor; a drag by the grip to the top; each posting every group's id with the removed one last; no click moving the page. It fails on the old code. agent-grip, click-scroll, account-arrange, usage-arrange, provider-order and the group-*/routing-* GUI tests pass in WebKit, but for group-from-model-add's 600x420 cases, which fail on main as well. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass.
2026-10-04 19:27:51 +08:00
yetone 5569275465 group: a routing group's members can be patterns, so a group follows a provider's catalog (#766: magpie group add my-free-pool models='openrouter/*:free,opencode-zen/*-free') — a group names its models one by one, so a pool of a vendor's free models went stale as the vendor added and dropped them. A group now keeps patterns apart from the models it names (Group.Match): a glob, * any run of characters (/ too) over the provider/model id in any case, or re:<regexp> over the whole id. groupsIn, which every reader goes through (Groups, FindGroup, /v1/models, MemberGroups, GroupsWith, RenameGroup, rules, Off, Pick, the GUI, TUI and CLI), puts after the named models every enabled provider's model a pattern matches, in catalog order, deduplicated, the named one keeping its place; a pattern never matches a group. What was matched is derived (Group.Matched) and never stored: store() and SaveGroup keep only the named members, so a save never freezes matches. Off and rules may name a matched model. A group with only patterns is allowed; one matching nothing routes nowhere and says so: magpie group <id> lists each pattern with how many models it matches now ("matches nothing now" in amber), the group list and the TUI too, and the GUI card shows a line per pattern with its count. CLI: models= takes patterns among the ids, models+= adds them (naming a matched model moves it to where it is named), models-=<pattern> drops one, models-= of a matched model is refused naming its pattern; the help documents patterns. GUI: the editor has a Patterns box (Add pattern / Remove, validated as the server does), matched models follow those named marked "by pattern" with their off switch and no Remove, and saves send members without the matched ones plus match; zh strings added. Tests: TestGroupPatterns, TestGroupPatternMembersOffAndRules, TestGroupPatternMatchingNothing, TestPatternSyntax (provider), TestPatternGroupRoutes (gateway: a request reaches a matched model, a model a provider adds joins, Off on a matched one, /v1/models lists the group), TestGroupPatternsCLI, and group-patterns.test.cjs (WebKit, en+zh); they fail on the old code (the Go ones don't build, the GUI one finds no pattern lines). GUI: group-patterns, group-found-off, group-member-fast, group-member-off, settings-groups, agent-model-groups, remote-group-served, routing-manual pass on WebKit; group-from-model-add has the same 2 failures (600x420) as origin/main. A request to a group whose patterns match nothing now is a 404 naming the group and its patterns (emptyGroupError), not 'magpie knows no model' and every model; TestEmptyPatternGroupSaysSo. With the owner's real config under a sandbox HOME: group/ds-pool of models='deepseek/*' listed deepseek-flash and deepseek-v4-pro by pattern, stored only the pattern, was in /v1/models and answered from deepseek-flash; none-pool of 'nobody/*' said its pattern matches nothing. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. 2026-10-04 16:52:15 +08:00
yetone 57a87f0ab9 gui: code text on Windows is Cascadia Mono / Consolas with Chinese in YaHei UI, not SimSun (#690) — on a Chinese Windows 11 the Library's MCP tags (远程 · 需登录), the routing page's model chips (gpt-6.1-sol) and other small code text drew thin, unhinted and not round: the tags take --code, whose stack (ui-monospace, SF Mono, Menlo, Consolas, monospace) has no Chinese face, so their Chinese fell to the generic monospace, SimSun on a Chinese Windows; and routing.css's model chips and step lines, the sign-in sheet's link and code, the import textarea, the headers editor and What's new named stacks of their own (ui-monospace, SFMono-Regular, Menlo, monospace, or var(--mono, …) with no --mono anywhere) with no Windows face at all, so all their text was SimSun. Now every monospace text takes var(--code), and on Windows (html.win, as --font already is) --code is "Cascadia Mono", Consolas, "Microsoft YaHei UI", "Microsoft YaHei", monospace; the Mac's and Linux's stack is unchanged (the Mac's ui-monospace is SF Mono either way). win-fonts.test.cjs (no sheet names a monospace stack of its own; the badge, the id, the model chip and the sign-in link take the Mac's stack off Windows and Cascadia Mono / Consolas / YaHei UI with html.win) fails on the old CSS and passes in webkit and chromium; the routing, library, omarchy and signin-link GUI tests pass as before but routing-compact, routing-manual and routing-time, which fail the same on main. Not seen on a real Windows machine; the light grey of the ids (--faint) is unchanged. 2026-10-03 22:23:17 +08:00
yetone b878f17dc1 groups: a member can be switched off (#feedback on Discord: 希望路由组里的模型可以直接通过checkbox控制是否启用,测试路由规则的时候需要频繁的添加和删除路由组里的模型很麻烦,而且会丢失顺序) — each member in the group editor has a switch; one switched off (Group.Off) keeps its place in the order and its rules but is sent nothing until switched on again, a rule naming it falls to the group's order as for a member not ready. The card says (off) after it. A member whose reasoning changes or that is renamed stays off; a manual group sends to its pick whatever is off; switching every member of a routed group off is refused. TestGroupMemberOff, group-member-off.test.cjs (WebKit, en+zh). 2026-10-03 04:57:01 +08:00
yetone d3308f567f gui: the routing story's lines lead with the provider's logo before the account, key or provider they name (the owner: 这里在前面显示对应的 provider 图标会不会更直观一点)
The "why" line and each try's line (failed, answered, waiting), and the asides, put the named seat's icon (its own, its preset's, or the generic one) before the first account, key or provider of the request's order they mention — the longest name at the leftmost place, a whole word only. The opening line and what the vendor said word for word keep their text as is. routing-log-icons.test.cjs (Chromium and WebKit, en and zh: a Zhipu account failing, an OpenAI key answering) fails without the change. go vet ./internal/gui/, go build (darwin GUI), go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build pass; the routing tests that read the story pass in WebKit (routing-served flaked once under load and passes on rerun, as on main).
2026-10-02 11:27:03 +08:00
Arvak f3ba918491 gui: make magpie web usable on phone screens (#391)
* gui: make magpie web usable on phone screens

* gui: keep phone content readable and retain idle scroll protection

* gui: tolerate small desktop screenshot rendering differences

* tests: synchronize Zhipu team quota request records

* gui: keep every agent field visible on phones

* gui: exercise touch scrolling in the settings usage part

* gui: serve plugin parts in the phone test fixture
2026-10-02 10:15:42 +08:00