f2eb56c6bbde1300dddc402861b59cd4e45e0215
33
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
0621e70fb9 |
routing: leave a provider out of the groups magpie finds
chenxiang0010 on Discord asked to keep a provider or a model out of the auto-created routing groups. A model could already be kept out (remove its found group; magpie keeps it removed), but a provider could only be turned off per group or everywhere. Now Routing -> Groups, under "Find groups on their own", has "Leave out a provider..." (app menu, saved when it closes) and `magpie group auto skip <provider>...|none`. The providers chosen (providers.json autoGroupSkip) join no found group; a group the user made or changed keeps them, a found group left with one provider goes away, and a request for it is served by AutoStandIn from a provider still in, and agents on it are reseated (agent.Reseat). A rename carries the id along. en, zh, zh-TW, ja, de. Run at 383947fce (this change on origin/main |
||
|
|
869c4d112d |
routing: the magpies fly under the cards, and a long intent is cut short on its row (penershu on X)
penershu on X (v0.1.2123): with two agents sending at once through jd-auto-balanced, one magpie sat on the hub's "127.0.0.1:3425" with its dot beside it, another on the group's split dot, and the row smart routing picked ran "回答中… · 按意图“Design architecture…”" off the right edge. Cause: - .rt-sky (birds and dots) was z-index 2, over the cards (z 1). Flights cross the hub's box (via(), |
||
|
|
8701eb35ea |
routing: with several routes on the stage, each route's rows hang under its own heading (hoobnn on Discord)
hoobnn: "路由这里,会莫名出现两个没有使用的路由,并且鼠标悬浮,显示错误的 供应商". The screenshot's header read "DeepSeek-V4.1-Flash · 路由组 · 启用 3 个 · 3 个 Agent 同时在发" over five rows: the group's three (Volcengine Ark, a DF Model account, Qwen China) and, between and below them, Pi's zcode account and OpenCode's Kimi Code (China) key. Cause: the stage shows up to four agents at once ( |
||
|
|
e1721d6404 |
routing: a weighted group's editor sorts its members by weight once (Norcleeh)
Norcleeh (Discord #general) asked for a way to order a By weight group's members by weight. The order matters there: it is the fallback's when a model fails. Now the group editor has a "Sort by weight" text button beside Add another model. It shows while the group routes By weight and the order would change. A press puts the named members heaviest first (no weight counts as 1, equal weights keep their order, one switched off is sorted too; a pattern's members stay after them) and draw()s. The button then goes. It is a one-off reorder of the draft, saved with the group's Save; no mode is stored. Its title says the order is the fallback's. Strings in zh, zh-TW, ja and de. The routing plugin's client.js isn't a core script; no budget changed. Run (mote-run, at this head on |
||
|
|
9e33962c05 |
gui: Settings has Reduce motion, stilling magpie as the system's does (#3813)
CupOfBread asked for a switch that turns magpie's motion off to save
resources on the desktop, and linull24 saw the Routing page keep a
phone's browser busy. magpie already stills its animations under the
system's Reduce Motion: 46 @media (prefers-reduced-motion: reduce)
rules across app.css and the plugins' styles, and calm() in the
scripts. Settings -> General now has "Reduce motion" (Off / On) that
does the same without the system setting.
- settings.json keeps reduceMotion; boot.js passes it; a POST that
leaves it out keeps it, as the other prefs.
- theme.js's holdStill(on) sets data-motion="reduce" on <html> and sets
the media of every stylesheet rule written for reduced motion to
"all" (and back when turned off), so the same rules apply and no CSS
is written twice. layout.js calls it before the first paint when the
saved setting is on; applyPrefs calls it on a change.
- calm() is true when data-motion is reduce too, so the scripts'
motion (Routing's stage, Library, Usage) holds still with it.
- routing.css: the reduced-motion rule for the live dot was
.rt-livedot, which lost to .rt-livedot.on's animation; it is now
.rt-livedot.on, so the dot stands still with either setting.
Measured on mote (Chromium 390x844, 4x CPU throttle, live Routing
traffic, CDP Performance over 10s, two runs each): main-thread task time
0.18 and 0.22 s/s with it off, 0.090 and 0.085 s/s on; style recalc
0.021/0.025 off, 0.008/0.011 on.
Tests: reduce-motion.test.cjs (new, both engines): saved on, the
reduced-motion rules apply from the start (a probe's live dot has no
animation, calm() is true); Off restores them and posts false; On again
posts true. TestSettingsReduceMotion: off by default, kept by a POST
that leaves it out, cleared by false, in settings.json and boot.js.
The Settings row is in settings-general's list of rows.
Run on mote at this head (rebased on
|
||
|
|
7dcc0aedc6 |
routing: a group's rules line up without a subgrid, as the requests do since #3731 (#3955)
Each .rt-rule was a subgrid of the rules list with a fit-content(50%) conditions column, the shape gpboyer2's Safari 16 crash stack showed for the request rows (#3731). Now the list is a flex column and each rule is a grid of its own on 16px fit-content(50%) minmax(0, 1fr) auto. Its conditions are at least --rt-condw wide: fitConds takes the property off, reads each rule's conditions width under its own fit-content(50%), and sets the widest, rounded up to 1/64px, on the list. It runs when the rules are drawn, and a frame after the list or a rule's conditions change size (ResizeObserver, disconnected on each redraw so rules drawn before are not held) or a condition is typed into. Under 640px the property is unused (min-width 0), as the layout there was its own before. New test routing-rule-columns: no rule of the rules' CSS says subgrid; in both engines and five languages, every rule's → and its conditions start at one x at 1100, 900 and 700px; at 390px what a rule does is under its conditions and nothing passes the editor's side; an intent typed longer moves every rule's → right, and shorter again back left, still at one x. Run on mote (Playwright 1.62.0, Chromium and WebKit). At the rebased head on origin/main |
||
|
|
a1f0a6109a |
routing: the requests list lines up its rows without a subgrid, so Safari 16 stops crashing on it (#3731)
gpboyer2 found the cause: each .rt-req was a subgrid of .rt-reqs with fit-content() tracks, and Safari 16's grid track sizing recursed on it until the WebContent process died and the page reloaded, again and again under steady traffic. Now .rt-reqs is a flex column and each row is its own grid on var(--rt-cols, var(--rt-tpl)). A hidden .rt-sizer grid at the list's foot holds one probe per row shape (display: contents cells placed by column), and fitCols reads its computed columns into --rt-cols: the fixed ones rounded up to the layout's 1/64px, the flexible one minmax(0, 1fr). A ResizeObserver on the probes' cells, deferred a frame so WebKit logs no "ResizeObserver loop", refits when a cell's width changes. New columns drop the rows' measured heights (listKey carries --rt-cols) but keep the average, and metaFit measures with the columns of the layout it tests. Found on the way and fixed here since the new key needs it: drawList sized the gaps with the average from before it was recomputed. The other subgrids of the same kind (.rt-rule, .sess-bar, .sess-skill, .quota-windows .quota) are #3955. Tests: routing-own-columns.test.cjs (new) fails on the old code (a subgrid in routing.css) and checks, in Chromium and WebKit, en and zh, at 1440, 1100, 940 and 700, that every route has a row and the rows' columns line up. routing-day-window, routing-scroll-end and routing-live-calm read the rows' own columns and skip the sizer. Run at this stack's head 103631319 on main |
||
|
|
ca9b5048e3 |
routing: a request tried on many keys keeps its steps in a box of 200px, so the list below stays where it was (#3764)
A trace tried on 40 keys says a line or two a key, so .rt-steps grew to ~2500px and pushed the request list a screen down; clicking between it and a one-key request moved the list by that much each time (hheei's analysis in #3764). The list now holds at most 200px (eight or so steps) and scrolls in itself; short stories start at its top as before. jayswu's patch (their branch gui/cap-routing-steps-height, ported here since the repo takes no outside PRs). One change to it: a different request's story starts scrolled to the top, and that reset now runs before renderSteps' "nothing changed" return. In the patch it ran after, so two requests whose stories read alike (the same keys refused the same way) kept the first one's scroll. Run at base |
||
|
|
77f860105c |
routing: a flowing wire is drawn in a layer of its own, so WebView2 doesn't redraw every wire each frame (#3164)
On Windows the Routing page with an 800-key group open ran at 31 fps. A flowing wire (stroke-dashoffset animated) sat in the one svg of every wire, 993x36215 px with 803 paths, and Chromium re-rasterized that whole svg on the GPU each frame: CrGpuMain was busy 5s in 5s, 3.6s of it in RasterDecoderImpl::DoRasterCHROMIUM. Hiding the wires svg gave 118 fps, taking the dash animation off the wires 102 fps; WebKit (macOS) was never slow here. Now flowNear draws each flowing wire by a copy in .rt-flows, an svg over the wires with will-change: transform, with the wire's d, --agent and the dashes it worked out, and hides the wire itself (.flown: hidden, no animation). The look is the same; the svg of every wire no longer changes while a request flows. Reduced motion stops the copies too. Real WebView2 (Edg/155, Windows 11, Radeon 8060S), the magpie window at 1281x1128 CSS px, dpr 1.1, a sandbox HOME with two providers of 499 and 299 keys in one group, both folds open, a request every 0.3s through a fake upstream; v0.1.1587's release exe against this commit built with GOOS=windows: steady 15s x3 31 fps, 89-94 frames >40ms -> 114 fps, 4-9 >40ms scroll 12s 58 fps -> 88 fps fold+unfold 4s 41 fps -> 103 fps The same injected by hand into the old page first: 38 -> 48 fps with the copies in a plain svg, 94 fps with will-change, so the layer is what does it. Test: routing-answered-still checks that each flowing wire has a copy with its d, animated, in a will-change layer, the wire itself hidden and still, and that nothing is left once the request is done. Without this change .rt-flows doesn't exist and it times out. Run at this commit (rebased on origin/main |
||
|
|
098ac9696d |
routing: with 200 keys or more only those near sight are in the list (#3164)
With both groups open (800 keys) every update laid out, read and moved every key, longer than a frame in WebKit. From 200 keys on, a run of keys far from sight is now one gap li as tall as they are (place), and a key in it is given the box it would have there, so its wire is drawn as before. Scrolled half a screen on, or when layout finds the view moved, the list is made again around where it is, keeping what is in sight where it was. put() moves only the nodes out of order, so a fold held where it was clicked doesn't move with a re-place. A gap is a new li each time, never one used again for other keys, so app.js's click hold can't keep a gap that now stands for other rows (app.js unchanged). The stage's ResizeObserver lays out in the next frame: layout() reads the rows, and rows coming into sight change #rt's height by a fraction of a pixel, which WebKit reported as a ResizeObserver loop. Run at |
||
|
|
9fc382e66d |
routing: a key off screen is not laid out or painted, so hundreds of open keys keep WebKit's frames (#3164)
With a group's 500 and 300 keys both open, WebKit drew ~40 frames a second on the Routing page: hiding the keys below row 60 alone gave back ~100 frames in 10s, so it painted every row again on each frame a magpie flew. Chromium was at 60 already. A key row now has content-visibility: auto, so one out of sight is skipped. Its height while skipped is contain-intrinsic-size: auto var(--rt-row): the last height it was drawn at, or, never drawn, the content height of a key drawn now, which layout() reads with the boxes it reads already and sets a frame later (set in the stage's own ResizeObserver, WebKit reported a loop). Rows keep their heights, so the wires to them and the list's scroll height are as before. A row a 429 hit (.hit) is drawn whole: its tag stands over its top edge, which the paint containment would cut. A WebKit without content-visibility or checkVisibility draws every row as before. Run at this head (rebased on origin/main |
||
|
|
c888ef2725 |
routing: a rule's hours are kept in the zone they were set in (gaubeebangeel on X)
magpie on a cloud server in UTC read a routing group's rule hours on the
server's clock, so a Beijing user's 09:00-18:00 held at 17:00-02:00
Beijing time, with nothing saying so.
- provider.TimeWindow carries the IANA zone its hours were set in
("zone": "Asia/Shanghai", omitempty). Holds reads From, To and Days in
that zone (time.LoadLocation, cached; Go's embedded tzdata, so Windows
knows them too). A window with no zone, every one saved before this,
stays on magpie's own clock (time.Local) as before. A zone magpie
doesn't know is refused on save (clean); one in a file edited by hand
makes the window never hold, so the rule is as if absent, never always
on and never hours off. Text() adds " (Zone)"; Line() writes tz=.
- GUI: changing a rule's hours or days in the editor saves the browser's
zone (Intl resolvedOptions().timeZone); hours left alone keep theirs.
/api/groups gives magpie's clock (clock: zone, offset in seconds), and
when its offset differs from the hours' zone the Routing page tells the
zone beside them, on the group's rules and in the editor: "Asia/Shanghai
time" (zh "Asia/Shanghai 时间"), or "server time, UTC+0" (zh "服务器时间
UTC+0") for hours with no zone. Nothing is added when the clocks agree.
zh, zh-TW, ja, de.
- CLI and TUI: time=09:00-18:00@Asia/Shanghai or tz=Asia/Shanghai; with
none, this computer's zone ($TZ, time.Local, the /etc/localtime link)
when it has an IANA name, otherwise none (magpie's clock). An unknown
zone is refused with what one looks like; tz= alone needs time= or
days=. Usage text updated.
- docs/subsystems/gateway-routing.md: the zone rules.
Older magpie reading a shared or synced group ignores zone and reads the
hours on its own clock, as before.
Run in a sandbox HOME with pinned Go caches, first at base
|
||
|
|
b5a78fd8b5 |
routing: a group's rules are dragged into order
monkeyin_92 on X: "希望可以上下拖动规则". Rules are checked top first, so
their order matters, and it could only be changed a place at a time from
each rule's ⋯ menu (Move up / Move down).
A rule's number is now its handle, as a model's number is in the same
editor (memberHandle): drag it up or down (the shared dragRows, which
the members, groups and agents use), or focus it and press Alt+↑/↓. The
rules are renumbered at once and the keyboard stays on the moved rule's
handle. The grip beside the number shows only on hover, while dragging,
or from the keyboard; the dragged rule is lifted with a card background
and shadow, no coloured border. Move up and Move down stay under ⋯ and
now go through the same moveRule. Saved as the group's rules in their
new order. "Move rule {n}" in zh, zh-TW, ja and de; the title reuses
"Drag to reorder · Alt+↑/↓ to move".
Run at this head:
- routing-rule-drag.test.cjs (new), chromium and webkit, en, zh, zh-TW,
ja, de: 10 of 10. It checks the handles and their names, the grip hidden
away from the row and shown on hover, a drag of rule 3 above rule 1
with nothing opened by the drag's click, Alt+↓/↑ (past the end too)
with focus kept, ⋯ Move down, the page not moved, and the saved rules'
order with their conditions. Red on the parent (no .rt-rhandle): 10 of
10 in the parent's full run.
- GUI: every routing-*.test.cjs plus i18n-keys, click-scroll and
group-member-drag, both engines: 1321 pass, 55 red, all in files red the
same on origin/main
|
||
|
|
f99d27abc2 |
routing: a rule names several models, tried in order
monkeyin_92 on X: "can a rule take several models? Otherwise one rule
with several models is several rules." A rule now takes more than one
model (Rule.More after Rule.Use; `more` in the group's JSON, use=a,b
typed). They go first in that order: when the first fails or rests the
rule's next takes the request, ahead of the models the later matching
rules name and the group's others.
Every reader of Rule.Use goes through Uses/SetUses/MapUses/Without/Names
in grouprule.go:
- cleanRules: each must be the group's, each named once; a pause names one.
- gateway: ruleFor's turn hold, tool rounds and outgrown turns, compaction
(the rule's first that takes the summary, the others in Small),
ruleMembers/ruleOver/applyRule, nestedRules and ruleLed (the one a
nested group's turn stays on), modelRuled, ruleEffort (useEffort asked
of each), ThenUses (leaves out all of the rule's own). RuleHit.More is
in the trace; Instead from More has Unready false, one from a later
rule Unready true, as before.
- ruledEntry: what the group takes is what every one of them takes.
- provider rename, auto/ refs, groupfast, a member's removal (a rule
goes with its last), ShareGroup and its import (one this magpie hasn't
is left out of the rule).
- CLI `group rule add use=a,b` and its listing; `group models-=` keeps a
rule's other models. The TUI shows them joined and keeps the rule when
one is deleted.
- GUI (plugins/routing): a chip per model, a + for the next one, an ×
on each while there is more than one, a chip picks another in its place
(app menu, no native select); the card's tooltip and the trace's why
("…so c/mini, which the rule names after it, goes first"), nested too;
en, zh, zh-TW, ja, de.
Old data: a rule of one model writes no `more`, so groups saved before
read and save unchanged (TestRuleMoreOnDisk). An older magpie reads `use`
alone: its requests go to the first model, the others are plain group
members in group order; if it saves the group, `more` is dropped.
Tests: TestRuleSeveralModelsInOrder, TestRuleEffortReachesTheRulesNextModel,
TestRuleCompactPassesOverTheRulesSmallModel (gateway); TestCleanRulesSeveralModels,
TestRuleMoreOnDisk, TestRuleWithout, TestParseRuleSeveralModels,
TestThenUsesLeavesOutTheRulesOwn, TestRuledEntrySeveralModels,
TestSharedGroupRuleSeveralModels, TestRuleMoreRenamedAndKept (provider);
TestGroupRuleSeveralModelsCmd (cli); TestGroupTakeOutKeepsARulesOtherModels
(tui); routing-rule-models.test.cjs. Broken by hand: ruleMembers on Use
alone turns the first two gateway tests red.
Run at this head:
- gofmt -l clean; go vet -tags nogui clean with GOOS=linux and GOOS=windows
for provider, gateway, cli, tui.
- go test -tags nogui -timeout 45m: internal/provider, internal/cli,
internal/tui ok; internal/gateway ok (384s); the new gateway tests
again after; internal/gui budgets ok.
- GUI: every routing-*.test.cjs plus i18n-keys, click-scroll and
group-member-drag, chromium and webkit (en, zh, zh-TW, ja, de where the
file has them): 1319 pass, 57 red. routing-rule-models passes in both.
The reds are in files that are red the same on origin/main
|
||
|
|
2a8a177466 |
gui: the tray panel fits its tallest tab whole, and Routing's first open holds its height
CyberCaius (Discord, Windows): the tray panel jitters or shows a
scrollbar, and today's call count is slow on the first open.
- fit() measured the sections alone, so the view's padding, the gap
under the tabs and what sits around a section were left out: 10px
short on Routing, 31px with 8 agents. It now lays out every section
at once (no data-ptab for the measure), sums each tab's sections by
their margin box, skips what is display:none, and adds what lies
outside the view. It never shows one tab after another: hiding the
open tab ends its running transitions (panel-fold's unroll,
tray-cell-click's refresh).
- Routing's placeholder was three short bars, and the panel grew when
the trace landed. It is now a hidden copy of the stage and six
request rows, so it is as tall as what comes.
- Today's line (usage?period=today) is asked for when the page is
built, not after the first trace.
Test: internal/gui/tests/panel-fit-tabs.test.cjs, chromium and webkit
x en, zh, zh-TW, ja, de. 8 and 2 agents: no tab overflows the fitted
panel. Trace held: today's 42 shows before it, the fit is the same
after it, Routing doesn't overflow. Scrolled by wheel in a 220px
panel: fit(40); fit() leaves scrollTop where it was, with no scroll
events.
Run at tree 53ae48f72 (on origin/main
|
||
|
|
b995095637 |
gui: a routing group's strategy is switched from its row (MoChou, #3450)
MoChou (#3450): changing a routing group's strategy took opening the editor, finding the routing control, picking and saving. The routing tag on each group row is now a pop-up button: it opens the app's own menu (openProtoMenu, no native select) with the routings the editor offers (GROUP_ROUTE_OPTS plus JS plugin routings), the current one checked. Picking one saves the group through /api/groups/save with every other field as it was, as the editor's Save would. Manual keeps the pick the group had; with none the gateway takes the first member (provider.cleanGroup), as with the editor. "Rate limited to the back" is dropped when the new routing can't sink, as the editor does. Re-picking the checked routing saves nothing; an editor with unsaved changes asks first (confirmDiscard). The row's Edit button and switch are unchanged; clicking the tag doesn't open the editor and doesn't scroll. Keyboard: Enter/Space opens, arrows move, Escape closes back to the tag, and focus returns to the same group's tag after the save redraws the list. At <=560px in the window the row keeps only its routing tag (the other tags stay hidden as before). New string "How {name} routes: click to change it" in zh, zh-TW, ja, de. Run (worktree; the new test, i18n-keys and internal/gui budget/i18n tests again at this head after rebasing on |
||
|
|
91b0be8363 |
routing: a group's row opens into its editor and folds back in motion, and Save shows it
The owner asked (10-23) for iOS-like motion when a routing group opens and
folds, and for a save animation. drawGroups now measures each slot (a
group's row or its editor, data-gslot) before replaceKeeping and, where a
slot changed between row and editor, animates its height from the old one
to the new: opening on SPRING (570ms) with the editor's parts coming in
staggered from 6px above, folding on IOS_EASE (420ms) with the row's
content fading in. A new group's editor grows from nothing. Save shows a
spinner while the gateway saves; the saved row folds from the editor's
height and lights up, with a check that pops in by its name and goes
after ~1.5s. With reduced motion asked for nothing moves.
Folding from the editor's foot (where Save and Cancel are) would let the
browser clamp the shorter page and leave the row above the window
(WebKit showed it). foldInSight moves the page up with the fold, step
for step with the slot's height, as the reader's scroll; groupAction's
own keep-the-saved-row-in-sight check is skipped when the fold did it.
Run at this head (rebased on origin/main), Chromium and WebKit:
- group-morph.test.cjs (new): en, zh, zh-TW, ja, de at 1100 and 420px;
the editor grows from the row's height, the row folds from the
editor's, Save spins, the saved row folds from the editor's height
with its check, the row is in sight after each fold; reduced motion
has no height animation.
- routing-save, group-fold, routing-group-fold, routing-save-blank,
routing-save-keeps-the-row, group-editor-align, group-editor-fits,
i18n-keys.
- go test ./internal/gui -run 'Budget|Plugin|Asset': ok.
Broken by hand: without morphSlots the new test is red ("the editor grows from the row's 57px, not null", Chromium); without foldInSight it is red in WebKit ("the folded row is in sight").
Not tried: the real Linux (WebKitGTK) app.
|
||
|
|
d3f3df746e |
routing: the page's head has Routing groups, which brings the groups at the page's foot into view (shihh on Discord)
The routing groups sit below the stage, the story and every request; with many models (shihh on Discord) they are a long scroll down. The Routing page's head now has Routing groups (#rtGoGroups) beside New group: a down arrow, its name, and a tooltip saying where they are. Its click goes through scrollOnPurpose, brings .rt-gsec to the top of the view and moves the focus into it. The page's layout is unchanged (no #1354-style move): the groups stay last in #rtMore. fitGo gives the button only the head's spare room (the .grow spacer): named, its arrow alone (still named to a screen reader), or left out, so nothing else in the head moves or wraps. Strings in zh, zh-TW, ja and de. app.js untouched (plugin files only). Test: routing-groups-jump.test.cjs, Chromium and WebKit x en/zh/zh-TW/ja/de x 1000px web, 480px web, 640px window: 30/30. It is red on main's assets (no button), red with the scrollOnPurpose check removed (the app's guard pulls the view back), red without the focus move, and red with fitGo removed (de at 480px web: Hide accounts moves). Run at this change on |
||
|
|
3a213e1dc1 |
routing: a waiting row's dot keeps its whole glow (#2553, dumplings)
The Routing request row's target cell (.rt-req .to) clips with
overflow:hidden, and the waiting dot's 6px glow sat flush against its
left edge, so the glow was cut on the left (and a pixel above and
below). The cell now has 6px of padding on its left and 1px above and
below, given back with a negative margin, so the glow fits inside the
clip and nothing in the row moves.
Run at
|
||
|
|
b3f5953495 |
routing: an open group's heading looks as every editor's does, not as the Models fold chip
The owner, 10-21: on an opened routing group the heading's space above
differed from below, and its line curved at the ends. The heading had
the class .fold to fold back into its row, and .fold is the Models
head's chip: padding 3px 6px 3px 4px, a 6px radius, the faint colour and
a pill background on hover. On the heading that gave 3px above against
8px below, rounded ends on its bottom line, a dimmed name and a box over
it on hover. It now has its own class (folds), which keeps the pointer
and adds a focus ring; the layout is .editor .ehead's, as on every
other editor.
Run on origin/main
|
||
|
|
f21dd99f5a |
privacy: every masking is recorded, and Settings › Privacy shows it
What was masked is now kept, so the user can see it. Settings › Privacy opens on a summary card: how many values were kept from vendors over 1, 7 or 30 days, by kind, by finder (rules, your words, the local model, known values) and by where they went, with a day strip. The page is grouped into What to mask, How it's found (rules and the local model are layers, not a toggle: the model adds names and addresses rules can't see) and Sharing. A records view lists each masked request: its kinds, finders, placeholders and, while magpie runs, the line around each value. Gateway › Recent calls and the Routing log carry a masked-N badge that opens the record. Originals never go to disk. internal/maskrec writes day files under ~/.config/magpie/masking (0600, 30 days, 100MB at most) holding kinds, finders, placeholders, a first character or key prefix and a length. The lines around values are kept in memory for the last 400 records only, and /api/masking/value answers only while the masker remembers a placeholder. Nothing is written under MAGPIE_TEST_SANDBOX. A masker says what it masked through gwmw.Teller (JSONHits, TextHits, Value); a plugin masker that doesn't is counted only, so older redact plugins keep working. Every route that masks notes it: chat, Responses, Codex backend and search, embeddings, images, video, transcription, decide and the search MCP query. Masking still fails closed: a masker that panics on any path refuses the request (TestMaskingOnAndOff's fake now panics on JSONHits and TextHits too, since the gateway asks a Teller through those). app.js grows to 1,314,432 bytes, so its budget rises to 1,335,000 and the core's to 1,528,800 (+1.5%): Settings is the core's own page. Run at this head (rebased on origin/main |
||
|
|
a8224019af |
routing: a day of thousands of requests draws only the rows in sight, and its numbers are measured again on a new width only (#2524)
UNscientific-9 (#2524): picking a day on Routing's request list froze the page for seconds with thousands of rows. renderLog built a row for every request of the day (~20 elements each, up to 2,000 a day) and put the new ones in among the old row by row, so both days' rows were in at once. Beside that, metaFit was run by a ResizeObserver on the column's every change of size; the meta-under mark it sets changes the column's height, which measured every row's numbers again (the reporter saw 8 runs in 8s, ~200ms each). Now: - A list of 300 or more items is windowed: only the rows in and near sight are drawn, between two aria-hidden gaps as tall as the rows above and below. A drawn row's height is measured and kept; one never drawn counts as the average. Scrolling or a resize draws the rows then in sight, once a frame, and the first row in sight stays where it was. - The columns stay as wide as before: for each shape of row not drawn (its time's digits, model and kind, its numbers), one unseen, inert zero-height probe row stays in the grid, so the auto columns size by it. The digits are tabular, so a probe stands for its shape. - A list made mostly anew (another day) is put in with one replaceChildren, not row by row among the old ones. - metaFit runs on a change of the column's width only. When it moves the numbers under or back, the list is drawn again for the new heights. - A row's clock uses one cached Intl.DateTimeFormat. Under 300 items the list is drawn whole, as before. Not done here, from the reporter's list: drawAll still runs renderHist on a static day at each poll. Measured with a live request arriving every 250ms while a 2,000-row day was shown (scratchpad dayidle.cjs, chromium, 4s): frame callbacks 330 / 211 ms total / 9 ms longest before, 90 / 52 ms / 4 ms after. A guard there would have to know every input of renderHist (now(), lifted rests, names), so it was left out. Trimming prompt.parts from the payload is on the server, not here. The renderer crash on repeated switches was not reproduced. Measured (scratchpad dswitch.cjs, 2,000 rows a day, 1280x900, five day switches each, wall ms / longest block ms, load average ~220-290): - chromium before: 379/304 454/374 452/374 474/389 427/376, rows=2000, ~39,740 elements - chromium after: 56/22 61/20 56/19 74/21 410/17, rows 17-21, ~1,520- 1,600 elements (the 410 is wall time under load; its longest block 17) - webkit before: 565/461 624/493 639/526 625/516 616/516, rows=2000 - webkit after: 117/37 95/25 93/30 128/26 138/25, rows 17-21 - same grid columns and list height after as before, in both engines: chromium "89.4375px 94.1875px 661.078px 181.297px", scrollHeight 61602; webkit "89.4375px 94.1875px 641.078125px 181.296875px", 61602 Run: - tests/routing-day-window.test.cjs (new), chromium and webkit, en zh zh-TW ja de, 1280px and 420px: 30 tests, 30 pass. It picks a 2,000-row day, checks the rows drawn are bounded and the list is as tall as all of them, scrolls to a wide model far down (columns unchanged, not cut), holds a row still across frames mid-list, reaches the last row and picks it, switches day, and goes By session to the list's foot. The second test grows the column taller three times and counts reads of the numbers' boxes: 0, and >0 on a new width. - Same test on the old assets (MAGPIE_ROUTING_ASSETS, the routing client.js/css before this change), chromium en: 3 fail, "a day of 2000 put 2000 rows in the list" (both widths) and the measure test (12000 reads, not 0). - Broken by hand: WIN_MIN 300 -> 300000 fails "a day of 2000 put 2000 rows in the list"; the width guard taken out fails "156 !== 0" in both engines. Both restored. - tests/routing-sessions.test.cjs: its 2,001-request history test now scrolls to a session's group instead of expecting all 2,001 rows in the DOM. 8 pass, 0 fail (chromium and webkit, en and zh). - routing-*.test.cjs, panel-routing*.test.cjs and every other GUI file that reads the request list (claude-auth-status, claude-subagent-tag, dates-gui-lang, click-scroll, codex-subagent-model, codex-credits, desktop-subagent-model, key-nourl, phone-rows, reasoning-speed, remote-group-served, purpose-filter, search-instead, rest-try-now, search-mcp, vision-mcp), both engines, every language, concurrency 4: 1412 tests, 1390 pass, 22 fail. 18 of those are routing-bodies, routing-keys-fold, routing-model-rest, routing-request-metrics and routing-wb-restricted, which fail the same way on the old assets (#2658, #2559). The other 4 (rest-try-now chromium en 1100 and ja 420, routing-log-icons webkit zh, routing-time-went chromium de) pass when their files run alone: 64 tests, 64 pass. Not tried: WebKitGTK and the Windows WebView2 app (where the reporter's seconds-long freeze was on Windows); the numbers above are Playwright's Chromium and WebKit on macOS. |
||
|
|
ac3a2a3df5 |
routing: the page asks for frames only while its stage moves, and the live dot pulses only while a request is under way (#2827)
zhang-4411 (#2827): under xrdp/X11 with no GPU the Routing page's web process took 459%-830% CPU. Beside compositing (27353a952), the page itself drew on every frame while nothing moved: its frame loop asked for the next frame forever once Routing was shown, and the live dot's rtlive pulse ran with no request under way. On llvmpipe each of those frames is rasterised on the CPU. Now the loop stops once nothing on the stage moves and is kicked again by what makes something move (a request arriving, a replay, the page shown again). The dot pulses (.rt-livedot.on) only while a request is live. With no request, the page asks for no frames. Measured in the GUI harness (scratchpad measure.cjs, 4s windows, Playwright on macOS, load average ~200): - chromium, Routing idle: before 70 ms CPU/s, 60.3 rAF/s, 1 running animation (rtlive); after 4 ms CPU/s, 0 rAF/s, 0 animations - webkit, Routing idle: before 62 rAF/s, 1 animation; after 0 rAF/s, 0 animations (WebKit's per-process CPU reading was negative under this load, so only frames are given) - Routing busy (requests moving) is unchanged: chromium 176 -> 186 ms CPU/s, ~64 rAF/s both Run: - tests/routing-idle-frame.test.cjs (webkit, en and zh, as the file runs): 9 pass 0 fail. It now also counts the frames asked for with nothing moving and checks the dot's animation; MAGPIE_ROUTING_ASSETS points it at an older asset tree. - Same test on the old assets (9fd80b212's, MAGPIE_ROUTING_ASSETS): FAIL "the Routing loop kept asking for frames with nothing on its stage moving (26 frames in 400ms)". - Broken by hand (animation back on .rt-livedot): FAIL "the live dot pulsed with no request under way". Restored. - Routing GUI files, chromium and webkit, every language: 1104 tests, 1086 pass, 18 fail. Every one of those 18 fails the same way on the old assets in the same run (base 22 fail, new 20 fail on the reruns): routing-bodies "opens to its request and response", and under load routing-model-rest, routing-keys-fold, routing-request-metrics and routing-wb-restricted. All are in #2658 (and #2559). The one red only on the new side, routing-wb-restricted zh-TW 420px, passes rerun alone in both engines. Not tried: WebKitGTK, xrdp or llvmpipe. Playwright's WebKit is not WebKitGTK, so the CPU the reporter sees is not measured here. |
||
|
|
b0b0764210 |
gui: a routing rule's ⋯ is always shown, and a rule Save refuses for having no condition says so under it, with how to add one or remove it (ppBruce on Discord)
ppBruce (v0.1.1290): in a routing group's editor "once a rule is added there is no delete button, and a rule with empty conditions can't be saved". Two causes: - The rule's ⋯, the only way to Remove rule (and move a rule), was opacity 0 unless the row was hovered or focused ( |
||
|
|
78827954fb |
routing: with routing groups off, the Routing page says so and turns them on (bigbenniu on X)
bigbenniu on X: on a new install the Routing page had nothing past its
requests, no New group and no word of where it had gone. A new install's
Essentials preset leaves the "groups" built-in off, and everything marked
data-feature="groups" was hidden without a trace.
Now an element can be marked data-feature-off="<id>", the other way
round: featureStyle shows it only while that feature is off. Where the
routing groups were, the Routing page shows such a note: routing groups
are off in Plugins › Built-in, the groups magpie finds still route, your
own can't be made or changed here; and a "Turn on routing groups" button
that posts plugins/builtin {id:"groups",on:true}, applies the answer and
reloads the groups. It sits after the groups' own rows, so their order
(group-found-off's check) is as it was. Strings in zh, zh-TW, ja and de.
Run:
- internal/gui/tests/routing-groups-off.test.cjs (new), Chromium and
WebKit, en and zh, 900 and 420px: groups off shows the note and its
button, New group and the groups hidden, the note fits the window;
the click posts {id:"groups",on:true}, the note goes, the groups and
New group come back, the status says so; groups on shows no note;
every new string in zh, zh-TW, ja and de. 18/18 with group-found-off.
Red by hand two ways: without the note's data-feature-off (6 of 7
red in Chromium), and without featureStyle's data-feature-off rule
(6 of 7 red). Screenshots looked at, zh 900 and 420.
- 119 GUI files (routing*, group*, panel-routing*, builtins, *-off*):
all pass but routing-bodies (10) and routing-keys-fold (5), which
fail the same 15 on a fresh origin/main
|
||
|
|
fa5295d011 |
panel: a Manual routing group's model is switched from the tray panel (#2489)
Jerell.OvO asked on Discord (#general) to change a Manual group's model
from the tray's dropdown. Until now that worked only on the group's card
on the Routing page or with `magpie group pick <id> <model>`.
- provider.PickGroup(id, pick) sets a Manual group's Pick and nothing
else. It refuses a group that doesn't route by hand, a model not in
the group, and an unknown or hidden group.
- POST /api/groups/pick {id, pick} calls it and answers with the groups'
state. The panel doesn't send the whole group back the way the card's
save does, so a stale panel copy can't overwrite an edit made on the
Routing page in the meantime.
- Tray panel, Routing tab: under today's totals, one row per Manual group
of two or more members that is on. The row has the group's name and its
picked member as a sess-pick button. The button opens the app's menu
(openProtoMenu, no native select), headed "Model every request goes
to". It lists the members with the card's notes ("fast", the provider,
and "no provider serves it now" for one not ready), and the picked
member is ticked. Picking the ticked one posts nothing. No new layout,
no left border.
- The tab reads the groups again when it is shown, and loadGroups redraws
the panel. A pick made on the Routing page or from the CLI shows here.
- New string in zh, zh-TW, ja, de.
Tests:
- TestPickGroup (provider): switches and routes to the new member, keeps
the rest of the group, refuses the three cases and changes nothing
then. Red with the `g.Pick = pick` line removed.
- TestGroupsPick (gui): /api/groups/pick answers with picked = the new
member and refuses a non-member.
- panel-routing-pick.test.cjs: a 440px panel in Chromium and WebKit, in
en, zh, zh-TW, ja and de. 10/10 pass. Red with the row left out of
renderPanel. Screenshots were checked in de (web) and zh-TW and en
(app).
- gofmt -l clean; go vet -tags nogui for darwin, linux and windows: clean.
- GUI subset (panel-*, routing-*, i18n-*, header-relang,
agent-notice-lang; 1199 cases) on 63be47717+this: 1175 pass. Each red
was rerun file by file on this head and on a clean
|
||
|
|
af601541ef |
routing: a request opens to its request and response (Fate on Discord)
Fate asked on Discord to see what a single request on the Routing page sent
and got back, such as a Codex prediction. The bodies were captured already,
in the Gateway page's 40 recent calls and the opt-in request archive, but
nothing led there from a Routing request.
- gateway: a Call carries the Routing request it was (Call.Route = the
trace's Route.ID), set where serve, the Codex backend and a refused title
record it. Server.RouteCall finds it in the ring. A route id is not a
call id. A route names its archive copy (Route.Archive =
call.archiveName()), set only when the archive was on, so it reaches the
saved history too.
- gui: GET /api/gateway/call takes ?route= besides ?id=. It is the same
handler, the same no-store, the same key guard and the same 404 once the
ring has let the call go.
- Routing page: the story's head has "Request and response". It fetches
only when pressed, and shows the masked bodies through callBodyPanel (an
SSE reply reads as its events). A request the ring no longer has shows
the archive's copy through archivePanel when the route names one.
Otherwise it says the last 40 are kept until magpie quits and how to turn
the archive on. Nothing more is captured or kept than before.
- The head now wraps. At narrow widths its buttons ran past the story
("Back to live" was cut off at 440px).
- The two button words live in i18n.js: i18n-keys' "a plugin's words are
its own" found them inside core strings.
- docs/subsystems/gui-shell.md says how a route reaches its bodies.
Tests:
- TestRoutingRequestOpensItsBodies (new): each of two routes gets its own
bodies; route 0 and an unknown route get 404. Red without
`call.Route = tr.ID` ("route …: 404").
- TestArchiveWholeBodies now checks that the route names the archive. Red
without the t.Archive line (`route names archive ""`).
- routing-bodies.test.cjs (new), chromium and webkit at 440px, en, zh,
zh-TW, ja and de, 10/10. It covers the ring's copy read only when asked,
hiding, another request closing it, the archive's copy, the
how-to-keep note, nothing past the story and no left border.
- Red with the client asking ?id= and with the head's wrap removed.
- routing-request-metrics.test.cjs: with the head wrapped, its 480px
picker clicks in WebKit landed on the footer. Playwright's WebKit places
elements in the scrolled view hundreds of px lower than
getBoundingClientRect, which elementFromPoint agrees with. The test now
clicks where the page shows them. 5 runs of both engines, 20/20.
Run in a sandbox HOME at
|
||
|
|
6f92815335 |
routing: each try says where its time went: magpie, the network, the vendor (Discord, Magic_zero)
A user read a slow turn as the gateway being slow. The try loop's
httptrace now also records DNS, connect, TLS, GotConn (reused or not)
and the first response byte. Each Try keeps a TryNet ("net"): magpie's
own time, requests made before it, the wait for a pooled connection,
DNS, connect, TLS, sending, the vendor's wait for its first byte, and
Head (from the try's start to that byte). A Route also carries the usage
record's Sent/Own/Retried/Queued split. Usage records are unchanged.
The Routing page's story shows "Where the time went" under each finished
try. It is one stacked bar plus named values, in three groups (magpie,
network, vendor): Waiting for a slot (tr.queued, which was never shown
before), In magpie, DNS, Connecting, TLS, Sending, Vendor (first byte),
First token, Streaming. Parts that took no time are left out. The
strings are in every language. "Waiting for a slot" moves from the
Usage plugin's i18n into i18n.js, since Routing uses it too.
Not covered: plugin providers (and any other request sent by something
other than Go's client). Their request goes out through the Bun host's
fetch, so no httptrace fires. Such a try has no net and shows no
breakdown, only the time it took, as before (and so does a trace from
before this change).
Run (worktree at origin/main
|
||
|
|
0e8fcd7926 |
routing: an account that answered is lit but still; only a request in flight pulses and flows, and a panicked request's routes end (#2386)
Since
|
||
|
|
431e2941bb |
gui: a Routing request whose numbers don't fit one line keeps where it went whole and its numbers on one line under it (#2288, xishuchkui-code)
On a laptop's screen (about 1300px wide at 150%) the request list beside
the accounts is ~800px: wider than 760px, where a row goes onto three
lines, but too narrow for one. A row there cut where it went to
"Op… · deepseek-v4.1-fla…" and broke its metrics over two lines of their
own, at a different place on each row.
Now, where a row's metrics would wrap in their column on one line, the
list's column gets a meta-under mark and every row keeps its time, the
model asked and where it went on its first line and its metrics on one
line under them. metaFit decides it on the next frame after a resize or a
render: it takes the mark off, measures whether any row's metrics wrap,
and puts it back if so, before the frame is drawn, keeping what scrolls in
place (rows are shorter on one line). Measuring under the mark instead let
it flip: metrics within their 40% share can still wrap beside a wide model.
Where they fit, the row stays on one line as before (#860's
routing-columns); 760px and narrower is unchanged.
A fixed max1100 width mark was tried first and dropped: it put #860's
fixtures, which fit one line at a 900–1056px list, onto two lines.
Run: new routing-row-two-lines.test.cjs (Chromium and WebKit; en, zh,
zh-TW, ja, de; viewport 1500 = list ~845px beside the accounts, the
reporter's, plus 1300, 1100 and 420) and routing-columns pass, 14/14;
with the meta-under toggle removed by hand the new test fails in every
language ("where it went is cut"). Related GUI tests (172 files: routing-*
and every test that opens view=routing or the header), both engines, at
concurrency 4: 2449/2463; the 14 reds are routing-held-member WebKit 420
(#2252), routing-model-rest (#2115) and routing-wb-restricted (#1905),
each red alone on origin/main
|
||
|
|
dcf292cc8e |
routing: a group editor's labels are level with their controls, and every hint 4px under it (the owner)
Models' and Patterns' lists, empty in a new group, still took a grid row,
so the add button and the pattern input began 6-10px under their labels
(Models 7.5px, Patterns 11px off). Slow to start's and Context's hints sat
12px under their choices (an 8px wrap gap plus the hint's 4px margin) where
every other row's sit 4px.
- app.css: `.fallback .fbl:empty` takes no row. This was already so for the
rules list (.rt-rules); it now holds for every .fallback, the provider
editor's Fallback list among them, and the rt-rules copy goes.
- routing.css: the pattern input's 4px margin only follows a list with
patterns in it; ctx-wrap's row gap is 4px and its hint has no margin.
Run at
|
||
|
|
f255a3e3b7 |
gui: a routing group's editor keeps its member rows and pattern row inside it, a long model's name ellipsized, not the chips cut off (碳碳双键 on Discord)
碳碳双键's screenshot (zh, ~770px): in a group's editor the 模型 rows ran
past the editor's right edge, 跟随分组推理 / 标准速度 cut off, and the 模式
row didn't line up with them. .fallback and its .fbl are grids with an
auto track, which grows to the widest row's min-content: one long model
id (nvidia/nemotron-3-super-120b-a12b:free) widened the whole column.
The track is minmax(0, 1fr) now, so the column is the editor's width. A
member row's name and its provider shrink and ellipsize (the provider
first), with the whole name as a title on hover; when the chips still
don't fit they wrap to a second line, right-aligned. The rules group
(.rt-rules) and the phone's own row layout (body.web, which wraps and
starts at the left) are left as they were; the new rules sit in :where()
so the phone's still win.
New test group-editor-fits.test.cjs: Chromium and WebKit, the desktop
window and the web page, 1100, 770 and 420 wide, en, zh, zh-TW, ja, de.
It checks that nothing in the members or patterns box passes the
editor's edges, no chip is cut, the page doesn't scroll sideways, the
pattern row's edges are the members box's, and the long name is a title.
It fails on origin/main
|
||
|
|
eb7199e120 |
gui: Routing is a plugin's page, its script, style and words in plugins/routing (P2)
P2 of docs/subsystems/plugin-runtime.md, the third page after Sessions and Library. - routing.js and routing.css move to assets/plugins/routing/ (client.js, routing.css). Its part's html is the page's head and boxes that were index.html's <main id="view-routing">; the rest is drawn by routingPage, run at mount since it builds on app.js. It keeps itself after that as it did (its own hidden, the language, focus), so its hooks are dirty and discard, a routing group being edited, which show() and the window's close ask through magpie.call: window.routingDirty and discardRouting are gone. - plugins/routing: Essential, Requires window and gateway, in use while the user has a routing group (not Auto, not Hidden), since the page is where it is edited. The gateway routes the same with it off. - With it off, what leads to the page goes too: the nav and panel tabs and the panel's section (data-feature="routing"), the guide's Open Routing, Providers' "Make a routing group of …", the Usage list's View routing and its time as a link, the context card's Latest request. A panel left on its Routing tab shows Agents. - What other pages use of it stays on window: openRoute (context.js), kindName, swapWhy, routedWhy (Usage's Requests), newGroupWith (Providers), panelRoutingShown (the panel). - The 505 strings only Routing says move from i18n.js to plugins/routing/i18n.js (4 languages); i18n.js 17048 → 15032 lines. The plugin's own name and line stay in i18n.js: the Plugins page says them with the plugin off (TestBuiltinsTranslated). - Tests and comments that named routing.js name the new path (gateway's antigravity_rest and loop_guard, codeassist.go, usage.go, web_compress, group_member_info, assets_revalidate, font-cascade, win-fonts, three routing-*.test.cjs). builtins.test.cjs and builtins_test.go count seven built-ins and switch Routing off: its tabs go, the page shown stays. - docs: plugin-runtime.md, gui-shell.md, gateway-routing.md. Run, first on origin/main |