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
fix(animations): admit a full-size poster upload and tell a caller its clip is paywalled, not corrupt
nirholasce0a4f69ab08
diff --git a/api/animations/sell.js b/api/animations/sell.jsindex 76531aa35..1d6cb5316 100644--- a/api/animations/sell.js+++ b/api/animations/sell.js@@ -120,12 +120,8 @@ async function handleList(req, res, auth, raw) {// tracks. Listing for sale is intentionally not the same as publishing the// clip free to the gallery: that is what `visibility: 'public'` means, and// a creator who chooses it is giving the motion away deliberately.- // Re-pricing an existing listing usually re-sends only the key, so keep the- // size we already measured for that same artifact, and dropping it blanks the- // "size" a buyer sees in the marketplace feed. A new key resets it.- const artifactBytes =- input.artifact_bytes ??- (clip.artifact_key === input.artifact_key ? (clip.artifact_bytes ?? null) : null);++ const artifactBytes = resolveArtifactBytes(input, clip);let row;try {@@ -174,6 +170,16 @@ async function handleDelist(req, res, auth, raw) {});}+// Re-pricing an existing listing usually re-sends only the artifact key, so keep+// the size we already measured for that same artifact. Dropping it blanks the+// size a buyer sees on the marketplace card. A different key resets it, because+// the measurement no longer describes the file being sold.+export function resolveArtifactBytes(input, clip) {+ if (input.artifact_bytes != null) return input.artifact_bytes;+ if (clip?.artifact_key !== input.artifact_key) return null;+ return clip?.artifact_bytes ?? null;+}+// Explicit payout overrides win; otherwise pull the seller's default wallets.async function resolvePayto(userId, input) {const out = {@@ -221,4 +227,4 @@ async function resolveAuth(req, requiredScope) {return bearer;}-export const __test__ = { listSchema, delistSchema, shape, resolvePayto };+export const __test__ = { listSchema, delistSchema, shape, resolvePayto, resolveArtifactBytes };diff --git a/api/animations/thumbnail.js b/api/animations/thumbnail.jsindex 75f437168..e692dd5a7 100644--- a/api/animations/thumbnail.js+++ b/api/animations/thumbnail.js@@ -11,6 +11,11 @@ import { limits } from '../_lib/rate-limit.js';import { isUuid } from '../_lib/validate.js';const MAX_PNG_BYTES = 1_500_000;+// base64 inflates by 4/3, and the poster travels inside a JSON envelope. Read+// with a body limit that actually admits a MAX_PNG_BYTES image: on readJson's+// 1 MB default, every poster over ~749 KB died as an unexplained parse failure+// long before the size check below could name the real problem.+const MAX_BODY_BYTES = Math.ceil(MAX_PNG_BYTES * 1.4) + 4096;const PNG_HEADER = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);export default wrap(async (req, res) => {@@ -23,7 +28,15 @@ export default wrap(async (req, res) => {const rl = await limits.upload(auth.userId);if (!rl.success) return rateLimited(res, rl, 'thumbnail upload rate exceeded');- const body = await readJson(req).catch(() => null);+ let body;+ try {+ body = await readJson(req, MAX_BODY_BYTES);+ } catch (err) {+ if (err?.status === 413) {+ return error(res, 413, 'too_large', `png must be 1..${MAX_PNG_BYTES} bytes`);+ }+ return error(res, 400, 'invalid_request', 'body must be JSON');+ }const id = body?.id;const pngB64 = body?.png_base64;diff --git a/docs/animation-studio.md b/docs/animation-studio.mdindex 922a21b56..68bf981de 100644--- a/docs/animation-studio.md+++ b/docs/animation-studio.md@@ -82,6 +82,7 @@ curl -X POST 'https://three.ws/api/animations/clips' \- **Autosave is local, not the account.** Posing and keyframing never touch your account until you explicitly Save. The autosave draft lives in local storage and is offered back next session; an unload guard warns while work is unsaved.- **Saving and selling need an account.** Export and download are open to everyone; saving to the library and listing for sale require sign-in.- **The sellable artifact is the baked GLB.** A marketplace listing sells the baked animated GLB, so the buyer gets a self-contained, playable file.+- **Pricing a clip hides its keyframes.** Once a private or unlisted clip carries a price, `GET /api/animations/clips/:id` answers non-owners with the clip's metadata, poster and price but no motion tracks, flagged `paywalled: true` and carrying a `download_url` to the paid download. You keep full access to your own clip. Setting visibility to **public** publishes the motion to the free gallery, so a public clip's tracks stay readable even when it is also priced: price a clip you want to sell as private or unlisted.- **Mannequin-only controls.** Build, skin color, and joint constraints apply to the primitive mannequin; on a loaded GLB avatar those controls are disabled.- **Fingerspelling spells letters and numbers.** The Spell box keeps A to Z, the ASL number handshapes 0 to 9, and spaces, and drops punctuation. It needs a loaded rigged avatar with finger bones; the mannequin and finger-less rigs are refused with an explanation.diff --git a/src/animation-manager.js b/src/animation-manager.jsindex fc65c580f..f040c5169 100644--- a/src/animation-manager.js+++ b/src/animation-manager.js@@ -546,6 +546,11 @@ export class AnimationManager {const json = await res.json();// API responses wrap the baked clip one level deeper.const clipJson = isApiClip ? json?.clip?.clip : json;+ // A clip listed for sale answers with metadata only. Say so, rather than+ // letting a paywall read as a corrupt payload.+ if (!clipJson && json?.clip?.paywalled) {+ throw new Error(`animation ${name} is a paid clip, unlock it at ${json.clip.download_url}`);+ }if (!clipJson) throw new Error(`clip payload missing from ${url}`);const clip = AnimationClip.parse(clipJson);clip.name = name;