diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css index ea3c7f15f..f7ea0c9be 100644 --- a/internal/gui/assets/app.css +++ b/internal/gui/assets/app.css @@ -849,7 +849,9 @@ body.panel #agents > .row .ag-handle::before { left: -8px; } .ag-open .field.ag-who .ok { order: 2; } .ag-who .ok { display: none; flex: none; align-items: center; gap: 3px; color: var(--green); font-weight: 600; } .ag-who.done .ok { display: inline-flex; } +/* busy: app.js glyphBusy has put the spinner's arc in place of the glyph */ .ag-fix.busy svg > * { transform-box: view-box; transform-origin: 50% 50%; animation: spin .8s linear infinite; } +@media (prefers-reduced-motion: reduce) { .ag-fix.busy svg > * { animation: none; } } /* what has to listen at an address no agent reaches magpie by (#1013): long addresses wrap, and it can be copied */ .drift-why { overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; } /* the agent's CLI on its name's line (#202): its version faint, and a quiet diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index f8c2b1864..893d171bd 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -2115,13 +2115,13 @@ function appRestart(a) { e.stopPropagation(); if (!(await confirmRestart(a.name))) return; go.disabled = true; - go.classList.add("busy"); + glyphBusy(go, true); try { state = await api("agents/restart/" + a.id, {}); renderAgents(); status(t("{agent} restarted", { agent: a.name })); } catch (err) { - if (go.isConnected) { go.disabled = false; go.classList.remove("busy"); } + if (go.isConnected) { go.disabled = false; glyphBusy(go, false); } status(tNotice(err.message), "err"); } }; @@ -2506,7 +2506,7 @@ async function keepAgent(a) { // reapplyAgent writes what magpie set on the agent into its config again. async function reapplyAgent(a, btn) { - btn?.classList.add("busy"); + glyphBusy(btn, true); try { state = await api("agents/reapply/" + a.id, {}); renderAgents(); @@ -2514,7 +2514,7 @@ async function reapplyAgent(a, btn) { const msg = t("{agent} goes through magpie again", { agent: a.name }); saidOk(msg); } catch (e) { - btn?.classList.remove("busy"); + glyphBusy(btn, false); statusErr(e); } } @@ -2529,6 +2529,18 @@ const cliBusy = new Set(); // the ones being updated now const CLI_UP = "M8 2.5v8M4.5 7 8 10.5 11.5 7M3.5 13.5h9"; const CLI_SPIN = "M13.5 8a5.5 5.5 0 1 1-5.5-5.5"; +// glyphBusy shows an icon button at work with the spinner the others turn +// (saving, a CLI's update): its glyph is put aside for the arc and comes +// back when it is done. A glyph turning on itself said nothing but that +// it was turning (a skill's update arrow went round, @wiirhan on X). +function glyphBusy(b, on) { + const g = b?.querySelector("svg"); + if (!g) return; + b.classList.toggle("busy", on); + if (on) b.held ||= (g.replaceWith(svg(CLI_SPIN, g.getAttribute("width"))), g); + else if (b.held) g.replaceWith(b.held), b.held = 0; +} + function cliTag(a) { const box = el("span", "ag-cli"); // its settings are here, its CLI isn't: uninstalled, its folder left diff --git a/internal/gui/assets/plugins/library/client.js b/internal/gui/assets/plugins/library/client.js index cf8b4e61b..0d14abccd 100644 --- a/internal/gui/assets/plugins/library/client.js +++ b/internal/gui/assets/plugins/library/client.js @@ -8342,13 +8342,14 @@ magpie.plugin("library", (ctx) => { if (!gone && (s.kind === "github" || s.kind === "git" || s.origin)) { const u = button("", "lib-icon", async (e, b) => { if (s.edited) return confirmUpdateEdited(s); - // spinning, with the row's actions kept in view while the fetch - // runs; then what came of it: updated, nothing new, or the error - b.classList.add("busy"); + // the spinner in place of its arrow, with the row's actions kept in + // view while the fetch runs; then what came of it: updated, + // nothing new, or the error + glyphBusy(b, true); b.parentElement?.classList.add("busy"); await change("skills/update", { name: s.name }, (res) => res?.current?.includes(s.name) ? t("{name} is already up to date", { name: s.name }) : t("{name} is updated", { name: s.name })); - b.classList.remove("busy"); + glyphBusy(b, false); b.parentElement?.classList.remove("busy"); }); u.append(svg(GLYPH.up, 13, 1.5)); diff --git a/internal/gui/assets/plugins/library/library.css b/internal/gui/assets/plugins/library/library.css index 30e1997bf..3a1197ab4 100644 --- a/internal/gui/assets/plugins/library/library.css +++ b/internal/gui/assets/plugins/library/library.css @@ -416,10 +416,9 @@ input.lib-setname:focus { border-color: var(--accent); box-shadow: 0 0 0 3px col .lib-icon { width: 26px; height: 26px; padding: 0; display: inline-grid; place-items: center; } .lib-rowacts.busy { opacity: 1; } .lib-icon.busy, .lib-icon.busy:disabled { opacity: 1; color: var(--muted); } -.lib-icon.busy svg { animation: lib-spin .8s linear infinite; } -@keyframes lib-spin { to { transform: rotate(360deg); } } -@media (prefers-reduced-motion: reduce) { .lib-icon.busy svg { animation: lib-pulse 1.2s ease infinite alternate; } } -@keyframes lib-pulse { to { opacity: .35; } } +/* busy: app.js glyphBusy has put the spinner's arc in place of the glyph */ +.lib-icon.busy svg > * { transform-box: view-box; transform-origin: 50% 50%; animation: spin .8s linear infinite; } +@media (prefers-reduced-motion: reduce) { .lib-icon.busy svg > * { animation: none; } } /* the skill finder */ .lib-install { margin-bottom: 4px; } diff --git a/internal/gui/core_budget_test.go b/internal/gui/core_budget_test.go index 7620a09c9..8a542355e 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_089_252 // 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; +275 for the grants Alibaba's Token Plan asks of a RAM user's AccessKey in the reader's language (MetalHqa on X): one string (ALI_RAM) shown under the editor's AccessKey ID and on the card that names them, less the 48 of the wrong "a RAM user that may use Model Studio is enough" it replaces; the editor and quotaError draw them on every window, so there is no page to move them to; +135 for a model test its vendor queued shown queued and not green (sufeng1894 on X): queuedSaid, one string shared by the chip's title, Test models' and Test this model's status, and the chip's amber dot; renderModels draws the provider editor's chips, so there is no page to move it to; +66 for AstrLink Guard's row saying an x64 magpie runs it under Windows on Arm's emulation until the next update installs the Arm build (EV_John_Liu on X), the Rosetta line's sibling, one line in pmSub; the Privacy rows draw it, so there is no page to move it to; +864 for Use on a Claude setup-token account, which switches Claude Code itself to it in its settings.json, and Use back on its signed-in account (liukaybee on X): one swUse helper shared by both buttons, packed to the shortest form; renderAccounts draws every account row, so there is no page to move it to; +1 for the classifier timeout's unset default, 15 and not 8 (ESern29751 on X): its second digit in the Settings row's fallback, which renderReplies draws, so there is no page to move it to; +457 for Kimi Code's subagent pool and its effort (XiaoLing_Arisa on X): the Subagents line and its pool menu in kimisub.js, imported before a Kimi Code row's Details first slides open so it measures the line, and what is left is that import, the line's place, the three fields kept out of the row's squares and the picker's note that Kimi's subagents run on the lead's model, packed to the shortest form; renderAgents draws every row, so there is no page to move it to; +354 for Images per request (#6849, Yuu_jiang_ on X): its field and parse are in maximages.js, imported as the editor draws Max output, and what stays is the import, the two saves' lines and the check that the editor is still open when it and keyrates.js land, no page to move them to; +499 for Speed beside Model and Effort in an agent's opened row (Tengs999 on X): the line, its menu and what decides the speed in agentspeed.js, imported before a fast model's Details first slides open so it measures the line, and what is left is that import and the line's place in the panel's and the window's rows, packed to one helper; renderAgents draws every row, so there is no page to move it to; -1,529: each ChatGPT account's own warm-up time (renderWarmAtOwn) moved into autoresetown.js, imported when its rows first draw, paying for a provider's editor opening Advanced when its warm-up or check-in is on (ChrisYagao on X), and the room left over given back; +103 for the sidebar foot that holds Settings' tabs marked by a class, not :has(), which Safari before 15.4 can't parse (#5919): no page's code small enough to move was left (modelInfo serves two plugins); +52 for a proxy's failure said in the reader's language (laiuuui on X): proxyWhy is in proxies.js, imported when Settings draws its saved proxies, and what is left is api()'s one line handing the reply to it; api() reads every error, so there is no page to move it to; +485 for which effort a Claude Code tier runs at (lightwlh on X): an unset tier's effort reads follows session, a set one's title says the session's effort and /effort don't change it, and New sessions' effort says a tier with its own runs at that one, one ownSaid shared by both titles, packed to the shortest form; connectPanel and the effort slider draw every agent's Details, so there is no page to move it to; -165: the provider editor's WebSocket row moved into socketrow.js, imported as the editor draws, paying for its tick opening ticked on OpenAI's own API (KawaiiZapic on X), and the room left over given back; +68 for the version row saying a version newer than its channel's waits until the channel passes it (realfxw on X): one t() for both channels and the Every version tail shared with Up to date, packed to the shortest form; renderUpdate draws it on every window, so there is no page to move it to; +5 for the Version row's Restart named Restart only (realfxw on X restarted again and again on a bare Restart beside Check, waiting for an update): the one word more, short enough that the row's line doesn't wrap at 420; renderUpdate draws it on every window, so there is no page to move it to; +611 for the Usage page's cards kept still as they come in (liuzhengdong99 on X: 滑到上面看某张卡片,视图会被拽回下面): keepInView finding a card drawn anew by its data-key and leaving the browser's own anchoring to a view with none kept, unpin letting cards arranged by hand land where they were dropped, loadQuotas saying a read is under way, and an empty first history answer counted as come; which cards wait and the heights they keep went to the usage plugin, and what is left is the scroll guard every page goes through, so there is no page to move it to - coreScriptBudget = 1_273_943 // 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; +275 for the grants Alibaba's Token Plan asks of a RAM user's AccessKey in the reader's language (MetalHqa on X): one string (ALI_RAM) shown under the editor's AccessKey ID and on the card that names them, less the 48 of the wrong "a RAM user that may use Model Studio is enough" it replaces; the editor and quotaError draw them on every window, so there is no page to move them to; +135 for a model test its vendor queued shown queued and not green (sufeng1894 on X): queuedSaid, one string shared by the chip's title, Test models' and Test this model's status, and the chip's amber dot; renderModels draws the provider editor's chips, so there is no page to move it to; +66 for AstrLink Guard's row saying an x64 magpie runs it under Windows on Arm's emulation until the next update installs the Arm build (EV_John_Liu on X), the Rosetta line's sibling, one line in pmSub; the Privacy rows draw it, so there is no page to move it to; +189 for Let magpie set it on a Codex card locked by config.toml's own compact limit or background threshold (sufeng1894 on X), and Undo for a background share taken over: the shared send posts it, packed to the shortest form; adviceRow draws every card, so there is no page to move it to; +864 for Use on a Claude setup-token account, which switches Claude Code itself to it in its settings.json, and Use back on its signed-in account (liukaybee on X): one swUse helper shared by both buttons, packed to the shortest form; renderAccounts draws every account row, so there is no page to move it to; +1 for the classifier timeout's unset default, 15 and not 8 (ESern29751 on X): its second digit in the Settings row's fallback, which renderReplies draws, so there is no page to move it to; +457 for Kimi Code's subagent pool and its effort (XiaoLing_Arisa on X): the Subagents line and its pool menu in kimisub.js, imported before a Kimi Code row's Details first slides open so it measures the line, and what is left is that import, the line's place, the three fields kept out of the row's squares and the picker's note that Kimi's subagents run on the lead's model, packed to the shortest form; renderAgents draws every row, so there is no page to move it to; +354 for Images per request (#6849, Yuu_jiang_ on X): its field and parse are in maximages.js, imported as the editor draws Max output, and what stays is the import, the two saves' lines and the check that the editor is still open when it and keyrates.js land, no page to move them to; +499 for Speed beside Model and Effort in an agent's opened row (Tengs999 on X): the line, its menu and what decides the speed in agentspeed.js, imported before a fast model's Details first slides open so it measures the line, and what is left is that import and the line's place in the panel's and the window's rows, packed to one helper; renderAgents draws every row, so there is no page to move it to; -1,529: each ChatGPT account's own warm-up time moved into autoresetown.js, paying for Advanced opening on a warm-up or check-in that is on (ChrisYagao on X), the room left over given back; +103 for the same .with-sub foot (#5919); +52 for the Advisor kind of an advisor call's own usage row (#6977, Refeccd on Discord): its entry in the generated purposes.js; the kinds are read wherever Usage and Routing draw a row, so there is no page to move it to; +54 for a proxy's failure said in the reader's language (laiuuui on X): proxyWhy is in proxies.js, imported when Settings draws its saved proxies, and what is left is api()'s one line handing the reply to it; api() reads every error, so there is no page to move it to; +843 for which effort a Claude Code tier runs at (lightwlh on X): an unset tier's effort reads follows session, a set one's title says the session's effort and /effort don't change it, and New sessions' effort says a tier with its own runs at that one, one ownSaid shared by both titles, packed to the shortest form; connectPanel and the effort slider draw every agent's Details, so there is no page to move it to; -165: the provider editor's WebSocket row moved into socketrow.js, imported as the editor draws, paying for its tick opening ticked on OpenAI's own API (KawaiiZapic on X), and the room left over given back; +68 for the version row saying a version newer than its channel's waits until the channel passes it (realfxw on X): one t() for both channels and the Every version tail shared with Up to date, packed to the shortest form; renderUpdate draws it on every window, so there is no page to move it to; +5 for the Version row's Restart named Restart only (realfxw on X restarted again and again on a bare Restart beside Check, waiting for an update): the one word more, short enough that the row's line doesn't wrap at 420; renderUpdate draws it on every window, so there is no page to move it to; +611 for the Usage page's cards kept still as they come in (liuzhengdong99 on X: 滑到上面看某张卡片,视图会被拽回下面): keepInView finding a card drawn anew by its data-key and leaving the browser's own anchoring to a view with none kept, unpin letting cards arranged by hand land where they were dropped, loadQuotas saying a read is under way, and an empty first history answer counted as come; which cards wait and the heights they keep went to the usage plugin, and what is left is the scroll guard every page goes through, so there is no page to move it to + appScriptBudget = 1_089_480 // 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; +275 for the grants Alibaba's Token Plan asks of a RAM user's AccessKey in the reader's language (MetalHqa on X): one string (ALI_RAM) shown under the editor's AccessKey ID and on the card that names them, less the 48 of the wrong "a RAM user that may use Model Studio is enough" it replaces; the editor and quotaError draw them on every window, so there is no page to move them to; +135 for a model test its vendor queued shown queued and not green (sufeng1894 on X): queuedSaid, one string shared by the chip's title, Test models' and Test this model's status, and the chip's amber dot; renderModels draws the provider editor's chips, so there is no page to move it to; +66 for AstrLink Guard's row saying an x64 magpie runs it under Windows on Arm's emulation until the next update installs the Arm build (EV_John_Liu on X), the Rosetta line's sibling, one line in pmSub; the Privacy rows draw it, so there is no page to move it to; +864 for Use on a Claude setup-token account, which switches Claude Code itself to it in its settings.json, and Use back on its signed-in account (liukaybee on X): one swUse helper shared by both buttons, packed to the shortest form; renderAccounts draws every account row, so there is no page to move it to; +1 for the classifier timeout's unset default, 15 and not 8 (ESern29751 on X): its second digit in the Settings row's fallback, which renderReplies draws, so there is no page to move it to; +457 for Kimi Code's subagent pool and its effort (XiaoLing_Arisa on X): the Subagents line and its pool menu in kimisub.js, imported before a Kimi Code row's Details first slides open so it measures the line, and what is left is that import, the line's place, the three fields kept out of the row's squares and the picker's note that Kimi's subagents run on the lead's model, packed to the shortest form; renderAgents draws every row, so there is no page to move it to; +354 for Images per request (#6849, Yuu_jiang_ on X): its field and parse are in maximages.js, imported as the editor draws Max output, and what stays is the import, the two saves' lines and the check that the editor is still open when it and keyrates.js land, no page to move them to; +499 for Speed beside Model and Effort in an agent's opened row (Tengs999 on X): the line, its menu and what decides the speed in agentspeed.js, imported before a fast model's Details first slides open so it measures the line, and what is left is that import and the line's place in the panel's and the window's rows, packed to one helper; renderAgents draws every row, so there is no page to move it to; -1,529: each ChatGPT account's own warm-up time (renderWarmAtOwn) moved into autoresetown.js, imported when its rows first draw, paying for a provider's editor opening Advanced when its warm-up or check-in is on (ChrisYagao on X), and the room left over given back; +103 for the sidebar foot that holds Settings' tabs marked by a class, not :has(), which Safari before 15.4 can't parse (#5919): no page's code small enough to move was left (modelInfo serves two plugins); +52 for a proxy's failure said in the reader's language (laiuuui on X): proxyWhy is in proxies.js, imported when Settings draws its saved proxies, and what is left is api()'s one line handing the reply to it; api() reads every error, so there is no page to move it to; +485 for which effort a Claude Code tier runs at (lightwlh on X): an unset tier's effort reads follows session, a set one's title says the session's effort and /effort don't change it, and New sessions' effort says a tier with its own runs at that one, one ownSaid shared by both titles, packed to the shortest form; connectPanel and the effort slider draw every agent's Details, so there is no page to move it to; -165: the provider editor's WebSocket row moved into socketrow.js, imported as the editor draws, paying for its tick opening ticked on OpenAI's own API (KawaiiZapic on X), and the room left over given back; +68 for the version row saying a version newer than its channel's waits until the channel passes it (realfxw on X): one t() for both channels and the Every version tail shared with Up to date, packed to the shortest form; renderUpdate draws it on every window, so there is no page to move it to; +5 for the Version row's Restart named Restart only (realfxw on X restarted again and again on a bare Restart beside Check, waiting for an update): the one word more, short enough that the row's line doesn't wrap at 420; renderUpdate draws it on every window, so there is no page to move it to; +611 for the Usage page's cards kept still as they come in (liuzhengdong99 on X: 滑到上面看某张卡片,视图会被拽回下面): keepInView finding a card drawn anew by its data-key and leaving the browser's own anchoring to a view with none kept, unpin letting cards arranged by hand land where they were dropped, loadQuotas saying a read is under way, and an empty first history answer counted as come; which cards wait and the heights they keep went to the usage plugin, and what is left is the scroll guard every page goes through, so there is no page to move it to; +228 for an icon button at work showing the spinner every other button turns in place of its glyph, not the glyph turning on itself (wiirhan on X: a Library skill's Update spun its own up arrow): glyphBusy, shared by that Update and an agent row's Apply again and Restart, packed to the shortest form; renderAgents and the Library's rows draw them on every window, so there is no page to move it to + coreScriptBudget = 1_274_171 // 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; +275 for the grants Alibaba's Token Plan asks of a RAM user's AccessKey in the reader's language (MetalHqa on X): one string (ALI_RAM) shown under the editor's AccessKey ID and on the card that names them, less the 48 of the wrong "a RAM user that may use Model Studio is enough" it replaces; the editor and quotaError draw them on every window, so there is no page to move them to; +135 for a model test its vendor queued shown queued and not green (sufeng1894 on X): queuedSaid, one string shared by the chip's title, Test models' and Test this model's status, and the chip's amber dot; renderModels draws the provider editor's chips, so there is no page to move it to; +66 for AstrLink Guard's row saying an x64 magpie runs it under Windows on Arm's emulation until the next update installs the Arm build (EV_John_Liu on X), the Rosetta line's sibling, one line in pmSub; the Privacy rows draw it, so there is no page to move it to; +189 for Let magpie set it on a Codex card locked by config.toml's own compact limit or background threshold (sufeng1894 on X), and Undo for a background share taken over: the shared send posts it, packed to the shortest form; adviceRow draws every card, so there is no page to move it to; +864 for Use on a Claude setup-token account, which switches Claude Code itself to it in its settings.json, and Use back on its signed-in account (liukaybee on X): one swUse helper shared by both buttons, packed to the shortest form; renderAccounts draws every account row, so there is no page to move it to; +1 for the classifier timeout's unset default, 15 and not 8 (ESern29751 on X): its second digit in the Settings row's fallback, which renderReplies draws, so there is no page to move it to; +457 for Kimi Code's subagent pool and its effort (XiaoLing_Arisa on X): the Subagents line and its pool menu in kimisub.js, imported before a Kimi Code row's Details first slides open so it measures the line, and what is left is that import, the line's place, the three fields kept out of the row's squares and the picker's note that Kimi's subagents run on the lead's model, packed to the shortest form; renderAgents draws every row, so there is no page to move it to; +354 for Images per request (#6849, Yuu_jiang_ on X): its field and parse are in maximages.js, imported as the editor draws Max output, and what stays is the import, the two saves' lines and the check that the editor is still open when it and keyrates.js land, no page to move them to; +499 for Speed beside Model and Effort in an agent's opened row (Tengs999 on X): the line, its menu and what decides the speed in agentspeed.js, imported before a fast model's Details first slides open so it measures the line, and what is left is that import and the line's place in the panel's and the window's rows, packed to one helper; renderAgents draws every row, so there is no page to move it to; -1,529: each ChatGPT account's own warm-up time moved into autoresetown.js, paying for Advanced opening on a warm-up or check-in that is on (ChrisYagao on X), the room left over given back; +103 for the same .with-sub foot (#5919); +52 for the Advisor kind of an advisor call's own usage row (#6977, Refeccd on Discord): its entry in the generated purposes.js; the kinds are read wherever Usage and Routing draw a row, so there is no page to move it to; +54 for a proxy's failure said in the reader's language (laiuuui on X): proxyWhy is in proxies.js, imported when Settings draws its saved proxies, and what is left is api()'s one line handing the reply to it; api() reads every error, so there is no page to move it to; +843 for which effort a Claude Code tier runs at (lightwlh on X): an unset tier's effort reads follows session, a set one's title says the session's effort and /effort don't change it, and New sessions' effort says a tier with its own runs at that one, one ownSaid shared by both titles, packed to the shortest form; connectPanel and the effort slider draw every agent's Details, so there is no page to move it to; -165: the provider editor's WebSocket row moved into socketrow.js, imported as the editor draws, paying for its tick opening ticked on OpenAI's own API (KawaiiZapic on X), and the room left over given back; +68 for the version row saying a version newer than its channel's waits until the channel passes it (realfxw on X): one t() for both channels and the Every version tail shared with Up to date, packed to the shortest form; renderUpdate draws it on every window, so there is no page to move it to; +5 for the Version row's Restart named Restart only (realfxw on X restarted again and again on a bare Restart beside Check, waiting for an update): the one word more, short enough that the row's line doesn't wrap at 420; renderUpdate draws it on every window, so there is no page to move it to; +611 for the Usage page's cards kept still as they come in (liuzhengdong99 on X: 滑到上面看某张卡片,视图会被拽回下面): keepInView finding a card drawn anew by its data-key and leaving the browser's own anchoring to a view with none kept, unpin letting cards arranged by hand land where they were dropped, loadQuotas saying a read is under way, and an empty first history answer counted as come; which cards wait and the heights they keep went to the usage plugin, and what is left is the scroll guard every page goes through, so there is no page to move it to; +228 for an icon button at work showing the spinner every other button turns in place of its glyph, not the glyph turning on itself (wiirhan on X: a Library skill's Update spun its own up arrow): glyphBusy, shared by that Update and an agent row's Apply again and Restart, packed to the shortest form; renderAgents and the Library's rows draw them on every window, 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/busy-glyph-spinner.test.cjs b/internal/gui/tests/busy-glyph-spinner.test.cjs new file mode 100644 index 000000000..b270ab80b --- /dev/null +++ b/internal/gui/tests/busy-glyph-spinner.test.cjs @@ -0,0 +1,155 @@ +// Run with Node's test runner and Playwright on the module path; see README.md. +// @wiirhan on X: "资源库--技能--更新技能的loading状态为啥是直接转箭头?" A +// skill's Update in the Library turned its own up arrow round and round +// while the fetch ran, which reads as a joke, not as work under way. An icon +// button at work now shows the spinner every other button turns (saving, a +// CLI's update: CLI_SPIN's arc) in place of its glyph, and gets its glyph +// back when it is done. The same for an agent row's Restart, whose circular +// arrow turned the same way. Held answers keep each button at work while it +// is looked at: the arc is there, the glyph is not, it turns at 0.9s a turn +// or faster, and with reduced motion it stands still. Chromium and WebKit, +// en, zh, zh-TW, ja and de, wide and narrow. 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 { strings } = require("./strings.cjs"); + +const assets = path.resolve(__dirname, process.env.MAGPIE_ASSETS || "../assets"); +const SPIN = "M13.5 8a5.5 5.5 0 1 1-5.5-5.5"; // app.js CLI_SPIN +const UP = "M8 12.5v-9 M4.5 7 8 3.5 11.5 7"; // the library's GLYPH.up +const REAPPLY = "M13.5 8a5.5 5.5 0 1 1-1.6-3.9M13.5 2.5v3.25h-3.25"; // app.js REAPPLY +const HOME = "/Users/wiirhan"; +const lib = { + dir: `${HOME}/.magpie/library`, backups: `${HOME}/.magpie/backups`, home: HOME, + agents: [{ id: "claude", name: "Claude Code", icon: "", skills: `${HOME}/.claude/skills`, mcp: `${HOME}/.claude.json` }], + instructions: { agents: [] }, servers: [], foundServers: [], foundSkills: [], projects: [], problems: [], + skills: [{ name: "pdf", description: "Reads PDFs", kind: "github", agents: ["claude"], source: "https://github.com/owner/repo/tree/main/pdf" }], +}; +const days = (n) => new Date(Date.now() - n * 86400e3).toISOString(); +const workbuddy = { + id: "workbuddy", name: "WorkBuddy", icon: "generic", path: "/fixture/models.json", wired: true, appRestart: { since: days(1) }, + fields: [{ key: "model", label: "model", value: "deepseek-v4", options: [{ value: "deepseek-v4", label: "DeepSeek V4", ref: "deepseek/deepseek-v4", note: "DeepSeek · via magpie" }] }], +}; + +let I18N; +const tr = (lang, key, vars = {}) => { + const s = lang === "en" ? key : I18N[lang][key]; + assert.equal(typeof s, "string", `${lang} has no ${JSON.stringify(key)}`); + return s.replace(/\{(\w+)\}/g, (m, k) => (k in vars ? String(vars[k]) : m)); +}; + +// held: the paths whose answer waits until the test lets it go +function serve(lang, held) { + return async (route) => { + const req = route.request(), url = new URL(req.url()); + const json = (data, status = 200) => route.fulfill({ status, json: data }); + if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light",web:true};` }); + if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" }); + if (url.pathname === "/api/state") return json({ agents: [workbuddy], profiles: [], settings: { lang, theme: "light" } }); + if (url.pathname === "/api/library") return json(lib); + if (url.pathname === "/api/library/skills/update") { + await new Promise((go) => held.set("update", go)); + return json({ ...lib, result: { changed: ["claude"] } }); + } + // the restart fails, so its button stays to show its glyph back + if (url.pathname.startsWith("/api/agents/restart/")) { + await new Promise((go) => held.set("restart", go)); + return json({ error: "WorkBuddy is still open" }, 409); + } + if (url.pathname === "/api/plugins") return json({ plugins: [] }); + if (url.pathname === "/api/agents/cli") return json({ agents: {}, pending: false }); + if (url.pathname === "/api/usage/quotas") return json([]); + if (url.pathname === "/api/groups") return json({ groups: [] }); + if (url.pathname === "/api/providers") return json({ providers: [], presets: [], excluded: [], gateway: { running: true, window: true } }); + if (url.pathname.startsWith("/api/")) return json({}); + if (url.host !== "magpie.test") return route.fulfill({ status: 404, body: "" }); + 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: "" }); } + }; +} + +// what the button draws and how it turns: its paths, and each running +// animation that rotates, with its turn's length and how often it repeats +// (a colour or opacity transition is not a turn) +const look = (loc) => loc.evaluate((b) => ({ + paths: [...b.querySelectorAll("svg path")].map((p) => p.getAttribute("d")), + turns: b.getAnimations({ subtree: true }).filter((a) => a.effect.getKeyframes().some((f) => /rotate|matrix/.test(f.transform || ""))).map((a) => { + const tm = a.effect.getComputedTiming(); + return { duration: tm.duration, iterations: tm.iterations, on: a.effect.target.tagName.toLowerCase() }; + }), +})); + +function atWork(seen, reduce, what) { + assert.deepEqual(seen.paths, [SPIN], `${what} at work draws ${JSON.stringify(seen.paths)}, not the spinner alone`); + if (reduce) return assert.deepEqual(seen.turns, [], `${what} turns with reduced motion`); + const spins = seen.turns; + assert.equal(spins.length, 1, `${what}: ${JSON.stringify(seen.turns)}`); + assert.equal(spins[0].on, "path", `${what} turns its whole svg, not the arc inside it`); + assert.ok(spins[0].duration <= 900, `${what} turns once in ${spins[0].duration}ms`); + assert.equal(spins[0].iterations, Infinity); +} + +const sideways = (page) => page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth); + +for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) { + test(engine + ": an icon button at work shows the spinner, not its glyph turning", async (t) => { + assert(["chromium", "webkit"].includes(engine), "BROWSER must be chromium or webkit"); + I18N = strings().I18N; + const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: process.env.PLAYWRIGHT_CHANNEL || "chromium" })); + t.after(() => browser.close()); + for (const [width, reduce] of [[1100, false], [420, true]]) for (const lang of ["en", "zh", "zh-TW", "ja", "de"]) { + await t.test(`${lang} at ${width}px${reduce ? ", reduced motion" : ""}`, async () => { + const held = new Map(), errors = []; + const ctx = await browser.newContext({ viewport: { width, height: 900 }, reducedMotion: reduce ? "reduce" : "no-preference" }); + await ctx.addInitScript(() => { try { localStorage.setItem("magpie.libTab", "skills"); } catch {} }); + const page = await ctx.newPage(); + page.setDefaultTimeout(5000); + page.setDefaultNavigationTimeout(60000); + page.on("pageerror", (e) => errors.push(e.message)); + await page.route("**/*", serve(lang, held)); + + // the Library's skill row: Update, at work and then done + await page.goto("http://magpie.test/"); + await page.locator('button[data-view="library"]').click(); + const row = page.locator("#view-library .lib-row").filter({ has: page.locator(".name", { hasText: /^pdf$/ }) }); + await row.waitFor(); + const up = row.locator(".lib-rowacts .lib-icon").first(); + assert.deepEqual((await look(up)).paths, [UP], "the row's first action is not Update"); + await row.hover(); + await up.click(); + await page.waitForFunction(() => document.querySelector("#view-library .lib-rowacts .lib-icon.busy")); + await page.waitForFunction(() => document.querySelector("#view-library").getAttribute("aria-busy") === "true"); + assert.equal(held.size, 1, "Update posted nothing"); + atWork(await look(up), reduce, "a skill's Update"); + // the row's actions stay in view while Update works (they fade in on hover, so wait out the fade) + await page.waitForFunction(() => getComputedStyle(document.querySelector("#view-library .lib-rowacts")).opacity === "1"); + assert.ok(await sideways(page) <= 1, "the page scrolls sideways"); + held.get("update")(); + await page.locator("#status").filter({ hasText: tr(lang, "{name} is updated", { name: "pdf" }) }).waitFor(); + const back = row.locator(".lib-rowacts .lib-icon").first(); + assert.deepEqual(await look(back), { paths: [UP], turns: [] }, "Update didn't get its arrow back"); + + // an agent row's Restart, the same + await page.goto("http://magpie.test/?view=agents"); + const go = page.locator('.row.agent[data-id="workbuddy"] .ag-restart'); + await go.waitFor(); + assert.deepEqual((await look(go)).paths, [REAPPLY]); + await go.click(); + await page.locator("dialog.action-confirm[open] button.primary").click(); + await page.waitForFunction(() => document.querySelector(".ag-restart.busy")); + atWork(await look(go), reduce, "Restart"); + assert.equal((await go.textContent()).trim(), tr(lang, "Restart")); + assert.ok(await sideways(page) <= 1, "the page scrolls sideways"); + held.get("restart")(); + await page.waitForFunction(() => document.querySelector("#status").classList.contains("err")); + await page.waitForFunction(() => !document.querySelector(".ag-restart").disabled); + assert.deepEqual(await look(go), { paths: [REAPPLY], turns: [] }, "Restart didn't get its glyph back"); + assert.deepEqual(errors, []); + await ctx.close(); + }); + } + }); +} diff --git a/internal/gui/tests/skill-update-feedback.test.cjs b/internal/gui/tests/skill-update-feedback.test.cjs index dd628edcc..04e42c775 100644 --- a/internal/gui/tests/skill-update-feedback.test.cjs +++ b/internal/gui/tests/skill-update-feedback.test.cjs @@ -1,8 +1,8 @@ // Run with Node's test runner and Playwright on the module path; see README.md. // zhexuanliuoutl1 on X: updating a skill from GitHub (hugohe3/ppt-master) said -// nothing while it ran. The row's Update button now spins until the fetch is -// done, and the toast says what came of it: updated, already up to date, or -// the error. In English and Chinese, in Chromium and WebKit. No backend: the +// nothing while it ran. The row's Update button now shows the spinner until +// the fetch is done, and the toast says what came of it: updated, already up +// to date, or the error. In English and Chinese, in Chromium and WebKit. No backend: the // API is faked here. const assert = require("node:assert/strict"); const fs = require("node:fs/promises"); @@ -103,8 +103,9 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", const status = async () => (await page.locator("#status").textContent()).trim(); await press(page, btn); - // held: the button turns, the row's actions stay in view - await page.waitForFunction(() => document.querySelector(".lib-skill .lib-rowacts.busy button.lib-icon.busy svg")?.getAnimations().some((a) => a.playState === "running")); + // held: the spinner's arc turns in place of the arrow (@wiirhan on X: + // the arrow itself went round), the row's actions stay in view + await page.waitForFunction(() => document.querySelector(".lib-skill .lib-rowacts.busy button.lib-icon.busy svg path")?.getAnimations().some((a) => a.playState === "running")); await page.mouse.move(0, 0); // (its fade-out, if it were going, is under .14s: a state, not a wait) await page.waitForFunction(() => getComputedStyle(document.querySelector(".lib-rowacts.busy")).opacity === "1");