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.

fix(animations): stop the public library endpoint from ever serving Mixamo clips

nirholas7867eab231ef
diff --git a/api/animations/library.js b/api/animations/library.js
index eef8274cb..df628c299 100644
--- a/api/animations/library.js
+++ b/api/animations/library.js
@@ -64,6 +64,23 @@ const MAX_PAGE = 1000;
// every real caller while keeping the response bounded.
const MAX_NAMES = 50;
+/**
+ * Defense in depth: no clip missing a `license`, or whose `source` names
+ * Mixamo, is ever served from this public endpoint, regardless of what the
+ * uploader staged. Adobe's Mixamo terms permit in-project playback but not
+ * redistributing the raw clip files, which is exactly what this endpoint and
+ * its mirror (scripts/mirror-animation-library.mjs) do, so a clip without
+ * provenance proving it is safe to redistribute is dropped rather than served.
+ *
+ * @param {{ license?: string, source?: string }} clip
+ * @returns {boolean}
+ */
+function isPublishable(clip) {
+ if (!clip || !clip.license) return false;
+ if (/mixamo/i.test(String(clip.source || ''))) return false;
+ return true;
+}
+
/**
* Parse ?name= into a deduped, bounded list of exact clip names. Accepts the
* param repeated (?name=a&name=b) and comma-separated (?name=a,b), because both
@@ -98,12 +115,12 @@ async function readManifest(key) {
try {
const buf = await getPublicObjectBuffer(key);
const parsed = JSON.parse(buf.toString('utf8'));
- const clips = Array.isArray(parsed)
+ const rawClips = Array.isArray(parsed)
? parsed
: Array.isArray(parsed.clips)
? parsed.clips
: [];
- return { clips, generatedAt: parsed.generated_at || null };
+ return { clips: rawClips.filter(isPublishable), generatedAt: parsed.generated_at || null };
} catch (err) {
const code = err?.$metadata?.httpStatusCode;
if (err?.name !== 'NoSuchKey' && code !== 404) {
diff --git a/pages/animations.html b/pages/animations.html
index 0013f5b93..571c65341 100644
--- a/pages/animations.html
+++ b/pages/animations.html
@@ -436,6 +436,15 @@
/* Raised for the 4.5:1 axe AA floor; measured against this page's real bg. */
color: var(--text-3, #84848e);
}
+ .ag-card-credit {
+ font-size: 10px;
+ color: var(--text-3, #84848e);
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ min-width: 0;
+ }
+ .ag-card-credit::before { content: '· '; }
.ag-card-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 2px; }
.ag-card-btn {
flex: 1;
diff --git a/scripts/mixamo-all.mjs b/scripts/mixamo-all.mjs
index 9e86a84b5..c3396dd13 100644
--- a/scripts/mixamo-all.mjs
+++ b/scripts/mixamo-all.mjs
@@ -34,25 +34,19 @@
* clip JSONs to animation-sources/.library-clips/ (gitignored, ~3 GB
* for the full catalog).
*
- * Phase 5 — Upload (needs S3_* creds, see below)
- * Uploads baked clips to R2 under animations/library/clips/<name>.json
- * and publishes animations/library/manifest.json. Served to users via
- * GET /api/animations/library + the R2 CDN. Content-hash cached in
- * scripts/mixamo-upload-state.json — re-run uploads only changed clips.
+ * Phase 5 (Upload): DISABLED PERMANENTLY, see uploadLibrary() below.
+ * Adobe's Mixamo terms permit in-project playback but not redistributing
+ * raw clip files, which is exactly what publishing to the public bulk
+ * library and its mirror script did. The bulk library now builds and
+ * publishes from CC0 sources via scripts/cc0-animation-library.mjs.
*
* Usage:
- * node scripts/mixamo-all.mjs # run all phases
* node scripts/mixamo-all.mjs --catalog # phase 1 only (no auth)
* node scripts/mixamo-all.mjs --download # phases 1+2 (needs MIXAMO_TOKEN)
* node scripts/mixamo-all.mjs --integrate # phases 1+3 (use saved sources)
- * node scripts/mixamo-all.mjs --build # phase 4 only
- * node scripts/mixamo-all.mjs --upload # phase 5 only (needs S3_* creds)
+ * node scripts/mixamo-all.mjs --build # phase 4 only (local retarget research)
* node scripts/mixamo-all.mjs --concurrency=5 --limit=50 # tuning flags
*
- * Required for upload phase (same names the production API uses — pull with
- * `vercel env pull .env.local`): S3_ENDPOINT, S3_ACCESS_KEY_ID,
- * S3_SECRET_ACCESS_KEY, S3_BUCKET, S3_PUBLIC_DOMAIN.
- *
* Required for download phase:
* MIXAMO_TOKEN in .env.local — either run node scripts/get-mixamo-token.mjs
* (needs ADOBE_EMAIL/ADOBE_PASSWORD in .env.local), or copy it by hand:
@@ -128,15 +122,10 @@ const PROGRESS_PATH = SHARD.count > 1
: join(__dirname, 'mixamo-progress.json');
const SOURCES_DIR = join(ROOT, 'animation-sources');
-// Bulk library outputs — all gitignored; the library ships via R2, not git.
+// Bulk library outputs: all gitignored, the library ships via R2, not git.
+// (Upload is disabled, see uploadLibrary() below, so only the config/stage
+// paths phases 1-4 still use are kept here.)
const LIBRARY_CONFIG_PATH = join(__dirname, 'mixamo-library.config.json');
-const LIBRARY_STAGE_DIR = join(ROOT, 'animation-sources/.library-clips');
-const LIBRARY_MANIFEST_PATH = join(LIBRARY_STAGE_DIR, 'manifest.json');
-// Poster thumbnails rendered by scripts/build-animation-thumbnails.mjs; each
-// uploads beside its clip and is published as the manifest entry's `thumb`.
-const LIBRARY_THUMBS_DIR = join(ROOT, 'animation-sources/.library-thumbs');
-const UPLOAD_STATE_PATH = join(__dirname, 'mixamo-upload-state.json');
-const LIBRARY_R2_PREFIX = 'animations/library';
mkdirSync(SOURCES_DIR, { recursive: true });
@@ -646,132 +635,21 @@ async function build() {
async function uploadLibrary() {
console.log('\n── Phase 5: Upload library to R2 ──────────────────────────');
- // Same env names the production API uses (api/_lib/env.js), with the older
- // R2_* names from earlier scripts accepted as fallback.
- const accountId = loadEnv('R2_ACCOUNT_ID');
- const endpoint = loadEnv('S3_ENDPOINT') || (accountId ? `https://${accountId}.r2.cloudflarestorage.com` : null);
- const accessKeyId = loadEnv('S3_ACCESS_KEY_ID') || loadEnv('R2_ACCESS_KEY_ID');
- const secretAccessKey = loadEnv('S3_SECRET_ACCESS_KEY') || loadEnv('R2_SECRET_ACCESS_KEY');
- const bucket = loadEnv('S3_BUCKET') || loadEnv('R2_BUCKET');
- const publicDomain = (loadEnv('S3_PUBLIC_DOMAIN') || '').replace(/\/+$/, '');
-
- if (!endpoint || !accessKeyId || !secretAccessKey || !bucket || !publicDomain) {
- console.log(' ⚠️ Storage creds missing — skipping upload.');
- console.log(' Needs S3_ENDPOINT, S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY, S3_BUCKET, S3_PUBLIC_DOMAIN.');
- console.log(' Pull them with: vercel env pull .env.local');
- return;
- }
- if (!existsSync(LIBRARY_MANIFEST_PATH)) {
- console.log(' ⚠️ No staged library (animation-sources/.library-clips/manifest.json) — run the build phase first.');
- return;
- }
-
- const { S3Client, PutObjectCommand } = await import('@aws-sdk/client-s3');
- const { createHash } = await import('node:crypto');
- const client = new S3Client({
- region: 'auto',
- endpoint,
- credentials: { accessKeyId, secretAccessKey },
- });
-
- const staged = JSON.parse(readFileSync(LIBRARY_MANIFEST_PATH, 'utf8'));
- const state = existsSync(UPLOAD_STATE_PATH) ? JSON.parse(readFileSync(UPLOAD_STATE_PATH, 'utf8')) : {};
- const saveState = () => writeFileSync(UPLOAD_STATE_PATH, JSON.stringify(state, null, 2));
-
- let uploaded = 0, skipped = 0, failed = 0;
- const clips = [];
- const queue = [...staged];
-
- async function worker() {
- while (queue.length) {
- const entry = queue.shift();
- const file = join(LIBRARY_STAGE_DIR, `${entry.name}.json`);
- if (!existsSync(file)) { failed++; console.warn(` ❌ ${entry.name}: staged clip missing`); continue; }
- const body = readFileSync(file);
- const sha = createHash('sha1').update(body).digest('hex');
- const key = `${LIBRARY_R2_PREFIX}/clips/${entry.name}.json`;
-
- // Poster thumbnail (optional — clips without one simply publish no
- // `thumb` and the gallery falls back to its icon placeholder).
- const thumbFile = join(LIBRARY_THUMBS_DIR, `${entry.name}.webp`);
- const thumbKey = `${LIBRARY_R2_PREFIX}/thumbs/${entry.name}.webp`;
- let thumbUrl = null;
- if (existsSync(thumbFile)) {
- const thumbBody = readFileSync(thumbFile);
- const thumbSha = createHash('sha1').update(thumbBody).digest('hex');
- if (state[`thumb:${entry.name}`] === thumbSha) {
- thumbUrl = `${publicDomain}/${thumbKey}`;
- } else {
- try {
- await client.send(new PutObjectCommand({
- Bucket: bucket,
- Key: thumbKey,
- Body: thumbBody,
- ContentType: 'image/webp',
- CacheControl: 'public, max-age=604800',
- }));
- state[`thumb:${entry.name}`] = thumbSha;
- thumbUrl = `${publicDomain}/${thumbKey}`;
- } catch (err) {
- console.warn(`\n ⚠️ thumb ${entry.name}: ${err.message}`);
- }
- }
- }
-
- const clipMeta = {
- name: entry.name,
- label: entry.label,
- icon: entry.icon,
- loop: entry.loop !== false,
- ...(entry.category ? { category: entry.category } : {}),
- ...(entry.duration ? { duration: entry.duration } : {}),
- bytes: body.length,
- url: `${publicDomain}/${key}`,
- ...(thumbUrl ? { thumb: thumbUrl } : {}),
- };
-
- if (state[entry.name] === sha) {
- skipped++;
- clips.push(clipMeta);
- continue;
- }
- try {
- await client.send(new PutObjectCommand({
- Bucket: bucket,
- Key: key,
- Body: body,
- ContentType: 'application/json',
- CacheControl: 'public, max-age=86400',
- }));
- state[entry.name] = sha;
- uploaded++;
- clips.push(clipMeta);
- if (uploaded % 25 === 0) { saveState(); process.stdout.write(`\r ${uploaded} uploaded, ${skipped} unchanged…`); }
- } catch (err) {
- failed++;
- console.warn(`\n ❌ ${entry.name}: ${err.message}`);
- }
- }
- }
- await Promise.all(Array.from({ length: 8 }, worker));
- saveState();
-
- clips.sort((a, b) => a.name.localeCompare(b.name));
- const manifest = {
- generated_at: new Date().toISOString(),
- total: clips.length,
- clips,
- };
- await client.send(new PutObjectCommand({
- Bucket: bucket,
- Key: `${LIBRARY_R2_PREFIX}/manifest.json`,
- Body: JSON.stringify(manifest),
- ContentType: 'application/json',
- CacheControl: 'public, max-age=300',
- }));
-
- console.log(`\n ✅ Upload: ${uploaded} new/changed, ${skipped} unchanged, ${failed} failed`);
- console.log(` 📋 ${LIBRARY_R2_PREFIX}/manifest.json → ${clips.length} clips live via /api/animations/library`);
+ // Disabled for good (prompts/finish/085-partners-02-animation-library-license.md).
+ // Adobe's Mixamo terms permit in-project playback but not redistributing the
+ // raw character/animation files, which is exactly what this phase did:
+ // publish clips/*.json + manifest.json behind a public GET endpoint
+ // (api/animations/library.js) with a dedicated third-party mirror script
+ // (scripts/mirror-animation-library.mjs). That risk is retired, not worked
+ // around, so this phase refuses to run rather than gating on a flag someone
+ // could flip back on. The bulk library is now built and published from CC0
+ // sources by scripts/cc0-animation-library.mjs --upload instead. Phases 1-4
+ // above are untouched and still useful for research/offline retargeting.
+ console.error(
+ " ⛔ Upload disabled permanently: redistributing raw Mixamo clip files is not covered by Adobe's license.",
+ );
+ console.error(' Use `node scripts/cc0-animation-library.mjs --upload` to publish the CC0 replacement library.');
+ process.exitCode = 1;
}
// ═══════════════════════════════════════════════════════════════════════════
diff --git a/src/animations-gallery.js b/src/animations-gallery.js
index 71bfa8b56..aeefd0a13 100644
--- a/src/animations-gallery.js
+++ b/src/animations-gallery.js
@@ -303,13 +303,15 @@ function normalizeLibraryClip(clip) {
url: clip.url, // site-relative clip JSON — playable by the live preview
thumbnail_url: `/animations/thumbs/${encodeURIComponent(clip.name)}.webp`,
price: null,
+ credit: clip.source || null,
+ license: clip.license || null,
};
}
function normalizeFullLibraryClip(clip) {
return {
id: clip.name,
- source: 'mixamo',
+ source: 'bulk',
name: clip.label || clip.name,
loop: clip.loop !== false,
icon: clip.icon || '🎬',
@@ -324,6 +326,11 @@ function normalizeFullLibraryClip(clip) {
// No thumb in the manifest means no request.
thumbnail_url: clip.thumb || null,
price: null,
+ // Every bulk clip is CC0 (Quaternius / Mesh2Motion) or self-generated by
+ // the text-to-motion worker; the manifest names which one so the gallery
+ // can credit it (prompts/finish/085-partners-02-animation-library-license).
+ credit: clip.source || null,
+ license: clip.license || null,
};
}
@@ -340,6 +347,8 @@ function normalizeCommunityClip(clip) {
url: null, // fetched through /api/animations/clips/:id by the preview engine
thumbnail_url: clip.thumbnail_url || null,
price: clip.price || null,
+ credit: null,
+ license: null,
};
}
@@ -695,7 +704,7 @@ function fmtDuration(ms) {
const CATEGORY_BY_KEY = new Map(GALLERY_CATEGORIES.map((c) => [c.key, c]));
function sourceLabel(source) {
- return source === 'community' ? 'Community' : source === 'mixamo' ? 'Mocap' : 'Studio';
+ return source === 'community' ? 'Community' : source === 'bulk' ? 'Mocap' : 'Studio';
}
// ── Card ────────────────────────────────────────────────────────────────────
@@ -726,6 +735,9 @@ function buildCard(clip, index) {
<button class="ag-card-cat" data-cat-jump="${escHtml(clip.category)}"
title="Show all ${escHtml(cat?.label || 'More')} animations">${cat?.icon || ''} ${escHtml(cat?.label || 'More')}</button>
<span class="ag-card-source">${sourceLabel(clip.source)}</span>
+ ${clip.credit
+ ? `<span class="ag-card-credit" title="${escHtml(clip.license ? `${clip.credit} (${clip.license})` : clip.credit)}">${escHtml(clip.credit)}</span>`
+ : ''}
</div>
<div class="ag-card-actions">
<a href="${escHtml(studioUrl)}" class="ag-card-btn ag-card-btn--primary"
@@ -823,6 +835,7 @@ function openModal(index) {
clip.duration_ms ? escHtml(fmtDuration(clip.duration_ms)) : null,
clip.loop ? 'loops' : 'plays once',
escHtml(sourceLabel(clip.source)),
+ clip.credit ? escHtml(clip.license ? `${clip.credit} (${clip.license})` : clip.credit) : null,
]
.filter(Boolean)
.map((x) => `<span>${x}</span>`)
diff --git a/tests/animations-library-endpoint.test.js b/tests/animations-library-endpoint.test.js
index 95f77677f..8e87a88c9 100644
--- a/tests/animations-library-endpoint.test.js
+++ b/tests/animations-library-endpoint.test.js
@@ -43,6 +43,8 @@ const CLIP = {
duration: 4.4,
bytes: 1174283,
url: 'https://cdn.example/animations/library/clips/mx-hip-hop-dancing.json',
+ source: 'Quaternius Universal Animation Library 2',
+ license: 'CC0 1.0 Universal',
};
// No beforeEach reset: every test installs its own mockResolvedValue/
@@ -240,4 +242,40 @@ describe('GET /api/animations/library', () => {
await handler(fakeReq('GET', '/api/animations/library?name='), res);
expect(JSON.parse(res.body).clips.length).toBe(5);
});
+
+ // ── License filter (defense in depth) ───────────────────────────────────
+ // Adobe's Mixamo terms permit in-project playback but not redistributing raw
+ // clip files, which is exactly what this endpoint does. No clip missing a
+ // `license`, or whose `source` names Mixamo, may ever be served here,
+ // regardless of what an uploader staged (prompts/finish/
+ // 085-partners-02-animation-library-license.md).
+
+ it('drops a clip with no license field', async () => {
+ readManifest.mockResolvedValue(Buffer.from(JSON.stringify({
+ clips: [CLIP, { ...CLIP, name: 'no-license-clip', license: undefined }],
+ })));
+ const res = fakeRes();
+ await handler(fakeReq(), res);
+ const body = JSON.parse(res.body);
+ expect(body.clips.map((c) => c.name)).toEqual(['mx-hip-hop-dancing']);
+ expect(body.total).toBe(1);
+ });
+
+ it('drops a clip whose source names Mixamo even if it carries a license', async () => {
+ readManifest.mockResolvedValue(Buffer.from(JSON.stringify({
+ clips: [CLIP, { ...CLIP, name: 'mixamo-clip', source: 'Mixamo', license: 'royalty-free' }],
+ })));
+ const res = fakeRes();
+ await handler(fakeReq(), res);
+ const body = JSON.parse(res.body);
+ expect(body.clips.map((c) => c.name)).toEqual(['mx-hip-hop-dancing']);
+ });
+
+ it('keeps a properly licensed CC0 clip', async () => {
+ readManifest.mockResolvedValue(Buffer.from(JSON.stringify({ clips: [CLIP] })));
+ const res = fakeRes();
+ await handler(fakeReq(), res);
+ const body = JSON.parse(res.body);
+ expect(body.clips).toEqual([CLIP]);
+ });
});