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 (x402 spec + self-facilitator, worlds API, locales, walk world day-night, gallery, garment forge, avatar face projection)

nirholasce0968a23461
diff --git a/api/_lib/x402-paid-endpoint.js b/api/_lib/x402-paid-endpoint.js
index 800734f1a..5af87c9c1 100644
--- a/api/_lib/x402-paid-endpoint.js
+++ b/api/_lib/x402-paid-endpoint.js
@@ -185,7 +185,13 @@ function buildRequirements({ priceAtomics, networks, resourceUrl, payToOverride
(!solTo ||
!env.X402_FEE_PAYER_SOLANA ||
!env.X402_ASSET_MINT_SOLANA ||
- !solanaSettleable())
+ !solanaSettleable() ||
+ // Sponsor recently observed under its SOL settle floor (sync,
+ // cache-backed, fail-open): every sponsor-mode settle is refused at
+ // that level, so advertising the accept just makes the buyer sign a
+ // payment that dies with settlement_unavailable. Drop Solana until
+ // the wallet is refunded; other networks keep the endpoint payable.
+ sponsorKnownBelowFloor())
)
continue;
if (net === NETWORK_BSC_MAINNET && (!bscTo || !env.X402_ASSET_ADDRESS_BSC)) continue;
diff --git a/api/cron/garment-catalog-audit.js b/api/cron/garment-catalog-audit.js
new file mode 100644
index 000000000..cfdfd7231
--- /dev/null
+++ b/api/cron/garment-catalog-audit.js
@@ -0,0 +1,146 @@
+// @ts-check
+// GET /api/cron/garment-catalog-audit — daily integrity sweep of the public
+// wardrobe catalog.
+//
+// The catalog (gs://three-ws-garments/garments/catalog.json) is living
+// production data fed by the garment forge and consumed by every closet
+// client. It can rot silently: an object deleted or overwritten, a bucket
+// policy change breaking anonymous reads, a truncated upload. This cron
+// verifies, for every entry:
+//
+// 1. structural validity (spec/slot/region/license/hash-shape — the same
+// contract src/garment-catalog.js enforces client-side),
+// 2. the GLB and thumbnail are anonymously reachable (HEAD),
+// 3. the GLB bytes still hash to model.sha256 (full check on a rotating
+// subset per run, so a 100-entry catalog stays inside cron budget while
+// every entry gets re-hashed within a few days).
+//
+// Failures are logged through reportServerError, which the production triage
+// sweep (npm run triage:gcp) already classifies — no new alert channel.
+// The heavyweight geometric audit (bind + walk-gait deviation) stays in
+// `npm run audit:garments`, run on demand after seeding or placement changes.
+
+import { error, json, method, reportServerError, wrapCron } from '../_lib/http.js';
+import { env } from '../_lib/env.js';
+import { constantTimeEquals } from '../_lib/crypto.js';
+
+const CATALOG_URL = 'https://storage.googleapis.com/three-ws-garments/garments/catalog.json';
+const SPEC_URI = 'https://three.ws/specs/garment-manifest-v1';
+const SLOTS = new Set([
+ 'top', 'bottom', 'footwear', 'outerwear', 'hair', 'headwear', 'glasses', 'accessory',
+]);
+const REGIONS = new Set([
+ 'torso', 'upperArms', 'lowerArms', 'hands',
+ 'hips', 'upperLegs', 'lowerLegs', 'feet', 'neck', 'scalp',
+]);
+const LICENSES = new Set([
+ 'CC0-1.0', 'CC-BY-4.0', 'MIT', 'Apache-2.0', 'BSD-2-Clause', 'BSD-3-Clause',
+]);
+const SHA256_RE = /^[0-9a-f]{64}$/;
+// Full-hash this many entries per run, rotating by day-of-year so the whole
+// catalog is re-verified every few days without ever fetching every GLB.
+const HASH_SAMPLE = 5;
+
+function requireCron(req, res) {
+ const secret = process.env.CRON_SECRET || env.CRON_SECRET;
+ if (!secret) {
+ error(res, 503, 'not_configured', 'CRON_SECRET unset');
+ return false;
+ }
+ const auth = req.headers['authorization'] || '';
+ const presented = auth.startsWith('Bearer ') ? auth.slice(7) : '';
+ if (!constantTimeEquals(presented, secret)) {
+ error(res, 401, 'unauthorized', 'invalid cron secret');
+ return false;
+ }
+ return true;
+}
+
+function structuralErrors(m) {
+ const errs = [];
+ if (m?.spec !== SPEC_URI) errs.push('unknown spec');
+ if (!SLOTS.has(m?.slot)) errs.push(`unknown slot "${m?.slot}"`);
+ if (!Array.isArray(m?.occludes) || m.occludes.some((r) => !REGIONS.has(r))) {
+ errs.push('bad occludes');
+ }
+ if (!LICENSES.has(m?.license)) errs.push(`license "${m?.license}"`);
+ if (!SHA256_RE.test(m?.model?.sha256 || '')) errs.push('malformed sha256');
+ if (!/^https:\/\//.test(m?.model?.uri || '')) errs.push('non-https model.uri');
+ return errs;
+}
+
+async function head(url) {
+ const res = await fetch(url, { method: 'HEAD' }).catch(() => null);
+ return res?.ok ? null : `HEAD ${url} -> ${res ? res.status : 'unreachable'}`;
+}
+
+async function sha256Of(url) {
+ const res = await fetch(url).catch(() => null);
+ if (!res?.ok) return null;
+ const buf = await res.arrayBuffer();
+ const digest = await crypto.subtle.digest('SHA-256', buf);
+ return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, '0')).join('');
+}
+
+export default wrapCron(async (req, res) => {
+ if (!method(req, res, ['GET'])) return;
+ if (!requireCron(req, res)) return;
+
+ const catRes = await fetch(CATALOG_URL).catch(() => null);
+ if (!catRes?.ok) {
+ reportServerError(new Error(`garment catalog unreachable (${catRes?.status ?? 'network'})`), {
+ code: 'garment_catalog_unreachable',
+ context: { url: CATALOG_URL },
+ });
+ return error(res, 502, 'catalog_unreachable', `catalog fetch ${catRes?.status ?? 'failed'}`);
+ }
+ const catalog = await catRes.json().catch(() => null);
+ if (!Array.isArray(catalog)) {
+ reportServerError(new Error('garment catalog is not a JSON array'), {
+ code: 'garment_catalog_malformed',
+ });
+ return error(res, 502, 'catalog_malformed', 'catalog is not a JSON array');
+ }
+
+ const failures = [];
+ for (const m of catalog) {
+ const label = `${m?.slot}/${m?.id}`;
+ const errs = structuralErrors(m);
+ if (errs.length) {
+ failures.push({ id: label, errors: errs });
+ continue;
+ }
+ const reach = (await Promise.all([
+ head(m.model.uri),
+ m.preview?.thumbnail ? head(m.preview.thumbnail) : null,
+ ])).filter(Boolean);
+ if (reach.length) failures.push({ id: label, errors: reach });
+ }
+
+ // Rotating full-hash sample: day-of-year picks the window.
+ const day = Math.floor(Date.now() / 86_400_000);
+ const clean = catalog.filter((m) => !failures.some((f) => f.id === `${m?.slot}/${m?.id}`));
+ const hashed = [];
+ for (let i = 0; i < Math.min(HASH_SAMPLE, clean.length); i++) {
+ const m = clean[(day * HASH_SAMPLE + i) % clean.length];
+ const sha = await sha256Of(m.model.uri);
+ hashed.push(`${m.slot}/${m.id}`);
+ if (sha && sha !== m.model.sha256) {
+ failures.push({ id: `${m.slot}/${m.id}`, errors: ['sha256 drift: stored bytes no longer match the manifest'] });
+ }
+ }
+
+ for (const f of failures) {
+ reportServerError(new Error(`garment catalog entry broken: ${f.id}: ${f.errors.join('; ')}`), {
+ code: 'garment_catalog_entry_broken',
+ context: f,
+ });
+ }
+
+ return json(res, 200, {
+ ok: failures.length === 0,
+ entries: catalog.length,
+ hashed,
+ failures,
+ });
+});
diff --git a/public/locales/as.json b/public/locales/as.json
index 505756722..5173c7f52 100644
--- a/public/locales/as.json
+++ b/public/locales/as.json
@@ -16815,6 +16815,40 @@
"three_ws": "<span class=\"brand-mark\"></span> three.ws",
"try_an_example_chip_above_to_see": "আৱিষ্কাৰ → পৰিকল্পনা → কল → সংশ্লেষণ প্ৰবাহ চাবলৈ ওপৰৰ এটা উদাহৰণ চিপ চেষ্টা কৰক।"
},
+ "sign_language": {
+ "a_signer_spells_names_and_loanwords_and": "এজন সংকেতকাৰীয়ে নাম আৰু ঋণ লোৱা শব্দবোৰ বানান কৰে আৰু বাকী সকলো <em>সংকেত দিয়ে</em>। এই শব্দবোৰৰ অৱতাৰৰ শব্দভাণ্ডাৰত প্ৰকৃত সংকেত আছে: এটা হাতৰ আকৃতি, শৰীৰৰ এটা স্থান, আৰু এটা গতি, এটা বা দুয়োখন হাতত। ইয়াক চাবলৈ এটা বাছনি কৰক। বাক্যৰ বাকী সকলো এতিয়াও আঙুলিৰে বানান কৰা হয়।",
+ "all_26_asl_letter_handshapes_plus_the": "ASLৰ আটাইকেইটা ২৬টা আখৰৰ হাতৰ আকৃতি আৰু ০-৯ সংখ্যা, ট্ৰেচ কৰা J আৰু Z আৰু ডাবল-লেটাৰ বাউন্সৰ সৈতে। এনিমেচন ষ্টুডিঅ'ত এটা শব্দ টাইপ কৰক আৰু সংকেতটোক এটা এনিমেটেড GLB হিচাপে এক্সপ'ৰ্ট কৰক, অথবা ইয়াক এটা লিংক হিচাপে শ্বেয়াৰ কৰক।",
+ "american_sign_language_live_in_3d": "<span class=\"sl-chip-dot\"></span> আমেৰিকান ছাইন লেংগুৱেজ · 3Dত লাইভ",
+ "avatar": "অৱতাৰ",
+ "best_results_good_light_hand_in_frame": "শ্ৰেষ্ঠ ফলাফল: ভাল পোহৰ, ফ্ৰেমত হাত, এটা সময়ত এটা আখৰ। সংখ্যা আৰু সম্পূৰ্ণ A-Z বৰ্ণমালা সমৰ্থিত।",
+ "chat_with_an_agent": "এজন এজেণ্টৰ সৈতে কথা পাতক →",
+ "click_start_fingerspell_a_word_at_your": "আৰম্ভ কৰক ক্লিক কৰক, আপোনাৰ কেমেৰাত এটা শব্দ আঙুলিৰে বানান কৰক, তাৰ পিছত বন্ধ কৰক। আপোনাৰ ব্ৰাউজাৰে ভিডিঅ'টোক স্থানীয়ভাৱে হাত আৰু শৰীৰৰ লেণ্ডমাৰ্কলৈ ৰূপান্তৰিত কৰে; কেৱল সেই স্থানাংকবোৰ চিনাক্তকৰণৰ বাবে পঠোৱা হয়। ৱেবকেমৰ আঙুলিৰে বানান কৰা নিখুঁত নহয় (বেলেগ ভুল আখৰ আশা কৰিব), সেয়েহে ইয়াক বিশ্বাস কৰাৰ আগতে পাঠটো পৰ্যালোচনা কৰক।",
+ "fingerspell_anything": "যিকোনো বস্তু আঙুলিৰে বানান কৰক",
+ "fingerspell_into_your_webcam_and_the_ai": "আপোনাৰ ৱেবকেমত আঙুলিৰে বানান কৰক আৰু AIয়ে ইয়াক পাঠলৈ পঢ়ে: লেণ্ডমাৰ্কবোৰ আপোনাৰ ডিভাইচত নিষ্কাশন কৰা হয়, সেয়েহে ভিডিঅ'টো কেতিয়াও আপোনাৰ মেচিনৰ পৰা ওলাই নাযায়। তলৰ ডেমোৱে একে চিনাক্তকৰণকাৰী চলায়।",
+ "gm": "gm",
+ "honest_scope_words_with_a_sign_are": "স্পষ্ট পৰিসৰ: সংকেত থকা শব্দবোৰ সংকেত দিয়া হয়, বাকী সকলো আখৰে আখৰে আঙুলিৰে বানান কৰা হয়। সংকেতবোৰ ইংৰাজী শব্দৰ ক্ৰমত একেলগে গাঁঠি দিয়া হয়, যিটো স্বাক্ষৰিত ইংৰাজী, ASL ব্যাকৰণ নহয়: প্ৰকৃত ASLএ বাক্যবোৰ পুনৰ ক্ৰমবদ্ধ কৰে, স্থানৰ মাজেৰে ক্ৰিয়া পদবোৰৰ ৰূপ সলনি কৰে, আৰু মুখত ব্যাকৰণ বহন কৰে। ওপৰৰ শব্দভাণ্ডাৰটো এটা আৰম্ভণিৰ সংহতি আৰু ই বৃদ্ধি পোৱাৰ বাবে। <a href=\"/docs/sign-language\">সম্পূৰ্ণ বিৱৰণ</a> পঢ়ক।",
+ "i_love_three_ws": "মই three.ws ভাল পাওঁ",
+ "it_signs_these_it_doesn_t_spell": "ই এইবোৰ সংকেত দিয়ে। ই এইবোৰ বানান নকৰে।",
+ "meta_description": "three.ws অৱতাৰবোৰে আমেৰিকান ছাইন লেংগুৱেজত সংকেত দিয়ে। যিকোনো শব্দ বা সংখ্যা আঙুলিৰে বানান কৰক, স্বাক্ষৰিত চাট উত্তৰ পাওক, আৰু আপোনাৰ ৱেবকেমৰ সৈতে AIলৈ পুনৰ সংকেত দিয়ক: সমগ্ৰ লুপ, 3Dত লাইভ।",
+ "meta_og_description": "ASLত সংকেত দিয়া অৱতাৰ। যিকোনো বস্তু আঙুলিৰে বানান কৰক, স্বাক্ষৰিত চাট উত্তৰ পাওক, আৰু আপোনাৰ ৱেবকেমৰ সৈতে পুনৰ সংকেত দিয়ক, 3Dত লাইভ।",
+ "meta_og_title": "ছাইন লেংগুৱেজ অৱতাৰ · three.ws",
+ "meta_title": "ছাইন লেংগুৱেজ অৱতাৰ · three.ws",
+ "meta_twitter_description": "ASLত সংকেত দিয়া অৱতাৰ: আঙুলিৰে বানান কৰা, স্বাক্ষৰিত চাট উত্তৰ, আৰু ৱেবকেম সংকেত ইনপুট, 3Dত লাইভ।",
+ "meta_twitter_title": "ছাইন লেংগুৱেজ অৱতাৰ · three.ws",
+ "open_the_animation_studio": "এনিমেচন ষ্টুডিঅ' খুলক →",
+ "sign_back_with_your_camera": "আপোনাৰ কেমেৰাৰে পুনৰ সংকেত দিয়ক",
+ "sign_it": "🤟 ইয়াক সংকেত দিয়ক",
+ "sign_to_us_and_we_ll_read": "আমাৰ সৈতে সংকেত দিয়ক আৰু আমি ইয়াক পঢ়িম",
+ "signed_chat_replies": "স্বাক্ষৰিত চাট উত্তৰ",
+ "signing_hand": "সংকেত দিয়া হাত",
+ "speed": "গতি",
+ "start_signing": "🎥 সংকেত দিয়া আৰম্ভ কৰক",
+ "thank_you": "ধন্যবাদ",
+ "three_ws_avatars_fingerspell_any_word_or": "three.ws অৱতাৰবোৰে ASLত যিকোনো শব্দ বা সংখ্যা আঙুলিৰে বানান কৰে, প্ৰতিটো চাট উত্তৰ সংকেত দিয়ে, আৰু ৱেবকেমৰ পৰা আপোনাৰ নিজৰ সংকেত পঢ়ে। সমগ্ৰ কথোপকথন, দুয়োটা দিশত, 3Dত যি ব্ৰাউজাৰত চলে।",
+ "try_the_webcam_demo": "ৱেবকেম ডেমো চেষ্টা কৰক ↓",
+ "turn_on_sign_mode_in_the_agent": "এজেণ্ট চাটত সংকেত মোড অন কৰক আৰু অৱতাৰে প্ৰতিটো উত্তৰ সংকেত দিয়ে: য'ত লাইব্ৰেৰী সংকেত আছে, বাকীখিনিৰ বাবে আঙুলিৰে বানান কৰা হয়। যিকোনো এম্বেডেড অৱতাৰে ইয়াক এটা <code>sign-language</code> এট্ৰিবিউটৰ সৈতে পায়।",
+ "your_avatar_speaks_sign_language": "আপোনাৰ অৱতাৰে ছাইন লেংগুৱেজ কয়।"
+ },
"signal_detail": {
"all_feeds": "← সকলো ফীড",
"meta_description": "এজন সত্যায়িত ট্ৰেডাৰৰ পেইড ছিগনেল ফীড — প্ৰমাণিত সঠিকতা, বাস্তৱায়িত ফলাফল, আৰু প্ৰতিটো ছিগনেলৰ বাবে অন-চেইন প্ৰমাণ। স্বয়ংক্ৰিয়ভাৱে মিৰৰ কৰিবলৈ আপোনাৰ এজেণ্টৰ সৈতে ছাবস্ক্ৰাইব কৰক।",
diff --git a/public/locales/ml.json b/public/locales/ml.json
index 11a08a747..807555941 100644
--- a/public/locales/ml.json
+++ b/public/locales/ml.json
@@ -16825,12 +16825,12 @@
"click_start_fingerspell_a_word_at_your": "Click start, fingerspell a word at your camera, then stop. Your browser turns the video into hand and body landmarks locally; only those coordinates are sent for recognition. Webcam fingerspelling is imperfect (expect the odd wrong letter), so review the text before you trust it.",
"fingerspell_anything": "Fingerspell anything",
"fingerspell_into_your_webcam_and_the_ai": "Fingerspell into your webcam and the AI reads it to text: landmarks are extracted on your device, so the video never leaves your machine. The demo below runs the same recognizer.",
- "gm": "",
- "honest_scope_words_with_a_sign_are": "",
- "i_love_three_ws": "",
- "it_signs_these_it_doesn_t_spell": "",
- "meta_description": "",
- "meta_og_description": "",
+ "gm": "gm",
+ "honest_scope_words_with_a_sign_are": "Honest scope: words with a sign are signed, everything else is fingerspelled letter by letter. Signs are strung together in English word order, which is signed English, not ASL grammar: real ASL reorders sentences, inflects verbs through space, and carries grammar on the face. The vocabulary above is a starting set and is meant to grow. Read the <a href=\"/docs/sign-language\">full breakdown</a>.",
+ "i_love_three_ws": "i love three.ws",
+ "it_signs_these_it_doesn_t_spell": "It signs these. It doesn’t spell them.",
+ "meta_description": "three.ws avatars sign in American Sign Language. Fingerspell any word or number, get signed chat replies, and sign back to the AI with your webcam: the whole loop, live in 3D.",
+ "meta_og_description": "Avatars that sign in ASL. Fingerspell anything, get signed chat replies, and sign back with your webcam, live in 3D.",
"meta_og_title": "",
"meta_title": "",
"meta_twitter_description": "",
diff --git a/src/walk.js b/src/walk.js
index 8ce67b0b2..67c99d492 100644
--- a/src/walk.js
+++ b/src/walk.js
@@ -75,6 +75,9 @@ import { applyWorldNameplate } from './shared/living-avatar.js';
import { createWalkCapture } from './walk-capture.js';
import { createMarketplaceGallery } from './marketplace-gallery.js';
import { createAgentDeskManager, fetchLiveAgentDesks } from './walk-agent-desk.js';
+import { createWalkDayNight } from './walk-day-night.js';
+import { Minimap } from './game/hud/minimap.js';
+import './game/hud/world-hud.css';
// Walk-Browse: on /marketplace-walk the page boots with ?gallery=marketplace and
// the engine becomes a strollable 3D marketplace hall. See marketplace-gallery.js.
@@ -491,6 +494,12 @@ scene.add(sun);
// sun.target must be in the scene for position updates to take effect.
scene.add(sun.target);
+// Day/night cycle: the same deterministic world clock /play runs on, driving
+// this rig's sun arc, sky gradient, light levels, and IBL strength. Armed per
+// environment (outdoor stages only) in applyEnvironmentMeta(); paused while AR
+// passthrough owns the lighting.
+const dayNight = createWalkDayNight({ ambientLight, hemi, sun, scene, stageEl: stage });
+
// Ground — opaque disc in non-AR mode, swapped to a shadow-only catcher in AR.
const groundOpaque = new Mesh(
new CircleGeometry(GROUND_RADIUS, 64),
@@ -2484,6 +2493,10 @@ function tick() {
// 5. Update speech bubbles (3D -> 2D projection)
updateSpeechBubbles();
+ // 5b. Advance the shared world clock's sky (no-op indoors / in AR, where the
+ // estimated room lighting owns the rig).
+ if (!arActive) dayNight.update();
+
// 6. Update minimap
updateMinimapFrame();
@@ -3811,6 +3824,10 @@ function applyEnvironmentMeta(meta) {
swapTerrain(meta);
applyLighting(meta, { ambientLight, hemi, sun });
applySky(meta, stage);
+ // Arm (outdoor) or disarm (indoor/void) the day/night cycle. When armed it
+ // immediately re-drives the lights + sky applyLighting/applySky just set, so
+ // entering a world at night never flashes noon.
+ dayNight.setEnvironment(meta);
clearDynamicMeshes();
buildCollidersFromMeta(meta);
contentBillboard?.placeOnTerrain();