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
Marketplace, pose library, purchased skills, and script updates
nirholas7344a69d9306
diff --git a/.gitignore b/.gitignoreindex b6c039e71..b42d4fae4 100644--- a/.gitignore+++ b/.gitignore@@ -112,6 +112,8 @@ threews-launch-week-case-study.htmldebug-screenshots/# GLB optimization backups (see scripts/optimize-glb.mjs)+# Note: GLBs themselves are committed in compressed form — the served avatar/+# animation assets are meshopt-compressed in place by scripts/compress-glbs.mjs.*.glb.bak.secrets/.env.verceldiff --git a/api/users/me/purchased-skills.js b/api/users/me/purchased-skills.jsindex e746393a6..f59a103b7 100644--- a/api/users/me/purchased-skills.js+++ b/api/users/me/purchased-skills.js@@ -31,6 +31,9 @@ export default wrap(async (req, res) => {sp.currency_mint,sp.chain,sp.tx_signature,+ sp.skill_nft_mint,+ sp.skill_nft_network,+ sp.skill_nft_minted_at,sp.confirmed_at,sp.valid_until,sp.trial_remaining,diff --git a/pages/marketplace.html b/pages/marketplace.htmlindex d49435f1f..1fe719cf2 100644--- a/pages/marketplace.html+++ b/pages/marketplace.html@@ -1830,6 +1830,18 @@color: #fde047;}+ .payment-fee-note {+ font-size: 12px;+ color: rgba(255, 255, 255, 0.6);+ line-height: 1.5;+ padding: 10px 0 0;+ }++ .payment-fee-note strong {+ color: rgba(255, 255, 255, 0.85);+ font-weight: 600;+ }+.payment-wallet-area {margin: 20px 0;padding: 16px;@@ -4444,6 +4456,8 @@<strong id="payment-price-display"></strong></div>+ <div class="payment-fee-note" id="payment-fee-note" hidden></div>+<div class="payment-wallet-area" id="payment-wallet-area"><!-- Wallet connection status and button will be rendered here by JS --><button class="btn-primary" id="payment-connect-wallet-btn">diff --git a/pages/pose.html b/pages/pose.htmlindex 0b7bca1ed..20a5e02bf 100644--- a/pages/pose.html+++ b/pages/pose.html@@ -1441,6 +1441,17 @@padding: 18px;align-content: start;}+ .pl-drawer-foot {+ display: flex;+ flex-wrap: wrap;+ gap: 8px;+ padding: 14px 18px;+ border-top: 1px solid var(--border);+ background: rgba(0, 0, 0, 0.25);+ }+ .pl-drawer-foot .pose-btn {+ text-decoration: none;+ }.pl-card {border: 1px solid var(--border);border-radius: 12px;diff --git a/scripts/compress-glbs.mjs b/scripts/compress-glbs.mjsindex fa8f9d5b3..70785994e 100644--- a/scripts/compress-glbs.mjs+++ b/scripts/compress-glbs.mjs@@ -3,15 +3,17 @@* GLB compression pipeline.** Reads GLB files with @gltf-transform, applies a lossless-perceptual transform- * chain (dedup → prune → resample → quantize → EXT_meshopt_compression →- * WebP texture recompression via EXT_texture_webp) and writes the result back- * in place — but only if the output is actually smaller.+ * chain (dedup → prune → resample → quantize → EXT_meshopt_compression) and+ * writes the result back in place — but only if the output is actually smaller.** node scripts/compress-glbs.mjs # scan public/ + rider/assets/* node scripts/compress-glbs.mjs public/avatars/x.glb # explicit file list*- * The output uses EXT_meshopt_compression because the main viewer and the- * marketplace lobby both wire the meshopt decoder (src/viewer/internal.js).+ * The output uses EXT_meshopt_compression, which requires a meshopt decoder at+ * load time — the main viewer wires one via getDecoders() in+ * src/viewer/internal.js, so these decompress automatically there. Only run+ * this on GLBs served to decoder-equipped loaders; bare GLTFLoader sites (e.g.+ * thumbnails, accessories) need scripts/optimize-glb.mjs (lossless) instead.* Three.js' GLTFLoader decodes KHR_mesh_quantization natively.** Idempotent: reading an already-compressed GLB requires the meshopt *decoder*,@@ -25,9 +27,8 @@ import path from 'node:path';import { fileURLToPath } from 'node:url';import { NodeIO } from '@gltf-transform/core';import { ALL_EXTENSIONS } from '@gltf-transform/extensions';-import { dedup, prune, resample, quantize, meshopt, textureCompress } from '@gltf-transform/functions';+import { dedup, prune, resample, quantize, meshopt } from '@gltf-transform/functions';import { MeshoptEncoder, MeshoptDecoder } from 'meshoptimizer';-import sharp from 'sharp';const ROOT = path.resolve(fileURLToPath(import.meta.url), '../..');const DEFAULT_SCAN_DIRS = ['public', 'rider/assets'];@@ -110,7 +111,7 @@ async function main() {resample(),quantize(),meshopt({ encoder: MeshoptEncoder, level: 'medium' }),- textureCompress({ encoder: sharp, targetFormat: 'webp', quality: 85 }),+ // TODO: add textureCompress once sharp is added to devDependencies);const bytes = await io.writeBinary(document);diff --git a/scripts/create-agent-collection.mjs b/scripts/create-agent-collection.mjsindex d6e0774a9..0e2184386 100644--- a/scripts/create-agent-collection.mjs+++ b/scripts/create-agent-collection.mjs@@ -47,18 +47,20 @@import { readFileSync } from 'node:fs';import { fileURLToPath } from 'node:url';import path from 'node:path';-import { createRequire } from 'node:module';import { Keypair } from '@solana/web3.js';import bs58 from 'bs58';+import { Pool, neonConfig } from '@neondatabase/serverless';+import ws from 'ws';import { createUmi } from '@metaplex-foundation/umi-bundle-defaults';import { mplCore, createCollection, fetchCollection } from '@metaplex-foundation/mpl-core';import { createSignerFromKeypair, generateSigner, signerIdentity } from '@metaplex-foundation/umi';import { skillCollectionSymbol, THREE_WS } from '../api/_lib/three-brand.js';-const require = createRequire(import.meta.url);-const { Client } = require('pg');+// Neon's Pool is pg-compatible and supports parameterized text queries — the+// same driver scripts/apply-migrations.mjs uses for script-side DB access.+neonConfig.webSocketConstructor = ws;const HERE = path.dirname(fileURLToPath(import.meta.url));const REPO_ROOT = path.resolve(HERE, '..');@@ -159,8 +161,7 @@ async function main() {console.log('');// ── Load target agents ─────────────────────────────────────────────────────- const db = new Client({ connectionString: databaseUrl });- await db.connect();+ const db = new Pool({ connectionString: databaseUrl });let agents;try {diff --git a/src/marketplace.js b/src/marketplace.jsindex f0c6508f2..232e3f1f5 100644--- a/src/marketplace.js+++ b/src/marketplace.js@@ -6311,6 +6311,37 @@ function setStatus(text, kind) {el.className = 'payment-status' + (kind ? ' ' + kind : '');}+// Honest fee disclosure: once the server quotes a purchase, show how the price+// is split — a platform fee leg plus what the creator nets — before the buyer+// approves the transfer. No fee → the note stays hidden.+function renderFeeDisclosure(purchase) {+ const el = $('payment-fee-note');+ if (!el) return;+ const fee = purchase?.fee;+ if (!fee || !(Number(fee.amount) > 0)) {+ clearFeeDisclosure();+ return;+ }+ const decimals = Number(purchase.mint_decimals ?? 6);+ const places = decimals === 6 ? 2 : 4;+ const mintLabel = shortMintLabel(purchase.currency_mint);+ const toUi = (atomic) => (Number(atomic) / Math.pow(10, decimals)).toFixed(places);+ const creatorAtomic = purchase.creator_amount ?? String(BigInt(purchase.amount) - BigInt(fee.amount));+ const pct = (fee.bps / 100).toLocaleString(undefined, { maximumFractionDigits: 2 });+ el.innerHTML =+ `Includes a <strong>${pct}% platform fee</strong> (${toUi(fee.amount)} ${escapeHtml(mintLabel)}). ` ++ `Creator receives <strong>${toUi(creatorAtomic)} ${escapeHtml(mintLabel)}</strong>.`;+ el.hidden = false;+}++function clearFeeDisclosure() {+ const el = $('payment-fee-note');+ if (el) {+ el.hidden = true;+ el.innerHTML = '';+ }+}+// ── Payment modal chrome helpers ──────────────────────────────────────────//// The same modal is reused by skill / time-pass / asset flows. These helpers@@ -6677,8 +6708,11 @@ async function handleAssetPurchase() {payer: connectedWallet.publicKey,recipient: purchase.recipient,mint: purchase.currency_mint,- amount: BigInt(purchase.amount),+ amount: BigInt(purchase.creator_amount ?? purchase.amount),reference: purchase.reference,+ fee: purchase.fee+ ? { recipient: purchase.fee.recipient, amount: BigInt(purchase.fee.amount) }+ : null,});setStatus('Approve in wallet…');@@ -6793,6 +6827,7 @@ async function handlePurchase() {});return;}+ renderFeeDisclosure(purchase);} catch (e) {setStatus(e.message, 'err');confirmBtn.disabled = false;@@ -6806,8 +6841,11 @@ async function handlePurchase() {payer: connectedWallet.publicKey,recipient: purchase.recipient,mint: purchase.currency_mint,- amount: BigInt(purchase.amount),+ amount: BigInt(purchase.creator_amount ?? purchase.amount),reference: purchase.reference,+ fee: purchase.fee+ ? { recipient: purchase.fee.recipient, amount: BigInt(purchase.fee.amount) }+ : null,});setStatus('Approve in wallet…');diff --git a/src/pose-library.js b/src/pose-library.jsindex f7d2af4d2..e4797ee81 100644--- a/src/pose-library.js+++ b/src/pose-library.js@@ -282,6 +282,10 @@ export class PoseLibrary {el('button', { class: 'pl-close', type: 'button', 'aria-label': 'Close library', onclick: () => overlay.remove() }, ['✕']),]),list,+ el('footer', { class: 'pl-drawer-foot' }, [+ el('a', { class: 'pose-btn', href: '/marketplace?tab=animations' }, ['Browse the animation marketplace →']),+ el('a', { class: 'pose-btn', href: '/marketplace?tab=earn' }, ['Your sales & earnings']),+ ]),]);const select = (tab) => {