Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

plugins: a plugin's README loads under magpie's bird bouncing down its lines

yetone722483c089b6
diff --git a/internal/gui/assets/plugins.css b/internal/gui/assets/plugins.css
index 0781b0bed..5a6a1bec9 100644
--- a/internal/gui/assets/plugins.css
+++ b/internal/gui/assets/plugins.css
@@ -253,8 +253,19 @@ button.pm-chip:disabled { cursor: default; opacity: .6; }
.pm-link { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 7px; background: var(--pill); color: var(--fg-2); font-size: 11.5px; text-decoration: none; }
.pm-link:hover { background: var(--pill-hover); color: var(--fg); }
.pm-readme { border-top: 1px solid var(--line-2); padding-top: 12px; min-height: 60px; }
-.pm-rskel { height: 11px; margin: 8px 0; border-radius: 5px; background: var(--pill); animation: pm-pulse 1.3s ease-in-out infinite; }
-.pm-rskel.short { width: 55%; }
+/* the README's skeleton: strings the bird bounces down (bounceLoader) */
+.pm-bounce { position: relative; height: 108px; }
+.pm-bounce[data-gone] { position: absolute; z-index: 2; pointer-events: none; }
+.pm-bounce > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; transition: opacity .3s ease-out; }
+.pm-bounce[data-gone] > svg { opacity: 0; }
+.pm-bounce path { fill: none; stroke: var(--skel, var(--pill)); stroke-width: 10; stroke-linecap: round; transition: stroke .35s ease-out; }
+.pm-bounce path[data-lit] { stroke: color-mix(in srgb, var(--accent) 18%, var(--skel, var(--pill))); }
+.pm-bird { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 1; }
+.pm-bird svg { position: absolute; left: -13.2px; top: -19.6px; width: 22px; height: 22px; color: var(--fg); fill: currentColor; overflow: visible; }
+.pm-bird .tail { transform-box: view-box; transform-origin: 14px 22px; }
+.pm-bird .wing { transform-box: view-box; transform-origin: 30px 19.8px; }
+.pm-bird[data-flap] .wing { animation: pm-flap .16s ease-in-out infinite alternate; }
+@keyframes pm-flap { from { transform: rotate(-22deg); } to { transform: rotate(18deg); } }
/* a README */
.pm-md { font-size: 12.5px; line-height: 1.6; color: var(--fg-2); overflow-wrap: anywhere; }
@@ -292,6 +303,6 @@ button.pm-chip:disabled { cursor: default; opacity: .6; }
}
@media (prefers-reduced-motion: reduce) {
.pm-card { transition: none; }
- .pm-card.ghost .sk, .pm-rskel, .pm-ghlook, .pm-ghlook .dots i, .pm-arrive .pm-card { animation: none; }
+ .pm-card.ghost .sk, .pm-bird .wing, .pm-ghlook, .pm-ghlook .dots i, .pm-arrive .pm-card { animation: none; }
.pm-ghlook .dots i { opacity: .5; }
}
diff --git a/internal/gui/assets/plugins.js b/internal/gui/assets/plugins.js
index cafe19dd5..806a479b1 100644
--- a/internal/gui/assets/plugins.js
+++ b/internal/gui/assets/plugins.js
@@ -1495,6 +1495,92 @@
return d;
}
+ // a README on its way: its lines are strings, and magpie's bird drops in
+ // and bounces down them, each bending under its feet and wobbling after
+ // it; leave() sends it off when the README comes. Its marks are data-*,
+ // not classes, so the dialog's observer doesn't place it again each hop
+ function bounceLoader() {
+ const box = el("div", "pm-bounce"), s = document.createElementNS("http://www.w3.org/2000/svg", "svg"), b = el("div", "pm-bird");
+ s.innerHTML = "<path/><path/><path/><path/>";
+ b.innerHTML = `<svg viewBox="0 0 44 44"><use href="#bird" clip-path="url(#bird-body)"/><g class="tail"><use href="#bird" clip-path="url(#bird-tail)"/></g><g class="wing"><use href="#bird" clip-path="url(#bird-wing)"/></g></svg>`;
+ box.append(s, b);
+ const ps = [...s.children], ws = [1, .94, .6, .82], at = [.16, .44, .3, .58];
+ const L = ws.map((w, i) => ({ y: 31 + i * 22, d: 0, v: 0, bx: 0, hold: false }));
+ // the bird is placed by its feet: f faces it, r leans it, sx/sy squash it
+ let W = 0, x = 0, y = 0, f = 1, r = 0, sx = 1, sy = 1, gone = false;
+ const put = (o) => { ({ x = x, y = y, f = f, r = r, sx = sx, sy = sy } = o); b.style.transform = `translate(${x}px,${y}px) rotate(${r * f}deg) scale(${f * sx},${sy})`; };
+ const draw = () => L.forEach((l, i) => {
+ const h = l.y, d = l.d, x1 = W * ws[i] - 5, c = Math.min(x1 - 12, Math.max(17, l.bx));
+ ps[i].setAttribute("d", `M5 ${h}C${(5 + c) / 2} ${h} ${c - (c - 5) * .35} ${h + d} ${c} ${h + d}C${c + (x1 - c) * .35} ${h + d} ${(c + x1) / 2} ${h} ${x1} ${h}`);
+ });
+ // a step over frames; it stops when the box is gone, or the README came
+ const tween = (ms, fn, ease = (t) => t, exit) => new Promise((ok, no) => {
+ const t0 = performance.now();
+ const step = (now) => {
+ if (!box.isConnected || (gone && !exit)) return no();
+ const t = Math.min(1, (now - t0) / ms);
+ fn(ease(t), t);
+ t < 1 ? requestAnimationFrame(step) : ok();
+ };
+ requestAnimationFrame(step);
+ });
+ const easeIn = (t) => t * t * t, easeOut = (t) => 1 - (1 - t) ** 3;
+ (async () => {
+ await new Promise(requestAnimationFrame);
+ if (!box.isConnected || gone) return;
+ W = box.clientWidth;
+ if (calm()) return draw(), put({ x: at[0] * W, y: L[0].y - 5 });
+ // each string a damped spring, let go of when the bird leaves it
+ (async () => {
+ let last = performance.now();
+ for (;;) {
+ const now = await new Promise(requestAnimationFrame), dt = Math.min(.032, (now - last) / 1000);
+ if (!box.isConnected || gone) return;
+ last = now;
+ for (const l of L) if (!l.hold) { l.v += (-625 * l.d - 6 * l.v) * dt; l.d += l.v * dt; }
+ draw();
+ }
+ })();
+ for (;;) {
+ W = box.clientWidth;
+ ps.forEach((p) => delete p.dataset.lit);
+ const x0 = at[0] * W;
+ await tween(300, (e, t) => put({ x: x0 - 24 + 24 * t, y: -30 + (L[0].y + 25) * e, f: 1, r: 0, sx: 1 - .05 * t, sy: 1 + .08 * t }), easeIn);
+ for (let i = 0; i < L.length; i++) {
+ const l = L[i], top = l.y - 5, deep = i === L.length - 1 ? 16 : 10;
+ l.hold = true;
+ l.bx = x;
+ ps[i].dataset.lit = "";
+ await tween(140, (e) => { put({ y: top + deep * e, sx: 1 + .16 * e, sy: 1 - .2 * e }); l.d = y - top; }, easeOut);
+ await tween(90, (e) => { put({ y: top + deep * (1 - e), sx: 1.16 - .16 * e, sy: .8 + .3 * e }); l.d = y - top; }, easeIn);
+ l.hold = false;
+ l.v = -deep * 14;
+ const xa = x, ya = y;
+ if (i + 1 < L.length) {
+ const xb = at[i + 1] * W, yb = L[i + 1].y - 5;
+ put({ f: xb > xa ? 1 : -1 });
+ await tween(340, (e, t) => put({ x: xa + (xb - xa) * t, y: ya + (yb - ya) * t - 72 * t * (1 - t), sx: 1 - .06 * Math.sin(Math.PI * t), sy: 1 + .12 * Math.sin(Math.PI * t), r: (t - .5) * 20 }));
+ } else {
+ // the last one throws it high, out of sight, and it drops in again
+ b.dataset.flap = "";
+ await tween(520, (e) => put({ x: xa + 70 * e, y: ya - (ya + 60) * e, f: 1, r: -12, sx: 1, sy: 1 }), easeOut);
+ delete b.dataset.flap;
+ await tween(260, () => {});
+ }
+ }
+ }
+ })().catch(() => {});
+ box.leave = () => {
+ gone = true;
+ box.dataset.gone = b.dataset.flap = "";
+ const xa = x, ya = y;
+ tween(420, (e) => put({ x: xa + (W + 60 - xa) * e, y: ya - (ya + 80) * e, f: 1, r: -14, sx: 1, sy: 1 }), easeIn, true)
+ // gone once the dialog has grown to the README, not while it does
+ .then(() => tween(200, () => {}, undefined, true)).then(() => box.remove(), () => {});
+ };
+ return box;
+ }
+
// the plugin's page: what it is, what npm says of it, and its README
async function detail(l) {
// a folder plugin: what it is comes from the folder, not from npm; a
@@ -1559,7 +1645,7 @@
}
if (l.replaces) main.append(el("p", "pm-note", t("magpie's own sign-in to this subscription is deprecated: this plugin takes its place, and accounts signed in there move to it.")));
const readme = el("div", "pm-readme");
- readme.append(el("div", "pm-rskel"), el("div", "pm-rskel short"), el("div", "pm-rskel"));
+ readme.append(bounceLoader());
main.append(readme);
ed.append(main);
const bar = el("div", "bar");
@@ -1573,14 +1659,23 @@
const tick = setInterval(() => { if (!ed.isConnected) return stop(); redrawAct(); }, 600);
function stop() { clearInterval(tick); }
// the README takes the skeleton's place, and the dialog grows to it on
- // the spring it opened on, centred as it goes, not in one jump
+ // the spring it opened on, centred as it goes, not in one jump; the
+ // bird flies off over it
const fill = (n) => {
- const d = ed.parentElement, h = d.offsetHeight, y = d.style.top;
+ const d = ed.parentElement, h = d.offsetHeight, y = d.style.top, wait = readme.querySelector(".pm-bounce");
+ const m = d.parentElement, at = wait?.getBoundingClientRect(), o = m.getBoundingClientRect();
readme.replaceChildren(n);
if (!ed.isConnected || calm()) return;
+ // it leaves from over the dialog, where it was: anywhere in it, WebKit
+ // lays the fields out 8px short while it is there
+ if (wait) {
+ Object.assign(wait.style, { top: at.top - o.top + m.scrollTop + "px", left: at.left - o.left + m.scrollLeft + "px", width: at.width + "px" });
+ m.append(wait);
+ wait.leave();
+ }
holdModal();
d.animate([{ height: h + "px", top: y, overflow: "hidden" }, { height: d.offsetHeight + "px", top: d.style.top, overflow: "hidden" }], { duration: 570, easing: SPRING });
- readme.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 300, easing: "ease-out" });
+ n.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 300, easing: "ease-out" });
};
try {
const p = await api("plugins/page?name=" + encodeURIComponent(l.package));
diff --git a/internal/gui/core_budget_test.go b/internal/gui/core_budget_test.go
index 4437a7822..c123861ca 100644
--- a/internal/gui/core_budget_test.go
+++ b/internal/gui/core_budget_test.go
@@ -16,7 +16,7 @@ import (
// raises them and says why in its commit.
const (
appScriptBudget = 1_326_105 // app.js: 1,198,239 after Usage left (P2); 1,218,098 with the 10-15 fixes to pages still in the core; 1,232,466 with the provider editor's Advanced fold and every dialog holding its place, the core's own (10-16); 1,250,533 with the quota refresh kept through redraws, the core's own since the tray panel draws it too, plus 1.5% (#2397); 1,269,083 with Free first's option in the provider editor's ROUTINGS, which the Routing page reads too, plus 1.5%; 1,272,726 with the Providers page drawing its last list at once (#1519), the core's page, and the Routing trace's account names read without Object.entries (#1481), plus 1.5%; a dialog growing out of the row that opened it and folding back into it, the core's own since every page's dialogs open through it (10-20); Codex's and Claude Code's own settings moved from Settings into the agent's row on the Agents page, the core's own since the tray panel and the window both draw them (10-20); 1,314,432 with Settings › Privacy's record of what was masked (its summary, the records view and the local model's controls), which belongs to Settings, the core's own, plus 1.5%; 1,336,481 with a provider's Names & levels saying Provider in model names is Settings' and opening it there (joe), and Settings' Image recognition saying where a custom provider's model is marked (nexnull), both in the core's own pages, with no room added (10-23); 1,337,633 with Settings › Models › Replies' Intent classifier timeout (#2934, reyoung), Settings' own row, drawn by waitRow, which the Image generation timeout's row now shares, with no room added; 1,337,735 with the provider editor's link naming a partner's page by its own host (siteHost) instead of usemagpie.ai's /go link, the core's own editor, with no room added (10-23); 1,338,084 with Check in now saying what the press came to (claimed +credits, already today, not available yet) where it said "refreshed" (#3326), the check-in row the tray panel draws too, the core's own, with no room added (10-23); 1,338,929 with a new partner's tile keeping a small dot until it is opened, in the add sheet, the core's own, with no room added (10-23); 1,343,324 with the sidebar's open-page row marked by one shape that moves on a spring (navTopGo), the window's own shell, which every page sits beside, with no room added (10-23); 1,343,465 with a dialog kept centred while its content comes in, until it is pressed (holdModal, every page's dialogs), the core's own, with no room added (10-24); 1,317,486 with what masking did moved out to Insights › Masking (plugins/redact), the budget lowered to it (10-24); 1,321,336 with Codex's one subagent model, its card's square saying plainly what each choice does and a row with a name in its sheet, where two squares read alike (the owner), the Agents page's, which the tray panel draws too, the core's own, with no room added (10-24); 1,321,424 with Settings › Models' Image generation MCP server row beside Image recognition's (JonahFu on X), the two drawn by one helper (mcpRow), Settings' own, with no room added (10-25); 1,321,994 with a provider of the user's set never to rest for a limit (zoecats), the provider editor's Advanced row, the core's own editor, with no room added (10-25); 1,322,289 with Settings › Privacy's Keep a key's form under Mask secrets (Charles Cao on X), Settings' own row, with no room added (10-25); 1,322,537 with no Codex squares beside its named settings rows (the owner), with no room added (10-25); 1,323,401 with the tray panel drawing its last allowances at once and asking for them beside the state (#3160, #3134), the tray panel's, the core's own, and the 4 bytes 84c50f032 added, with no room added (10-25); 1,326,105 with many releases' notes merged into one list by kind, each line with its version (the owner), in the update sheet and What's new, with no room added (10-25)
- coreScriptBudget = 1_537_016 // every core script: 1,358,034 after Usage left; 1,380,003 with them; 1,405,937 with the fold; 1,426,102 with 10-16's core work (the GitHub list loading, the move to plugins, Settings › Long conversations), plus 1.5% (#2612); 1,447,368 with loadBack, the window's one state read per return, which every page needs and so is the core's own (1,446,845 before it, 155 bytes under), plus 1.5%; OpenCode Zen's card saying OpenCode tells no key its balance adds ~390 bytes inside it; 1,472,589 with the dialog that grows out of its row and the agents' own settings in their rows, on main's 10-20 core work (the Providers page's last list, the Routing trace's names), plus 1.5% (10-20); 1,506,192 with Settings › Privacy's record of what was masked, plus 1.5%; 1,529,393 with the Intent classifier timeout row (#2934), with no room added; 1,529,495 with the editor's partner link host, with no room added; 1,529,844 with Check in now's press summary (#3326), with no room added; 1,530,689 with the new partner tile's dot, with no room added; 1,535,084 with the sidebar's spring, with no room added; 1,549,478 with the context window card's map (tiles by tokens, the default look, the block grid a switch away) and its text view showing an inline image, in context.js, which the Routing page draws as well as Usage, so the core's own, with no room added (10-24); 1,550,768 with a usage card's refresh opening after its text (#840's card, which the tray panel draws too), the Add key spinner, and a dialog kept centred while its content comes in, with no room added (10-24); 1,524,789 with what masking did moved out to Insights › Masking, lowered to it; 1,528,525 with Codex's one subagent model, with no room added (10-24); 1,528,972 with the Image generation MCP server row (JonahFu on X), with no room added (10-25); 1,529,542 with the limit-rest row (zoecats), with no room added (10-25); 1,529,837 with Keep a key's form (Charles Cao on X), with no room added (10-25); 1,530,050 with no Codex squares beside its named settings rows (the owner), with no room added (10-25); 1,530,631 with a plugin's page growing to its README on the dialog's spring instead of in one jump (the owner), the Plugins page's, in plugins.js, with no room added (10-25); 1,533,445 with the context map counting its tokens on as a live request grows, a tile pointed at keeping its tip, a tool's gathered results saying how many and the small files their folder (the owner, after flohoeller's map on X), in context.js, which the Routing page draws as well as Usage, and the 4 bytes 84c50f032 added to app.js (Settings' Version row) without a raise, with no room added (10-25); 1,534,312 with the tray panel's last allowances drawn at once (#3160, #3134), with no room added (10-25); 1,537,016 with many releases' notes merged into one list by kind (the owner), in app.js, with no room added (10-25)
+ coreScriptBudget = 1_542_244 // every core script: 1,358,034 after Usage left; 1,380,003 with them; 1,405,937 with the fold; 1,426,102 with 10-16's core work (the GitHub list loading, the move to plugins, Settings › Long conversations), plus 1.5% (#2612); 1,447,368 with loadBack, the window's one state read per return, which every page needs and so is the core's own (1,446,845 before it, 155 bytes under), plus 1.5%; OpenCode Zen's card saying OpenCode tells no key its balance adds ~390 bytes inside it; 1,472,589 with the dialog that grows out of its row and the agents' own settings in their rows, on main's 10-20 core work (the Providers page's last list, the Routing trace's names), plus 1.5% (10-20); 1,506,192 with Settings › Privacy's record of what was masked, plus 1.5%; 1,529,393 with the Intent classifier timeout row (#2934), with no room added; 1,529,495 with the editor's partner link host, with no room added; 1,529,844 with Check in now's press summary (#3326), with no room added; 1,530,689 with the new partner tile's dot, with no room added; 1,535,084 with the sidebar's spring, with no room added; 1,549,478 with the context window card's map (tiles by tokens, the default look, the block grid a switch away) and its text view showing an inline image, in context.js, which the Routing page draws as well as Usage, so the core's own, with no room added (10-24); 1,550,768 with a usage card's refresh opening after its text (#840's card, which the tray panel draws too), the Add key spinner, and a dialog kept centred while its content comes in, with no room added (10-24); 1,524,789 with what masking did moved out to Insights › Masking, lowered to it; 1,528,525 with Codex's one subagent model, with no room added (10-24); 1,528,972 with the Image generation MCP server row (JonahFu on X), with no room added (10-25); 1,529,542 with the limit-rest row (zoecats), with no room added (10-25); 1,529,837 with Keep a key's form (Charles Cao on X), with no room added (10-25); 1,530,050 with no Codex squares beside its named settings rows (the owner), with no room added (10-25); 1,530,631 with a plugin's page growing to its README on the dialog's spring instead of in one jump (the owner), the Plugins page's, in plugins.js, with no room added (10-25); 1,533,445 with the context map counting its tokens on as a live request grows, a tile pointed at keeping its tip, a tool's gathered results saying how many and the small files their folder (the owner, after flohoeller's map on X), in context.js, which the Routing page draws as well as Usage, and the 4 bytes 84c50f032 added to app.js (Settings' Version row) without a raise, with no room added (10-25); 1,534,312 with the tray panel's last allowances drawn at once (#3160, #3134), with no room added (10-25); 1,537,016 with many releases' notes merged into one list by kind (the owner), in app.js, with no room added (10-25); 1,542,244 with a plugin's README loading under magpie's bird bouncing down its lines instead of pulsing bars (the owner), the Plugins page's, in plugins.js, with no room added (10-26)
)
func TestCoreScriptBudget(t *testing.T) {
diff --git a/internal/gui/tests/plugin-readme-bird.test.cjs b/internal/gui/tests/plugin-readme-bird.test.cjs
new file mode 100644
index 000000000..821404b30
--- /dev/null
+++ b/internal/gui/tests/plugin-readme-bird.test.cjs
@@ -0,0 +1,128 @@
+// Run with Node's test runner and Playwright on the module path; see README.md.
+// A plugin's README loads under magpie's bird: it drops onto the skeleton's
+// lines, each one bending under it as it bounces down them. When the README
+// comes the bird flies off and the box goes. With reduced motion the lines
+// stay straight and the bird sits still on the first.
+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 listings = [{ package: "opencode-copilot-auth", name: "GitHub Copilot", icon: "githubcopilot", providers: ["github-copilot"],
+ summary: { en: "Your GitHub Copilot plan." }, npm: { version: "0.0.9", weekly: 48213, publisher: "thdxr" } }];
+const readme = (n) => ["# opencode-copilot-auth", ...Array.from({ length: n }, (_, i) => "\nParagraph " + i + ".")].join("\n");
+
+function server(reply) {
+ return async (route) => {
+ const url = new URL(route.request().url());
+ const json = (data) => route.fulfill({ json: data });
+ if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"en",theme:"light",web:false};` });
+ 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: "en", theme: "light" } });
+ if (url.pathname === "/api/providers") return json({ providers: [], presets: [], excluded: [], gateway: { running: true, window: true }, plugins: [] });
+ if (url.pathname === "/api/groups") return json({ groups: [], pools: [] });
+ const state = { bun: true, bunVersion: "1.3.0", plugins: [] };
+ if (url.pathname === "/api/plugins/market") return json({ listings, state });
+ if (url.pathname === "/api/plugins") return json(state);
+ if (url.pathname === "/api/plugins/listings") return json({ listings });
+ if (url.pathname === "/api/plugins/search") return json({ hits: [{ package: "opencode-copilot-auth", version: "0.0.9" }] });
+ if (url.pathname === "/api/plugins/page") return json(await reply());
+ if (url.pathname.startsWith("/api/")) return json({});
+ if (!/^\/[\w./-]*$/.test(url.pathname) || 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: "" }); }
+ };
+}
+
+// the loader's state in one frame: each line's path, and the bird's place
+const look = (page) => page.evaluate(() => {
+ const b = document.querySelector("#modal .pm-bounce");
+ if (!b) return null;
+ return { paths: [...b.querySelectorAll("path")].map((p) => p.getAttribute("d")), bird: b.querySelector(".pm-bird").style.transform,
+ feet: b.querySelector(".pm-bird svg").getBoundingClientRect().height };
+});
+// how far a line's middle bends below its ends
+const bend = (d) => { const n = (d || "").match(/-?[\d.]+/g)?.map(Number) || []; return n.length < 14 ? 0 : n[7] - n[1]; };
+
+async function open(browser, reduced) {
+ const page = await (await browser.newContext({ viewport: { width: 980, height: 820 }, reducedMotion: reduced ? "reduce" : "no-preference" })).newPage();
+ page.setDefaultTimeout(5000);
+ const errors = [];
+ page.on("pageerror", (e) => errors.push(e.message));
+ let release;
+ const next = new Promise((r) => { release = r; });
+ await page.route("**/*", server(() => next));
+ await page.goto("http://magpie.test/?view=plugins");
+ await page.locator("#view-plugins .pm-find input").fill("copilot");
+ const card = page.locator('.pm-card[data-pkg="opencode-copilot-auth"]');
+ await card.locator(".pm-dl", { hasText: "48k/week" }).waitFor();
+ await page.waitForLoadState("networkidle");
+ await card.locator(".pm-sum").click();
+ await page.locator("#modal .pm-bounce").waitFor();
+ return { page, errors, release };
+}
+
+for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
+ test(engine + ": the README loads under a bird bouncing down its lines, and it flies off when the README comes", async (t) => {
+ const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
+ t.after(() => browser.close());
+ const { page, errors, release } = await open(browser, false);
+ const first = await look(page);
+ assert.equal(first.paths.length, 4, "four lines");
+ assert(first.feet > 10, `the bird is drawn: ${JSON.stringify(first)}`);
+ // over a round, a line bends under the bird and the bird moves
+ const seen = await page.evaluate(() => new Promise((done) => {
+ const b = document.querySelector("#modal .pm-bounce"), t0 = performance.now(), out = { bend: 0, places: new Set(), lit: 0 };
+ const step = () => {
+ for (const p of b.querySelectorAll("path")) {
+ const n = (p.getAttribute("d") || "").match(/-?[\d.]+/g)?.map(Number) || [];
+ if (n.length >= 14) out.bend = Math.max(out.bend, n[7] - n[1]);
+ }
+ out.lit = Math.max(out.lit, b.querySelectorAll("path[data-lit]").length);
+ out.places.add(b.querySelector(".pm-bird").style.transform);
+ if (performance.now() - t0 > 2000) return done({ bend: out.bend, places: out.places.size, lit: out.lit });
+ requestAnimationFrame(step);
+ };
+ step();
+ }));
+ assert(seen.bend > 4, `a line bent under the bird: ${JSON.stringify(seen)}`);
+ assert(seen.places > 20, `the bird moved: ${JSON.stringify(seen)}`);
+ assert(seen.lit >= 2, `the lines it landed on lit: ${JSON.stringify(seen)}`);
+
+ release({ readme: readme(12), updated: "2026-09-01T00:00:00Z" });
+ await page.locator("#modal .pm-md p", { hasText: "Paragraph 11." }).waitFor();
+ // flying off, it sits over the README, not above it, and leaves from
+ // where it was
+ const md = await page.evaluate(() => {
+ const b = document.querySelector("#modal .pm-bounce"), m = document.querySelector("#modal .pm-md");
+ return { gone: b ? "gone" in b.dataset : null, inReadme: b ? !!b.closest(".pm-readme") : null, boxTop: b?.getBoundingClientRect().top,
+ mdTop: m.getBoundingClientRect().top, readmeTop: m.parentElement.getBoundingClientRect().top };
+ });
+ assert.notEqual(md.gone, false, `the box leaves when the README comes: ${JSON.stringify(md)}`);
+ assert.notEqual(md.inReadme, true, `it leaves from outside the README's flow: ${JSON.stringify(md)}`);
+ assert(md.boxTop == null || Math.abs(md.boxTop - md.mdTop) < 4, `it leaves from where it was: ${JSON.stringify(md)}`);
+ assert(md.mdTop - md.readmeTop < 20, `the README takes the top, the leaving bird no room: ${JSON.stringify(md)}`);
+ await page.waitForFunction(() => !document.querySelector("#modal .pm-bounce"), null, { timeout: 2000 });
+ assert.deepEqual(errors, []);
+ });
+
+ test(engine + ": with reduced motion the lines stay straight and the bird sits still", async (t) => {
+ const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
+ t.after(() => browser.close());
+ const { page, errors, release } = await open(browser, true);
+ await page.waitForFunction(() => document.querySelector("#modal .pm-bounce path").getAttribute("d"));
+ const a = await look(page);
+ await page.waitForTimeout(400);
+ const b = await look(page);
+ assert.deepEqual(a, b, "nothing moves");
+ for (const d of a.paths) assert.equal(bend(d), 0, `straight: ${d}`);
+ assert.match(a.bird, /translate\(/);
+ release({ readme: readme(3), updated: "2026-09-01T00:00:00Z" });
+ await page.locator("#modal .pm-md p", { hasText: "Paragraph 2." }).waitFor();
+ assert.equal(await page.locator("#modal .pm-bounce").count(), 0, "the box goes at once");
+ assert.deepEqual(errors, []);
+ });
+}