e4e9eb0928becfa4e48484dde85ef5032671d582
125
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
2926b7beff |
usage, routing: the model id a request went out under is kept and shown
daoche_wuzui on X asked how magpie serves Antigravity and whether a
request goes out under a suffixed model: nothing showed the id actually
sent. Antigravity's plugin turns gemini-3.7-flash at high effort into
gemini-3.7-flash-high, and a relay's upstream name (ModelWires) renames
a model too; the ledger and Routing showed only the routed model.
- A plugin's reply may carry X-Magpie-Sent-Model
(provider.SentModelHeader). forward() reads it from plugin providers
only (a non-plugin's header is ignored) and deletes it, so it never
reaches the agent. Without it, provider.SentNameOnIn (the upstream
name, or Antigravity's variant) is used.
- wireName keeps the id only when it differs from the model. It goes in
usage.Record.Wire (`wire`, omitempty), the trace's Try.Wire, the
ledger cache and a last CSV column, sent_model (docs/reference.md).
- Usage › Requests: the Sent cell and the detail show the sent id when
there is one, with "model → sent id" on hover. Routing: a try sent
under another id gets one aside line, "Sent to the vendor as {model}"
(zh, zh-TW, ja, de).
- Antigravity's mover min is 0.2.4: plugins 67fb1258 sets the header on
every reply (stream, whole and errors); its tgz is on the plugins
repo's dist branch.
Run at this head (
|
||
|
|
1c9c359f9d |
gui: Usage cards keep their place as they come in (liuzhengdong99 on X)
liuzhengdong99 on X: 用量界面每张卡片取数的时间不一致,导致卡片渲染时高度一直 跳动——滑到上面看某张卡片,视图会被拽回下面. The allowance cards come in at different times: each vendor's read (the page asks again every 1.5s while X-Magpie-Reading says a read is under way), then the curves' history. Every answer redraws the cards (renderQuotas), and packUsage grows the ones above the card being read. Nothing kept that card in place: the view's scroll guard (keepInView) only knew elements by node, and the cards are new nodes on each draw, so the browser's anchoring was the only thing holding them. It anchored on nodes that were being replaced, and the reader ended up dragged down. Fix: - The Overview keeps the card being read in place: the highest card (or part of the page under the cards) that starts in sight, found again by its data-key after a redraw (keepInView's new `only` mode with pinnedAt), and followed after every packUsage (followPin). The browser's own anchoring stays on while nothing is kept: at the page's top, on another tab, and while the cards are dragged or moved by keys (unpin, so a dropped card lands where its slot showed). - Placeholders from the last known height: each card's height drawn in full is kept by its key (localStorage magpie.usageCardTall, 1s debounce, 200 keys at most). A card still waiting on its read or its curve (usageWaiting: quotasReading, the new flag loadQuotas sets, or no history answer yet) is packed and held at least that tall, in the column count the cards were last whole in at that width. On the next start, no card in sight moves. - loadQuotaHist counts its first answer even when it is empty, so a user with no history isn't left waiting (found by usage-pack: the cards held their first packing at 560px). No new animation, nothing scrolls the page on its own (click-scroll passes), and the layout is unchanged once the cards are in. Run (mica, Playwright 1.62.0, Chromium + WebKit): - usage-cards-steady.test.cjs (new): 20 tests, all 5 languages, 1100px and 420px. On the old assets (MAGPIE_ASSETS) it was red 8 of 8 in en and ja. With the hold disabled, the second visit goes red. - At |
||
|
|
4d79bebfa7 |
usage: speed counts all output, reasoning and tool calls too, from the first output (Archivemylife on X)
Archivemylife on X: speed should be the upstream's usage over the local time, with no split into reasoning, tools and answer, since reasoning and tool calls are tokens too. Speed is now every output token the vendor's usage counts (reasoning and tool-call arguments included) over the time from the first output of any kind to the end of the reply. The first output is the earlier of the first content (TTFT) and the first sign of reasoning, firstToken.reasoningMs in ttft.go, which works the same in every protocol: - a Responses reasoning item's start; - an Anthropic thinking or redacted_thinking block's start; - sealed (hidden) thinking; - reasoning deltas spread over 100 ms or more. Deltas that came at once are a buffered burst and tell none. A summary is no sign (summaryPart: a Responses reasoning summary, a Gemini thought, or a summary translated from another protocol via firstToken.summarized), because it is written after some of the reasoning it sums up (#1463). A reply that reasoned with no sign of when it began counts only its answer, its output less the reasoning, from its first text, and none with no text. Before this, a reply that reasoned always counted only its answer, and a reply that wrote tool calls after reasoning told no speed. Burst and held-content checks judge the answer's part. The same definition holds everywhere: - gateway: speed.go, trace.go, codex_backend.go; - usage.DecodeOf, for the Usage cards, rows and `magpie usage`; - the Usage page's ledDecode; - the Routing page's decodeOf and its ranking (fast routing reads noteTrySpeed, which uses DecodeOf). settledCountVersion goes to 8, so settled heat totals are counted again. The rule text is in en, zh, zh-TW, ja and de. Docs: reference.md, and gui-shell.md under "Streamed output speed". Red on the old code (scratch worktree at |
||
|
|
5cf1d3846a |
sessions: an agent left off in the first "allow selected" is asked about once more, on Sessions and Usage › Requests
baysonfox on X: with magpie installed after Antigravity 2.0, the app's
sessions and calls made without magpie never showed in Usage, while agy
CLI's did. The first consent named the app off beside agy, and a named
agent was never "new" again, so nothing asked about it and nothing on
Usage said why. The reader is fine: the app's calls come from its own
SQLite steps (antigravityRead), read once allowed.
Nothing is turned on by magpie: the gate is the user's privacy choice.
Instead:
- settings.SessionReads gets Kept: agents turned off on their own (a
sessions/reads post without `all`: Keep off, a Settings › Privacy row,
`magpie sessions read off <agent>`). A post setting it on takes it out.
- readsNow's New: off, found here and not Kept (was: never named). So an
agent left off in the first choice's list is asked about once more,
as one found later already was.
- Usage › Requests shows a line above its rows for those agents
(readsLater in the usage plugin): Count {names} / Don't count, the
same {agents} posts as the Sessions page's laterCard. Gone after
either answer; sessions/reads read at most once a minute.
- Old data: an agent turned off in Settings before Kept existed has no
entry and is asked once more, for every user with such an agent.
Tests:
- TestSessionReadsUncheckedAgentAskedAgain (count, keep off): sandbox
HOME with testdata/agy-sessions and the real Antigravity 2.30
conversation (antigravity-2.30-tools); after the first choice the app
is off and New, has no rows in /api/usage/requests; Count brings its
rows in, Keep off keeps none, and neither is asked again. Red on the
old code (New false after the first choice).
- TestSessionReadsTurnedOffNotAskedAgain: off on its own, under all true
and all false, is neither on nor New.
- usage-reads-note.test.cjs: the Requests line in Chromium and WebKit,
en/zh/zh-TW/ja/de at 900/420/390px, both answers, buttons inside the
line, no sideways scroll; red on the old code (no #ledReads).
Run on mica (mote was full: load 40+, another GUI suite on it), rebased
on
|
||
|
|
67f24d7422 |
usage: every cache hit rate to two decimals, its exact share on hover; a speed's dash says why
shangyuan0818 on X: in Usage › Requests the ranking's model hit rates
had no decimals or one ("98%" beside "99.6%"), the request table mixed
them too, and hovering showed no exact value.
- hitPct gives every hit rate two decimals (98.00%, 99.60%), the same
in the ranking, the request table and its details, the Cache hit
rate card, the cache-read tiles, the model and agent rows, Sessions,
the tray panel, Routing's rows, figures and group averages, and the
context window's Prompt cache. It still never says 100.00% or 0.00%
of a prompt not all or none cached (99.99%, 0.01%).
- Each of them has the exact share on hover, in its title (hitTip):
"9,800 of 10,000 prompt tokens read from the cache: 98%", the share
to six places with no trailing zeros. One new string, translated in
zh, zh-TW, ja and de.
ohblue on X: 速度 shows "—" for many 200 requests (491 in, 93 out,
first token 6.3s, total 6.4s), "≥133 token/秒" for others.
- That speed can't honestly be counted: 93 tokens in the 120ms after a
6.3s wait would read ~775 tok/s, which is a reply written during the
wait and let go at once (ledHeldShort_). The dash already had its
reason as a title, but nothing showed it was there. It now has the
help cursor (the cache column's dash too), the Speed column's head
says what a speed is on hover, and a request's details say "— " and
the reason in words, for a reader who can't hover.
Budget: app.js and the core grew by my hitTip, cacheHitTip and the
titles. To stay inside both budgets with no raise, setQuotaRange moved
to plugins/usage/page.js and PLACEHOLDER to plugins/redact/page.js (each
read by that page alone), cacheHitOf and cacheHitTip share cachePrompt,
and hitPct is one expression. Core 1,272,578 of 1,272,581; app.js
1,087,887 of 1,088,248.
Run on mote/mica, this change on origin/main, both engines, every
language, at the widths each file covers:
- usage-hit-exact.test.cjs (new): green. Red with the old hitPct
('hit rate 98%') and red with the help cursor and the details' line
taken out ('pointer' !== 'help').
- 85 GUI files (every test that reads a hit rate, quota range or
masking, Usage, Routing, i18n-keys, gui-ja/de/zh-tw): 1318 pass, 30
fail. All 30 are red alike without this change, and all are filed:
agent-menu-label webkit panel (#6371), zcode-models webkit de
(#6566), quota-credits (#6807), quota-curve (#6789), usage-fold's
17 subscriptions (#3415, #6003), usage-ledger (#4078, #3104, #4626),
usage-ledger-chart (#6790). usage-fold's 'several accounts' went red
only under the 85-file run and passes alone on this tree (#3415,
commented).
- go test ./internal/gui on mica: ok (TestCoreScriptBudget included).
- Red alike on a HEAD checkout without this change, already filed:
usage-ledger "newest live route needs no return-to-live button"
(#4078, #3104, #4626), usage-ledger-chart "the metric is remembered"
(#6790).
Not run before the push: the whole GUI suite and go test ./... (both
machines had other sessions' full suites running); they run after it
and their result goes on record. Not tried: Windows WebView2, the
reporters' own ledgers, the real app.
|
||
|
|
5bfa57e3d3 |
usage: check one model on one provider with a few fixed-answer calls, kept beside the other providers
skingstyle48487 on X runs more than ten relays and asked for something like the "pelican test" to spot one that waters a model down. In a follow-up (2122694296054972815) they said speed, failures and the model's name show whether a relay is fast and stable, not whether the model got weaker. They asked for small tests with known answers, the share of right answers and of right tool calls, and relays compared side by side. On Usage › Requests › Model speed › Providers, each row has a Check… that opens a dialog. Opening it sends nothing; only its Check makes the calls. POST /api/relay-check (gateway.CheckRelay) makes 6 small streamed Chat Completions calls through the gateway, pinned to provider/model as an agent would, three at a time: - write 1 to 40; - 1234 × 5678, 987 × 654 and 2468 × 1357; - weather in Paris and time in Tokyo, each call offering both tools, so the right one has to be picked. Each part says what it found, never a verdict on the provider: - whether the answer was the expected one, and what came back; - the model the reply named, when the ledger would call it another model (usage.Swapped, not SameSpelled or ListedAs); - the provider that answered, when the call was handed on; - how many input tokens the 118-character prompt was counted as; - first token, tok/s and the whole time. The dialog heads the parts with "Answers right: n of m" and "Right tool calls: n of m". The numbers come from the gateway's own usage records (a tap in appendUsage keyed on the request's context), not from each protocol's reply. The tally of each provider's last check is kept in the window's storage. The Providers table then shows Answers and Tool calls columns: sortable, amber when short of all, a dash for providers not checked, so relays are compared side by side. The dialog code is a lazily loaded root script (relaycheck.js), as app.js has no room left. Run, at this head: - mote: go test -timeout 45m ./internal/gateway ./internal/gui ./internal/cli ./internal/usage: ok (the full ./... suite passed at 41d88731c, before the fixed-answer calls; mote and mica were each running another session's GUI suite at this head); - gofmt -l, GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./...: clean; - go test -run 'CheckRelay|ReadChatStream' -v ./internal/gateway (5 tests pass); - usage-model-speed.test.cjs, chromium and webkit, en, zh, zh-TW, ja and de at 400px: 12/12; - i18n-keys and old-webkit: their only reds are the three on origin/main, each filed (#6877 ", with an image", #5919 :has(), #6030 headerpresets.js); - TestCoreScriptBudget and the app.js budget: ok, not raised. Broken by hand: - taking tapUsage out of appendUsage turns TestCheckRelayAnsweredAsAsked and TestCheckRelaySaysWhatDiffers red; - dropping the tool-name check turns TestCheckRelayCountsEachAnswer red (get_weather for Tokyo read as right); - pressing Check as the dialog opens turns the GUI test red ("opening the dialog sends no call"). Not tried: - the whole GUI suite at this head (both machines busy with another session's suite); - a real relay (fakes only); - a context-window probe; - a comparison with the vendor's own count_tokens; - a periodic check (the check runs only on a press). |
||
|
|
b0674b9ec4 |
providers: a key's balance shows on its row, as Usage last read it
lyj1115 on X: magpie found the relay's balance (the probe), but the Providers row showed only the API key; the figure was on Usage alone. The row's quiet facts line (host · models) now ends in " · $10472.14", in the line's own colour and size, with "Balance $…" as its tooltip. Several keys' balances are added up as the Usage card's head adds them (shared balances counted once), else the key in use's. A failed read, a signed-in account (its windows are on Usage) and Usage turned off show none. Opening Providers asks for Usage's own read (never ?asked=1, so "read only when asked" holds) when it is over a minute old, as Routing does (#1833); rows are marked after the list is drawn and after a read. rowBalance, markBalances and keysSum/keysSumTip live in plugins/usage/page.js (keysSum moved out of app.js) so app.js stays under its code budget without a raise; app.js calls markBalances?.(). No new words, no CSS. Run (mote, at this tree rebased on origin/main |
||
|
|
34606000da |
gui: the tray panel's Usage tab ends in a heatmap of recent weeks (eiyuuzaki2333 on X)
Asked for "a heatmap like GitHub's / Codex's, also in the tray". The window already has one (Usage › Requests, 53 weeks, #1369), so no second copy goes on the Overview, which counts gateway calls only while the heatmap counts session-file calls too. The tray panel had none. The panel's Usage tab now ends in a card of the recent weeks, one cell a day, Monday on top, as many weeks as the card fits (8 to 53: about 25 at the panel's 440, 17 at 320). It goes after the chart and ranking, so nothing above it moves. Its shades are the existing monochrome accent ramp (.l0 to .l4) and follow the tab's own Tokens / Cost / Requests switch, with no new read; a provider or computer picked above narrows it. A tooltip says the day and its tokens, requests and cost. Weeks with no call show no card. No animation. It reads the existing cached /api/usage/heatmap, at most once a minute and again when a pick changes; the tab's own 10 s reads don't wait for it, and no endpoint was added. The card, its reads and tooltip live in plugins/usage/page.js, which shares its grid (heatGridOf, taken out of drawLedHeat as it was) and tooltip (ledHeatTip, now told the metric and provider) with the Requests tab. app.js keeps one guarded call in renderPanelUse: the ledger read can come back before page.js has run, so page.js draws the tab again when it loads. Both script budgets hold it at this base with no raise. The card is .pu-heat, not .pu-card, so the chart's card stays the tab's one .pu-card. The panel's light pills are its card's white, so a quiet day there is a 7% shade of the text over the card. Run (rebased on origin/main |
||
|
|
e47abdf468 |
usage: the allowances' trend takes any last N days; a curve's hover reads the exact numbers
shangyuan0818 on X asked for exact numbers on the Overview's quota curves when hovered, and for the trend to take any "last N days". - Usage → Overview, the allowances' "Trends: …" button: the menu now has 7 days and 30 days beside Off, 2 days and Cycle, and "Other number of days…", which turns the button into a field for 1 to 45 (the days of history magpie keeps). Enter or leaving the field keeps it; Escape leaves the range as it was; a number out of range says so and keeps the old one. A custom N stays in the menu, and is kept across a reload (magpie.quotaRange). - Hovering a quota curve shows a small tip at the reading nearest the pointer: when it was read, then each window's left to two decimals (70.46%), with a hairline at that time. A balance curve shows the balance in the card's currency. The curve's own tooltip (what the dashes mean) waits while the tip shows. A touch still zooms, as before. - The trend menu, the days field and the hover live in the usage plugin's page.js, so app.js stays inside its budget. - No animation: the tip follows the pointer, which a movement would lag. Run, at |
||
|
|
d597b4d010 |
usage: a priced cost without "≈", at least two decimals; cache hit rate to two
shangyuan0818 on X: Usage → Requests showed every cost as "≈$…", and the cache hit rate with one decimal. - A cost from known prices is what magpie counted, so "≈" is gone from every priced cost: Requests' Cost card and tiles, the agent, model and account rows, the quick panel's Usage, Routing's live rows. An estimate keeps it (a window's whole on an account card, a session file's times). - fmtCost gives at least two decimals ($1.00, $100.00, $2500.50), three under $1 as before, and a sub-mill amount to its first two digits ($0.00040, $0.000012) instead of $0.000. - Requests' Cache hit rate card has two decimals (93.97%); hitPct still never rounds up to 100% or down to 0%. - A whole-window estimate from $100 up stays whole ($1235): its cents would claim a precision it hasn't (wholeCost, moved to page.js to keep app.js inside its budget). Run, at |
||
|
|
2e1c0a377b |
usage: a single-account card folds to its figures, and folded cards are one size (PILIHU2023 on X)
PILIHU2023 asked for a fold on each Usage → Overview card that leaves only the usage, with the cards all one height and width. - A card with one account (or one key) and figures to show (windows or a balance) now has a disclosure chevron at the end of its head, before its ⋯. It reuses the per-account fold (usageAcctFold, usageAccts in localStorage), so its state is kept across restarts and its titles are the existing ones. Folded, the card keeps its windows' names, bars and figures. It drops resets, curves, history, the reading line and the auto-reset and credits rows. A plan-only card (OpenCode Zen Free) has nothing to fold and gets no chevron. - Cards with several accounts keep their own folds: each account's chevron, and the All N accounts strip's. - Folded cards are packed to one height: the tallest folded single card. A card of several accounts, each in brief, takes whole rows of that height. A fully folded page is a grid of one width and one height. Open cards keep their natural height, so nothing is stretched or clipped (jen_celeus, #860). - app.js was at its budget with no room. The Usage packing block (packUsage and its helpers, about 3.8KB of code) moved from app.js to plugins/usage/page.js, which already holds the Usage page's card menus. app.js code is now about 3.2KB under its budget. No budget was raised. - The chevron's turn uses --ease-out (cubic-bezier(.23, 1, .32, 1)), .15s. What was run: - New usage-card-fold.test.cjs: Chromium and WebKit × en, zh, zh-TW, ja, de, at 1400, 900 and 400px and after a reload. It folds every card and checks they are one width and one height, sit on whole rows and don't overlap. It then unfolds two cards and checks they are their own height again. Red on origin/main |
||
|
|
5bd41301b9 |
warm-up: All accounts warms every account in use at one press (CoderMaurice on X)
CoderMaurice on X: with several Claude accounts, Warm up now had to be
pressed once per account. With two or more accounts, the Warm up… menu on
the Warm up now row (a Claude Code or Codex provider's editor, the warm-up
section) now starts with All accounts. It sends POST /api/warm-all, and
provider.WarmAll sends Warm up now to every account that is in use (the
one the agent is on, or one turned on beside it) and whose windows aren't
all running already, going by the cached readings the Usage page shares.
It runs three at a time. An account that is turned off or paused, or
already in its windows, is sent nothing. An account whose sign-in lapsed
is sent nothing and is listed as failed, as Warm up now treats it. The
row's line lists the accounts warmed, the ones already in a window, and
each refusal with its reason (in red).
Accounts that are turned off aren't listed. A gateway rest is not read
(the provider package can't see it). An account rested for a used-up
window is still inside that window, so it is skipped as running.
"All accounts" moves from the usage plugin's i18n.js into core i18n.js,
since the core uses it now. It and two new strings are in zh, zh-TW, ja
and de. app.js stays inside its budget: the single-account and
all-accounts results now go through one formatter.
Run at a1968a0b5 (rebased on origin/main
|
||
|
|
93762f968a |
usage: small, idle clients fold into one Other row
WJaunita45604 on X: test runs leave dozens of randomly named clients of
~10K tokens each in the Usage page's Agents list, and the page crawls.
renderUsage draws every Agents row again at each refresh whose summary
changed, at ~0.1ms of DOM and layout a row: with 400 clients a redraw
took 30-54ms in Chromium and 45-66ms in WebKit, with 2000 136-178ms and
224-246ms (probe at 1200px, Bun/SiYuan/translate-web and N clients).
A client not hidden folds when it is past the 5 with the most tokens,
under 1% of the period's tokens, and either made no call in the last 3
days (the agent group's new `last`) or is past the top 20; two or more
fold, or none do. No setting. Other sits at the list's foot with the
folded groups' sums (usageSum), so totals stay exact, and opens with a
click, Enter or Space; open, it draws the folded rows with their own
actions 100 at a time (Show {n} more). Closed they aren't drawn at all:
with 400 or 2000 clients a redraw now fits one frame (~13-20ms in both
engines), as with none.
Run at
|
||
|
|
2a6ab83d8a |
usage: each account of a provider's card is a card of its own; the ⋯ keeps its room
normalcoder_ on X (v0.1.4079, Usage > Overview): accounts inside a provider
card were told apart by a hairline only, and the card's ⋯ was drawn over
the end of the head ("Show the other accounts in brief" was hidden).
- renderQuotas puts each account of a card with several into a
.subscription-acct box (a provider's keys, a balance a line, stay
lines); quotaCardMenu looks through the box for the account's head.
- The head keeps 18px for the ⋯ whether it shows or not; where nothing
hovers, the ⋯ is always shown.
- Core budgets +57 (app.js) / +81 (core): renderQuotas draws every card,
so there is no page to move it to.
Run (mote, both engines):
- usage-card-menu-room.test.cjs: 20/20 here; red 20/20 on origin/main
|
||
|
|
1ab2c39843 |
tray: the menu bar and panel leave out what Usage's Overview hides (onkashiko on X)
onkashiko on X: a quota hidden in the main window still showed from the menu bar. |
||
|
|
7ea1e6a4b3 |
usage: the tray panel and the TUI leave out what the Usage page hides
onkashiko on X: a provider whose allowance card was hidden in the main
window (Usage > Overview, "Hide from Overview") still showed in the menu
bar's panel. The panel's Allowances tab had only its own Arrange list
(panelUsageHidden) and read the full cards.
Now the panel leaves out a card whose cardHideKey is in usageCardsHidden
and the rows in usageWindowsHidden (withoutHiddenRows), as Overview does;
a menu bar cell's card still shows (panelPeek). A subscription whose
every card the page hides counts in the foot's "{n} hidden" and shows as
hidden in Arrange; Show there
also drops its keys from usageCardsHidden, since the panel follows the
page. All of it is panelPageCut in the Usage plugin's page.js, which every
window loads, so the core scripts get no bigger (TestCoreScriptBudget
unchanged). Hiding from the panel alone still leaves the page as it is. The
panel reads settings again each time it is shown (loadBack), so a hide or
unhide in the main window reaches it with no restart.
Siblings: magpie tui's Usage page leaves out the same cards and rows
(usageShown, read at every quota read). The menu bar's cells and tooltip
show only the cards picked in Settings, so they keep a hidden card as
before; routing, caps and counting are unchanged.
Run:
- panel-page-hidden.test.cjs (new): chromium + webkit, en/zh/zh-TW/ja/de,
10/10 green; red on the old app.js/panelarrange.js (cards still drawn).
- TestUsagePageLeavesOutWhatTheAppHides (new): green; red on the old
pages.go (balance, account and row still listed).
- GUI: the 128 files that read the panel, Usage or tray code, chromium +
webkit, every language, on mote: 17 files red, rerun alone at
concurrency 1 here 123/449 red and at origin/main
|
||
|
|
27c998aba0 |
usage: the tray panel's and Requests' costs follow each provider's currency
onkashiko on X: with Currency set to By provider, the menu bar panel still showed every cost in one currency; providers and models were not each in their own. drawLedColumns and drawLedRank (shared by the tray panel and the window's Requests tab) formatted every value with no provider, so fmtCost fell back to the Totals in currency. - usageapi.Ledger echoes the provider a page is filtered to (`provider`, omitempty). - app.js: ledProv(l, split, id) names the provider of a value: the ledger's filter, the row's provider (provider split), the provider part of a modelAt id, or for a model split the provider(s) that served it when they all share a currency. ledFormat/ledFormatLong take it, so the rank's values and sub-lines, the tooltip's rows and the axis (when one provider is picked) are in that provider's currency. Sums (the panel total, the tooltip total, a model served in two currencies) stay in the Totals in currency. - page.js: the Requests head and the cost head use the filter's provider; the heatmap tip too. Other fmtCost calls are sums or sessions with no provider and are unchanged. - core script budget +491 (1,269,040 -> 1,269,531): drawLedColumns and drawLedRank are drawn by the panel, so there is no lazy page to move this to; packed to the shortest form. - docs/subsystems/gui-shell.md says how By provider reaches the panel. Run: - At 065fb6a8b (rebased on |
||
|
|
925bc7188b |
usage: the Requests card's up arrow opens what the bytes sent upstream were made of
theforeveriris (X, 2121408745616162998) saw 8169 requests send 8.6 GB up and 1.0 GB down and wanted to know why. About 1 MB a request is normal: every request sends the whole conversation again, with the system prompt and the tools' definitions. This shows it. Gateway: promptOf, which already parses the body off the request path, now also counts the bytes of the system prompt, the tool definitions and images in the body it read. upParts scales those to the wire bytes and puts them on Record.UpParts. Nothing new runs on the request path, and a body that isn't parsed stays "Not measured". Usage: a packed row keeps the mix in 255ths under flag rowUpParts (32768); the row stays 152 bytes. Totals gain up_calls, up_measured, up_system, up_tools and up_images, and Shares carry up_bytes and up_calls by agent and by model. settledCountVersion goes 4 -> 5, so settled days are counted again once on the next start. GUI (Usage -> Requests): the "↑ 8.6 GB" on the Requests card is a button that opens a "Sent upstream" card: the average per request, one sentence on why, a bar and legend for Conversation / Tool definitions / System prompt / Images / Not measured, and the top 8 agents and models with bytes sent and per request. The open state is kept; × closes it. A request's details get a "Made of" line. zh, zh-TW, ja, de strings. Entrance is 200ms ease-out, no movement under reduced motion. Run (mote, at this head on |
||
|
|
57dc64ba12 |
usage: the Overview's lists rank by tokens, cost, calls or name (onducoder on X)
onducoder asked for a ranking of Usage › Overview's Agents, Models, Gateway keys and Accounts by what each used. Each list's heading now ends in a quiet pick (the order's name and a chevron) that opens the app menu: Tokens (the default, the server's order), Cost, Calls or Name. By tokens the list stays in the server's order (most tokens first, the cache left out) unless "with cache" is on, when the cache counts too; other orders fall back to tokens, then calls. By cost, a row with no price goes last; by name, a row with no name goes last. Each list keeps its own order in localStorage (magpie.usageSort), and a folded list hides its pick. The code is in the Usage plugin (page.js, its i18n.js); "Calls" is a core word, since other files say it. The core script doesn't grow (TestCoreScriptBudget passes). gateway-caller-keys and usage-accounts read the heading's .label, since the heading's text now includes the pick; mobile-web takes the picks out until BASE_REF has them. Run: usage-sort.test.cjs (new; chromium and webkit, en zh zh-TW ja de, 1100 and 420 wide). On mica, with the next two commits, these files at this head and at origin/main |
||
|
|
817d35ffa9 |
usage: a window's whole follows the tokens pick's With cache (Anotiaww on X)
@Anotiaww asked (X 2121248031983194214) that the account cards' "Whole ≈ N tokens" on Usage → Overview follow the page's tokens pick. With cache, it now adds the window's routed cache read and written, scaled by the same share used as the input and output; the line reads "Whole ≈ N tokens with cache" and its tooltip says cache is included. Without cache nothing changes. Changing the pick redraws the cards. The tray panel shows no holds line, so it has nothing to follow. holdsLine and holdsUnknownLine move from app.js into the Usage plugin's page.js, beside usageWithCache, so the core script budget stays as it is (it had 14 bytes left). quotaWindows still calls them as globals. New words are said in zh, zh-TW, ja and de. Run (mica, both engines, every language): - quota-holds, i18n-keys, i18n-en-no-cjk: 16/16 ok. The new quota-holds test (pick With cache at 360 and 1000px, reload keeps it, pick back) went red in both engines with the cache left out and the old words, and again with no redraw on pick. - 185 GUI files that reach Usage or quotas, plus mobile-web, idle-ticks, old-webkit and every i18n file, concurrency 3. Reds: account-eye, account-mask, account-refresh-holds, claude-quota-onboarding, codex-auto-reset (de), key-balance-card (de), menu-scroll, mobile-web, old-webkit, quota-count-wrap. The same files are red at the base |
||
|
|
5211fd3ba2 |
usage: a currency "By provider" shows each provider's costs in what it sells in
onkashiko on X: DeepSeek, Kimi (China), Zhipu and other domestic vendors
price in yuan, the rest in dollars, and one currency for every cost made
the Usage page read wrong for half of them.
Settings > Usage > Currency gains a third choice, By provider. With it,
a figure of one provider's calls (a model's, an account's, a key's row,
a request, a routing try, a quota card's whole) shows in the currency
that provider sells in, and every sum across providers (the total,
agents, sessions, charts, the tray, Bark's daily, the day page) in the
currency a "Totals in" row picks, a row shown only while By provider is
chosen. GUI, TUI and CLI agree. Costs stay stored in dollars; only the
display converts, at the live rate (internal/fx).
Which providers sell in yuan (provider.PricesInYuan): a .cn host; a
preset at its own site that is a yuan preset (deepseek, zhipu,
volcengine, tencent-cloud, bailian, siliconflow…), ends in -cn, or is in
its China region; a plugin id ending in -cn; a provider of one's own
with a yuan models.dev catalog served at that catalog's site. A relay
made from DeepSeek's preset, Z.ai, Kimi's and MiniMax's international
endpoints stay in dollars: they share a catalog with their Chinese
twins, so the catalog alone can't tell.
Known limit: models.dev has only dollar prices (converted from the
vendors' yuan at ~6.7-7.0), so a yuan figure is that dollar price at
today's rate and can differ a few percent from the vendor's own list.
A second ask from onkashiko: set the currency of the menu bar and of
the totals apart, sums converted by themselves.
So Settings > Usage also gains an Advanced fold (closed by default, open while
set) with one row, Menu bar currency: Same as totals (the default), $ or
¥ (settings.TrayCurrency, TrayCostIn). It sets the menu bar's totals
cards and the tray tooltip's cost; the Usage page, the panel, the TUI,
the CLI and Bark's daily message stay in the totals' currency
(totalsCurrency). Like the other menu bar settings it stays on this
computer (KeepOwn). Every sum is still made in dollars and converted
once, at the live rate, so a mixed-currency total is never added up
from yuan and dollars.
Settings' currency rows (Currency, Totals in, Menu bar currency and the
rate in the tooltip) moved out of app.js into currencyprefs.js, imported
when Settings draws its usage prefs, and costInYuan is packed: the core
is 3 bytes under coreScriptBudget, with no raise.
Run:
- go test -count=1 at this tree on mote: internal/settings,
settingsapi, tui, cli, catalog, provider, fx and gui all ok
(TestCoreScriptBudget included). The full go test ./... and the whole
GUI suite are queued behind other sessions' suites on suite.lock
(mote and mica, load 35 and 60) and had not started at push.
- GUI files at this tree (mica): currency-provider, currency, i18n-keys,
i18n-en-no-cjk, tray-cost, tray-totals, every settings-*, old-webkit:
362 pass, 28 red. Every red is red the same at origin/main
|
||
|
|
5d54a990d4 |
usage: switched-off providers' accounts can be checked in, and Check in all (wxkwxk666 on X)
wxkwxk666 asked for two things on the Usage page. First, a provider switched off should still show its accounts, at the bottom and folded, so they can still be checked in each day. Second, one button should check in every account at once. - provider.OffCheckins (off_checkins.go) lists every account a checkiner reaches whose provider is switched off (Off, not Hidden). Each is a card with no windows. Nothing is read or asked for it. Its check-in result is matched by its own key, not by its name, since two sign-ins can share a name (plugins#254). GET /api/usage/checkins/off serves the list. - The Usage page (plugins/usage) adds a "Switched off · n" line after the cards and the hidden line. It is folded until clicked. Each account shows today's check-in, and a Check in button when it isn't checked in yet. The button uses checkinnow.js's ciNowSend, which POSTs /api/usage/checkin-account. - Check in all, at the head of the allowances, presses every account not checked in today, from the cards and from the switched-off line. It sends one checkin-account request per account, three at a time, shows "Checking in i/n…", then gives the counts (checkinPressSaid). When no account is due, it says so and sends nothing. - Nothing switches a provider back on. The new strings are in zh, zh-TW, ja and de. Plugin files only: app.js is unchanged. - docs/subsystems/provider-plugins.md says all of this. Run, on mote: - TestOffCheckinsListsSwitchedOffAccounts, in the fakeco plugin sandbox: - nothing is listed before the switch-off; - after it, two cards with distinct keys; - a press on one checks in exactly that account; - the provider stays off; - only the pressed card carries a result; - nothing is listed once the provider is switched on. - go test ./internal/provider ./internal/gui, at this commit on origin/main |
||
|
|
d370bef982 |
usage: Failed lists the requests a fallback answered, as Routing shows their tries failed (maohy915 on X)
maohy915 runs magpie on a NAS and uses it from another computer's magpie
through Remote magpie. The NAS's Routing page showed failed calls, but
Usage → Requests → Failed found none. Reproduced with two sandbox
instances on mote (B → remote-magpie → A, where A's provider `bad`
answers 429 and falls back to `good`). A's trace had 2 requests and 1
rerouted. Usage had 2 rows, Failed had 0 and Retried had 1. A try that
fails and is handed on writes no row when nothing is billed, and its
request's row is an answer on the second try. Failed kept only
LostRequest, the requests whose agent got the error, so the failed try
was nowhere under Failed. Plain failures, remote or not, were already
listed; only rerouted ones were missing.
Failed now keeps every request a try failed on (Record.FailedTry): the
requests the agent got an error for, the tries handed on, and the
requests a later try answered. Retried still keeps only the answered
ones. The counts are unchanged: each request is counted once, by how it
ended (小一's rule), so a Failed list reads "1 failed · 2 answered on a
retry". The Failed option and the card's "N failed" button now say so in
their tooltip, in every language. Filtered page cells are cached on disk
under the filter, so settledCountVersion goes to 4; the first start after
the upgrade pairs the history again once.
Run (mote):
- go test ./internal/usage ./internal/usageapi ./internal/gui: ok.
- New test TestFailedKeepsRequestsAFallbackAnswered; updated
TestRequestsCountedOnceWithTheirRetries.
- GUI, both engines: ledger-retried (5 languages, 420/1100), i18n-keys,
i18n-en-no-cjk, usage-ledger, api-key-usage, purpose-filter,
usage-ledger-content, usage-phone-head, usage-loops, usage-request-page.
All pass except known reds: i18n-keys "a plugin's words are its own"
(#6422/#6423) and usage-ledger "newest live route needs no
return-to-live button" (#4078/#3104/#4626).
- gofmt; go vet for darwin, linux -tags nogui, and windows.
- Real repro with a binary built from this tree: A's Failed went from 0
rows to the rerouted request, both in the API and in the real page
(Chromium).
Broken by hand:
- Filter back to LostRequest: both Go tests red.
- The Failed option's title dropped: ledger-retried red.
Not tried:
- Restoring settledCountVersion to 3 doesn't turn
TestSettledCountedAsVersioned red: it counts only Filter{}. The bump is
by reading.
- Not tried on a real NAS or in the desktop app's remote window; the
page is the NAS's own web page.
|
||
|
|
76ceff87c9 |
usage: a number of hours the reader sets, beside the calendar (eachg0 on X)
The range menu behind Custom has a top row, "[N] hours back". Enter asks the Usage page for the rolling window last:Nh (1 to 720), which the backend already answers for every view (totals, chart, models, accounts, Requests); the chip reads "Last 30 hours". The pick and N are kept on this device (magpie.usagePeriod, magpie.usageHours). 24 stays the preset's chip, and an empty page, the credit days and the menu-bar way in know the new period. zh, zh-TW, ja, de strings added. Run (mote, at the rebased head): usage-hours, usage-24h, i18n-keys in chromium and webkit, en and zh. Broken by hand: keptPeriod limited to the presets turned usage-hours red (expected last:30h, got today). Not tried: the whole GUI suite (queued on mote's suite.lock behind other sessions, still running), narrow widths by hand, the tray panel (it has no 24h chip and is unchanged). |
||
|
|
6edf7a69e5 |
usage: hide and show single quota rows of an Overview card (wangshaowei39 on X)
Antigravity's card lists Claude & GPT, Gemini and more. A row group can now be
hidden from Usage > Overview the way a card can: right-click or long-press a
row, or use the card's "..." menu, and choose "Hide <group> from Overview". The
"Hidden" line under the cards lists hidden cards and rows with an Unhide button
and Show all. The last group of a card cannot be hidden (use the card's own
hide). Persisted as settings usageWindowsHidden ("<card>|<group>"), changed
through /api/usage/arrange { windowsHidden } and kept by the Settings save.
Table view and tray panel are untouched.
Run (on mote):
- go test: TestUsageArrange*, TestUsageArrangeWindowsHidden (new), TestSettingsSave*,
settings_keep guard, TestCoreScriptBudget, ./internal/settings, ./internal/settingsapi;
gofmt clean; go vet darwin, linux nogui, windows.
- GUI, chromium and webkit: usage-rows-hide (new, 5 languages x 1200/560/390;
32/32), usage-card-more 32/32, usage-arrange, usage-all-accounts 24/24,
i18n-keys 4/4.
- usage-cards-hide and usage-hidden-way-back: "de 560" red (no sideways scroll
635 vs 560); the same red on a clean origin/main
|
||
|
|
cfd3367df8 |
usage: a request's details show its service tier (JackyFill on X)
The ledger has kept each call's service tier since #1784 (tier_asked, tier_sent, tier_served in the log, the CSV and the JSON), but the Requests page never showed it. A request's details now have a Service tier line: "asked X", then "sent Y" only when it differs, then "answered Z" only when the reply named a tier. A call with none shows no line. Row flag bits are untouched: the tiers are string slots, so no bit is taken. Run, on mica: new ledger-service-tier.test.cjs (3 rows: all three tiers, asked+sent without an answer, none) in chromium and webkit, en zh zh-TW ja de, 12 of 12 green; with the add("Service tier") line removed by hand it is 0 of 12; i18n-keys caught a duplicate "Service tier" key (the core table already has all four languages), which is removed; ledger-*, i18n-keys, i18n-en-no-cjk and gui-* files rerun green after (ledger-cache-hit chromium was red once in the first batch, green on rerun in the same batch's second run). Not tried: a real Codex priority call end to end (the gateway side is #1784's); the full suite runs after the tag. |
||
|
|
c14fa0ce93 |
Bring back 919780414 and 88d2962e0, which 698ed4adb undid
|
||
|
|
698ed4adb5 |
gateway: a busy port names the program holding it, and Tailscale's serve gets its fix (pluoki on X)
The Gateway page, `magpie serve` and the app log said only "port N is held by another program". pluoki's was `tailscale serve` on the same port number. proc.PortHolder reads the holder (lsof on the Mac, /proc on Linux, Get-NetTCPConnection on Windows). Tailscale's daemon is root's and often unreadable, so `tailscale serve status --json` is the fallback for the port. gateway.NoteHeld / PortHeld.Sentence say who holds it, and for Tailscale give `tailscale serve --https=<other> http://127.0.0.1:<port>`. Shown in the `magpie serve` standby line and bind error, the app log, `gatewayHeld` in /api/state (Gateway page) and Start's "taken" answer, in en, zh, zh-TW, ja, de. A holder that can't be read says nothing; the old wording stands. Nothing is killed or touched. Run: gofmt clean; go vet darwin, linux nogui, windows (mica); go test ./internal/proc ok; targeted holder/gateway tests on macOS (mica), Windows (win-run) and Linux (wsl-run); parser tests with real lsof output; GUI gateway-port-holder, gateway-takeover, gateway-older, gateway-skew, gateway-port, i18n-keys, i18n-en-no-cjk in chromium and webkit. Real run on WSL: a holder named tailscaled on the LAN address with magpie on 0.0.0.0 gives the Tailscale sentence at the bind error; a Python holder on loopback gives "held by python3.12 (pid N)". Broken by hand: each fix reverted in turn, its test went red. gateway-card.test.cjs is red on origin/main too (#6029). internal/gateway, gui and cli package runs were still going at push; the full suite follows the tag. Not tried: a real `tailscale serve` (changes live config), a real Windows holder end to end, the bind-error path on macOS (a wildcard bind coexists with a specific one there). |
||
|
|
9197804144 |
gui: Usage allowances can be shown as a table beside the cards (zysicyj on X)
With a dozen accounts the packed card grid is hard to scan. The Usage page's Allowances header now has a Cards / Table switch (a segmented control, remembered per user in localStorage "quotaView"; the default stays Cards, and nothing is written until the user picks). The table has one row per account: subscription, account, then the four most common windows (used % with a bar and the reset time), an Other column for extra windows and balances, sortable by any column (click again to reverse, a third time to clear; rows with no value stay last). Balance-only and error rows span the window columns. Same data and helpers as the cards (quotaFill, resetClock, quotaWho). At narrow widths the table box scrolls, not the page. The code is a lazily imported quotatable.js, so app.js stays inside its code budget. "Cards" and "Table" are translated in zh, zh-TW, ja and de. quotatable.js is listed in old-webkit's lazy-script exceptions; docs/subsystems/gui-shell.md has a paragraph on it. Run (on mica/mote, Playwright): the new usage-quota-table.test.cjs, 22 of 22 in chromium and webkit, in en/zh/zh-TW/ja/de, at 1100px and 420px (14 faked accounts: default is cards and saves nothing, row count and figures, persistence across reload, sort cycle and account sort, no page overflow, back to cards). TestCoreScriptBudget, i18n tests 8/8, gofmt, go vet for darwin, linux -tags nogui and windows. Whole GUI suite (make test-ui) at 1ad0f4cc4+this: started before the tag; first 890 results green except account-arrange (#6010, red the same on origin/main). Broken by hand: with the default flipped to table, 10 of the new tests failed; restored. Not tried: the real app, Linux WebKitGTK, a real account's data (the fixtures are faked, with the shapes the cards read). |
||
|
|
e6bf4adf1f |
usage: Claude Code's helper requests are labelled, the largest cache write is one click away (recih on X, #6199)
Claude Code's AgentSummary and its auto mode classifier name themselves nowhere in the request, so there is no client marker to read. The gateway tells them by their content (inferredKind: a claude-cli/ request on the Messages API; the classifier by autoModeClassifierAsk, the summary by its last user text "Describe your ... in 3-5 words") and records them as agent_summary_inferred and auto_mode_check_inferred. The purpose catalog names them "Progress summary (inferred)" and "Auto mode check (inferred)" and puts each with its plain kind's purpose, so the existing Purpose filter lists both; nothing known and nothing inferred share a name. A tool that printed the same words, a chat, and another agent's request stay unmarked. A requests page now also holds BigWrite, the gateway-served row that wrote the most to the cache (cells, page-v1.json and pageFromLedger all carry it; rows from session files have no request to open). The Requests line shows it as "109K largest write", a button that opens that request through openUsageRoute. settledCountVersion is raised to 3, which keys the cached pages. Not done: the per-request branch recovery result asked for in #6199. No structured field holds it. Run on mote (load 21-24 of 18 cores, mica was higher): go test ./internal/usage ./internal/usageapi, the gateway and gui purpose tests, go vet for darwin, linux (nogui) and windows, gofmt; the GUI files usage-big-write (new), purpose-filter, routing-kind, i18n-keys and usage-ledger in chromium and webkit. Broken by hand: inferredKind returning "" turns TestClaudeHelperRequestsAreLabelled red; the larger-than test of BigWrite.add turned round turns TestRequestPageBigWrite red on both paths; the jump off turns usage-big-write red. Not tried: a real Claude Code session against a live subscription, Linux WebKitGTK. |
||
|
|
da169135a0 |
usage: an empty page says session files aren't read yet, and allows them (simonzyzy on X)
Claude Code's and Codex's sessions, and each call's tokens and time, need no provider: with the consent given, a sandbox HOME with no providers lists both agents' sessions and /api/usage/requests returns their calls (source log, ms, tokens). The only gate is sessions/reads asked=false, which the Sessions page asks but the Usage Overview and Requests pages did not mention; they said to point an agent at a catalog model. Now they say the files aren't read yet and offer one button that allows the agents found. The Sessions page says live output speed is measured only on gateway requests and where the files' own figures are. |
||
|
|
50ce30d56e |
gui: times follow the system's 12 or 24 hour clock (iXerol on X)
An en-US Mac set to 24-Hour Time showed Routing's request times in 12
hours: no webview hands the page the system's clock, and navigator.language
carries only the region. boot.js now says it as hourCycle ("h23" or "h12",
left out when the system names none, and for a browser tab, which keeps its
own): macOS from AppleICUForce24HourTime / AppleICUForce12HourTime, Windows
from Control Panel\International sTimeFormat, Linux from gsettings
clock-format. intlLang() adds -u-hc-<cycle> to its tag, so every formatter
that takes it follows, and the places that forced 24 hours (hour12: false,
hourCycle h23) spread hourClock() instead: 24 unless the system says 12.
Read once per 30s, so a change in System Settings shows at the next load.
Run on mote: new hc-clock.test.cjs (en-US on a 24h system, en-GB on a 12h
one, a silent system), chromium and webkit; Go tests for the three readers
and boot.js; gofmt; go vet darwin, windows and linux nogui; internal/gui
tests; GUI files of gui-*, i18n-*, panel-*, quota-*, reset-*, routing-*,
usage-* in chromium and webkit. TestCoreScriptBudget was over by 77 bytes
and passes with two app.js comments cut, no raise.
Broken by hand: hc-clock goes red (2 of 3) without the intlLang suffix.
Not tried: a real Windows or Linux session's setting (the readers are
unit-tested on their formats), a live Mac.
|
||
|
|
31f75dddac |
i18n: de and ja say a placeholder once where their English key does
8a3dbf023's accounts-list sign-in line had {agent} twice in de and ja, and the
Usage plugin's model-price line had {model} twice in ja. gui-de and gui-ja
'has every zh string, with its placeholders and tags' were red on origin/main
|
||
|
|
88c417392e |
usage: a sortable model speed ranking on the Requests tab (@flying_crp on X)
Usage's Requests tab gets a "Model speed" card: per model, the median output tokens/s, the median wait for the first token and the request count, over the selected range, sortable by every column (aria-sort header buttons, quiet table, no gradients). A request counts when it was answered (not rejected, handed on, failed or canceled), its first token was timed and it wrote 100 tokens or more (usage.MinRankTokens; the tooltip says so). Computed locally: each chunk keeps a 2% log-bin histogram per model beside its cells (speed_rank.go, chunkPart.speeds), a page merges the chunks' histograms, so there is no per-request sort and medians are within ~1%. The settled chunks' histograms are in the page file; its key salt is now page-v2, so the first load after upgrade recounts settled history once. /api/ledger sends speeds and speed_min. Run (mote): gofmt clean; go vet darwin, linux nogui, windows for the touched packages and ./... earlier; go test internal/usage, internal/usageapi, internal/gui ok at this head; usage-model-speed.test.cjs 12 of 12 (chromium and webkit, en/zh/zh-TW/ja/de, 400px: order, sort by every column, aria-sort, focus kept, no horizontal overflow, ellipsis, hidden when empty); with i18n-keys and i18n-en-no-cjk 20 of 20; the whole GUI suite once on the branch before the rebase: every red is in a file unrelated to this change (account-arrange #6010, account-refresh-holds #5814, account-eye #5052, agent-switch-accounts #5925, bulk visibility and disconnect previews #5982 fixed in |
||
|
|
ae449f8e4f |
gui: the sidebar's tab lists give each tab a mark of its own
Library's, Usage's, Plugins' and Settings' tabs, listed under their page
in the sidebar (navSubs), were names alone while every page above them
has an icon (the owner, with a screenshot of Library's list). Each tab
now has a 14px line mark before its name, from NAV_SUB_IC by page and
tab id: segs gives its buttons data-seg (Usage's own strip too), and
Settings' tabs have data-set. A tab with no mark (none today) keeps an
empty slot, so the names stay in one column. The mark is muted, and
takes the row's ink when the row is hovered or picked.
The marks are in navicons.js, imported with the first list drawn, which
then draws again with them. Its one line in app.js is paid for by two
navSubs comments cut, so the core's script budget is not raised
(1,533,751 of 1,533,802).
German's longest Settings names ("Synchronisierung und Backup") were
cut with an ellipsis at 1100 before this; "Netzwerk und Freigabe" now
is too (7px). Left as is: shortening the word would change it in five
other German sentences that name the tab.
Run:
- nav-sub-icons.test.cjs (new): every row of the four lists has its
mark, 14px, before its name and level with it, one column per list,
names whole (not German); en zh zh-TW ja de, Chromium and WebKit, on
WSL (magpie-desktop): 12 of 12. Red with Library's memory mark taken
out by hand ("library: Memory has a mark").
- go test ./internal/gui on Windows: 8 reds, the same 8 alone on
origin/main
|
||
|
|
40ca0c88de |
gui: a model's price is set from the Usage page (soilzhu80 on X)
A model an agent runs is often in no provider's list, so no provider's
Model settings could price it. A model's row on the Usage page (its "…"
or a right-click) and its bar in the Sessions tab's Models card (a
right-click) now offer "Set price…": a sheet with input, output, cache
read and cache write in $ / 1M tokens, the maker's list price greyed in
the empty boxes. It sets the model's price from any provider (*/model),
the key `magpie model price '*/model'` writes, through GET/POST
/api/model-price (modelprice.go). A provider's own price for the model
still comes first. Restore default takes the price away. Sessions' stats
are forgotten on a save, so past calls are counted at the new price too.
A Sessions bar prices the id after its last "/", the id sessions'
priceOf looks up.
Run (mote): go test -run ModelPrice ./internal/gui; node --test
usage-model-price (chromium + webkit, 420px wide, en/zh/zh-TW/ja/de),
usage-clear (its menu now has Set price… above Clear usage…),
i18n-keys; gofmt -l; go vet ./... for darwin, linux -tags nogui and
windows.
Broken by hand: SetModelPrice skipped, TestModelPriceFromAnyProvider red
("set: 200 {Price:<nil>}"); Set price… taken out of the row menu,
usage-model-price red.
Not tried: a real gateway call priced after setting it in the real app.
|
||
|
|
662546e78d |
usage: a cache hit rate reads 100% only when all of the prompt was cached (ZhangXiaof48473 on X)
Routing's request list showed "缓存 100%" for Codex requests of 77.5K
tokens that read 77,200 of them from the cache (99.6%), beside rows at
99%, and the route line said "请求缓存命中率 99%". Every hit rate was
Math.round(100 * h) + "%", so anything from 99.5% up read 100%.
One formatter now says every hit rate: hitPct(h, d) in app.js, whole
percents (d decimals) unless rounding would say 100% or 0% of a prompt
not all or none cached, then one or two decimals (99.6%, 99.95%; never
past 99.99% or under 0.01%). Its callers: Routing's request rows, their
route line and a session's Avg. cache (plugins/routing/client.js); the
tray panel's Cache hit rate and the ranking rows' hit rate (app.js); the
Usage page's tiles, agent rows, Requests table, request detail and its
KPI strip, which keeps its one decimal (plugins/usage/page.js); the
context card's Prompt cache and the session traits Cache-friendly,
Cache misses and Cache hit (context.js). The TUI's and CLI's sessions
line, which floored the integer, use usage.HitPct, the same rule in Go;
it rounds now, so the TUI test's 67% (25.2K of 37.3K, 67.6%) reads 68%.
No new strings; app.js pays its bytes with six ledger comments cut, so
the core scripts are 15 bytes smaller than at its parent, no raise. Main
is over the core budget already (1,534,476 > 1,533,802 at the parent,
#5918); this commit doesn't add to it.
Run on mote:
- new internal/gui/tests/cache-hit-pct.test.cjs (Routing rows 99.6% /
100% / 99%, the route line, hitPct at its edges) in chromium and
webkit, en and zh: green; with the escalation line removed by hand,
red (99.99% where 99.6% is wanted).
- cache-hit-pct, panel-usage, context-window, i18n-keys, usage-ledger,
tray-totals, ctx-route, ledger-cache-hit, usage-hit-rate,
routing-request-metrics (both engines; ledger-cache-unknown and
ledger-cache-tokens in an earlier run): 186 pass, 6 red, all in
usage-ledger's 'newest live route needs no return-to-live button',
red the same on origin/main
|
||
|
|
add47afd82 |
usage: a card's ⋯ opens its menu, Hide from Overview where it is seen (jen_celeus on X)
jen_celeus asked to hide providers with no usage information, OpenCode
Zen and the like, from Usage. The hide was already there
(UsageCardsHidden, Hide from Overview, the "n hidden" line with Unhide
and Show all), but it sat behind a right-click, a long press or the drag
handle's menu, and nobody found it. Each card's head now has a ⋯ button
(quotaCardMore), the Agents row's pattern: shown on hover and keyboard
focus, always shown where nothing hovers, opening the same menu
(quotaCardMenu, now anchored on the ⋯), a second click closing it. On a
phone it keeps 22px with a 44px-high hit area that stops at the card's
edge (an even -11px inset spilled past it: usage-accounts-fold,
usage-keys-fold and usage-shared-balance said "card spills"). The long
press leaves the ⋯ alone. Its label reuses "Actions for {name}", already
in every language.
Run (mote): usage-card-more.test.cjs (new: Claude beside a Zen card with
a plan and no windows; en, zh, zh-TW, ja, de at 1200, 560 and a 390 web
phone; chromium and webkit): the ⋯ is there with its label, hidden at
rest where hover is, shown on hover, never over the head's text where
nothing hovers, menu = Hide from Overview, toggles, the hide posts
{cardsHidden:["opencode-zen-free|plan"]}, no scroll, the "1 hidden"
line's Unhide brings it back, no page errors. The 154 GUI files that
load the Usage page plus i18n-keys, both engines: see the next commit's
record. gofmt; go vet darwin, linux -tags nogui, windows;
go test ./internal/gui/ (budgets) ok.
Broken by hand: without head.append(quotaCardMore(...)) the new test is
red in every subtest (chromium 0 of 16).
Not tried: the real app's WebKitGTK and Windows WebView2 windows; the
web page on a real phone.
|
||
|
|
ca5e537ecb |
usage: traffic over time in Requests' chart, and how fast it flows now (songlairui on X)
songlairui on X asked for the gateway's bandwidth: many LLM calls, base64
images above all, weigh on the network. Each request's row already kept
its bytes up (UpBytes) and down (DownBytes), shown in its details and as
the period's "↑ · ↓" under the Requests card. What was missing was
bandwidth over time and right now.
- The Requests chart's metrics take Traffic: each hour's/day's bytes up and
down, stacked by model, provider or agent. Its axis is in bytes ("4 MB"),
its tooltip splits a column into "↑ up · ↓ down", and the ranking's
values are bytes with the same split under each. A period with none
says "No traffic counted in this period". A chart point's Part now
carries up_bytes/down_bytes, from rows (Part.add) and from the request
page's cells (Part.plus). The cells already kept Totals, so no cache
version bump is needed.
- While requests are in flight, the Requests card says how fast traffic
flows now: "↑ 1.0 MB/s · ↓ 40 KB/s", over the last ~3s, read from the
new GET /api/usage/traffic a second apart. That route reports the
gateway's running totals (Server.Traffic) and its requests in flight.
The totals are atomics added where a row's bytes are added (sentUp,
downCount.Read). So a stream counts as it arrives, nothing is buffered
or scanned, and the totals and rows count the same bytes once. Polling
runs only while Usage → Requests is shown and the window is visible.
The line goes when nothing is in flight and nothing flowed. When another
magpie serves the gateway, the route answers {} and the page shows no
rate.
A Codex turn on the Responses WebSocket (
|
||
|
|
98c4b2e814 |
usage: a request opens on a page of its own
geesehowardt7 on X clicked a request on the Usage page to see where it came from. The click on its time opened Routing, which they hadn't asked for, and the row's details had no source address. A row's click, or Enter or Space on it, now pushes that request's own page (#ledReqPane, ledReqOpen/renderLedReq) over the list. The page gives the model and status, then ledDetail: time, agent, source IP (the previous commit's client_ip: loopback reads "This computer · 127.0.0.1", a gateway row from before the field "Not recorded", rows read from session files, other computers and magpie's own calls none), requested, provider, account, sent, served, effort, then status, error, duration, tokens, cost, credits, speed and the archive. Routing is the View routing link in it, and the time cell no longer links there. "Requests ‹" or Escape (not while a menu, dialog or field takes it) goes back to the list where it was left, with the row focused (ledReqClose). Leaving the Usage page closes it (ledLeave(true)), and a refresh keeps it. The in-table expanding row (ledOpen, tr.led-detail) and its narrow-window lc-opt copies are gone, since the page shows every field at every width. It slides in 200ms with the ease-out curve, and only fades with reduced motion. "Source IP" and "Not recorded" are added in zh, zh-TW, ja and de. The 20 ledger test files that opened a row's details now open the page. usage-request-page.test.cjs covers the page, the address, the way back, focus and a 560px window. docs/subsystems/gui-shell.md describes it. Run at this commit's tree (rebased on origin/main |
||
|
|
7c1dc198d1 |
usage: a turn over the Responses WebSocket counts what the socket was sent, and says so
A Codex turn kept on a Responses WebSocket sends only the new items as a
delta, but the row's ↑ was the whole HTTP body magpie built before the
transport ran, so a long conversation read as ~13MB up per turn
(matrix0487 on Discord). overSocket now records what each socket write
carried (wroteSocket) and, when the turn went out on the socket alone,
replaces the HTTP figure with those bytes (sentOnSocket); a turn that fell
back to HTTP keeps the HTTP body and adds any socket write made before the
fallback. errCodexSocketAgain's retry on a new socket counts both writes.
The row remembers that it went over the socket: Record.Socket (json "ws"),
packed as Flags bit 16384 (rowSocket, added to TestRowFlagsApart). The
Requests table's protocol badge says "Responses · WS" and the details'
Protocol line "Responses · WebSocket".
Run on mote at this commit (rebased on origin/main
|
||
|
|
9d4c338a67 |
gui: magpie web on a phone no longer scrolls sideways or keeps a band at its foot (#4943)
precis1onz (iOS Safari, dark, English, Usage) saw the page move sideways
and a dark band stay at the screen's foot.
- Sideways: Usage → Requests' "Split by" row (label and five choices) is
one unwrapped span, 393 to 558px wide at 375 to 430px. It was the only
thing wider than a phone in any view or language. On the phone layout
it now wraps inside the screen (app.css, phone block only).
- The band: the Requests table's stand-in scrollbar (#799) is sticky at
the view's foot, and a touch screen draws no bar in it, so it stood
there as an empty 12px band. ledHScroll now leaves it hidden on
(hover: none) and (pointer: coarse); a finger moves the table itself.
A desktop keeps it as before.
New test, phone-no-sideways.test.cjs: every view (Agents, Sessions,
Providers, Routing, Groups, Gateway, Library, Plugins, Masking, each
Usage tab, Settings' tabs) on an iPhone at 375 in en, zh, zh-TW, ja, de
and at 390 and 430 in en, in Chromium and WebKit, with long ids, emails
and paths; nothing may be wider than the screen and no empty band may
stay sticky at a view's foot. ledger-swipe now expects no bar on a
phone, and that the swipe moves the table.
Run (mote, through mote-run):
- phone-no-sideways: red on the old assets (
|
||
|
|
a8aeb2cad2 |
usage: picked days can start and end at a minute
blrbrzkj on Discord asked to see usage from one time to another, not only whole days. The range menu has a start and an end time under its month (empty is the whole day; 9:30, 0930 and 09:30 all read 09:30). Picked with the days, the period is "2026-10-01T09:30..2026-10-01T18:00"; Enter applies new times to the days already picked. A time that isn't one, or an end not after the start on one day, is marked and asks for nothing. The opt says "Oct 1 09:30 – 18:00". The backend reads either end as a date or a date with its minute (usage.RangeOf, bounds); an untimed end is its next midnight. A timed range of 48 hours or less is drawn by the hour from the first's hour. CSV names drop the colons. Run (mote): node --test usage-range-times (new, chromium + webkit, en + zh), usage-range, i18n-keys, credit-days: 26/26 ok. go test ./internal/usage ./internal/gui ok (TestCoreScriptBudget fits, the periodDays comment cut to pay for its regex); gofmt clean; go vet native, GOOS=windows (usage, gui), GOOS=linux (usage) ok. Broken by hand: a timed end read as its day's midnight turns TestPickedMinutesArePeriod red. The page's own typedTime first clashed with app.js's hhmm and stopped the Usage page mounting; the GUI run caught it. Not tried: the real app with a real ledger; ja/de/zh-TW screens. Reported-by: blrbrzkj (Discord) |
||
|
|
3d49ac069e |
usage: a 24 hours period, and the period picked is kept
The Usage page's periods were Today, 7 days, 30 days and All. "Today" starts at midnight, so early in the day it shows almost nothing (mahiro233 on Discord). A "24 hours" period now sits after Today and asks the server for its rolling window, last:24h (#2075), with an hourly chart. Its empty state says "No calls in the last 24 hours." (en, zh, zh-TW, ja, de). The menu bar's credit days count it as 2. The period picked from the list is kept in localStorage and the page opens on it next time. Picked day ranges aren't kept (they go stale), and neither is a period the URL brings (?period=7d from the menu bar). Tests: usage-24h.test.cjs (new; Chromium and WebKit, en and zh, 900px): 24 hours sits after Today and asks for last:24h, its empty note, a reload opens on the kept pick, ?period=7d is not kept. Five usage tests counted the period list by index and were moved one along. Run on mote at |
||
|
|
ecc16fe979 |
usage: the quick panel and the Usage page word unpriced calls alike
The quick panel's Cost said "15 个没有价格" while the Usage page's
said "15 次调用没有已知价格,未计入". Both now say "{n} calls unpriced"
("15 次调用未计价"), as the page's other cost heads already did, with
the whole sentence on hover.
Reported-by: tenacious_eagle on Discord
The Usage page's plugin already had the two count keys; they live in the
core's i18n.js now that the quick panel says them too (i18n-keys: no key
twice, a plugin's words are its own). The Overview calls tile says the
same words, so usage-unpriced-sum's tile wording follows.
Run on mote at origin/main
|
||
|
|
92be1d779b |
usage: the allowances' head opens Settings › Allowances
The Usage page draws the allowances, but how they are shown (used or
left, the menu bar's figures) and their alerts are set in Settings ›
Allowances, and nothing on the page said so (the scattered settings
audit after netube99 on X). The allowances' head now has a Settings ›
link, as the Routing page has, that opens that tab and lights the
Allowance display row (now #quotaLeftRow). Wired in the usage plugin,
so the core script doesn't grow.
Run (mote, through mote-run, Chromium and WebKit, every language, 1100
and 420): settings-places, mobile-web (with an origin/main baseline;
the button is taken out until the baseline has it, as rtToSet is),
account-mask, quota-curve, i18n-keys: 89 of 89, twice. A first run had
one red whose name a tail cut off; the next two runs of the same files
were 89 of 89, so it is unnamed and not seen again.
Broken by hand: no onclick, settings-places 2 of 2 red (no row lit);
no #quotaLeftRow, 1 of 1 red.
At the pushed head (rebased on
|
||
|
|
54af4357c3 |
usage: the agent filters show each agent's icon
The owner: Usage › Requests' agent menu listed names alone ("这里应该有
Agent的icon"). The ledger's agents already carry their icon (usageapi
Named.Icon), so the menu now draws it beside each name: an agent's own
logo, the generic one for a client magpie doesn't know (AsyncOpenAI,
Go-http-client). Sessions' agent menu does the same, from a session's
icon or, for an agent with none listed, the agent magpie knows. The
shared menu (openSessCombo) draws icons only when its options carry
them, and keeps the room blank on the All row, so every name starts at
one x; the other filters (models, folders, providers...) are unchanged.
usage-agent-filter-icons.test.cjs opens both menus in Chromium and
WebKit, en and zh: each row's icon, the All row's blank room, names at
one x, each icon on its name's line, and the search narrowing them.
Run (mote, at
|
||
|
|
f418edffc3 |
sessions: a session's details show how full its context was, request by request
liang_yongxiang on Discord: Routing tells how full one request's context window was; does Sessions have the same, each turn's share? A session's details on the Sessions page (and in Usage's Sessions list, which draws the same details) get a Context line when the gateway sent calls of it (s.via): the Context tab's spark of its prompts, request by request against its window, and the fullest one's share beside it, toned as the tab tones it. A point's tip says "Request 2: 80K of 200K (40%)" (the tab's spark says it too now, where the window is known); a point clicked opens that request in Routing with its card. A session the gateway never saw asks nothing; one it kept no prompt of shows no line. The data is the routing history the Context tab already reads. A new GET /api/context/session?agent=&id=&from=&to= reads only the days from the session's first to its last (30 at most), through the tab's per-day cache (daysRecsLocked, split out of contextRecsLocked, so the tab's cached days are not evicted), and keeps that one session (contextOfRecsFor), with up to 1000 of its requests. The tab keeps the latest 80 sessions and would leave an older one out. Subagent and side calls are left out as the tab leaves them out; the same id under another agent is that agent's. The line's code is in plugins/usage/page.js (sessCtxLine). context.js only exports spark and health, and pays for its tip by cutting comments, so the core's scripts are 10 bytes under main's, no budget raise. Run at this head (rebased on |
||
|
|
7a6211d047 |
providers: a model's own headers, in Model settings
axelburks on Discord: a vendor routes one model by a header of its own. A key's provider (built-in or custom) can give each model headers (settings.ModelHeaders["pid/model"]). They go on that provider's requests for that model alone, after the provider's headers and after auth: a name both have is sent once, as the model's, so a user's value is never overridden by the provider's or magpie's key header. The gateway names the model (provider.WithModel) on every route that asks one: chat on each API, translated and streamed, count_tokens, System One's decision, embeddings, images, videos and the model test. A fallback provider serving the same model id gets its own headers only. Accounts and plugins carry their sign-in's headers and take none. The editor's "Name, price and reasoning level" panel is now "Model settings" (every language), with + Add header per model, staged and made with the Save; Restore default takes them away. The rows being typed are kept out of the draft's compare, so an untouched editor still closes without asking. Broken by hand: dropping WithModel from gateway.go turns TestModelHeadersReachTheirModelOnEveryRoute red; dropping the provider id check in modelOf turns TestModelHeadersStayWithTheirProvider red. Run, on this stack over origin/main |
||
|
|
b77400826a |
usage: the Overview read again keeps its cards and its place, and shows it is reading
jiabubu on Discord: a refresh of the Usage page's Overview showed nothing while it read, flashed the page and dropped cards for a moment, and pressing Usage again while on the Overview flashed it or moved its scroll. - Pressing Usage again (show() calls the plugin's open, loadUsage(true)) put the skeleton up, which hid the sections, collapsed the page and clamped its scrollTop. loadUsage now puts the skeleton up only for a first read or another period or zone (usageFor/usageKey); a page that already shows that read reads again quietly through refreshUsage, so nothing is blanked and the scroll stays. - The refresh beside the period turns while such a read is out (#usageReload.reading, after 200ms), and while every card is read (loadQuotas) each card's refresh turns (#subscriptionUsage.reading, quotaReading in page.js). A card's own busy turn is left to its own animation (:not(.busy)). No turning under reduced motion. - renderQuotas draws the cards again in one go, as their reset countdowns need, but now keeps their logo nodes (keepIcons), and the Overview's lists do too: a logo made afresh blinked out while its picture loaded. - app.js stays in its budget: a three-line comment in renderQuotas cut to one. Core 1,533,507 of 1,533,802 before the rebase on |