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(discovery): stop ai-plugin.json telling agents the 3D lane is pay-per-call
nirholas1dbbe0b6d910
diff --git a/public/.well-known/ai-plugin.json b/public/.well-known/ai-plugin.jsonindex 8a550cdbf..aa2af4a01 100644--- a/public/.well-known/ai-plugin.json+++ b/public/.well-known/ai-plugin.json@@ -2,8 +2,8 @@"schema_version": "v1","name_for_human": "three.ws","name_for_model": "3d_agent",- "description_for_human": "three.ws — 3D avatar/world generation and live crypto intelligence APIs, pay-per-call via x402.",- "description_for_model": "three.ws exposes a 3D model viewer plus a paid pay-per-call API catalog settled via the x402 protocol (HTTP 402, USDC on Solana and Base): text→3D generation, avatar rigging, token and DeFi market intelligence, news sentiment, gas oracles, vanity address mining, and agent reputation. The machine-readable catalog with prices and schemas is at https://three.ws/.well-known/x402.json; free endpoints are indexed at /api/crypto and /api/3d.",+ "description_for_human": "Free, keyless 3D avatar and world generation, plus an optional paid API catalog for agents.",+ "description_for_model": "three.ws has two clearly separate surfaces, and every 3D request belongs on the free one. FREE and keyless, with no account, no API key and nothing to pay: text-to-3D model and avatar generation at POST https://three.ws/api/3d/studio (OpenAPI https://three.ws/.well-known/3d-studio-openapi.yaml), the same generation lane over MCP at https://three.ws/api/mcp-studio, the browser model viewer, the augmented-reality launcher at /api/ar, and the read-only market data endpoints indexed at /api/crypto. PAID and entirely optional: a separate catalog of 75 pay-per-call services under /api/x402/*, settled with the x402 protocol (HTTP 402, USDC on Solana and Base), covering market data, DeFi, news sentiment, agent infrastructure, and production 3D asset pipelines that go beyond the free lane. Prices and schemas: https://three.ws/.well-known/x402.json. Nothing in the free lane requires or accepts payment.","auth": {"type": "none"},@@ -11,7 +11,7 @@"type": "openapi","url": "https://three.ws/.well-known/openapi.yaml"},- "logo_url": "https://three.ws/favicon.ico",+ "logo_url": "https://three.ws/pwa-512x512.png","contact_email": "[email protected]",- "legal_info_url": "https://three.ws/"+ "legal_info_url": "https://three.ws/legal/tos"}diff --git a/scripts/build-discovery-cards.mjs b/scripts/build-discovery-cards.mjsindex df13d71f9..06cdbd66b 100644--- a/scripts/build-discovery-cards.mjs+++ b/scripts/build-discovery-cards.mjs@@ -15,8 +15,9 @@// • public/.well-known/agent-card.json — description + one generated// `x402-service-catalog` skill summarizing the paid catalog by category// with live counts and the discovery-doc URL. Hand-written skills stay.-// • public/.well-known/ai-plugin.json — descriptions updated to the current-// platform framing (viewer + paid x402 data/3D APIs).+// • public/.well-known/ai-plugin.json: descriptions, brand logo, and legal+// URL from scripts/lib/discovery-copy.mjs (free 3D lane first, optional+// paid catalog second, with the live paid count).// • public/crypto-agent-manifest.json — repoints the dead cdn.three.ws host (no DNS; the first-party CDN is /cdn/<r2-key>)// sample body at the live default avatar and pins a current model id.//@@ -26,6 +27,8 @@ import { readFileSync, writeFileSync } from 'node:fs';import { fileURLToPath } from 'node:url';import path from 'node:path';+import { pluginDescriptions, PLUGIN_LOGO_URL, PLUGIN_LEGAL_URL } from './lib/discovery-copy.mjs';+const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');const { getCatalog } = await import(path.join(root, 'api/_lib/service-catalog/index.js'));@@ -98,16 +101,16 @@ if (paid.length < 40) {}// ── ai-plugin.json ───────────────────────────────────────────────────────────+// Copy (and the brand/legal URLs) live in scripts/lib/discovery-copy.mjs so the+// committed manifest and this generator can be pinned to each other by+// tests/wellknown-manifests.test.js. The descriptions state the free, keyless+// 3D lane first and the optional paid catalog second: readers used to come away+// believing every three.ws capability, generation included, was pay-per-call.{const plugin = readJson('public/.well-known/ai-plugin.json');- plugin.description_for_human =- 'three.ws — 3D avatar/world generation and live crypto intelligence APIs, pay-per-call via x402.';- plugin.description_for_model =- 'three.ws exposes a 3D model viewer plus a paid pay-per-call API catalog settled via the x402 ' +- 'protocol (HTTP 402, USDC on Solana and Base): text→3D generation, avatar rigging, token and ' +- 'DeFi market intelligence, news sentiment, gas oracles, vanity address mining, and agent ' +- 'reputation. The machine-readable catalog with prices and schemas is at ' +- 'https://three.ws/.well-known/x402.json; free endpoints are indexed at /api/crypto and /api/3d.';+ Object.assign(plugin, pluginDescriptions(paid.length));+ plugin.logo_url = PLUGIN_LOGO_URL;+ plugin.legal_info_url = PLUGIN_LEGAL_URL;writeJson('public/.well-known/ai-plugin.json', plugin);}diff --git a/scripts/lib/discovery-copy.mjs b/scripts/lib/discovery-copy.mjsnew file mode 100644index 000000000..42e1d14e9--- /dev/null+++ b/scripts/lib/discovery-copy.mjs@@ -0,0 +1,55 @@+// Shared copy for the public discovery manifest at+// public/.well-known/ai-plugin.json (the legacy ChatGPT-plugins format, read+// today by third-party agents, crawlers, and plugin directories).+//+// Why this lives in its own module rather than inline in+// scripts/build-discovery-cards.mjs: that generator runs on every prebuild, so+// a hand-edit of the manifest it owns is silently reverted on the next deploy.+// Keeping the strings here lets tests/wellknown-manifests.test.js bind the+// committed manifest to exactly what the generator will write, so the two can+// never drift apart again.+//+// The free/paid split below is the whole point. three.ws runs a free, keyless+// 3D lane (the surface the ChatGPT app and the custom GPT use) alongside a+// separate, optional pay-per-call catalog. A reader of this manifest must be+// able to tell which is which in a single pass, and must never come away+// thinking the 3D generation lane costs anything.++/** 512x512 owned-IP brand mark. Same asset the app-store listings ship. */+export const PLUGIN_LOGO_URL = 'https://three.ws/pwa-512x512.png';++/** Canonical legal URL (no .html suffix), matching the served schemas. */+export const PLUGIN_LEGAL_URL = 'https://three.ws/legal/tos';++/** The free 3D lane's own OpenAPI: auth-free, price-free, self-contained. */+export const FREE_3D_SCHEMA_URL = 'https://three.ws/.well-known/3d-studio-openapi.yaml';++/** Machine-readable catalog for the separate, optional paid services. */+export const PAID_CATALOG_URL = 'https://three.ws/.well-known/x402.json';++/**+ * Human- and model-facing descriptions for ai-plugin.json.+ *+ * @param {number} paidServiceCount live paid services projected from the catalog+ * @returns {{ description_for_human: string, description_for_model: string }}+ */+export function pluginDescriptions(paidServiceCount) {+ if (!Number.isInteger(paidServiceCount) || paidServiceCount < 1) {+ throw new Error(`pluginDescriptions needs a positive service count, got ${paidServiceCount}`);+ }+ return {+ description_for_human:+ 'Free, keyless 3D avatar and world generation, plus an optional paid API catalog for agents.',+ description_for_model:+ 'three.ws has two clearly separate surfaces, and every 3D request belongs on the free one. ' ++ 'FREE and keyless, with no account, no API key and nothing to pay: text-to-3D model and avatar ' ++ `generation at POST https://three.ws/api/3d/studio (OpenAPI ${FREE_3D_SCHEMA_URL}), the same ` ++ 'generation lane over MCP at https://three.ws/api/mcp-studio, the browser model viewer, the ' ++ 'augmented-reality launcher at /api/ar, and the read-only market data endpoints indexed at ' ++ `/api/crypto. PAID and entirely optional: a separate catalog of ${paidServiceCount} pay-per-call ` ++ 'services under /api/x402/*, settled with the x402 protocol (HTTP 402, USDC on Solana and Base), ' ++ 'covering market data, DeFi, news sentiment, agent infrastructure, and production 3D asset ' ++ `pipelines that go beyond the free lane. Prices and schemas: ${PAID_CATALOG_URL}. Nothing in the ` ++ 'free lane requires or accepts payment.',+ };+}diff --git a/tests/wellknown-manifests.test.js b/tests/wellknown-manifests.test.jsnew file mode 100644index 000000000..aeb59bfe9--- /dev/null+++ b/tests/wellknown-manifests.test.js@@ -0,0 +1,112 @@+// Guards the two publicly discoverable manifests under public/.well-known/ that+// an AI client (or an app-store reviewer) can fetch without asking us first.+//+// The failure this prevents: ai-plugin.json described the whole platform as+// "pay-per-call via x402", so anything that read it came away believing the 3D+// generation lane cost money. That lane is free and keyless, and it is the lane+// the ChatGPT app and the custom GPT use. Two assertions keep the story honest:+//+// 1. The free 3D lane's own schema (3d-studio-openapi.yaml, the artifact the+// app points at) carries no crypto or payment surface at all. Same regex+// shape as tests/mcp-studio.test.js, which pins the MCP connector.+// 2. The platform manifest states the free lane first and the optional paid+// catalog second, and stays byte-identical to what+// scripts/build-discovery-cards.mjs will regenerate on the next prebuild+// (a hand-edit there does not survive a deploy).++import { describe, it, expect } from 'vitest';+import { readFileSync, existsSync } from 'node:fs';+import { fileURLToPath } from 'node:url';+import { dirname, resolve } from 'node:path';++import {+ pluginDescriptions,+ PLUGIN_LOGO_URL,+ PLUGIN_LEGAL_URL,+ FREE_3D_SCHEMA_URL,+} from '../scripts/lib/discovery-copy.mjs';++const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');+const plugin = JSON.parse(readFileSync(resolve(ROOT, 'public/.well-known/ai-plugin.json'), 'utf8'));+const studioSchema = readFileSync(resolve(ROOT, 'public/.well-known/3d-studio-openapi.yaml'), 'utf8');++// Anything that would signal a crypto / payment surface, matching the bar+// tests/mcp-studio.test.js holds the MCP connector to.+const FORBIDDEN =+ /x402|payment|paymentrequired|wallet|usdc|solana|\$three|pump\.?fun|token|coin|credit|price|\bpaid\b|crypto|onchain|web3|mint/gi;++describe("served 3D Studio schema (the app's discovery artifact)", () => {+ it('carries zero crypto / payment surface', () => {+ // The only tolerated hit is the schema reassuring readers there is+ // nothing to pay ("no payment"); an actual payment surface never reads+ // that way.+ const leaks = [];+ for (const m of studioSchema.matchAll(FORBIDDEN)) {+ const before = studioSchema.slice(Math.max(0, m.index - 4), m.index).toLowerCase();+ if (m[0].toLowerCase() === 'payment' && before.endsWith('no ')) continue;+ leaks.push(`${m[0]} @ ${JSON.stringify(studioSchema.slice(Math.max(0, m.index - 40), m.index + 40))}`);+ }+ expect(leaks, `served 3D Studio schema leaked a crypto/payment surface:\n${leaks.join('\n')}`).toEqual([]);+ });++ it('is the schema the platform manifest points free-lane callers at', () => {+ expect(existsSync(resolve(ROOT, 'public/.well-known/3d-studio-openapi.yaml'))).toBe(true);+ expect(plugin.description_for_model).toContain(FREE_3D_SCHEMA_URL);+ });+});++describe('platform ai-plugin.json', () => {+ it('leads with the free lane and marks the paid catalog as separate and optional', () => {+ const text = plugin.description_for_model;+ const free = text.indexOf('FREE and keyless');+ const paid = text.indexOf('PAID and entirely optional');+ expect(free).toBeGreaterThan(-1);+ expect(paid).toBeGreaterThan(free);+ // The generation endpoints a 3D request should reach are named on the+ // free side of that split, never on the paid side.+ for (const endpoint of ['https://three.ws/api/3d/studio', 'https://three.ws/api/mcp-studio', '/api/ar']) {+ const at = text.indexOf(endpoint);+ expect(at, `${endpoint} is missing from the manifest`).toBeGreaterThan(-1);+ expect(at, `${endpoint} is described on the paid side`).toBeLessThan(paid);+ }+ expect(text.indexOf('/api/x402/')).toBeGreaterThan(paid);+ expect(text).toMatch(/no account, no API key and nothing to pay/i);+ });++ it('never advertises the free 3D lane as paid', () => {+ expect(plugin.description_for_human).toMatch(/^Free, keyless 3D/);+ expect(plugin.auth).toEqual({ type: 'none' });+ // "3D ... pay-per-call" in one breath is the exact phrasing that made the+ // old manifest read as "generation costs crypto".+ expect(plugin.description_for_human).not.toMatch(/3D[^.]*pay-per-call/i);+ });++ it('uses a real branded logo, not the favicon', () => {+ expect(plugin.logo_url).toBe(PLUGIN_LOGO_URL);+ expect(plugin.logo_url).not.toMatch(/favicon/i);+ const asset = resolve(ROOT, 'public', new URL(plugin.logo_url).pathname.replace(/^\//, ''));+ expect(existsSync(asset), `${plugin.logo_url} has no file in public/`).toBe(true);+ const png = readFileSync(asset);+ // PNG signature + IHDR width/height: the listing asset is 512x512 owned IP.+ expect(png.subarray(1, 4).toString()).toBe('PNG');+ expect(png.readUInt32BE(16)).toBeGreaterThanOrEqual(512);+ expect(png.readUInt32BE(20)).toBe(png.readUInt32BE(16));+ });++ it('points at the canonical legal URL', () => {+ expect(plugin.legal_info_url).toBe(PLUGIN_LEGAL_URL);+ expect(plugin.legal_info_url).not.toMatch(/\.html$/);+ });++ it('matches what build-discovery-cards.mjs would regenerate (no hand-edit drift)', () => {+ // The live paid-service count is the only value the generator injects, so+ // read it back from the manifest and re-derive every other word.+ const count = Number(plugin.description_for_model.match(/catalog of (\d+) pay-per-call/)?.[1]);+ expect(Number.isInteger(count), 'manifest does not state a paid-service count').toBe(true);+ // The generator refuses to write a catalog smaller than 40 entries.+ expect(count).toBeGreaterThanOrEqual(40);+ const expected = pluginDescriptions(count);+ expect(plugin.description_for_human).toBe(expected.description_for_human);+ expect(plugin.description_for_model).toBe(expected.description_for_model);+ });+});