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(daily): Daily Forge — a daily 3D challenge + creator streak
nirholas2ce192007219
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d2201a6db..83dffc4e9 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,6 +7,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr## 2026-07-17- **AR Studio** (`/ar/studio`) — A live multi-model AR scene through your camera: place any number of 3D models and avatars in your real space, pull in your forge creations, community models, or any GLB link, and generate new models by prompt without leaving the view.+- **Daily Forge** (`/daily`) — A new 3D creative challenge every day. Forge today's theme into a real 3D model, free and no sign-up, build a daily streak, and place your creation in AR on your phone.- **Image to 3D — Turn a Photo into a 3D Model** (`/image-to-3d`) — Upload a photo (or up to 4 angles) and get a downloadable textured 3D model (GLB). The Forge's photo lane, opened directly — for objects and props; for faces, use Selfie to Avatar.- **A new way to generate avatars: modular, and no two look alike** — The studio avatar generator used to recolor one of five fixed body meshes, so a whole gallery of them read as the same handful of people in different colors. It now composes each avatar from modular parts: a hairstyle, top, bottom, footwear, and glasses mixed across the base bodies onto one shared skeleton, then recolored per part and scaled for height. This is the same one-skeleton-many-parts approach the best avatar platforms use, built in-house with no external service. Every generated avatar is fully rigged and carries facial expression blendshapes, and two of them almost never look the same. All platform-generated avatars continue to appear across the galleries. (`/gallery`) `[feature, improvement]`- **AR Studio goes multiplayer: build a scene together in real time** — The AR Studio can now be a shared space. Tap Share live to open a room with a short code, send it to a friend, and you both see the same scene update live: every model one of you adds, moves, resizes, rotates, or removes appears for everyone in the room instantly, with a running count of who's building alongside you. Forge a new model from a prompt and it drops into the shared room for everyone. Open the same room on two phones pointed at the same QR marker and the models pin to the same spot on your real table. It runs on the same realtime servers as our live worlds, with each person only able to edit their own models. (`/ar/studio`) `[feature]`@@ -19,6 +20,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Community models are now sorted into colorful categories** — Every model was labeled 'other', so the browse pages were a monochrome wall with the category badges and filters doing nothing. Models are now automatically sorted into Avatar, Creature, Vehicle, Scene, Accessory, or Item from their prompt, shown as color-coded badges across the Forge showcase, gallery, and community feed. New models are categorized the moment they finish. (`/forge`) `[feature, improvement]`- **Community models now show a real picture, not an empty tile** — Most models made on the free lane are built directly as 3D geometry with no preview image, so across the site (Fresh from the Forge, the gallery, community, search, and creator profiles) the majority of cards were showing a blank gradient instead of the model. A new background job renders every finished model to a real thumbnail from the actual 3D file and fills it in, newest first, so browse pages fill up with real work instead of empty tiles. New models heal within minutes of finishing. (`/forge`) `[improvement, infra]`- **Creator profile pages work again, plus a site-wide reliability sweep** — A full automated sweep of every page and API endpoint on the site caught a bug that replaced creator profile pages (three.ws/u/yourname) with an error message. That is fixed. The sweep also repaired the login captcha for rate-limited sign-ins, fixed dead links in the dashboard and two blog posts, and added two dozen previously unlisted pages to the site index so search engines and the sitemap can find them. The audit now runs with deeper checks (blank-page detection, visible error detection, and link crawling) so regressions like these get caught before anyone hits them. (`/changelog`) `[fix, improvement]`+- **Daily Forge: a new 3D challenge every day, and a streak worth keeping** — There's now a reason to come back tomorrow. Daily Forge at three.ws/daily gives everyone the same fresh creative theme each day — tiny robots, glass creatures, cozy objects, brave little knights — with a running day count and a few starter ideas. Forge your take on it (free, no sign-up, about a minute) and you light a daily streak; keep showing up and it grows, with a celebration when you hit 3, 7, 30 days and beyond. Miss a day and it resets, but your best is always remembered. Every creation you make lands one tap from viewing it in AR or dropping it into a shared AR Studio room, and a community strip shows what others are forging. It works entirely in your browser with no account needed. (`/daily`) `[feature]`- **Embeddable 3D viewer now shows loading, progress, and errors on its own** — The lightweight <three-ws-viewer> web component (the one you drop on any site for a 3D preview) used to render a blank canvas while a model loaded and a blank canvas if it failed. It now ships its own designed states: a spinner with a live download percentage, an error card with Try again and Download GLB, a friendly empty placeholder, and a fade-in when the model appears with a one-time 'drag to rotate' cue. A new optional auto-rotate attribute gently spins the model, and a progress event lets your page track loading. The hosted three.ws/viewer page also shows a real download percentage instead of an endless spinner and restores the swipe-to-rotate hint. `[sdk, improvement]`- **Every free 3D generation now gets an automatic quality check** — The Forge already re-rolled broken meshes, but the deeper "looks nothing like what I asked for" check only ran on the paid High tier, so the free Draft and Standard lanes could still hand back a valid-but-wrong model. Now a smart adaptive gate covers the free lanes too: a clean, textured result ships instantly, and only an uncertain one is sent to the vision quality check and re-generated if it falls short. The result bar shows the outcome as a Verified, Checked, or Low confidence chip so you can see at a glance whether a model passed. (`/forge`) `[improvement, feature]`- **Faster, clearer wallet sign-in (one tap on Solana Seeker)** — Connecting a wallet now gives real feedback: the button shows a Connecting state, a success confirmation when it links, and a plain-language message with a one-tap retry when something goes wrong instead of failing silently. If you have no wallet installed, you get a clear Get Phantom prompt rather than a surprise browser tab. On a Solana Seeker, signing in now takes a single tap instead of two: both login and wallet-linking use the Mobile Wallet Adapter's built-in Sign-In-With-Solana, so authorization and the signature happen in one Seed Vault prompt, and backing out is recognized as a clean cancel. Phantom, Backpack, and Solflare work exactly as before. The whole wallet layer is now covered by an automated test suite. `[improvement]`diff --git a/STRUCTURE.md b/STRUCTURE.mdindex 09b6ab5ad..4651ecc55 100644--- a/STRUCTURE.md+++ b/STRUCTURE.md@@ -46,6 +46,7 @@ bottom.| Spatial MCP (3D as a native response type) | Spec [specs/SPATIAL_MCP.md](specs/SPATIAL_MCP.md), pure validator/builder [api/_lib/spatial-mcp.js](api/_lib/spatial-mcp.js), validator tool [api/_mcp3d/tools/spatial.js](api/_mcp3d/tools/spatial.js) (`validate_spatial_response`, free), reference renderer [public/spatial-mcp/spatial-renderer.js](public/spatial-mcp/spatial-renderer.js) + demo [public/spatial-mcp/index.html](public/spatial-mcp/index.html) `→ /spatial-mcp`, docs [docs/spatial-mcp.md](docs/spatial-mcp.md). | Live · both stores | Open (CC0) shape for returning a live, interactive 3D scene as a first-class MCP tool result (scene GLB, camera, environment, animation, AR handoff, affordances) instead of a URL. Every three.ws 3D generator emits a conformant artifact under `structuredContent.spatial`; the validator returns actionable errors, not a boolean; the framework-free reference renderer displays any conformant payload — including one transformed from a foreign tool result (portability proof at `/spatial-mcp`). Zero coin surface — reusable in the OpenAI free app. Tests: [tests/spatial-mcp.test.js](tests/spatial-mcp.test.js). Evidence: [prompts/store-submissions/_generated/spatial-mcp/](prompts/store-submissions/_generated/spatial-mcp/). Store-submission prompt 20. || AR-ready exports ("View in your space") | Device-routing core [api/_lib/ar-launch.js](api/_lib/ar-launch.js), UA-branched launch endpoint [api/ar.js](api/ar.js) `→ /api/ar`, MCP tool [api/_mcp3d/tools/ar.js](api/_mcp3d/tools/ar.js) (`export_ar`, free), in-viewer AR button [public/viewer.html](public/viewer.html), docs [docs/ar.md](docs/ar.md). | Live · both stores | `GET /api/ar?src=<glb>` branches on the request User-Agent server-side: iOS → Apple Quick Look (USDZ generated from the GLB on the fly by model-viewer's three.js USDZExporter — real conversion, no server USD tooling), Android → 302 Google Scene Viewer ARCore intent with browser fallback, desktop → WebGL viewer. Bad input rejected at the boundary with a designed error page. `export_ar` returns the AR launch link + a conformant Spatial-MCP artifact; response is OpenAI-clean (no ids/coin surface). `kind=avatar` is the living-agent lane: the launch page leads with a "Bring it to life" handoff into `/irl?avatar=<glb>` (avatar-producing tools return `irlUrl` automatically), and Android serves the launch page instead of the blind Scene Viewer redirect so the living path stays visible. Shared links unfurl: the launch page's `og:image` points at `GET /api/render/glb?glbUrl=` ([api/render/glb.js](api/render/glb.js), server-side PNG of the actual model, CDN-cached a day) and the page carries "Create your own" → `/ar` conversion CTAs. Tests: [tests/ar-export.test.js](tests/ar-export.test.js). Evidence: [prompts/store-submissions/_generated/ar/](prompts/store-submissions/_generated/ar/). Store-submission prompt 21. || AR Forge (prompt → model → your room) | [public/ar-forge.html](public/ar-forge.html) `→ /ar` (self-contained page, CDN model-viewer + local meshopt decoder, no Vite registration needed; vercel route sets `xr-spatial-tracking` permissions-policy) | Live | Mobile-first app: one prompt hits the free NVIDIA lane (`POST /api/forge {backend:"nvidia"}`, poll `?job=`), the result renders in an AR-capable `<model-viewer>` with "View in your space" (WebXR / Scene Viewer / Quick Look). Non-AR devices get a QR handoff to `GET /api/ar?src=` (server-side UA routing) plus a copyable `/viewer?src=` share link. Deep link `/ar?src=<glb>&title=` reopens any shared model; recent forges persist in localStorage. Designed idle/working/failed/result states; https-only GLB guard. |+| Daily Forge (daily challenge + creator streak) | [pages/daily.html](pages/daily.html) `→ /daily` + [src/daily.js](src/daily.js), deterministic theme rotation [src/daily/daily-theme.js](src/daily/daily-theme.js), streak state machine [src/daily/creator-streak.js](src/daily/creator-streak.js) | Live | The **anonymous-first retention loop** the platform lacked: the logged-in streak system ([api/_lib/streaks.js](api/_lib/streaks.js)) needs an account, so the no-sign-up forge majority had no reason to return. Every UTC day resolves to one curated creative theme (the same for everyone, hashed from the date — no backend, no randomness) with a running "Day N" counter; forging today's theme on the free lane lights a localStorage streak (consecutive-day state machine: extend / reset-on-gap / never-double-count, `best` preserved, at-risk vs lapsed display), and milestones (3/7/14/30/50/100/365) fire a celebration. The generation lands in the shared recents so it's one tap from `/ar` and `/ar/studio`; a "Fresh from the community" strip reads `/api/forge-gallery?scope=community`. `changefreq: daily` in the sitemap. Tests: [tests/daily-theme.test.js](tests/daily-theme.test.js), [tests/creator-streak.test.js](tests/creator-streak.test.js). || AR Studio (multi-model live camera scene) | [pages/ar-studio.html](pages/ar-studio.html) `→ /ar/studio` + [src/ar-studio.js](src/ar-studio.js), multi-anchor WebXR session [src/ar/multi-place.js](src/ar/multi-place.js), pure scene math [src/ar/studio-scene.js](src/ar/studio-scene.js) | Live | The standalone multi-model AR surface: place ANY number of models/avatars into one live camera view (every earlier AR lane was single-model). Model sources: in-view forge (`POST /api/forge {backend:"nvidia"}` runs behind the live camera, result drops into the room), the forge gallery (`/api/forge-gallery` — yours + community tabs), recent forges (localStorage, shared with `/ar`), a pasted GLB link, or repeatable `?src=` deep links (https/relative only). Rendering ladder: WebXR immersive-ar with one XRAnchor per placed model + always-armed reticle (Android), getUserMedia passthrough + gyro world-lock (iOS/everywhere), grid preview + drag-look + QR handoff (desktop). Gestures: tap select, drag move, pinch resize, two-finger twist rotate; per-model duplicate/rotate/remove, clear-with-undo. Humanoids with no baked clips idle via the universal retarget ([src/irl/pin-idle.js](src/irl/pin-idle.js)); scene persists in localStorage and the whole ARRANGEMENT (models + transforms) round-trips through a base64url `#s=` hash on the share/QR URL, so a composed scene reopens exactly on any device. **Presence realism:** WebXR placements are lit by the real room via lighting-estimation ([src/ar/estimated-lighting.js](src/ar/estimated-lighting.js), three's `XREstimatedLight` — real primary-light direction/colour + a live environment cube map so metal/glass reflect the actual room, reverting to baked lights when the device isn't estimating) and occluded by real geometry via depth-sensing ([src/ar/depth-occlusion.js](src/ar/depth-occlusion.js)); the passthrough path matches room brightness AND colour by sampling the camera feed. Desktop keyboard controls (arrows nudge / R rotate / D duplicate / Delete). Photo capture composites camera + WebGL ([src/irl/share-frame.js](src/irl/share-frame.js)). Reachable from `/ar`, the forge AR panel, and the `/viewer` action sheet. **Shared rooms (build together, live):** "Share live" opens a room with a 6-char code; anyone who opens `/ar/studio?room=CODE` joins the same scene and every add / move / scale / rotate / remove delta-syncs in real time, with a live "N here" presence pill. New Colyseus room [multiplayer/src/rooms/StudioRoom.js](multiplayer/src/rooms/StudioRoom.js) + schema [multiplayer/src/studio-schemas.js](multiplayer/src/studio-schemas.js) (owner-gated edits, per-room/per-owner caps, per-client rate limit, https-only src validation — same discipline as WalkRoom's object channel), client wrapper [src/ar/studio-net.js](src/ar/studio-net.js), and a shared logical coordinate frame [src/ar/studio-coords.js](src/ar/studio-coords.js) (relEast/relNorth/yawDeg) so every device agrees on placement; QR-marker colocalization ([src/irl/marker-anchor.js](src/irl/marker-anchor.js)) is the co-located "same physical table" upgrade. Runs on the same Colyseus host as /walk and /irl (a new room, not a new process). Tests: [tests/ar-studio-scene.test.js](tests/ar-studio-scene.test.js), [tests/ar-studio-coords.test.js](tests/ar-studio-coords.test.js), [tests/ar-estimated-lighting.test.js](tests/ar-estimated-lighting.test.js), [tests/studio-room.test.js](tests/studio-room.test.js). || IRL (agents in the real world) | [pages/irl.html](pages/irl.html) `→ /irl` + [src/irl.js](src/irl.js), WebXR placement [src/ar/webxr.js](src/ar/webxr.js) + pinch [src/ar/pinch-scale.js](src/ar/pinch-scale.js), animated Quick Look bake [src/usdz-animated.js](src/usdz-animated.js) (static fallback [src/usdz-pipeline.js](src/usdz-pipeline.js)), backend [api/irl/](api/irl) | Live | Pin an agent at a real GPS spot; discovery is presence-proof-gated ([docs/irl/THREAT-MODEL.md](docs/irl/THREAT-MODEL.md)). **Place in AR** leads the dock on AR-capable devices: WebXR hit-test anchoring on Android with two-finger pinch resize (25%..400%) persisted to the pin (`anchor_scale`; the pinch lands as a follow-up `PATCH /api/irl/pins {id, scale}` after the placement tap), and ARKit Quick Look on iOS with the idle clip baked into the USDZ so the agent moves instead of standing in a T-pose. Discovered pins are equally alive in the in-page camera view: every mounted humanoid GLB plays the retargeted idle clip via a per-pin mixer ([src/irl/pin-idle.js](src/irl/pin-idle.js), phase-randomized, LOD-bounded), camera-aware gaze composes on top of the running animation, and the scene renders with ACES tone mapping + IBL + soft shadows (e2e: [tests/e2e/irl-pin-idle.spec.js](tests/e2e/irl-pin-idle.spec.js)). Inbound `/irl?avatar=<glb>` is the living-agent handoff from `GET /api/ar?…&kind=avatar` (explicit `?avatar=` wins over a saved session). Money Drops and World Lines: [docs/irl.md](docs/irl.md). SDK: [packages/irl/](packages/irl). **Share** ([src/irl/share-frame.js](src/irl/share-frame.js), [api/irl/share.js](api/irl/share.js), [api/irl/share/[token].js](api/irl/share/%5Btoken%5D.js)) mints a permanent, unfurlable `/irl/s/:token` link from the captured AR photo for the pin you just placed — never a coordinate, owner-gated, falls back to the plain native share sheet with no active pin. **Analytics** ([api/_lib/irl-analytics.js](api/_lib/irl-analytics.js), [api/irl/analytics.js](api/irl/analytics.js)) is the first site-wide usage rollup for the feature — pins placed, nearby reads, placement method, shares, drop claims — rendered at [/admin/irl-analytics](pages/admin/irl-analytics.html), aged out by the existing hourly reaper. || Verifiable 3D provenance (content credentials) | Spec [specs/PROVENANCE_3D.md](specs/PROVENANCE_3D.md), pure core [api/_lib/provenance-3d.js](api/_lib/provenance-3d.js), Solana anchor [api/_lib/provenance-anchor.js](api/_lib/provenance-anchor.js), MCP tools [api/_mcp3d/tools/provenance.js](api/_mcp3d/tools/provenance.js) (`verify_provenance` free, `anchor_provenance` paid $0.05), free REST verify [api/provenance.js](api/provenance.js) `→ /api/provenance`, viewer badge [public/viewer.html](public/viewer.html), docs [docs/provenance.md](docs/provenance.md). | Live (verify) · anchor gated on issuer key + devnet funds | C2PA-style signed content credentials for AI 3D: creator, prompt, model/provider, lineage, timestamp, and the GLB's sha256, ed25519-signed by the three.ws issuer with the credential hash anchored on Solana. Free public `verify_provenance` / `GET /api/provenance?src=…` recompute the hash and return `verified | tampered | unknown` (a single changed byte → tampered); the verify path and response are coin-clean (both stores). `anchor_provenance` signs + writes the SPL Memo anchor + stores the credential in R2. Tests: [tests/provenance-3d.test.js](tests/provenance-3d.test.js). Evidence: [prompts/store-submissions/_generated/provenance/](prompts/store-submissions/_generated/provenance/). Store-submission prompt 19. |diff --git a/data/changelog.json b/data/changelog.jsonindex 0628bd613..2cc60c3ef 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,15 @@{"$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": "Daily Forge: a new 3D challenge every day, and a streak worth keeping",+ "summary": "There's now a reason to come back tomorrow. Daily Forge at three.ws/daily gives everyone the same fresh creative theme each day — tiny robots, glass creatures, cozy objects, brave little knights — with a running day count and a few starter ideas. Forge your take on it (free, no sign-up, about a minute) and you light a daily streak; keep showing up and it grows, with a celebration when you hit 3, 7, 30 days and beyond. Miss a day and it resets, but your best is always remembered. Every creation you make lands one tap from viewing it in AR or dropping it into a shared AR Studio room, and a community strip shows what others are forging. It works entirely in your browser with no account needed.",+ "tags": [+ "feature"+ ],+ "link": "/daily"+ },{"date": "2026-07-17","title": "The homepage no longer greets you with an empty stage",diff --git a/data/pages.json b/data/pages.jsonindex e7b78b7c8..ef780b914 100644--- a/data/pages.json+++ b/data/pages.json@@ -765,6 +765,15 @@"added": "2026-07-17","showcase": true},+ {+ "path": "/daily",+ "title": "Daily Forge",+ "description": "A new 3D creative challenge every day. Forge today's theme into a real 3D model, free and no sign-up, build a daily streak, and place your creation in AR on your phone.",+ "priority": 0.8,+ "changefreq": "daily",+ "added": "2026-07-17",+ "showcase": true+ },{"path": "/spatial-mcp","title": "Spatial MCP — reference renderer",diff --git a/pages/daily.html b/pages/daily.htmlnew file mode 100644index 000000000..7c7378516--- /dev/null+++ b/pages/daily.html@@ -0,0 +1,263 @@+<!doctype html>+<html lang="en">+<head>+ <script>/* three.ws theme boot */(function(){try{var m=localStorage.getItem('twx_theme');var l=m==='auto'?(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches):m==='light';document.documentElement.setAttribute('data-theme',l?'light':'dark');}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();</script>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />+ <meta name="theme-color" content="#0b0c10" />+ <title>Daily Forge · three.ws</title>+ <meta name="description" content="A new 3D creative challenge every day. Forge today's theme into a real 3D model, free and no sign-up, and build a daily streak. Place your creation in AR on your phone." />+ <link rel="canonical" href="https://three.ws/daily" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:type" content="website" />+ <meta property="og:url" content="https://three.ws/daily" />+ <meta property="og:title" content="Daily Forge · three.ws" />+ <meta property="og:description" content="A new 3D creative challenge every day. Forge today's theme into a real 3D model, free, and keep your streak alive." />+ <meta property="og:image" content="https://three.ws/api/page-og?s=labs&t=Daily+Forge&d=A+new+3D+creative+challenge+every+day.+Forge+today%27s+theme+into+a+real+3D+model%2C+free+and+no+sign-up%2C+and+build+a+daily+streak.&p=%2Fdaily" />+ <meta property="og:image:width" content="1200" />+ <meta property="og:image:height" content="630" />+ <meta name="twitter:card" content="summary_large_image" />+ <meta name="twitter:site" content="@trythreews" />+ <meta name="twitter:title" content="Daily Forge · three.ws" />+ <meta name="twitter:description" content="A new 3D creative challenge every day. Build a daily streak." />+ <script type="application/ld+json">{"@context":"https://schema.org","@type":"WebApplication","name":"Daily Forge","url":"https://three.ws/daily","applicationCategory":"GameApplication","operatingSystem":"Any","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"},"description":"A daily 3D creative challenge: forge the day's theme into a real 3D model and build a streak.","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}}</script>+ <link rel="icon" href="/favicon.ico" sizes="any" />+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />+ <meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1" />+ <!-- Meshopt decoder before <model-viewer> (Forge GLBs are meshopt-compressed). -->+ <script src="/model-viewer-meshopt.js"></script>+ <script type="module" src="https://cdn.jsdelivr.net/npm/@google/[email protected]/dist/model-viewer.min.js"></script>+ <style>+ :root {+ --bg: #0b0c10; --ink: #ecedf2; --ink-dim: #9aa0af; --ink-faint: #6b7080;+ --line: rgba(255,255,255,0.09); --panel: rgba(255,255,255,0.03);+ --accent: #ffb15c; --good: #6ee7b7; --warn: #fca5a5;+ --flame: #ff8a3d; --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;+ }+ * { box-sizing: border-box; }+ html, body { margin: 0; }+ body {+ font-family: var(--font);+ background: radial-gradient(130% 130% at 50% 0%, #16130e 0%, #0b0c10 55%, #08090c 100%);+ color: var(--ink); min-height: 100dvh; display: flex; flex-direction: column;+ }+ a { color: inherit; }+ header.bar {+ display: flex; align-items: center; gap: 12px; padding: 12px 16px;+ border-bottom: 1px solid var(--line); background: rgba(10,11,14,0.55);+ backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5;+ }+ .brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 700; }+ .brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--flame); box-shadow: 0 0 12px var(--flame); }+ .crumb { color: var(--ink-dim); font-size: 13px; }+ .spacer { flex: 1 1 auto; }+ .streak-pill {+ display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700;+ background: rgba(255,138,61,0.14); border: 1px solid rgba(255,138,61,0.4);+ color: #ffd0a8; border-radius: 999px; padding: 6px 12px; white-space: nowrap;+ }+ .streak-pill.zero { background: var(--panel); border-color: var(--line); color: var(--ink-dim); }+ a.top { color: var(--ink-dim); font-size: 13px; text-decoration: none; }+ a.top:hover { color: var(--ink); }+ main { flex: 1 1 auto; width: 100%; max-width: 760px; margin: 0 auto; padding: 22px 16px 48px; display: flex; flex-direction: column; gap: 18px; }++ /* Theme hero */+ .theme {+ border: 1px solid var(--line); border-radius: 18px; padding: 20px;+ background:+ radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--theme, #ffb15c) 16%, transparent) 0%, transparent 55%),+ var(--panel);+ position: relative; overflow: hidden;+ }+ .theme .day { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--theme, var(--accent)); }+ .theme h1 { margin: 6px 0 6px; font-size: clamp(24px, 6vw, 34px); letter-spacing: -0.02em; display: flex; align-items: center; gap: 12px; }+ .theme h1 .emoji { font-size: 1.1em; filter: saturate(1.1); }+ .theme .hint { margin: 0; color: var(--ink-dim); font-size: 14.5px; line-height: 1.5; max-width: 52ch; }++ /* Streak banner */+ .streak {+ display: flex; align-items: center; gap: 14px; border: 1px solid var(--line);+ border-radius: 14px; padding: 13px 16px; background: var(--panel);+ }+ .streak .flame { font-size: 30px; line-height: 1; filter: drop-shadow(0 0 10px rgba(255,138,61,0.5)); }+ .streak.lit .flame { animation: flicker 2.6s ease-in-out infinite; }+ @keyframes flicker { 0%,100% { transform: scale(1) rotate(-1deg); } 50% { transform: scale(1.08) rotate(1deg); } }+ @media (prefers-reduced-motion: reduce) { .streak.lit .flame { animation: none; } }+ .streak .txt { flex: 1 1 auto; min-width: 0; }+ .streak .n { font-size: 16px; font-weight: 750; }+ .streak .sub { font-size: 12.5px; color: var(--ink-dim); }+ .streak .best { font-size: 12px; color: var(--ink-faint); white-space: nowrap; }++ /* Prompt */+ form.ask { display: flex; gap: 8px; align-items: stretch; }+ .ask input {+ flex: 1 1 auto; min-width: 0; font: inherit; font-size: 15px; color: var(--ink);+ background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.16);+ border-radius: 12px; padding: 12px 14px; transition: border-color .15s, background .15s;+ }+ .ask input::placeholder { color: var(--ink-faint); }+ .ask input:focus { outline: none; border-color: color-mix(in srgb, var(--theme, var(--accent)) 65%, transparent); background: rgba(255,255,255,0.07); }+ button.go {+ appearance: none; cursor: pointer; font: inherit; font-size: 14.5px; font-weight: 750;+ color: #1a1206; background: var(--theme, var(--accent)); border: 0; border-radius: 12px; padding: 12px 20px;+ display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; transition: filter .15s, transform .05s;+ }+ button.go:hover { filter: brightness(1.07); }+ button.go:active { transform: translateY(1px); }+ button.go[disabled] { opacity: .55; cursor: progress; filter: none; }+ .chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }+ .chips .label { color: var(--ink-faint); font-size: 12px; }+ button.chip {+ appearance: none; cursor: pointer; font: inherit; font-size: 12.5px; color: #d6dae4;+ background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.13);+ border-radius: 999px; padding: 6px 12px; transition: background .15s, border-color .15s, color .15s;+ }+ button.chip:hover { background: color-mix(in srgb, var(--theme, var(--accent)) 14%, transparent); border-color: color-mix(in srgb, var(--theme, var(--accent)) 40%, transparent); color: #fff; }++ /* Stage */+ .stage { position: relative; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: rgba(255,255,255,0.02); min-height: min(52dvh, 440px); display: flex; flex-direction: column; }+ model-viewer { width: 100%; flex: 1 1 auto; min-height: min(48dvh, 400px); --poster-color: transparent; --progress-bar-color: var(--theme, var(--accent)); background: transparent; opacity: 1; transition: opacity .35s ease; }+ model-viewer.veiled { opacity: 0; }+ .overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 13px; text-align: center; padding: 26px; }+ .spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.14); border-top-color: var(--theme, var(--accent)); animation: spin .9s linear infinite; }+ @keyframes spin { to { transform: rotate(360deg); } }+ @media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }+ .idleart { font-size: 42px; line-height: 1; }+ .h { font-size: 15px; font-weight: 650; }+ .muted { color: var(--ink-dim); font-size: 13px; line-height: 1.5; max-width: 40ch; }+ .elapsed { font-variant-numeric: tabular-nums; color: var(--ink-faint); font-size: 12px; }+ .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 14px; border-top: 1px solid var(--line); background: rgba(10,11,14,0.45); }+ .actions .meta { flex: 1 1 100%; color: var(--ink-dim); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }+ a.btn, button.btn {+ appearance: none; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 7px;+ font: inherit; font-size: 13px; font-weight: 650; color: var(--ink);+ background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14);+ border-radius: 10px; padding: 8px 13px; transition: background .15s, border-color .15s, transform .05s;+ }+ a.btn:hover, button.btn:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.28); }+ a.btn:active, button.btn:active { transform: translateY(1px); }+ .btn.primary { background: color-mix(in srgb, var(--theme, var(--accent)) 20%, transparent); border-color: color-mix(in srgb, var(--theme, var(--accent)) 45%, transparent); color: #fff; }+ .hidden { display: none !important; }+ .retry { color: var(--theme, var(--accent)); background: transparent; border: 1px solid color-mix(in srgb, var(--theme, var(--accent)) 45%, transparent); }++ /* Community */+ section.rail-wrap h2 { font-size: 13px; font-weight: 650; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .06em; margin: 4px 0 10px; }+ .rail { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 9px; }+ .rail a { display: flex; flex-direction: column; gap: 6px; text-decoration: none; }+ .rail .thumb { aspect-ratio: 1.2; border-radius: 10px; overflow: hidden; background: linear-gradient(140deg,#171923,#101218); display: grid; place-items: center; }+ .rail .thumb img { width: 100%; height: 100%; object-fit: cover; }+ .rail .cap { font-size: 11.5px; color: var(--ink-dim); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }++ /* Milestone toast */+ .milestone { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(4,4,6,0.6); padding: 24px; }+ .milestone-card { text-align: center; max-width: 340px; background: #12140f; border: 1px solid color-mix(in srgb, var(--flame) 40%, var(--line)); border-radius: 20px; padding: 28px 24px; box-shadow: 0 30px 80px -30px rgba(255,138,61,0.5); animation: pop .3s ease; }+ @keyframes pop { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }+ .milestone-card .big { font-size: 52px; line-height: 1; }+ .milestone-card h3 { margin: 12px 0 6px; font-size: 22px; }+ .milestone-card p { margin: 0 0 16px; color: var(--ink-dim); font-size: 14px; line-height: 1.5; }++ footer.foot { border-top: 1px solid var(--line); padding: 14px 16px; text-align: center; color: var(--ink-faint); font-size: 12px; }+ footer.foot a { color: var(--ink-dim); }+ footer.foot a:hover { color: var(--ink); }+ </style>+</head>+<body>+ <header class="bar">+ <a class="brand" href="/"><span class="dot" aria-hidden="true"></span>three.ws</a>+ <span class="crumb">/ Daily Forge</span>+ <span class="spacer"></span>+ <span class="streak-pill zero" id="streak-pill" title="Your daily forge streak">🔥 <span id="streak-pill-n">0</span></span>+ <a class="top" href="/forge">Studio →</a>+ </header>++ <main>+ <div class="theme" id="theme">+ <div class="day" id="theme-day">Daily challenge</div>+ <h1><span class="emoji" id="theme-emoji" aria-hidden="true">✨</span><span id="theme-title">Today's theme</span></h1>+ <p class="hint" id="theme-hint">Loading today's challenge…</p>+ </div>++ <div class="streak" id="streak">+ <span class="flame" aria-hidden="true">🔥</span>+ <div class="txt">+ <div class="n" id="streak-n">Start your streak today</div>+ <div class="sub" id="streak-sub">Forge today's theme to begin a daily streak.</div>+ </div>+ <div class="best" id="streak-best"></div>+ </div>++ <form class="ask" id="ask" autocomplete="off">+ <input id="prompt" name="prompt" type="text" inputmode="text" enterkeyhint="go" maxlength="600" minlength="3"+ placeholder="Describe your take on today's theme…" aria-label="Describe the 3D model to generate" required />+ <button class="go" id="go" type="submit">Forge<span aria-hidden="true">✦</span></button>+ </form>+ <div class="chips" id="chips" aria-label="Prompt ideas for today"><span class="label">Ideas:</span></div>++ <div class="stage" id="stage">+ <model-viewer id="mv" class="veiled" camera-controls auto-rotate touch-action="pan-y"+ rotation-per-second="16deg" interaction-prompt="none" shadow-intensity="1" shadow-softness="0.85"+ exposure="1.05" environment-image="neutral" tone-mapping="aces"+ ar ar-modes="webxr scene-viewer quick-look" ar-scale="auto" reveal="auto" alt="Your 3D creation">+ </model-viewer>++ <div id="idle" class="overlay">+ <div class="idleart" aria-hidden="true">🛠️</div>+ <div class="h">Make today's theme yours</div>+ <div class="muted">Type your own spin above or tap an idea. It's free, takes about a minute, and keeps your streak alive.</div>+ </div>++ <div id="working" class="overlay hidden" aria-live="polite">+ <div class="spinner" aria-hidden="true"></div>+ <div class="h" id="worktitle">Forging…</div>+ <div class="muted" id="workmsg">Sending your prompt to the forge.</div>+ <div class="elapsed" id="elapsed"></div>+ </div>++ <div id="failed" class="overlay hidden">+ <div class="h">That one didn't make it</div>+ <div class="muted" id="failmsg">Generation failed.</div>+ <button class="btn retry" id="retry" type="button">Try again</button>+ </div>++ <div class="actions hidden" id="actions">+ <div class="meta" id="meta"></div>+ <button class="btn primary" id="ar-btn" type="button" aria-label="View this in augmented reality">📱 View in your room</button>+ <a class="btn" id="studio-btn" aria-label="Open in AR Studio">▣ AR Studio</a>+ <a class="btn" id="download" download aria-label="Download the GLB">Download</a>+ <button class="btn" id="share" type="button" aria-label="Share this creation">Share</button>+ </div>+ </div>++ <section class="rail-wrap hidden" id="rail-wrap">+ <h2>Fresh from the community</h2>+ <div class="rail" id="rail"></div>+ </section>+ </main>++ <div class="milestone hidden" id="milestone" role="dialog" aria-modal="true" aria-label="Streak milestone">+ <div class="milestone-card">+ <div class="big" id="ms-emoji">🔥</div>+ <h3 id="ms-title">7-day streak!</h3>+ <p id="ms-body">You've forged something seven days running. Keep it going.</p>+ <button class="btn primary" id="ms-close" type="button">Keep forging</button>+ </div>+ </div>++ <footer class="foot">+ A new challenge every day at midnight UTC · Free, no sign-up ·+ <a href="/forge">Forge studio</a> · <a href="/ar/studio">AR Studio</a> · <a href="/gallery">Gallery</a>+ </footer>++ <script type="module">+ function webglSupported() {+ try { const c = document.createElement('canvas'); return !!(window.WebGLRenderingContext && (c.getContext('webgl') || c.getContext('experimental-webgl'))); } catch { return false; }+ }+ if (webglSupported()) import('/src/daily.js');+ else {+ const s = document.getElementById('idle');+ if (s) s.innerHTML = '<div class="idleart">🛰️</div><div class="h">This browser can’t render 3D</div><div class="muted">Reopen Daily Forge in an up-to-date Chrome or Safari to join today’s challenge.</div>';+ }+ </script>+</body>+</html>diff --git a/public/ar-forge.html b/public/ar-forge.htmlindex 7ff98a188..e32e133b4 100644--- a/public/ar-forge.html+++ b/public/ar-forge.html@@ -226,7 +226,7 @@<footer class="foot">Free lane, fair-use rate limited · Models are meshopt-compressed glTF binaries ·- <a href="/ar/studio">AR Studio (multi-model)</a> · <a href="/forge">Forge studio</a> · <a href="/viewer">GLB viewer</a> · <a href="/features/ar">How AR works</a> ·+ <a href="/daily">Daily Forge challenge</a> · <a href="/ar/studio">AR Studio (multi-model)</a> · <a href="/forge">Forge studio</a> · <a href="/viewer">GLB viewer</a> · <a href="/features/ar">How AR works</a> ·<a href="/irl">Living agents in AR</a></footer>diff --git a/public/changelog.json b/public/changelog.jsonindex 5306ee10b..5ab2b5f4f 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-17T13:07:59.891Z",+ "generated_at": "2026-07-17T20:59:09.415Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -16,6 +16,16 @@"launch"]},+ {+ "date": "2026-07-17",+ "type": "launch",+ "title": "Daily Forge",+ "summary": "A new 3D creative challenge every day. Forge today's theme into a real 3D model, free and no sign-up, build a daily streak, and place your creation in AR on your phone.",+ "link": "/daily",+ "tags": [+ "launch"+ ]+ },{"date": "2026-07-17","type": "launch",@@ -144,6 +154,16 @@"improvement"]},+ {+ "date": "2026-07-17",+ "type": "update",+ "title": "Daily Forge: a new 3D challenge every day, and a streak worth keeping",+ "summary": "There's now a reason to come back tomorrow. Daily Forge at three.ws/daily gives everyone the same fresh creative theme each day — tiny robots, glass creatures, cozy objects, brave little knights — with a running day count and a few starter ideas. Forge your take on it (free, no sign-up, about a minute) and you light a daily streak; keep showing up and it grows, with a celebration when you hit 3, 7, 30 days and beyond. Miss a day and it resets, but your best is always remembered. Every creation you make lands one tap from viewing it in AR or dropping it into a shared AR Studio room, and a community strip shows what others are forging. It works entirely in your browser with no account needed.",+ "link": "/daily",+ "tags": [+ "feature"+ ]+ },{"date": "2026-07-17","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex ae119c3ad..c411c4220 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -14,6 +14,14 @@<category>launch</category><description>A live multi-model AR scene through your camera: place any number of 3D models and avatars in your real space, pull in your forge creations, community models, or any GLB link, and generate new models by prompt without leaving the view.</description></item>+ <item>+ <title>Daily Forge</title>+ <link>https://three.ws/daily</link>+ <guid isPermaLink="false">2026-07-17:Daily Forge</guid>+ <pubDate>Fri, 17 Jul 2026 12:00:00 GMT</pubDate>+ <category>launch</category>+ <description>A new 3D creative challenge every day. Forge today's theme into a real 3D model, free and no sign-up, build a daily streak, and place your creation in AR on your phone.</description>+ </item><item><title>Image to 3D — Turn a Photo into a 3D Model</title><link>https://three.ws/image-to-3d</link>@@ -110,6 +118,14 @@<category>fix</category><description>A full automated sweep of every page and API endpoint on the site caught a bug that replaced creator profile pages (three.ws/u/yourname) with an error message. That is fixed. The sweep also repaired the login captcha for rate-limited sign-ins, fixed dead links in the dashboard and two blog posts, and added two dozen previously unlisted pages to the site index so search engines and the sitemap can find them. The audit now runs with deeper checks (blank-page detection, visible error detection, and link crawling) so regressions like these get caught before anyone hits them.</description></item>+ <item>+ <title>Daily Forge: a new 3D challenge every day, and a streak worth keeping</title>+ <link>https://three.ws/daily</link>+ <guid isPermaLink="false">2026-07-17:Daily Forge: a new 3D challenge every day, and a streak worth keeping</guid>+ <pubDate>Fri, 17 Jul 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>There's now a reason to come back tomorrow. Daily Forge at three.ws/daily gives everyone the same fresh creative theme each day — tiny robots, glass creatures, cozy objects, brave little knights — with a running day count and a few starter ideas. Forge your take on it (free, no sign-up, about a minute) and you light a daily streak; keep showing up and it grows, with a celebration when you hit 3, 7, 30 days and beyond. Miss a day and it resets, but your best is always remembered. Every creation you make lands one tap from viewing it in AR or dropping it into a shared AR Studio room, and a community strip shows what others are forging. It works entirely in your browser with no account needed.</description>+ </item><item><title>Embeddable 3D viewer now shows loading, progress, and errors on its own</title><link>https://three.ws/changelog</link>diff --git a/public/features.json b/public/features.jsonindex 7f67328bb..f4cd7ded7 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-17T13:07:59.879Z",+ "generated_at": "2026-07-17T20:59:09.400Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",@@ -939,6 +939,16 @@"tags": [],"showcase": true},+ {+ "path": "/daily",+ "title": "Daily Forge",+ "description": "A new 3D creative challenge every day. Forge today's theme into a real 3D model, free and no sign-up, build a daily streak, and place your creation in AR on your phone.",+ "added": "2026-07-17",+ "auth": null,+ "indexable": true,+ "tags": [],+ "showcase": true+ },{"path": "/spatial-mcp","title": "Spatial MCP — reference renderer",diff --git a/public/llms-full.txt b/public/llms-full.txtindex 9dfba3a41..d02cb9093 100644--- a/public/llms-full.txt+++ b/public/llms-full.txt@@ -572,6 +572,12 @@ URL: https://three.ws/ar/studioA live multi-model AR scene through your camera: place any number of 3D models and avatars in your real space, pull in your forge creations, community models, or any GLB link, and generate new models by prompt without leaving the view.+### Daily Forge++URL: https://three.ws/daily++A new 3D creative challenge every day. Forge today's theme into a real 3D model, free and no sign-up, build a daily streak, and place your creation in AR on your phone.+### Spatial MCP — reference rendererURL: https://three.ws/spatial-mcpdiff --git a/public/llms.txt b/public/llms.txtindex 14e5881f3..1b049a6de 100644--- a/public/llms.txt+++ b/public/llms.txt@@ -109,6 +109,7 @@ Experimental features actively shipping. Expect fast iteration.- [glTF / GLB Viewer](https://three.ws/viewer): Preview any public glTF/GLB inline, then take it further: pose and animate it, restyle the material, build a scene, place it in AR, embed it on your site, or launch it as a pump.fun coin.- [AR Forge](https://three.ws/ar): Type a prompt, get a real 3D model, and place it in your room: free text-to-3D with one-tap AR on any phone (WebXR, Scene Viewer, Quick Look) and a QR handoff from desktop.- [AR Studio](https://three.ws/ar/studio): A live multi-model AR scene through your camera: place any number of 3D models and avatars in your real space, pull in your forge creations, community models, or any GLB link, and generate new models by prompt without leaving the view.+- [Daily Forge](https://three.ws/daily): A new 3D creative challenge every day. Forge today's theme into a real 3D model, free and no sign-up, build a daily streak, and place your creation in AR on your phone.- [Spatial MCP — reference renderer](https://three.ws/spatial-mcp): The open standard for returning a live, interactive 3D scene as a first-class MCP tool result, with a framework-free reference renderer that displays any conformant artifact — including ones transformed from other tools.- [Playground](https://three.ws/playground): Sandbox for experimenting with agents, prompts, and 3D scenes.- [Labs Showcase](https://three.ws/labs): A curated gallery of three.ws's most powerful — and most hidden — features. Find and try things you didn't know existed.diff --git a/public/sitemap/index.html b/public/sitemap/index.htmlindex bbfe9d5b2..c9f3a97f0 100644--- a/public/sitemap/index.html+++ b/public/sitemap/index.html@@ -58,7 +58,7 @@<main class="sm-wrap"><div class="sm-hero"><h1>Sitemap</h1>- <p>All 465 pages on three.ws, grouped by purpose. Looking for the machine-readable versions?</p>+ <p>All 466 pages on three.ws, grouped by purpose. Looking for the machine-readable versions?</p><div class="sm-formats"><a href="/sitemap.xml"><code>sitemap.xml</code> · for search engines</a><a href="/llms.txt"><code>llms.txt</code> · for AI agents</a>@@ -70,7 +70,7 @@</div><div class="sm-filter"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/></svg>- <input id="sm-filter-input" type="search" placeholder="Filter 465 pages by name, path, or description…" aria-label="Filter pages" autocomplete="off" spellcheck="false" />+ <input id="sm-filter-input" type="search" placeholder="Filter 466 pages by name, path, or description…" aria-label="Filter pages" autocomplete="off" spellcheck="false" /><kbd aria-hidden="true">/</kbd></div><p class="sm-filter-count" id="sm-filter-count" role="status" aria-live="polite"></p>@@ -688,7 +688,7 @@<section class="sm-section" id="labs"><header>- <h2>Labs<span class="sm-count" data-count>14</span></h2>+ <h2>Labs<span class="sm-count" data-count>15</span></h2><p class="sm-section-desc">Experimental features actively shipping. Expect fast iteration.</p></header><ul class="sm-list">@@ -748,6 +748,13 @@<span class="sm-desc">A live multi-model AR scene through your camera: place any number of 3D models and avatars in your real space, pull in your forge creations, community models, or any GLB link, and generate new models by prompt without leaving the view.</span></a></li>+ <li>+ <a href="/daily">+ <span class="sm-title">Daily Forge</span>+ <span class="sm-path">/daily</span>+ <span class="sm-desc">A new 3D creative challenge every day. Forge today's theme into a real 3D model, free and no sign-up, build a daily streak, and place your creation in AR on your phone.</span>+ </a>+ </li><li><a href="/spatial-mcp"><span class="sm-title">Spatial MCP — reference renderer</span>diff --git a/src/daily.js b/src/daily.jsnew file mode 100644index 000000000..3586b6550--- /dev/null+++ b/src/daily.js@@ -0,0 +1,293 @@+// Daily Forge (/daily) — a new 3D creative challenge every day, with a streak.+//+// The retention loop the platform was missing for its anonymous majority: the+// logged-in streak system (api/_lib/streaks.js) needs an account, so the huge+// no-sign-up forge audience had no reason to come back. This surface gives them+// one — a deterministic daily theme (src/daily/daily-theme.js), a localStorage+// streak (src/daily/creator-streak.js), and a one-minute free generation that+// keeps the flame lit. Every creation also lands in the shared recents so it's+// one tap from AR and the AR Studio.+//+// Self-contained apart from the free forge lane (POST /api/forge, same contract+// as /ar) and the community gallery (/api/forge-gallery). model-viewer is loaded+// by the page via CDN.++import { seedForDate, themeForDate, utcDayKey } from './daily/daily-theme.js';+import {+ loadStreak, milestoneFor, recordDay, saveStreak, streakStatus,+} from './daily/creator-streak.js';+import { createLogger } from './shared/log.js';++const log = createLogger('daily');+const $ = (id) => document.getElementById(id);+const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));++const RECENT_KEY = 'twx_ar_forge_recent'; // shared with /ar + AR Studio+const POLL_MS = 3000;+const MAX_POLL_MS = 300000;++// Stable anonymous forge identity (same key /forge, /ar, and AR Studio use), so+// generations count toward this browser's gallery and streak consistently.+const CLIENT_ID = (() => {+ const KEY = 'forge:cid';+ try {+ let id = localStorage.getItem(KEY);+ if (!id) { id = crypto?.randomUUID?.() || `c-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`; localStorage.setItem(KEY, id); }+ return id;+ } catch { return `c-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`; }+})();++const today = utcDayKey(new Date());+const theme = themeForDate(new Date());++// ── Render the day ─────────────────────────────────────────────────────────────+document.documentElement.style.setProperty('--theme', theme.accent);+$('theme-day').textContent = `Day ${theme.day} · Daily challenge`;+$('theme-emoji').textContent = theme.emoji;+$('theme-title').textContent = theme.title;+$('theme-hint').textContent = theme.hint;+document.title = `${theme.emoji} ${theme.title} · Daily Forge · three.ws`;++const input = $('prompt');+input.value = seedForDate(new Date());+input.placeholder = `Your take on "${theme.title}"…`;++// Seed chips (tap to fill).+const chips = $('chips');+for (const seed of theme.seeds) {+ const b = document.createElement('button');+ b.type = 'button'; b.className = 'chip'; b.textContent = seed;+ b.addEventListener('click', () => { input.value = seed; forge(seed); });+ chips.appendChild(b);+}++// ── Streak ─────────────────────────────────────────────────────────────────────+function renderStreak() {+ const st = streakStatus(loadStreak(), today);+ const pill = $('streak-pill');+ const pillN = $('streak-pill-n');+ const streakEl = $('streak');+ const n = $('streak-n');+ const sub = $('streak-sub');+ const best = $('streak-best');++ const shown = st.actedToday ? st.current : (st.atRisk ? st.current : 0);+ pillN.textContent = String(shown);+ pill.classList.toggle('zero', shown === 0);+ streakEl.classList.toggle('lit', shown > 0);+ best.textContent = st.best > 1 ? `Best: ${st.best}` : '';++ if (st.actedToday) {+ n.textContent = st.current === 1 ? 'Streak started — day 1' : `${st.current}-day streak 🔥`;+ sub.textContent = 'You forged today. Come back tomorrow to keep it going.';+ } else if (st.atRisk) {+ n.textContent = `${st.current}-day streak at risk`;+ sub.textContent = 'Forge today to keep your streak alive.';+ } else {+ n.textContent = 'Start your streak today';+ sub.textContent = st.best > 0 ? `Your best was ${st.best} days — forge today to begin again.` : 'Forge today’s theme to begin a daily streak.';+ }+}+renderStreak();++// Bump the streak after a real creation; celebrate a milestone.+function bumpStreak() {+ const { state, changed, milestone } = recordDay(loadStreak(), today);+ if (changed) saveStreak(state);+ renderStreak();+ if (milestone) celebrate(milestone, state.current);+}++function celebrate(milestone, current) {+ const emoji = milestone >= 100 ? '👑' : milestone >= 30 ? '🌟' : milestone >= 7 ? '🔥' : '✨';+ $('ms-emoji').textContent = emoji;+ $('ms-title').textContent = `${milestone}-day streak!`;+ $('ms-body').textContent = milestone >= 30+ ? `${current} days of daily creation. You're a machine — keep the flame burning.`+ : `You've forged something ${milestone} days running. That's a real habit forming.`;+ $('milestone').classList.remove('hidden');+ try { navigator.vibrate?.([12, 40, 12]); } catch {}+}+$('ms-close').addEventListener('click', () => $('milestone').classList.add('hidden'));+$('milestone').addEventListener('click', (e) => { if (e.target === $('milestone')) $('milestone').classList.add('hidden'); });++// ── Forge flow (free NVIDIA lane) ──────────────────────────────────────────────+const mv = $('mv');+let runSeq = 0;+let elapsedTimer = null;+let current = null; // { glb, prompt }++function overlay(el) {+ ['idle', 'working', 'failed'].forEach((id) => $(id).classList.add('hidden'));+ if (el) $(el).classList.remove('hidden');+}+function setBusy(b) {+ const go = $('go');+ go.disabled = b;+ go.innerHTML = b ? 'Forging…' : 'Forge<span aria-hidden="true">✦</span>';+}+function startElapsed() {+ const t0 = Date.now();+ stopElapsed();+ elapsedTimer = setInterval(() => { $('elapsed').textContent = `${Math.round((Date.now() - t0) / 1000)}s`; }, 1000);+}+function stopElapsed() { if (elapsedTimer) { clearInterval(elapsedTimer); elapsedTimer = null; } $('elapsed').textContent = ''; }+function isHttps(u) { try { return new URL(u).protocol === 'https:'; } catch { return false; } }++async function forge(prompt) {+ prompt = String(prompt || '').trim();+ if (prompt.length < 3) { input.focus(); return; }+ const seq = ++runSeq;+ setBusy(true);+ mv.classList.add('veiled');+ $('actions').classList.add('hidden');+ $('worktitle').textContent = `Forging "${prompt.length > 52 ? `${prompt.slice(0, 49)}…` : prompt}"`;+ $('workmsg').textContent = 'Sending your prompt to the forge.';+ overlay('working');+ startElapsed();++ try {+ const res = await fetch('/api/forge', {+ method: 'POST',+ headers: { 'content-type': 'application/json', 'x-forge-client': CLIENT_ID },+ body: JSON.stringify({ prompt, backend: 'nvidia' }),+ });+ const data = await res.json().catch(() => ({}));+ if (res.status === 503 || data.error === 'unconfigured') throw new Error('The generator is offline right now. Try again in a few minutes.');+ if (res.status === 429 || data.error === 'rate_limited') {+ const secs = Number(data.retry_after) > 0 ? Math.ceil(Number(data.retry_after)) : 15;+ throw new Error(data.message || `The forge is busy — try again in about ${secs}s.`);+ }+ if (!res.ok) throw new Error(data.message || `The generator returned ${res.status}.`);++ let done = data;+ if (!(data.status === 'done' && data.glb_url)) {+ if (!data.job_id) throw new Error('The forge did not accept the job. Try again.');+ $('workmsg').textContent = 'Queued. Sculpting starts in a moment.';+ done = await pollUntilDone(data.job_id, seq);+ }+ if (!done || seq !== runSeq) return;+ stopElapsed();+ remember(prompt, done.glb_url);+ showResult(done.glb_url, prompt);+ } catch (err) {+ if (seq !== runSeq) return;+ stopElapsed();+ setBusy(false);+ $('failmsg').textContent = (err && err.message) || 'Generation failed.';+ overlay('failed');+ }+}++async function pollUntilDone(jobId, seq) {+ const deadline = Date.now() + MAX_POLL_MS;+ for (;;) {+ if (seq !== runSeq) return null;+ if (Date.now() > deadline) throw new Error('Generation timed out. Try a simpler, single-object prompt.');+ await new Promise((r) => setTimeout(r, POLL_MS));+ if (seq !== runSeq) return null;+ const res = await fetch(`/api/forge?job=${encodeURIComponent(jobId)}`, { headers: { 'x-forge-client': CLIENT_ID } });+ const data = await res.json().catch(() => ({}));+ if (data.status === 'done' && data.glb_url) return data;+ if (data.status === 'failed') throw new Error(data.error || 'Generation failed. Try rephrasing the prompt.');+ if (data.status === 'running') $('workmsg').textContent = 'Sculpting geometry and painting textures. Usually under a minute.';+ }+}++function showResult(glbUrl, prompt, { forged = true } = {}) {+ if (!isHttps(glbUrl)) { $('failmsg').textContent = 'The forge returned an invalid model link.'; overlay('failed'); setBusy(false); return; }+ current = { glb: glbUrl, prompt, forged };+ overlay('working');+ $('worktitle').textContent = 'Loading your creation…';+ $('workmsg').textContent = 'Almost there.';+ mv.setAttribute('alt', prompt ? `3D model: ${prompt}` : 'Your 3D creation');+ mv.setAttribute('src', glbUrl);+}++mv.addEventListener('load', () => {+ if (!current || mv.getAttribute('src') !== current.glb) return;+ overlay(null);+ setBusy(false);+ mv.classList.remove('veiled');+ $('actions').classList.remove('hidden');+ $('meta').textContent = current.prompt || 'Your creation';+ $('meta').title = current.prompt || '';+ $('download').href = current.glb;+ $('download').setAttribute('download', `${fileName(current.prompt)}.glb`);+ $('studio-btn').href = `/ar/studio?src=${encodeURIComponent(current.glb)}&title=${encodeURIComponent((current.prompt || '').slice(0, 80))}`;+ if (mv.canActivateAR) $('ar-btn').textContent = '📱 View in your room';+ else $('ar-btn').textContent = '📱 Open AR on your phone';+ // The creation itself is the qualifying action — light the streak now (but not+ // for a deep-linked model the viewer didn't forge themselves).+ if (current.forged) bumpStreak();+});+mv.addEventListener('error', () => {+ if (!current) return;+ setBusy(false);+ $('failmsg').textContent = 'The model was generated but could not be displayed. You can still download the GLB.';+ overlay('failed');+ $('actions').classList.remove('hidden');+ if (current.forged) bumpStreak(); // a real generation happened even if the preview failed+});++function arLink() {+ if (!current) return `${location.origin}/daily`;+ return `${location.origin}/api/ar?src=${encodeURIComponent(current.glb)}&title=${encodeURIComponent((current.prompt || '').slice(0, 80))}`;+}+function fileName(prompt) {+ const s = (prompt || 'daily-forge').replace(/[^a-z0-9]+/gi, '-').slice(0, 48).replace(/^-|-$/g, '');+ return s || 'daily-forge';+}++$('ar-btn').addEventListener('click', () => {+ if (mv.canActivateAR) { try { mv.activateAR(); return; } catch {} }+ window.open(arLink(), '_blank', 'noopener');+});+$('share').addEventListener('click', () => {+ if (!current) return;+ const url = `${location.origin}/viewer?src=${encodeURIComponent(current.glb)}&title=${encodeURIComponent((current.prompt || '').slice(0, 80))}`;+ const payload = { title: `${theme.title} · Daily Forge`, text: `My take on today's Daily Forge theme: ${current.prompt}`, url };+ if (navigator.share) { navigator.share(payload).catch(() => {}); return; }+ navigator.clipboard?.writeText(url).then(() => {+ const b = $('share'); const old = b.textContent; b.textContent = 'Link copied ✓'; setTimeout(() => { b.textContent = old; }, 1600);+ }).catch(() => window.prompt('Copy this link:', url));+});+$('retry').addEventListener('click', () => { overlay('idle'); if (input.value.trim().length >= 3) forge(input.value); else input.focus(); });++function remember(prompt, glb) {+ try {+ const list = (JSON.parse(localStorage.getItem(RECENT_KEY) || '[]') || []).filter((e) => e && e.glb !== glb);+ list.unshift({ prompt: String(prompt).slice(0, 200), glb, ts: Date.now() });+ localStorage.setItem(RECENT_KEY, JSON.stringify(list.slice(0, 8)));+ } catch {}+}++$('ask').addEventListener('submit', (e) => { e.preventDefault(); forge(input.value); });++// ── Community strip ────────────────────────────────────────────────────────────+(async function loadCommunity() {+ try {+ const res = await fetch('/api/forge-gallery?scope=community&limit=12');+ if (!res.ok) return;+ const data = await res.json();+ const items = (data.creations || [])+ .map((c) => ({ src: c.glb_url || c.glbUrl || '', title: c.prompt || c.title || '', poster: c.preview_image_url || c.previewImageUrl || '' }))+ .filter((c) => c.src && isHttps(c.src))+ .slice(0, 12);+ if (!items.length) return;+ const rail = $('rail');+ rail.innerHTML = items.map((it) => `+ <a href="/viewer?src=${encodeURIComponent(it.src)}&title=${encodeURIComponent(it.title.slice(0, 80))}" title="${esc(it.title)}">+ <span class="thumb">${it.poster ? `<img src="${esc(it.poster)}" alt="" loading="lazy" />` : '<span aria-hidden="true">◆</span>'}</span>+ <span class="cap">${esc(it.title || 'Untitled')}</span>+ </a>`).join('');+ $('rail-wrap').classList.remove('hidden');+ } catch (err) { log.warn('community load failed', err); }+})();++// Deep link: /daily?src=<glb> reopens a shared creation.+(function fromQuery() {+ const q = new URLSearchParams(location.search);+ const src = q.get('src') || '';+ if (src && isHttps(src)) showResult(src, q.get('title') || q.get('prompt') || 'Shared creation', { forged: false });+})();diff --git a/src/daily/creator-streak.js b/src/daily/creator-streak.jsnew file mode 100644index 000000000..c0ef78267--- /dev/null+++ b/src/daily/creator-streak.js@@ -0,0 +1,114 @@+// Creator streak — the anonymous-first "come back tomorrow" mechanic for Daily+// Forge. The logged-in retention system (api/_lib/streaks.js) needs an account;+// the majority of forgers are anonymous, so this covers them with a pure,+// localStorage-backed streak keyed to the browser. No login, no network.+//+// All logic here is a pure state machine over { current, best, lastDay, total }+// and a UTC day key — storage and the clock are injected by the caller, so it+// unit-tests exactly and can never drift on a timezone or a double-count.++/** Days between two UTC 'YYYY-MM-DD' keys (b - a), or null if either is unusable. */+export function daysBetween(a, b) {+ const ta = Date.parse(`${a}T00:00:00Z`);+ const tb = Date.parse(`${b}T00:00:00Z`);+ if (Number.isNaN(ta) || Number.isNaN(tb)) return null;+ return Math.round((tb - ta) / 86_400_000);+}++/** A fresh streak state (never created yet). */+export function emptyStreak() {+ return { current: 0, best: 0, lastDay: '', total: 0 };+}++/**+ * Advance a streak for a qualifying action (a finished forge) on `today`.+ * Idempotent per day: acting five times today only counts once. A one-day gap+ * (yesterday → today) extends the streak; a longer gap resets it to 1.+ *+ * @param {{current:number,best:number,lastDay:string,total:number}} prev+ * @param {string} today UTC 'YYYY-MM-DD'.+ * @returns {{ state: object, changed: boolean, milestone: number|null }}+ * changed: whether today added a new active day; milestone: a streak length+ * just reached that's worth celebrating (3/7/14/30/50/100/365), else null.+ */+export function recordDay(prev, today) {+ const state = { ...emptyStreak(), ...(prev || {}) };+ if (!/^\d{4}-\d{2}-\d{2}$/.test(today)) {+ return { state, changed: false, milestone: null };+ }+ if (state.lastDay === today) {+ // Already counted today — no change, no re-celebration.+ return { state, changed: false, milestone: null };+ }+ const gap = state.lastDay ? daysBetween(state.lastDay, today) : null;+ if (gap === 1) {+ state.current += 1; // consecutive day+ } else if (gap != null && gap <= 0) {+ // Clock skew / a day key "before" lastDay — count the action but don't+ // corrupt the streak (treat as same-period, no increment beyond floor 1).+ state.current = Math.max(state.current, 1);+ } else {+ state.current = 1; // first ever, or a broken streak restarts+ }+ state.lastDay = today;+ state.total += 1;+ state.best = Math.max(state.best, state.current);+ return { state, changed: true, milestone: milestoneFor(state.current) };+}++const MILESTONES = [3, 7, 14, 30, 50, 100, 365];++/** The milestone exactly reached at a given streak length, or null. */+export function milestoneFor(current) {+ return MILESTONES.includes(current) ? current : null;+}++/**+ * The live streak "status" for display, given the last stored state and today.+ * A streak stays "active" through today; if the user hasn't acted today it's+ * "at risk" (act today to keep it) until the day after lastDay, then "broken"+ * (the displayed current resets to 0 for a stale streak).+ *+ * @param {object} state+ * @param {string} today UTC 'YYYY-MM-DD'.+ * @returns {{ current:number, best:number, total:number, actedToday:boolean, atRisk:boolean }}+ */+export function streakStatus(state, today) {+ const s = { ...emptyStreak(), ...(state || {}) };+ if (!s.lastDay) return { current: 0, best: s.best, total: s.total, actedToday: false, atRisk: false };+ const gap = daysBetween(s.lastDay, today);+ if (gap === 0) return { current: s.current, best: s.best, total: s.total, actedToday: true, atRisk: false };+ if (gap === 1) return { current: s.current, best: s.best, total: s.total, actedToday: false, atRisk: true };+ // Two or more days since the last action → the streak has lapsed.+ return { current: 0, best: s.best, total: s.total, actedToday: false, atRisk: false };+}++// ── Storage (browser) ─────────────────────────────────────────────────────────+const KEY = 'twx_daily_streak_v1';++/** Read the stored streak (safe: bad/absent data → empty). */+export function loadStreak(storage = safeStorage()) {+ if (!storage) return emptyStreak();+ try {+ const raw = storage.getItem(KEY);+ if (!raw) return emptyStreak();+ const v = JSON.parse(raw);+ return {+ current: Number(v.current) || 0,+ best: Number(v.best) || 0,+ lastDay: typeof v.lastDay === 'string' ? v.lastDay : '',+ total: Number(v.total) || 0,+ };+ } catch {+ return emptyStreak();+ }+}++export function saveStreak(state, storage = safeStorage()) {+ if (!storage) return;+ try { storage.setItem(KEY, JSON.stringify(state)); } catch { /* private mode */ }+}++function safeStorage() {+ try { return typeof localStorage !== 'undefined' ? localStorage : null; } catch { return null; }+}diff --git a/src/daily/daily-theme.js b/src/daily/daily-theme.jsnew file mode 100644index 000000000..43cfb03f9--- /dev/null+++ b/src/daily/daily-theme.js@@ -0,0 +1,105 @@+// Daily Forge — the deterministic daily creative challenge.+//+// Every UTC day resolves to exactly one theme, the same for everyone, computed+// with no backend and no randomness (so it's testable and every device agrees):+// a stable hash of the YYYY-MM-DD date picks a theme, and a rotation offset keyed+// to the week keeps a theme from repeating on consecutive same-weekday slots.+// A "day number" (days since the launch anchor) gives the challenge a running+// count — "Day 142" — that makes returning feel like a streak worth keeping.+//+// Pure + DOM-free so it unit-tests directly and can run identically on the client+// or in a future cron that pre-renders the day's gallery.++// A curated set of themes the free text→3D lane renders well: single, well-lit+// subjects with a clear material story, no scenes/crowds. Each carries a few+// seed prompts (a tap-to-fill starting point) and an accent for the day's UI.+export const THEMES = Object.freeze([+ { id: 'tiny-robots', emoji: '🤖', title: 'Tiny Robots', hint: 'A small, characterful robot with a clear personality.', accent: '#7cc4ff', seeds: ['a tiny rusty gardening robot holding a watering can', 'a round chrome barista robot with glowing eyes', 'a cardboard-box robot with mismatched arms'] },+ { id: 'glass-creatures', emoji: '🫧', title: 'Glass Creatures', hint: 'An animal or creature blown from coloured glass.', accent: '#8be9d6', seeds: ['a koi fish made of swirling stained glass', 'a translucent glass hummingbird mid-flight', 'a frosted-glass fox curled asleep'] },+ { id: 'cozy-mugs', emoji: '☕', title: 'Cozy Objects', hint: 'A small comforting everyday object, lovingly detailed.', accent: '#f2b880', seeds: ['a chunky handmade ceramic mug with a tiny house painted on it', 'a knitted teapot cozy shaped like a sleeping cat', 'a stack of worn leather-bound books tied with twine'] },+ { id: 'crystal-relics', emoji: '💎', title: 'Crystal Relics', hint: 'A gemstone artifact — faceted, glowing, precious.', accent: '#c9a8ff', seeds: ['a crystal chess knight glowing from within', 'an amethyst geode cracked open with a tiny city inside', 'a floating quartz compass etched with runes'] },+ { id: 'micro-plants', emoji: '🪴', title: 'Micro Gardens', hint: 'A tiny potted plant or terrarium world.', accent: '#8fd694', seeds: ['a bonsai tree growing inside a glowing glass cube', 'a mossy terrarium in a lightbulb with a tiny ladder', 'a succulent in a hand-painted face pot'] },+ { id: 'retro-tech', emoji: '📼', title: 'Retro Tech', hint: 'A nostalgic gadget, faithfully worn and detailed.', accent: '#ff9ec4', seeds: ['a chunky 80s boombox with rainbow buttons', 'a beige retro computer with a smiling face on screen', 'a translucent purple handheld game console'] },+ { id: 'sweet-treats', emoji: '🍰', title: 'Sweet Treats', hint: 'A dessert good enough to screenshot.', accent: '#ffb3c1', seeds: ['a towering strawberry shortcake with dripping glaze', 'a glossy donut with galaxy sprinkles', 'a matcha parfait in a tall glass with mochi'] },+ { id: 'brave-knights', emoji: '🛡️', title: 'Brave Little Knights', hint: 'A pint-sized hero in charming armor.', accent: '#a9b4ff', seeds: ['a tiny knight in acorn-cap armor holding a needle sword', 'a chubby corgi in polished plate armor', 'a mushroom knight with a shield made of bark'] },+ { id: 'deep-sea', emoji: '🐙', title: 'Deep Sea', hint: 'A bioluminescent creature from the dark ocean.', accent: '#6fe3ff', seeds: ['a glowing anglerfish with a lantern of stars', 'a translucent jellyfish trailing neon ribbons', 'a curled-up bioluminescent octopus'] },+ { id: 'space-junk', emoji: '🛰️', title: 'Space Explorers', hint: 'A little astronaut, rover, or friendly craft.', accent: '#b8b3ff', seeds: ['a stubby one-eyed rover with big wheels', 'a tiny astronaut planting a flag made of candy', 'a round friendly satellite with antenna ears'] },+ { id: 'autumn', emoji: '🍂', title: 'Autumn Things', hint: 'Something warm, seasonal, and hand-made.', accent: '#f0a868', seeds: ['a carved pumpkin lantern with a cozy grin', 'a woven basket spilling tiny gourds and leaves', 'a candle shaped like a stack of fallen leaves'] },+ { id: 'music', emoji: '🎸', title: 'Little Instruments', hint: 'A miniature musical instrument, beautifully finished.', accent: '#ffcf70', seeds: ['a tiny lacquered grand piano with glowing keys', 'a hand-painted ukulele with floral inlay', 'a brass trumpet with a snail curled in the bell'] },+ { id: 'mythic', emoji: '🐉', title: 'Mythic Beasts', hint: 'A small friendly mythical creature.', accent: '#c58bff', seeds: ['a chubby baby dragon hoarding a single gold coin', 'a moss-covered forest spirit with lantern eyes', 'a tiny phoenix made of warm ember glass'] },+ { id: 'vehicles', emoji: '🚗', title: 'Tiny Vehicles', hint: 'A toy-like vehicle with character.', accent: '#7ad6c0', seeds: ['a rounded bubble-top bug car in mint green', 'a wooden toy submarine with brass portholes', 'a hot-air balloon shaped like a strawberry'] },+ { id: 'lanterns', emoji: '🏮', title: 'Lights & Lanterns', hint: 'A glowing light source, warm and inviting.', accent: '#ffb15c', seeds: ['a paper lantern shaped like a sleepy moon', 'a firefly jar lamp on a little wooden stand', 'a stained-glass lighthouse the size of a thumb'] },+ { id: 'winter', emoji: '❄️', title: 'Winter Wonders', hint: 'Something frosty, cozy, or crystalline.', accent: '#9fd8ff', seeds: ['a snow globe with a tiny warm cabin inside', 'a hot cocoa mug topped with a marshmallow snowman', 'an ice-crystal deer standing in soft snow'] },+ { id: 'birds', emoji: '🐦', title: 'Bright Birds', hint: 'A colorful little bird, richly textured.', accent: '#7fe0a0', seeds: ['a plump origami paper crane unfolding into color', 'an enamel-pin robin with a tiny scarf', 'a peacock made of hand-cut felt'] },+ { id: 'desserts-2', emoji: '🍄', title: 'Curious Mushrooms', hint: 'A whimsical mushroom, glowing or storybook.', accent: '#f79fb0', seeds: ['a glowing blue mushroom house with round windows', 'a red-cap mushroom with a tiny wooden door', 'a cluster of bioluminescent toadstools on a log'] },+ { id: 'tools', emoji: '🔧', title: 'Handmade Tools', hint: 'A crafted tool or trinket with worn character.', accent: '#e8b478', seeds: ['a brass pocket compass engraved with stars', 'a wooden-handled magnifying glass with a leather cord', 'a tiny anvil with a glowing horseshoe'] },+ { id: 'candy', emoji: '🍬', title: 'Candy World', hint: 'An object made of sweets and sugar glass.', accent: '#ff9ecb', seeds: ['a gingerbread cottage with gumdrop shingles', 'a lollipop tree with swirling rainbow candy', 'a chocolate fountain frozen mid-pour'] },+ { id: 'gems-2', emoji: '🔮', title: 'Fortune & Magic', hint: 'A magical object — orbs, potions, charms.', accent: '#bfa4ff', seeds: ['a glowing crystal ball on a clawed brass stand', 'a bubbling potion bottle with a tiny galaxy inside', 'a spellbook wrapped in glowing chains'] },+ { id: 'garden-2', emoji: '🌸', title: 'Spring Blooms', hint: 'A flower or blossom, delicate and vivid.', accent: '#ffa6c9', seeds: ['a single glass cherry blossom branch', 'a sunflower with a tiny bee wearing goggles', 'a lotus flower opening over still water'] },+ { id: 'ghosts', emoji: '👻', title: 'Friendly Spirits', hint: 'A cute, harmless ghost or spirit.', accent: '#b9c2ff', seeds: ['a round sheet-ghost holding a tiny candle', 'a translucent cat spirit with star eyes', 'a shy lantern-ghost with a soft glow'] },+ { id: 'castles', emoji: '🏰', title: 'Tiny Castles', hint: 'A small storybook building or tower.', accent: '#9fb8ff', seeds: ['a spiral wizard tower on a floating rock', 'a mushroom-topped fairy cottage', 'a sandcastle with real seashell windows'] },+]);++// Anchor the running "Day N" counter to a fixed launch date so the number is+// stable across devices and time zones (UTC midnight boundaries).+const ANCHOR_UTC = Date.UTC(2026, 6, 17); // 2026-07-17, Daily Forge launch+const DAY_MS = 86_400_000;++/** Normalize a Date | ISO string | 'YYYY-MM-DD' to a UTC 'YYYY-MM-DD' key. */+export function utcDayKey(input) {+ let d;+ if (input instanceof Date) d = input;+ else if (typeof input === 'string') {+ // A bare YYYY-MM-DD is parsed as UTC midnight by Date; guard other strings.+ d = new Date(/^\d{4}-\d{2}-\d{2}$/.test(input) ? `${input}T00:00:00Z` : input);+ } else d = new Date(input);+ if (Number.isNaN(d.getTime())) return '';+ return d.toISOString().slice(0, 10);+}++// FNV-1a over the date key — a stable, well-distributed hash with no deps.+function hashKey(key) {+ let h = 0x811c9dc5;+ for (let i = 0; i < key.length; i++) {+ h ^= key.charCodeAt(i);+ h = Math.imul(h, 0x01000193) >>> 0;+ }+ return h >>> 0;+}++/**+ * The running challenge number for a date — days since the launch anchor, 1-based+ * ("Day 1" on launch day). Dates before the anchor clamp to 1.+ * @param {Date|string} input+ * @returns {number}+ */+export function dayNumber(input) {+ const key = utcDayKey(input);+ if (!key) return 1;+ const t = Date.parse(`${key}T00:00:00Z`);+ return Math.max(1, Math.floor((t - ANCHOR_UTC) / DAY_MS) + 1);+}++/**+ * Resolve the theme for a given date. Deterministic: same day → same theme+ * everywhere. A week-indexed rotation offset means the sequence doesn't line up+ * into a fixed 24-day loop, so a given weekday doesn't always draw the same theme.+ * @param {Date|string} [input] Defaults handled by the caller (pass a real date).+ * @returns {{ id, emoji, title, hint, accent, seeds:string[], day:number, dateKey:string }}+ */+export function themeForDate(input) {+ const dateKey = utcDayKey(input) || '1970-01-01';+ const day = dayNumber(dateKey);+ const week = Math.floor((Date.parse(`${dateKey}T00:00:00Z`) - ANCHOR_UTC) / (DAY_MS * 7));+ const idx = (hashKey(dateKey) + (Number.isFinite(week) ? week * 5 : 0)) % THEMES.length;+ const theme = THEMES[((idx % THEMES.length) + THEMES.length) % THEMES.length];+ return { ...theme, day, dateKey };+}++/** Pick one seed prompt for a date deterministically (stable "starter" per day). */+export function seedForDate(input) {+ const t = themeForDate(input);+ const dateKey = t.dateKey;+ const pick = hashKey(`seed:${dateKey}`) % t.seeds.length;+ return t.seeds[pick];+}diff --git a/tests/creator-streak.test.js b/tests/creator-streak.test.jsnew file mode 100644index 000000000..3f9563af8--- /dev/null+++ b/tests/creator-streak.test.js@@ -0,0 +1,127 @@+// Creator streak state machine (src/daily/creator-streak.js).+// The contract: consecutive UTC days extend the streak, a gap resets it, acting+// twice in one day never double-counts, `best` only ever grows, milestones fire+// exactly once at the right lengths, and a stale streak reads as lapsed. Pure —+// clock + storage injected.++import { describe, expect, it } from 'vitest';++import {+ daysBetween, emptyStreak, loadStreak, milestoneFor, recordDay,+ saveStreak, streakStatus,+} from '../src/daily/creator-streak.js';++describe('daysBetween', () => {+ it('counts whole UTC days', () => {+ expect(daysBetween('2026-07-17', '2026-07-18')).toBe(1);+ expect(daysBetween('2026-07-17', '2026-07-17')).toBe(0);+ expect(daysBetween('2026-07-18', '2026-07-17')).toBe(-1);+ expect(daysBetween('2026-07-01', '2026-08-01')).toBe(31);+ });+ it('returns null for bad keys', () => {+ expect(daysBetween('nope', '2026-07-18')).toBe(null);+ });+});++describe('recordDay', () => {+ it('starts a streak at 1 on the first ever action', () => {+ const { state, changed } = recordDay(emptyStreak(), '2026-07-17');+ expect(state).toMatchObject({ current: 1, best: 1, lastDay: '2026-07-17', total: 1 });+ expect(changed).toBe(true);+ });++ it('extends on a consecutive day', () => {+ let s = recordDay(emptyStreak(), '2026-07-17').state;+ s = recordDay(s, '2026-07-18').state;+ s = recordDay(s, '2026-07-19').state;+ expect(s.current).toBe(3);+ expect(s.best).toBe(3);+ expect(s.total).toBe(3);+ });++ it('does not double-count a second action the same day', () => {+ let s = recordDay(emptyStreak(), '2026-07-17').state;+ const again = recordDay(s, '2026-07-17');+ expect(again.changed).toBe(false);+ expect(again.state.current).toBe(1);+ expect(again.state.total).toBe(1);+ expect(again.milestone).toBe(null);+ });++ it('resets to 1 after a gap but keeps best', () => {+ let s = emptyStreak();+ for (const d of ['2026-07-17', '2026-07-18', '2026-07-19']) s = recordDay(s, d).state;+ expect(s.current).toBe(3);+ s = recordDay(s, '2026-07-25').state; // 6-day gap+ expect(s.current).toBe(1);+ expect(s.best).toBe(3); // best survives the break+ expect(s.total).toBe(4);+ });++ it('fires a milestone exactly when a threshold is reached, once', () => {+ let s = emptyStreak();+ const hits = [];+ const days = Array.from({ length: 8 }, (_, i) => `2026-07-${String(17 + i).padStart(2, '0')}`);+ for (const d of days) {+ const r = recordDay(s, d); s = r.state;+ if (r.milestone) hits.push({ day: d, m: r.milestone });+ }+ expect(hits.map((h) => h.m)).toEqual([3, 7]); // day 3 and day 7 of the run+ });++ it('never corrupts on clock skew (a day before lastDay)', () => {+ let s = recordDay(emptyStreak(), '2026-07-18').state;+ const r = recordDay(s, '2026-07-17'); // "yesterday" arrives after "today"+ expect(r.state.current).toBeGreaterThanOrEqual(1);+ expect(Number.isFinite(r.state.current)).toBe(true);+ });++ it('ignores a malformed day key', () => {+ const r = recordDay(emptyStreak(), 'garbage');+ expect(r.changed).toBe(false);+ expect(r.state.current).toBe(0);+ });+});++describe('milestoneFor', () => {+ it('recognizes the celebration lengths only', () => {+ for (const m of [3, 7, 14, 30, 50, 100, 365]) expect(milestoneFor(m)).toBe(m);+ for (const n of [1, 2, 4, 8, 29, 31]) expect(milestoneFor(n)).toBe(null);+ });+});++describe('streakStatus', () => {+ const built = (() => {+ let s = emptyStreak();+ for (const d of ['2026-07-17', '2026-07-18', '2026-07-19']) s = recordDay(s, d).state;+ return s;+ })();++ it('reads active the same day', () => {+ expect(streakStatus(built, '2026-07-19')).toMatchObject({ current: 3, actedToday: true, atRisk: false });+ });+ it('reads at-risk the next day (act to keep it)', () => {+ expect(streakStatus(built, '2026-07-20')).toMatchObject({ current: 3, actedToday: false, atRisk: true });+ });+ it('reads lapsed after two idle days (current shown as 0, best kept)', () => {+ expect(streakStatus(built, '2026-07-22')).toMatchObject({ current: 0, best: 3, atRisk: false });+ });+ it('handles a never-started streak', () => {+ expect(streakStatus(emptyStreak(), '2026-07-19')).toMatchObject({ current: 0, atRisk: false });+ });+});++describe('storage round-trip', () => {+ function memStorage() {+ const map = new Map();+ return { getItem: (k) => (map.has(k) ? map.get(k) : null), setItem: (k, v) => map.set(k, v) };+ }+ it('persists and reloads a streak; bad data degrades to empty', () => {+ const store = memStorage();+ const s = recordDay(emptyStreak(), '2026-07-17').state;+ saveStreak(s, store);+ expect(loadStreak(store)).toEqual(s);+ store.setItem('twx_daily_streak_v1', '{bad json');+ expect(loadStreak(store)).toEqual(emptyStreak());+ });+});diff --git a/tests/daily-theme.test.js b/tests/daily-theme.test.jsnew file mode 100644index 000000000..9f41e402b--- /dev/null+++ b/tests/daily-theme.test.js@@ -0,0 +1,80 @@+// Daily Forge theme rotation + day counter (src/daily/daily-theme.js).+// The contract: every UTC day resolves to exactly one theme, the same for every+// device, deterministically; the day counter is stable and monotonic; and the+// rotation actually varies (it doesn't collapse to one theme or a fixed weekday+// loop). Pure — no clock, no DOM.++import { describe, expect, it } from 'vitest';++import {+ dayNumber, seedForDate, THEMES, themeForDate, utcDayKey,+} from '../src/daily/daily-theme.js';++describe('utcDayKey', () => {+ it('normalizes Date, ISO, and bare date strings to a UTC day', () => {+ expect(utcDayKey('2026-07-17')).toBe('2026-07-17');+ expect(utcDayKey(new Date('2026-07-17T23:30:00Z'))).toBe('2026-07-17');+ expect(utcDayKey('2026-07-17T05:00:00Z')).toBe('2026-07-17');+ });+ it('returns "" for unparseable input', () => {+ expect(utcDayKey('not a date')).toBe('');+ expect(utcDayKey(NaN)).toBe('');+ });+});++describe('themeForDate', () => {+ it('is deterministic — the same day always gives the same theme', () => {+ const a = themeForDate('2026-08-01');+ const b = themeForDate('2026-08-01');+ expect(a.id).toBe(b.id);+ expect(a).toMatchObject({ day: expect.any(Number), dateKey: '2026-08-01' });+ });++ it('always returns a real, complete theme from the set', () => {+ const ids = new Set(THEMES.map((t) => t.id));+ for (let i = 0; i < 120; i++) {+ const key = utcDayKey(new Date(Date.UTC(2026, 6, 17) + i * 86400000));+ const t = themeForDate(key);+ expect(ids.has(t.id)).toBe(true);+ expect(t.seeds.length).toBeGreaterThan(0);+ expect(t.title).toBeTruthy();+ expect(t.emoji).toBeTruthy();+ }+ });++ it('actually rotates — a month of days hits many distinct themes', () => {+ const seen = new Set();+ for (let i = 0; i < 30; i++) {+ const key = utcDayKey(new Date(Date.UTC(2026, 6, 17) + i * 86400000));+ seen.add(themeForDate(key).id);+ }+ expect(seen.size).toBeGreaterThanOrEqual(10);+ });++ it('does not always repeat the same theme on the same weekday', () => {+ // Same weekday, 7 days apart, several weeks — should not be a single theme.+ const mondays = [0, 7, 14, 21, 28, 35].map((d) =>+ themeForDate(utcDayKey(new Date(Date.UTC(2026, 6, 20) + d * 86400000))).id);+ expect(new Set(mondays).size).toBeGreaterThan(1);+ });+});++describe('dayNumber', () => {+ it('is 1 on launch day and increments by one per UTC day', () => {+ expect(dayNumber('2026-07-17')).toBe(1);+ expect(dayNumber('2026-07-18')).toBe(2);+ expect(dayNumber('2026-08-16')).toBe(31);+ });+ it('clamps dates before launch to 1', () => {+ expect(dayNumber('2020-01-01')).toBe(1);+ });+});++describe('seedForDate', () => {+ it('returns a deterministic seed drawn from that day’s theme', () => {+ const t = themeForDate('2026-09-09');+ const seed = seedForDate('2026-09-09');+ expect(t.seeds).toContain(seed);+ expect(seedForDate('2026-09-09')).toBe(seed); // stable+ });+});diff --git a/vercel.json b/vercel.jsonindex d61afe3f8..0733c30af 100644--- a/vercel.json+++ b/vercel.json@@ -1370,6 +1370,13 @@},"dest": "/ar-studio.html"},+ {+ "src": "/daily/?",+ "headers": {+ "permissions-policy": "xr-spatial-tracking=*, camera=(self)"+ },+ "dest": "/daily.html"+ },{"src": "/ar/?","headers": {diff --git a/vite.config.js b/vite.config.jsindex 0b82a463a..15974ade4 100644--- a/vite.config.js+++ b/vite.config.js@@ -543,6 +543,7 @@ const appConfig = {xr: resolve(__dirname, 'pages/xr.html'),temporary: resolve(__dirname, 'pages/temporary.html'),irl: resolve(__dirname, 'pages/irl.html'),+ daily: resolve(__dirname, 'pages/daily.html'),'ar-studio': resolve(__dirname, 'pages/ar-studio.html'),'irl-privacy': resolve(__dirname, 'pages/irl-privacy.html'),'world-lines': resolve(__dirname, 'pages/world-lines.html'),@@ -1158,6 +1159,8 @@ support: resolve(__dirname, 'pages/support.html'),'/irl/': resolve(root, 'pages/irl.html'),'/ar/studio': resolve(root, 'pages/ar-studio.html'),'/ar/studio/': resolve(root, 'pages/ar-studio.html'),+ '/daily': resolve(root, 'pages/daily.html'),+ '/daily/': resolve(root, 'pages/daily.html'),'/irl-privacy': resolve(root, 'pages/irl-privacy.html'),'/irl-privacy/': resolve(root, 'pages/irl-privacy.html'),'/world-lines': resolve(root, 'pages/world-lines.html'),