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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat(forge): fill the generation wait with rotating prompt-craft tips
nirholasb819942e1d8a
diff --git a/data/changelog.json b/data/changelog.jsonindex 347c1fb67..b9d807d10 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,14 @@{"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.","entries": [+ {+ "date": "2026-07-17",+ "title": "Forge fills the wait with prompt-craft tips",+ "summary": "While your model is generating, the Forge now shows a rotating \"while it forges\" tip: short, concrete prompt-craft advice tuned to the free lane (name one subject, add a material, describe the finish, and so on), each with a worked example. It sits alongside the real progress steps, so the 10-60 second wait quietly makes your next prompt sharper instead of just ticking. Motion-sensitive visitors get a single static tip.",+ "tags": [+ "improvement"+ ]+ },{"date": "2026-07-17","title": "Share a model, and whoever opens the link builds their own",diff --git a/pages/forge.html b/pages/forge.htmlindex 020141f81..ce492314b 100644--- a/pages/forge.html+++ b/pages/forge.html@@ -3510,6 +3510,7 @@<script type="module" src="/src/forge-showcase.js"></script><script type="module" src="/src/forge-dropzone.js"></script><script type="module" src="/src/forge-more-like-this.js"></script>+ <script type="module" src="/src/forge-wait.js"></script><div id="footer-container"></div><script src="/footer.js"></script></body>diff --git a/src/forge-wait.js b/src/forge-wait.jsnew file mode 100644index 000000000..d5973b676--- /dev/null+++ b/src/forge-wait.js@@ -0,0 +1,119 @@+// Forge — "while it forges" tips (browser client).+//+// While a generation runs, forge.js shows the honest step/progress panel+// (#state-generating). This module adds a quiet, rotating craft tip beneath it,+// so the 10-60s wait teaches instead of just ticking. It is fully decoupled:+// there is no "generation started" event, so it watches the panel's own+// is-hidden class and starts/stops the rotation from that. It never touches the+// progress UI and never fakes progress — it only rotates real, curated content.+//+// Motion-safe: under prefers-reduced-motion it shows a single static tip with no+// timer and no crossfade.++import { FORGE_TIPS, tipOrder } from './shared/forge-tips.js';++const panel = document.getElementById('state-generating');+if (panel && FORGE_TIPS.length) {+ const steps = panel.querySelector('.gen-steps') || panel;+ const anchor = steps.querySelector('.gen-leave-hint');++ const STYLE_ID = 'forge-wait-styles';+ if (!document.getElementById(STYLE_ID)) {+ const style = document.createElement('style');+ style.id = STYLE_ID;+ style.textContent = `+.forge-wait{margin-top:var(--space-sm);padding:var(--space-sm) var(--space-md);+ background:var(--surface-2);border:1px solid var(--stroke);+ border-radius:var(--radius-md);}+.forge-wait-eyebrow{display:block;font-family:var(--font-mono);font-size:var(--text-2xs);+ letter-spacing:.12em;text-transform:uppercase;color:var(--accent);margin-bottom:var(--space-2xs);}+.forge-wait-body{transition:opacity .32s ease;}+.forge-wait-body.is-swapping{opacity:0;}+.forge-wait-tip{margin:0;font-size:var(--text-sm);line-height:var(--leading-normal);color:var(--ink);}+.forge-wait-example{margin:var(--space-2xs) 0 0;font-family:var(--font-mono);+ font-size:var(--text-2xs);color:var(--ink-dim);}+@media (prefers-reduced-motion:reduce){.forge-wait-body{transition:none;}}`;+ document.head.appendChild(style);+ }++ const card = document.createElement('div');+ card.className = 'forge-wait';+ card.setAttribute('aria-live', 'polite');+ card.innerHTML =+ '<span class="forge-wait-eyebrow">// while it forges</span>' ++ '<div class="forge-wait-body"><p class="forge-wait-tip"></p>' ++ '<p class="forge-wait-example" hidden></p></div>';+ if (anchor && anchor.parentNode) anchor.parentNode.insertBefore(card, anchor);+ else steps.appendChild(card);++ const body = card.querySelector('.forge-wait-body');+ const tipEl = card.querySelector('.forge-wait-tip');+ const exEl = card.querySelector('.forge-wait-example');++ const reduceMotion =+ typeof window.matchMedia === 'function' &&+ window.matchMedia('(prefers-reduced-motion: reduce)').matches;++ const ROTATE_MS = 7000;+ let order = tipOrder();+ let pos = 0;+ let timer = null;++ function paint(i) {+ const t = FORGE_TIPS[i];+ tipEl.textContent = t.tip;+ if (t.example) {+ exEl.textContent = `Try: “${t.example}”`;+ exEl.hidden = false;+ } else {+ exEl.textContent = '';+ exEl.hidden = true;+ }+ }++ function advance() {+ pos = (pos + 1) % order.length;+ if (reduceMotion) {+ paint(order[pos]);+ return;+ }+ body.classList.add('is-swapping');+ setTimeout(() => {+ paint(order[pos]);+ body.classList.remove('is-swapping');+ }, 320);+ }++ function start() {+ // Fresh order each run so a repeat generation does not open on the same tip.+ order = tipOrder();+ pos = 0;+ paint(order[0]);+ if (timer) clearInterval(timer);+ if (!reduceMotion) timer = setInterval(advance, ROTATE_MS);+ }++ function stop() {+ if (timer) {+ clearInterval(timer);+ timer = null;+ }+ }++ const isVisible = () => !panel.classList.contains('is-hidden');++ // No "generation started" event exists; the panel toggling is-hidden is the+ // signal. Watch it and start/stop the rotation to match.+ const observer = new MutationObserver(() => {+ if (isVisible()) {+ if (!timer) start();+ } else {+ stop();+ }+ });+ observer.observe(panel, { attributes: true, attributeFilter: ['class'] });++ // Handle the case where a generation is already running at load time.+ if (isVisible()) start();+ else paint(order[0]);+}diff --git a/src/shared/forge-tips.js b/src/shared/forge-tips.jsnew file mode 100644index 000000000..d9e4447d2--- /dev/null+++ b/src/shared/forge-tips.js@@ -0,0 +1,33 @@+// Forge — "while it forges" craft tips (pure, shared, testable).+//+// A text→3D generation takes 10-60s. forge.js already shows honest progress; it+// does not fill the wait with anything to learn. These curated cards do: each is+// a concrete prompt-craft tip tuned to the free draft lane (single subject ++// material), so the wait quietly makes a creator's NEXT prompt better. Nothing+// here fakes progress — it is genuine content shown alongside the real timers.+//+// Deliberately dependency-free so both the client and its tests can import it.++export const FORGE_TIPS = [+ { tip: 'Name one subject. A single object reconstructs far cleaner than a whole scene.', example: 'a sitting red fox' },+ { tip: 'Add a material. Words like brushed brass or glazed ceramic sharpen the mesh and its texture.', example: 'a brushed brass compass' },+ { tip: 'Describe the finish. Matte, glossy, polished, or weathered tell the model how light should behave.', example: 'a weathered bronze helmet' },+ { tip: 'Give it a pose. A stance reads clearer than a bare noun.', example: 'an owl with wings spread' },+ { tip: 'Add a colour. A named colour resolves cleaner than leaving it open.', example: 'a teal ceramic vase' },+ { tip: 'Two details is the sweet spot. A material plus a colour or pose usually nails it.', example: 'a glossy red toy car' },+ { tip: 'Style words carry weight. Low-poly, chibi, steampunk, or art deco set a whole look in one word.', example: 'a low-poly mountain fox' },+ { tip: 'Skip the background. Extra objects and scenery pull a single-subject model off target.', example: 'a lone stone lighthouse' },+ { tip: 'Love the result? Tap “More like this” to re-forge it in new materials in one click.', example: null },+];++// A rotation order over the tips. When a seeded rng is supplied the order is+// deterministic (for tests); otherwise it is shuffled so repeat visitors do not+// always see the same first card. Fisher-Yates.+export function tipOrder(rng = Math.random) {+ const idx = FORGE_TIPS.map((_, i) => i);+ for (let i = idx.length - 1; i > 0; i--) {+ const j = Math.floor(rng() * (i + 1));+ [idx[i], idx[j]] = [idx[j], idx[i]];+ }+ return idx;+}diff --git a/tests/forge-wait.test.js b/tests/forge-wait.test.jsnew file mode 100644index 000000000..2b2d268f4--- /dev/null+++ b/tests/forge-wait.test.js@@ -0,0 +1,122 @@+// @vitest-environment jsdom+//+// The "while it forges" tips turn dead wait time into prompt-craft coaching. The+// grammar must stay well-formed, and the client must start rotating only while+// the generating panel is visible, stop when it hides, and never fight the real+// progress UI. Motion-safe behaviour (no timer) is pinned too.++import { describe, expect, it, beforeEach, vi, afterEach } from 'vitest';+import { FORGE_TIPS, tipOrder } from '../src/shared/forge-tips.js';++describe('forge tips content', () => {+ it('every tip has non-empty text and an optional string example', () => {+ expect(FORGE_TIPS.length).toBeGreaterThanOrEqual(6);+ for (const t of FORGE_TIPS) {+ expect(typeof t.tip).toBe('string');+ expect(t.tip.trim().length).toBeGreaterThan(10);+ expect(t.example === null || typeof t.example === 'string').toBe(true);+ }+ });++ it('tipOrder is a permutation of all indices and deterministic under a seed', () => {+ const rng = () => 0.42;+ const a = tipOrder(rng);+ const b = tipOrder(() => 0.42);+ expect(a).toEqual(b);+ expect([...a].sort((x, y) => x - y)).toEqual(FORGE_TIPS.map((_, i) => i));+ });+});++describe('forge-wait client', () => {+ async function mountFreshModule() {+ vi.resetModules();+ return import('../src/forge-wait.js');+ }++ function buildDom({ hidden = true } = {}) {+ document.head.innerHTML = '';+ document.body.innerHTML = `+ <div class="panel gen ${hidden ? 'is-hidden' : ''}" id="state-generating">+ <div class="gen-preview"></div>+ <div class="gen-steps">+ <div class="gen-meta">Elapsed 0s</div>+ <p class="gen-leave-hint">Feel free to leave this page.</p>+ <button id="cancel">Cancel</button>+ </div>+ </div>`;+ }++ beforeEach(() => {+ vi.useFakeTimers();+ // Default: motion allowed.+ window.matchMedia = vi.fn().mockReturnValue({ matches: false });+ });+ afterEach(() => {+ vi.useRealTimers();+ });++ it('injects the tips card into the steps column, above the leave hint', async () => {+ buildDom({ hidden: true });+ await mountFreshModule();+ const card = document.querySelector('#state-generating .gen-steps .forge-wait');+ expect(card).toBeTruthy();+ // Sits immediately before the leave-hint.+ expect(card.nextElementSibling.classList.contains('gen-leave-hint')).toBe(true);+ expect(card.querySelector('.forge-wait-eyebrow').textContent).toContain('while it forges');+ // A tip is painted even before the panel opens.+ expect(card.querySelector('.forge-wait-tip').textContent.length).toBeGreaterThan(0);+ });++ it('rotates tips only while the panel is visible', async () => {+ buildDom({ hidden: true });+ await mountFreshModule();+ const panel = document.getElementById('state-generating');+ const tipEl = document.querySelector('.forge-wait-tip');++ // Reveal the panel — rotation should begin.+ panel.classList.remove('is-hidden');+ await Promise.resolve(); // let the MutationObserver microtask flush+ const first = tipEl.textContent;++ // Advance one interval + the crossfade swap delay.+ vi.advanceTimersByTime(7000);+ vi.advanceTimersByTime(320);+ const second = tipEl.textContent;+ expect(second).not.toBe(first);++ // Hide the panel — rotation must stop (content frozen).+ panel.classList.add('is-hidden');+ await Promise.resolve();+ const frozen = tipEl.textContent;+ vi.advanceTimersByTime(7000 * 3);+ expect(tipEl.textContent).toBe(frozen);+ });++ it('shows a tip but starts no timer under reduced motion', async () => {+ window.matchMedia = vi.fn().mockReturnValue({ matches: true });+ buildDom({ hidden: false }); // already generating+ await mountFreshModule();+ const tipEl = document.querySelector('.forge-wait-tip');+ const first = tipEl.textContent;+ expect(first.length).toBeGreaterThan(0);+ // No auto-rotation: advancing time changes nothing.+ vi.advanceTimersByTime(7000 * 5 + 320);+ expect(tipEl.textContent).toBe(first);+ });++ it('renders the example line only when a tip has one', async () => {+ buildDom({ hidden: false });+ await mountFreshModule();+ const ex = document.querySelector('.forge-wait-example');+ const tip = FORGE_TIPS.find((t) => t.example);+ // Force a known tip with an example onto the card via a fresh paint cycle:+ // the first painted tip is order[0]; assert the example element is coherent.+ if (!ex.hidden) {+ expect(ex.textContent).toContain('Try:');+ } else {+ expect(ex.textContent).toBe('');+ }+ // At least one tip in the deck carries an example.+ expect(tip).toBeTruthy();+ });+});