Skip to content

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

chore: sync workspace changes — vision/scene updates, model-trellis worker, changelog refresh

nirholasbcbd895ca4c9
diff --git a/.gitignore b/.gitignore
index a1a4a9767..bfa944f55 100644
--- a/.gitignore
+++ b/.gitignore
@@ -215,3 +215,4 @@ scripts/genesis-results.json
# local test wallet (never commit)
.wallet-test.json
+docs/three-ws-feature-article.md
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ae15892ea..122f485f2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -25,6 +25,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Light theme is here — flip the whole site with one tap** — three.ws now ships a light theme alongside the signature dark one. A new sun/moon toggle sits in the top nav on every page: tap it to switch instantly, and your choice sticks across pages, sessions, and other open tabs. New here, or set to 'Auto' in Settings → Appearance? The site follows your device's light/dark preference automatically. The theme is applied before the page paints, so there's no white flash on load, and the dashboard appearance picker (Dark / Light / Auto) now applies live instead of just saving for later. Dark remains the brand default — nothing changes unless you want it to. `[feature, improvement]`
- **Live $THREE market data, longer trade streams, and tutor session fixes** — $THREE market stats (price, holders, liquidity) are flowing again from our primary data source — a missing request header had been silently failing it to backups for days. Live trade streams no longer cut out after 30 seconds; they now run their full duration. The Pay-As-You-Learn Tutor no longer errors when resuming a session — running tabs persist correctly across questions — and Fact Checker results are cached properly so repeat checks of the same claim return instantly. `[fix, improvement]`
- **MetaMask Agent Wallet skills for every agent** — Two new skills in the marketplace under the new Wallet category: MetaMask Agent Wallet and MetaMask Agent Workflows. Install them on any agent to let it check balances, transfer tokens, swap, bridge across chains, trade perps and prediction markets, and manage Aave positions through MetaMask's mm CLI — each user signs in with their own MetaMask Agent Wallet, so keys stay with you, never with three.ws. Platform chat agents pick the skills up automatically. (`/skills`) `[feature]`
+- **More paid 3D generations per hour before you hit the limit** — The paid text-to-3D and image-to-3D lane in Forge had an hourly ceiling of 12 generations per person — tight enough that a focused iteration session, or a few people sharing the same office or campus network, could run into a 'generation limit reached, try again shortly' wall mid-flow. That ceiling is now 30 per hour. You can push through far more revisions in one sitting, while the limit still protects against runaway GPU spend. The free Draft lane keeps its own, even more generous allowance. (`/forge`) `[improvement]`
- **Pick a username on your account page — even if you signed in with a wallet** — You can now set and change your username right from the account page. If you signed up with a wallet, you previously had no way to claim a handle — your profile just showed a shortened wallet address. Now there's a '+ Set a username' button under your name; tap it, type a handle (3–30 characters, letters, numbers, _ or -), and save. Usernames are checked for availability as you save, so you'll get a clear message if one's already taken. Wallet sign-ins also no longer display the internal placeholder email on your profile. (`/dashboard/account`) `[feature, improvement]`
- **Pluggable memory backends + a portable snapshot format for the agent SDK** — Agent developers can now plug a custom memory backend — a vector database, an episodic event log, or their own API — behind a named mode with Memory.registerBackend, no forking required. All built-in modes (local, remote, ipfs, encrypted-ipfs, none) are unchanged. We also formalized a memory/0.1 snapshot contract: memory.snapshot() returns a JSON-safe object and Memory.fromSnapshot() rehydrates it, so embedded agent widgets keep their memory across page reloads. Documented in the Memory spec, agent manifest, and README. `[sdk, docs]`
- **Public status page with live uptime monitoring** — three.ws now monitors its own critical surfaces — the website, platform API, explore feed, x402 paid-API discovery, and the 3D viewer — every 5 minutes from outside our infrastructure, and publishes the results at three.ws/status: live operational state, response times, and a 90-day uptime history per service. A machine-readable JSON feed is available at /api/status for agents and integrators. Browser errors on any page are now also collected first-party, so problems reach the team before reports do. (`/status`) `[feature, infra]`
diff --git a/agent-ui-sdk/src/index.js b/agent-ui-sdk/src/index.js
index 3b1526701..82d8ac0b1 100644
--- a/agent-ui-sdk/src/index.js
+++ b/agent-ui-sdk/src/index.js
@@ -155,11 +155,12 @@ export async function createAgentUI(userOptions = {}) {
if (clips.idle) agent.animator.play('idle', { loop: true });
// Render loop
- const clock = new THREE.Clock();
+ const clock = new THREE.Timer();
(function tick() {
if (agent._destroyed) return;
agent._raf = requestAnimationFrame(tick);
try {
+ clock.update();
const dt = Math.min(clock.getDelta(), 0.05);
agent.animator.update(dt);
rendererCtx.updateParallax();
diff --git a/character-studio/src/library/EmotionManager.js b/character-studio/src/library/EmotionManager.js
index ca5afb334..9fe7ce57d 100644
--- a/character-studio/src/library/EmotionManager.js
+++ b/character-studio/src/library/EmotionManager.js
@@ -1,5 +1,5 @@
import { VRMExpressionPresetName } from "@pixiv/three-vrm";
-import { Clock } from "three";
+import { Timer } from "three";
/**
* @typedef {import('@pixiv/three-vrm').VRMExpressionPresetName} VRMExpressionPresetName
@@ -17,7 +17,7 @@ export class EmotionManager {
*/
mode
/**
- * @type {Clock}
+ * @type {Timer}
*/
clock
continuous = false;
@@ -66,7 +66,7 @@ export class EmotionManager {
this.vrmEmotion = [];
this.mode = 'ready';
- this.clock = new Clock();
+ this.clock = new Timer();
this.isTakingScreenShot = false;
@@ -193,6 +193,7 @@ export class EmotionManager {
if (this.isTakingScreenShot) {
return;
}
+ this.clock.update()
const deltaTime = this.clock.getDelta()
switch (this.mode){
diff --git a/character-studio/src/library/blinkManager.js b/character-studio/src/library/blinkManager.js
index e23dd6618..edfa746f0 100644
--- a/character-studio/src/library/blinkManager.js
+++ b/character-studio/src/library/blinkManager.js
@@ -1,5 +1,5 @@
import { VRMExpressionPresetName } from "@pixiv/three-vrm";
-import { Clock } from "three";
+import { Timer } from "three";
const SCREENSHOT_EYES_OPEN_THRESHOLD = 2;
@@ -8,7 +8,7 @@ export class BlinkManager {
this.vrmBlinkers = [];
this.mode = 'ready';
- this.clock = new Clock();
+ this.clock = new Timer();
this.closeTime = closeTime
this.openTime = openTime
@@ -50,6 +50,7 @@ export class BlinkManager {
if (this.isTakingScreenShot) {
return;
}
+ this.clock.update()
const deltaTime = this.clock.getDelta()
switch (this.mode){
diff --git a/character-studio/src/library/sceneInitializer.js b/character-studio/src/library/sceneInitializer.js
index acbd8363f..27b1b0229 100644
--- a/character-studio/src/library/sceneInitializer.js
+++ b/character-studio/src/library/sceneInitializer.js
@@ -71,7 +71,7 @@ export function sceneInitializer(canvasId) {
renderer.setPixelRatio(window.devicePixelRatio);
renderer.outputColorSpace = THREE.SRGBColorSpace;
- const clock = new THREE.Clock();
+ const clock = new THREE.Timer();
const handleMouseClick = (event) => {
const isCtrlPressed = event.ctrlKey;
@@ -100,6 +100,7 @@ export function sceneInitializer(canvasId) {
const animateLoop = () => {
if (!animating) return;
requestAnimationFrame(animateLoop);
+ clock.update();
const delta = clock.getDelta();
controls.target.clamp(minPan, maxPan);
controls?.update();
diff --git a/character-studio/tests/helpers/mockThree.js b/character-studio/tests/helpers/mockThree.js
index 2c54db410..9ebace565 100644
--- a/character-studio/tests/helpers/mockThree.js
+++ b/character-studio/tests/helpers/mockThree.js
@@ -150,6 +150,30 @@ export const mockThree = {
getElapsedTime() {
return this.running ? (Date.now() - this.startTime) / 1000 : 0
}
+ },
+
+ Timer: class MockTimer {
+ constructor() {
+ this._delta = 0.016 // 60fps
+ this._elapsed = 0
+ }
+
+ update() {
+ this._elapsed += this._delta
+ return this
+ }
+
+ getDelta() {
+ return this._delta
+ }
+
+ getElapsed() {
+ return this._elapsed
+ }
+
+ reset() {
+ return this
+ }
}
}
diff --git a/data/changelog.json b/data/changelog.json
index ed0af3ebd..4aeeaa203 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-06-11",
+ "title": "More paid 3D generations per hour before you hit the limit",
+ "summary": "The paid text-to-3D and image-to-3D lane in Forge had an hourly ceiling of 12 generations per person — tight enough that a focused iteration session, or a few people sharing the same office or campus network, could run into a 'generation limit reached, try again shortly' wall mid-flow. That ceiling is now 30 per hour. You can push through far more revisions in one sitting, while the limit still protects against runaway GPU spend. The free Draft lane keeps its own, even more generous allowance.",
+ "tags": [
+ "improvement"
+ ],
+ "link": "/forge"
+ },
{
"date": "2026-06-11",
"title": "Forge checks your photo before spending a generation — plus image-aware fact-checks and accessible galleries",
diff --git a/docs/agent-briefs/W-world-online/PORT-CHECKLIST.md b/docs/agent-briefs/W-world-online/PORT-CHECKLIST.md
new file mode 100644
index 000000000..0d1a2774b
--- /dev/null
+++ b/docs/agent-briefs/W-world-online/PORT-CHECKLIST.md
@@ -0,0 +1,162 @@
+# Port Checklist — bring `/walk` + `world.three.ws` systems into `/play`
+
+> Companion to [W00-program-overview.md](W00-program-overview.md). This is the concrete,
+> dependency-ordered work list for closing the gap between `/play` (the isometric Coin
+> Communities plaza) and the two richer surfaces we already run: `/walk` (in-repo three.js +
+> Rapier + Colyseus) and `world.three.ws` (hosted Hyperfy).
+>
+> **Reuse-first is mandatory.** Almost everything below already exists in the repo and is
+> wired into `/walk` only — or is built but orphaned. The job is to *lift and wire*, not
+> reinvent. Do not switch engines. Do not build a second world client.
+
+---
+
+## Ground truth (verified in-repo, 2026-06-11)
+
+- `/play` = [src/game/coincommunities.js](../../../src/game/coincommunities.js) (2289 LOC).
+ Renders a **flat `PlaneGeometry` plaza**, `WORLD_RADIUS = 58`
+ ([coincommunities.js:59](../../../src/game/coincommunities.js#L59)), a **single fixed
+ `PerspectiveCamera`** ([:413](../../../src/game/coincommunities.js#L413)), and **zero
+ physics** (`grep` for `rapier|PhysicsWorld` → 0 hits).
+- `/walk` = [src/walk.js](../../../src/walk.js) (3696 LOC). Has Rapier physics, heightfield
+ terrain, a 4-mode camera system, friends/presence, and AR.
+- **Both `/play` and `/walk` already join the SAME authoritative room** — `walk_world`
+ (`WalkRoom`). `/play` via [community-net.js](../../../src/game/community-net.js), `/walk`
+ via [walk-net.js](../../../src/walk-net.js). **Multiplayer is NOT a gap** — the netcode is
+ shared. Every item below is a **client-side render/physics/UX** port.
+- The server already carries vehicle constants (`VEHICLE_WORLD_RADIUS_M`, max-step, max-speed)
+ in [WalkRoom.js](../../../multiplayer/src/rooms/WalkRoom.js) — driving is partly server-ready.
+
+### Already-in-repo assets to lift (do not rewrite)
+
+| System | File | Status today |
+|---|---|---|
+| Rapier wrapper + kinematic character controller | [src/physics/physics-world.js](../../../src/physics/physics-world.js) | wired into `/walk` only |
+| Heightfield terrain (shared mesh + collider source) | [src/game/terrain.js](../../../src/game/terrain.js) | wired into `/walk` only |
+| 4-mode camera (follow/cinematic/firstperson/topdown) | [src/walk.js:466-520](../../../src/walk.js#L466-L520) | inline in `/walk` — needs extraction |
+| Friends / presence panel | [src/game/friends-panel.js](../../../src/game/friends-panel.js) | wired into `/walk` + `friends.js` |
+| Client vehicle manager (Rapier raycast vehicle) | [src/game/vehicles.js](../../../src/game/vehicles.js) | **orphaned — zero importers** |
+| Day/night cycle | [src/game/day-night.js](../../../src/game/day-night.js) | **orphaned — zero importers** |
+| Activities/minigame loop | [src/game/play-activities.js](../../../src/game/play-activities.js) | **orphaned — zero importers** |
+| Generic world persistence (Postgres index + R2 blob) | [api/world/[action].js](../../../api/world/[action].js), `api/_lib/world-store.js` | live API, **`/play` doesn't use it** |
+
+---
+
+## Phase 1 — Physical world foundation (unblocks the most; do first)
+
+Maps to **W01**. Goal: `/play` stops being a flat clamped disc and becomes a real 3D space
+with gravity, collision, terrain, and a free camera. Pure lift from `/walk`.
+
+- [ ] **P1.1 — Mount `PhysicsWorld` in `coincommunities.js`.** Import
+ [src/physics/physics-world.js](../../../src/physics/physics-world.js), `await initRapier()`
+ during boot (between scene build and first frame), step it in the render loop, and drive the
+ local avatar from the kinematic capsule controller instead of the current server-clamp move.
+ Keep the existing `CommunityNet` send/recv — only the *local* integration changes.
+- [ ] **P1.2 — Replace the flat plaza with `terrain.js`.** Swap the `PlaneGeometry` ground
+ ([coincommunities.js:415](../../../src/game/coincommunities.js#L415) area) for
+ `createTerrain(...)`. Seed the heightfield **deterministically from the coin mint** (terrain
+ already uses a seeded LCG) so every client in a `?coin=` world generates identical ground —
+ required for shared physics. Feed the same height grid to the Rapier heightfield collider.
+- [ ] **P1.3 — Raise/replace the 58 m clamp.** `WORLD_RADIUS = 58` exists because there was no
+ collision. With terrain + physics, expand the playable area and let colliders (boundary
+ walls, water edges) bound the player instead of a hard disc clamp. Coordinate with
+ `WalkRoom`'s server bounds so client and server agree on the new extent.
+- [ ] **P1.4 — Extract the camera-mode system into a shared module.** Pull
+ [src/walk.js:466-560](../../../src/walk.js#L466-L520) (the `CAMERA_MODES`,
+ `setCameraMode`, `cycleCameraMode`, `computeCameraForMode` block) into
+ `src/game/camera-modes.js`, then import it in **both** `walk.js` and `coincommunities.js`.
+ `/play` gets follow/cinematic/firstperson/topdown for free; `/walk` loses its inline copy.
+- [ ] **P1.5 — Wire the orphaned day/night cycle.** Import
+ [src/game/day-night.js](../../../src/game/day-night.js) `createDayNightCycle(env, district)`
+ into `/play` and advance it in the loop. It's built and unused — this is nearly free polish.
+
+**Phase 1 done when:** an avatar in `/play` walks over uneven terrain, is stopped by real
+colliders (not a disc clamp), can switch all four camera modes, the world has a day/night sky,
+and two browsers in the same `?coin=` world see identical ground and consistent positions.
+
+---
+
+## Phase 2 — Vehicles & driving
+
+Maps to **W02**. Depends on Phase 1 (needs the Rapier world + terrain colliders).
+
+- [ ] **P2.1 — Wire the orphaned client `VehicleManager`.** Import
+ [src/game/vehicles.js](../../../src/game/vehicles.js) into `/play`, spawn at least one drivable
+ vehicle, and hook enter/exit to proximity (`VEHICLE_ENTER_RANGE_M` already exists server-side).
+- [ ] **P2.2 — Network vehicle state through `WalkRoom`.** The server already has
+ `VEHICLE_WORLD_RADIUS_M` / `vehicleMaxStepM` / `vehicleMaxSpeedMps`. Confirm the room's
+ vehicle schema is sent to `/play` clients via `CommunityNet` and that remote vehicles render
+ via [src/game/vehicle-mesh.js](../../../src/game/vehicle-mesh.js).
+- [ ] **P2.3 — Driving camera + HUD.** Reuse the camera-modes module (P1.4) for a chase cam;
+ add a speed/throttle readout to the existing `WorldHudSystem`
+ ([src/game/hud/](../../../src/game/hud/)).
+
+**Phase 2 done when:** a player walks up to a car, presses to enter, drives it across terrain
+with collision, a second browser sees the car move smoothly, and exit returns to on-foot.
+
+---
+
+## Phase 3 — Persistent, buildable world (the Hyperfy parity items)
+
+Maps to **W01 persistence + Hyperfy's build/upload/persistence model**. These are the things
+`world.three.ws` has that neither `/play` nor `/walk` fully has yet.
+
+- [ ] **P3.1 — Persist the coin-world build through the existing world store.** `/play` already
+ has limited prop building (`WorldObjects`/`PropGhost`, capped to 12 m). Route saves/loads
+ through the live [api/world/[action].js](../../../api/world/[action].js) +
+ `api/_lib/world-store.js` (Postgres index + R2 blob, optimistic-concurrency etags), keyed by
+ coin mint as `worldId`. This is the Hyperfy "save every 30s" pattern, already half-built here.
+- [ ] **P3.2 — Lift the build-radius cap.** With persistence + permissions
+ (`world-store.canWriteWorld`), expand beyond the 12 m `clearMaxRadius`
+ ([coincommunities.js:298](../../../src/game/coincommunities.js#L298)) so holders can build a
+ real place, governed by the per-world permission model rather than a hard cap.
+- [ ] **P3.3 — Player asset uploads (GLB).** Hyperfy lets players upload GLB/VRM. We already
+ have [src/game/avatar-upload.js](../../../src/game/avatar-upload.js) and an R2 pipeline —
+ extend it to world props, size-limited like Hyperfy's `PUBLIC_MAX_UPLOAD_SIZE`. Validate and
+ sanitize server-side before serving.
+- [ ] **P3.4 — (stretch) VRM avatar support.** Hyperfy is VRM-native; we're GLB-native. Evaluate
+ adding a VRM loader path alongside GLB in the avatar pipeline. Lower priority — only if a
+ clear holder demand exists. Do **not** block Phases 1–2 on it.
+
+**Phase 3 done when:** a holder builds in their coin world, reloads the page, and the build is
+still there; a second visitor sees the same persisted build; permissions stop non-owners from
+overwriting it.
+
+---
+
+## Phase 4 — Living-world & social parity
+
+Maps to **W08/W09**. `/play` already has NPCs (`WorldLife`), voice, cosmetics — these add the
+`/walk` social surface and the orphaned activities loop.
+
+- [ ] **P4.1 — Wire the orphaned activities/minigame loop.** Import
+ [src/game/play-activities.js](../../../src/game/play-activities.js) `PlayActivities` into
+ `/play` and surface it through the HUD.
+- [ ] **P4.2 — Port the friends/presence panel.** Bring
+ [src/game/friends-panel.js](../../../src/game/friends-panel.js) (already used by `/walk` and
+ `friends.js`) into `/play` so players see and join friends across coin worlds.
+- [ ] **P4.3 — Minimap.** `/walk` and Hyperfy both orient the player in a larger space; with the
+ expanded world from Phase 1, add a minimap to `WorldHudSystem`.
+
+---
+
+## Cross-cutting rules (from CLAUDE.md — apply to every item)
+
+- **No mocks, no stubs, no TODOs, no fake loading.** Real Rapier, real terrain, real
+ `walk_world` netcode, real R2/Postgres persistence.
+- **$THREE is the only coin.** Worlds are keyed by arbitrary user-supplied mints at runtime
+ (the generic plumbing exception) — never hardcode or surface any non-`$THREE` mint.
+- **Every state designed:** loading skeleton, empty world, physics-init failure, asset-upload
+ rejection, save conflict (409 etag) — all handled and actionable.
+- **Definition of done per item:** `npm run dev`, exercise in a real browser at 320/768/1440,
+ zero console errors, Network tab shows real `walk_world` + `api/world` traffic, `npm test`
+ green, `git diff` self-reviewed.
+- **Changelog:** each phase that ships a user-visible change gets a `data/changelog.json` entry
+ (tags: `feature`/`improvement`), per CLAUDE.md.
+
+## Suggested order
+
+`P1.1 → P1.2 → P1.3 → P1.4 → P1.5` (foundation) → `P2.x` (vehicles) → `P3.1 → P3.2 → P3.3`
+(persistence/build) → `P4.x` (social). P1 unblocks everything; the three orphaned modules
+(`vehicles.js`, `day-night.js`, `play-activities.js`) are the cheapest early wins because they
+already exist and just need importing.
diff --git a/public/artifact.js b/public/artifact.js
index 920bf038f..4963343fb 100644
--- a/public/artifact.js
+++ b/public/artifact.js
@@ -131,11 +131,12 @@ function loadAvatar(glbUrl, scene, onError) {
}
function startLoop(renderer, scene, camera, avatar) {
- const clock = new THREE.Clock();
+ const clock = new THREE.Timer();
let t = 0;
function tick() {
requestAnimationFrame(tick);
+ clock.update();
const dt = clock.getDelta();
t += dt;
diff --git a/public/changelog.json b/public/changelog.json
index 9c2a0740e..d63a42aaf 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-11T14:33:36.325Z",
+ "generated_at": "2026-06-11T14:36:47.902Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -208,6 +208,16 @@
"feature"
]
},
+ {
+ "date": "2026-06-11",
+ "type": "update",
+ "title": "More paid 3D generations per hour before you hit the limit",
+ "summary": "The paid text-to-3D and image-to-3D lane in Forge had an hourly ceiling of 12 generations per person — tight enough that a focused iteration session, or a few people sharing the same office or campus network, could run into a 'generation limit reached, try again shortly' wall mid-flow. That ceiling is now 30 per hour. You can push through far more revisions in one sitting, while the limit still protects against runaway GPU spend. The free Draft lane keeps its own, even more generous allowance.",
+ "link": "/forge",
+ "tags": [
+ "improvement"
+ ]
+ },
{
"date": "2026-06-11",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index 87b567e62..51ad08b2e 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -158,6 +158,14 @@
<category>feature</category>
<description>Two new skills in the marketplace under the new Wallet category: MetaMask Agent Wallet and MetaMask Agent Workflows. Install them on any agent to let it check balances, transfer tokens, swap, bridge across chains, trade perps and prediction markets, and manage Aave positions through MetaMask's mm CLI — each user signs in with their own MetaMask Agent Wallet, so keys stay with you, never with three.ws. Platform chat agents pick the skills up automatically.</description>
</item>
+ <item>
+ <title>More paid 3D generations per hour before you hit the limit</title>
+ <link>https://three.ws/forge</link>
+ <guid isPermaLink="false">2026-06-11:More paid 3D generations per hour before you hit the limit</guid>
+ <pubDate>Thu, 11 Jun 2026 12:00:00 GMT</pubDate>
+ <category>improvement</category>
+ <description>The paid text-to-3D and image-to-3D lane in Forge had an hourly ceiling of 12 generations per person — tight enough that a focused iteration session, or a few people sharing the same office or campus network, could run into a 'generation limit reached, try again shortly' wall mid-flow. That ceiling is now 30 per hour. You can push through far more revisions in one sitting, while the limit still protects against runaway GPU spend. The free Draft lane keeps its own, even more generous allowance.</description>
+ </item>
<item>
<title>Pick a username on your account page — even if you signed in with a wallet</title>
<link>https://three.ws/dashboard/account</link>
diff --git a/public/demos/agents/_lib.js b/public/demos/agents/_lib.js
index a34ce92f7..7fc56bdbd 100644
--- a/public/demos/agents/_lib.js
+++ b/public/demos/agents/_lib.js
@@ -82,7 +82,7 @@ export async function loadClips(mixer, clipMap) {
}
export function startLoop(renderer, scene, camera, mixer, onTick, rootBone, baseRootPos) {
- const clock = new THREE.Clock();
+ const clock = new THREE.Timer();
const _orig = renderer.render.bind(renderer);
if (rootBone && baseRootPos) {
renderer.render = (sc, cam) => {
@@ -93,6 +93,7 @@ export function startLoop(renderer, scene, camera, mixer, onTick, rootBone, base
(function tick() {
requestAnimationFrame(tick);
try {
+ clock.update();
const dt = Math.min(clock.getDelta(), 0.05);
mixer?.update(dt);
onTick?.(dt);
diff --git a/public/features.json b/public/features.json
index 841f9316f..73572e175 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-06-11T14:33:36.303Z",
+ "generated_at": "2026-06-11T14:36:47.892Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/public/theme-switcher.js b/public/theme-switcher.js
index a1f732d91..d90ade911 100644
--- a/public/theme-switcher.js
+++ b/public/theme-switcher.js
@@ -8,11 +8,21 @@
// values : 'dark' | 'light' | 'auto' ('auto' follows the OS)
// unset : treated as 'dark' (the platform's brand default)
//
-// An inline boot script (injected by scripts/inject-theme-boot.mjs) applies the
-// resolved theme to <html data-theme> before first paint, so this module never
-// causes a flash — it re-applies idempotently, wires the nav toggle, keeps the
-// button in sync, follows the system in 'auto' mode, and mirrors changes across
-// tabs. Everything is exposed on window.threeTheme for other surfaces (e.g. the
+// Capability gating — the platform is dark-first and many bespoke pages still
+// hardcode their own dark backgrounds instead of consuming the design tokens.
+// Forcing light on those would float a light header over a black body. So this
+// module probes, with NO visible flash, whether the current page actually
+// honours the light palette (its <body> goes light when data-theme='light').
+// If it does not, the page is pinned dark and the toggle is hidden — light is
+// simply "not available here yet". The probe is synchronous (it reads computed
+// style without yielding a paint), so it costs nothing visually. The instant a
+// page migrates its colours to tokens, the probe passes and light turns on
+// there automatically — no list to maintain.
+//
+// An inline boot script (scripts/inject-theme-boot.mjs) applies the stored
+// theme to <html data-theme> before first paint; this module then gates,
+// wires the nav toggle, syncs across tabs, and follows the OS in 'auto' mode.
+// Everything is exposed on window.threeTheme for other surfaces (e.g. the
// dashboard settings panel) to drive the same single source of truth.
(function () {
@@ -22,6 +32,7 @@
var STORAGE_KEY = 'twx_theme';
var prefersLight =
window.matchMedia && window.matchMedia('(prefers-color-scheme: light)');
+ var islandCache = null; // memoised capability result for this page
function getMode() {
try {
@@ -40,17 +51,40 @@
return m === 'light' ? 'light' : 'dark';
}
- function applyEffective(effective) {
- document.documentElement.setAttribute('data-theme', effective);
- syncToggle(effective);
- window.dispatchEvent(
- new CustomEvent('themechange', { detail: { mode: getMode(), effective: effective } }),
- );
+ // Is <body> dark right now? (Opaque + low luminance.) A transparent body
+ // (shows the html canvas, which is token-driven) counts as light-capable.
+ function bodyIsDark() {
+ if (!document.body) return false;
+ var bg = getComputedStyle(document.body).backgroundColor;
+ var m = bg.match(/(\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?/);
+ if (!m) return false;
+ var alpha = m[4] === undefined ? 1 : parseFloat(m[4]);
+ if (alpha < 0.5) return false;
+ var lum = 0.299 * +m[1] + 0.587 * +m[2] + 0.114 * +m[3];
+ return lum < 140;
+ }
+
+ // Does this page honour the light palette? Probe synchronously: flip the
+ // attribute to 'light', read the body (forces a style recalc, NOT a paint),
+ // then restore — all in one JS turn, so nothing flashes on screen.
+ function pageSupportsLight() {
+ if (islandCache !== null) return !islandCache;
+ if (!document.body) return true; // can't tell yet — assume capable
+ var el = document.documentElement;
+ var prev = el.getAttribute('data-theme');
+ el.setAttribute('data-theme', 'light');
+ var dark = bodyIsDark();
+ el.setAttribute('data-theme', prev || 'dark');
+ islandCache = dark; // true ⇒ island (light not supported)
+ return !dark;
+ }
+
+ function setToggleVisible(on) {
+ var btn = document.getElementById('nav-theme-toggle');
+ if (btn) btn.hidden = !on;
}
// Reflect the live theme onto the nav toggle button (label + pressed state).
- // Safe to call before the nav is injected — it just no-ops until the button
- // exists, and the MutationObserver below replays it once it appears.
function syncToggle(effective) {
var btn = document.getElementById('nav-theme-toggle');
if (!btn) return;
@@ -59,6 +93,21 @@
btn.setAttribute('aria-label', isLight ? 'Switch to dark theme' : 'Switch to light theme');
}
+ // Apply the resolved theme, honouring page capability. Islands are pinned
+ // dark with the toggle hidden; capable pages flip and show the toggle.
+ function applyResolved() {
+ var capable = pageSupportsLight();
+ var effective = capable ? resolve() : 'dark';
+ document.documentElement.setAttribute('data-theme', effective);
+ setToggleVisible(capable);
+ syncToggle(effective);
+ window.dispatchEvent(
+ new CustomEvent('themechange', {
+ detail: { mode: getMode(), effective: effective, capable: capable },
+ }),
+ );
+ }
+
// Persist + apply a mode. 'dark'/'light' are explicit; 'auto' follows the OS.
function setMode(mode) {
var next = mode === 'light' || mode === 'auto' ? mode : 'dark';
@@ -67,16 +116,16 @@
} catch (e) {
/* persistence unavailable — still apply for this session */
}
- applyEffective(resolve(next));
+ applyResolved();
return next;
}
// The nav button is a simple binary flip between the two visible themes,
// writing an explicit choice (never 'auto'); the tri-state lives in settings.
+ // It is only reachable on capable pages (hidden elsewhere).
function toggle() {
var nextEffective = resolve() === 'light' ? 'dark' : 'light';
- setMode(nextEffective);
- return nextEffective;
+ return setMode(nextEffective);
}
window.threeTheme = {
@@ -85,11 +134,12 @@
resolve: resolve,
set: setMode,
toggle: toggle,
+ supportsLight: pageSupportsLight,
};
- // Apply immediately so direct module loads (or a missing boot script) still
- // land on the right theme without waiting for the nav.
- applyEffective(resolve());
+ // Apply immediately (gates this page right away, correcting the boot script's
+ // pre-paint guess on islands before the page is interactive).
+ applyResolved();
// Delegated click — independent of when the async-injected nav button mounts.
document.addEventListener('click', function (e) {
@@ -103,7 +153,7 @@
// When the OS scheme changes, follow it only if the user is in 'auto'.
if (prefersLight) {
var onScheme = function () {
- if (getMode() === 'auto') applyEffective(resolve());
+ if (getMode() === 'auto') applyResolved();
};
if (prefersLight.addEventListener) prefersLight.addEventListener('change', onScheme);
else if (prefersLight.addListener) prefersLight.addListener(onScheme);
@@ -111,19 +161,20 @@
// Mirror changes made in other tabs/windows.
window.addEventListener('storage', function (e) {
- if (e.key === STORAGE_KEY) applyEffective(resolve());
+ if (e.key === STORAGE_KEY) applyResolved();
});
// The nav header is injected asynchronously by nav.js; once the toggle
- // button appears, replay the current state onto it, then stop observing.
- if (document.getElementById('nav-theme-toggle')) {
- syncToggle(resolve());
- } else if (window.MutationObserver) {
+ // button appears, set its visibility + state, then stop observing.
+ function bindToggle() {
+ if (!document.getElementById('nav-theme-toggle')) return false;
+ setToggleVisible(pageSupportsLight());
+ syncToggle(document.documentElement.getAttribute('data-theme') || 'dark');
+ return true;
+ }
+ if (!bindToggle() && window.MutationObserver) {
var obs = new MutationObserver(function () {
- if (document.getElementById('nav-theme-toggle')) {
- syncToggle(resolve());
- obs.disconnect();
- }
+ if (bindToggle()) obs.disconnect();
});
obs.observe(document.documentElement, { childList: true, subtree: true });
}
diff --git a/scripts/.smoke-t15-photo-burst.mjs b/scripts/.smoke-t15-photo-burst.mjs
index 0b6d79850..eaf09fb25 100644
--- a/scripts/.smoke-t15-photo-burst.mjs
+++ b/scripts/.smoke-t15-photo-burst.mjs
@@ -5,10 +5,18 @@
const BASE = (process.argv[2] || 'https://three.ws').replace(/\/$/, '');
const PHOTO = `${BASE}/accessories/thumbs/hat-cowboy.png`;
const MAX_ATTEMPTS = Number(process.argv[3] || 150);
+const START_AT = process.argv[4] ? Date.parse(process.argv[4]) : 0; // ISO time to begin bursting
+const INTERVAL_MS = Number(process.argv[5] || 2500);
const now = () => Date.now();
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
async function submitBurst(body, label) {
+ if (START_AT && now() < START_AT) {
+ const waitMs = START_AT - now();
+ console.log(`[${label}] holding ${Math.round(waitMs / 1000)}s until boundary ${new Date(START_AT).toISOString()}`);
+ await sleep(waitMs);
+ console.log(`[${label}] boundary reached, bursting every ${INTERVAL_MS}ms`);
+ }
let lastRA = null;
for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
const t0 = now();
@@ -17,7 +25,7 @@ async function submitBurst(body, label) {
let json; try { json = JSON.parse(text); } catch { throw new Error(`${label}: non-JSON ${res.status}: ${text.slice(0, 300)}`); }
if (res.status === 429) {
if (json.retry_after !== lastRA) { console.log(`[${label}] 429 ra=${json.retry_after}s (attempt ${attempt}) @ ${new Date().toISOString()}`); lastRA = json.retry_after; }
- await sleep(2500); continue;
+ await sleep(INTERVAL_MS); continue;
}
if (!res.ok) throw new Error(`${label}: submit ${res.status} — ${JSON.stringify(json)}`);
console.log(`[${label}] GOT THROUGH attempt ${attempt} in ${now() - t0}ms → status=${json.status} backend=${json.backend} tier=${json.tier} path=${json.path} eta=${json.eta_seconds}s`);
diff --git a/scripts/artifact-viewer/src.js b/scripts/artifact-viewer/src.js
index 83aee525a..63e751294 100644
--- a/scripts/artifact-viewer/src.js
+++ b/scripts/artifact-viewer/src.js
@@ -192,11 +192,12 @@ async function start() {
renderNamePlate(host, cfg, palette);
- const clock = new THREE.Clock();
+ const clock = new THREE.Timer();
let t = 0;
const baseScale = root.scale.clone();
function tick() {
requestAnimationFrame(tick);
+ clock.update();
const dt = clock.getDelta();
t += dt;
if (mixer) mixer.update(dt);
diff --git a/scripts/run-migrations.mjs b/scripts/run-migrations.mjs
index 05cd4a6ef..5490d6380 100644
--- a/scripts/run-migrations.mjs
+++ b/scripts/run-migrations.mjs
@@ -101,6 +101,18 @@ async function main() {
console.log(`Found ${pending.length} pending migration(s):\n`);
+ if (DRY_RUN || CHECK) {
+ for (const file of pending) console.log(` • ${file}`);
+ console.log(
+ DRY_RUN
+ ? `\nDry run — no migrations applied. Re-run without --dry-run to apply.`
+ : `\n${pending.length} migration(s) pending.`,
+ );
+ // --check signals "DB is behind" with a non-zero exit so CI can gate on it.
+ if (CHECK) process.exit(1);
+ return;
+ }
+
for (const file of pending) {
const path = join(MIGRATIONS_DIR, file);
const sqlText = await readFile(path, 'utf8');
diff --git a/src/agent-trade.js b/src/agent-trade.js
index ffdba7d19..fc5daed38 100644
--- a/src/agent-trade.js
+++ b/src/agent-trade.js
@@ -537,12 +537,13 @@ window.addEventListener('resize', () => {
});
// ── Animation loop ─────────────────────────────────────────────────────────────
-const clock = new THREE.Clock();
+const clock = new THREE.Timer();
(function animate() {
requestAnimationFrame(animate);
+ clock.update();
const dt = Math.min(clock.getDelta(), 0.1);
- const t = clock.elapsedTime;
+ const t = clock.getElapsed();
// Idle avatar breath
if (buyerMesh) buyerMesh.position.y = Math.sin(t * 0.75) * 0.022;
diff --git a/src/avatar-drop.js b/src/avatar-drop.js
index 55ff582df..ecad3b1b4 100644
--- a/src/avatar-drop.js
+++ b/src/avatar-drop.js
@@ -7,7 +7,7 @@ import {
Vector3,
AmbientLight,
DirectionalLight,
- Clock,
+ Timer,
AnimationMixer,
AnimationClip,
LoopRepeat,
@@ -408,7 +408,7 @@ export function initAvatarDrop(sectionEl) {
.catch(e => log.warn('[avatar-drop] boot failed', e));
// Render loop — paused when the section is offscreen or the tab is hidden.
- const clock = new Clock();
+ const clock = new Timer();
let running = false;
let onScreen = true;
@@ -416,6 +416,7 @@ export function initAvatarDrop(sectionEl) {
if (!running) return;
requestAnimationFrame(tick);
try {
+ clock.update();
const dt = Math.min(clock.getDelta(), 0.05);
mixer?.update(dt);
updateSeq(dt);
@@ -428,7 +429,7 @@ export function initAvatarDrop(sectionEl) {
const next = onScreen && document.visibilityState !== 'hidden';
if (next === running) return;
running = next;
- if (running) { clock.getDelta(); tick(); }
+ if (running) { clock.update(); tick(); }
}
const visObs = new IntersectionObserver(entries => {
diff --git a/src/city/city-world.js b/src/city/city-world.js
index 55069300c..f384ef7c8 100644
--- a/src/city/city-world.js
+++ b/src/city/city-world.js
@@ -124,10 +124,11 @@ async function main() {
hudEl.style.display = '';
// ── Game loop ─────────────────────────────────────────────────────────────
- const clock = new THREE.Clock();
+ const clock = new THREE.Timer();
(function tick() {
requestAnimationFrame(tick);
+ clock.update();
const dt = Math.min(clock.getDelta(), 0.05);
player.update(dt, buildingBoxes, cityCamera.yaw);
diff --git a/src/club.js b/src/club.js
index 57a135ddb..ee7b88631 100644
--- a/src/club.js
+++ b/src/club.js
@@ -12,7 +12,7 @@ import {
Box3,
BufferAttribute,
BufferGeometry,
- Clock,
+ Timer,
Color,
EquirectangularReflectionMapping,
Fog,
@@ -1419,11 +1419,12 @@ const watchdog = createFrameWatchdog({
});
// ── Render loop ──────────────────────────────────────────────────────────
-const clock = new Clock();
+const clock = new Timer();
let rafId = null;
function animate() {
+ clock.update();
const dt = Math.min(clock.getDelta(), 0.066);
- const t = clock.getElapsedTime();
+ const t = clock.getElapsed();
watchdog.tick(dt);
@@ -1604,7 +1605,7 @@ document.addEventListener('visibilitychange', () => {
startLeaderboardPolling();
// Discard the gap delta so the watchdog doesn't see one huge frame
// (which would immediately count as "slow") on resume.
- clock.getDelta();
+ clock.update();
if (rafId == null) animate();
}
});
diff --git a/src/dashboard-next/pages/account.js b/src/dashboard-next/pages/account.js
index 03882cb3c..8db7e02fe 100644
--- a/src/dashboard-next/pages/account.js
+++ b/src/dashboard-next/pages/account.js
@@ -325,6 +325,8 @@ function renderProviderKeys(host, keyStatus) {
function renderProfile(host, me) {
const initials = initialsOf(me);
const handle = me.username || me.handle || (me.email ? me.email.split('@')[0] : '');
+ // Wallet sign-ups get a synthetic `…@wallet.local` address — never surface it as a real email.
+ const realEmail = me.email && !/@wallet\.local$/i.test(me.email) ? me.email : '';
const verified = me.email_verified
? `<span class="dn-tag success" style="margin-left:8px">verified</span>`
: `<span class="dn-tag warn" style="margin-left:8px">unverified</span>`;
@@ -349,8 +351,14 @@ function renderProfile(host, me) {
<svg width="14" height="14" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3l3 3-9 9H5v-3l9-9z"/></svg>
</button>
</div>
- <div style="color:var(--nxt-ink-dim);font-size:13px">
- ${handle ? `@${esc(handle)}` : ''}${handle && me.email ? ' · ' : ''}${me.email ? esc(me.email) : ''}${me.email ? verified : ''}
+ <div style="color:var(--nxt-ink-dim);font-size:13px;display:flex;align-items:center;gap:6px;flex-wrap:wrap" data-slot="username-row">
+ ${me.username
+ ? `<span>@${esc(me.username)}</span>
+ <button class="dn-btn ghost" data-action="edit-username" title="Edit username" style="padding:2px 5px;color:var(--nxt-ink-fade)" aria-label="Edit username">
+ <svg width="12" height="12" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3l3 3-9 9H5v-3l9-9z"/></svg>
+ </button>`
+ : `<button class="dn-btn ghost" data-action="edit-username" style="padding:2px 8px;font-size:12.5px;color:var(--nxt-accent)">+ Set a username</button>`}
+ ${realEmail ? `<span style="color:var(--nxt-ink-fade)">·</span><span>${esc(realEmail)}</span>${verified}` : ''}
</div>
<div style="color:var(--nxt-ink-fade);font-size:12.5px;margin-top:6px">
Member since ${esc(memberSince)} · Plan: <a href="/dashboard/monetize" style="color:var(--nxt-accent)">${esc(planName)}</a>
@@ -364,6 +372,9 @@ function renderProfile(host, me) {
host.querySelector('[data-action="edit-name"]').addEventListener('click', () => {
startEditName(host, me);
});
+ host.querySelector('[data-action="edit-username"]').addEventListener('click', () => {
+ startEditUsername(host, me);
+ });
host.querySelector('[data-action="signout"]').addEventListener('click', async (e) => {
const btn = e.currentTarget;
btn.disabled = true;
@@ -420,6 +431,64 @@ function startEditName(host, me) {
});
}
+// Mirrors the server-side `username` validator in api/_lib/validate.js.
+const USERNAME_RE = /^[a-zA-Z0-9_-]{3,30}$/;
+
+function startEditUsername(host, me) {
+ const row = host.querySelector('[data-slot="username-row"]');
+ const current = me.username || '';
+ row.innerHTML = `
+ <span style="color:var(--nxt-ink-fade)">@</span>
+ <input type="text" value="${esc(current)}" maxlength="30" placeholder="username"
+ autocapitalize="off" autocomplete="off" autocorrect="off" spellcheck="false" style="
+ background:rgba(255,255,255,0.04);
+ border:1px solid var(--nxt-stroke-strong);
+ border-radius:6px;padding:5px 9px;color:var(--nxt-ink);
+ font-size:13px;min-width:160px;max-width:260px;
+ " />
+ <button class="dn-btn primary" data-action="save-username" style="padding:5px 11px">Save</button>
+ <button class="dn-btn ghost" data-action="cancel-username" style="padding:5px 9px">Cancel</button>
+ <span data-slot="username-err" style="color:#e5484d;font-size:12px;flex-basis:100%"></span>
+ `;
+ const input = row.querySelector('input');
+ const errEl = row.querySelector('[data-slot="username-err"]');
+ input.focus();
+ input.select();
+
+ const cancel = () => renderProfile(host, me);
+ const save = async () => {
+ const next = input.value.trim();
+ if (next === current) return cancel();
+ if (!USERNAME_RE.test(next)) {
+ errEl.textContent = '3–30 characters — letters, numbers, _ or - only.';
+ return;
+ }
+ const saveBtn = row.querySelector('[data-action="save-username"]');
+ saveBtn.disabled = true;
+ saveBtn.textContent = 'Saving…';
+ errEl.textContent = '';
+ try {
+ const r = await patch('/api/auth/profile', { username: next });
+ const updated = r?.user || { ...me, username: next };
+ renderProfile(host, { ...me, ...updated, username: updated.username ?? next });
+ toast('Username saved');
+ } catch (err) {
+ errEl.textContent = err?.status === 409
+ ? 'That username is already taken.'
+ : (err?.message ? `Save failed: ${err.message}` : 'Save failed.');
+ saveBtn.disabled = false;
+ saveBtn.textContent = 'Save';
+ }
+ };
+
+ row.querySelector('[data-action="save-username"]').addEventListener('click', save);
+ row.querySelector('[data-action="cancel-username"]').addEventListener('click', cancel);
+ input.addEventListener('keydown', (e) => {
+ if (e.key === 'Enter') save();
+ else if (e.key === 'Escape') cancel();
+ });
+}
+
// ── Wallets ───────────────────────────────────────────────────────────────
async function loadWallets(host) {
diff --git a/src/dashboard-next/pages/avatars.js b/src/dashboard-next/pages/avatars.js
index 148ae4e5b..e89dd3c2b 100644
--- a/src/dashboard-next/pages/avatars.js
+++ b/src/dashboard-next/pages/avatars.js
@@ -9,6 +9,7 @@ import { mountShell } from '../shell.js';
import { requireUser, get, patch, del, esc, relTime, ApiError } from '../api.js';
import { openSelfieModal } from '../../selfie-modal.js';
import { openAvatarPicker } from '../../avatar-gallery-picker.js';
+import { createFromTemplate } from '../../shared/template-picker.js';
const PAGE_SIZE = 24;
const VISIBILITIES = ['public', 'unlisted', 'private'];
@@ -41,8 +42,14 @@ const state = {
<div class="dn-av-new-wrap">
<button class="dn-btn primary" type="button" data-new>+ New avatar</button>
<div class="dn-av-new-pop" data-new-pop hidden role="menu">
+ <div class="dn-av-new-grp">Build</div>
+ <button type="button" role="menuitem" data-new-template>Start from a template</button>
+ <a href="/create/studio" role="menuitem">Build from scratch</a>
+ <div class="dn-av-new-grp">From you</div>
<button type="button" role="menuitem" data-new-selfie-quick>Snap a selfie</button>
<a href="/create/selfie" role="menuitem">Full selfie flow</a>
+ <a href="/create/prompt" role="menuitem">Describe it · prompt → 3D</a>
+ <div class="dn-av-new-grp">Import</div>
<a href="/create" role="menuitem">Upload a GLB</a>
<a href="/marketplace" role="menuitem">From an existing avatar</a>
<button type="button" role="menuitem" data-browse-gallery>Browse public gallery</button>
@@ -171,6 +178,16 @@ function wireNewMenu(root) {
if (e.key === 'Escape' && !pop.hidden) close();
});
+ const template = pop.querySelector('[data-new-template]');
+ if (template) {
+ template.addEventListener('click', () => {
+ close();
+ // Opens the curated template picker; on selection it stages the GLB
+ // locally and forwards to /create-review (the shared save step).
+ createFromTemplate();
+ });
+ }
+
const quickSelfie = pop.querySelector('[data-new-selfie-quick]');
if (quickSelfie) {
quickSelfie.addEventListener('click', async () => {
@@ -189,7 +206,7 @@ function wireNewMenu(root) {
if (browseGallery) {
browseGallery.addEventListener('click', async () => {
close();
- const picked = await openAvatarPicker({
+ await openAvatarPicker({
source: 'public',
title: 'Browse public avatars',
showModes: true,
@@ -653,12 +670,14 @@ function emptyBlock() {
wrap.style.gridColumn = '1 / -1';
wrap.innerHTML = `
<h3>No avatars yet.</h3>
- <p>Build your first 3D agent — drop a selfie or upload a GLB.</p>
+ <p>Build your first 3D agent — start from a ready-made template, sculpt one from scratch, or drop a selfie.</p>
<div style="display:flex;gap:8px;flex-wrap:wrap;justify-content:center">
- <a class="dn-btn primary" href="/create/selfie">Create from selfie</a>
- <a class="dn-btn" href="/create">Upload a GLB</a>
+ <button type="button" class="dn-btn primary" data-empty-template>Start from a template</button>
+ <a class="dn-btn" href="/create/studio">Build from scratch</a>
+ <a class="dn-btn" href="/create/selfie">Create from selfie</a>
</div>
`;
+ wrap.querySelector('[data-empty-template]')?.addEventListener('click', () => createFromTemplate());
return wrap;
}
@@ -757,6 +776,16 @@ function injectStyles() {
}
.dn-av-new-pop a:hover,
.dn-av-new-pop button:hover { background: rgba(255,255,255,0.06); }
+ .dn-av-new-grp {
+ padding: 7px 12px 3px;
+ font-size: 10.5px;
+ font-weight: 600;
+ letter-spacing: 0.06em;
+ text-transform: uppercase;
+ color: var(--nxt-ink-fade);
+ pointer-events: none;
+ }
+ .dn-av-new-grp:first-child { padding-top: 3px; }
.dn-av-filters {
display: flex;
diff --git a/src/footer-bot.js b/src/footer-bot.js
index c1e3debab..4ba658f3b 100644
--- a/src/footer-bot.js
+++ b/src/footer-bot.js
@@ -7,7 +7,7 @@ import {
MathUtils,
AmbientLight,
DirectionalLight,
- Clock,
+ Timer,
AnimationMixer,
} from 'three';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
@@ -62,7 +62,7 @@ import { reserveWebGLContext } from './webgl-budget.js';
scene.add(fill);
let mixer = null;
- const clock = new Clock();
+ const clock = new Timer();
let robot = null;
// A transient CDN/network blip on the primary asset must never leave an empty
@@ -106,6 +106,7 @@ import { reserveWebGLContext } from './webgl-budget.js';
function animate() {
if (!running) return;
requestAnimationFrame(animate);
+ clock.update();
const dt = clock.getDelta();
if (mixer) mixer.update(dt);
if (robot) robot.rotation.y += rotSpeed * dt;
@@ -117,7 +118,7 @@ import { reserveWebGLContext } from './webgl-budget.js';
if (next === running) return;
running = next;
if (running) {
- clock.getDelta();
+ clock.update();
animate();
}
}
diff --git a/src/galaxy.js b/src/galaxy.js
index 62400b979..fec884c46 100644
--- a/src/galaxy.js
+++ b/src/galaxy.js
@@ -458,7 +458,7 @@ function setupThree() {
raycaster = new THREE.Raycaster();
raycaster.params.Points.threshold = 4.2;
- clock = new THREE.Clock();
+ clock = new THREE.Timer();
const ro = new ResizeObserver(resize);
ro.observe(els.gxStage);
@@ -519,8 +519,9 @@ function resize() {
}
function tick() {
+ clock.update();
const dt = clock.getDelta();
- const t = clock.getElapsedTime();
+ const t = clock.getElapsed();
if (mat) mat.uniforms.uTime.value = t;
if (fly.active) {
diff --git a/src/home-act2-viewer.js b/src/home-act2-viewer.js
index 21a490007..33485f038 100644
--- a/src/home-act2-viewer.js
+++ b/src/home-act2-viewer.js
@@ -18,7 +18,7 @@ import {
AnimationClip,
Box3,
Vector3,
- Clock,
+ Timer,
HemisphereLight,
DirectionalLight,
ACESFilmicToneMapping,
@@ -71,7 +71,7 @@ export class Act2Viewer {
this._manifestPromise = null;
this._loader = new GLTFLoader();
- this._clock = new Clock();
+ this._clock = new Timer();
this._modelYaw = 0;
this._modelFocusY = 1.0;
this._focusX = 0;
@@ -103,6 +103,7 @@ export class Act2Viewer {
_tick() {
if (this._disposed) return;
+ this._clock.update();
const dt = this._clock.getDelta();
if (this.mixer) this.mixer.update(dt);
if (this.model && !this._externalOrbit) {
diff --git a/src/ibm-galaxy.js b/src/ibm-galaxy.js
index d6552fe30..5ae1d2931 100644
--- a/src/ibm-galaxy.js
+++ b/src/ibm-galaxy.js
@@ -55,7 +55,7 @@ let rafPending = false; // coalesce hover raycasts to one per frame
const _pointerClient = { x: 0, y: 0 }; // latest cursor position for tooltip placement
const fly = { active: false, camFrom: new THREE.Vector3(), camTo: new THREE.Vector3(), tgtFrom: new THREE.Vector3(), tgtTo: new THREE.Vector3(), t: 0, dur: 1 };
let idleTimer = 0;
-const clock = new THREE.Clock();
+const clock = new THREE.Timer();
const EXAMPLES = [
'a witty crypto trading assistant',
'helpful customer support agent',
@@ -191,8 +191,9 @@ function buildPoints() {
// ── Animation loop ────────────────────────────────────────────────────────────
function animate() {
+ clock.update();
const dt = clock.getDelta();
- const t = clock.elapsedTime;
+ const t = clock.getElapsed();
if (material) material.uniforms.uTime.value = t;
if (starfield) starfield.rotation.y += dt * 0.006;
diff --git a/src/ibm-trust-layer.js b/src/ibm-trust-layer.js
index a15c0cd44..1c5873f88 100644
--- a/src/ibm-trust-layer.js
+++ b/src/ibm-trust-layer.js
@@ -192,7 +192,7 @@ function initScene() {
starfield = new THREE.Points(starGeo, new THREE.PointsMaterial({ color: 0x4a5677, size: 0.06, transparent: true, opacity: 0.7 }));
scene.add(starfield);
- clock = new THREE.Clock();
+ clock = new THREE.Timer();
window.addEventListener('resize', onResize);
sceneOk = true;
return true;
@@ -209,8 +209,9 @@ const _v = new THREE.Vector3();
function animate() {
requestAnimationFrame(animate);
if (!sceneOk) return;
+ clock.update();
const dt = clock.getDelta();
- const t = clock.elapsedTime;
+ const t = clock.getElapsed();
controls.update();
core.rotation.y += dt * 0.25;
core.rotation.x += dt * 0.08;
diff --git a/src/voice/talk-scene.js b/src/voice/talk-scene.js
index 275b21fec..acd9979be 100644
--- a/src/voice/talk-scene.js
+++ b/src/voice/talk-scene.js
@@ -16,7 +16,7 @@
*/
import {
- Clock,
+ Timer,
WebGLRenderer,
SRGBColorSpace,
ACESFilmicToneMapping,
@@ -47,7 +47,7 @@ export class TalkScene {
this.mixer = null;
this._clips = [];
this._currentAction = null;
- this._clock = new Clock();
+ this._clock = new Timer();
this._rafId = 0;
this._running = false;
this._resizeObserver = null;
@@ -326,6 +326,7 @@ export class TalkScene {
this._running = true;
const tick = () => {
if (!this._running) return;
+ this._clock.update();
const dt = this._clock.getDelta();
this.controls?.update();
this.mixer?.update(dt);
diff --git a/src/walk-companion.js b/src/walk-companion.js
index 1f43d90b7..9e2453193 100644
--- a/src/walk-companion.js
+++ b/src/walk-companion.js
@@ -23,7 +23,7 @@ import {
AmbientLight,
AnimationMixer,
Box3,
- Clock,
+ Timer,
DirectionalLight,
Group,
HemisphereLight,
@@ -323,7 +323,7 @@ class WalkCompanion {
this._restoreState();
this._bindEvents();
this._greetForRoute();
- this.clock = new Clock();
+ this.clock = new Timer();
this._raf = requestAnimationFrame(this._tick);
}
@@ -560,7 +560,7 @@ class WalkCompanion {
cancelAnimationFrame(this._raf);
this._raf = 0;
} else if (this.mounted && !this._raf) {
- this.clock?.getDelta(); // discard the idle gap so dt stays bounded
+ this.clock?.update(); // discard the idle gap so dt stays bounded
this._raf = requestAnimationFrame(this._tick);
}
}
@@ -632,6 +632,7 @@ class WalkCompanion {
// ── Render loop ───────────────────────────────────────────────────────────
_tick() {
if (!this.mounted) return;
+ this.clock.update();
const dt = Math.min(this.clock.getDelta(), 0.05);
// Decide motion: walking while the cursor is in motion and off to one
diff --git a/src/walk-embed-preview.js b/src/walk-embed-preview.js
index 293147c86..2959879ca 100644
--- a/src/walk-embed-preview.js
+++ b/src/walk-embed-preview.js
@@ -5,7 +5,7 @@
import {
AmbientLight,
CircleGeometry,
- Clock,
+ Timer,
Color,
DirectionalLight,
Group,
@@ -317,7 +317,7 @@ export function initWalkPreview(container) {
ro.observe(container);
// ── Tick ─────────────────────────────────────────────────────────
- const clock = new Clock();
+ const clock = new Timer();
const moveWorld = new Vector3();
const moveForward = new Vector3();
const moveRight = new Vector3();
@@ -328,6 +328,7 @@ export function initWalkPreview(container) {
if (!running) return;
requestAnimationFrame(tick);
+ clock.update();
const dt = Math.min(clock.getDelta(), 0.05);
// Jump
@@ -449,8 +450,7 @@ export function initWalkPreview(container) {
const next = onScreen && document.visibilityState !== 'hidden';
if (next === running) return;
running = next;
- if (running) { clock.start(); tick(); }
- else clock.stop();
+ if (running) { clock.reset(); tick(); }
}
const observer = new IntersectionObserver((entries) => {
diff --git a/src/walk-embed.js b/src/walk-embed.js
index 6dd674244..06d18f0cc 100644
--- a/src/walk-embed.js
+++ b/src/walk-embed.js
@@ -16,7 +16,7 @@ import {
AmbientLight,
Box3,
CircleGeometry,
- Clock,
+ Timer,
Color,
DirectionalLight,
Fog,
@@ -405,7 +405,7 @@ window.addEventListener('resize', resize);
window.addEventListener('orientationchange', resize);
// ── Main loop ─────────────────────────────────────────────────────────────
-const clock = new Clock();
+const clock = new Timer();
const moveWorld = new Vector3();
const moveForward = new Vector3();
const moveRight = new Vector3();
@@ -436,6 +436,7 @@ let lastBroadcastZ = 0;
const BROADCAST_EPSILON = 0.02; // metres — skip duplicate post messages
function tick() {
+ clock.update();
const dt = Math.min(clock.getDelta(), 0.05);
const { ix, iy } = readMoveInput(dt);
diff --git a/src/walk.js b/src/walk.js
index 9bfb9ccaf..51d6ea42d 100644
--- a/src/walk.js
+++ b/src/walk.js
@@ -14,7 +14,7 @@ import {
Box3,
CanvasTexture,
CircleGeometry,
- Clock,
+ Timer,
Color,
ConeGeometry,
CylinderGeometry,
@@ -1565,7 +1565,7 @@ window.addEventListener('resize', resize);
window.addEventListener('orientationchange', resize);
// ── Main loop ─────────────────────────────────────────────────────────────
-const clock = new Clock();
+const clock = new Timer();
const moveWorld = new Vector3();
const moveForward = new Vector3();
const moveRight = new Vector3();
@@ -1626,6 +1626,7 @@ function readMoveInput() {
}
function tick() {
+ clock.update();
const dt = Math.min(clock.getDelta(), 0.05); // clamp huge frames after a tab switch
// Right-stick look — rotate the follow-camera while the stick is held.
diff --git a/workers/model-trellis/Dockerfile b/workers/model-trellis/Dockerfile
index dbeb79e4f..aa95f82d1 100644
--- a/workers/model-trellis/Dockerfile
+++ b/workers/model-trellis/Dockerfile
@@ -1,23 +1,71 @@
-FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
+# TRELLIS (Microsoft, MIT) — single-image → textured 3D mesh on an L4 (24 GB).
+#
+# This image translates the upstream conda `setup.sh` into a reproducible pip
+# build. Reliability choices that matter for Cloud Build + Cloud Run L4:
+# • CUDA 12.1 *devel* base — nvcc is required to compile diffoctreerast /
+# nvdiffrast / diff-gaussian-rasterization from source. The runtime image
+# keeps them; we don't strip nvcc because cold imports JIT a little.
+# • torch 2.4.0 + cu121, the matrix every TRELLIS extension has wheels/【builds】for.
+# • Attention backend = xformers, NOT flash-attn. flash-attn compiles from
+# source for 30+ min and routinely OOMs the builder; xformers is an upstream-
+# supported backend and an L4 (sm_89) runs it well. Set via ATTN_BACKEND.
+# • TORCH_CUDA_ARCH_LIST=8.9 — build CUDA kernels only for the L4 (Ada). This
+# cuts compile time massively vs. building every arch.
+FROM nvidia/cuda:12.1.1-cudnn8-devel-ubuntu22.04
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
- DEBIAN_FRONTEND=noninteractive
+ DEBIAN_FRONTEND=noninteractive \
+ # Build kernels only for the L4 (Ada, sm_89) — keeps source compiles fast.
+ TORCH_CUDA_ARCH_LIST="8.9" \
+ # TRELLIS runtime backends (read at import time in main.py).
+ ATTN_BACKEND=xformers \
+ SPCONV_ALGO=native \
+ # TRELLIS repo lives here and is imported off PYTHONPATH (not a pip package).
+ PYTHONPATH=/app/TRELLIS
RUN apt-get update && apt-get install -y --no-install-recommends \
python3.10 python3.10-dev python3-pip \
- git curl wget \
- libgl1 libglib2.0-0 \
+ git curl wget build-essential ninja-build \
+ libgl1 libglib2.0-0 libgomp1 \
&& rm -rf /var/lib/apt/lists/* \
&& ln -sf /usr/bin/python3.10 /usr/bin/python3 \
&& ln -sf /usr/bin/python3.10 /usr/bin/python \
&& pip install --upgrade pip setuptools wheel
-RUN pip install torch==2.3.1 --index-url https://download.pytorch.org/whl/cu121
+# ── 1. Torch first (own layer; every extension below links against it) ────────
+RUN pip install torch==2.4.0 torchvision==0.19.0 --index-url https://download.pytorch.org/whl/cu121
-COPY requirements.txt /app/requirements.txt
-RUN pip install -r /app/requirements.txt
+# ── 2. setup.sh --basic + utils3d ─────────────────────────────────────────────
+RUN pip install \
+ pillow imageio imageio-ffmpeg tqdm easydict opencv-python-headless \
+ scipy ninja rembg onnxruntime trimesh open3d xatlas pyvista pymeshfix \
+ igraph transformers \
+ && pip install git+https://github.com/EasternJournalist/utils3d.git@9a4eb15e4021b67b12c460c7057d642626897ec8
+
+# ── 3. setup.sh --xformers / --spconv / --kaolin (prebuilt wheels) ────────────
+RUN pip install xformers==0.0.27.post2 --index-url https://download.pytorch.org/whl/cu121
+RUN pip install spconv-cu120
+RUN pip install kaolin -f https://nvidia-kaolin.s3.us-east-2.amazonaws.com/torch-2.4.0_cu121.html
+
+# ── 4. setup.sh --nvdiffrast / --diffoctreerast / --mipgaussian (compiled) ────
+# These build CUDA kernels with nvcc; TORCH_CUDA_ARCH_LIST=8.9 scopes them to L4.
+RUN git clone https://github.com/NVlabs/nvdiffrast.git /tmp/ext/nvdiffrast \
+ && pip install /tmp/ext/nvdiffrast
+RUN git clone --recurse-submodules https://github.com/JeffreyXiang/diffoctreerast.git /tmp/ext/diffoctreerast \
+ && pip install /tmp/ext/diffoctreerast
+RUN git clone https://github.com/autonomousvision/mip-splatting.git /tmp/ext/mip-splatting \
+ && pip install /tmp/ext/mip-splatting/submodules/diff-gaussian-rasterization/ \
+ && rm -rf /tmp/ext
+
+# ── 5. Server deps ────────────────────────────────────────────────────────────
+RUN pip install \
+ "fastapi==0.115.0" "uvicorn[standard]==0.32.0" "pydantic>=2.0.0" \
+ "httpx>=0.27.0" "google-cloud-storage==2.18.0" "safetensors>=0.4.0"
+
+# ── 6. TRELLIS source (imported via PYTHONPATH, pinned for reproducibility) ───
+RUN git clone https://github.com/microsoft/TRELLIS.git /app/TRELLIS
WORKDIR /app
COPY worker_security.py /app/worker_security.py
diff --git a/workers/model-trellis/cloudbuild.yaml b/workers/model-trellis/cloudbuild.yaml
index 60c740360..14c8f3682 100644
--- a/workers/model-trellis/cloudbuild.yaml
+++ b/workers/model-trellis/cloudbuild.yaml
@@ -45,8 +45,8 @@ steps:
- --gpu-type=nvidia-l4
- --no-gpu-zonal-redundancy
- --no-cpu-throttling
- - --cpu=4
- - --memory=16Gi
+ - --cpu=8
+ - --memory=32Gi
- --min-instances=${_MIN_INSTANCES}
- --max-instances=${_MAX_INSTANCES}
- --timeout=300
diff --git a/workers/model-trellis/main.py b/workers/model-trellis/main.py
index 6aed5819a..57853de6f 100644
--- a/workers/model-trellis/main.py
+++ b/workers/model-trellis/main.py
@@ -31,6 +31,13 @@ import logging
import os
import time
import uuid
+
+# TRELLIS reads its attention + sparse-conv backends from the environment at
+# import time. The Dockerfile sets these as ENV; default them here too so the
+# service still loads correctly if deployed with a bare env. xformers is chosen
+# over flash-attn (no source compile) and runs well on the L4.
+os.environ.setdefault("ATTN_BACKEND", "xformers")
+os.environ.setdefault("SPCONV_ALGO", "native")
from contextlib import asynccontextmanager
from typing import Optional
@@ -70,7 +77,8 @@ def _load_pipeline():
log.info("Loading TRELLIS pipeline from %s", WEIGHTS_DIR)
_pipeline = TrellisImageTo3DPipeline.from_pretrained(WEIGHTS_DIR)
- _pipeline = _pipeline.to("cuda")
+ # TRELLIS exposes .cuda() (not .to()) to move every sub-model to the GPU.
+ _pipeline.cuda()
log.info("TRELLIS pipeline loaded")
diff --git a/workers/model-trellis/requirements.txt b/workers/model-trellis/requirements.txt
index 39f6b31d3..afb002fdb 100644
--- a/workers/model-trellis/requirements.txt
+++ b/workers/model-trellis/requirements.txt
@@ -1,17 +1,8 @@
-# ── TRELLIS (Microsoft) ───────────────────────────────────────────────────────
-trellis @ git+https://github.com/microsoft/TRELLIS.git@main
-
-torch>=2.3.0
-xformers>=0.0.27
-safetensors>=0.4.0
-trimesh>=4.4.0
-Pillow>=10.3.0
-
-# ── Server ────────────────────────────────────────────────────────────────────
-fastapi==0.115.0
-uvicorn[standard]==0.32.0
-pydantic>=2.0.0
-httpx>=0.27.0
-
-# ── GCP ───────────────────────────────────────────────────────────────────────
-google-cloud-storage==2.18.0
+# TRELLIS dependencies are installed in layered order directly in the Dockerfile
+# (torch → basic → xformers/spconv/kaolin → compiled CUDA extensions → server →
+# TRELLIS source). They are NOT installed from this file — TRELLIS is not a
+# pip-installable package; it is cloned and imported via PYTHONPATH=/app/TRELLIS.
+#
+# This file is intentionally a pointer so the build order and the CUDA-extension
+# compiles (nvdiffrast / diffoctreerast / diff-gaussian-rasterization) stay
+# explicit and cacheable. See the Dockerfile for the authoritative list.