Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(play): sharpen the event-countdown verifier, polish jobs board loading state

nirholas88a11a6025f0
diff --git a/scripts/verify-event-countdown.mjs b/scripts/verify-event-countdown.mjs
index ef108bf15..4b97b433c 100644
--- a/scripts/verify-event-countdown.mjs
+++ b/scripts/verify-event-countdown.mjs
@@ -108,11 +108,23 @@ async function go(page, path) {
throw last;
}
+// /play renders a full 3D world; on a software rasterizer its main thread is
+// busy enough that Playwright's actionability polling can starve on an element
+// that is plainly there. Wait with an in-page predicate instead: one evaluation
+// per poll, no hit-testing, and it survives the HMR reloads other agents trigger
+// in this shared worktree.
+const waitFor = (page, selector, { gone = false, timeout = WORLD_TIMEOUT } = {}) =>
+ page.waitForFunction(
+ ([sel, want]) => (document.querySelector(sel) === null) === want,
+ [selector, gone],
+ { timeout, polling: 250 },
+ );
+
// The pill only shows itself once the player is in-world (the lobby is hidden).
const waitForPill = (page) => page.waitForFunction(() => {
const p = document.querySelector('.cc-event-pill');
return !!p && !p.hidden;
-}, null, { timeout: WORLD_TIMEOUT });
+}, null, { timeout: WORLD_TIMEOUT, polling: 250 });
const cssAnim = (loc) => loc.evaluate((n) => getComputedStyle(n).animationName);
@@ -148,7 +160,7 @@ console.log('\n/play lobby banner, upcoming');
{
const { ctx, page, errors } = await newPage({ body: cfg({ startsIn: 3 * 86400e3, endsIn: 4 * 86400e3 }) });
await go(page, '/play');
- await page.waitForSelector('.cc-event-banner', { timeout: WORLD_TIMEOUT });
+ await waitFor(page, '.cc-event-banner');
const b = page.locator('.cc-event-banner');
check('state is upcoming', (await b.getAttribute('data-state')) === 'upcoming');
check('event name rendered', (await b.locator('.cc-event-name').textContent()) === NAME);
@@ -179,9 +191,9 @@ console.log('\n/play, upcoming flips to live with no reload');
{
const { ctx, page, errors } = await newPage({ body: cfg({ startsIn: 10000, endsIn: 3600e3 }) });
await go(page, '/play');
- await page.waitForSelector('.cc-event-banner[data-state="upcoming"]', { timeout: WORLD_TIMEOUT });
+ await waitFor(page, '.cc-event-banner[data-state="upcoming"]');
check('mounts as upcoming', true);
- await page.waitForSelector('.cc-event-banner[data-state="live"]', { timeout: 30000 });
+ await waitFor(page, '.cc-event-banner[data-state="live"]', { timeout: 30000 });
check('flips to live in place', true);
check('kicker reads live', (await page.locator('.cc-event-banner .cc-event-kicker').textContent()).trim() === 'Live now');
check('clock reads LIVE', (await page.locator('.cc-event-clock b').textContent()) === 'LIVE');
@@ -195,7 +207,7 @@ console.log('\n/play, prefers-reduced-motion');
{
const { ctx, page } = await newPage({ body: cfg({ startsIn: -60e3, endsIn: 3600e3 }), reducedMotion: 'reduce' });
await go(page, '/play');
- await page.waitForSelector('.cc-event-banner[data-state="live"]', { timeout: WORLD_TIMEOUT });
+ await waitFor(page, '.cc-event-banner[data-state="live"]');
check('no pulse animation', (await cssAnim(page.locator('.cc-event-banner .cc-event-dot'))) === 'none');
await ctx.close();
}
@@ -205,9 +217,9 @@ console.log('\n/play, the event ends while the page is open');
{
const { ctx, page, errors } = await newPage({ body: cfg({ startsIn: -3600e3, endsIn: 12000 }) });
await go(page, '/play');
- await page.waitForSelector('.cc-event-banner', { timeout: WORLD_TIMEOUT });
+ await waitFor(page, '.cc-event-banner');
check('mounted while live', true);
- await page.waitForSelector('.cc-event-banner', { state: 'detached', timeout: 30000 });
+ await waitFor(page, '.cc-event-banner', { gone: true, timeout: 30000 });
check('banner unmounts at endsAt', true);
check('pill unmounts at endsAt', (await page.locator('.cc-event-pill').count()) === 0);
check('no console errors', ownErrors(errors).length === 0, ownErrors(errors).join(' | '));
@@ -219,7 +231,7 @@ console.log('\n/play, an already-ended event mounts nothing');
{
const { ctx, page } = await newPage({ body: cfg({ startsIn: -7200e3, endsIn: -3600e3 }) });
await go(page, '/play');
- await page.waitForSelector('#cc-lobby .cc-lobby-inner', { timeout: WORLD_TIMEOUT });
+ await waitFor(page, '#cc-lobby .cc-lobby-inner');
await page.waitForTimeout(5000);
check('nothing mounted', (await page.locator('.cc-event-banner, .cc-event-pill').count()) === 0);
await ctx.close();
@@ -257,7 +269,7 @@ console.log('\n/play in-world pill');
const again = await newPage({ body, storage });
await go(again.page, EVENT_LINK);
- await again.page.waitForSelector('.cc-event-banner', { timeout: WORLD_TIMEOUT });
+ await waitFor(again.page, '.cc-event-banner');
await again.page.waitForTimeout(4000);
check('dismissal survives a reload', (await again.page.locator('.cc-event-pill').count()) === 0);
check('lobby banner still shown after dismissal', (await again.page.locator('.cc-event-banner').count()) === 1);
@@ -272,7 +284,7 @@ console.log('\n/play at 375px');
viewport: { width: 375, height: 812 },
});
await go(page, EVENT_LINK);
- await page.waitForSelector('.cc-event-banner', { timeout: WORLD_TIMEOUT });
+ await waitFor(page, '.cc-event-banner');
await dismissIntro(page);
const doc = await page.evaluate(() => ({
scrollW: document.documentElement.scrollWidth,
@@ -310,7 +322,7 @@ console.log('\nhome page strip, upcoming');
{
const { ctx, page, errors } = await newPage({ body: cfg({ startsIn: 3 * 86400e3, endsIn: 4 * 86400e3 }) });
await go(page, '/');
- await page.waitForSelector('.tws-eventbar', { timeout: PAGE_TIMEOUT });
+ await waitFor(page, '.tws-eventbar', { timeout: PAGE_TIMEOUT });
const bar = page.locator('.tws-eventbar');
check('state is upcoming', (await bar.getAttribute('data-state')) === 'upcoming');
check('event name rendered', (await bar.locator('.tws-eventbar-name').textContent()) === NAME);
@@ -340,14 +352,14 @@ console.log('\nhome page strip, upcoming to live to over');
{
const { ctx, page, errors } = await newPage({ body: cfg({ startsIn: 8000, endsIn: 20000 }) });
await go(page, '/');
- await page.waitForSelector('.tws-eventbar[data-state="upcoming"]', { timeout: PAGE_TIMEOUT });
+ await waitFor(page, '.tws-eventbar[data-state="upcoming"]', { timeout: PAGE_TIMEOUT });
check('mounts as upcoming', true);
- await page.waitForSelector('.tws-eventbar[data-state="live"]', { timeout: 30000 });
+ await waitFor(page, '.tws-eventbar[data-state="live"]', { timeout: 30000 });
check('flips to live with no reload', true);
check('kicker reads live', (await page.locator('.tws-eventbar-kicker').textContent()).trim() === 'Live now');
check('clock reads LIVE', (await page.locator('.tws-eventbar-clock').textContent()) === 'LIVE');
check('live dot pulses', (await cssAnim(page.locator('.tws-eventbar-dot'))) === 'tws-eventbar-pulse');
- await page.waitForSelector('.tws-eventbar', { state: 'detached', timeout: 30000 });
+ await waitFor(page, '.tws-eventbar', { gone: true, timeout: 30000 });
check('unmounts at endsAt', true);
check('no console errors', ownErrors(errors).length === 0, ownErrors(errors).join(' | '));
await ctx.close();
@@ -358,13 +370,13 @@ console.log('\nhome page strip, reduced motion / already over / dismissal / 375p
{
const rm = await newPage({ body: cfg({ startsIn: -60e3, endsIn: 3600e3 }), reducedMotion: 'reduce' });
await go(rm.page, '/');
- await rm.page.waitForSelector('.tws-eventbar[data-state="live"]', { timeout: PAGE_TIMEOUT });
+ await waitFor(rm.page, '.tws-eventbar[data-state="live"]', { timeout: PAGE_TIMEOUT });
check('no pulse animation under reduced motion', (await cssAnim(rm.page.locator('.tws-eventbar-dot'))) === 'none');
await rm.ctx.close();
const over = await newPage({ body: cfg({ startsIn: -7200e3, endsIn: -3600e3 }) });
await go(over.page, '/');
- await over.page.waitForSelector('.hero', { timeout: PAGE_TIMEOUT });
+ await waitFor(over.page, '.hero', { timeout: PAGE_TIMEOUT });
await over.page.waitForTimeout(4000);
check('an already-ended event mounts nothing', (await over.page.locator('.tws-eventbar').count()) === 0);
await over.ctx.close();
@@ -372,7 +384,7 @@ console.log('\nhome page strip, reduced motion / already over / dismissal / 375p
const body = cfg({ startsIn: 3 * 86400e3, endsIn: 4 * 86400e3 });
const d = await newPage({ body });
await go(d.page, '/');
- await d.page.waitForSelector('.tws-eventbar', { timeout: PAGE_TIMEOUT });
+ await waitFor(d.page, '.tws-eventbar', { timeout: PAGE_TIMEOUT });
await d.page.locator('.tws-eventbar-x').click();
await d.page.waitForTimeout(300);
check('dismiss removes the strip', (await d.page.locator('.tws-eventbar').count()) === 0);
@@ -381,14 +393,14 @@ console.log('\nhome page strip, reduced motion / already over / dismissal / 375p
const again = await newPage({ body, storage });
await go(again.page, '/');
- await again.page.waitForSelector('.hero', { timeout: PAGE_TIMEOUT });
+ await waitFor(again.page, '.hero', { timeout: PAGE_TIMEOUT });
await again.page.waitForTimeout(4000);
check('dismissal survives a reload', (await again.page.locator('.tws-eventbar').count()) === 0);
await again.ctx.close();
const m = await newPage({ body, viewport: { width: 375, height: 812 } });
await go(m.page, '/');
- await m.page.waitForSelector('.tws-eventbar', { timeout: PAGE_TIMEOUT });
+ await waitFor(m.page, '.tws-eventbar', { timeout: PAGE_TIMEOUT });
const geo = await m.page.evaluate(() => ({
scrollW: document.documentElement.scrollWidth,
clientW: document.documentElement.clientWidth,
diff --git a/src/game/quests-ui.css b/src/game/quests-ui.css
index d5030c924..0758efa41 100644
--- a/src/game/quests-ui.css
+++ b/src/game/quests-ui.css
@@ -62,7 +62,14 @@
.qb-lb-name { flex: 1; min-width: 0; font-size: 13px; color: var(--cc-text); overflow-wrap: anywhere; }
.qb-lb-score { flex: none; font-size: 11px; color: var(--cc-dim); font-variant-numeric: tabular-nums; }
-.qb-lb-you-wrap { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--cc-edge-soft); }
+/* Your own rank is PINNED, not merely appended: on a long board it sticks to the
+ * bottom of the scrolling body so "where am I" is answered without scrolling. */
+.qb-lb-you-wrap {
+ position: sticky; bottom: -16px; z-index: 1;
+ margin-top: 12px; padding: 10px 0 16px;
+ border-top: 1px solid var(--cc-edge-soft);
+ background: linear-gradient(to bottom, transparent, var(--cc-panel-solid) 18%);
+}
.qb-lb-prize { margin-top: 12px; font-size: 10px; color: var(--cc-dim); line-height: 1.5; opacity: 0.85; }
/* Skeleton rows while the first read is in flight — the shape of the answer,