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
chore: land in-progress platform work
nirholas516b69691abb
diff --git a/api/marketplace/buy-asset.js b/api/marketplace/buy-asset.jsindex fdfe84476..95f27bdb0 100644--- a/api/marketplace/buy-asset.js+++ b/api/marketplace/buy-asset.js@@ -414,14 +414,10 @@ async function payAsAgent({ res, auth, agent, row, price, payoutAddress, itemTypif (!pur) return error(res, 500, 'purchase_missing', 'purchase row vanished mid-flight');// Same finalize as the browser path: receipt, revenue, both notifications.- // It writes the 200 envelope, to which we add the agent attribution.- const originalJson = res.json;- return finalizeAssetConfirm(- Object.assign(Object.create(Object.getPrototypeOf(res)), res, { json: originalJson }),- pur,- txSignature,- { paid_by_agent: { id: agent.id, name: agent.name || null, address: buyer.address }, label },- );+ return finalizeAssetConfirm(res, pur, txSignature, {+ paid_by_agent: { id: agent.id, name: agent.name || null, address: buyer.address },+ label,+ });}// ── Status ─────────────────────────────────────────────────────────────────@@ -532,7 +528,7 @@ async function handleConfirm(req, res, reference) {// Atomic confirm + receipt + notifications for a verified asset payment. Shared// by the Solana and EVM confirm paths; `txSignature` is the Solana signature or// the EVM tx hash.-async function finalizeAssetConfirm(res, pur, txSignature) {+async function finalizeAssetConfirm(res, pur, txSignature, extra = null) {const updated = await sql`UPDATE asset_purchasesSET status = 'confirmed', tx_signature = ${txSignature}, confirmed_at = now(), updated_at = now()@@ -584,7 +580,7 @@ async function finalizeAssetConfirm(res, pur, txSignature) {});}- return json(res, 200, { data: { status: 'confirmed', tx_signature: txSignature } });+ return json(res, 200, { data: { status: 'confirmed', tx_signature: txSignature, ...(extra || {}) } });}// EVM asset confirm: the buyer submits the settlement tx hash; verify a USDCdiff --git a/public/locales/ko.json b/public/locales/ko.jsonindex cd0b25d35..280b4d482 100644--- a/public/locales/ko.json+++ b/public/locales/ko.json@@ -16815,40 +16815,7 @@"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": "A signer spells names and loanwords and <em>signs</em> everything else. These words have real signs in the avatar’s vocabulary: a handshape, a place on the body, and a movement, on one or both hands. Pick one to watch it. Everything else in a sentence still fingerspells.",- "all_26_asl_letter_handshapes_plus_the": "All 26 ASL letter handshapes plus the numbers 0-9, with the traced J and Z and the double-letter bounce. Type a word in the Animation Studio and export the signing as an animated GLB, or share it as a link.",- "american_sign_language_live_in_3d": "<span class=\"sl-chip-dot\"></span> American Sign Language · live in 3D",- "avatar": "Avatar",- "best_results_good_light_hand_in_frame": "Best results: good light, hand in frame, one letter at a time. Numbers and the full A-Z alphabet are supported.",- "chat_with_an_agent": "Chat with an agent →",- "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": "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": "Sign Language Avatars · three.ws",- "meta_title": "Sign Language Avatars · three.ws",- "meta_twitter_description": "Avatars that sign in ASL: fingerspelling, signed chat replies, and webcam sign input, live in 3D.",- "meta_twitter_title": "Sign Language Avatars · three.ws",- "open_the_animation_studio": "Open the Animation Studio →",- "sign_back_with_your_camera": "Sign back with your camera",- "sign_it": "🤟 Sign it",- "sign_to_us_and_we_ll_read": "Sign to us and we’ll read it",- "signed_chat_replies": "Signed chat replies",- "signing_hand": "Signing hand",- "speed": "Speed",- "start_signing": "🎥 Start signing",- "thank_you": "thank you",- "three_ws_avatars_fingerspell_any_word_or": "three.ws avatars fingerspell any word or number in ASL, sign every chat reply, and read your own signing back from a webcam. The whole conversation, both directions, in 3D that runs in the browser.",- "try_the_webcam_demo": "Try the webcam demo ↓",- "turn_on_sign_mode_in_the_agent": "Turn on sign mode in the agent chat and the avatar signs every answer: library signs where they exist, fingerspelling for the rest. Any embedded avatar gets it with one <code>sign-language</code> attribute.",- "your_avatar_speaks_sign_language": "Your avatar speaks sign language."- },+ "sign_language": {},"signal_detail": {"all_feeds": "← 모든 피드","meta_description": "검증된 트레이더의 유료 시그널 피드 — 입증된 정확성, 실현된 결과, 모든 시그널에 대한 온체인 증명. 에이전트로 구독하여 자동 미러링하세요.",diff --git a/workers/avatar-reconstruction/face_pipeline.py b/workers/avatar-reconstruction/face_pipeline.pyindex ec80df91c..740a1a601 100644--- a/workers/avatar-reconstruction/face_pipeline.py+++ b/workers/avatar-reconstruction/face_pipeline.py@@ -33,6 +33,7 @@ from scipy.interpolate import RBFInterpolatorimport glb_opsimport face_geometry+import face_projectionimport pygltflibfrom worker_security import UnsafeUrlError, fetch_remote_bytes@@ -63,6 +64,10 @@ GEOMETRY_MORPH_ENABLED = os.environ.get("GEOMETRY_MORPH", "1") != "0"# perfect frontals.MAX_MORPH_YAW_DEG = float(os.environ.get("MAX_MORPH_YAW_DEG", "35"))+# Projective texturing (step 10c). On by default; set PROJECTIVE_TEXTURE=0 to+# fall back to warp-only skin, which is what shipped before this landed.+PROJECTIVE_TEXTURE_ENABLED = os.environ.get("PROJECTIVE_TEXTURE", "1") != "0"+_FACE_MAP: Optional[face_geometry.FaceMap] = None_FACE_MAP_LOADED = False@@ -564,7 +569,9 @@ def process(skin_tone = _extract_skin_tone(img_arr, landmarks, img_w, img_h)new_skin = _tint_texture(new_skin, skin_tone, strength=0.25, protect_mask=face_mask_uv)- glb_ops.set_material_texture(glb, "Wolf3D_Skin", new_skin)+ # The skin texture is written after the geometry morph (step 10c), because+ # projective texturing needs the head's final shape to know where each texel+ # lands in the photo.# 9. Hair colour tint.hair_colour = _extract_hair_colour(img_arr, landmarks, img_w, img_h)@@ -617,6 +624,63 @@ def process(log.warning("[%s] geometry morph failed (%s) — keeping template shape",job_id, exc)+ # 10c. Projective texturing — paint the photo onto the ~81% of the head the+ # face-oval warp cannot reach (ears, jawline, neck, forehead to the+ # hairline). Runs after the morph so it projects onto the head's final shape;+ # projecting onto the template and then morphing would slide the texture off+ # the features it was sampled from. Gated on facing, occlusion and the+ # foreground mask, and blended UNDER the face-oval composite, which stays+ # authoritative where the landmark warp already applies.+ if PROJECTIVE_TEXTURE_ENABLED:+ try:+ fmap = _get_face_map()+ positions, mesh_uvs, mesh_faces = glb_ops.get_head_mesh_data(glb)+ normals = glb_ops.recompute_vertex_normals(positions, mesh_faces)+ lm_vtx = uv_map.get("landmark_vtx")+ if fmap is not None and lm_vtx:+ lm_idx = np.asarray(lm_vtx, dtype=np.int64)+ n = min(len(landmarks), len(lm_idx))+ pts2d = np.array(+ [[landmarks[i].x * img_w, landmarks[i].y * img_h] for i in range(n)],+ dtype=np.float64,+ )+ fg_arr = np.array(fg_img.convert("RGBA"), dtype=np.uint8)+ fg_alpha = fg_arr[:, :, 3].astype(np.float32) / 255.0+ projected = face_projection.project_photo_to_uv(+ photo_rgb=np.array(fg_img.convert("RGB"), dtype=np.uint8),+ foreground_mask=fg_alpha,+ positions=positions,+ normals=normals,+ uvs=mesh_uvs,+ faces=mesh_faces,+ landmarks_2d=pts2d,+ landmark_vertices=positions[lm_idx[:n]],+ tex_w=new_skin.width,+ tex_h=new_skin.height,+ )+ if projected is not None:+ proj_rgb, proj_weight = projected+ coverage = face_projection.coverage_fraction(proj_weight)+ blended = face_projection.blend_projection(+ np.array(new_skin.convert("RGB"), dtype=np.uint8),+ proj_rgb,+ proj_weight,+ protect=face_mask_uv,+ )+ new_skin = Image.fromarray(blended, "RGB")+ log.info(+ "[%s] projective texturing covered %.1f%% of the skin atlas "+ "beyond the face oval (%.1fs)",+ job_id, coverage * 100.0, time.time() - t0,+ )+ else:+ log.info("[%s] projective texturing skipped: no camera pose", job_id)+ except Exception as exc: # noqa: BLE001 — enrichment must never fail the job+ log.warning("[%s] projective texturing failed (%s) — keeping warp-only skin",+ job_id, exc)++ glb_ops.set_material_texture(glb, "Wolf3D_Skin", new_skin)+# 11. Serialize.result = glb_ops.save_glb(glb)log.info("[%s] pipeline done in %.1fs — %d bytes", job_id, time.time() - t0, len(result))diff --git a/workers/garment-forge/main.py b/workers/garment-forge/main.pyindex d26929170..3d5df2a0f 100644--- a/workers/garment-forge/main.py+++ b/workers/garment-forge/main.py@@ -366,19 +366,38 @@ async def generate(raise HTTPException(status_code=422,detail=f"slot must be one of {list(GARMENT_SLOTS)}")job_id = body.job_id or str(uuid.uuid4())- await _update_job(job_id, status="queued", stage="queued",- prompt=body.prompt, slot=body.slot)- background_tasks.add_task(- _process_job, job_id, body.prompt, body.slot, body.tier,- body.yaw_deg if body.yaw_deg is not None else GARMENT_YAW_DEG,+ # The record carries everything the pipeline needs, so ANY instance can+ # drive this job later: submission and execution are decoupled on purpose.+ await _update_job(+ job_id, status="queued", stage="queued", attempts=0,+ prompt=body.prompt, slot=body.slot, tier=body.tier,+ yaw_deg=body.yaw_deg if body.yaw_deg is not None else GARMENT_YAW_DEG,)+ background_tasks.add_task(_drive_job, job_id)return {"job_id": job_id, "status": "queued"}[email protected]("/sweep")+async def sweep(background_tasks: BackgroundTasks,+ authorization: str = Header(...)) -> dict:+ """Re-drive jobs whose owning instance is gone. Cloud Scheduler calls this+ on a cadence; it is also safe to call by hand. Claiming is atomic, so+ overlapping sweeps and live instances never double-run a job."""+ _require_api_key(authorization)+ loop = asyncio.get_event_loop()+ ids = await loop.run_in_executor(None, _list_claimable_ids, MAX_CONCURRENT)+ for jid in ids:+ background_tasks.add_task(_drive_job, jid)+ log.info("sweep re-driving %d job(s): %s", len(ids), ids)+ return {"redriving": len(ids), "job_ids": ids}++async def _fail_if_stale(job: dict) -> dict:- """Watchdog: an in-flight record that stopped advancing belongs to a- reclaimed instance. Convert it to a terminal failure (and persist that)- so no client polls a zombie forever."""+ """Watchdog on the read path: an in-flight record that stopped advancing+ lost its instance. Losing an instance is routine Cloud Run behaviour, so+ the job goes back to `queued` for the next sweep to re-drive; only a job+ that has burned MAX_ATTEMPTS is declared terminally failed, so a poller+ never watches a zombie and a recoverable job is never buried."""if job.get("status") not in ("queued", "running"):return jobtry:@@ -388,13 +407,18 @@ async def _fail_if_stale(job: dict) -> dict:age = (datetime.now(timezone.utc) - updated).total_seconds()if age <= JOB_STALE_S:return job- log.error("[%s] stale for %.0fs at stage %s; marking failed",- job.get("job_id"), age, job.get("stage"))+ attempts = int(job.get("attempts", 0))+ if attempts < MAX_ATTEMPTS:+ log.warning("[%s] stale for %.0fs at stage %s (attempt %d/%d); requeueing",+ job.get("job_id"), age, job.get("stage"), attempts, MAX_ATTEMPTS)+ return await _update_job(job["job_id"], status="queued", stage="queued")+ log.error("[%s] stale for %.0fs at stage %s after %d attempts; marking failed",+ job.get("job_id"), age, job.get("stage"), attempts)return await _update_job(job["job_id"], status="failed",error=f"job stalled at stage '{job.get('stage')}' "- f"(no progress for {int(age)}s); the owning instance was likely "- "reclaimed. Retry the generation.",+ f"(no progress for {int(age)}s) after {attempts} attempts. "+ "Retry the generation.",)