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
feat(sign-language): runnable ASL example, web-component attribute docs, and alphabet cross-links
nirholas156ec92b2432
diff --git a/docs/sign-language.md b/docs/sign-language.mdindex d336bcb69..bc2e7e075 100644--- a/docs/sign-language.md+++ b/docs/sign-language.md@@ -11,6 +11,7 @@ New here? The step-by-step walkthrough is [Tutorial: make your avatar sign](http| Watch an avatar sign something | [/sign-language](https://three.ws/sign-language) | Type a phrase, press **🤟 Sign it**. Known words sign, the rest spell || Send someone a signed phrase | `https://three.ws/sign-language?say=happy+to+meet+you` | The page signs it on arrival. The **🔗 Share this phrase** chip copies this link for whatever was just signed || See the whole vocabulary | [/sign-language](https://three.ws/sign-language#sl-vocab) | Every word with a real sign, as a chip you can click to watch |+| Learn the manual alphabet | [/asl-alphabet](https://three.ws/asl-alphabet) | Every letter and number on a live hand, with what to look for, the look-alikes, and a drill for reading it || Spell a word and download it | [/pose](https://three.ws/pose) | The Spell box builds an animation clip you can scrub, slow down, and export as an animated GLB || Share a spelled word | `https://three.ws/pose?spell=HELLO` | The Studio spells it on arrival, on whatever avatar is loaded || Get signed answers from an AI agent | [/app](https://three.ws/app) | The **🤟** button in the chat header signs every assistant reply |@@ -82,6 +83,18 @@ Another 41 everyday spellings route to those same signs, so ordinary sentences w**Everything else fingerspells.** All 26 letter handshapes, the numbers 0-9, the traced J and Z motions, and the small bounce signers use for a double letter. A sentence that mixes both is one clip with no seam: the hands come up once at the start and settle once at the end, exactly as a signer does, rather than resetting between words.+## Learn the alphabet on /asl-alphabet++[/asl-alphabet](https://three.ws/asl-alphabet) is the reference for the manual alphabet itself. Every letter A-Z and digit 0-9 is formed by a live rig you can orbit, so you see the handshape from any angle rather than from one photographed side.++- **Click a key, or press it.** Typing `q` signs a Q. A single letter holds its pose so you can study it; a word settles back to rest the way a signer finishes.+- **Every letter is described**, with the letters it is confused with named explicitly (F against 9, M against N, K against V, G against Q). Look-alikes are where reading breaks down, so they are called out rather than left to be discovered.+- **Spell any word** and each key lights up as the hand reaches it. The highlight comes from the clip builder itself, not from a timer guessed alongside it, so it stays in step at any speed.+- **Practice reading it**, which is the harder half. The avatar spells a letter or a word, you type what you read, and your streak is kept on the device.+- Deep links: `?letter=W` opens a letter, `?spell=HELLO` spells a word.++Speed, signing hand, and avatar are the same settings as /sign-language, stored under the same key, so a left-handed signer sets that once for both pages.+## Fingerspell and export in the Animation StudioThe [Animation Studio](https://three.ws/pose) treats a spelled word as an animation clip like any other. Load a rigged avatar, find the **Spell** box in the Animation panel, type a word, press **🤟 Spell**.@@ -163,6 +176,31 @@ const on = await agentAvatar.setSignLanguage(true);Need only the alphabet? `buildFingerspellingClip('HELLO')` in [`src/fingerspelling.js`](../src/fingerspelling.js) returns the same `AnimationClip` JSON document the animation library serves, with no avatar attached.+Pass a `marks` array to collect `{ letter, start, end }` for every letter as it is placed, which is how /asl-alphabet keeps its keyboard in step with the hand:++```js+const marks = [];+const clip = buildFingerspellingClip('HELLO', { marks });+// marks → [{ letter: 'H', start: 0.35, end: 1.07 }, …]+```++## Install it as a package++The whole engine ships as [`@three-ws/sign-language`](https://www.npmjs.com/package/@three-ws/sign-language) with **zero runtime dependencies**: no three.js, no DOM, no network. It compiles signing in a browser, in Node, or in a worker.++```bash+npm install @three-ws/sign-language+```++```js+import { compileUtterance, signLookup } from '@three-ws/sign-language';++const { clip, signed, spelled } = compileUtterance('happy to meet you', { signs: signLookup() });+// signed → ['HAPPY', 'MEET', 'YOU'] spelled → ['TO']+```++The package README covers every export, the authoring format, and a runnable Node example: [packages/sign-language](../packages/sign-language/README.md).+## Reading signing: the recognition API`/api/asl-recognition` is the endpoint behind the webcam input. No API key, no account; it is rate-limited per IP.@@ -352,6 +390,9 @@ None of this replaces a human interpreter. It makes an avatar legible to signers## Related- [Tutorial: make your avatar sign](https://three.ws/tutorials/sign-with-your-avatar), the guided walkthrough of everything on this page+- [/asl-alphabet](https://three.ws/asl-alphabet), the manual alphabet on a live hand, with a practice drill+- [`@three-ws/sign-language`](../packages/sign-language/README.md), the engine as an npm package+- [examples/sign-language.html](../examples/sign-language.html), a runnable page with both integration paths- [Animation Studio](./animation-studio.md), the Spell box, exports, and share links- [docs/animations.md](./animations.md), clip formats and the retarget engine- [docs/web-component.md](./web-component.md), every `<agent-3d>` attribute including `sign-language`diff --git a/docs/tutorials/sign-with-your-avatar.md b/docs/tutorials/sign-with-your-avatar.mdindex 417ef38f2..bbd3f088f 100644--- a/docs/tutorials/sign-with-your-avatar.md+++ b/docs/tutorials/sign-with-your-avatar.md@@ -79,6 +79,8 @@ Another 41 everyday spellings resolve to those same 32 signs, so ordinary sentenThe full vocabulary with every gloss is in [the sign language reference](/docs/sign-language#what-it-signs-and-what-it-spells).+The letters themselves have their own reference: [/asl-alphabet](/asl-alphabet) forms every letter and number on a live hand, names the look-alikes (F against 9, M against N), and drills you on reading them. If you want to learn to fingerspell rather than just watch it, start there.+---## Step 4: Share a signed phrase as a link@@ -209,5 +211,7 @@ None of it replaces a human interpreter. It makes an avatar legible to signers i- [docs/sign-language.md](../sign-language.md): the full reference: vocabulary, developer APIs, and how the signing engine works- [docs/tutorials/animate-your-avatar.md](animate-your-avatar.md): the clip library, retargeting, and animated GLB export in depth- [docs/web-component.md](../web-component.md): every `<agent-3d>` attribute, including `sign-language`+- [/asl-alphabet](/asl-alphabet): the manual alphabet, letter by letter, with a practice drill+- [examples/sign-language.html](../../examples/sign-language.html): a runnable page with both integration pathsPrimary call to action: open **[/sign-language](/sign-language)** and sign your own name.diff --git a/docs/web-component.md b/docs/web-component.mdindex 63b2eec63..33e38afd4 100644--- a/docs/web-component.md+++ b/docs/web-component.md@@ -82,6 +82,29 @@ Lighting, camera orbit, and environment are managed by the built-in viewer; they|-----------|------|---------|-------------|| `voice` | string | on if manifest configures voice | Voice mode. Set to `livekit` for the LiveKit realtime voice pipeline; TTS/STT providers otherwise come from the manifest. |+### Sign language (ASL)++| Attribute | Type | Default | Description |+|-----------|------|---------|-------------|+| `sign-language` | boolean | off | The avatar signs every assistant reply in American Sign Language: words in the lexicon are signed, the rest are fingerspelled, in one continuous motion. Any value except `off` or `false` enables it, at boot or toggled at runtime. Requires a rig with finger bones; one without is refused with an explanation rather than signing wrong. |++```html+<agent-3d agent-id="your-agent" chat sign-language></agent-3d>+```++```js+// Toggle it from your own UI at any time.+const el = document.querySelector('agent-3d');+el.setAttribute('sign-language', ''); // on+el.removeAttribute('sign-language'); // off+```++Signing rides the same `SPEAK` event as spoken replies, so it works identically+in the hosted app and in an embed. A runnable page is+[examples/sign-language.html](../examples/sign-language.html); the engine and its+vocabulary are documented in [Sign language](./sign-language.md), and the+alphabet is browsable at [/asl-alphabet](https://three.ws/asl-alphabet).+### Skills and memory| Attribute | Type | Default | Description |diff --git a/examples/README.md b/examples/README.mdindex 74c2670ef..434132ba9 100644--- a/examples/README.md+++ b/examples/README.md@@ -24,6 +24,7 @@ The demos import the framework source directly (`../src/element.js`, `../src/lib|---|---|---|| [bare-avatar.html](./bare-avatar.html) | The default `<agent-3d>` output: just the avatar on a transparent background, no chat UI. A checkerboard body proves the transparency. | [src/element.js](../src/element.js) || [one-line-demo.html](./one-line-demo.html) | One `<agent-3d chat>` tag turns a page into a full conversational 3D agent (body, instructions, brain, chat UI). | [src/element.js](../src/element.js) |+| [sign-language.html](./sign-language.html) | Two ways to sign: `<agent-3d chat sign-language>` for signed chat replies, and the engine driven directly to compile any text into one clip. | [src/element.js](../src/element.js), [src/sign-speech.js](../src/sign-speech.js) || [minimal.html](./minimal.html) | `<agent-3d>` dropped into an ordinary landing-page layout. | [src/element.js](../src/element.js) || [web-component.html](./web-component.html) | The `<mv-viewer>` custom element: three viewers with different attributes plus its event log. | [src/components/ModelViewerElement.js](../src/components/ModelViewerElement.js) || [two-agents.html](./two-agents.html) | `<agent-stage formation="row">` hosting two `<agent-3d>` elements in one shared scene, with a chat input that addresses both. | [src/lib.js](../src/lib.js) |diff --git a/examples/sign-language.html b/examples/sign-language.htmlnew file mode 100644index 000000000..03bd8a769--- /dev/null+++ b/examples/sign-language.html@@ -0,0 +1,144 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <title>Signing avatar: ASL replies and compiled clips</title>+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <!--+ Two ways to put American Sign Language on a page, side by side:++ 1. `<agent-3d chat sign-language>`: the avatar signs every assistant+ reply. One attribute; nothing else to wire.+ 2. The engine directly: compile any text into one signed clip+ (src/sign-speech.js) and play it on a viewer you control, with no+ chat and no agent involved.++ Run it: npm run dev, then open+ http://localhost:3000/examples/sign-language.html+ -->+ <style>+ :root { color-scheme: dark; }+ * { box-sizing: border-box; }+ body {+ margin: 0; min-height: 100vh; background: #07090d; color: #e8edf5;+ font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;+ padding: 40px clamp(16px, 5vw, 56px) 80px;+ }+ header { max-width: 68ch; }+ h1 { font-size: clamp(26px, 4vw, 38px); line-height: 1.1; letter-spacing: -.02em; margin: 0 0 12px; }+ p.lede { color: #93a2b8; margin: 0 0 8px; }+ code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; color: #7dd3fc; }+ .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 24px; margin-top: 36px; }+ .card { border: 1px solid #1d2734; border-radius: 18px; background: #0b1017; padding: 22px; }+ .card h2 { font-size: 19px; margin: 0 0 6px; }+ .card p { color: #93a2b8; font-size: 14px; margin: 0 0 16px; }+ agent-3d { width: 100%; height: 460px; display: block; border-radius: 14px; overflow: hidden; background: #05070a; }+ #stage { width: 100%; height: 360px; border-radius: 14px; background: #05070a; position: relative; }+ .row { display: flex; gap: 8px; margin-top: 14px; }+ input, button {+ font: inherit; border-radius: 10px; border: 1px solid #24405c; padding: 10px 14px;+ }+ input { flex: 1 1 auto; min-width: 0; background: #0d151f; color: #e8edf5; }+ input:focus { outline: none; border-color: #38bdf8; box-shadow: 0 0 0 3px rgba(56,189,248,.22); }+ button { background: rgba(56,189,248,.16); color: #e8edf5; cursor: pointer; font-weight: 600; }+ button:hover { background: rgba(56,189,248,.3); }+ button:focus-visible { outline: 2px solid #38bdf8; outline-offset: 2px; }+ .out { margin-top: 12px; font-size: 13px; color: #93a2b8; min-height: 40px; font-family: ui-monospace, monospace; white-space: pre-line; }+ .note { margin-top: 40px; max-width: 72ch; color: #93a2b8; font-size: 14px; border-left: 2px solid #24405c; padding-left: 16px; }+ .note a { color: #7dd3fc; }+ </style>+ </head>+ <body>+ <header>+ <h1>A signing avatar, two ways</h1>+ <p class="lede">+ Left: an agent whose every reply is signed, from one HTML attribute. Right: the+ signing engine on its own, compiling whatever you type into a single animation clip.+ </p>+ <p class="lede">Words with a sign are signed; everything else is fingerspelled, in the same continuous motion.</p>+ </header>++ <div class="grid">+ <section class="card">+ <h2>1. Signed chat replies</h2>+ <p>+ <code><agent-3d chat sign-language></code>. Ask it anything: the answer is+ spoken in the chat panel and signed on the avatar.+ </p>+ <agent-3d agent-id="trinity" chat sign-language body="/avatars/cz.glb"></agent-3d>+ </section>++ <section class="card">+ <h2>2. The engine on its own</h2>+ <p>+ No agent, no chat: <code>compileUtterance()</code> turns text into one clip and the+ viewer plays it. This is the same code path the attribute above uses.+ </p>+ <div id="stage" role="img" aria-label="A 3D avatar signing the text you enter"></div>+ <div class="row">+ <input id="text" type="text" value="happy to meet you" aria-label="Text to sign" maxlength="60" />+ <button id="go" type="button">Sign it</button>+ </div>+ <div class="out" id="out" aria-live="polite">Type anything and press Sign it.</div>+ </section>+ </div>++ <p class="note">+ The engine is published as+ <a href="https://www.npmjs.com/package/@three-ws/sign-language">@three-ws/sign-language</a>+ with zero runtime dependencies, so it also runs in Node or a worker. The live feature is at+ <a href="https://three.ws/sign-language">three.ws/sign-language</a>, the alphabet reference at+ <a href="https://three.ws/asl-alphabet">three.ws/asl-alphabet</a>, and the full documentation at+ <a href="https://three.ws/docs/sign-language">three.ws/docs/sign-language</a>.+ </p>++ <script type="module">+ // 1. The web component: `sign-language` is the whole integration.+ import '../src/element.js';++ // 2. The engine, driven directly against a viewer this page owns.+ import { PoseStage } from '../src/avatar-pose.js';+ import { SignSpeaker } from '../src/sign-speech.js';+ import { signLookup } from '../src/sign-dictionary.js';++ const out = document.getElementById('out');+ const stage = new PoseStage(document.getElementById('stage'), {+ glbUrl: '/avatars/cz.glb',+ framing: 'portrait',+ });++ let speaker = null;+ try {+ const { supported } = await stage.mount();+ stage.start();+ if (supported) {+ speaker = new SignSpeaker({ manager: stage.anim, signs: signLookup() });+ out.textContent = 'Ready. Type anything and press Sign it.';+ } else {+ out.textContent = 'This rig has no finger bones, so it cannot form handshapes.';+ }+ } catch (err) {+ out.textContent = `Could not load the avatar: ${err.message}`;+ }++ async function sign() {+ const text = document.getElementById('text').value.trim();+ if (!speaker || !text) return;+ try {+ const { signed, spelled, clip } = await speaker.speak(text);+ out.textContent =+ `signed: ${signed.join(', ') || '(none)'}\n` ++ `spelled: ${spelled.join(', ') || '(none)'}\n` ++ `clip: ${clip.duration.toFixed(2)}s, ${clip.tracks.length} tracks`;+ } catch (err) {+ out.textContent = err.message;+ }+ }++ document.getElementById('go').addEventListener('click', sign);+ document.getElementById('text').addEventListener('keydown', (e) => {+ if (e.key === 'Enter') sign();+ });+ </script>+ </body>+</html>diff --git a/scripts/.aa/probe.mjs b/scripts/.aa/probe.mjsdeleted file mode 100644index e1d34ec23..000000000--- a/scripts/.aa/probe.mjs+++ /dev/null@@ -1,14 +0,0 @@-import { chromium } from 'playwright';-const b = await chromium.launch();-const p = await b.newPage({ viewport: { width: 900, height: 800 } });-const logs = [];-p.on('console', (m) => logs.push(m.type() + ': ' + m.text().slice(0, 160)));-await p.goto('http://localhost:3007/asl-alphabet?letter=W', { waitUntil: 'networkidle' });-await p.waitForTimeout(3000);-const el = await p.$('.aa-stage-wrap');-for (const t of [0, 1200, 2500, 5000]) {- if (t) await p.waitForTimeout(t === 1200 ? 1200 : 1300);- await el.screenshot({ path: `/tmp/claude-1000/-workspaces-three-ws/ac683624-d99b-4e76-bfbe-4e0283327d2c/scratchpad/seq-${t}.png` });-}-console.log(JSON.stringify(logs.filter((l) => !/WebSocket|vite/i.test(l)).slice(0, 8), null, 1));-await b.close();diff --git a/scripts/.aa/probe2.mjs b/scripts/.aa/probe2.mjsdeleted file mode 100644index d2e7a5ab5..000000000--- a/scripts/.aa/probe2.mjs+++ /dev/null@@ -1,16 +0,0 @@-import { chromium } from 'playwright';-const b = await chromium.launch();-const p = await b.newPage({ viewport: { width: 900, height: 800 } });-const errs = [];-p.on('pageerror', (e) => errs.push('pageerror: ' + e.message));-await p.goto('http://localhost:3007/asl-alphabet', { waitUntil: 'networkidle' });-await p.waitForTimeout(4000);-const el = await p.$('.aa-stage-wrap');-await p.click('.aa-key[data-char="W"]');-for (const t of [400, 900, 1600]) {- await p.waitForTimeout(t === 400 ? 400 : 500);- await el.screenshot({ path: `/tmp/claude-1000/-workspaces-three-ws/ac683624-d99b-4e76-bfbe-4e0283327d2c/scratchpad/click-${t}.png` });-}-console.log('status:', await p.textContent('#aa-status'));-console.log('errors:', errs);-await b.close();diff --git a/scripts/.aa/probe3.mjs b/scripts/.aa/probe3.mjsdeleted file mode 100644index eabd91f90..000000000--- a/scripts/.aa/probe3.mjs+++ /dev/null@@ -1,13 +0,0 @@-import { chromium } from 'playwright';-const b = await chromium.launch();-const p = await b.newPage({ viewport: { width: 900, height: 800 } });-p.on('console', (m) => {- const t = m.text();- if (/GL Driver|WebSocket|vite/i.test(t)) return;- console.log('[' + m.type() + ']', t.slice(0, 200));-});-p.on('pageerror', (e) => console.log('[pageerror]', e.message.slice(0, 200)));-await p.goto('http://localhost:3007/asl-alphabet', { waitUntil: 'networkidle' });-await p.waitForTimeout(6000);-console.log('status:', await p.textContent('#aa-status'));-await b.close();diff --git a/scripts/.aa/shot.mjs b/scripts/.aa/shot.mjsdeleted file mode 100644index 8639b6727..000000000--- a/scripts/.aa/shot.mjs+++ /dev/null@@ -1,12 +0,0 @@-import { chromium } from 'playwright';-const url = process.argv[2] || 'http://localhost:3007/asl-alphabet?letter=W';-const out = process.argv[3] || '/tmp/claude-1000/-workspaces-three-ws/ac683624-d99b-4e76-bfbe-4e0283327d2c/scratchpad/aa4.png';-const sel = process.argv[4] || '.aa-stage-wrap';-const b = await chromium.launch();-const p = await b.newPage({ viewport: { width: 1180, height: 820 } });-await p.goto(url, { waitUntil: 'networkidle' });-await p.waitForTimeout(7000);-const el = await p.$(sel);-await (el || p).screenshot({ path: out });-console.log('shot ok');-await b.close();