From 11cbf4de1d7b11e44f8b8a471dd7de892d0655f1 Mon Sep 17 00:00:00 2001 From: yetone Date: Wed, 28 Oct 2026 22:25:30 +0800 Subject: [PATCH] usage: Sessions' agent filter is a menu, as the model and folder ones beside it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (d4f1d6480, then c4972b36e after the rebase): the same reds on both. gateway-key-cycle is #4072, gateway-caller-keys #3797, usage-ledger's "newest live route" #4078, web-page's #gateway .dot #4079. i18n-keys' "masking…" was fixed on main in 174250b27. mcp-oauth-app passes alone on both. - At this tree, rebased onto 6ecc65b6d (the pushed tree): usage-sessions-agents-fit, sessions-empty-range, sessions-overview-once, i18n-keys and click-scroll 50 of 50, and go test -tags nogui -run Budget ./internal/gui ok. Not run: the whole GUI suite (another session's was running on mote). --- internal/gui/assets/app.css | 12 +- internal/gui/assets/plugins/usage/client.js | 2 +- internal/gui/assets/plugins/usage/page.js | 37 +--- internal/gui/tests/README.md | 22 +- internal/gui/tests/sess-agent-strip.test.cjs | 208 ------------------ .../gui/tests/sessions-empty-range.test.cjs | 7 +- .../gui/tests/sessions-overview-once.test.cjs | 3 +- .../tests/usage-sessions-agents-fit.test.cjs | 92 ++++---- 8 files changed, 81 insertions(+), 302 deletions(-) delete mode 100644 internal/gui/tests/sess-agent-strip.test.cjs diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css index f09edeed3..58965acb6 100644 --- a/internal/gui/assets/app.css +++ b/internal/gui/assets/app.css @@ -3083,19 +3083,19 @@ body.window .ag-sk-icon { width: 22px; height: 22px; border-radius: 6px; } which #929 left widening the whole page until its last agent's filter was only reachable by dragging the page sideways, and Plugins' kinds on GitHub, wider than a 420px window in Japanese */ -.segs.regions, .connect .segs, #sessAgent, .pm-ghbar .segs { max-width: 100%; overflow-x: auto; } +.segs.regions, .connect .segs, .pm-ghbar .segs { max-width: 100%; overflow-x: auto; } /* no scrollbar-width here: Chromium (WebView2) then drops every ::-webkit-scrollbar rule and draws Windows' classic bar, arrows and all, under the strip; the app's thin thumb instead, slimmer still */ -:where(body:not(.mac)) :is(.segs.regions, .connect .segs, #sessAgent, .pm-ghbar .segs)::-webkit-scrollbar { height: 6px; } -:where(body:not(.mac)) :is(.segs.regions, .connect .segs, #sessAgent, .pm-ghbar .segs)::-webkit-scrollbar-thumb { border-width: 1px; } +:where(body:not(.mac)) :is(.segs.regions, .connect .segs, .pm-ghbar .segs)::-webkit-scrollbar { height: 6px; } +:where(body:not(.mac)) :is(.segs.regions, .connect .segs, .pm-ghbar .segs)::-webkit-scrollbar-thumb { border-width: 1px; } /* on a Mac they scroll with no bar, as a Mac's own tab strips do: the system's overlay bar showed over the options' lower half for a moment after each scroll, and a click there went to the bar, which paged the strip sideways and picked nothing (#1620) */ -:where(body.mac) :is(.segs.regions, .connect .segs, #sessAgent, .pm-ghbar .segs) { scrollbar-width: none; } -:where(body.mac) :is(.segs.regions, .connect .segs, #sessAgent, .pm-ghbar .segs)::-webkit-scrollbar { display: none; } -.segs.regions .opt, .connect .segs .opt, #sessAgent .opt, .pm-ghbar .segs .opt { flex: none; } +:where(body.mac) :is(.segs.regions, .connect .segs, .pm-ghbar .segs) { scrollbar-width: none; } +:where(body.mac) :is(.segs.regions, .connect .segs, .pm-ghbar .segs)::-webkit-scrollbar { display: none; } +.segs.regions .opt, .connect .segs .opt, .pm-ghbar .segs .opt { flex: none; } /* a custom provider's five Base URL APIs wrap to a second row where the editor is too narrow for them (#1346); the thumb follows the row */ .segs.base-apis { max-width: 100%; flex-wrap: wrap; } diff --git a/internal/gui/assets/plugins/usage/client.js b/internal/gui/assets/plugins/usage/client.js index 31519a69c..b74feaa5a 100644 --- a/internal/gui/assets/plugins/usage/client.js +++ b/internal/gui/assets/plugins/usage/client.js @@ -105,7 +105,7 @@ magpie.plugin("usage", (ctx) => {