Skip to content

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

gui: once the loading bird comes it lands before the page fills

yetone8cbd0a9c91c2
diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js
index 9f7864dfa..986815447 100644
--- a/internal/gui/assets/app.js
+++ b/internal/gui/assets/app.js
@@ -126,6 +126,7 @@ async function api(path, body, heads, signal) {
body: body === undefined ? undefined : JSON.stringify(body),
signal,
});
+ if (body === undefined) await skelHold();
heads?.(res.headers);
if (had && res.ok && res.headers.get("X-Magpie-Same")) return had.data;
if (res.status === 204) return null;
@@ -8507,6 +8508,16 @@ function skelSeen() {
// left, and with the bird turned off neither runs (a 1-core server:
// Yayoi_no_yume on X).
let skelSince = 0, skelFlying = false, skelTick = 0;
+// Once the bird has come it lands at least once (the owner, 10-30: a load
+// done as it came had it streak off over no skeleton): a read back before
+// then waits for it, and is let go as it leaves. At most 1.5s, for a frame
+// a hidden window never draws.
+let skelGate = null, skelWaiting = 0;
+async function skelHold() {
+ if (!skelGate) return;
+ skelWaiting++;
+ try { await skelGate; } finally { skelWaiting--; }
+}
const skelAdded = new MutationObserver((recs) => {
for (const r of recs) for (const n of r.addedNodes) if (n.nodeType === 1 && (n.matches(SKEL) || n.querySelector(SKEL))) return skelWatch();
});
@@ -8529,6 +8540,9 @@ function skelWatch() {
skelWatch();
async function skelBird() {
skelFlying = true;
+ let release;
+ const gate = skelGate = new Promise((ok) => { release = () => { if (skelGate === gate) skelGate = null; ok(); }; });
+ setTimeout(release, 1500);
const b = el("div", "sk-bird roam");
b.innerHTML = BIRD;
document.body.append(b);
@@ -8549,17 +8563,24 @@ async function skelBird() {
const after = seen.filter((t) => s.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING);
return after[0] || seen[0];
};
- let s = next(null);
- if (!s) return void (b.remove(), (skelFlying = false));
+ let s = next(null), quiet = false;
+ if (!s) return void (b.remove(), release(), (skelFlying = false));
try {
let at = spot(s);
put({ x: at.x - 24, y: at.y - 40, f: 1 });
+ b.animate([{ opacity: 0 }, { opacity: 1 }], 120);
await tween(300, (e, t) => put({ x: at.x - 24 + 24 * t, y: at.y - 40 + 40 * e, sx: 1 - .05 * t, sy: 1 + .08 * t }), easeIn);
+ // its bar gone before it landed: it fades where it is, never flying
+ // over what came instead
+ if (!s.isConnected) return void (quiet = true);
for (let hops = 0; hops < 400; hops++) {
// it lands: the bar dips under it and springs back
s.animate([{ transform: "none" }, { transform: "translateY(3px)", offset: .3 }, { transform: "translateY(-1.2px)", offset: .6 }, { transform: "translateY(.4px)", offset: .8 }, { transform: "none" }], { duration: 560, easing: "ease-out" });
await tween(130, (e) => put({ y: at.y + 3 * e, sx: 1 + .14 * e, sy: 1 - .18 * e }), easeOut);
await tween(90, (e) => put({ y: at.y + 3 * (1 - e), sx: 1.14 - .14 * e, sy: .82 + .18 * e }), easeIn);
+ // landed once: a read held for it means the load is done
+ if (!hops && skelWaiting) break;
+ if (!hops) release();
const to = birdOff() ? null : next(s);
if (!to) break;
const from = { x, y }, go = spot(to), h = 16 + Math.min(40, Math.hypot(go.x - from.x, go.y - from.y) * .15);
@@ -8572,10 +8593,12 @@ async function skelBird() {
s = to; at = { x, y };
}
} finally {
+ release();
// nothing left to stand on: it flies off, up and away
+ if (quiet) await b.animate([{ opacity: 1 }, { opacity: 0, transform: b.style.transform + " scale(.6)" }], { duration: 160, easing: "ease-in", fill: "forwards" }).finished;
b.dataset.flap = "";
const from = { x, y };
- await tween(480, (e) => put({ x: from.x + (innerWidth + 60 - from.x) * e, y: from.y - (from.y + 80) * e, f: 1, r: -14, sx: 1, sy: 1 }), easeIn);
+ if (!quiet) await tween(480, (e) => put({ x: from.x + (innerWidth + 60 - from.x) * e, y: from.y - (from.y + 80) * e, f: 1, r: -14, sx: 1, sy: 1 }), easeIn);
b.remove();
skelFlying = false;
skelSince = 0;
diff --git a/internal/gui/assets/plugins/routing/client.js b/internal/gui/assets/plugins/routing/client.js
index 3939577b8..2d9cc96a4 100644
--- a/internal/gui/assets/plugins/routing/client.js
+++ b/internal/gui/assets/plugins/routing/client.js
@@ -3212,7 +3212,9 @@ function routingPage(part) {
};
async function loadDays(d) {
try {
- const res = await (await fetch("/api/gateway/history?day=" + encodeURIComponent(d || ""))).json();
+ const got = await fetch("/api/gateway/history?day=" + encodeURIComponent(d || ""));
+ await window.skelHold?.();
+ const res = await got.json();
days = res.days || [];
noteAccounts(res.routes);
if (d && d === day) { past = (res.routes || []).map(whole); pastCut = !!res.cut; }
diff --git a/internal/gui/tests/skeleton-bird.test.cjs b/internal/gui/tests/skeleton-bird.test.cjs
index 5e32d7926..a97d630ca 100644
--- a/internal/gui/tests/skeleton-bird.test.cjs
+++ b/internal/gui/tests/skeleton-bird.test.cjs
@@ -2,7 +2,8 @@
// What is loading has magpie's bird on it (the owner, 10-26): skeletons
// still up after a moment, as on a slow page, get the bird, which hops from
// bar to bar, each bar dipping under it, and flies off once they are gone.
-// A quick load never sees it, and with reduced motion no bird comes.
+// A quick load never sees it, and with reduced motion no bird comes. Once
+// it has come it lands once before the page fills (the owner, 10-30).
// Settings' Loading bird (Yayoi_no_yume on X, a 1-core server) turns it
// off: no bird comes and nothing looks for skeletons. With it on, the look
// every 250ms runs only while a skeleton is in the page.
@@ -98,6 +99,29 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.deepEqual(errors, []);
});
+ test(engine + ": a load done as the bird comes keeps its skeletons until the bird has landed once", async (t) => {
+ const browser = await launch();
+ t.after(() => browser.close());
+ let release;
+ const held = new Promise((r) => { release = r; });
+ const { page, errors } = await open(browser, false, () => held);
+ await page.locator("#view-plugins .pm-card.ghost").first().waitFor();
+ // how many bars had dipped under the bird when the last skeleton went
+ await page.evaluate(() => new MutationObserver((ms, o) => {
+ if (document.querySelector("#view-plugins .pm-card.ghost")) return;
+ seen.dipsAtGone = seen.dips; seen.goneAt = performance.now(); o.disconnect();
+ }).observe(document.body, { childList: true, subtree: true }));
+ await page.locator(".sk-bird.roam").waitFor({ state: "attached", timeout: 3000 });
+ const at = await page.evaluate(() => performance.now());
+ release();
+ await page.waitForFunction(() => seen.goneAt, null, { timeout: 3000 });
+ const { dipsAtGone, goneAt } = await page.evaluate(() => seen);
+ assert.ok(dipsAtGone > 0, "the bird landed on a bar before the skeletons went");
+ assert.ok(goneAt - at < 1500, `the load waited at most for one landing (${Math.round(goneAt - at)}ms)`);
+ await page.waitForFunction(() => !document.querySelector(".sk-bird"), null, { timeout: 2000 });
+ assert.deepEqual(errors, []);
+ });
+
test(engine + ": a quick load never sees the bird", async (t) => {
const browser = await launch();
t.after(() => browser.close());