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(choreograph,asl): land the choreography and alphabet drill work from this worktree

nirholas3b18627a539a
diff --git a/chat/src/App.svelte b/chat/src/App.svelte
index 68bff6a5f..626b67414 100644
--- a/chat/src/App.svelte
+++ b/chat/src/App.svelte
@@ -23,7 +23,7 @@
} from './providers.js';
import ModelSelector from './ModelSelector.svelte';
import CompanyLogo from './CompanyLogo.svelte';
- import { controller, remoteServer, config, params, toolSchema, syncServer, brandConfig, ttsEnabled, ttsVoiceURI, localAgentId, activeAgent, talkingHeadAvatarUrl, route, mode, websiteCategory, loadCurrentUser, currentUser, notify, localProvidersEnabled, generating as generatingStore } from './stores.js';
+ import { controller, remoteServer, config, params, toolSchema, syncServer, brandConfig, STOCK_BRAND_NAME, ttsEnabled, ttsVoiceURI, localAgentId, activeAgent, talkingHeadAvatarUrl, route, mode, websiteCategory, loadCurrentUser, currentUser, notify, localProvidersEnabled, generating as generatingStore } from './stores.js';
import { t } from './i18n.js';
import Notifications from './Notifications.svelte';
import TxApprovalModal from './TxApprovalModal.svelte';
@@ -962,6 +962,9 @@
} else if (err.code === 'rate_limited') {
const hint = err.retryAfter ? ` Try again in ${err.retryAfter}s.` : ' Please wait a moment and try again.';
convo.messages[i].error = `The built-in model is rate-limited.${hint}`;
+ } else if (err.code === 'network') {
+ convo.messages[i].error =
+ 'Could not reach the model. The request never left this device, so nothing was sent. Check your connection, then hover this reply and press the refresh button to try again.';
} else if (err.code === 'tools_unsupported') {
const tools = err.toolNames?.length ? err.toolNames.join(', ') : 'the enabled tools';
convo.messages[i].error = `**${err.modelId}** doesn't support tool use. Disable ${tools} in the Tools panel, or switch to a tool-capable model like \`anthropic/claude-sonnet-4.5\` or \`openai/gpt-5-mini\`.`;
@@ -1503,7 +1506,12 @@
$: window.saveConversation = saveConversation;
$: {
- document.title = $brandConfig.name;
+ // Only a white-labeled brand renames the tab. On the stock build the title
+ // stays the one index.html declares, so the tab, the share card and the
+ // site's page index all say the same thing about /chat.
+ if ($brandConfig.name && $brandConfig.name !== STOCK_BRAND_NAME) {
+ document.title = $brandConfig.name;
+ }
document.documentElement.style.setProperty('--accent', $brandConfig.accent_color);
}
@@ -2386,6 +2394,9 @@
<button
data-trigger="knobs"
class="flex rounded-full p-2 transition-colors hover:bg-gray-100"
+ aria-label="Model settings"
+ aria-expanded={knobsOpen}
+ title="Model settings"
on:click={() => (knobsOpen = !knobsOpen)}
>
<Icon icon={feSidebar} strokeWidth={3} class="m-auto h-4 w-4 text-slate-700" />
@@ -2608,6 +2619,8 @@
<button
class="ml-auto flex rounded-full p-3 transition-colors hover:bg-gray-100"
use:flash
+ aria-label="Share conversation"
+ title="Share conversation"
on:click={shareConversation}
>
<Icon icon={feShare} strokeWidth={3} class="m-auto h-4 w-4 text-slate-700" />
@@ -2654,6 +2667,9 @@
<button
data-trigger="knobs"
class="flex rounded-full p-3 transition-colors hover:bg-gray-100"
+ aria-label="Model settings"
+ aria-expanded={knobsOpen}
+ title="Model settings"
on:click={() => (knobsOpen = !knobsOpen)}
>
<Icon icon={feSidebar} strokeWidth={3} class="m-auto h-4 w-4 text-slate-700" />
diff --git a/chat/src/CompanyLogo.svelte b/chat/src/CompanyLogo.svelte
index af70ab166..bcf270312 100644
--- a/chat/src/CompanyLogo.svelte
+++ b/chat/src/CompanyLogo.svelte
@@ -18,36 +18,38 @@
</span>
{:else if model && model.provider}
{#if model.provider === 'OpenAI' || model.id.startsWith('openai')}
- <img src="{base}logos/openai.ico" loading="lazy" class="{size} {rounded || 'rounded-sm'}" alt="" />
+ <img src="{base}logos/openai.ico" loading="lazy" aria-hidden="true" class="{size} {rounded || 'rounded-sm'}" alt="" />
{:else if model.provider === 'Anthropic' || model.id.startsWith('anthropic')}
<img
src="{base}logos/anthropic.jpeg"
loading="lazy"
+ aria-hidden="true"
class="{size} {rounded || 'rounded-sm'}"
alt=""
/>
{:else if model.id.startsWith('meta-llama')}
- <img src="{base}logos/meta.png" loading="lazy" class={size} alt="" />
+ <img src="{base}logos/meta.png" loading="lazy" aria-hidden="true" class={size} alt="" />
{:else if model.provider === 'Mistral' || model.id.startsWith('mistralai')}
- <img src="{base}logos/mistral.png" loading="lazy" class={size} alt="" />
+ <img src="{base}logos/mistral.png" loading="lazy" aria-hidden="true" class={size} alt="" />
{:else if model.id.startsWith('cohere')}
- <img src="{base}logos/cohere.png" loading="lazy" class={size} alt="" />
+ <img src="{base}logos/cohere.png" loading="lazy" aria-hidden="true" class={size} alt="" />
{:else if model.provider === 'Groq'}
- <img src="{base}logos/groq.png" loading="lazy" class="{size} {rounded || 'rounded-sm'}" alt="" />
+ <img src="{base}logos/groq.png" loading="lazy" aria-hidden="true" class="{size} {rounded || 'rounded-sm'}" alt="" />
{:else if model.id.startsWith('nous')}
- <img src="{base}logos/nous.png" loading="lazy" class={size} alt="" />
+ <img src="{base}logos/nous.png" loading="lazy" aria-hidden="true" class={size} alt="" />
{:else if model.id.startsWith('google')}
- <img src="{base}logos/google.png" loading="lazy" class={size} alt="" />
+ <img src="{base}logos/google.png" loading="lazy" aria-hidden="true" class={size} alt="" />
{:else if model.id.startsWith('perplexity')}
<img
src="{base}logos/perplexity.svg"
loading="lazy"
+ aria-hidden="true"
class="{size} {rounded || 'rounded-sm'}"
alt=""
/>
{:else if model.id.startsWith('deepseek')}
- <img src="{base}logos/deepseek.ico" loading="lazy" class={size} alt="" />
+ <img src="{base}logos/deepseek.ico" loading="lazy" aria-hidden="true" class={size} alt="" />
{:else if model.id.startsWith('qwen')}
- <img src="{base}logos/qwen.svg" loading="lazy" class={size} alt="" />
+ <img src="{base}logos/qwen.svg" loading="lazy" aria-hidden="true" class={size} alt="" />
{/if}
{/if}
diff --git a/chat/src/Message.svelte b/chat/src/Message.svelte
index d3fdfb946..08f7d19fb 100644
--- a/chat/src/Message.svelte
+++ b/chat/src/Message.svelte
@@ -754,6 +754,7 @@
<button
class="group/actions flex h-7 w-7 shrink-0 rounded-lg hover:bg-gray-100"
on:click={copyContent}
+ aria-label="Copy message"
title="Copy"
>
{#if copied}
@@ -765,6 +766,8 @@
{/if}
<button
class="group/actions flex h-7 w-7 shrink-0 rounded-lg hover:bg-gray-100"
+ aria-label="Edit message"
+ title="Edit"
on:click={async () => {
convo.messages[i].editing = true;
convo.messages[i].pendingContent = convo.messages[i].content;
@@ -784,6 +787,8 @@
{#if message.role !== 'system'}
<button
class="group/actions flex h-7 w-7 shrink-0 rounded-lg hover:bg-gray-100"
+ aria-label="Regenerate reply"
+ title="Regenerate"
on:click={() => {
activeToolcall = null;
@@ -822,6 +827,8 @@
{/if}
<button
class="group/actions flex h-7 w-7 shrink-0 rounded-lg hover:bg-gray-100"
+ aria-label="Delete message"
+ title="Delete"
on:click={() => {
// Remove this message from the conversation:
convo.messages = convo.messages.slice(0, i).concat(convo.messages.slice(i + 1));
@@ -840,6 +847,8 @@
{/if}
</div>
<button
+ aria-label="Insert a message here"
+ title="Insert a message here"
on:click={async () => {
// Insert a blank message inbetween the next message and the next next message:
let role;
diff --git a/chat/src/MessageContent.svelte b/chat/src/MessageContent.svelte
index 0ee4deaa2..28cedd593 100644
--- a/chat/src/MessageContent.svelte
+++ b/chat/src/MessageContent.svelte
@@ -7,9 +7,30 @@
</script>
{#if message.error}
- <span class="markdown text-slate-600 prose-a:underline">
- <Markdown source={message.error} />
- </span>
+ <!-- An error is a state of its own, not a quieter reply: give it a border, a
+ warning tint and a role so it is legible at a glance and announced. -->
+ <div
+ role="alert"
+ class="markdown flex w-full max-w-none items-start gap-2 rounded-xl border border-amber-500/40 bg-amber-500/5 px-3 py-2 text-left text-sm text-ink-soft prose-a:underline"
+ >
+ <svg
+ viewBox="0 0 24 24"
+ class="mt-[3px] h-4 w-4 shrink-0 text-amber-400"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ aria-hidden="true"
+ >
+ <path d="M12 9v4" />
+ <path
+ d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z"
+ />
+ <path d="M12 17h.01" />
+ </svg>
+ <span class="min-w-0"><Markdown source={message.error} /></span>
+ </div>
{:else if message.content}
<div
bind:clientHeight={contentHeight}
diff --git a/chat/src/convo.js b/chat/src/convo.js
index f717fb7d7..94c71ccbd 100644
--- a/chat/src/convo.js
+++ b/chat/src/convo.js
@@ -212,6 +212,11 @@ export async function complete(convo, onupdate, onabort) {
}
} catch (err) {
if (err.name === 'AbortError') return;
+ // fetch rejects with a bare TypeError when the request never reached the
+ // server (offline, DNS, a blocked or refused connection). Its message is
+ // "Failed to fetch", which told the user nothing; tag it so the UI can
+ // answer with something they can act on.
+ if (err instanceof TypeError && !err.code) err.code = 'network';
onabort?.(err);
}
}
@@ -405,7 +410,14 @@ async function streamResponse(provider, readableStream, onupdate, onabort) {
if (error instanceof DOMException && error.name === 'AbortError') {
onabort();
} else {
- onupdate({ error: error.message });
+ // The stream died after the reply started. Say so, and say what is
+ // safe to do next, rather than printing the transport's own wording.
+ onupdate({
+ error:
+ error instanceof TypeError
+ ? 'The reply stopped early because the connection dropped. Hover this reply and press the refresh button to regenerate it.'
+ : error.message,
+ });
}
}
}
diff --git a/chat/src/stores.js b/chat/src/stores.js
index d2ba320ac..afd146e2c 100644
--- a/chat/src/stores.js
+++ b/chat/src/stores.js
@@ -3,8 +3,13 @@ import { persisted } from './localstorage.js';
import { v4 as uuidv4 } from 'uuid';
import { syncHostedAddress } from './sync.js';
+// The name a stock (not white-labeled) deployment reports. `brandConfig.name`
+// exists so an operator can rename the tab; when it still reads this, there is
+// no custom brand and the title the HTML declares is the one that should stand.
+export const STOCK_BRAND_NAME = 'three.ws chat';
+
export const brandConfig = writable({
- name: 'three.ws chat',
+ name: STOCK_BRAND_NAME,
logo_url: null,
accent_color: '#6366f1',
tagline: 'Chat with any AI model',
diff --git a/chat/src/three-ui/TopNav.svelte b/chat/src/three-ui/TopNav.svelte
index 77e3b431c..0b87c289b 100644
--- a/chat/src/three-ui/TopNav.svelte
+++ b/chat/src/three-ui/TopNav.svelte
@@ -44,8 +44,16 @@
</button>
</div>
- <!-- CENTER: main-site navigation (desktop) -->
- <nav class="absolute left-1/2 hidden -translate-x-1/2 items-center gap-0.5 lg:flex" aria-label="three.ws">
+ <!-- CENTER: main-site navigation (desktop).
+ In flow, not absolutely centered: a centered overlay sat on top of the
+ right-hand cluster at every width, so the Pay pill covered Features and
+ Docs and neither was clickable. Shown from xl, where the three clusters
+ fit side by side; below that the links live in the sheet behind the
+ hamburger. -->
+ <nav
+ class="hidden min-w-0 flex-1 items-center justify-center gap-0.5 xl:flex"
+ aria-label="three.ws"
+ >
{#each siteLinks as link}
<a
href={link.href}
@@ -59,15 +67,17 @@
{/each}
</nav>
- <!-- RIGHT: auth buttons + hamburger -->
- <div class="flex items-center gap-2">
+ <!-- RIGHT: auth buttons + hamburger. The hamburger stays until xl, because
+ that is where the site links join the bar; without it, every width
+ between md and xl had no way to reach them at all. -->
+ <div class="flex shrink-0 items-center gap-2">
<div class="hidden items-center gap-2 md:flex">
<NotificationBell />
<PayWalletPicker />
<WalletConnect />
</div>
<button
- class="rounded-full p-2 text-ink transition-colors hover:bg-paper-deep md:hidden"
+ class="rounded-full p-2 text-ink transition-colors hover:bg-paper-deep xl:hidden"
aria-label={mobileOpen ? 'Close menu' : 'Open menu'}
aria-expanded={mobileOpen}
on:click={() => (mobileOpen = !mobileOpen)}
@@ -79,7 +89,7 @@
<!-- Mobile sheet -->
{#if mobileOpen}
- <div class="border-t border-rule bg-paper md:hidden">
+ <div class="border-t border-rule bg-paper xl:hidden">
<div class="flex flex-col gap-1 px-4 py-3">
<button
on:click={goChatHome}
@@ -109,7 +119,9 @@
Back to three.ws
</a>
- <div class="mt-2 flex flex-col gap-3 border-t border-rule pt-3">
+ <!-- Only when the header cluster is hidden, so the wallet controls are
+ never offered twice on the same screen. -->
+ <div class="mt-2 flex flex-col gap-3 border-t border-rule pt-3 md:hidden">
<PayWalletPicker />
<WalletConnect />
</div>
diff --git a/docs/choreography.md b/docs/choreography.md
index cc17a4658..45bd4c43d 100644
--- a/docs/choreography.md
+++ b/docs/choreography.md
@@ -187,9 +187,11 @@ player.update(deltaSeconds);
Routines round-trip through the URL, so a link is the routine. The studio keeps `?r=` in sync as you edit:
```
-https://three.ws/choreograph?r=Welcome%7Cwave%3A2%2Cnod%3A1.2%2Cidle%3A1.6
+https://three.ws/choreograph?r=Welcome|wave:2,nod:1.2,idle:1.6
```
+The studio writes that query itself rather than through `URLSearchParams`, because the encoding below already escapes everything it needs to and a second pass would turn a routine called `The pitch` into `?r=The%2520pitch|…`. Links written the older way still load: the page retries a value that will not parse after one `decodeURIComponent`.
+
The encoding is deliberately legible rather than base64, so you can read a link before you click it and hand-write one when that is easier:
```
@@ -199,7 +201,7 @@ Name|slot:hold[*speed][@clip],slot:hold,…
- `Welcome|wave:2,nod:1.2` gives two beats
- `Slow%20clap|celebrate:3*0.5` plays at half speed
- `Encore|dance:4@av-offabean-dance` pins a specific clip (naming the slot's default instead, `@rumba`, stores `null` and leaves the slot resolving)
-- `Waiting~loop|patience:3,fidget:2.4` sets `loop` via the `~loop` suffix on the name
+- `Waiting~loop|patience:3,fidget:2.4` sets `loop` via the `~loop` suffix on the name (a `~` inside the name itself is escaped to `%7E`, so a routine really called `Encore~loop` stays one)
`encodeRoutine()` and `decodeRoutine()` in the runtime module are the canonical implementations. A malformed link throws with the reason rather than dropping steps quietly, and the studio shows that reason instead of silently loading something else.
diff --git a/docs/sign-language.md b/docs/sign-language.md
index 404355e5d..20f1e3a3f 100644
--- a/docs/sign-language.md
+++ b/docs/sign-language.md
@@ -104,9 +104,9 @@ Another 41 everyday spellings route to those same signs, so ordinary sentences w
- **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.
+- **Spell any word** and each key lights up as the hand reaches it. The word is also laid out under the input, one cell per letter, lit in the same cadence, so a long word can be followed without scrolling back to the A-to-Z grid. 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.
+- Deep links: `?letter=W` opens a letter, `?spell=HELLO` spells a word. The link is read before the page builds anything, so the letter's description, its look-alike note and its pressed key are on screen immediately and the avatar catches up when the rig finishes loading.
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. That includes [your own avatar](#sign-with-your-own-avatar): pick it on either page and it forms the letters on both.
diff --git a/docs/skill-bundles.md b/docs/skill-bundles.md
index 815d10932..639740a3c 100644
--- a/docs/skill-bundles.md
+++ b/docs/skill-bundles.md
@@ -51,6 +51,7 @@ All four live under the agent. `:id` is the agent's UUID.
| Method | Path | Auth | Does |
|---|---|---|---|
| `GET` | `/api/agents/:id/bundles` | public | List the agent's active bundles |
+| `GET` | `/api/agents/:id/bundles?include_inactive=1` | owner | The same list with paused bundles included |
| `GET` | `/api/agents/:id/bundles?action=pricing&skills=a,b` | public | Price a candidate bundle against real sales |
| `POST` | `/api/agents/:id/bundles` | owner | Publish a bundle |
| `PATCH` | `/api/agents/:id/bundles/:bundleId` | owner | Rename, reprice, or change its skills |
@@ -135,6 +136,13 @@ fifty. The response is `201` with the created bundle and its skills.
`DELETE` sets `is_active = false`. Buyers who already paid keep their access,
because access lives on their `skill_purchases` rows, not on the bundle.
+Pausing is reversible. `PATCH` with `{"is_active": true}` puts the bundle back on
+sale, and `include_inactive=1` is how you find it again: the plain `GET` is the
+buyer-facing list and stays active-only, so a paused bundle is returned only to a
+session that owns the agent. Anyone else passing the flag gets the public list
+unchanged. The builder page uses exactly this, which is why a paused bundle stays
+on screen, dimmed, with a **Reactivate** button.
+
---
## Checkout
diff --git a/pages/asl-alphabet.html b/pages/asl-alphabet.html
index a8e4a8909..d249f6834 100644
--- a/pages/asl-alphabet.html
+++ b/pages/asl-alphabet.html
@@ -59,11 +59,16 @@
aspect-ratio: 4 / 5; min-height: 360px;
}
#aa-stage { position: absolute; inset: 0; width: 100%; height: 100%; }
+ /* A readable chip, not a gradient scrim. The avatar behind it can be any
+ colour (a pale shirt, a light-theme backdrop), so the status carries its
+ own opaque ground rather than borrowing contrast from the render. */
.aa-status {
- position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 16px;
- font-family: var(--font-mono); font-size: 13px; color: #fff;
- background: linear-gradient(to top, rgba(0,0,0,.6), transparent); pointer-events: none; min-height: 20px;
+ position: absolute; left: 10px; right: 10px; bottom: 10px; padding: 9px 12px;
+ font-family: var(--font-mono); font-size: 13px; line-height: 1.45; color: #fff;
+ background: rgba(6, 12, 20, .84); border: 1px solid rgba(255,255,255,.14);
+ border-radius: 12px; backdrop-filter: blur(6px); pointer-events: none;
}
+ .aa-status:empty { display: none; }
/* The letter card */
.aa-card { border: 1px solid var(--stroke); border-radius: 18px; background: var(--surface-1); padding: 20px 22px; margin-top: 22px; }
@@ -122,8 +127,9 @@
border: 1px solid var(--stroke); background: var(--surface-2);
}
- /* Spell + practice */
- .aa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: clamp(36px, 5vw, 60px); }
+ /* Spell + practice. Each panel keeps its own height: stretching the
+ shorter one to match left a large empty box beside the drill. */
+ .aa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; margin-top: clamp(36px, 5vw, 60px); }
.aa-panel { min-width: 0; border: 1px solid var(--stroke); border-radius: 18px; background: var(--surface-1); padding: clamp(20px, 3vw, 28px); }
.aa-panel h2 { font-size: clamp(19px, 2vw, 24px); margin: 0 0 8px; letter-spacing: -.02em; }
.aa-panel p { color: var(--ink-dim); font-size: 14px; line-height: 1.6; margin: 0 0 16px; }
@@ -161,6 +167,19 @@
.aa-feedback[data-state='right'] { border-color: rgba(56,211,159,.6); color: var(--ink); }
.aa-feedback[data-state='wrong'] { border-color: rgba(239,68,68,.55); color: var(--ink); }
.aa-feedback[data-state='asking'], .aa-feedback[data-state='shown'] { border-color: rgba(56,189,248,.5); }
+ /* The word laid out as the hand spells it: the letter on stage lights up
+ here as well as on the keyboard, so the reader can follow a long word
+ without scrolling back up to the A-to-Z grid. */
+ .aa-trail { display: flex; flex-wrap: wrap; gap: 5px; }
+ .aa-trail-ch {
+ min-width: 26px; padding: 3px 0; text-align: center; border-radius: 7px;
+ font-family: var(--font-mono); font-size: 14px; font-weight: 600;
+ border: 1px solid var(--stroke); background: var(--surface-2); color: var(--ink-dim);
+ transition: color .12s ease, background .12s ease, border-color .12s ease;
+ }
+ .aa-trail-ch[data-live='true'] { color: #04121c; background: #38bdf8; border-color: #38bdf8; }
+ .aa-trail-ch[data-space='true'] { border-color: transparent; background: transparent; }
+
.aa-practice-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
/* An unusable drill dims its controls, never its explanation: the text
is the one thing a visitor in that state actually needs to read. */
@@ -274,6 +293,9 @@
/>
<button id="aa-spell-btn" class="aa-btn" type="button">🤟 Spell it</button>
</div>
+ <div class="aa-feedback" id="aa-spell-feedback" role="status" aria-live="polite">
+ Type a word and the letters appear here as the hand reaches them.
+ </div>
</section>
<section class="aa-panel" id="aa-practice" aria-label="Practice reading fingerspelling">
diff --git a/public/choreograph.css b/public/choreograph.css
index af498c858..24d332e9d 100644
--- a/public/choreograph.css
+++ b/public/choreograph.css
@@ -1009,6 +1009,13 @@
border-radius: 10px;
background: var(--ch-surface-2);
overflow-x: auto;
+ /* The block scrolls its own long lines, but its intrinsic width still
+ counted toward the page's min-content size, and `main` sits in a flex
+ column where that min-content wins over the viewport. One line of the
+ embed snippet is wider than a 320px phone, so the whole page scrolled
+ sideways. Containment says out loud what `overflow-x` already implies:
+ this box's width does not depend on what is inside it. */
+ contain: inline-size;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 12px;
line-height: 1.55;
diff --git a/public/tokens.css b/public/tokens.css
index 37a462f06..994e23fcf 100644
--- a/public/tokens.css
+++ b/public/tokens.css
@@ -446,6 +446,17 @@
--text-3: #888f9c;
--text-4: #aab0bc;
--nv-bar-bg: rgba(255, 255, 255, 0.82);
+
+ /* Wallet identity accent. The dark palette's pale violets (#c4b5fd text,
+ #a78bfa vanity) were never remapped for light, so every wallet chip on a
+ light surface rendered its address at 1.7:1 against the card: unreadable,
+ and well under the 4.5:1 AA floor for the 11px type it uses. Darkening the
+ two ink tokens to the violet-600/700 rungs keeps the violet identity that
+ marks wallet UI across the app and measures 5.3:1 and 6.6:1. The fills,
+ strokes and glow are alpha-based on the same 139,92,246 hue and already
+ composite correctly on a light canvas, so they stay put. */
+ --wallet-accent: #6d28d9;
+ --wallet-accent-strong: #5b21b6;
}
@media (prefers-reduced-motion: reduce) {
diff --git a/scripts/capture-bundles-media.mjs b/scripts/capture-bundles-media.mjs
index 3180dc24a..fd0ecab1f 100644
--- a/scripts/capture-bundles-media.mjs
+++ b/scripts/capture-bundles-media.mjs
@@ -69,9 +69,14 @@ try {
const ctx = await browser.newContext({ viewport: { width: 1280, height: 1000 }, deviceScaleFactor: 2 });
const p = await ctx.newPage();
await p.goto(`${base}/login?next=%2Fbundles`, { waitUntil: 'networkidle' });
- await p.fill('input[type="email"], input[name="email"]', EMAIL);
- await p.fill('input[type="password"], input[name="password"]', PASSWORD);
- await p.click('button[type="submit"]');
+ // The classic email/password form by id, not by input type. /login also
+ // renders a Privy passwordless widget whose own `input[type="email"]`
+ // comes first in the DOM, so a type-based selector filled that one
+ // instead and every authenticated shot below was silently skipped.
+ await p.waitForSelector('#email', { timeout: 20000 });
+ await p.fill('#email', EMAIL);
+ await p.fill('#password', PASSWORD);
+ await p.click('form button[type="submit"]');
await p.waitForURL(/\/bundles/, { timeout: 30000 }).catch(() => {});
await p.waitForSelector('#bd-builder:not(.bd-hide), #bd-gate:not(.bd-hide)', { timeout: 20000 });
diff --git a/src/asl-alphabet-page.js b/src/asl-alphabet-page.js
index 6ebd7da6e..4c94676db 100644
--- a/src/asl-alphabet-page.js
+++ b/src/asl-alphabet-page.js
@@ -42,6 +42,16 @@ async function boot() {
const stageHost = $('#aa-stage');
if (!stageHost) return;
+ // A shared link names the letter the visitor came for, so it is read before
+ // anything is built. Seeding the card from it is the difference between a
+ // /asl-alphabet?letter=W link showing W's description immediately and showing
+ // A's description for the whole length of the rig download.
+ const params = new URLSearchParams(location.search);
+ const linkedLetter = (params.get('letter') || '').toUpperCase().slice(0, 1);
+ const rawWord = (params.get('spell') || '').slice(0, 24);
+ const linkedWord = normalizeWord(rawWord) ? rawWord : '';
+ const linkedFirst = normalizeWord(linkedWord).replace(/\s+/g, '').slice(0, 1);
+
const prefs = loadSignPrefs();
let avatar = resolveRig(prefs);
let rate = SPEEDS.some((s) => s.rate === prefs.rate) ? prefs.rate : 1;
@@ -91,11 +101,19 @@ async function boot() {
return canSign;
};
+ // Why the avatar cannot sign right now, phrased for whichever panel is asking.
+ // Both the stage status and the spell panel need it, and a visitor scrolled
+ // down to the spell box never sees a message left on the stage.
+ const stageProblem = () =>
+ stageState === 'loading'
+ ? 'The avatar is still loading: the description is ready now, the handshape follows.'
+ : 'The avatar could not load. Reload the page to try again: every letter is still described in words.';
+
// ── Playing letters and words ────────────────────────────────────────────
const clearHighlights = () => {
highlightTimers.forEach((t) => clearTimeout(t));
highlightTimers = [];
- document.querySelectorAll('.aa-key[data-live="true"]').forEach((el) => el.removeAttribute('data-live'));
+ clearHighlightsOnly();
};
/**
@@ -103,18 +121,14 @@ async function boot() {
* Marks come from the clip builder itself, so the highlight is the real
* cadence rather than an animation guessed alongside it.
*/
- const play = async (text, { describe = true } = {}) => {
+ const play = async (text, { describe = true, trail = false } = {}) => {
const letters = normalizeWord(text);
if (!letters) {
setStatus('Letters and numbers only: that is all the manual alphabet can spell.');
return null;
}
if (!stage?.anim || !canSign) {
- setStatus(
- stageState === 'loading'
- ? 'The avatar is still loading: the description is ready now, the handshape follows.'
- : 'The avatar could not load. Reload the page to try again: every letter is still described in words.',
- );
+ setStatus(stageProblem());
return null;
}
const token = ++playToken;
@@ -137,22 +151,27 @@ async function boot() {
// a word hands the avatar back to its idle when the spelling is done.
stage.anim.playOnce(name, single ? { settleTo: null } : {});
+ // The trail is built from `marks` rather than from the word, so its cells
+ // line up with the clip one-for-one even when a letter repeats.
+ const trailCells = trail ? renderTrail(marks) : [];
+
const startedAt = performance.now();
- for (const mark of marks) {
- if (mark.letter === ' ') continue;
+ marks.forEach((mark, i) => {
+ if (mark.letter === ' ') return;
highlightTimers.push(
window.setTimeout(() => {
if (token !== playToken) return;
clearHighlightsOnly();
const key = document.querySelector(`.aa-key[data-char="${mark.letter}"]`);
key?.setAttribute('data-live', 'true');
+ trailCells[i]?.setAttribute('data-live', 'true');
// The card follows the spelling, but the share link keeps
// pointing at the whole word rather than whichever letter
// the hand happened to be on when Share was clicked.
if (describe) showLetter(mark.letter, { quiet: true, share: false });
}, Math.max(0, mark.start * 1000 - (performance.now() - startedAt))),
);
- }
+ });
highlightTimers.push(
window.setTimeout(() => {
if (token === playToken) clearHighlightsOnly();
@@ -163,6 +182,7 @@ async function boot() {
const clearHighlightsOnly = () => {
document.querySelectorAll('.aa-key[data-live="true"]').forEach((el) => el.removeAttribute('data-live'));
+ document.querySelectorAll('.aa-trail-ch[data-live="true"]').forEach((el) => el.removeAttribute('data-live'));
};
// ── The letter detail card ───────────────────────────────────────────────
@@ -223,13 +243,20 @@ async function boot() {
buildKeys('#aa-digits', DIGITS);
// Populate the card before the rig is fetched: the look-alike note, the
// pressed key and the share link are all readable while the GLB downloads.
- showLetter('A', { quiet: true });
+ // A deep link decides which letter that is, so a link never opens on the
+ // wrong description and corrects itself minutes later on a slow connection.
+ const seeded = [linkedLetter, linkedFirst].find((c) => CHARS.includes(c)) || 'A';
+ showLetter(seeded, { quiet: true });
// Typing a letter signs it: the fastest possible path from "what is a Q"
// to seeing a Q, with no pointer involved.
document.addEventListener('keydown', (e) => {
- const typing = /^(input|textarea)$/i.test(e.target?.tagName || '');
- if (typing || e.metaKey || e.ctrlKey || e.altKey) return;
+ const typing = /^(input|textarea|select)$/i.test(e.target?.tagName || '') || e.target?.isContentEditable;
+ // An open modal (the avatar picker) owns the keyboard. Signing behind it
+ // both swallows the dialog's own key handling and animates a letter the
+ // visitor cannot see.
+ const modal = document.querySelector('[aria-modal="true"], dialog[open]');
+ if (typing || modal || e.metaKey || e.ctrlKey || e.altKey) return;
const char = e.key.toUpperCase();
if (!CHARS.includes(char)) return;
e.preventDefault();
@@ -237,25 +264,56 @@ async function boot() {
});
// ── Spell a word ─────────────────────────────────────────────────────────
+ // The panel answers in its own line rather than only on the stage overlay.
+ // The overlay sits beside the avatar, a viewport above this box on a phone,
+ // so a rejected word used to change nothing the visitor could see.
const spellInput = $('#aa-spell-input');
const spellBtn = $('#aa-spell-btn');
+ const spellFeedback = $('#aa-spell-feedback');
+
+ const saySpell = (text, state) => {
+ if (!spellFeedback) return;
+ spellFeedback.textContent = text;
+ spellFeedback.dataset.state = state;
+ };
+
+ /** Lay the spelling out as cells and hand them back in clip order. */
+ function renderTrail(marks) {
+ if (!spellFeedback) return [];
+ spellFeedback.textContent = '';
+ spellFeedback.dataset.state = 'shown';
+ const row = document.createElement('span');
+ row.className = 'aa-trail';
+ const cells = marks.map((mark) => {
+ const cell = document.createElement('span');
+ cell.className = 'aa-trail-ch';
+ const space = mark.letter === ' ';
+ cell.textContent = space ? ' ' : mark.letter;
+ if (space) cell.setAttribute('data-space', 'true');
+ row.appendChild(cell);
+ return cell;
+ });
+ spellFeedback.appendChild(row);
+ return cells;
+ }
+
const spellIt = async () => {
const raw = spellInput?.value?.trim();
if (!raw) {
- setStatus('Type a word and the avatar spells it, letter by letter.');
+ saySpell('Type a word first: a name, a city, anything with no sign of its own.', 'wrong');
spellInput?.focus();
return;
}
const normalized = normalizeWord(raw);
if (!normalized) {
- setStatus('Letters and numbers only: that is all the manual alphabet can spell.');
+ saySpell('Letters and numbers only: that is all the manual alphabet can spell.', 'wrong');
spellInput?.focus();
return;
}
setStatus(`Spelling ${normalized.toLowerCase()}`);
shareTarget = { param: 'spell', value: normalized };
if (shareBtn) shareBtn.hidden = false;
- await play(normalized);
+ if (!(await play(normalized, { trail: true }))) saySpell(stageProblem(), 'wrong');
};
spellBtn?.addEventListener('click', spellIt);
spellInput?.addEventListener('keydown', (e) => {
@@ -264,6 +322,12 @@ async function boot() {
spellIt();
}
});
+ // A shared spelling arrives in the box straight away, so the link reads as
+ // itself while the rig is still downloading.
+ if (linkedWord) {
+ if (spellInput) spellInput.value = linkedWord;
+ shareTarget = { param: 'spell', value: normalizeWord(linkedWord) };
+ }
shareBtn?.addEventListener('click', async () => {
const { param, value } = shareTarget;
@@ -466,8 +530,11 @@ async function boot() {
persist();
setStatus('Loading avatar…');
if (await mountStage()) {
+ // Say the swap landed. Replaying the letter is silent, so without
+ // this the stage sat under "Loading avatar…" for the rest of the
+ // visit, and a screen reader was never told the load had finished.
+ setStatus(`${picked.label} is forming the letters now.`);
if (current) play(current, { describe: false });
- else if (picked.custom) setStatus(`${picked.label} is forming the letters now.`);
return true;
}
// No finger bones means no handshapes, and a hand that cannot move is
@@ -502,16 +569,14 @@ async function boot() {
};
if (canSign) await waitForIdleClip();
- const params = new URLSearchParams(location.search);
- const wanted = (params.get('letter') || '').toUpperCase().slice(0, 1);
- const wantedWord = params.get('spell') || '';
- if (wantedWord && normalizeWord(wantedWord)) {
- if (spellInput) spellInput.value = wantedWord.slice(0, 24);
+ // The card was seeded from these at build time; what is left is the playback,
+ // which is the only part that had to wait for a rig.
+ if (linkedWord) {
if (!reducedMotion) spellIt();
- else setStatus(`Ready to spell ${normalizeWord(wantedWord).toLowerCase()}. Press Spell it.`);
- } else if (CHARS.includes(wanted)) {
- if (!reducedMotion) signLetter(wanted);
- else showLetter(wanted);
+ else setStatus(`Ready to spell ${normalizeWord(linkedWord).toLowerCase()}. Press Spell it.`);
+ } else if (CHARS.includes(linkedLetter)) {
+ if (!reducedMotion) signLetter(linkedLetter);
+ else showLetter(linkedLetter);
} else if (userPicked) {
// Someone who pressed a key while the rig was still downloading has
// already chosen: sign what they asked for rather than resetting to A.
diff --git a/src/choreograph-page.js b/src/choreograph-page.js
index fcc6cba7e..3d2685ce5 100644
--- a/src/choreograph-page.js
+++ b/src/choreograph-page.js
@@ -72,6 +72,12 @@ const state = {
raf: 0,
lastT: 0,
stagedClip: null, // clip currently mounted on the stage
+ /** True while a play is still binding its clips and nothing is on stage yet. */
+ starting: false,
+ /** Bumped by every start and every stop, so work that was already in flight
+ * when the user changed their mind can tell that it no longer owns the
+ * stage. Binding a cold routine takes seconds; a lot can happen in them. */
+ startGen: 0,
agents: null, // null = not fetched, [] = signed out or none
dragIndex: -1,
loadedFromLink: false,
@@ -122,13 +128,31 @@ async function loadManifest() {
}
/**
- * The signed-in user's agents. A 401 is the ordinary signed-out case, not an
- * error: the whole page works without an account.
+ * The signed-in user's agents. Being signed out is the ordinary case here, not
+ * an error: the whole page works without an account, and only the save panel
+ * needs to know. `/api/auth/me` answers 200 either way, so asking it first keeps
+ * an anonymous visitor's console clean instead of printing a red 401 from
+ * `/api/agents` on every first paint.
*/
async function loadAgents() {
try {
- const res = await fetch('/api/agents', {
- credentials: 'include',
+ const { apiFetch, noteSession } = await import('./api.js');
+ const who = await apiFetch('/api/auth/me', {
+ allowAnonymous: true,
+ headers: { accept: 'application/json' },
+ });
+ const user = who.ok ? (await who.json()).user : null;
+ noteSession(!!user);
+ if (!user) {
+ state.agents = [];
+ renderSave();
+ return;
+ }
+ // allowAnonymous keeps a session that expired mid-edit from bouncing the
+ // composer to /login: the save panel simply falls back to its signed-out
+ // state and the routine on screen survives.
+ const res = await apiFetch('/api/agents', {
+ allowAnonymous: true,
headers: { accept: 'application/json' },
});
state.agents = res.ok ? ((await res.json()).agents ?? []) : [];
@@ -519,6 +543,7 @@ async function stageStep(step, { crossfade = true } = {}) {
setStageState('error', `"${stepClip(step)}" is not in the clip manifest.`);
return;
}
+ const gen = state.startGen;
const preview = await getPreview();
const bounds = state.boundClips || [];
try {
@@ -527,11 +552,15 @@ async function stageStep(step, { crossfade = true } = {}) {
crossfade: crossfade && state.stagedClip ? CROSSFADE : 0,
frameWith: bounds.filter(Boolean),
});
+ // Stopped or restarted while this clip was binding: whatever is on the
+ // stage now is the routine the user asked for, so leave it alone.
+ if (gen !== state.startGen) return;
state.stagedClip = def.id;
setStageState('none');
el('stage-badge').hidden = false;
el('stage-badge').textContent = `${step.slot} · ${clipLabel(def.id)}`;
} catch (err) {
+ if (gen !== state.startGen) return;
setStageState('error', err?.message ? `Preview failed: ${err.message}` : undefined);
}
}
@@ -543,9 +572,15 @@ async function prepareClips(routine) {
state.boundClips = await preview.prepare(defs);
}
+/**
+ * Cue the routine and start it.
+ * @param {number} [fromIndex] step to open on
+ * @returns {Promise<boolean>} false when a newer start or a stop took the stage
+ * before this one finished binding, so callers can skip their follow-up.
+ */
async function startPlayback(fromIndex = 0) {
const routine = currentRoutine();
- if (!routine) return;
+ if (!routine) return false;
stopRaf();
el('stage-loading-text').textContent =
@@ -555,8 +590,12 @@ async function startPlayback(fromIndex = 0) {
// take seconds on a cold first play, and a play button that still reads "▶"
// while the stage spins reads as a click that did not register.
setPlayButton(true);
+ state.starting = true;
+ const gen = ++state.startGen;
await prepareClips(routine);
+ if (gen !== state.startGen) return false;
+ state.starting = false;
state.player = new RoutinePlayer(routine, {
loop: state.loop,
@@ -577,6 +616,7 @@ async function startPlayback(fromIndex = 0) {
setPlayButton(true);
startRaf();
setStatus(`Playing ${routine.name}, ${routine.steps.length} steps.`);
+ return true;
}
function playFrom(index) {
@@ -585,6 +625,8 @@ function playFrom(index) {
function stopPlayback() {
stopRaf();
+ state.startGen++;
+ state.starting = false;
state.player = null;
state.stagedClip = null;
state.preview?.stop();
@@ -606,8 +648,8 @@ function restageIfPlaying() {
stopPlayback();
return;
}
- startPlayback(0).then(() => {
- if (!state.player) return;
+ startPlayback(0).then((ok) => {
+ if (!ok || !state.player) return;
state.player.seek(Math.min(at, routineDuration(routine)));
if (!wasPlaying) {
state.player.pause();
@@ -644,6 +686,15 @@ function stopRaf() {
function togglePlay() {
if (!state.steps.length) return;
+ if (state.starting) {
+ // The transport already reads "pause" while the clips bind, so pressing it
+ // has to call that load off. Without this it would queue a second copy of
+ // the same load behind the first and leave the user watching the spinner
+ // they were trying to dismiss.
+ stopPlayback();
+ setStatus('Stopped before the routine started.');
+ return;
+ }
if (!state.player) {
startPlayback(0);
return;
@@ -667,7 +718,8 @@ function scrubTo(seconds) {
const routine = currentRoutine();
if (!routine) return;
if (!state.player) {
- startPlayback(0).then(() => {
+ startPlayback(0).then((ok) => {
+ if (!ok) return;
state.player?.seek(seconds);
state.player?.pause();
setPlayButton(false);
@@ -682,11 +734,37 @@ function scrubTo(seconds) {
/* ── url state ─────────────────────────────────────────────────────────── */
+/** The query key a routine travels in. */
+const ROUTINE_PARAM = 'r';
+
+/**
+ * The raw `?r=` value, read without decoding it.
+ *
+ * `encodeRoutine` already escapes the routine name, and the `|` `,` `:` `*` `@`
+ * it separates steps with are all legal in a query string, so the encoded
+ * routine belongs in the URL verbatim. Handing it to `URLSearchParams` instead
+ * would escape its percent signs a second time, so the share link for a routine
+ * called "The pitch" read `?r=The%2520pitch|…`, and reading it back through
+ * `URLSearchParams.get` would strip exactly one layer, turning a name that
+ * legitimately contains an escaped `|` into a raw bar that splits the routine on
+ * the wrong character.
+ *
+ * @returns {string|null}
+ */
+function readEncodedRoutine() {
+ for (const pair of window.location.search.replace(/^\?/, '').split('&')) {
+ if (pair.startsWith(`${ROUTINE_PARAM}=`)) return pair.slice(ROUTINE_PARAM.length + 1);
+ }
+ return null;
+}
+
function syncUrl() {
const routine = currentRoutine();
const url = new URL(window.location.href);
- if (routine) url.searchParams.set('r', encodeRoutine(routine));
- else url.searchParams.delete('r');
+ url.searchParams.delete(ROUTINE_PARAM);
+ const others = url.searchParams.toString();
+ const mine = routine ? `${ROUTINE_PARAM}=${encodeRoutine(routine)}` : '';
+ url.search = [others, mine].filter(Boolean).join('&');
window.history.replaceState(null, '', url);
}
@@ -711,16 +789,30 @@ function loadRoutine(routine, { announce = true } = {}) {
* point instead" belong in one sentence, not two that overwrite each other.
*/
function applyDeepLink() {
- const encoded = new URLSearchParams(window.location.search).get('r');
+ const encoded = readEncodedRoutine();
if (!encoded) return null;
+ // Links shared before the studio wrote its own query carry one extra layer of
+ // escaping. A value that does not parse as-is gets one decode and a second
+ // chance, so every link that used to work still does.
+ const candidates = [encoded];
try {
- loadRoutine(decodeRoutine(encoded), { announce: false });
- setStatus(`Loaded a shared routine: ${state.name}.`);
- state.loadedFromLink = true;
- return null;
- } catch (err) {
- return err.message;
+ const once = decodeURIComponent(encoded);
+ if (once !== encoded) candidates.push(once);
+ } catch {
+ // A lone percent sign means it was never double-escaped: nothing to retry.
+ }
+ let firstError = null;
+ for (const candidate of candidates) {
+ try {
+ loadRoutine(decodeRoutine(candidate), { announce: false });
+ setStatus(`Loaded a shared routine: ${state.name}.`);
+ state.loadedFromLink = true;
+ return null;
+ } catch (err) {
+ firstError ??= err.message;
+ }
}
+ return firstError;
}
/* ── saving ────────────────────────────────────────────────────────────── */
diff --git a/src/runtime/choreography.js b/src/runtime/choreography.js
index e28f51d84..83c770c10 100644
--- a/src/runtime/choreography.js
+++ b/src/runtime/choreography.js
@@ -239,7 +239,11 @@ function decodeStep(text) {
export function encodeRoutine(routine) {
const r = normalizeRoutine(routine);
const steps = r.steps.map(encodeStep).join(',');
- return `${encodeURIComponent(r.name)}${r.loop ? '~loop' : ''}|${steps}`;
+ // `encodeURIComponent` leaves `~` alone, which would let a routine actually
+ // named "Encore~loop" encode to the same text as a looping "Encore" and come
+ // back decoded as the wrong routine. Escape it so the marker is unambiguous.
+ const name = encodeURIComponent(r.name).replace(/~/g, '%7E');
+ return `${name}${r.loop ? '~loop' : ''}|${steps}`;
}
/**