ac4af582301a4e8a29245dbba767eba31334ddf9
13
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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
|
||
|
|
84da86ebd5 |
gui: Hide accounts is one switch for every page, window and the panel (paultian)
paultian on Discord (#feedback): Routing, Usage and Providers each kept their own "Hide accounts" state, so turning it on in one page left the others showing emails. Now window.hideAccounts is one switch, one localStorage value (magpie.maskEmails), behind #rtMask, #usageMask and #pvMask alike. Flipping it in any page applies to every page at once, and a storage event carries it to other windows and the tray panel. The old magpie.maskProviders value is folded in on first load (hidden if either value was on) and then removed, so nobody who hid accounts on one page sees them shown after updating. The tooltip and the Settings line now say "on every page" instead of "on this page", in every language. Tests: provider-mask.test.cjs checks that one switch hides accounts on every page and in a second window, that the state survives a reload, and that an old maskProviders=1 comes through as hidden. account-mask's expected tooltip text is updated. Run on mote (GUI files at base 05aba5ca4; the Go asset/budget tests again at this head after rebasing on |
||
|
|
457cfd7c63 |
usage: a phone's head is the tabs over one line of days, sum and refresh
The owner's pick of three phone designs (B): Usage's tabs run across the
head, and under them one line holds the days as a menu ("7 days ⌄", the
app's own menu, never a <select>), the sum, and the refresh as a dot and
its figure ("● 5s", green while live). The days strips (#period,
#sessRange, #ctxRange) are hidden behind the menu. It follows whichever
the open tab shows, and a pick clicks that strip's option, so each choice
keeps its one handler; Custom opens the range menu from the head. Each
control is drawn about 30px and tapped at 44. A desktop window keeps its
strips. The refresh keeps its own menu and
its reload icon, unlike the mock-up, which had neither.
usage-phone-head.test.cjs checks the layout, the menu and the taps in
every language and both engines at 390 and 320px, and a desktop
window at 1100px.
Run (mote, at this branch's head after the rebase onto
|
||
|
|
f7a80bc904 |
usage: a Model filter beside the Provider filter on Requests (OHHHHHH05 on X)
OHHHHHH05 asked for 按模型筛选 next to the provider filter, with requests,
input/output tokens, cache and estimated cost for the range, gateway and
session-log calls alike. Usage › Requests could already be narrowed to a
model, but only by clicking it in the chart's ranking or typing it in the
search box. Now it has its own filter, after Provider, in the app's menu
(sessPick/openSessCombo, no <select>). It lists the models the other
filters keep, by tokens (/api/usage/requests' by.model, which is counted
without the model's pick). Picking one sends model=, which the server
already applied to both sources, so the sum line (requests, in, out,
cache read/write), the cost head, the through/not-through-magpie cells,
the chart and the rows are all that model's. All models clears it. A
pick made in the ranking shows in the filter too. No API change, no new
strings ("All models", "Model", "{n} tokens" are already in every
locale), app.js untouched (the plugin's page.js only).
Run (at
|
||
|
|
75a7db27b9 |
usage: an allowance card can be hidden from the Overview (whqtian_07012 on Discord)
whqtian wanted StepFun's plan card on Usage › Overview without its
balance card. Right-click a card (or long-press it on a touch screen)
and the app menu offers "Hide from Overview". With several accounts on
one card it says "Hide this account from Overview". A plan card that
carries its key's balance also offers "Hide its balance from Overview",
which keeps the plan. Each hidden card is saved as its tray card id plus
its kind (stepfun|balance, kimi|me@x|plan) in settings.UsageCardsHidden,
through POST /api/usage/arrange (cardsHidden). The Settings save keeps
it. Under the cards, a quiet "{n} hidden" line opens them, each with
Unhide, and Show all from two. It is the same pattern as the Agents
list's hide.
Display only: routing, caps, counting, the Accounts list, the tray
panel's Allowances (it has its own Arrange) and the menu bar cells
never see it. A cell clicked for a hidden card shows it until the page
is left (usagePeek). UI: the app menu, not a native select, no
coloured stripes, no new button on the cards.
Run at this head (rebased on
|
||
|
|
11cbf4de1d |
usage: Sessions' agent filter is a menu, as the model and folder ones beside it
The owner (10-28, screenshot of Usage › Sessions with 13 agents in a strip across the page): "这应该是个 Combo Box". The agent filter was a segmented strip, one segment per agent in range, that scrolled sideways in itself once it ran past the window (#929). It is now the same sessPick button as 全部模型 and 全部文件夹, with the same searchable menu: "All agents", then every agent with sessions or usage in the range, the most used first, each with its tokens under the other two filters. One agent in range still leaves it hidden; the pick still resets to All when its agent leaves the range. The request ledger's agent filter was already this menu. #sessAgent left the CSS rules for scrolling strips; the strip's own test (sess-agent-strip, #929's sideways scroll) is gone with the strip, and usage-sessions-agents-fit now checks the menu: no sideways scroll at 860 and 560 wide, the three filters on one line inside the window, the menu's order, search, a pick shown on the button and kept when the page is drawn again, All clearing it, one agent hidden. sessions-empty-range and sessions-overview-once pick their agent from the menu. Run on mote (node 22, Playwright 1.62.0): - usage-sessions-agents-fit, sessions-empty-range, sessions-overview-once: 24 of 24, Chromium and WebKit, every language they cover. - usage-sessions-agents-fit against origin/main's page.js, client.js and app.css: red in all four (BUTTON.sess-pick expected, a div of segments). - go test -tags nogui -run Budget ./internal/gui: ok. - 122 other GUI files that touch Usage, sess-pick or i18n, concurrency 3, beside another session's full GUI suite (load 36-75): 1944 pass, 24 fail in gateway-caller-keys, gateway-key-cycle, i18n-keys, mcp-oauth-app, usage-ledger and web-page. Rerun alone at concurrency 1 on this tree and on origin/main ( |
||
|
|
012c584cc1 |
usage: clear a model's usage, or all of it, from the Usage page
CrazyMouse_TT on X asked for a way to clear usage, all of it or one model's, to measure a local model fresh after deploying it. The Usage page's Models list has a "…" on each row (and a right-click menu) with "Clear usage…", and "Clear all usage…" sits under the lists below the "Counted from…" note. Each asks first, in a confirmation that says what is deleted, that it can't be undone, and that key spending limits and allowances still count the calls. A clear is a mark in settings (usageCleared: provider, model, unix ms), read at read time; usage.jsonl is never rewritten. The Overview hides calls up to the mark in summarizeFrom; the Requests page, heatmap and ledger/CSV hide them in Filter.keepsRow, their one choke point, and the request index's meta carries the marks so its cache is dropped. Key budgets, window holds and Codex reads go through usage.Visit and the raw log, so a clear never resets a key's spending limit or a quota. A later clear of the same model or of everything takes the place of an earlier one. The marks ride the settings part of a sync (sync-backup.md) and a save of the Settings page keeps them (api.go's keep list; the guard test TestSettingsSaveKeepsWhatItDoesNotSend caught it missing). gateway-sessions.md and sync-backup.md say so. Run on mote (mote-run) at this tree, rebased on origin/main |
||
|
|
396e0e4638 |
usage: a deleted provider's requests merged into another, or named, from the Requests filter
CyberCaius on Discord: a deleted provider's requests sat under its old id
("<date> 已删除"), and the only way to put them under a provider they
have was renaming that provider onto the old id. Now, with a deleted
provider picked in Usage › Requests' Provider filter, a "…" beside it
offers Merge into… (an app menu of the providers there are now) and
Rename… (the filter's button turns into a name field; Enter or leaving
it saves, Escape keeps it). With the merged-into provider picked, the
same "…" lists Separate <name> for each, the undo.
Nothing in the log is rewritten. Both live on the deletion's own record
in providers.json (Deleted.Into/MergedAt, Deleted.Label), so a provider
added later under the old id inherits neither: it is a different
provider, and its record of its own is what it has. Renaming the target
carries the merge (Rename rewrites Into); deleting the target ends it.
Renames.Both(id, time) gives the id a call is shown under and the one it
was made to (Own). Listing, filtering, the summary and vias go by the
shown id; pricing (Record.priceID, block_price's as), window holds and
the gateway's loggedAnswers go by the own one, so a merge moves no cost
or token, only whose name they sit under. The target's face lists what
was merged into it (Named.Merged). Routes: GET /api/usage/deleted/into,
POST /api/usage/deleted {id, into?, name?}; a field not sent stays.
Run (mote, at this tree on
|
||
|
|
1c617c1532 |
usage: the Requests chart can be drawn as lines, kept per viewer (molvqingtai, Discord)
molvqingtai asked on Discord for the request chart on Usage > Requests to be a line chart. A small two-icon switch (bars, lines) now sits in the chart's header row beside the Token / Cost / Requests / Speed tabs. Bars stay the default. The choice is kept in localStorage magpie.ledChart, next to magpie.ledMetric; any other value, or a read that throws, gives bars. Lines cover every tab. Tokens, cost and requests draw the stacked totals as cumulative lines with a faint band per model and "other" last, so the top line meets the stacked column's top. Speed draws a dashed all-models line and each model's own line, broken where a model has no value. Tooltip, day pick, ranking hover (it now strokes a series instead of filling it), the time-zone handling and the empty state are the columns'. drawLedColumns in core app.js gets one hook, box.drawn, which the Usage page sets; the line code lives in plugins/usage/page.js. The tray panel's chart is unchanged (bars). app.js is 1,343,276 bytes, under TestCoreScriptBudget's 1,343,324; the budget is not raised. New test usage-chart-line.test.cjs (en, zh, zh-TW, ja, de x light, dark x 1180, 420): bars by default, translated labels, the switch inside the header with no sideways scroll and no left border, a click doesn't scroll the page, lines still chosen and drawn after a reload, the top line within 1px of the column top for tokens, cost and requests, speed's dashed line and broken runs, tooltip and ranking hover, the empty state; a "pie" value and a throwing getItem give bars. Run at |
||
|
|
f73378365f |
gui: a filter a click set on Usage's Requests goes when they are left (TJHHHH on Discord)
TJHHHH: after a jump to Codex's requests on the Usage page, every later
visit listed only Codex's. The Requests' filters are module state in
plugins/usage/page.js and nothing ever reset them, so a click on Codex in
the ranking split by agent stuck for the app's lifetime.
Now a filter a click lent the Requests (a ranking click on an agent,
provider, model or gateway key, a chart day, the address's ?agent= and
the like, a route from Routing) is remembered in ledLent and given back
by ledLeave when the reader leaves the Requests: for another Usage tab
(renderUsageTab), or another page through a new page hook, `leave`, that
show() calls on the page it leaves. A filter picked in its own menu or
typed in the search stays, as a menu choice does in a Mac app. A route's
saved filters keep their lent marks, and leaving with a route on gives
back the route too. Docs: plugin-runtime.md's Usage hooks.
Siblings judged and left: the tray panel's Usage tab ranking (its own
view, not the page's Requests), the Sessions reveal (per agent, no "all"), the KPI
failed/retried jumps (shown in the status segment, read as own picks).
Test: tests/usage-ledger-leave.test.cjs, chromium and webkit, en zh
zh-TW ja de: ranking click leaves for a page and for a tab, menu pick
stays, ?agent= goes, a route goes. On the old app.js/page.js/client.js
it is red, 20 of 25 in chromium ("back from another page: last asked
period=today&agent=codex"); only the menu-pick case passes there.
Green with the fix, in both engines.
Run at
|
||
|
|
b9f790d37b |
plugins: panels in magpie's pages, a page that replaces a built-in one, titles in the window's language, and a look that matches
P5 of the plugin runtime (docs/subsystems/plugin-runtime.md):
- Panels (magpie.panels): a plugin draws a frame into a slot of a
built-in page (a provider's editor, Settings, Usage); magpie.context
says where it is, and the frame is as tall as what it draws.
- A page can replace a built-in one (magpie.page.replaces); show() opens
it in that page's place, and the sidebar row goes to it.
- page.titles and a panel's titles name it in the window's language
({"zh": …}); a malformed map is dropped, the title kept
(TestWindowTitles).
- main's #2501 already names wails:// in the policy of a page in the
desktop window (through ownWindow), which is why the usage page drew as
bare HTML from v0.1.1259. TestPluginPageLoadsItsFilesInTheWindow loads
a page through ownWindow in a real WKWebView, which Playwright on http
can't; the subsystem page says how.
- The bridge adds magpie's look for what a page leaves unstyled, every
rule in :where() so any rule of the page's wins, and the theme's
colours as --magpie-* variables.
One commit: the panels, the replacing pages and the titles share hunks
in page.go, pluginpage.go, pluginpages.js and the docs, and couldn't be
split cleanly.
Run:
- Full: this series (P5, the Plugins dot, the probe test, P6, and a
built-ins-on commit since dropped for main's own
|
||
|
|
d6b045a7e7 |
usage: the Overview's lists fold under their headings and stay folded, the token totals can count the cache, and the Requests Tokens card wraps its cache count instead of cutting it (#2378)
The reporter asked for three things on the Usage page: fold Agents,
Models and Accounts from their titles and remember it (日常看账号维度
较多,都要拉到最底下); an option to count the cache in the token totals;
and the Requests tab's Tokens card cut its cache count off on a wide
window ("缓存 879…").
- Folds: each Overview list's heading (Agents, Models, Accounts, and
Gateway keys beside them) is a .fold button with its chevron, the
Gateway page's pattern. A click keeps the page still (backToReader).
What is folded is kept per viewer in localStorage magpie.usageFolded
(mountUsageFolds at the plugin's mount, showUsageFolds per render).
- Cache: the tokens tile's label is a pop-up (usageTokensPick, the app
menu, no <select>) of Without cache / With cache, kept in
localStorage magpie.usageWithCache. With cache, the tile, the chart,
and every row's count and share add cache read and written
(usageTokens), and the tile says the cache's count. Default unchanged.
- Cut count: a token line in parts (the Requests strip's Tokens card,
the Overview's tokens tile) wraps between its counts and keeps each
whole (usageParts, .parts); only a count wider than its card on its
own is cut. The part spans undo .kpi span's label capitals.
- Strings in zh, zh-TW, ja, de. docs/subsystems/gui-shell.md bullet.
- mobile-web.test.cjs: until BASE_REF has mountUsageFolds, the
desktop Usage comparison puts the new fold buttons and the pop-up
back to their plain labels and compares the rest as before. That
comparison caught the tile's line in the label's capitals and 5px
taller; both fixed, and usage-overview-fold now checks them.
Run at this head (base
|
||
|
|
3c7ec4ba24 |
gui: Usage is a plugin's page, its code, markup and words in plugins/usage (P2)
P2 of docs/subsystems/plugin-runtime.md, the fourth page after Sessions,
Library and Routing, and the largest part of app.js.
- The Usage page's code (~3000 lines: the Overview's cards, the
Requests ledger and heatmap, the Sessions tab, the Agents list) moves
from app.js to assets/plugins/usage/page.js; its markup, index.html's
<main id="view-usage">, is client.js's part html. app.js 25756 →
22675 lines (1,355,376 → 1,198,239 bytes).
- page.js builds on app.js at the top level (its timers, ?view=usage's
tab and filters), so it is the one plugin script that loads after
app.js. index.html: kernel.js, the plugins' other scripts, app.js and
the scripts beside it, each page.js, then start.js, which is app.js's
old tail (magpie.start(), navHides, OPEN_VIEWS, the first page shown,
load()), so the first page has its code. TestBuiltinClientsLoaded
holds that order.
- Hooks: open loads it, refresh(again) is load()'s read of it, reload is
Refresh now, costs redraws costs on a currency change, tab says the
tab for focusQuotaCard. app.js calls those through magpie.call. The
allowance cards, quotasOpened, panelQuotaFocus and panelUseFocus stay
in app.js: the tray panel draws them too.
- plugins/usage: Essential, Requires window, no InUse. Off, its nav tab
goes and so do the ways to it (data-feature="usage": the panel's Open
Usage, Routing's View usage); show("usage") gives way to Agents; the
panel's Allowances tab stays. builtins.test.cjs switches it off and
checks each.
- The 173 strings only Usage says move to plugins/usage/i18n.js;
i18n.js 15032 → 14344 lines. "{n}s" and
"All sessions" stay: context.js says them too since #1591.
- context.js: with context.js now in before the first page is shown,
the page's open and load()'s first refresh both reached loadContext,
and the second drew "Reading…" again over the advice the first had
just drawn, so its curves never played their entrance (context-tune,
3 of 3 red). loadContext draws the waiting pane once for the same
days. Its dead last line, which loaded the tab once context.js came
in late, goes.
- context-window.test.cjs's "arrives after the state" becomes "loads at
once though context.js is slow": start.js now waits for it.
usage-stale-answer reads page.js beside app.js. quota-refresh-order
(#1630) cut app.js at the period picker's comment, now in page.js; it
ends at the next comment that stays (5 of 5; without keepRefreshedQuotas'
call, 2 of 5 red).
- docs: plugin-runtime.md, gui-shell.md.
Run, at this tree on origin/main
|