From b010fba05b211a5e1b88128c8fd6038e9357e7f2 Mon Sep 17 00:00:00 2001 From: yetone Date: Mon, 16 Nov 2026 14:05:59 +0800 Subject: [PATCH] gui: the pages go in the reader's own order, in the sidebar and a phone's tab bar (chet030714 on X) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Settings › General › Sidebar pages, where pages are hidden, now also puts them in order: a row is dragged by its grip (shown on hover, always on a touch screen), or moved with Alt+↑/↓. The order is kept for this browser in localStorage magpie.navOrder, beside magpie.navHidden. The sidebar and the header's tabs follow it at once, and a phone's tab bar (phonetabs.js) shows the first four with the rest under More. Providers is listed (it can be moved, never hidden). While the order isn't the home one the sidebar's group names (Work, Models, ...) are left out, since a reordered list breaks the groups; Default order (shown only then) removes the key and puts the pages and their names back. A page the kept order doesn't name (new in an update) goes after the page it follows at home. Plugin pages keep their place in their group. A reader who never reorders sees nothing change. navOrder and navArrange live in the new navorder.js, imported by navHides only once an order is kept (and by navpages.js with the menu), so what is left in app.js is that one line: +107 on both core budgets, explained there. old-webkit's list of on-demand scripts names navorder.js. Built on the unpushed WIP 10b9ee22c (page-order worktree), cherry-picked onto origin/main; the WIP test clicked the aria-disabled Providers row without force, and its reload checks now wait for the async import. Run: - nav-pages-order.test.cjs (new): Chromium and WebKit, en/zh/zh-TW/ja/de, 10/10 pass. Red on origin/main (no menu opens), 5/5 chromium. - The whole GUI suite (make test-ui) on mote at the first, inline version (navArrange ran on every start; the final version runs nothing new for a reader with no order), stopped after 4,171 ok / 171 not ok, none in a nav, sidebar or phone file. Five of the red files (agent-switch-accounts, gateway-key-arrange, first-untick, data-folder, api-key-theme) rerun on mica at this tree and at origin/main c1ab9a494: 34 pass / 56 fail on both. - At the final tree on mica: every nav*, phone*, side*, sidebar*, i18n*, last-page, menu-scroll*, settings-search and old-webkit file: 377 pass / 42 fail; the reds (menu-scroll, nav-timeout, phone-no-sideways, side-effort, old-webkit) fail the same at origin/main c1ab9a494, and last-page webkit's (two requests cut off counted as page errors, #5972's kind) passed 3 of 3 alone; go test ./internal/gui/...: ok. old-webkit's two reds are #6570/#6030 (navpages.js, headerpresets.js missing from its list) and #5919, the same on origin/main. Not tried: a finger drag on a real phone (the test taps the menu and checks the grip shows; the drag is the mouse path dragRows shares), and the real app's window (Wails); the GUI tests load the real assets. --- docs/subsystems/gui-shell.md | 2 +- internal/gui/assets/app.css | 18 +++ internal/gui/assets/app.js | 2 + internal/gui/assets/i18n.js | 4 + internal/gui/assets/navorder.js | 31 ++++ internal/gui/assets/navpages.js | 129 +++++++++++++--- internal/gui/core_budget_test.go | 4 +- internal/gui/tests/nav-pages-order.test.cjs | 155 ++++++++++++++++++++ internal/gui/tests/old-webkit.test.cjs | 3 +- 9 files changed, 325 insertions(+), 23 deletions(-) create mode 100644 internal/gui/assets/navorder.js create mode 100644 internal/gui/tests/nav-pages-order.test.cjs diff --git a/docs/subsystems/gui-shell.md b/docs/subsystems/gui-shell.md index cfe7b11e4..9ff4bf9fa 100644 --- a/docs/subsystems/gui-shell.md +++ b/docs/subsystems/gui-shell.md @@ -19,7 +19,7 @@ three. | The app's page in a browser | Settings › Network and sharing › Browser access (`renderWebPage` in `plugins/gateway/settings.js`, drawn with the Web pages rows) has the app serve its own page to a browser while it runs, so a tunnel (Cloudflare Tunnel, SSH) or a computer on the network can reach it without `magpie web` kept running in a terminal (jiakun_zhao on X). Off, This computer (`127.0.0.1`, which a tunnel's service points at) or Local network (every address; a "Not encrypted" row without `--tls-cert`). It is `magpie web`'s page and guard, not a second kind: `startAppPage` (from `Run`, after `startBackend`) serves `webServed` over a `Handler` of its own, whose `Windows` is `appWebHost` (a browser tab for `isWeb`, but not `ownWeb`, so the app's windows aren't taken for `magpie web`'s: `webPage` and gateway mode stay the app's; quitting quits the app, and a restart to update from it brings back the windows the app has up, `restartFrom`). The key is always asked for: no mode serves without it. It lives with the mode and port in `web-page.json` beside settings.json (0600, never in settings.json, so sync and backup don't carry it), is made the first time the page is turned on, kept across restarts (a browser's cookie stays good), and replaced by New key, which turns away every browser signed in with the old one (the guard is swapped atomically, `appPage.cur`). A file that can't be read, or names no known mode, is off and says why; Settings rewrites it only given a whole choice. A port another program holds (`magpie web`; the magpie before a restart to update) is said and tried again every 4 s (`appPageRetry`); the port must be 1024 up and not the gateway's. `GET/POST /api/web-page` are on the app's own windows' API only, never a browser's, so a browser on the page can neither read the key it came in without nor turn the page off under itself. `magpie web` on the port the app serves prints the app's link and opens it rather than starting a second (`gui.AppPage`, `samePort`). Sessions are warmed once a process however many `Handler`s there are (`warmOnce`). See `TestAppPageServesOnlyWithItsKey`, `TestAppPageWaitsForABusyPort`, `TestAppPageUnreadFileServesNothing`, `TestAppPageTurnsDownBadChoices`, `TestAppPageBrowserIsATab` and `browser-access.test.cjs`. | [`apppage.go`](../../internal/gui/apppage.go), [`web_cli.go`](../../internal/cli/web_cli.go) | | Another magpie in a window | Settings › Network and sharing › Another magpie (`renderRemote` in `plugins/gateway/settings.js`) opens a magpie elsewhere, a server's (`magpie daemon install --web`, `magpie web`, another app's Browser access), in a window of the app's own, so its routing and usage are read from the desktop (xuanwo on X). The window (`OpenRemote`, `remote_app.go`) loads that magpie's own web page with `?k=` and signs in through its `webGuard` as a browser does: nothing is served here, and the page in it reaches that magpie alone (a remote page gets no bound calls). The address is the link that magpie printed (its `k=` taken out as the key) or a bare address, https:// when no scheme is typed; plain http only to an IP, localhost, a `.local` or a one-word name (`remoteAddr`), as a Mac's webview allows, so the key never crosses the internet in the clear. Before the window opens, `remoteProbe` asks for the link without following it: only a 303 setting a `magpie_web_*` cookie is that magpie taking the key; a 401, a 403 (allowed addresses), an untrusted certificate, no answer or anything else is said in Settings. Address and key live in `remote-magpie.json` beside settings.json (0600, never in settings.json); `GET /api/remote` says the address and whether a key is kept, never the key, and `POST /api/remote` with no key uses the one kept for the same address. The routes are on the app's own windows' API only (`!isWeb`), and a host that can't open windows refuses. See `TestRemoteAddr`, `TestRemoteOpensTheOtherMagpie`, `TestRemoteNotMagpie`, `TestRemoteNotOnBrowserPages` and `another-magpie.test.cjs`. | [`remote.go`](../../internal/gui/remote.go), [`remote_app.go`](../../internal/gui/remote_app.go) | | The page | `app.js` keeps one state object per view and renders it into a list, with no framework. The views have their own files: `plugins.js` and `context.js`, and those a plugin adds under `assets/plugins//` (the Gateway, Sessions, Library, Routing and Usage pages, see [plugin runtime](plugin-runtime.md)) (Usage's Context tab, and the context window card the Routing page draws under a request's story, fed by `/api/context` in `context.go`, which scores and tags each agent; a client whose User-Agent names only an HTTP library, a runtime or an API SDK (`usage.IsLibrary`: curl, Bun, python-httpx, Go-http-client, OpenAI/Python), or nothing (`other`), is no agent and goes on one card, `scripts`, named Scripts with its libraries listed, read from each route's kept agent so older history folds too, while the Usage page's Agents list keeps each by its own name (theforeveriris on X, `context_scripts_test.go`, `context-scripts.test.cjs`); clicking a part, a cell or an item opens its text from `/api/context/text`, the last 10 requests' masked bodies in memory, else the request archive's copy masked the same way, with a 404 saying why there is none (`archive`: off, missing, cut, unread; `context_archive.go`), and its Reply the reply from `/api/context/reply` (`openCtxText`, in `ctxtext.js`, `context-text.test.cjs`), rendered 100 items and 20000 characters at a time; a session's details on the Sessions page and Usage's Sessions list draw a Context line of its requests from `/api/context/session`, which reads only the days from its first to its last (30 at most) and keeps that one session, so the tab's 80-session cap never leaves it out (`sessCtxLine` in `plugins/usage/page.js`, liang_yongxiang on Discord, `context_session_test.go`, `sessions-context-line.test.cjs`); its "Tuned for you" cards are fed by `/api/tune` in `tune.go`, see [agent wiring](agent-wiring.md)). Strings go through `t()` with translations in `i18n.js`, and a plugin's own in its `i18n.js` (zh, zh-TW, ja and de; the English text is the key and the fallback). zh-TW is Traditional Chinese with Taiwan's words; a system language of zh-TW, zh-HK, zh-MO or any zh-Hant picks it, and the tray menu and notifications follow (`trayLang`). Dropdowns use `openProtoMenu`. Every app menu (`openProtoMenu`, `openRowMenu`, `openSessCombo`) is placed by `placeMenu`: under its anchor, or over it when the window runs out below; one that fits neither way takes the larger room, its height held to it, and scrolls inside itself, and a scroll inside a menu doesn't close it (#1437, `removed-groups-menu-scroll.test.cjs`). The highest any popover goes is `popTop`: 8px under `header.top` on a Mac window, where the traffic lights are drawn over the page, and 8px from the top elsewhere; `placeMenu`, the field picker's `placePop` (which also holds `#pop`'s height to that room) and an agent's model list (`openAgentModels`) all use it (#1573, `popover-mac-chrome.test.cjs`). Scrolling is done only by `scrollOnPurpose(e)` with the reader's event. | [`assets/app.js`](../../internal/gui/assets/app.js), [`assets/i18n.js`](../../internal/gui/assets/i18n.js) | -| Window navigation | In the window from 1024 points wide (`SIDE_AT`, the same width as app.css's `side-nav` rules), `layoutNav` moves the brand, the pages (`#nav`) and Settings into the sidebar (`#side`): the pages in four groups (Work, Models, Insights, Extend; a group none of whose pages shows, as in gateway mode, leaves out its name), the gateway's address at its foot (`sideGwRead`, read from `/api/providers` only while there is a sidebar, or drawn at once from boot.js's `sideGateway`; on a page other machines open, `magpie web`, it is `MAGPIE_PUBLIC_URL` while they are let in, as the Gateway page's address and About's Gateway URL are, noahhrreion on Discord; a port applied in Settings redraws it), and the header a breadcrumb (`renderCrumb`). A page whose head holds only its tools (Library, Plugins, Settings) has them in the title bar after the breadcrumb, `tools` setting the room between it and the window's own buttons. When they don't fit there the tools show their icons alone (`tools-tight`; each keeps its name as `aria-label` and in its tooltip), then the breadcrumb drops its leading parts, and last the page's name is cut at its end, so no tool lies over the title (#2625, `title-bar-tools.test.cjs`). The open page's own tabs (`NAV_SUBS`: Usage, Library, Plugins, Settings) are listed under it as `.nav-s` rows (`role="tab"`, `data-of` the page tab's id) and the page's strip is hidden; Settings' are listed above its button at the foot, which is laid from its end (`.side-foot`'s `column-reverse`, its rows kept whole and scrolled from the end when the window is too short), so the list grows up from the button and the button and the gateway's line stay where they were clicked (jen_celeus on X, `sidebar-settings-steady.test.cjs`); a row's click clicks that tab at once, the selection (`.nav-hl`) having set off as the row was pressed (`navSubGlide`; back if the press leaves the row), and is the list's only shape: a row hovered or pressed has no ground of its own, and a `MutationObserver` draws the list again when the strip changes. A page's tabs share its one scroll, so a row that picks another tab opens it at its top (`scrollOnPurpose` with the row's click); the tab already open, picked again, leaves the page where it is (`sidebar-tab-top.test.cjs`). The list opens and folds with an iOS-like spring (`navSubEnter`, `navSubLeave`; none under reduced motion), and a folding list is out of reach at once. The open page's row folds its list and unfolds it, as a Mac sidebar's disclosure (hkwok06 on X: Settings' list unrolled and only another page, the gateway, put it away): the row carries a muted chevron (`.nav-fold`, `aria-expanded`), turned down to the list while it shows (up for Settings', which opens above its button) and to the side while folded, and the row clicked again, or Enter on it, folds or unfolds the list and leaves the page and its tab as they were (`navFold` and `navFoldRows` in `navicons.js`, imported with the first list; `navSubs` asks `navList("Folded")`). A folded list stays folded, per page, in localStorage `magpie.navFolded`, until its row opens it again. See `nav-sub-fold.test.cjs`. The open page's own row is marked the same way, by one shape (`.nav-top-hl`, the rows' own ground given up to it, hovered or pressed too) that `navTopGo` moves to the row picked on a damped spring, as iOS moves a selection (`NAV_SPRING`, SwiftUI's response 0.42s and damping 0.84; `navTopStep` steps it each frame): it sets off as the row is pressed and comes back if the press leaves the row or the page isn't left, turns with the speed it has when the press changes its mind, and follows its row while the list above it folds, landing where the row ends up. It is put in place, not sent, when the window opens on a page or the rows move under it at rest (a `ResizeObserver`), is away while Settings is open (it has its own selection at the foot), comes back fading in on its row, jumps under reduced motion, and isn't drawn in the header's tabs, which have their `.thumb`. `#nav` is `position: relative` in the sidebar for it, so `.seg`'s centring `left` and `top` are reset. See `sidebar-glide.test.cjs`. Narrower, the page beside a sidebar would be narrower than Usage's requests table needs (768 points), so they go back into the header's row, as a Mac sidebar gives way in a narrow window. At every width the reader can pick the sidebar or the header's tabs from the title bar's button (`#sideToggle`, ⌃⌘S or Ctrl+Shift+S; `toggleSideNav`), kept in localStorage `magpie.navLayout` (`side` or `top`) and so laid out from the first frame; none picked, the sidebar comes from `SIDE_AT`. Picked in a narrow window the sidebar is narrower (184 points under 860), and magpie web on a phone keeps its own tab bar and has no button. That tab bar (`phoneWeb`, app.css `body.web .top #nav`) lies at the window's foot, as an iPhone app's, over the home indicator's inset (`--tabbar`), with each page's icon over its name. It holds five tabs: with more pages shown than that, the first four and More, whose app menu lists the rest with their icons and ticks the open one, and More is marked while one of them is open and carries a page's dot (`phonetabs.js`, imported by `layoutNav` the first time the page is a phone's; a `MutationObserver` fits it again when a page is shown, left out or opened). Before it the tabs were a strip that scrolled sideways with nothing saying it did, and Agents and the Library lay past its edge (geraldpppppp on X). Status messages sit above the bar. See `phone-tabs.test.cjs`. The two layouts trade places in a view transition (`navMorph`, app.css `.nav-morph`): the sidebar slides, each page's tab flies to its place in the other, and the page slides as one (its old image dropped, so no line prints twice); without view transitions, under reduced motion, or in the Linux app the change is at once: WebKitGTK with compositing off (`WEBKIT_DISABLE_COMPOSITING_MODE`, which `webkit_linux.go` sets under Wayland) crashes in a view transition. Elsewhere a transition still going after `MORPH_MAX` (1.5s) is skipped, so a webview that never ends one can't leave the window on the old layout's picture. See `side-toggle.test.cjs`. A window made wider or narrower drops what a click held (`heldWidth`): the page laid out again isn't the click's doing. The reader's own place is kept instead for a second while the page is laid out again (`relaid`, a `ResizeObserver` on the open page's parts calling `backToReader`): crossing `SIDE_AT` the browser clamps the scroll to each layout it passes through, and the page ended short of its foot (#1672, `text-size.test.cjs`). See `sidebar.test.cjs`. A sidebar longer than a short window keeps no scroll bar beside its pages: the native bars of `.side-scroll` and `.side-foot` are hidden, and `sideBars` lays a thin bar over each box's edge that shows while it scrolls, fades about a second after it stops (kept while hovered or dragged), can be dragged or clicked to page, and is gone when the box fits, the same in WebKit, WebView2 and WebKitGTK. See `sidebar-overlay-scrollbar.test.cjs`. The window opens on the page the reader last left, as a Mac app comes back as it was (molvqingtai and lc on Discord): `show` keeps the page in localStorage `magpie.lastView` (which the app's webview keeps across restarts, as it keeps `magpie.navLayout`), and `keptView` opens it at start. A page asked for in the address (`?view=`, the tray's links, a reload) wins, Agents too; a kept name that is no page opens the first page, and one gateway mode leaves out opens Providers (`show`). Settings › General › Sidebar pages (`navpages.js`, loaded when Settings draws; youimark on X) leaves pages out of the sidebar for this browser alone: localStorage `magpie.navHidden`, read by `navMine` (through `navList`, which reads `magpie.navFolded` too), which `navHides` and `offView` ask beside gateway mode and the built-in plugins, so a hidden page's link or kept place opens Providers (Agents hidden: `start.js`), and Providers cannot be hidden (`nav-pages-hidden.test.cjs`). Opening on it scrolls nothing. See `last-page.test.cjs`. | [`assets/app.js`](../../internal/gui/assets/app.js), [`assets/app.css`](../../internal/gui/assets/app.css) | +| Window navigation | In the window from 1024 points wide (`SIDE_AT`, the same width as app.css's `side-nav` rules), `layoutNav` moves the brand, the pages (`#nav`) and Settings into the sidebar (`#side`): the pages in four groups (Work, Models, Insights, Extend; a group none of whose pages shows, as in gateway mode, leaves out its name), the gateway's address at its foot (`sideGwRead`, read from `/api/providers` only while there is a sidebar, or drawn at once from boot.js's `sideGateway`; on a page other machines open, `magpie web`, it is `MAGPIE_PUBLIC_URL` while they are let in, as the Gateway page's address and About's Gateway URL are, noahhrreion on Discord; a port applied in Settings redraws it), and the header a breadcrumb (`renderCrumb`). A page whose head holds only its tools (Library, Plugins, Settings) has them in the title bar after the breadcrumb, `tools` setting the room between it and the window's own buttons. When they don't fit there the tools show their icons alone (`tools-tight`; each keeps its name as `aria-label` and in its tooltip), then the breadcrumb drops its leading parts, and last the page's name is cut at its end, so no tool lies over the title (#2625, `title-bar-tools.test.cjs`). The open page's own tabs (`NAV_SUBS`: Usage, Library, Plugins, Settings) are listed under it as `.nav-s` rows (`role="tab"`, `data-of` the page tab's id) and the page's strip is hidden; Settings' are listed above its button at the foot, which is laid from its end (`.side-foot`'s `column-reverse`, its rows kept whole and scrolled from the end when the window is too short), so the list grows up from the button and the button and the gateway's line stay where they were clicked (jen_celeus on X, `sidebar-settings-steady.test.cjs`); a row's click clicks that tab at once, the selection (`.nav-hl`) having set off as the row was pressed (`navSubGlide`; back if the press leaves the row), and is the list's only shape: a row hovered or pressed has no ground of its own, and a `MutationObserver` draws the list again when the strip changes. A page's tabs share its one scroll, so a row that picks another tab opens it at its top (`scrollOnPurpose` with the row's click); the tab already open, picked again, leaves the page where it is (`sidebar-tab-top.test.cjs`). The list opens and folds with an iOS-like spring (`navSubEnter`, `navSubLeave`; none under reduced motion), and a folding list is out of reach at once. The open page's row folds its list and unfolds it, as a Mac sidebar's disclosure (hkwok06 on X: Settings' list unrolled and only another page, the gateway, put it away): the row carries a muted chevron (`.nav-fold`, `aria-expanded`), turned down to the list while it shows (up for Settings', which opens above its button) and to the side while folded, and the row clicked again, or Enter on it, folds or unfolds the list and leaves the page and its tab as they were (`navFold` and `navFoldRows` in `navicons.js`, imported with the first list; `navSubs` asks `navList("Folded")`). A folded list stays folded, per page, in localStorage `magpie.navFolded`, until its row opens it again. See `nav-sub-fold.test.cjs`. The open page's own row is marked the same way, by one shape (`.nav-top-hl`, the rows' own ground given up to it, hovered or pressed too) that `navTopGo` moves to the row picked on a damped spring, as iOS moves a selection (`NAV_SPRING`, SwiftUI's response 0.42s and damping 0.84; `navTopStep` steps it each frame): it sets off as the row is pressed and comes back if the press leaves the row or the page isn't left, turns with the speed it has when the press changes its mind, and follows its row while the list above it folds, landing where the row ends up. It is put in place, not sent, when the window opens on a page or the rows move under it at rest (a `ResizeObserver`), is away while Settings is open (it has its own selection at the foot), comes back fading in on its row, jumps under reduced motion, and isn't drawn in the header's tabs, which have their `.thumb`. `#nav` is `position: relative` in the sidebar for it, so `.seg`'s centring `left` and `top` are reset. See `sidebar-glide.test.cjs`. Narrower, the page beside a sidebar would be narrower than Usage's requests table needs (768 points), so they go back into the header's row, as a Mac sidebar gives way in a narrow window. At every width the reader can pick the sidebar or the header's tabs from the title bar's button (`#sideToggle`, ⌃⌘S or Ctrl+Shift+S; `toggleSideNav`), kept in localStorage `magpie.navLayout` (`side` or `top`) and so laid out from the first frame; none picked, the sidebar comes from `SIDE_AT`. Picked in a narrow window the sidebar is narrower (184 points under 860), and magpie web on a phone keeps its own tab bar and has no button. That tab bar (`phoneWeb`, app.css `body.web .top #nav`) lies at the window's foot, as an iPhone app's, over the home indicator's inset (`--tabbar`), with each page's icon over its name. It holds five tabs: with more pages shown than that, the first four and More, whose app menu lists the rest with their icons and ticks the open one, and More is marked while one of them is open and carries a page's dot (`phonetabs.js`, imported by `layoutNav` the first time the page is a phone's; a `MutationObserver` fits it again when a page is shown, left out or opened). Before it the tabs were a strip that scrolled sideways with nothing saying it did, and Agents and the Library lay past its edge (geraldpppppp on X). Status messages sit above the bar. See `phone-tabs.test.cjs`. The two layouts trade places in a view transition (`navMorph`, app.css `.nav-morph`): the sidebar slides, each page's tab flies to its place in the other, and the page slides as one (its old image dropped, so no line prints twice); without view transitions, under reduced motion, or in the Linux app the change is at once: WebKitGTK with compositing off (`WEBKIT_DISABLE_COMPOSITING_MODE`, which `webkit_linux.go` sets under Wayland) crashes in a view transition. Elsewhere a transition still going after `MORPH_MAX` (1.5s) is skipped, so a webview that never ends one can't leave the window on the old layout's picture. See `side-toggle.test.cjs`. A window made wider or narrower drops what a click held (`heldWidth`): the page laid out again isn't the click's doing. The reader's own place is kept instead for a second while the page is laid out again (`relaid`, a `ResizeObserver` on the open page's parts calling `backToReader`): crossing `SIDE_AT` the browser clamps the scroll to each layout it passes through, and the page ended short of its foot (#1672, `text-size.test.cjs`). See `sidebar.test.cjs`. A sidebar longer than a short window keeps no scroll bar beside its pages: the native bars of `.side-scroll` and `.side-foot` are hidden, and `sideBars` lays a thin bar over each box's edge that shows while it scrolls, fades about a second after it stops (kept while hovered or dragged), can be dragged or clicked to page, and is gone when the box fits, the same in WebKit, WebView2 and WebKitGTK. See `sidebar-overlay-scrollbar.test.cjs`. The window opens on the page the reader last left, as a Mac app comes back as it was (molvqingtai and lc on Discord): `show` keeps the page in localStorage `magpie.lastView` (which the app's webview keeps across restarts, as it keeps `magpie.navLayout`), and `keptView` opens it at start. A page asked for in the address (`?view=`, the tray's links, a reload) wins, Agents too; a kept name that is no page opens the first page, and one gateway mode leaves out opens Providers (`show`). Settings › General › Sidebar pages (`navpages.js`, loaded when Settings draws; youimark on X) leaves pages out of the sidebar for this browser alone: localStorage `magpie.navHidden`, read by `navMine` (through `navList`, which reads `magpie.navFolded` too), which `navHides` and `offView` ask beside gateway mode and the built-in plugins, so a hidden page's link or kept place opens Providers (Agents hidden: `start.js`), and Providers cannot be hidden (`nav-pages-hidden.test.cjs`). The same menu puts the built-in pages in the reader's order (chet030714 on X): a row dragged by its grip, or moved with Alt+↑/↓, is kept in localStorage `magpie.navOrder`; `navArrange` in `navorder.js` (which `navHides` imports only once an order is kept, and `navpages.js` with the menu) moves the `#nav` buttons into it, so the sidebar, the header's tabs and a phone's tab bar (`phonetabs.js`: the first four, the rest under More) all follow, and while the order isn't the home one the groups' names are taken out of `#nav`. `navOrder` puts a page the kept order doesn't name (new in an update) after the page it follows at home; Default order removes the key. Plugin pages keep their own order in their group (`nav-pages-order.test.cjs`). Opening on it scrolls nothing. See `last-page.test.cjs`. | [`assets/app.js`](../../internal/gui/assets/app.js), [`assets/app.css`](../../internal/gui/assets/app.css) | | Settings › Privacy | The page opens on what masking kept from vendors (`drawMaskObs` in app.js, fed by `/api/masking/summary`): the values masked over 7 or 30 days with a chart of the days, the kinds, what only the local model found, agents to providers, and the values masked most, each shown only while pointed at (`maskTip`, `/api/masking/value`, which says it is gone after a restart). Its records (`drawMaskRecs`, `/api/masking/records` and `/api/masking/record`) take the page's place, filtered by kind, finder, agent or provider, a day at a time, each opening on the text the vendor saw with its placeholders marked. `maskedBadge`, on the Gateway page's recent calls and the Routing page's log, opens a request's own record (`openMaskRecord`), in amber with the count sent as written when every value found was on Warn. Below the card, *What to mask*, *How it's found* (the rules, always on while anything is masked, and the local model on top of them), *When a value is found* (Mask, Warn or Block per kind, the secret kinds first and the personal ones behind *Show all kinds*, and the *Never mask* list; `renderMaskActions`, with *Never mask* and *Masked words* drawn a value a row by `wordList` in `plugins/redact/settings.js`, saved as the same list of strings the one comma-separated box saved, `redact-words-list.test.cjs`), *Try it* (`renderMaskTry`, the text as the vendor would get it from `/api/masking/preview`, kept in no storage) and *Sharing*. *Agents' session history* (`renderSessionReads`, read from `/api/sessions/reads` only while the Privacy part is shown) has *Agents found later* and a row per agent found, the choice the Sessions page asks first on a fresh install; see [gateway sessions](gateway-sessions.md#which-agents-sessions-magpie-reads). While anything is masked, *Instead of masking, send to* (`redactRouteRow` in `plugins/redact/settings.js`, the redact plugin's part of Settings, which wraps `renderRedact` so app.js carries none of it) picks, in the app menu, a model a request masking would change goes to as written: Off by default, and only the models `/api/settings` lists as `maskRouteModels` (every route of theirs unmasked, `gateway.MaskRoute`), saved with `POST /api/settings/redact-route` (`redact-route.test.cjs`). See [gateway routing](gateway-routing.md) for what is recorded. | [`assets/app.js`](../../internal/gui/assets/app.js), [`masking.go`](../../internal/gui/masking.go) | | Built-in plugins | Plugins › Built-in, the page's first tab (`drawBuiltin` in `plugins.js`, rows by `renderBuiltins` in `app.js`), lists magpie's built-in plugins, each with a name, a line on what it is and a switch: Routing groups, Library, Observability, Sessions, Warm-up and check-in, and the Gateway and Routing pages (Essential). A plugin on with settings has their rows under its row, drawn from its schema by the kernel's `ui.form`, and a change posts `{id, config}`. The Gateway page is drawn by its plugin's own scripts through the window's kernel (`kernel.js`, `assets/plugins/gateway/`); see the [plugin runtime](plugin-runtime.md), "The window's kernel". They are `plugins/*` registered with the [plugin runtime](plugin-runtime.md); `GET /api/plugins/builtin` says each one (`builtinJSON`: on is active, the user's own choice, what of it is in use) and `POST {id, on}` (or `{id, config}`) writes plugins.yml. A page marks what goes with a plugin `data-feature=""`. Off, `featureStyle` hides everything so marked (rows drawn later too), `navHides` leaves its page's tab out of the sidebar and the header, `show` opens Agents for an address kept for it, and `setSetTab`, `partShows` and `findSettings` leave its Settings tab and rows out, of the search too. Settings' search lists the built-ins themselves after its own rows, off or on, by name, line or a setting in their schema (Gateway's Recent calls at a time is on its own page), and Open lights the row in Plugins › Built-in (`setFeatsFind` in the lazy [`setfeats.js`](../../internal/gui/assets/setfeats.js), `settings-search.test.cjs`). Its provider links are drawn the first time a search wants them (`provlinks.js`). One in use stays on: its switch is disabled and the row says what uses it, and the POST refuses it off. A plugins.yml that doesn't parse is said above the list and no switch moves. `boot.js` says which are off (`featuresOff`) and their settings (`pluginConfig`) before the first paint, and `settings.builtins` carries the list on every state read. The TUI doesn't follow them. See `builtins.test.cjs`, `builtins_test.go`. | [`builtins.go`](../../internal/gui/builtins.go), [`assets/plugins.js`](../../internal/gui/assets/plugins.js), [`assets/app.js`](../../internal/gui/assets/app.js) | | The app's log | `runGUI` and `runPanel` (so `magpie`, `app`, `tray`, `panel`, a window view and a `magpie:` link) call `startLog` before `gui.Run`: `applog.Start` sends the standard logger, which the gateway, the plugin host and Wails' error handler write to, to `app.log` in `appdir.Logs` as well as stderr (`quiet`, which never fails, first, since io.MultiWriter stops at a failed writer and an app opened from Explorer has no stderr), and points `debug.SetCrashOutput` at it, so a panic is in it. Opened from the Finder, the Dock or the Start menu the app has no terminal, and wrote its log nowhere (rayem1w on X, 0.1.2330). The folder is `~/Library/Logs/magpie` on macOS (beside the launch agent's `serve.log`, which launchd writes for `magpie serve`: the two processes never share a file), `%LOCALAPPDATA%\magpie\logs` on Windows, `$XDG_STATE_HOME/magpie` (`~/.local/state/magpie`) elsewhere, and `logs` in a portable data folder. The file is 0600. At 5 MiB (`Limit`) it becomes `app.old.log`; when another magpie (an update's new process) rotated it already (`os.SameFile` of the open file and the path differs), it is only opened again, and when it can't be moved it is emptied. Each line goes through `scrub`, which masks bearer and basic credentials, key and token query parameters, and `sk-`, `AIza`, `gh?_` and JWT shapes, though nothing logged is meant to carry one. Settings › About's Log row (`#logRow`, `settingsJSON.Log` from `applog.Current`, so `magpie web`, which writes no file, shows none) has its path and an Open (`POST /api/settings/log/reveal`) that shows its folder; `magpie log` prints where every log is, `-n` the last lines, `-f` follows across a rotation (`TestTheAppWritesItsLog`, `TestLogFollows`). | [`internal/applog/applog.go`](../../internal/applog/applog.go), [`gui_on.go`](../../internal/cli/gui_on.go), [`log_cli.go`](../../internal/cli/log_cli.go) | diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css index 22ec5ff09..f7d76395c 100644 --- a/internal/gui/assets/app.css +++ b/internal/gui/assets/app.css @@ -3385,6 +3385,24 @@ body.window .ag-sk-icon { width: 22px; height: 22px; border-radius: 6px; } /* a menu of actions, where nothing is or can be ticked, keeps no room for a tick: its items line up with its heading */ .proto-menu.pm-bare .pm-tick { display: none; } +/* Settings' Sidebar pages (navpages.js): each page's row is dragged to its + place, the grip at its end showing on the row under the pointer, as an + iPhone's list being reordered has it; Providers is always shown */ +.nav-pages-list { position: relative; display: grid; gap: 1px; } +.nav-pages-menu .pm-item { align-items: center; } +.nav-pages-menu .pm-words { flex: 1; min-width: 0; } +.nav-pages-menu .grip { flex: none; display: grid; place-items: center; align-self: stretch; width: 26px; margin: -6px -8px -7px 0; touch-action: none; cursor: grab; opacity: 0; transition: opacity .15s ease; } +.nav-pages-menu .grip::before { content: ""; width: 6px; height: 11px; background: radial-gradient(circle, var(--muted) .9px, transparent 1.2px) 0 0 / 3px 3.75px; } +.nav-pages-menu .pm-item:is(:hover, .dragging) .grip { opacity: 1; } +/* apart: Safari before 15.4 drops a whole selector list with :focus-visible in it */ +.nav-pages-menu .pm-item:focus-visible .grip { opacity: 1; } +@media (hover: none) { .nav-pages-menu .grip { opacity: 1; } } +.nav-pages-menu .pm-fixed .pm-tick { opacity: .4; } +.nav-pages-list.sorting { user-select: none; -webkit-user-select: none; } +.nav-pages-list.sorting > .pm-item { transition: transform .16s cubic-bezier(.23, 1, .32, 1); cursor: grabbing; } +.nav-pages-list.sorting > .pm-item.dragging { z-index: 2; background: var(--card-2); box-shadow: 0 0 0 1px var(--line); transition: none; will-change: transform; } +@media (prefers-reduced-motion: reduce) { .nav-pages-list.sorting > .pm-item { transition: none; } } +.nav-pages-reset { margin-top: 3px; } /* a group's heading in a menu of many: it ticks all of its items */ .proto-menu .pm-group { margin-top: 3px; } .proto-menu .pm-group .pm-name { font-size: 11px; font-weight: 600; color: var(--muted); } diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index 55cf48a18..0c325ed66 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -23392,6 +23392,8 @@ const navList = (k) => { try { return JSON.parse(localStorage.getItem("magpie.na const navMine = () => navList("Hidden"); function navHides() { if (mode !== "window") return; + // the reader's own order (navorder.js), imported only once there is one + window.navArrange ? navArrange() : navList("Order").length && import("./navorder.js").then(navHides, () => {}); for (const b of $("#nav").querySelectorAll("button[data-view]")) b.hidden = (gatewayMode && GATEWAY_HIDES.includes(b.dataset.view)) || featureHides(b) || navMine().includes(b.dataset.view); } function applyFeatures(list) { diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js index 08622aefb..f92d3d864 100644 --- a/internal/gui/assets/i18n.js +++ b/internal/gui/assets/i18n.js @@ -836,6 +836,7 @@ const I18N = { "{n} hidden": "已隐藏 {n} 个", "Sidebar pages": "侧边栏页面", "All shown": "全部显示", + "Always shown": "始终显示", "{n} at 0": "{n} 个为 0", "Fold the ones at 0": "收起为 0 的", "Nothing left here: every window used up, or a balance of 0": "已没有剩余额度的账号和密钥:每个额度窗口都已用完,或余额为 0", @@ -6190,6 +6191,7 @@ const I18N = { "{n} hidden": "已隱藏 {n} 個", "Sidebar pages": "側邊欄頁面", "All shown": "全部顯示", + "Always shown": "始終顯示", "{n} at 0": "{n} 個為 0", "Fold the ones at 0": "收起為 0 的", "Nothing left here: every window used up, or a balance of 0": "已沒有剩餘額度的帳號和金鑰:每個額度時段都已用完,或餘額為 0", @@ -11508,6 +11510,7 @@ const I18N = { "{n} hidden": "{n} 件非表示", "Sidebar pages": "サイドバーのページ", "All shown": "すべて表示", + "Always shown": "常に表示", "{n} at 0": "{n} 件が 0", "Fold the ones at 0": "0 のものをたたむ", "Nothing left here: every window used up, or a balance of 0": "残りがないアカウントとキー:すべてのウィンドウを使い切ったか、残高が 0", @@ -16844,6 +16847,7 @@ const I18N = { "{n} hidden": "{n} ausgeblendet", "Sidebar pages": "Seiten in der Seitenleiste", "All shown": "Alle sichtbar", + "Always shown": "Immer sichtbar", "{n} at 0": "{n} bei 0", "Fold the ones at 0": "Die bei 0 einklappen", "Nothing left here: every window used up, or a balance of 0": "Konten und Schlüssel ohne Rest: jedes Zeitfenster aufgebraucht oder ein Guthaben von 0", diff --git a/internal/gui/assets/navorder.js b/internal/gui/assets/navorder.js new file mode 100644 index 000000000..b86ebaeec --- /dev/null +++ b/internal/gui/assets/navorder.js @@ -0,0 +1,31 @@ +// The pages in the reader's order (chet030714 on X), kept in localStorage +// magpie.navOrder by Settings › General › Sidebar pages (navpages.js). +// app.js navHides imports this once an order is kept, so a reader who never +// reorders loads none of it. + +// the order of the pages vs; one it doesn't name, new in an update, goes +// after the page it follows at home +window.navOrder = function (vs) { + const o = [...new Set(navList("Order"))].filter((v) => vs.includes(v)); + vs.forEach((v, i) => { if (!o.includes(v)) o.splice(i && o.indexOf(vs[i - 1]) + 1, 0, v); }); + return o; +}; + +// the built-in pages and their groups' names, in the order they come at home +const nav = $("#nav"); +window.navHome = [...nav.querySelectorAll(":scope > .nav-gl:not([data-plugin-pages]), :scope > button[data-view]:not([data-plugin-page])")]; + +// the built-in pages put in that order, the phone's tab bar's too +// (phonetabs.js reads #nav); a group's name goes while the order is the +// reader's own, and comes back with the home order +window.navArrange = function () { + const home = navHome, vs = home.flatMap((e) => e.dataset.view || []), o = navOrder(vs), own = o.join() !== vs.join(); + let prev = null; + for (const e of own ? o.map((v) => home.find((b) => b.dataset.view === v)) : home) { + let nx = prev ? prev.nextElementSibling : nav.firstElementChild; + while (nx?.matches(".nav-sub, .thumb")) nx = nx.nextElementSibling; + if (nx !== e) nav.insertBefore(e, nx); + prev = e; + } + for (const e of home) if (!e.dataset.view) own ? e.remove() : e.dataset.en && (e.textContent = t(e.dataset.en)); +}; diff --git a/internal/gui/assets/navpages.js b/internal/gui/assets/navpages.js index 378185371..cb6783b8a 100644 --- a/internal/gui/assets/navpages.js +++ b/internal/gui/assets/navpages.js @@ -1,37 +1,128 @@ // Settings › General › Sidebar pages (youimark on X: a docker gateway has // no use for Agents or Library): which pages this browser leaves out of // the sidebar, kept in localStorage magpie.navHidden as this reader's own -// (navMine in app.js reads it). app.js imports this when Settings draws, -// so it weighs nothing on the core. +// (navMine in app.js reads it), and the order they go in (chet030714 on +// X: Routing, Providers and Agents first in a phone's tab bar, the rest +// under More), kept in magpie.navOrder (navorder.js). +// A row is dragged to its place, or moved with Alt+↑/↓; Providers is +// always shown. app.js imports this when Settings draws, so it weighs +// nothing on the core. +import "./navorder.js"; +const navPagesOf = (nav) => [...nav.querySelectorAll(":scope > button[data-view]")] + .filter((b) => !(gatewayMode && GATEWAY_HIDES.includes(b.dataset.view)) && !featureHides(b)) + .map((b) => ({ v: b.dataset.view, name: (b.querySelector("span[data-t]") || b.querySelector("span"))?.textContent || b.textContent.trim(), plugin: "pluginPage" in b.dataset })); + +function navPagesSave(k, list) { + try { + if (list) localStorage.setItem("magpie.nav" + k, JSON.stringify(list)); + else localStorage.removeItem("magpie.nav" + k); + } catch { /* not kept */ } + navHides(); + if (offView(view) !== view) show(offView(view)); + else if (!sideNav()) slide($("#nav"), "nav"); + navSubsAt = ""; + navSubs(); + window.renderNavPages(); +} + +const words = (name) => { const w = el("span", "pm-words"); w.append(el("span", "pm-name", name)); return w; }; + +function navPagesMenu(anchor) { + closeProtoMenu(); + const nav = $("#nav"), box = el("div", "pop proto-menu nav-pages-menu"), list = el("div", "nav-pages-list"); + box.setAttribute("role", "menu"); + const reset = el("button", "pm-item nav-pages-reset"); + reset.type = "button"; + reset.append(el("span", "pm-tick"), words(t("Default order"))); + reset.onclick = () => { navPagesSave("Order", null); draw(); list.querySelector(".pm-item")?.focus(NO_SCROLL); }; + hoverFocus(reset); + box.append(el("div", "pm-head", t("Sidebar pages")), list, reset); + const home = () => navHome.flatMap((e) => e.dataset.view || []); + const movable = () => [...list.querySelectorAll(".pm-item[data-moves]")]; + const focus = (v) => list.querySelector(`[data-v="${CSS.escape(v)}"]`)?.focus(NO_SCROLL); + // v to place to among the pages this menu lists, the others where they are + const move = (v, to) => { + const ps = movable().map((r) => r.dataset.v), all = navOrder(home()); + if (to < 0 || to >= ps.length || ps.indexOf(v) === to) return; + const s = ps.filter((x) => x !== v); + s.splice(to, 0, v); + const o = all.map((x) => ps.includes(x) ? s.shift() : x); + navPagesSave("Order", o.join() === home().join() ? null : o); + draw(); + focus(v); + }; + const item = (p, hid) => { + const r = el("button", "pm-item"), on = p.v === "providers" || !hid.includes(p.v); + r.type = "button"; + r.dataset.v = p.v; + r.setAttribute("role", "menuitemcheckbox"); + r.setAttribute("aria-checked", String(on)); + r.classList.toggle("on", on); + const tick = el("span", "pm-tick"); + if (on) tick.append(svg(CHECK, 12, 1.9)); + r.append(tick, words(p.name)); + if (p.v === "providers") { + r.classList.add("pm-fixed"); + r.setAttribute("aria-disabled", "true"); + r.title = t("Always shown"); + } + r.onclick = () => { + if (r.dataset.dragged || p.v === "providers") return; + const h = navMine(); + navPagesSave("Hidden", on ? [...h, p.v] : h.filter((x) => x !== p.v)); + draw(); + focus(p.v); + }; + hoverFocus(r); + // a plugin's page keeps its place in the Plugins group (pluginpages.js) + if (!p.plugin) { + r.dataset.moves = ""; + r.append(el("span", "grip")); + r.setAttribute("aria-description", t("Drag to reorder · Alt+↑/↓ to move")); + r.onpointerdown = (e) => dragRows(e, r, r, list, movable(), (to) => move(p.v, to)); + } + return r; + }; + const draw = () => { + const hid = navMine(); + list.replaceChildren(...navPagesOf(nav).map((p) => item(p, hid))); + reset.hidden = navOrder(home()).join() === home().join(); + }; + draw(); + const keys = (e) => { + if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return; + const items = [...box.querySelectorAll(".pm-item:not([hidden])")], i = items.indexOf(document.activeElement); + if (!e.altKey) return stepFocus(e, items, i); + const r = items[i]; + if (!r || !("moves" in r.dataset)) return; + e.preventDefault(); + e.stopPropagation(); + move(r.dataset.v, movable().indexOf(r) + (e.key === "ArrowDown" ? 1 : -1)); + }; + document.body.append(box); + placeMenu(box, anchor, "left"); + anchor.classList.add("open"); + anchor.setAttribute("aria-expanded", "true"); + holdMenu(box, anchor, keys, (e) => { if (scrollCloses(box, e)) closeProtoMenu(); }); + list.querySelector(".pm-item")?.focus(NO_SCROLL); +} + window.renderNavPages = function () { const row = $("#navPagesRow"), nav = $("#nav"); if (!row) return; // only a window has a sidebar: the panel has no #nav (#6139) if (mode !== "window" || !nav) { row.hidden = true; return; } - const pages = [...nav.querySelectorAll("button[data-view]")] - .filter((b) => b.dataset.view !== "providers" && !(gatewayMode && GATEWAY_HIDES.includes(b.dataset.view)) && !featureHides(b)) - .map((b) => ({ v: b.dataset.view, name: b.querySelector("[data-t]")?.dataset.en || b.textContent.trim() })); - row.hidden = !pages.length; + const pages = navPagesOf(nav); + row.hidden = pages.length < 2; if (row.hidden) return; const mine = navMine(); - const n = pages.filter((p) => mine.includes(p.v)).length; + const n = pages.filter((p) => p.v !== "providers" && mine.includes(p.v)).length; let b = row.querySelector(".nav-pages-pick"); if (!b) { b = el("button", "sess-pick pref-pick nav-pages-pick"); b.type = "button"; menuOf(b); - b.onclick = () => { - const now = navMine(); - openProtoMenu(b, pages.map((p) => ({ v: p.v, name: p.name })), pages.map((p) => p.v).filter((v) => !now.includes(v)), (shown) => { - const keep = now.filter((v) => !pages.some((p) => p.v === v)); - const hide = [...keep, ...pages.map((p) => p.v).filter((v) => !shown.includes(v))]; - try { localStorage.setItem("magpie.navHidden", JSON.stringify(hide)); } catch { /* not kept */ } - navHides(); - if (offView(view) !== view) show(offView(view)); - else if (!sideNav()) slide($("#nav"), "nav"); - window.renderNavPages(); - }, "Sidebar pages", "", "left", true); - }; + b.onclick = () => b.classList.contains("open") ? closeProtoMenu() : navPagesMenu(b); row.append(b); } b.textContent = n ? t("{n} hidden", { n }) : t("All shown"); diff --git a/internal/gui/core_budget_test.go b/internal/gui/core_budget_test.go index d0c735a58..e0fb8b2bd 100644 --- a/internal/gui/core_budget_test.go +++ b/internal/gui/core_budget_test.go @@ -17,8 +17,8 @@ import ( // never what pays for a change (#5918); the history of each number is in // `git log -L` of this file. const ( - appScriptBudget = 1_086_864 // app.js: 1,080,614 at 8016205e3, with the 5,653 of room it had; +123 for a sidebar list folded from its page's row (hkwok06 on X), its chevron and fold in navicons.js, imported with the first list; +57 for each account of a provider's Usage card in a card of its own (normalcoder_ on X), past the 24 of room left; +17 for an allowance card's wallet line under its rings (apple_test_src on X), the one filter shared with its text line; +338 for the Daily update channel (fishmagic80 on X): its segment, its line under Update channel and the version row's two Up to date on Daily words, packed to the shortest form (one t() per choice); Settings › About and renderUpdate draw them on every window, so there is no page to move them to; +35 for Baidu Qianfan's Token Plan sign-in (yuushabu_buyinn on X, #5860): its field in qianfanplan.js, imported when such a provider's editor opens, drawn by renderStepPlan now told whose sign-in it brings, and what is left is the import and two quotaError lines, past the room there was; quotaError reads every card's error, so there is no page to move it to; +27 for Windows' title bar (258a14 on X): the caption buttons, their clicks, the bar's double click and what keeps them over a dialog in wincap.js, imported in Windows' window alone, the header's room for them in app.css, and what is left is the one line that imports it, past the 29 of room there was; that window's frame is drawn on every start, so there is no page to move it to - coreScriptBudget = 1_270_954 // every core script at 8016205e3, the old measure 682 over its cap there (#5918); +367 for the model test on a chosen account (tmr11235), no page left to move it to; +151 for the provider menu's "Only on this device" item and its four translations; +458 for Settings › About's Report a problem row and its translations; +113 for withScheme, the one rule every typed address goes through (eachg0 on X), cut to the shortest form that keeps it whole; +10 for the kept whole's tooltip (Musikrv77852 on X), the past-cycle line reused for it, no page left to move it to; +1,112 for Codex's Open button and its Open Codex with menu (Yink88564391 on X), packed to the shortest form, no page left to move them to; +168 for Discover's long lists drawn in part (the owner, 11-13), after the rest of its hook moved into plugingrid.js, imported when Plugins first draws; +296 for the cap toggle and Smart sentences that say what they do and the Sign in on another computer row (Wing8Aqua on X), packed to the shortest form, no page left to move them to; +333 for In turn's figure in a provider's editor and its words naming the message that goes round (Wing8Aqua on X), the figure itself in rotfig.js, imported when In turn is first shown, the hook packed to the shortest form; +236 for a lone capped Codex account's row saying its turns go to the fallbacks when Codex is connected (not_4O4 on X), the two helpers inlined, no page left to move it to; +717 for omp's advisor (Awad_Yoo on X, #6408): its three rows moved into ompadvisor.js, imported when an omp's settings show, and what is left is the import, the role's " · off" and the Settings line's name, packed to the shortest form; +468 for a plugin's own file import (auth.import) in the import sheet, in the plugin's words (marchen_cc on X), packed to one statement; importSay is read as the Providers rows draw, so it has no lazy page to go to, and nothing else was moved out; +180 for Claude Magpie's own Claude Code folder (xMopf7RF on X, #6459): its Advanced fold in claudemagpie.js, imported when it first shows, and what is left is the import and the fold's place in the Separate app line, 216 bytes packed to the shortest form, less the 36 of room there was; +81 for the Use Claude Magpie button on Claude Desktop's row (xMopf7RF on X), drawn by claudemagpie.js too, what is left the one line that places it (#2710); +225 for the Hermes row's Other profiles lines (Norethcy on X), which 1d60b165c took out while each profile had a row and c96f33d65 left with no place at all, packed to the shortest form; the dead hermes# Default note went with it, and the Agents rows draw it, so there is no page to move it to; +397 for a key's own price rate (tnt12231 on X): its lines, check and placeholder in keyrates.js, imported when a provider with two or more keys opens, and what is left is the import, the draft's copy, Advanced opening for it, the save's one line and proxyLines drawing another kind of line; +316 for an image or video model's chip saying what it makes from its right-click (iceloon on X): the chat chip's Makes… now shared with it, and the media chip's Copy model ID left out, packed to the shortest form; the provider's editor draws it, so there is no page to move it to; +67 for the Claude Code · Claude Magpie row saying it is on magpie through Claude Magpie (xMopf7RF on X), one line in connectLine with the shortest words that say it; the Agents rows draw it, so there is no page to move it to; +12 for AIGoCode's logo in pngIcons (MindfulReturn on X), the list every drawn icon is looked up in; +491 for each cost in the tray panel's and Requests' chart and ranking in its own provider's currency (onkashiko on X): ledProv and the provider passed through, packed to the shortest form; drawLedColumns and drawLedRank are shared by the panel, so there is no page to move it to; +326 for the Qwen AI platform's Token Plan sign-in (imthe99galaxy on X): its field, sign-in and wait in qianwenplan.js, imported when such a provider's editor opens, and what is left is the import and one quotaError line for its two refusals, packed to the shortest form; quotaError reads every card's error, so there is no page to move it to; +72 for Copy all keys (emilochen on X): its row in keyrates.js, imported when a provider with two or more keys opens through keyRateField, now told which of its parts to draw, and what is left is the one line that places it; +83 for the page saying it has gone from view, so what its Sessions and Usage pages keep goes in 30 s and not 7 minutes (P0 memory): folded into the visibilitychange listener every window has, packed to the shortest form, so there is no page to move it to; +270 for Providers' Select, to remove several at once (eiyuuzaki2333 on X): its rows, bar, removal and keys in pvpick.js, imported when Select is first clicked, and what is left is pvSel, the button's click and two lines in renderProviders, which draws the list, so there is no page to move it to; +81 for each account of a provider's Usage card in a card of its own (normalcoder_ on X): one line that makes the box, its brief look left to CSS, and renderQuotas, which draws every card, so there is no page to move it to; +17 for Kimi Code's booster balance under an allowance card's rings in the tray panel (apple_test_src on X): the card's text line and the wallet line share one filter, packed to the shortest form; panelQuotaCard draws every card, so there is no page to move it to; +51 for what a failed plugin install left in plugins/, listed under Installed with a Remove (CHENGJIAHEGOXIS on X): its section in plugininstalled.js as pmLeftovers, imported when Plugins first draws, and what is left is the one call after drawInstalled; draw is what draws the page, so there is no page to move it to; +123 for a sidebar list folded from its page's row (hkwok06 on X): the chevron, its click and the fold kept per page in navicons.js, imported with the first list, and what is left is the folded list read beside the hidden pages' (navList, which navMine now shares) and the two rows' clicks asking navFold first; navSubs draws every list, so there is no page to move it to; +338 for the Daily update channel (fishmagic80 on X): its segment, its line under Update channel and the version row's two Up to date on Daily words, packed to the shortest form (one t() per choice); Settings › About and renderUpdate draw them on every window, so there is no page to move them to; +35 for Baidu Qianfan's Token Plan sign-in (yuushabu_buyinn on X, #5860): its field in qianfanplan.js, imported when such a provider's editor opens, drawn by renderStepPlan now told whose sign-in it brings, and what is left is the import and two quotaError lines, past the room there was; quotaError reads every card's error, so there is no page to move it to; +27 for Windows' title bar (258a14 on X): the caption buttons, their clicks, the bar's double click and what keeps them over a dialog in wincap.js, imported in Windows' window alone, the header's room for them in app.css, and what is left is the one line that imports it, past the 29 of room there was; that window's frame is drawn on every start, so there is no page to move it to + appScriptBudget = 1_086_971 // app.js: 1,080,614 at 8016205e3, with the 5,653 of room it had; +123 for a sidebar list folded from its page's row (hkwok06 on X), its chevron and fold in navicons.js, imported with the first list; +57 for each account of a provider's Usage card in a card of its own (normalcoder_ on X), past the 24 of room left; +17 for an allowance card's wallet line under its rings (apple_test_src on X), the one filter shared with its text line; +338 for the Daily update channel (fishmagic80 on X): its segment, its line under Update channel and the version row's two Up to date on Daily words, packed to the shortest form (one t() per choice); Settings › About and renderUpdate draw them on every window, so there is no page to move them to; +35 for Baidu Qianfan's Token Plan sign-in (yuushabu_buyinn on X, #5860): its field in qianfanplan.js, imported when such a provider's editor opens, drawn by renderStepPlan now told whose sign-in it brings, and what is left is the import and two quotaError lines, past the room there was; quotaError reads every card's error, so there is no page to move it to; +27 for Windows' title bar (258a14 on X): the caption buttons, their clicks, the bar's double click and what keeps them over a dialog in wincap.js, imported in Windows' window alone, the header's room for them in app.css, and what is left is the one line that imports it, past the 29 of room there was; that window's frame is drawn on every start, so there is no page to move it to; +107 for the pages in the reader's own order (chet030714 on X): the order, the sidebar and tab bar put in it, and the menu's drag and keys in navorder.js and navpages.js, imported once an order is kept or Settings draws, and what is left is the one line in navHides that imports it; navHides runs on every start, so there is no page to move it to + coreScriptBudget = 1_271_061 // every core script at 8016205e3, the old measure 682 over its cap there (#5918); +367 for the model test on a chosen account (tmr11235), no page left to move it to; +151 for the provider menu's "Only on this device" item and its four translations; +458 for Settings › About's Report a problem row and its translations; +113 for withScheme, the one rule every typed address goes through (eachg0 on X), cut to the shortest form that keeps it whole; +10 for the kept whole's tooltip (Musikrv77852 on X), the past-cycle line reused for it, no page left to move it to; +1,112 for Codex's Open button and its Open Codex with menu (Yink88564391 on X), packed to the shortest form, no page left to move them to; +168 for Discover's long lists drawn in part (the owner, 11-13), after the rest of its hook moved into plugingrid.js, imported when Plugins first draws; +296 for the cap toggle and Smart sentences that say what they do and the Sign in on another computer row (Wing8Aqua on X), packed to the shortest form, no page left to move them to; +333 for In turn's figure in a provider's editor and its words naming the message that goes round (Wing8Aqua on X), the figure itself in rotfig.js, imported when In turn is first shown, the hook packed to the shortest form; +236 for a lone capped Codex account's row saying its turns go to the fallbacks when Codex is connected (not_4O4 on X), the two helpers inlined, no page left to move it to; +717 for omp's advisor (Awad_Yoo on X, #6408): its three rows moved into ompadvisor.js, imported when an omp's settings show, and what is left is the import, the role's " · off" and the Settings line's name, packed to the shortest form; +468 for a plugin's own file import (auth.import) in the import sheet, in the plugin's words (marchen_cc on X), packed to one statement; importSay is read as the Providers rows draw, so it has no lazy page to go to, and nothing else was moved out; +180 for Claude Magpie's own Claude Code folder (xMopf7RF on X, #6459): its Advanced fold in claudemagpie.js, imported when it first shows, and what is left is the import and the fold's place in the Separate app line, 216 bytes packed to the shortest form, less the 36 of room there was; +81 for the Use Claude Magpie button on Claude Desktop's row (xMopf7RF on X), drawn by claudemagpie.js too, what is left the one line that places it (#2710); +225 for the Hermes row's Other profiles lines (Norethcy on X), which 1d60b165c took out while each profile had a row and c96f33d65 left with no place at all, packed to the shortest form; the dead hermes# Default note went with it, and the Agents rows draw it, so there is no page to move it to; +397 for a key's own price rate (tnt12231 on X): its lines, check and placeholder in keyrates.js, imported when a provider with two or more keys opens, and what is left is the import, the draft's copy, Advanced opening for it, the save's one line and proxyLines drawing another kind of line; +316 for an image or video model's chip saying what it makes from its right-click (iceloon on X): the chat chip's Makes… now shared with it, and the media chip's Copy model ID left out, packed to the shortest form; the provider's editor draws it, so there is no page to move it to; +67 for the Claude Code · Claude Magpie row saying it is on magpie through Claude Magpie (xMopf7RF on X), one line in connectLine with the shortest words that say it; the Agents rows draw it, so there is no page to move it to; +12 for AIGoCode's logo in pngIcons (MindfulReturn on X), the list every drawn icon is looked up in; +491 for each cost in the tray panel's and Requests' chart and ranking in its own provider's currency (onkashiko on X): ledProv and the provider passed through, packed to the shortest form; drawLedColumns and drawLedRank are shared by the panel, so there is no page to move it to; +326 for the Qwen AI platform's Token Plan sign-in (imthe99galaxy on X): its field, sign-in and wait in qianwenplan.js, imported when such a provider's editor opens, and what is left is the import and one quotaError line for its two refusals, packed to the shortest form; quotaError reads every card's error, so there is no page to move it to; +72 for Copy all keys (emilochen on X): its row in keyrates.js, imported when a provider with two or more keys opens through keyRateField, now told which of its parts to draw, and what is left is the one line that places it; +83 for the page saying it has gone from view, so what its Sessions and Usage pages keep goes in 30 s and not 7 minutes (P0 memory): folded into the visibilitychange listener every window has, packed to the shortest form, so there is no page to move it to; +270 for Providers' Select, to remove several at once (eiyuuzaki2333 on X): its rows, bar, removal and keys in pvpick.js, imported when Select is first clicked, and what is left is pvSel, the button's click and two lines in renderProviders, which draws the list, so there is no page to move it to; +81 for each account of a provider's Usage card in a card of its own (normalcoder_ on X): one line that makes the box, its brief look left to CSS, and renderQuotas, which draws every card, so there is no page to move it to; +17 for Kimi Code's booster balance under an allowance card's rings in the tray panel (apple_test_src on X): the card's text line and the wallet line share one filter, packed to the shortest form; panelQuotaCard draws every card, so there is no page to move it to; +51 for what a failed plugin install left in plugins/, listed under Installed with a Remove (CHENGJIAHEGOXIS on X): its section in plugininstalled.js as pmLeftovers, imported when Plugins first draws, and what is left is the one call after drawInstalled; draw is what draws the page, so there is no page to move it to; +123 for a sidebar list folded from its page's row (hkwok06 on X): the chevron, its click and the fold kept per page in navicons.js, imported with the first list, and what is left is the folded list read beside the hidden pages' (navList, which navMine now shares) and the two rows' clicks asking navFold first; navSubs draws every list, so there is no page to move it to; +338 for the Daily update channel (fishmagic80 on X): its segment, its line under Update channel and the version row's two Up to date on Daily words, packed to the shortest form (one t() per choice); Settings › About and renderUpdate draw them on every window, so there is no page to move them to; +35 for Baidu Qianfan's Token Plan sign-in (yuushabu_buyinn on X, #5860): its field in qianfanplan.js, imported when such a provider's editor opens, drawn by renderStepPlan now told whose sign-in it brings, and what is left is the import and two quotaError lines, past the room there was; quotaError reads every card's error, so there is no page to move it to; +27 for Windows' title bar (258a14 on X): the caption buttons, their clicks, the bar's double click and what keeps them over a dialog in wincap.js, imported in Windows' window alone, the header's room for them in app.css, and what is left is the one line that imports it, past the 29 of room there was; that window's frame is drawn on every start, so there is no page to move it to; +107 for the pages in the reader's own order (chet030714 on X): the order, the sidebar and tab bar put in it, and the menu's drag and keys in navorder.js and navpages.js, imported once an order is kept or Settings draws, and what is left is the one line in navHides that imports it; navHides runs on every start, so there is no page to move it to ) // codeBytes is how many bytes of b are code: its blank lines, its lines diff --git a/internal/gui/tests/nav-pages-order.test.cjs b/internal/gui/tests/nav-pages-order.test.cjs new file mode 100644 index 000000000..fdc9392ce --- /dev/null +++ b/internal/gui/tests/nav-pages-order.test.cjs @@ -0,0 +1,155 @@ +// Run with Node's test runner and Playwright on the module path; see README.md. +// Settings › General › Sidebar pages puts the pages in the reader's order +// (chet030714 on X: Routing, Providers and Agents first in a phone's tab +// bar, the rest under More). A row of its menu is dragged to its place, or +// moved with Alt+↑/↓; the sidebar follows the order and leaves out its +// groups' names, a phone's tab bar shows the first four with the rest under +// More, the order is kept for this browser (localStorage magpie.navOrder), a +// page the kept order doesn't name goes after the page it follows at home, +// and Default order puts it all back. Chromium and WebKit, every language. No +// backend: the API is faked. +const assert = require("node:assert/strict"); +const fs = require("node:fs/promises"); +const path = require("node:path"); +const { test } = require("node:test"); +const { chromium, webkit } = require("playwright"); + +const assets = path.resolve(__dirname, "../assets"); +const BASE = "http://magpie.test/"; +const HOME = ["agents", "sessions", "library", "providers", "routing", "groups", "gateway", "usage", "masking", "plugins"]; +const RESET = { en: "Default order", zh: "恢复默认顺序", "zh-TW": "恢復預設順序", ja: "既定の順に戻す", de: "Standardreihenfolge" }; + +function server(lang, web) { + return async (route) => { + const url = new URL(route.request().url()); + const json = (d) => route.fulfill({ json: d }); + if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:${JSON.stringify(lang)},theme:"light",web:${web}};` }); + if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" }); + if (url.pathname === "/api/state") return json({ agents: [], profiles: [], settings: { lang, theme: "light" } }); + if (url.pathname === "/api/settings") return json({ theme: "light", lang, version: "0.1.400", gateway: "http://127.0.0.1:3425", web, visionModels: [], imageGenModels: [], lanURLs: [] }); + if (url.pathname === "/api/providers") return json({ providers: [], presets: [], excluded: [], gateway: { running: true, window: true } }); + if (url.pathname === "/api/plugins") return json({ plugins: [] }); + if (url.pathname === "/api/usage/quotas") return json([]); + if (url.pathname === "/api/groups") return json({ groups: [], models: [] }); + if (url.pathname === "/api/window/fit") return route.fulfill({ status: 204 }); + if (url.pathname.startsWith("/api/")) return json({}); + const file = path.join(assets, url.pathname === "/" ? "index.html" : url.pathname); + const contentType = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml", ".png": "image/png" }[path.extname(file)]; + try { await route.fulfill({ body: await fs.readFile(file), contentType }); } catch { await route.fulfill({ status: 404, body: "" }); } + }; +} + +async function open(browser, { lang = "en", web = false, phone = false } = {}) { + const context = await browser.newContext(phone + ? { viewport: { width: 390, height: 844 }, deviceScaleFactor: 2, hasTouch: true, isMobile: browser.browserType().name() === "chromium", reducedMotion: "reduce" } + : { viewport: { width: 1100, height: 760 }, reducedMotion: "reduce" }); + const page = await context.newPage(); + page.setDefaultTimeout(5000); + page.setDefaultNavigationTimeout(60000); + page.errors = []; + page.on("pageerror", (e) => page.errors.push(e.message)); + await page.route("**/*", server(lang, web)); + return page; +} + +// the built-in pages in the sidebar's order, and the groups' names it shows +const order = (page) => page.$$eval("#nav > button[data-view]:not([data-plugin-page])", (bs) => bs.map((b) => b.dataset.view)); +const groups = (page) => page.$$eval("#nav > .nav-gl", (gs) => gs.filter((g) => !g.hidden).map((g) => g.textContent)); +const menuOrder = (page) => page.$$eval(".nav-pages-menu .nav-pages-list .pm-item", (rs) => rs.map((r) => r.dataset.v)); +// the sidebar in that order: a kept order is put in place by navorder.js, +// imported as the page starts +const arranged = (page, want) => page.waitForFunction((w) => [...document.querySelectorAll("#nav > button[data-view]:not([data-plugin-page])")].map((b) => b.dataset.view).join() === w.join(), want); +const kept = (page) => page.evaluate(() => JSON.parse(localStorage.getItem("magpie.navOrder") || "null")); +const move = (list, v, to) => { const o = list.filter((x) => x !== v); o.splice(to, 0, v); return o; }; + +for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) { + for (const lang of Object.keys(RESET)) { + test(`${engine} ${lang}: the pages go in the reader's order, in the sidebar and a phone's tab bar`, async (t) => { + const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" })); + t.after(() => browser.close()); + const page = await open(browser, { lang }); + await page.goto(BASE + "?view=settings"); + await page.waitForSelector("#navPagesRow:not([hidden]) .nav-pages-pick"); + assert.deepEqual(await order(page), HOME, "home order at first"); + const homeGroups = await groups(page); + assert.equal(homeGroups.length, 4, "the sidebar's groups are named"); + await page.locator(".nav-pages-pick").click(); + await page.waitForSelector(".nav-pages-menu"); + assert.deepEqual(await menuOrder(page), HOME, "the menu lists every page, Providers too, in their order"); + assert.equal(await page.locator(".nav-pages-reset").isVisible(), false, "no Default order while it is the default"); + // Providers is always shown: a click leaves it ticked + await page.locator('.nav-pages-menu [data-v="providers"]').click({ force: true }); + assert.equal(await page.locator('.nav-pages-menu [data-v="providers"]').getAttribute("aria-checked"), "true"); + // Routing to the top from the keyboard + await page.locator('.nav-pages-menu [data-v="routing"]').focus(); + for (let i = 0; i < 4; i++) await page.keyboard.press("Alt+ArrowUp"); + let want = move(HOME, "routing", 0); + assert.deepEqual(await menuOrder(page), want); + assert.deepEqual(await order(page), want, "the sidebar follows at once"); + assert.deepEqual(await groups(page), [], "its groups' names go with the home order"); + assert.equal(await page.evaluate(() => document.activeElement?.dataset.v), "routing", "the moved row keeps the focus"); + // Providers dragged up to second by its row + const from = await page.locator('.nav-pages-menu [data-v="providers"]').boundingBox(); + const onto = await page.locator('.nav-pages-menu [data-v="agents"]').boundingBox(); + await page.mouse.move(from.x + from.width - 10, from.y + from.height / 2); + await page.mouse.down(); + for (let i = 1; i <= 12; i++) await page.mouse.move(from.x + from.width - 10, from.y + from.height / 2 + (onto.y - 4 - from.y) * i / 12); + await page.waitForTimeout(80); + await page.mouse.up(); + want = move(want, "providers", 1); + assert.deepEqual(await menuOrder(page), want, "dragged into place"); + assert.equal(await page.locator('.nav-pages-menu [data-v="providers"]').getAttribute("aria-checked"), "true", "a drag ticks nothing off"); + assert.deepEqual(await kept(page), want, "kept"); + // hiding a page still works beside the order + await page.locator('.nav-pages-menu [data-v="sessions"]').click(); + assert.equal(await page.locator('#nav button[data-view="sessions"]').isHidden(), true); + await page.keyboard.press("Escape"); + assert.equal(await page.locator(".nav-pages-menu").count(), 0); + + // kept for this browser: a reload draws it so from the start + await page.goto(BASE + "?view=providers"); + await page.waitForSelector("#nav button.on"); + await arranged(page, want); + assert.deepEqual(await groups(page), []); + + // a phone's tab bar: the first four shown, the rest under More + const phone = await open(browser, { lang, web: true, phone: true }); + await phone.goto(BASE); + await phone.evaluate((o) => { localStorage.setItem("magpie.navOrder", JSON.stringify(o)); localStorage.setItem("magpie.navHidden", '["sessions"]'); }, want); + await phone.goto(BASE + "?view=providers"); + await phone.waitForSelector("#nav .nav-more"); + await arranged(phone, want); + const bar = await phone.$$eval("#nav > button", (bs) => bs.filter((b) => getComputedStyle(b).display !== "none" && b.getBoundingClientRect().width > 0).map((b) => b.dataset.view || "more")); + const shown = want.filter((v) => v !== "sessions" && v !== "groups"); + assert.deepEqual(bar, [...shown.slice(0, 4), "more"], "the bar: " + JSON.stringify(bar)); + await phone.locator("#nav .nav-more").tap(); + const rest = await phone.$$eval(".nav-more-menu .pm-item", (rs) => rs.length); + assert.ok(rest >= shown.length - 4, "More has the rest"); + // the order is set on the phone too, where its pages are hidden + await phone.keyboard.press("Escape"); + await phone.goto(BASE + "?view=settings"); + await phone.waitForSelector("#navPagesRow:not([hidden]) .nav-pages-pick"); + await phone.locator(".nav-pages-pick").tap(); + await phone.waitForSelector(".nav-pages-menu .grip"); + assert.equal(await phone.locator('.nav-pages-menu [data-v="routing"] .grip').isVisible(), true, "a phone shows the grip"); + assert.deepEqual(phone.errors, []); + + // a page the kept order doesn't name (new in an update) goes after + // the page it follows at home + await page.evaluate(() => localStorage.setItem("magpie.navOrder", JSON.stringify(["routing", "providers", "agents", "sessions", "library", "gateway", "usage", "masking", "plugins"]))); + await page.goto(BASE + "?view=settings"); + await page.waitForSelector(".nav-pages-pick"); + await arranged(page, ["routing", "groups", "providers", "agents", "sessions", "library", "gateway", "usage", "masking", "plugins"]); + + // Default order puts the pages and their groups back + await page.locator(".nav-pages-pick").click(); + await page.locator(".nav-pages-reset").click(); + assert.equal(await page.locator(".nav-pages-reset").isVisible(), false); + assert.equal(await page.locator(".nav-pages-reset").innerText().catch(() => RESET[lang]), RESET[lang]); + assert.deepEqual(await order(page), HOME); + assert.deepEqual(await groups(page), homeGroups); + assert.equal(await kept(page), null); + assert.deepEqual(page.errors, []); + }); + } +} diff --git a/internal/gui/tests/old-webkit.test.cjs b/internal/gui/tests/old-webkit.test.cjs index 271c48933..f0c6e8a9b 100644 --- a/internal/gui/tests/old-webkit.test.cjs +++ b/internal/gui/tests/old-webkit.test.cjs @@ -183,9 +183,10 @@ test("compat.js is the first of the page's own scripts", async () => { // claudemagpie.js when Claude Desktop's twin button or Advanced fold first shows; // keyrates.js when a provider with two or more keys opens; // appearance.js when Settings draws General or the look changes; + // navorder.js once a page order is kept, or Settings › Sidebar pages draws; // the checks above // still read them - for (const f of await scripts()) if (!["webfonts.js", "cfgblocked.js", "signsheets.js", "ruleedit.js", "ratewindows.js", "traywindows.js", "autoresetown.js", "registry.js", "navlamp.js", "whatsnew.js", "claudemode.js", "ctxtext.js", "resetask.js", "quotaall.js", "quotatable.js", "quitask.js", "checkinnow.js", "proxies.js", "autobackup.js", "scrollends.js", "profilerename.js", "settingshints.js", "keyspend.js", "syncfiles.js", "agentcompact.js", "agentwindow.js", "balfound.js", "passerrors.js", "tlscerts.js", "keybalance.js", "modellimits.js", "notices.js", "videogen.js", "provlinks.js", "setfeats.js", "pageshare.js", "panelfirst.js", "panelarrange.js", "modelfind.js", "agentsmanager.js", "agentsuffix.js", "phonetabs.js", "pluginmd.js", "bark.js", "acctexport.js", "plugincounts.js", "navicons.js", "autoswitchtip.js", "codexprojects.js", "pipecheck.js", "addfloat.js", "plugingrid.js", "plugininstalled.js", "rotfig.js", "ompadvisor.js", "claudemagpie.js", "keyrates.js", "qianwenplan.js", "qianfanplan.js", "agymove.js", "updatetrust.js", "currencyprefs.js", "appearance.js", "mirroredit.js"].includes(f)) assert(all.includes(f), f + " is not loaded by index.html"); + for (const f of await scripts()) if (!["webfonts.js", "cfgblocked.js", "signsheets.js", "ruleedit.js", "ratewindows.js", "traywindows.js", "autoresetown.js", "registry.js", "navlamp.js", "whatsnew.js", "claudemode.js", "ctxtext.js", "resetask.js", "quotaall.js", "quotatable.js", "quitask.js", "checkinnow.js", "proxies.js", "autobackup.js", "scrollends.js", "profilerename.js", "settingshints.js", "keyspend.js", "syncfiles.js", "agentcompact.js", "agentwindow.js", "balfound.js", "passerrors.js", "tlscerts.js", "keybalance.js", "modellimits.js", "notices.js", "videogen.js", "provlinks.js", "setfeats.js", "pageshare.js", "panelfirst.js", "panelarrange.js", "modelfind.js", "agentsmanager.js", "agentsuffix.js", "phonetabs.js", "pluginmd.js", "bark.js", "acctexport.js", "plugincounts.js", "navicons.js", "autoswitchtip.js", "codexprojects.js", "pipecheck.js", "addfloat.js", "plugingrid.js", "plugininstalled.js", "rotfig.js", "ompadvisor.js", "claudemagpie.js", "keyrates.js", "qianwenplan.js", "qianfanplan.js", "agymove.js", "updatetrust.js", "currencyprefs.js", "appearance.js", "mirroredit.js", "navorder.js"].includes(f)) assert(all.includes(f), f + " is not loaded by index.html"); }); test("the styles hold up in Safari 15.0", async () => {