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: harden pump dashboard + home observers, register new pages, refresh docs
nirholas168533b3fa95
diff --git a/api/_lib/env.js b/api/_lib/env.jsindex 42219faab..97f529457 100644--- a/api/_lib/env.js+++ b/api/_lib/env.js@@ -424,6 +424,13 @@ export const env = {return match ? match[1] : '';},+ // Birdeye API key — used by pump/dashboard and three-token to read live+ // price / market / trade data. Optional: handlers degrade to an explicit+ // "data unavailable" response when it's absent rather than crashing.+ get BIRDEYE_API_KEY() {+ return opt('BIRDEYE_API_KEY', '');+ },+// Solana devnet RPC URL. Falls back to the public devnet endpoint.get SOLANA_RPC_URL_DEVNET() {return opt('SOLANA_RPC_URL_DEVNET', 'https://api.devnet.solana.com');diff --git a/api/pump/dashboard.js b/api/pump/dashboard.jsindex c50d3342e..412c78177 100644--- a/api/pump/dashboard.js+++ b/api/pump/dashboard.js@@ -51,6 +51,10 @@ export default wrap(async (req, res) => {const tokenMint = agent.meta?.token?.mint;if (!tokenMint) return error(res, 404, 'token not launched for this agent');+ if (!BIRDEYE_API_KEY) {+ return error(res, 503, 'not_configured', 'On-chain data provider is not configured');+ }+const headers = { 'X-API-KEY': BIRDEYE_API_KEY };try {@@ -61,7 +65,7 @@ export default wrap(async (req, res) => {return json(res, 200, {price: price.data,- history: history.data.items,+ history: history?.data?.items ?? [],});} catch (e) {diff --git a/data/pages.json b/data/pages.jsonindex 9a22f88cc..33beacb71 100644--- a/data/pages.json+++ b/data/pages.json@@ -317,6 +317,22 @@"changefreq": "daily","added": "2026-05-25"},+ {+ "path": "/arbitrage",+ "title": "x402 Arbitrage",+ "description": "Cross-provider price disparities surfaced live from the merged x402 facilitator catalog. Find the cheapest endpoint for any capability.",+ "priority": 0.7,+ "changefreq": "daily",+ "added": "2026-05-29"+ },+ {+ "path": "/providers",+ "title": "x402 Providers",+ "description": "Quantified operator profiles for the x402 paid API catalog. Service counts, price bands, dominant categories, and the underlying listings.",+ "priority": 0.7,+ "changefreq": "daily",+ "added": "2026-05-29"+ },{"path": "/gmgn","title": "GMGN Smart Money",@@ -348,6 +364,14 @@"priority": 0.8,"changefreq": "weekly","added": "2026-05-27"+ },+ {+ "path": "/forever",+ "title": "Forever — etch a message into Bitcoin",+ "description": "Inscribe a message onto the Bitcoin blockchain. It stays there. Forever.",+ "priority": 0.6,+ "changefreq": "monthly",+ "added": "2026-05-29"}]},diff --git a/public/docs/agent-manifest.md b/public/docs/agent-manifest.mdindex fc0c57960..ff8e07158 100644--- a/public/docs/agent-manifest.md+++ b/public/docs/agent-manifest.md@@ -44,7 +44,7 @@ The `<agent-3d>` element accepts several source forms. Priority when multiple at<agent-3d manifest="https://cdn.acme.com/aria/manifest.json"></agent-3d><!-- Backend agent ID (platform-hosted) -->-<agent-three.ws-id="aria-guide"></agent-3d>+<agent-3d agent-id="aria-guide"></agent-3d><!-- Bare GLB — no manifest, viewer mode only --><agent-3d body="./product.glb"></agent-3d>@@ -97,7 +97,7 @@ const manifest = await loadManifest('https://cdn.acme.com/aria/manifest.json');"brain": {"provider": "anthropic",- "model": "claude-opus-4-6",+ "model": "claude-opus-4-7","instructions": "instructions.md","temperature": 0.7,"maxTokens": 4096,@@ -251,7 +251,7 @@ LLM runtime configuration. When omitted, the agent is reactive-only (skills and| Field | Type | Required | Default | Description ||----------------|--------|----------|---------|-------------|| `provider` | string | Yes | `"none"` | `"anthropic"`, `"openai"`, `"local"`, or `"none"`. Use `"none"` for a purely reactive avatar. |-| `model` | string | No | — | Model ID, e.g. `"claude-opus-4-6"`. |+| `model` | string | No | — | Model ID, e.g. `"claude-opus-4-7"`. || `instructions` | string | No | — | Relative path to a Markdown file (`instructions.md`) that contains the system prompt. Frontmatter in the file can override any `brain.*` field. || `temperature` | number | No | 0.7 | LLM sampling temperature (0–1). || `maxTokens` | number | No | 4096 | Max tokens per response. |@@ -262,7 +262,7 @@ LLM runtime configuration. When omitted, the agent is reactive-only (skills and```markdown---name: Coach Leo-model: claude-opus-4-6+model: claude-opus-4-7temperature: 0.8---@@ -558,7 +558,7 @@ Load it:},"brain": {"provider": "anthropic",- "model": "claude-opus-4-6",+ "model": "claude-opus-4-7","instructions": "instructions.md","temperature": 0.8,"maxTokens": 2048@@ -598,7 +598,7 @@ Load it:},"brain": {"provider": "anthropic",- "model": "claude-opus-4-6",+ "model": "claude-opus-4-7","instructions": "instructions.md"},"voice": {diff --git a/public/docs/agent-system.md b/public/docs/agent-system.mdindex f8c2c8f6b..2acd115d8 100644--- a/public/docs/agent-system.md+++ b/public/docs/agent-system.md@@ -369,7 +369,7 @@ The minimum manifest to run an agent:},"brain": {"provider": "anthropic",- "model": "claude-opus-4-6",+ "model": "claude-opus-4-7","instructions": "You are Aria, a friendly guide. Be concise and helpful."},"voice": {@@ -400,7 +400,7 @@ A manifest with an on-chain identity, external skills, and ElevenLabs voice:},"brain": {"provider": "anthropic",- "model": "claude-opus-4-6",+ "model": "claude-opus-4-7","instructions": "instructions.md","temperature": 0.8},diff --git a/public/docs/api-reference.md b/public/docs/api-reference.mdindex cebd61543..a2dda9e7e 100644--- a/public/docs/api-reference.md+++ b/public/docs/api-reference.md@@ -1,7 +1,11 @@-# API Reference+# REST API ReferenceBase URL: `https://three.ws/api`+> For the in-browser JavaScript API (the `<agent-3d>` element, `Viewer`, `Runtime`, `SceneController`, skills, memory), see [js-api.md](./js-api.md) and [web-component.md](./web-component.md). For the high-level npm SDK, see [sdk.md](./sdk.md).++The full machine-readable schema lives at [`https://three.ws/.well-known/openapi.yaml`](https://three.ws/.well-known/openapi.yaml). x402 paid endpoints are listed at [`/.well-known/x402.json`](https://three.ws/.well-known/x402.json) and the MCP endpoint is at [`/api/mcp`](https://three.ws/api/mcp).+---## Overview@@ -558,33 +562,60 @@ Usage events (token counts, latency, triggered actions) are recorded after each----### We-pay LLM proxy+### Brain proxy (multi-provider LLM)```-POST /api/llm/anthropic?agent=<agent_id>+POST /api/brain/chat+```++Server-Sent Events stream from a unified multi-provider LLM gateway. Used by the `<agent-3d>` element when `brain="…"` is set without a custom `key-proxy`. The "we-pay" mode deducts from the agent's monthly token budget and enforces the agent's embed policy (allowed origins, allowed surfaces).++**Request body**++```json+{+ "provider": "claude-sonnet-4-6",+ "messages": [{ "role": "user", "content": "Hello" }],+ "system": "You are a friendly product guide.",+ "maxTokens": 1024+}```-"We-pay" proxy. Enforces the agent's embed policy (allowed origins, allowed surfaces, brain mode) and deducts from the agent's monthly token budget. The request body is always Anthropic-shape; the server inspects `model` and routes to Anthropic, Groq, or OpenRouter, translating wire formats both ways so the response stream is also Anthropic-shape.+**Supported `provider` IDs**-Requires that the calling origin is listed in the agent's declared `origins`. Wildcard patterns are supported.+| Provider | Network | Tier |+|---|---|---|+| `claude-opus-4-7` | Anthropic | flagship |+| `claude-sonnet-4-6` | Anthropic | balanced |+| `claude-haiku-4-5` | Anthropic | fast |+| `gpt-4o` | OpenAI | flagship |+| `gpt-4o-mini` | OpenAI | fast |+| `qwen-*` | Qwen / Alibaba | varies |+| `openrouter:*` | OpenRouter (any) | varies |-**Supported models**+Call `GET /api/brain/chat` for the live list of providers actually available on the current deployment (depends on which provider keys are configured).-| Model ID | Upstream | Cost |-|----------|----------|------|-| `meta-llama/llama-3.3-70b-instruct:free` | OpenRouter | free (default) |-| `openai/gpt-oss-120b:free` | OpenRouter | free |-| `nousresearch/hermes-3-llama-3.1-405b:free` | OpenRouter | free |-| `llama-3.3-70b-versatile` | Groq | free, sub-second |-| `llama-3.1-8b-instant` | Groq | free, fastest |-| `claude-haiku-4-5-20251001` | Anthropic | paid |-| `claude-sonnet-4-6` | Anthropic | paid |-| `claude-opus-4-6` | Anthropic | paid |-| `claude-opus-4-7` | Anthropic | paid |+**Response (SSE)**-Request and response format match the [Anthropic Messages API](https://docs.anthropic.com/en/api/messages) exactly. Free-model routes are translated server-side. Upstream errors are sanitized before being returned to the client.+| Event | Payload |+|---|---|+| `meta` | `{ provider, label, network, model, tier }` |+| `first` | `{ firstTokenMs }` |+| (data) | JSON-encoded text chunk |+| `done` | `{ elapsedMs, firstTokenMs, usage }` |+| `error` | `{ message, elapsedMs }` |-**Rate limits:** Per-IP and per-agent limits apply in addition to the standard platform limits.+**Rate limits:** Per-IP and per-agent limits apply in addition to the standard platform limits. Failed upstream calls automatically fall back to OpenRouter where possible.++---++### Direct Anthropic proxy (legacy)++```+POST /api/llm/anthropic?agent=<agent_id>+```++Older single-provider proxy. Request/response shape matches the [Anthropic Messages API](https://docs.anthropic.com/en/api/messages) exactly. New integrations should use `/api/brain/chat` instead — it supports more providers and emits richer events.---@@ -870,6 +901,59 @@ See MCP documentation for full tool schemas and response shapes.---+## x402 Paid Endpoints — Sign-In-With-X (SIWX)++Every paid endpoint under `/api/x402/*` is built on the shared `paidEndpoint()` helper. Endpoints can opt into **Sign-In-With-X** (SIWX, CAIP-122) so a wallet that has already paid for a resource can re-access it by signing a message — no second on-chain payment.++### How it works++1. **First call.** The client has no payment header. The server returns a `402 Payment Required` whose body declares both the `accepts[]` payment requirements and a `sign-in-with-x` extension (chain list, signing statement, fresh nonce, `expirationTime`).+2. **Settle.** The client retries with `X-PAYMENT: <base64>`. The facilitator verifies and settles the USDC transfer. The server records a row in `siwx_payments` keyed by `(resource, address)`.+3. **Re-access.** Later, the same wallet sends the `SIGN-IN-WITH-X: <base64>` header instead of `X-PAYMENT`. The server parses the CAIP-122 payload, verifies the signature (EIP-191/EIP-1271/EIP-6492 for EVM via viem's `publicClient.verifyMessage`, ed25519 for Solana), checks the nonce against `siwx_nonces` for replay protection, and looks up the grant in `siwx_payments`. On match, the handler runs and the response carries `x-siwx-address: <recovered wallet>` (no `x-payment-response`).++### Opt-in for a new endpoint++Add a single `siwx:` block to `paidEndpoint(spec)`:++```js+paidEndpoint({+ route: '/api/x402/my-endpoint',+ // …other fields…+ siwx: {+ statement: 'Sign in to refresh the catalog without re-paying.',+ ttlSeconds: 24 * 3600, // grant lifetime; null = permanent+ expirationSeconds: 300, // SIWX message validity window+ },+});+```++That single declaration adds the `sign-in-with-x` extension to every 402 body, accepts the `SIGN-IN-WITH-X` header on incoming requests, and records a grant when a fresh settlement completes.++### Canonical example: `/api/x402/asset-download`++The marquee SIWX endpoint. The catalog lives in the Neon `paid_assets` table — each row carries `slug`, `r2_key`, `price_atomics`, `mime_type`, and optional per-creator payout overrides (`creator_payto_base`, `creator_payto_solana`, `creator_payto_bsc`). Buyers pay once per slug; subsequent re-downloads from the same wallet only require a signature. The response is JSON containing a short-lived presigned R2 URL — large GLBs stream directly from R2 instead of through the function.++Each asset has its own SIWX grant key: the endpoint passes a `resourceUrlBuilder` to `paidEndpoint()` that embeds the slug in the resource URI, so paying for one asset does not unlock the others.++### Operator status++`GET /api/x402-status` reports SIWX wiring under `.siwx`:++```json+{+ "siwx": {+ "configured": true,+ "paymentsRowCount": 42,+ "noncesRowCount": 17,+ "evmVerifierConfigured": true+ }+}+```++`evmVerifierConfigured: true` means `BASE_RPC_URL` is set and smart-contract wallet signatures (Coinbase Smart Wallet, Safe) will verify. Without it, only EOA signatures are accepted.++---+## Config API```@@ -927,7 +1011,7 @@ Responses always include `total`, `limit`, and `offset`.Use the official SDK instead of raw HTTP calls:```js-import { AgentAPI } from '@3dagent/sdk';+import { AgentAPI } from '@three-ws/sdk';const api = new AgentAPI({ apiKey: 'sk_live_xxxxx' });diff --git a/public/docs/avatar-creation.md b/public/docs/avatar-creation.mdindex 19872b744..269de051f 100644--- a/public/docs/avatar-creation.md+++ b/public/docs/avatar-creation.md@@ -8,17 +8,17 @@ Your agent's 3D avatar is what makes it feel real. It is the face people see, th| Path | Time | Skill required | Best for ||------|------|----------------|----------|-| Photo → Avaturn AI | 3–5 min | None | A realistic avatar that looks like you |-| Character Studio | 10–20 min | None | A stylized avatar with full creative control |+| Photo → AI avatar | 3–5 min | None | A realistic avatar that looks like you |+| Avatar builder | 10–20 min | None | A stylized avatar with full creative control || Upload your own GLB | 1 min | 3D modeling | An existing model from Blender, Mixamo, or any 3D tool |Pick one and follow its section below. All three paths produce a GLB file that gets saved to your account.----## Path 1: Photo-to-avatar (Avaturn)+## Path 1: Photo-to-avatar-The fastest way to get a personalized 3D avatar is to take a set of photos and let Avaturn's AI generate a realistic model from them.+The fastest way to get a personalized 3D avatar is to take a set of photos and let the three.ws AI generate a realistic model from them.### What you need@@ -37,7 +37,7 @@ Good lighting and a plain background give the best results. Photos can be JPEG o4. Select your preferred **body type** and **avatar style** (v1 = photorealistic, v2 = stylized)5. Click **Submit**-The photos are prepared and sent to the Avaturn pipeline. After a brief processing step, an Avaturn editor opens in a modal where you can adjust clothing, accessories, and other details before exporting.+The photos are prepared and sent to the photo avatar pipeline. After a brief processing step, an avatar editor opens in a modal where you can adjust clothing, accessories, and other details before exporting.When you click export, the GLB is fetched and saved to your three.ws account automatically.@@ -52,15 +52,15 @@ For developers who want to understand what happens under the hood:1. [selfie-capture.js](../src/selfie-capture.js) manages the two-step UI: method choice (camera vs upload) and the three photo slots. It dispatches a `selfie:submit` CustomEvent when all three slots are filled.2. [selfie-pipeline.js](../src/selfie-pipeline.js) handles that event: downscales each photo to a max of 1024px, converts to base64 JPEG, then POSTs to `/api/onboarding/avaturn-session` with the photos and body/style preferences.3. The API responds with a `session_url`. The page redirects to `/#avatarSession=<encoded url>`.-4. The main app reads the hash and opens `AvatarCreator` ([src/avatar-creator.js](../src/avatar-creator.js)) with the session URL, which initialises the Avaturn SDK into a modal iframe.-5. The Avaturn iframe fires a `avatar.exported` postMessage when the user exports. The SDK catches this, fetches the GLB bytes, and calls `onExport(blob)`.+4. The main app reads the hash and opens `AvatarCreator` ([src/avatar-creator.js](../src/avatar-creator.js)) with the session URL, which initialises the photo avatar SDK into a modal iframe.+5. The avatar editor iframe fires a `avatar.exported` postMessage when the user exports. The SDK catches this, fetches the GLB bytes, and calls `onExport(blob)`.6. [account.js](../src/account.js) → `saveRemoteGlbToAccount()` presigns an upload URL, pushes the GLB to R2 storage, and creates the avatar record.----## Path 2: Character Studio+## Path 2: Avatar builder-Character Studio is a browser-based avatar builder for full creative control, no photo required.+The three.ws avatar builder is a browser-based tool for full creative control, no photo required.### Access@@ -89,7 +89,7 @@ Character Studio communicates with the parent app via `postMessage`. The message[avatar-creator.js](../src/avatar-creator.js) listens for this, wraps the `ArrayBuffer` in a `Blob`, and passes it to `saveRemoteGlbToAccount()`.-The Character Studio URL defaults to `http://localhost:5173` for local development. Production deployments configure it via the `VITE_CHARACTER_STUDIO_URL` environment variable.+The avatar builder URL defaults to `http://localhost:5173` for local development. Production deployments configure it via the `VITE_CHARACTER_STUDIO_URL` environment variable.---@@ -113,7 +113,7 @@ The three.ws viewer accepts any valid glTF 2.0 binary (`.glb`) file. If your mod| FBX | Blender: File → Import → FBX, then File → Export → glTF 2.0 (.glb) || OBJ | Blender: File → Import → Wavefront, rig if needed, export as glTF || VRM | VRM files are glTF 2.0 under the hood — rename `.vrm` to `.glb` and it loads |-| Other avatar platforms | Most humanoid avatar tools export GLB and are compatible out of the box |+| Other avatar platforms | Most humanoid avatar tools (Mixamo, VRoid Hub, etc.) export GLB and are compatible out of the box || FBX via script | `/scripts/convert-fbx-to-glb.py` is available for batch conversion |---@@ -133,24 +133,33 @@ The viewer works with any GLB. The table below shows what each feature needs:### Morph target names-The Empathy Layer maps emotions to these exact morph target names. Include them in your model if you want facial animation:+three.ws follows the **ARKit-52** facial blendshape standard ([Apple ARKit reference](https://developer.apple.com/documentation/arkit/arfaceanchor/blendshapelocation)). Conformant avatars work end-to-end with the Empathy Layer, lip-sync, and any future face-tracking driver. The full canonical name list and runtime resolver live in [src/runtime/arkit52.js](../src/runtime/arkit52.js).++**The Empathy Layer drives this subset:**| Morph target | Driven by ||---|---|-| `mouthSmile` | Celebration (happiness) |-| `mouthOpen` | Celebration + talking |-| `mouthFrown` | Concern |+| `mouthSmileLeft` / `mouthSmileRight` | Celebration (happiness) |+| `jawOpen` | Celebration + talking |+| `mouthFrownLeft` / `mouthFrownRight` | Concern |+| `mouthPressLeft` / `mouthPressRight` | Uncertain / hedged || `browInnerUp` | Concern + empathy |-| `browOuterUpLeft` | Curiosity |-| `browOuterUpRight` | Curiosity (subtler) |-| `eyeSquintLeft` | Empathy |-| `eyeSquintRight` | Empathy |-| `eyesClosed` | Patience (subtle, not full close) |+| `browOuterUpLeft` / `browOuterUpRight` | Curiosity |+| `eyeSquintLeft` / `eyeSquintRight` | Empathy |+| `eyeBlinkLeft` / `eyeBlinkRight` | Patience (subtle) || `cheekPuff` | Celebration |-| `noseSneerLeft` | Concern |-| `noseSneerRight` | Concern |+| `noseSneerLeft` / `noseSneerRight` | Concern |++Visemes (`viseme_aa`, `viseme_E`, `viseme_O`, `viseme_PP` …) drive lip-sync — see [src/runtime/lipsync.js](../src/runtime/lipsync.js).++**Alias resolution.** The runtime accepts these common alternatives and maps them to the canonical name automatically — no need to rename morphs in your DCC:++- `snake_case`: `mouth_smile_left`, `brow_inner_up`, `jaw_open` …+- `_L` / `_R` suffixes: `mouthSmile_L`, `eyeBlink_R`, `browOuterUp_L` …+- Combined shapes: a single `mouthSmile` morph fans out to both `mouthSmileLeft` and `mouthSmileRight` slots when the canonical pair is absent.+- Older shorthand: `mouthOpen` → `jawOpen`, `eyesClosed` → `eyeBlinkLeft` (mirrored).-All influences are lerped smoothly every frame (speed ~4.0). Missing targets are silently skipped — you don't need all of them.+All influences are lerped smoothly every frame (speed ~4.0). Missing targets are silently skipped — you don't need all 52 to ship an avatar, but the more you implement the richer the expression. Use `conformanceReport()` in [src/runtime/arkit52.js](../src/runtime/arkit52.js) to audit a model.### Skeleton naming@@ -294,14 +303,14 @@ window.parent.postMessage({}, parentOrigin);```-If your tool uses the Avaturn SDK path, fire the `export` event with `{ url, urlType }` via the Avaturn postMessage protocol. See [avaturn-docs.md](../docs/avaturn-docs.md) for the full Avaturn iframe event reference.+If your tool uses the photo avatar SDK path, fire the `export` event with `{ url, urlType }` via the photo pipeline postMessage protocol.---## Troubleshooting**My avatar loads but has no facial expressions**-The model is missing morph targets. Export from Blender with "Shape Keys" enabled, or use Character Studio / Avaturn which include blend shapes by default.+The model is missing morph targets. Export from Blender with "Shape Keys" enabled, or use the three.ws avatar builder or photo pipeline — both include blend shapes by default.**Head movement doesn't work**The skeleton doesn't have a bone named `Head` or `Neck` (or a supported variant). Rename the bone in Blender or your DCC, or check for prefix issues (`mixamorigHead` is fine; `armature_root_Head` is not matched).diff --git a/public/docs/changelog.md b/public/docs/changelog.mdindex 7cd3ea128..800f3540c 100644--- a/public/docs/changelog.md+++ b/public/docs/changelog.md@@ -15,7 +15,7 @@ three.ws follows [Semantic Versioning](https://semver.org/) (`MAJOR.MINOR.PATCH`| **Patch** | Bug fixes with no API changes | `1.5.1` |**Current platform version:** `1.5.1`-**Current SDK version (`@nirholas/agent-kit`):** `0.1.0`+**Current SDK version (`@three-ws/sdk`):** `0.1.0`The SDK is versioned independently from the platform. A platform patch release does not necessarily bump the SDK version if no public API changed.@@ -34,7 +34,7 @@ What counts as a breaking change:- Removing or renaming a web component attribute or property- Changing the agent manifest schema in a non-backwards-compatible way (field removal or rename)- Changing an API endpoint path, method, or response shape-- Removing a public export from `@nirholas/agent-kit`+- Removing a public export from `@three-ws/sdk`Adding new optional fields to manifests, new optional API response properties, or new SDK exports is **not** a breaking change.@@ -138,7 +138,7 @@ Entries are organized by release. Categories follow [Keep a Changelog](https://k----## SDK Changelog (`@nirholas/agent-kit`)+## SDK Changelog (`@three-ws/sdk`)The SDK is published separately. Its changelog lives at [sdk/CHANGELOG.md](../../sdk/CHANGELOG.md).@@ -165,10 +165,10 @@ The CDN bundle is served from Vercel. The URL includes the version so you can pi```html<!-- Pinned to 1.5.1 — safe for production; won't break when 2.0.0 releases -->-<script type="module" src="https://[email protected]"></script>+<script type="module" src="https://three.ws/agent-3d/1.5.1/agent-3d.js"></script><!-- Always latest stable — convenient for development, risky for production -->-<script type="module" src="https://cdn.three.wsagent-3d.js"></script>+<script type="module" src="https://three.ws/agent-3d/latest/agent-3d.js"></script>```The CDN also maintains rolling channel aliases:@@ -185,7 +185,7 @@ The CDN also maintains rolling channel aliases:Each versioned bundle ships with a `integrity.json` sidecar for [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) verification:```-https://[email protected]/integrity.json+https://three.ws/agent-3d/1.5.1/integrity.json```---@@ -210,7 +210,7 @@ ERC-8004 contracts are immutable after deployment. This is a property of the blo```js// All deployed contract addresses, by chain ID-import { REGISTRY_DEPLOYMENTS } from '@nirholas/agent-kit';+import { REGISTRY_DEPLOYMENTS } from '@three-ws/sdk';// Base Mainnetconsole.log(REGISTRY_DEPLOYMENTS[8453].identityRegistry);@@ -250,10 +250,10 @@ Agent manifests carry a `$schema` field that identifies the format version:```bash# Upgrade to latest-npm update @nirholas/agent-kit+npm update @three-ws/sdk# Pin to a specific version-npm install @nirholas/[email protected]+npm install @three-ws/[email protected]```### CDN embed@@ -264,7 +264,7 @@ Change the version number in the `src` attribute of your script tag. Before upgr```js// From the SDK-import { version } from '@nirholas/agent-kit';+import { version } from '@three-ws/sdk';console.log(version); // "0.1.0"// From the platform API@@ -299,7 +299,7 @@ For contributors and maintainers. A release follows these steps:7. `npm run publish-lib` copies the CDN bundle into `dist/agent-3d/{version}/`, generates an `integrity.json` sidecar with SHA-384 hashes, updates the rolling channel aliases (`1.5`, `1`, `latest`), and writes a `versions.json` manifest.8. Vercel auto-deploys from `main` and serves the updated `dist/` directory on the CDN.-The SDK (`@nirholas/agent-kit`) is published to npm separately:+The SDK (`@three-ws/sdk`) is published to npm separately:```bashcd sdk && npm publish@@ -310,5 +310,5 @@ cd sdk && npm publish## Staying Up to Date- **GitHub Releases** — Watch the repository and select "Releases only" to get an email for each new release.-- **npm outdated** — Add `npm outdated @nirholas/agent-kit` to your CI pipeline to detect available upgrades automatically.-- **`versions.json`** — The CDN publishes a machine-readable index at `https://cdn.three.wsagent-3d/versions.json` listing all available versions, channel aliases, and SRI hashes.+- **npm outdated** — Add `npm outdated @three-ws/sdk` to your CI pipeline to detect available upgrades automatically.+- **`versions.json`** — The CDN publishes a machine-readable index at `https://three.ws/agent-3d/versions.json` listing all available versions, channel aliases, and SRI hashes.diff --git a/public/docs/configuration.md b/public/docs/configuration.mdindex 1a2d0e179..d53ede9dc 100644--- a/public/docs/configuration.md+++ b/public/docs/configuration.md@@ -192,16 +192,16 @@ Both should be the same value. Get from [dashboard.privy.io](https://dashboard.p### Avatar Pipeline#### `VITE_CHARACTER_STUDIO_URL`-**Optional.** Origin where the Character Studio in-browser avatar builder is hosted. Defaults to `http://localhost:5173` in dev and `https://studio.three.ws` in production.+**Optional.** Origin where the three.ws avatar builder is hosted. Defaults to `http://localhost:5173` in dev and `https://studio.three.ws` in production.```VITE_CHARACTER_STUDIO_URL=https://studio.three.ws```-Character Studio is an open-source 3D avatar editor (full body customisation — hair, clothing, accessories, skin tone, proportions). It runs as a separate Vite/React app under `character-studio/` in this monorepo and posts the exported GLB back to the parent via `postMessage`. It is fully compatible with the three.ws avatar runtime — same humanoid skeleton naming, ARKit `viseme_*` blendshapes, and Mixamo animation support.+The three.ws avatar builder is an open-source 3D avatar editor (full body customisation — hair, clothing, accessories, skin tone, proportions). It runs as a separate Vite/React app under `character-studio/` in this monorepo and posts the exported GLB back to the parent via `postMessage`. It is fully compatible with the three.ws avatar runtime — same humanoid skeleton naming, ARKit `viseme_*` blendshapes, and Mixamo animation support.#### `AVATURN_API_KEY`-**Optional.** API key for the Avaturn photo-to-avatar pipeline. Used server-side by `/api/onboarding/avaturn-session` to exchange selfie photos for a session URL.+**Optional.** API key for the photo-to-avatar pipeline. Used server-side by `/api/onboarding/avaturn-session` to exchange selfie photos for a session URL.```AVATURN_API_KEY=xxxxx@@ -210,21 +210,21 @@ AVATURN_API_KEY=xxxxxSign up at [avaturn.me/developer](https://avaturn.me/developer).#### `AVATURN_API_URL`-**Optional.** Override for self-hosted or staging Avaturn deployments. Defaults to `https://api.avaturn.me`.+**Optional.** Override for self-hosted or staging photo pipeline deployments. Defaults to `https://api.avaturn.me`.```AVATURN_API_URL=https://api.avaturn.me```#### `VITE_AVATURN_EDITOR_URL`-**Optional.** URL for the hosted Avaturn editor (no photos required, opened by the "Use default avatar" card at `/create`).+**Optional.** URL for the hosted avatar editor (no photos required, opened by the "Use default avatar" card at `/create`).```VITE_AVATURN_EDITOR_URL=https://editor.avaturn.me/```#### `VITE_AVATURN_DEVELOPER_ID`-**Optional.** Developer ID appended as a query parameter to the Avaturn editor URL.+**Optional.** Developer ID appended as a query parameter to the avatar editor URL.```VITE_AVATURN_DEVELOPER_ID=xxxxxdiff --git a/public/docs/contributing.md b/public/docs/contributing.mdindex 774751df7..da065daec 100644--- a/public/docs/contributing.md+++ b/public/docs/contributing.md@@ -31,15 +31,15 @@ You don't have to write code to make an impact. Contributions take many forms:### Requirements-- Node.js ≥ 18-- A browser with WebGL 2.0 (Chrome, Firefox, or Edge)+- Node.js 24.x (the repo's `engines.node` pins to this)+- A browser with WebGL 2.0 (Chrome, Firefox, Safari 15+, or Edge)### Steps```bash# 1. Fork the repo on GitHub, then clone your fork-git clone https://github.com/YOUR_USERNAME/3dagent.git-cd 3dagent+git clone https://github.com/YOUR_USERNAME/three.ws.git+cd three.ws# 2. Install dependenciesnpm install@@ -262,7 +262,7 @@ The avatar asset library welcomes clothing, hair, accessories, and other charact## Reporting Bugs-Open a [GitHub issue](https://github.com/nirholas/3d-agent/issues/new) and include:+Open a [GitHub issue](https://github.com/nirholas/three.ws/issues/new) and include:- Browser and OS version- Steps to reproduce (numbered, specific)@@ -271,7 +271,7 @@ Open a [GitHub issue](https://github.com/nirholas/3d-agent/issues/new) and inclu- Console errors — screenshot or paste the full message- A link to a GLB file that triggers the issue, if relevant-Check [existing issues](https://github.com/nirholas/3d-agent/issues) before opening a new one to avoid duplicates.+Check [existing issues](https://github.com/nirholas/three.ws/issues) before opening a new one to avoid duplicates.**Security vulnerabilities:** Do NOT open a public issue. Follow the responsible disclosure process described in the [Security documentation](./security.md). Public disclosure of an unpatched vulnerability puts all users at risk.@@ -279,8 +279,8 @@ Check [existing issues](https://github.com/nirholas/3d-agent/issues) before open## Getting Help-- **[GitHub Discussions](https://github.com/nirholas/3d-agent/discussions)** — design questions, architecture ideas, general "how does X work"-- **[GitHub Issues](https://github.com/nirholas/3d-agent/issues)** — bug reports and concrete feature requests+- **[GitHub Discussions](https://github.com/nirholas/three.ws/discussions)** — design questions, architecture ideas, general "how does X work"+- **[GitHub Issues](https://github.com/nirholas/three.ws/issues)** — bug reports and concrete feature requests- **Discord** — real-time chat (link in the README)Core team response times: typically 2–3 business days on GitHub, faster in Discord. If a PR has been open for a week with no review, a polite ping in Discord is welcome.diff --git a/public/docs/deployment.md b/public/docs/deployment.mdindex 21866e188..da4eebac1 100644--- a/public/docs/deployment.md+++ b/public/docs/deployment.md@@ -25,7 +25,7 @@ None of the optional layers (Redis, IPFS, blockchain relayer) are required to ruThe fastest route from zero to running:-[](https://vercel.com/new/clone?repository-url=https://github.com/nirholas/3d-agent)+[](https://vercel.com/new/clone?repository-url=https://github.com/nirholas/three.ws)1. Click the button → connect your GitHub account → Vercel forks the repo to your account.2. Fill in the environment variables (see the [Required environment variables](#required-environment-variables) section below).@@ -104,15 +104,14 @@ Without Redis, rate limits run in-memory per serverless instance. This is fine f### Avatar creation```env-# Character Studio — origin where the in-browser avatar builder iframe is hosted.+# Avatar builder — origin where the in-browser avatar builder iframe is hosted.# Defaults to http://localhost:5173 in dev. Production deployments should host the# character-studio/ workspace (it is a separate Vite/React app) and point this env-# var at its origin. Character Studio replaces the Ready Player Me iframe that was-# previously used here — same export contract, same humanoid rig, but open-source+# var at its origin. Same export contract, same humanoid rig, open-source# and self-hostable.VITE_CHARACTER_STUDIO_URL=https://studio.three.ws-# Avaturn — photo-to-avatar pipeline+# Photo-to-avatar pipeline# Get key at https://avaturn.me/developerAVATURN_API_KEY=AVATURN_API_URL=https://api.avaturn.me@@ -269,14 +268,14 @@ Without Redis the platform still works — rate limits run in-memory per serverl### Minimum requirements-- Node.js ≥ 18+- Node.js 24.x- A browser with WebGL 2.0 (Chrome, Firefox, or Edge 90+)- A Neon database (or any Postgres instance) for the API routes### Setup```bash-git clone https://github.com/nirholas/3d-agent.git+git clone https://github.com/nirholas/three.ws.gitcd 3d-agentnpm install@@ -537,7 +536,7 @@ After deploying, run through these checks to verify the instance is healthy:|---|---|| Viewer | Load the app and drag-drop a GLB file || Wallet sign-in | Connect MetaMask — SIWE challenge + verify |-| Avatar creation | Navigate to `/create` — Character Studio (or Avaturn) iframe loads |+| Avatar creation | Navigate to `/create` — avatar builder iframe loads || Agent page | Visit `/agent/:id` — 3D viewer with chat overlay || Embed | Check `/agent/:id/embed` loads without auth, can be iframed || Dashboard | Navigate to `/dashboard` — shows your agents |diff --git a/public/docs/embedding.md b/public/docs/embedding.mdindex b30861cff..b8642e9ec 100644--- a/public/docs/embedding.md+++ b/public/docs/embedding.md@@ -1,6 +1,6 @@# Embedding Guide-> **Audience:** Developers and no-code builders who want to add a three.ws to a website, app, or platform.+> **Audience:** Developers and no-code builders who want to add a three.ws agent to a website, app, or platform.---@@ -23,6 +23,18 @@ The `<agent-3d>` custom element is the recommended approach for any page where y### Basic setup+Install from npm:++```bash+npm install three.ws+```++```js+import 'three.ws';+```++Or load via CDN:+```html<!-- 1. Load the library (pinned version + SRI) --><script@@ -32,6 +44,9 @@ The `<agent-3d>` custom element is the recommended approach for any page where ycrossorigin="anonymous"></script>+<!-- or via unpkg -->+<script type="module" src="https://unpkg.com/three.ws"></script>+<!-- 2. Place the element --><agent-3dsrc="agent://base/42"@@ -264,7 +279,7 @@ The `allow` attribute controls browser feature access:|---------|-----|| Backend agent | `/agent/{agent-id}/embed` or `/agent-embed.html?id={agent-id}` || On-chain agent | `/a/{chainId}/{agentId}/embed` |-| Widget (kiosk) | `/widget#widget={widget-id}&kiosk=true` (slim shell, recommended) or `/app#widget={widget-id}&kiosk=true` (legacy) |+| Widget (kiosk) | `/app#widget={widget-id}&kiosk=true` || Model viewer only | `/#model={glb-url}` |### postMessage protocoldiff --git a/public/docs/erc8004.md b/public/docs/erc8004.mdindex 688659ead..e4c7d4b00 100644--- a/public/docs/erc8004.md+++ b/public/docs/erc8004.md@@ -259,7 +259,7 @@ The resolver understands several equivalent ways to refer to an agent:### JavaScript SDK```js-import { resolveOnchainAgent, parseAgentRef } from '@3dagent/sdk/erc8004';+import { resolveOnchainAgent, parseAgentRef } from '@three-ws/sdk/erc8004';// By chain + agent IDconst agent = await resolveOnchainAgent({ chainId: 8453, agentId: 42 });@@ -292,10 +292,10 @@ The resolver caches results per page session. Pass `{ fresh: true }` to bypass t```html<!-- CAIP-10 format in the agent-id attribute -->-<agent-three.ws-id="eip155:8453:0x8004A169FB4a3325136EB29fA0ceB6D2e539a432:42"></agent-3d>+<agent-3d agent-id="eip155:8453:0x8004A169FB4a3325136EB29fA0ceB6D2e539a432:42"></agent-3d><!-- Shorthand -->-<agent-three.ws-id="onchain:8453:42"></agent-3d>+<agent-3d agent-id="onchain:8453:42"></agent-3d>```The `<agent-3d>` element boots the full agent runtime — 3D rendering, memory, skills, and conversation — using the on-chain identity as its manifest source.@@ -363,7 +363,7 @@ After registering, your agent starts accumulating on-chain reputation. Any walleScores are integers from −100 to +100. The contract stores each individual review (submitter address, score, optional IPFS pointer to a longer write-up) and maintains a running aggregate (sum + count). The `getReputation` call returns `(avgX100, count)`:```js-import { getReputation, getRecentReviews } from '@3dagent/sdk/erc8004';+import { getReputation, getRecentReviews } from '@three-ws/sdk/erc8004';const { total, count, average } = await getReputation({agentId: 42,@@ -388,7 +388,7 @@ const reviews = await getRecentReviews({### Submitting feedback```js-import { submitReputation } from '@3dagent/sdk/erc8004';+import { submitReputation } from '@three-ws/sdk/erc8004';const txHash = await submitReputation({agentId: 42,@@ -424,7 +424,7 @@ Only allow-listed validator addresses can call `recordValidation`. Validators ar### Reading the latest validation```js-import { getLatestValidation } from '@3dagent/sdk/erc8004';+import { getLatestValidation } from '@three-ws/sdk/erc8004';const result = await getLatestValidation({agentId: 42,@@ -438,7 +438,7 @@ const result = await getLatestValidation({### Verifying independently```js-import { hashReport, reportPassed } from '@3dagent/sdk/erc8004';+import { hashReport, reportPassed } from '@three-ws/sdk/erc8004';// Re-run the validator and hash the new reportconst freshReport = await runGltfValidator(glbBytes);@@ -461,7 +461,7 @@ import {connectWallet,registerAgent,getIdentityRegistry,-} from '@3dagent/sdk/erc8004';+} from '@three-ws/sdk/erc8004';// Connect the user's walletconst { signer, chainId, address } = await connectWallet();@@ -486,7 +486,7 @@ The `onStatus` callback fires at each step so you can show progress in your UI.### Reading agents```js-import { getIdentityRegistry } from '@3dagent/sdk/erc8004';+import { getIdentityRegistry } from '@three-ws/sdk/erc8004';import { BrowserProvider } from 'ethers';const provider = new BrowserProvider(window.ethereum);@@ -512,8 +512,8 @@ const val = await registry.getMetadata(agentId, 'myKey');### Building the agent card manually```js-import { buildRegistrationJSON, agentRegistryId } from '@3dagent/sdk/erc8004';-import { REGISTRY_DEPLOYMENTS } from '@3dagent/sdk/erc8004/abi';+import { buildRegistrationJSON, agentRegistryId } from '@three-ws/sdk/erc8004';+import { REGISTRY_DEPLOYMENTS } from '@three-ws/sdk/erc8004/abi';const card = buildRegistrationJSON({name: 'My Agent',@@ -568,7 +568,7 @@ Testnet gas is free from faucets:```js// From src/erc8004/abi.js-import { REGISTRY_DEPLOYMENTS } from '@3dagent/sdk/erc8004/abi';+import { REGISTRY_DEPLOYMENTS } from '@three-ws/sdk/erc8004/abi';// Example: Base mainnetREGISTRY_DEPLOYMENTS[8453] === {diff --git a/public/docs/examples.md b/public/docs/examples.mdindex 988f8f9c6..f454624c7 100644--- a/public/docs/examples.md+++ b/public/docs/examples.md@@ -32,13 +32,13 @@ The absolute simplest setup: one script tag, one custom element.<agent-3dbody="/avatars/cz.glb"instructions="You are a friendly 3D guide."- brain="claude-opus-4-6"+ brain="claude-opus-4-7"width="100%"height="320px"></agent-3d></main>- <script type="module" src="https://cdn.three.wsagent-3d.js"></script>+ <script type="module" src="https://three.ws/agent-3d/latest/agent-3d.js"></script></body></html>```@@ -78,10 +78,10 @@ A pinned chatbot bubble that stays fixed in the viewport corner — like a suppoposition="bottom-right"width="320px"height="420px"- brain="claude-opus-4-6"+ brain="claude-opus-4-7"></agent-3d>- <script type="module" src="https://cdn.three.wsagent-3d.js"></script>+ <script type="module" src="https://three.ws/agent-3d/latest/agent-3d.js"></script></body></html>```@@ -148,7 +148,7 @@ A full AI-powered agent with a text input. The agent reads your messages, reasonbody="/avatars/aria.glb"name="Aria"instructions="You are Aria, a friendly AI assistant. Be helpful and concise."- brain="claude-opus-4-6"+ brain="claude-opus-4-7"></agent-3d><div class="chat">@@ -157,7 +157,7 @@ A full AI-powered agent with a text input. The agent reads your messages, reason</div><script type="module">- import 'https://cdn.three.wsagent-3d.js';+ import 'https://three.ws/agent-3d/latest/agent-3d.js';const aria = document.getElementById('aria');const input = document.getElementById('input');@@ -217,7 +217,7 @@ Two agents sharing a single WebGL canvas via `<agent-stage>`. Each keeps its ownname="Coach Leo"body="/avatars/cz.glb"instructions="You are Coach Leo. Friendly, short answers. When another agent says hi, wave and greet them back by name."- brain="claude-opus-4-6"+ brain="claude-opus-4-7"eager></agent-3d><agent-3d@@ -225,7 +225,7 @@ Two agents sharing a single WebGL canvas via `<agent-stage>`. Each keeps its ownname="Mira"body="/avatars/cz.glb"instructions="You are Mira, a quiet observer who only speaks when spoken to."- brain="claude-opus-4-6"+ brain="claude-opus-4-7"eager></agent-3d></agent-stage>@@ -238,7 +238,7 @@ Two agents sharing a single WebGL canvas via `<agent-stage>`. Each keeps its own<div class="log" id="log"></div><script type="module">- import 'https://cdn.three.wsagent-3d.js';+ import 'https://three.ws/agent-3d/latest/agent-3d.js';const log = document.getElementById('log');const stage = document.getElementById('stage');@@ -306,9 +306,9 @@ A reusable React component that wraps `<agent-3d>` and surfaces the `agent:readyimport { useEffect, useRef, useState } from 'react';// Load the web component once at module level-import 'https://cdn.three.wsagent-3d.js';+import 'https://three.ws/agent-3d/latest/agent-3d.js';-export function AgentViewer({ body, name, instructions, brain = 'claude-opus-4-6', mode = 'inline', onMessage, style }) {+export function AgentViewer({ body, name, instructions, brain = 'claude-opus-4-7', mode = 'inline', onMessage, style }) {const ref = useRef(null);const [ready, setReady] = useState(false);@@ -374,7 +374,7 @@ Listen to the agent's event stream to drive a custom transcript UI — no built-id="agent"body="/avatars/cz.glb"instructions="You are a helpful assistant."- brain="claude-opus-4-6"+ brain="claude-opus-4-7"style="display:block;width:400px;height:500px"></agent-3d>@@ -384,7 +384,7 @@ Listen to the agent's event stream to drive a custom transcript UI — no built-></div><script type="module">- import 'https://cdn.three.wsagent-3d.js';+ import 'https://three.ws/agent-3d/latest/agent-3d.js';const agent = document.getElementById('agent');const transcript = document.getElementById('transcript');@@ -442,7 +442,7 @@ Load different GLB models at runtime by calling `say()` or by swapping the `bodyid="viewer"body="/avatars/cz.glb"instructions="Describe what you see in the scene."- brain="claude-opus-4-6"+ brain="claude-opus-4-7"style="display:block;width:400px;height:400px"></agent-3d>@@ -453,7 +453,7 @@ Load different GLB models at runtime by calling `say()` or by swapping the `body</div><script type="module">- import 'https://cdn.three.wsagent-3d.js';+ import 'https://three.ws/agent-3d/latest/agent-3d.js';window.load = (url) => {// Setting the body attribute triggers a re-boot with the new model.@@ -485,7 +485,7 @@ Take a PNG snapshot of the current viewer state. The viewer renders a fresh fram<button id="capture" style="margin-top:12px">Download Screenshot</button><script type="module">- import 'https://cdn.three.wsagent-3d.js';+ import 'https://three.ws/agent-3d/latest/agent-3d.js';document.getElementById('capture').addEventListener('click', () => {// window.VIEWER is a debug global exposed by the runtime.@@ -619,7 +619,7 @@ Coach Leo is a fully-configured agent with a personality, skills, and persistent},"brain": {"provider": "anthropic",- "model": "claude-opus-4-6",+ "model": "claude-opus-4-7","instructions": "instructions.md","temperature": 0.8,"maxTokens": 2048@@ -644,7 +644,7 @@ Coach Leo is a fully-configured agent with a personality, skills, and persistent```markdown---name: Coach Leo-model: claude-opus-4-6+model: claude-opus-4-7temperature: 0.8---@@ -679,7 +679,7 @@ genuinely invested in the user's progress.style="display:block;width:400px;height:500px"></agent-3d>-<script type="module" src="https://cdn.three.wsagent-3d.js"></script>+<script type="module" src="https://three.ws/agent-3d/latest/agent-3d.js"></script>```### Design decisionsdiff --git a/public/docs/how-it-works.md b/public/docs/how-it-works.mdindex fcf15aa95..94a2dff8b 100644--- a/public/docs/how-it-works.md+++ b/public/docs/how-it-works.md@@ -1,307 +1,164 @@-# How CSS 3D Parallax Works+# How three.ws works-This page explains the mechanics behind the CSS 3D parallax scrolling hero used in this theme — from the mathematical foundations of 3D projection to the browser-specific quirks that required targeted workarounds. If you want to understand why each line of CSS exists, you are in the right place.+This page is the load-bearing mental model. If you're trying to figure out where a feature lives, how a request flows, or which layer to extend — start here.------## The CSS 3D Coordinate System--Before anything else, you need a mental model of how CSS thinks about three-dimensional space.--CSS uses a right-handed coordinate system. The X axis runs left to right across the screen. The Y axis runs top to bottom (not bottom to top as in mathematics — CSS and HTML have their origin at the top-left corner). The Z axis is perpendicular to the screen, pointing toward you. A positive `translateZ` moves an element closer to you; a negative `translateZ` moves it away into the page.--The **vanishing point** is where all parallel lines in the 3D scene would converge if extended to infinity. In CSS, the vanishing point defaults to the center of the element that has `perspective` set on it. If you set `perspective: 500px` on a container and it is 800px wide and 600px tall, the vanishing point sits at `(400px, 300px)` in that container's coordinate space. Elements positioned away from that center will appear to slant toward it, which is exactly what gives 3D scenes their sense of depth.--There is one important subtlety: the vanishing point is relative to the _perspective element_, not the viewport. This matters enormously for parallax, as we will see shortly.+For the full deep dive on internals, see [Architecture overview](./architecture.md). For the actual JS API, see [JavaScript API](./js-api.md) and [REST API](./api-reference.md). This document zooms out to *how it all fits together*.----## `perspective` on a Scroll Container vs. `perspective()` in a Transform--There are two ways to introduce perspective into CSS:--**1. The `perspective` property on a parent element:**--```css-.scroll-container {- perspective: 2.5rem;- overflow: hidden auto;-}-```--**2. The `perspective()` function inside a `transform` on the element itself:**+## The pitch in one paragraph-```css-.layer {- transform: perspective(2.5rem) translateZ(-10px);-}-```--These look similar but behave fundamentally differently, and the difference is what makes scrolling parallax possible.--When you use the `perspective` _property_ on a parent, all children share a _single_ vanishing point. Every child's 3D transform is evaluated relative to that one shared origin. As a result, moving one child does not move the vanishing point — it stays anchored to the parent.--When you use `perspective()` inside an individual element's `transform`, each element gets its own independent vanishing point centered on itself. There is no shared scene. Objects do not relate to each other in 3D space.--For parallax, the shared vanishing point is what you want. The scroll container has `perspective` set, and all the depth layers are children. When the container scrolls, the layers scroll at different visual rates because they are at different Z depths — all converging toward the same vanishing point. This is the entire trick.+three.ws turns an AI agent into a persistent, ownable, multi-chain object: a 3D body that renders in any modern browser, an LLM brain you choose (Claude, GPT, or others), an on-chain identity registered on EVM chains via ERC-8004 or on Solana via Metaplex Core, and a `<agent-3d>` web component you can drop into any page on the internet. Pay-per-call API endpoints use the x402 standard. The whole stack is open source under Apache-2.0.----## The Exact Math: `translateZ` and Parallax Depth--Here is the core rule of CSS 3D projection: an element translated along the Z axis by `z` in a container with `perspective: p` will appear to move at a visual rate proportional to `(p - z) / p` when the container is scrolled.--More precisely, when the scroll container moves by `d` pixels (i.e., `scrollTop` increases by `d`), an element at `translateZ(z)` appears to move by:--```-visual_movement = d × (p / (p - z))-```--For the parallax effect we want _slower_ movement for elements further away (negative Z). Substituting a negative Z value:+## What happens when an agent loads-```-visual_movement = d × (p / (p + |z|))-```--When `|z|` is large, the denominator grows, and the fraction shrinks below 1. The element appears to move _less_ than the scroll distance. That is parallax.--In this theme, the perspective value is `2.5rem`. The CSS variable `--md-parallax-depth` sets the depth multiplier. The actual `translateZ` value applied to each layer is:--```css-transform: translateZ(calc(2.5rem * var(--md-parallax-depth) * -1))- scale(calc(var(--md-parallax-depth) + 1));-```--With `--md-parallax-depth: 8` (the farthest background layer), the element is pushed `20rem` (8 × 2.5rem) back into the page. Its visual scroll rate becomes:--```-rate = 2.5 / (2.5 + 20) = 2.5 / 22.5 ≈ 0.111-```--That layer moves at about 11% of the scroll speed. A near-foreground layer at `--md-parallax-depth: 1` moves at:+Pick the simplest case: a host page on `example.com` has dropped in our embed script and the `<agent-3d>` element. A visitor scrolls to it. Here is the round trip, end to end:-```-rate = 2.5 / (2.5 + 2.5) = 2.5 / 5 = 0.5-```--That layer moves at 50% of scroll speed. The result: the background barely drifts while the foreground moves more noticeably — exactly the depth cue your visual system uses to infer distance.+1. **Lazy boot.** The CDN bundle (`https://three.ws/agent-3d/latest/agent-3d.js`) registers the custom element. It does *not* boot the 3D scene until the element scrolls into view (an `IntersectionObserver` waits). If you add the `eager` attribute, the scene boots on connect.+2. **Manifest resolution.** Once visible, the element looks at its attributes:+ - `agent-id="<uuid>"` → fetches the manifest from `/api/agents/<id>` on the platform+ - `agent-id="42" chain-id="8453"` → calls the ERC-8004 registry on Base, reads the `tokenURI`, then fetches the IPFS-hosted manifest+ - `manifest="https://…/manifest.json"` → fetches the URL directly+ - `body="…glb" brain="…"` → no manifest fetch needed; the attributes *are* the config+3. **Origin check.** If the manifest declares an `embed.origins` allowlist, the element verifies `location.origin` matches before continuing. Failed checks render an error placeholder, not the agent.+4. **Viewer init.** A WebGL renderer, perspective camera, lights, an HDRI environment, and `OrbitControls` are created — scoped to the element's shadow DOM, with idle frames skipped so off-screen agents don't burn battery.+5. **GLB load.** `GLTFLoader` (with DRACO, KTX2, and Meshopt decoders attached) fetches the avatar and centers it. The poster image from the manifest fades out when the model is ready.+6. **Runtime start.** If a brain is configured, the LLM runtime constructs the system prompt from `instructions.md`, the memory context, and the installed skills' tool schemas. The chat input, voice button, and accessory dock appear.+7. **Bus subscriptions.** The avatar's empathy layer, the identity logger, the chat UI, and any skills all subscribe to a single `agent-protocol` event bus. Nothing communicates by direct method call.+8. **Ready.** A `agent:ready` `CustomEvent` fires on the element. Host pages listening to it can now call `el.say("Hello!")` or `el.ask("How are you?")`.-The four layers in this theme use depth values of `8`, `5`, `2`, and `1`, giving visual scroll rates of roughly 11%, 33%, 56%, and 50% respectively. The gaps between values are chosen to make the depth separation clearly visible without any single layer moving so fast it looks wrong.+If you'd rather see this with module names and call sites, see the [architecture overview](./architecture.md#5-web-component-lifecycle).----## Scale Compensation: Why `scale(depth + 1)` Is Necessary+## The four layers-There is a problem with pushing elements back along the Z axis: they appear smaller. An element at `translateZ(-20rem)` inside a `perspective: 2.5rem` container will be dramatically shrunk by the 3D projection — it would appear as a tiny postage stamp in the corner of the screen.+The whole stack is split into four horizontal strata. Each layer can run on its own. Each layer is independently replaceable as long as you don't break the event bus contract.-The scale compensation formula fixes this:--```css-scale(calc(var(--md-parallax-depth) + 1))```--This is derived directly from the projection math. If an element is at depth `d` (where actual `translateZ` equals `d × -p`), the CSS projection shrinks it by a factor of `1 / (d + 1)`. Multiplying by `scale(d + 1)` exactly cancels that shrinkage, restoring the element to its intended visual size.--For the far background at `--md-parallax-depth: 8`:--- Projection shrink factor: `1 / (8 + 1) = 1/9`-- Scale compensation: `9`-- Net visual size: `1/9 × 9 = 1` — back to full size--For the near foreground at `--md-parallax-depth: 1`:--- Projection shrink factor: `1 / (1 + 1) = 1/2`-- Scale compensation: `2`-- Net visual size: `1/2 × 2 = 1` — back to full size--A critical side effect: because scale compensation makes far layers appear full-size, they must actually be _much larger_ in pixel terms than they appear. A layer at depth 8 needs to be rendered 9× its visible dimensions. This is why background images for deep layers need to be wide panoramic files — the scale transform stretches them to fill the viewport.-------## Why Scrolling a Perspective Container Creates Parallax--You might wonder: if the scroll container is scrolled, does not everything inside move together by the same amount? The answer is yes in 2D, but not in 3D.--When the container scrolls, the viewport's position in the container's coordinate space changes. Elements at `translateZ(0)` behave normally — they scroll at 1:1. But the 3D projection matrix transforms the geometry of elements at non-zero Z positions. As the viewpoint shifts relative to the Z-displaced elements, the _projected_ position on screen changes at a different rate than the raw scroll offset. The perspective math does this automatically; the browser's rendering engine handles it correctly by compositing each layer with its appropriate depth-projected transform.--This is why this technique requires no JavaScript whatsoever. The parallax is not computed by reading `scrollTop` and updating element positions — it is a natural geometric consequence of CSS 3D perspective projection. The browser's compositor thread handles it entirely, on the GPU.-------## Sticky Positioning for Hero Text--The hero text sits on top of the parallax image layers and should remain readable while the parallax scrolls. The standard approach — `position: sticky` — is used, but it requires a careful negative margin to work correctly:--```css-.parallax__group--hero-text {- position: sticky;- top: 0;- margin-bottom: -100vh;-}+┌──────────────────────────────────────────────┐+│ <agent-3d>, widgets, iframe, SDK packages │ ← Embed layer+├──────────────────────────────────────────────┤+│ ERC-8004 · Metaplex Core · IPFS · SIWE/SIWS │ ← Identity layer (optional)+├──────────────────────────────────────────────┤+│ LLM runtime · Skills · Memory · Empathy bus │ ← Agent layer+├──────────────────────────────────────────────┤+│ three.js · GLTFLoader · AnimationMixer │ ← Viewer layer+└──────────────────────────────────────────────┘```-The `margin-bottom: -100vh` deserves explanation. Sticky positioning keeps an element "stuck" to the top of the scroll container until its _parent_ scrolls out of view. Without the negative margin, the parent element would end exactly at the bottom of the text content, and the text would begin to scroll away before the parallax images are done moving through the viewport.--By setting `margin-bottom: -100vh`, the parent element's layout height is reduced by one viewport height. This pulls the sticky constraint boundary upward, keeping the text stuck for exactly as long as the parallax hero section occupies the viewport. When the parallax scroll group eventually leaves the viewport, the sticky text goes with it, revealing the normal document content below.+- **Viewer layer** — pure three.js. Knows nothing about agents, brains, or wallets. Useful on its own as a glTF inspector and as the rendering engine for Turntable / Animation Gallery widgets. See [Layers](./layers.md) for the contract.+- **Agent layer** — turns a static GLB into a presence. LLM tool-loop, skill registry, memory, and a continuous emotion blend that drives morphs and gaze. See [Agent system](./agent-system.md).+- **Identity layer** — durability across sessions, devices, and embed hosts. Wallet auth, on-chain registration, IPFS-pinned manifest bundles, signed action diary. Entirely optional. See [ERC-8004](./erc8004.md) and [Solana agents](./solana.md).+- **Embed layer** — the public face. The `<agent-3d>` custom element, five widget variants, iframe embeds, the CDN bundle, the SPA, edge routing in `vercel.json`. See [Embedding](./embedding.md).-This is a purely CSS technique. No scroll event listeners, no `position: fixed` with JavaScript offset calculations.+The four layers communicate through one event bus (`agent-protocol`). Every meaningful action is a `CustomEvent` on a singleton. That single design choice is why you can swap the avatar for a 2D sprite, the runtime for a different LLM, or memory for a vector store — and nothing else changes.----## Paint Containment with `contain: strict`+## A conversation, end to end-```css-.parallax__group {- contain: strict;-}-```--The `contain: strict` declaration tells the browser that this element and its subtree are self-contained: their layout, paint, and size do not affect anything outside the element, and nothing outside affects them. This is a performance hint that allows the browser to skip repainting the rest of the document when the parallax group changes.+A user types "Wave at me" into an embedded agent's chat input. Here's the full data flow:-For parallax layers that are constantly being composited and transformed, this is significant. Without containment, each frame of animation might trigger a full-page repaint. With `contain: strict`, the browser can isolate and independently composite each parallax group on the GPU, achieving buttery smooth frame rates even on mid-range hardware.+1. **Input.** Chat UI calls `runtime.send("Wave at me", { voice: false })`.+2. **System prompt.** The runtime builds the prompt: manifest `instructions.md` + a compact memory block + the skill registry's tool descriptions.+3. **LLM call.** A streaming request goes to Anthropic (or OpenAI, or whichever provider matches the manifest's `brain.provider`). The platform supports proxying through `/api/brain/chat` so API keys never live in the client.+4. **Tool call.** The model returns a `wave` tool invocation.+5. **Skill dispatch.** The skill registry looks up `wave`. It's a built-in: the handler emits a `gesture` event on the bus and plays the wave animation clip via the `SceneController`.+6. **Empathy reaction.** The avatar's empathy layer hears `gesture` and `speak` events on the same bus. Sentiment is positive, so celebration weight bumps slightly. Morph targets lerp `mouthSmile` toward 0.6 over a few frames; gaze locks on the user.+7. **TTS.** If `voice: true`, the text is read aloud via ElevenLabs (or the Web Speech API as fallback).+8. **Identity diary.** The identity layer hears `speak`, `gesture`, and `skill-done` and POSTs them to `/api/agent-actions` so the agent's signed action history persists.-The reason this is especially important here is that the 3D transforms on the parallax layers happen entirely on the compositor thread (separate from the main JavaScript thread), but only if the browser can correctly promote the layers to their own GPU compositing layers. `contain: strict` helps the browser make that determination reliably.+If you registered the agent on-chain, that signed action log can be attested to via the **ReputationRegistry** so anyone can verify behavior across embeds without trusting the central server.----## The `height: 140vh` on the First Group--The first parallax group uses `height: 140vh` rather than `100vh`. This is not arbitrary. The parallax layers inside the group appear to extend beyond the viewport — the far background layer (depth 8) scrolls at 11% of scroll speed, which means for it to travel through the viewport fully, the group needs to be scrolled through more than `100vh` of content.+## Where does the LLM key live?-The exact value needed depends on the depth values used. A deeper background requires a taller container to complete its scroll travel. `140vh` was empirically tuned to ensure all four layers complete their parallax motion before the hero scrolls fully off screen.+Three modes, all configurable per agent:-Subsequent groups (if any) use responsive `vw`-based heights rather than fixed `vh` values, because their content is image-driven and should maintain aspect ratios:+| Mode | When to use | How |+|---|---|---|+| **Hosted (default)** | Most users | Set `brain="claude-sonnet-4-6"`. The element posts to `https://three.ws/api/brain/chat`, which uses the platform's pooled keys. Billed against your three.ws account. |+| **Self-hosted proxy** | You want to manage cost or use a private model | Set `key-proxy="/api/llm"` to point at your own serverless function that injects keys before forwarding to the provider. Keys never reach the client. |+| **Direct (advanced)** | Local-only experiments | The runtime can call providers directly if you pass an API key explicitly. Don't ship this to a public page. |-```css-.parallax__group--scene {- height: 56.25vw; /* 16:9 aspect ratio */-}-```--This ensures the parallax scene scales proportionally with viewport width, maintaining correct composition at all screen sizes.+The brain proxy at [`/api/brain/chat`](./api-reference.md) supports Anthropic, OpenAI, Qwen, and OpenRouter — so the brain attribute can be `claude-opus-4-7`, `claude-sonnet-4-6`, `claude-haiku-4-5`, `gpt-4o`, `gpt-4o-mini`, and others.----## The Blend Layer+## Where does the avatar come from?-Between the parallax image layers and the content below, there is a gradient blend layer:+Three production paths. Pick whichever fits your use case:-```css-.parallax__blend {- background: linear-gradient(to bottom, transparent 0%, var(--md-default-bg-color) 100%);- z-index: 5;-}-```+- **Character Studio** — full-body character builder for stylised humanoids. Pick a base mesh, swap clothing/accessories/hairstyles, save. The output is a rigged GLB. See [character-studio.md](./character-studio.md).+- **Selfie (Avaturn)** — upload a photo, get a rigged 3D version of yourself in ~60 seconds. See [avaturn.md](./avaturn.md).+- **Upload your own** — any glTF 2.0 / GLB with a humanoid rig works. Drop the file into the editor at [three.ws/create](https://three.ws/create) or POST to `/api/avatars`.-This gradient transitions from fully transparent (showing the bottom edge of the parallax images) to the site's background color (matching the content sections below). It accomplishes two things:--1. It prevents a hard visual cutoff at the bottom of the parallax hero. Images rarely look clean at their exact edge, and the gradient masks any artifacts.-2. It creates a smooth visual merge between the scenic parallax imagery and the flat document content that follows, making the page feel cohesive rather than jarring.--The blend layer is positioned using `z-index: 5`, which places it above the image layers (which have lower z-index values) but the blend is transparent at the top, so it does not obscure the imagery.+Every avatar ends up as a `cdn.three.ws/u/<owner>/…glb` URL plus a database record. When you wire one into an agent, the agent's manifest references it under `body.uri`.----## Z-Index Stacking: `z-index: calc(10 - depth)`+## How embeds reach the host page-The parallax layers need to stack correctly: near objects (low depth number) should appear in front of far objects (high depth number). The formula for this is:+Once your agent is live, three surfaces let other pages embed it:-```css-z-index: calc(10 - var(--md-parallax-depth));-```+- **The web component** — `<agent-3d agent-id="…">` after loading the CDN script. The element runs in your page, sharing the DOM. Use this when you want full control and your CSP allows third-party scripts.+- **The iframe widget** — `https://three.ws/w/<widget-id>` rendered inside an `<iframe>`. Five widget types ship: Turntable, Animation Gallery, Talking Agent, ERC-8004 Passport, Hotspot Tour. Use this in environments where you can't load third-party scripts (Notion, Webflow, Framer, WordPress).+- **The Open Graph + oEmbed surface** — paste `https://three.ws/agent/<id>` into Slack, X, Discord, or any platform that consumes oEmbed, and you get a rich preview with the avatar's poster, name, and description.-At `--md-parallax-depth: 1` (near foreground), `z-index` is `9`. At `--md-parallax-depth: 8` (far background), `z-index` is `2`. Near layers are always on top of far layers in the stacking order.--Without this, the 3D projection might place elements visually at different depths, but the browser's paint order (which follows DOM order and z-index) might render them in the wrong order, creating situations where a background element is painted over a foreground element. The `z-index` formula ensures paint order matches visual depth order.+The `postMessage` bridge in the web component and the iframe widget speaks the same protocol, so host pages can call `say()`, `ask()`, `installSkill()`, and listen for events like `agent:speak`, `agent:tool-called`, `agent:skill-done` either way.----## Browser Quirks+## Why on-chain?-### Safari: Disabling `contain: strict`+On-chain identity is optional. Most agents work fine without it. You'd want it when:-Safari has a known issue where `contain: strict` on elements inside a `perspective` scroll container breaks the parallax effect — the 3D transforms stop updating correctly during scroll, causing layers to freeze or jump. A browser detection script adds a `.safari` class to the `<body>` element:+- **The agent should outlive the platform.** ERC-8004 registry contracts on Base and other EVM chains hold the canonical ID. The manifest is on IPFS. Even if `three.ws` disappeared tomorrow, anyone could resolve and run your agent.+- **You need verifiable behavior.** Validation attestations and signed action logs let third parties verify what an agent has done.+- **You want delegated wallet permissions.** ERC-7710 lets you sign once per session and grant the agent scoped, time-bound permission to act on-chain — no per-transaction prompts.+- **You want a portable address.** `agent://base/42` is a stable, resolver-agnostic URI. Any client that speaks the protocol can load it.-```js-if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {- document.body.classList.add('safari');-}-```--The CSS then disables `contain` specifically for Safari:--```css-.safari .parallax__group {- contain: none;-}-```--This restores correct parallax behavior at the cost of some paint performance in Safari. Given that Safari's rendering engine handles 3D compositing differently, this is an acceptable trade-off.--### Firefox: Repaint Bug Fix--Firefox has a repaint bug where the parallax layers occasionally fail to repaint after a rapid scroll or tab focus change, leaving ghost artifacts or blank regions. The fix involves toggling a class that forces a style recalculation:--```js-window.addEventListener('focus', () => {- document.body.classList.add('ff-hack');- requestAnimationFrame(() => document.body.classList.remove('ff-hack'));-});-```--```css-.ff-hack .parallax__layer {- will-change: transform;-}-```--Adding and removing `will-change: transform` forces Firefox to mark the compositing layers as dirty and repaint them on the next frame. This resolves the ghost artifact issue without any visible effect on the rendered output.+See [erc8004.md](./erc8004.md) and [solana.md](./solana.md) for the registration flows.----## Why Not JavaScript Scroll Listeners?+## What about monetisation?-Traditionally, parallax effects use JavaScript that reads `window.scrollY` on each scroll event and applies position offsets. This approach has serious performance problems:+Three independent mechanisms, used as needed:-- Scroll event handlers run on the **main thread**, which is the same thread that runs JavaScript, handles user input, and performs layout. Under heavy load, this thread can be busy, causing the parallax animation to lag behind the actual scroll position.-- Reading `scrollY` followed by writing to `element.style.transform` triggers **layout thrashing** if not carefully managed with `requestAnimationFrame`.-- Even with `requestAnimationFrame`, JavaScript-driven parallax runs at most 60fps on most displays, and may drop frames when other scripts are active.+- **x402** — pay-per-call USDC for paid API endpoints. Every paid endpoint declares itself in [`/.well-known/x402.json`](https://three.ws/.well-known/x402.json). Other agents (or humans with a wallet) can call paid endpoints with a single signed payment header.+- **pump.fun** — launch a Solana SPL token tied to your agent. The platform handles the bonding curve, the token metadata, and the embed.+- **AWS Marketplace** — enterprise subscriptions billable through AWS. See [aws-marketplace.md](./aws-marketplace.md). Subscriptions auto-issue an x402 API key via the marketplace entitlement service.-The CSS 3D approach runs entirely on the **compositor thread**, a separate GPU-accelerated thread that handles `transform` and `opacity` animations. The compositor thread is never blocked by JavaScript. The parallax updates happen at the full display refresh rate (including 120Hz and 144Hz displays) with zero jank, even if the main thread is busy processing data or rendering other UI.+You can mix these per agent. A common pattern: an agent has a free public persona on the platform, exposes one paid x402 skill for power users, and accepts donations via a pump.fun token.----## Why Not `animation-timeline: scroll()`?+## When to use which surface-The CSS Scroll-Driven Animations API (`animation-timeline: scroll()`) is a modern alternative that allows CSS animations to be driven by scroll position. As of 2025, it is supported in Chrome and Edge but lacks full support in Safari and Firefox.+Quick lookup for "I want to ship X":-Additionally, scroll-driven animations are still processed on the main thread in some implementations when they affect layout properties, and the API requires careful coordination when combined with 3D transforms and perspective containers. The CSS 3D perspective approach used here works in every browser that supports CSS 3D transforms — which is every major browser since 2012 — and delivers equivalent performance without the compatibility uncertainty.+| You want… | Reach for… |+|---|---|+| A 3D character on a marketing page | The CDN script + `<agent-3d>` |+| A character in Notion / Webflow / Framer | An iframe widget from [Widget Studio](./widget-studio.md) |+| A talking AI sidekick that follows visitors | `<agent-3d mode="floating">` |+| A character that controls a scene from page events | The JS API (`agent.say()`, `agent.ask()`) — see [js-api.md](./js-api.md) |+| Programmatic avatar manipulation in Node | `@three-ws/avatar` |+| An on-chain identity for your AI | [ERC-8004](./erc8004.md) or [Solana](./solana.md) |+| A paid API anyone (including agents) can call | [x402 monetization](./x402.md) |+| Multiple agents in one scene | `<agent-stage>` — see [multi-agent.md](./multi-agent.md) |+| To register a domain (e.g. ENS) as agent identity | [register-onchain.md tutorial](./tutorials/register-onchain.md) |----## Debugging: Chrome DevTools--### Layers Panel--Open Chrome DevTools, go to the **Layers** panel (More tools > Layers). Each parallax layer should appear as a separate compositing layer. If a layer is not promoted, you will see it listed as part of its parent. You can click any layer to see why it was or was not promoted (look for "Has a 3D transform" as the reason).--### 3D View--In Chrome DevTools, More tools > **3D View** renders your page's layer stack as an interactive 3D diagram. You can orbit around the layer stack and visually confirm that each parallax layer is at the correct depth. Layers that are pushed back in Z should appear further back in the 3D view. This is the most intuitive way to verify that the transforms are applied correctly.--If a layer appears at `z=0` when it should be at a negative Z, the most common cause is a missing `transform-style: preserve-3d` on an intermediate ancestor, or a CSS property on an ancestor that flattens the 3D context (such as `overflow: hidden` in some browsers, or certain `filter` values).-------## Summary--The CSS 3D parallax technique works because:--1. A `perspective` property on a scroll container establishes a shared 3D scene with a fixed vanishing point.-2. Child elements at negative Z positions are projected to appear smaller and scroll more slowly — the further back, the slower.-3. Scale compensation exactly counteracts the projection shrinkage, so images appear full-size at all depths.-4. The compositor thread handles all of this at GPU speed, with no JavaScript involvement.-5. Sticky text positioning and a blend gradient handle the presentation layer.-6. Browser-specific workarounds address known bugs in Safari and Firefox without compromising the core technique.+## What's next-The result is a hero section with genuine, smooth, GPU-accelerated depth — using nothing but CSS that browsers have supported for over a decade.+- **[Architecture overview](./architecture.md)** — full internals+- **[Agent system](./agent-system.md)** — runtime, skills, memory, emotion+- **[Layers](./layers.md)** — the four-layer contract in detail+- **[Quick start](./quick-start.md)** — go from zero to a living embed in under 10 minutesdiff --git a/public/docs/introduction.md b/public/docs/introduction.mdindex 9b439e9e9..316218444 100644--- a/public/docs/introduction.md+++ b/public/docs/introduction.md@@ -9,10 +9,13 @@ The result is an agent that doesn't just respond in a chat box. It occupies a th**Key facts:**- **License:** Apache-2.0 — use it, fork it, self-host it-- **Hosted platform:** [https://three.ws/](https://three.ws/)-- **CDN library:** `https://cdn.three.wsagent-3d.js`+- **Hosted platform:** [https://three.ws](https://three.ws)+- **CDN bundle:** `https://three.ws/agent-3d/latest/agent-3d.js` (also pinnable to a version, e.g. `/agent-3d/1.5.1/agent-3d.js`)+- **npm packages:** [`@three-ws/sdk`](https://www.npmjs.com/package/@three-ws/sdk), [`@three-ws/agent-ui`](https://www.npmjs.com/package/@three-ws/agent-ui), [`@three-ws/avatar`](https://www.npmjs.com/package/@three-ws/avatar), [`@three-ws/solana-agent`](https://www.npmjs.com/package/@three-ws/solana-agent), [`@3d-agent/mcp-server`](https://www.npmjs.com/package/@3d-agent/mcp-server)- **No server required** for basic use — the viewer, agent runtime, and skill system all run in the browser via WebGL 2.0- **glTF 2.0 / GLB** with Draco, KTX2, and Meshopt decompression supported out of the box+- **AWS Partner** — available on [AWS Marketplace](https://aws.amazon.com/marketplace) as a SaaS product, billable through your AWS account+- **x402 payments** — every paid endpoint discoverable at [`/.well-known/x402.json`](https://three.ws/.well-known/x402.json); MCP server at [`/api/mcp`](https://three.ws/api/mcp)---@@ -177,7 +180,7 @@ Game engine WebGL exports ship a large runtime (~10–50 MB) and require their oThe minimum to get a three.ws on screen is two lines of HTML:```html-<script type="module" src="https://cdn.three.wsagent-3d.js"></script>+<script type="module" src="https://three.ws/agent-3d/latest/agent-3d.js"></script><agent-3d body="https://example.com/avatar.glb"></agent-3d>```@@ -209,7 +212,8 @@ Once you have the basics working, the following guides go deeper:- **[Embedding Guide](./embedding.md)** — all attributes, modes, events, and the JS API- **[Widget Types](./widgets.md)** — Turntable, Animation Gallery, Talking Agent, Passport, Hotspot Tour- **[Agent System Overview](./agent-system.md)** — runtime, skill registry, memory, emotion system-- **[Manifest Reference](../specs/AGENT_MANIFEST.md)** — full JSON schema with examples-- **[API Reference](./api-reference.md)** — complete JS API for `Agent3DElement`+- **[Manifest Reference](./agent-manifest.md)** — full JSON schema with examples+- **[REST API](./api-reference.md)** and **[JavaScript API](./js-api.md)** — backend and in-browser surfaces+- **[Agents vs. avatars](./agents-vs-avatars.md)** — the difference, and when to care-If you want to look at what's already in the hosted platform — browsing agents, using Widget Studio, or registering on-chain — visit [https://three.ws/](https://three.ws/).+If you want to look at what's already in the hosted platform — browsing agents, using Widget Studio, or registering on-chain — visit [https://three.ws](https://three.ws).diff --git a/public/docs/js-api.md b/public/docs/js-api.mdindex 04ce86b4f..631e4228b 100644--- a/public/docs/js-api.md+++ b/public/docs/js-api.md@@ -1,6 +1,8 @@-# API Reference+# JavaScript API Reference-Complete reference for all public classes, methods, and properties in three.ws.+Complete reference for all public classes, methods, and properties exported by the three.ws web component bundle (`agent-3d.js`).++> For the HTTP/REST surface, see [api-reference.md](./api-reference.md). For the high-level npm SDK, see [sdk.md](./sdk.md). For the `<agent-3d>` element attributes, see [web-component.md](./web-component.md).---@@ -322,7 +324,7 @@ Creates the mini axes viewport:Builds the entire dat.gui panel. On mobile (≤ 700 px), uses 220 px width and starts closed; on desktop, 260 px width and starts open.-See [Architecture: GUI Structure](ARCHITECTURE.md#gui-structure-datgui) for the full folder tree.+See [Architecture overview](./architecture.md) for the full folder tree.#### `updateGUI()`diff --git a/public/docs/layers.md b/public/docs/layers.mdindex 021e355d4..7bc0f2921 100644--- a/public/docs/layers.md+++ b/public/docs/layers.md@@ -1,329 +1,155 @@-# Using Your Own Layers+# Layers-This guide walks through everything you need to know to replace the default hero images with your own artwork. It covers image format selection, dimension requirements, transparency rules, depth value strategy, scene composition principles, and the mechanics of wiring new images into the theme. By the end, you will be able to swap any set of layered images into the parallax hero with confidence.+three.ws is split into four horizontal layers. Each layer can be used on its own. Each layer is independently replaceable as long as its contract with the rest of the system holds. This document describes what each layer owns, what it exports, and where to extend it.------## Why Four Layers?--The theme ships with exactly four image layers, and this is a deliberate choice, not a technical limitation.--**Fewer than four** (two or three layers) produces a noticeably shallow depth effect. The human visual system picks up parallax cues from relative motion between planes. With only two planes, the separation feels thin — more like a cheap slideshow transition than genuine depth.--**More than four** (five or six layers) begins to have diminishing returns on perceived depth while multiplying file size substantially. Each additional AVIF layer adds to the initial page load. At four layers, users with fast connections load the hero in well under a second. At six or seven layers, you may see layout shift or a flash of empty space while the far layers load.--Four layers also maps cleanly to the natural visual hierarchy of most landscape compositions: sky/far background, mid-distance scenery, near-ground elements, and foreground detail. This four-plane model is how matte painters and game background artists have structured parallax scrollers for decades — because it matches how human eyes decompose distance in the real world.--If your scene genuinely needs five planes (for example, a foggy mountain range with a distinct middle-fog layer), adding a fifth is technically straightforward. Just be deliberate about it.+For the overall request flow, see [How three.ws works](./how-it-works.md). For internal module names and paths, see [Architecture overview](./architecture.md).----## Image Format Comparison--| Format | Compression | Alpha (Transparency) | Browser Support | Recommended Use |-| ------ | --------------------- | ------------------------ | ----------------------------------- | -------------------------------------------- |-| AVIF | Excellent (AV1-based) | Yes (full alpha channel) | Chrome 85+, Firefox 93+, Safari 16+ | Primary format for all layers |-| WebP | Good (VP8-based) | Yes | Chrome 32+, Firefox 65+, Safari 14+ | Fallback for older Safari |-| PNG | Lossless | Yes | Universal | Source files only; not for production |-| JPEG | Good (DCT-based) | No | Universal | Far background only (no transparency needed) |--**AVIF** is the primary format for this theme. It delivers dramatically smaller file sizes than WebP or PNG at equivalent visual quality — typically 40–60% smaller than WebP and 70–80% smaller than PNG for photographic content. For the wide panoramic images that parallax layers require (often 3000px+ wide), this difference is significant.--AVIF supports a full alpha channel, which is critical for mid-distance, near-ground, and foreground layers (more on this below). The alpha channel in AVIF uses the same AV1 compression as the color data, so transparent regions cost very little in file size compared to PNG's lossless transparency.--**WebP** should be provided as a `<source>` fallback in the `<picture>` element for users on Safari 14–15, which supports WebP but not AVIF. Safari 16+ supports AVIF natively, so WebP coverage is increasingly less necessary, but it remains good practice.--**PNG** should be used only for source/master files during the design phase. Never ship raw PNGs as hero layer images in production — a single transparent PNG at 3000×2000px can easily exceed 5MB, versus under 300KB for an equivalent AVIF.--**JPEG** can be used for the far background layer if it has no transparency requirement, but AVIF still outperforms JPEG at the same file size, so there is rarely a reason to reach for JPEG.-------## Exact Dimensions--### Minimum Dimensions--No layer should be smaller than the maximum viewport width you expect users to visit your site on. In practice, `2400px` wide is a safe minimum for desktop displays including high-density (2x) monitors at 1440px logical width. For near/foreground layers that are scaled up by the depth compensation factor, you need additional resolution.--Calculate the minimum raw image width for each layer using:+## The contract```-minimum_width = viewport_max_width × scale_factor+┌──────────────────────────────────────────────┐+│ Embed layer │+│ <agent-3d> · widgets · iframe · SDKs │+├──────────────────────────────────────────────┤+│ Identity layer (optional) │+│ ERC-8004 · Metaplex Core · IPFS · SIWE/SIWS│+├──────────────────────────────────────────────┤+│ Agent layer │+│ LLM runtime · skills · memory · empathy │+├──────────────────────────────────────────────┤+│ Viewer layer │+│ three.js · GLTFLoader · AnimationMixer │+└──────────────────────────────────────────────┘```-Where `scale_factor = depth + 1` (matching the CSS scale compensation). For the far background at depth 8:--```-minimum_width = 1440 × 9 = 12,960px-```--That looks alarming, but the browser's compositor only ever renders the visible portion of a scaled layer, and AVIF compression means a 12,000px-wide sky image might still only be 400KB due to the repetitive nature of sky gradients.--In practice, the scale compensation is applied in CSS, not to the image itself. The image does not need to be 12,000px wide — it needs to have enough resolution that when it is scaled by 9× in CSS and the user views the center portion at screen resolution, it does not appear blurry. For photographic content at 96dpi display resolution and 2× device pixel ratio, a source image of `3000px` wide is usually sufficient for the far background, because large amounts of scale compression and the visual nature of background imagery makes moderate blurriness imperceptible.--### Ideal Dimensions by Layer--| Layer | Depth | Scale Factor | Recommended Width | Recommended Height |-| -------------- | ----- | ------------ | ----------------- | ------------------ |-| Far background | 8 | 9× | 3000px | 1500px |-| Mid-background | 5 | 6× | 2800px | 1400px |-| Near-ground | 2 | 3× | 2400px | 1200px |-| Foreground | 1 | 2× | 2400px | 1200px |--### Why Wide Panoramas Work Better Than Tall Images--The horizontal crop of each layer is controlled by `--md-image-position`, which maps to `object-position`. Because the scale compensation zooms the image in considerably, a tall image mostly wastes pixels on the top and bottom edges that will never be visible. A wide panorama uses that pixel budget on horizontal detail that _will_ be seen as the user adjusts `--md-image-position` or visits on different viewport widths.--The aspect ratio `2:1` (width:height) is a reliable default. If your scene has significant vertical interest in the mid-ground (tall trees, cliffs, buildings), you can go to `1.5:1`, but avoid portrait-oriented source images.+The layers communicate through one event bus (`agent-protocol`). No layer calls another layer's methods directly. This is the load-bearing invariant — keep it intact and any layer can be replaced.----## Transparency: Which Layers Need It--The far background layer (depth 8) does not need transparency. It represents the sky, open sea, or any expanse that fills the entire frame. This layer is the "canvas" behind everything else.--Every other layer — mid-background, near-ground, and foreground — needs a transparent background. Here is why:+## Layer 1 — Viewer-In a parallax scene, layers stack on top of each other. If the mid-background layer has a solid color fill behind the mountains or trees you painted, that fill will cover the sky layer behind it, creating a hard rectangular cutout effect instead of a natural scene. The mid-background needs to show only the mountains and the sky directly behind them needs to come from the actual far background layer below.+**What it owns:** rendering, loading, animation, camera, lights, post-processing.-This means:+**Doesn't know about:** agents, brains, wallets, manifests, the protocol bus.-- **Far background (depth 8):** Solid image, no transparency required-- **Mid-background (depth 5):** Transparent background — show only the mid-distance objects-- **Near-ground (depth 2):** Transparent background — show only near-ground objects and foreground elements-- **Foreground (depth 1):** Transparent background — typically plants, rocks, or architectural elements that frame the scene+The Viewer is pure three.js. It can be used as a standalone glTF inspector with no agent at all — and is, in the Turntable and Animation Gallery widgets.-A common mistake is forgetting that the scale compensation zooms each layer in significantly. If your mid-background layer has transparent edges on the left and right, those edges may be scaled into the visible viewport. If the object you painted is centered in the image and the transparent area at the edges is large, the visible part of the image may be smaller than expected after scaling. Always preview the scaled result in CSS before finalizing your AVIF files.+Concretely:------## AVIF Alpha Channel and Parallax CSS--AVIF's alpha channel is encoded using the same AV1 codec as the color data, stored as a separate "auxiliary image" in the AVIF container. When the browser decodes an AVIF file with an alpha channel, it composites the alpha against the background using standard Porter-Duff "source over" blending.+- `WebGLRenderer` configured for `devicePixelRatio`, demand-rendered (`viewer.invalidate()`), idle frames skipped.+- `GLTFLoader` with `DRACOLoader`, `KTX2Loader`, and `MeshoptDecoder` attached. Decoder URLs are version-pinned to the bundled three.js.+- `OrbitControls`, auto-disabled when an embedded glTF camera is selected.+- `AnimationMixer` plus a per-clip action-state map.+- HDRI environment, exposure / tone mapping controls, optional helpers (grid, axes, wireframe, skeleton).+- Multi-file resolution via `LoadingManager.setURLModifier()` so drag-and-drop `scene.gltf + scene.bin + textures/...` works locally without uploads.-This interacts with the parallax CSS cleanly. The `object-fit: cover` property applied to each layer image respects the transparency of the image — transparent pixels remain transparent after fitting and cropping. The `object-position` property (controlled by `--md-image-position`) shifts the image within its container while preserving transparency.+**Extension points the next layer uses:**-One thing to verify: when exporting AVIF from Photoshop, Affinity Photo, or Figma, confirm that you are exporting with "alpha channel" or "transparency" enabled. Some AVIF exporters default to a flat white or black matte on transparent areas, which will destroy your transparency information. Always open the exported AVIF in a browser to visually verify the alpha before publishing.+- `viewer._afterAnimateHooks` — per-frame callbacks (emotion decay, tweens)+- `viewer.invalidate()` — request a render+- `viewer.content` / `viewer.scene` / `viewer.mixer`+- `viewer.animationManager` — external clip lazy-loading-AVIF files with alpha channels are somewhat larger than those without, because the alpha information is stored alongside the color data. For foreground layers with complex transparency (detailed foliage cutouts, for example), the AVIF file size will be noticeably larger than a solid background layer of the same dimensions. This is expected and acceptable.+If you only need a glTF viewer with no AI, importing `@three-ws/avatar` gives you this layer with a clean programmatic API (`loadAvatar()`, `playAnimation()`, etc.). The hosted Turntable and Animation Gallery widgets at `/w/<id>` are also pure viewer-layer.----## The `@4x` Naming Convention+## Layer 2 — Agent-Image files in this theme follow the convention:+**What it owns:** the LLM tool-loop, skills, memory, the empathy / emotion blend, the protocol bus.-```-```+**Doesn't know about:** how the LLM is hosted, where the wallet lives, which embed surface is showing it.-The `@4x` suffix is a source resolution indicator borrowed from iOS/macOS asset catalog conventions, where `@2x` means 2× pixel density, `@3x` means 3×, and so on. In this context, `@4x` signals that these are high-resolution source images intended to be displayed at a fraction of their pixel dimensions (because CSS scaling reduces them on screen).+Modules:-This naming convention has two benefits:+- **`agent-protocol.js`** — singleton `EventTarget` bus. Every action is a `CustomEvent`. 200-event ring buffer (`protocol.history`) for debugging.+- **`runtime/index.js`** — LLM tool-loop. Builds the system prompt from `instructions.md` + memory + skills, calls the provider, dispatches tool calls, feeds results back. Capped at `MAX_TOOL_ITERATIONS = 8`.+- **`runtime/scene.js`** — `SceneController`, the only bridge between agent intent and three.js reality: `playClipByName`, `playAnimationByHint`, `lookAt`, `setExpression`, `loadGLB`, `loadClip`, `moveTo`.+- **`runtime/tools.js`** — built-in tools (`wave`, `lookAt`, `play_clip`, `setExpression`, `speak`, `remember`) and stage-scoped tools (`observe_agents`, `say_to_agent`).+- **`runtime/speech.js`** — TTS (ElevenLabs / Web Speech API) and STT (browser `SpeechRecognition`). Silent no-op where unavailable.+- **`agent-skills.js`** — skill registry. Skills are dynamically loaded bundles (`SKILL.md`, `tools.json`, `handlers.js`). Trust modes (`any` / `owned-only` / `whitelist`).+- **`agent-memory.js`** — four-type memory store (`user`, `feedback`, `project`, `reference`). File-based memories live as frontmatter `.md` files indexed by `MEMORY.md` plus an append-only `timeline.jsonl`.+- **`agent-avatar.js`** — the empathy layer. Translates bus events into a continuous emotion blend (neutral, concern, celebration, patience, curiosity, empathy) and drives morph targets, head tilt, and gaze.-1. It documents the intended display scale in the filename, helping future maintainers understand why images seem larger than expected.-2. It prevents confusion with standard-resolution images. If you later add a WebP fallback or generate responsive sizes, you can name them `[email protected]` and `[email protected]` without ambiguity.+The full agent layer can run against any three.js scene, not just our viewer — `SceneController` only needs the standard handles.-The `@4x` suffix has no special meaning to browsers or MkDocs — it is purely a human-readable convention.+**Event bus vocabulary:** see [architecture.md §2](./architecture.md#2-the-event-bus-agent-protocoljs).----## Depth Value Selection Strategy--The four depth values used in this theme are `8`, `5`, `2`, and `1`. Understanding why these specific values were chosen helps you adjust them intelligently for your own scene.+## Layer 3 — Identity-**Depth 8 (far background):** The maximum depth value used. At depth 8, the visual scroll rate is approximately 11% of the page scroll speed. This layer barely moves, giving it a distant, immovable quality appropriate for sky or open horizon.+**What it owns:** persistent identity across sessions, devices, and embed hosts. Wallet auth, on-chain registration, IPFS-pinned manifests, signed action diary.-**Depth 5 (mid-background):** At depth 5, the visual scroll rate is approximately 33%. This layer moves noticeably but slowly, conveying mid-distance.+**Doesn't know about:** which avatar is loaded, what the LLM is doing.-**Depth 2 (near-ground):** At depth 2, the visual scroll rate is approximately 56%. This layer moves at just over half scroll speed, feeling close.+**Entirely optional.** Most agents work fine without it. Removing this layer drops you back to a local-only experience — the agent still runs, but it has no persistent identity.-**Depth 1 (foreground):** At depth 1, the visual scroll rate is 50%. Wait — why is foreground (depth 1) slower than near-ground (depth 2)?+Modules:-This is a quirk of the non-linear relationship between depth values and scroll rate. The rate formula is `p / (p + depth × p) = 1 / (1 + depth)`. At depth 2, rate is `1/3 ≈ 0.33`... wait, let us recalculate against the actual perspective value:+- **`agent-identity.js`** — the passport + diary. Stable agent ID, owner address, signed action history. Backed by `localStorage` (cache) and `/api/agents/<id>` (canonical). Listens on the protocol bus and POSTs `speak` / `skill-done` / `validate` / `sign` events to `/api/agent-actions`.+- **`memory/`** — `local`, `ipfs`, `encrypted-ipfs`, or `none`. Declared on the manifest.+- **`erc8004/`** — on-chain registries. `IdentityRegistry` (mints agent token with `tokenURI`), `ReputationRegistry` (signed feedback), `ValidationRegistry` (validation report hashes). Per-chain addresses in `erc8004/abi.js`.+- **`solana-agent/`** — Solana counterpart. Metaplex Core asset mint + Solana Attestation Service (SAS) attestations.+- **`auth/` + `wallet/`** — SIWE / SIWS for backend mutations; Privy for email/social → embedded wallet onboarding; session cookies after wallet proof.-```-rate = perspective / (perspective + |translateZ|)- = 2.5rem / (2.5rem + (depth × 2.5rem))- = 1 / (depth + 1)-```--So at depth 1: rate = `1/2 = 50%`; at depth 2: rate = `1/3 = 33%`; at depth 5: rate = `1/6 ≈ 17%`; at depth 8: rate = `1/9 ≈ 11%`.--The depth values `8 > 5 > 2 > 1` correctly produce scroll rates `11% < 17% < 33% < 50%` — each closer layer moves faster. The gap between values is nonlinear: going from depth 8 to depth 5 is a large jump in scroll rate (11% to 17%), while going from depth 2 to depth 1 is a smaller jump (33% to 50%). This nonlinearity means you get dramatic separation at the far end and subtler separation at the near end — which is how real-world parallax works, as atmospheric perspective compresses apparent depth differences at distance.--**Choosing your own depth values:** Keep the ratio between adjacent depth values large enough to produce a visible difference. Values too close together (e.g., `3`, `2.5`, `2`, `1.5`) produce a nearly flat-looking result because the scroll rate differences are tiny. Values too far apart (e.g., `20`, `10`, `5`, `1`) can make the foreground layer scroll so fast it looks jarring. The range `1–10` with nonlinear spacing works well for most hero sections.+Per-chain registry addresses, ABIs, and helpers ship as `@three-ws/sdk`. ENS attestations are also handled here — see [register-onchain.md](./tutorials/register-onchain.md).----## `object-position` as Crop Control--Each parallax layer is displayed using `object-fit: cover` (or equivalent background behavior), which crops the image to fill its container. The `--md-image-position` CSS variable controls where in the image the crop is taken from, horizontally:+## Layer 4 — Embed-```css-.parallax__layer img {- object-fit: cover;- object-position: calc(var(--md-image-position) * 1%) center;-}-```+**What it owns:** the public face. The web component, widgets, iframe surfaces, the CDN bundle, the SPA, edge routing.-`--md-image-position: 0` crops to the left edge of the image. `--md-image-position: 100` crops to the right edge. `--md-image-position: 50` centers the image (the default).+**Doesn't know about:** the contents of the manifest, what the LLM said, what the avatar is doing — only that they should be presented somewhere.-This is primarily useful for adjusting the composition after images are placed. If your mountain peak is 20% from the right edge of your source image, set `--md-image-position: 80` to shift the crop rightward so the peak is centered in the viewport.+Modules:-Each layer has its own `--md-image-position` value, allowing independent horizontal positioning of each depth plane. A common technique is to set the foreground layer's position slightly offset from the background — a foreground rock formation at 40% and the background peak at 60% creates a natural sense of different horizontal planes.+- **`element.js`** — `<agent-3d>` custom element. Lazy-boots via `IntersectionObserver` (unless `eager`). Enforces origin allowlist. Exposes attributes for `body`, `brain`, `agent-id`, `manifest`, `mode` (`inline` / `floating` / `section` / `fullscreen`), `voice`, and more. Public methods: `say()`, `ask()`, `installSkill()`, `expressEmotion()`, `play()`, `lookAt()`, `dispose()`.+- **`agent-stage.js`** — `<agent-stage>` for hosting multiple agents in one shared scene. See [multi-agent.md](./multi-agent.md).+- **`widget-types.js`** — the five widget variants: Turntable, Animation Gallery, Talking Agent, ERC-8004 Passport, Hotspot Tour.+- **`lib.js`** — the CDN entry. Imports the element, registers it, re-exports the public surface (`defineElement`, `Agent3DElement`, `AgentStageElement`, helpers).+- **`embed-action-bridge.js`** — the `postMessage` protocol. Iframe widgets and the web component speak the same dialect, so host pages can drive either with the same code.+- **`app.js`** — the main SPA. URL routing via hash (`#model=`, `#agent=`, `#kiosk=`) and query (`?agent=`) params.+- **`vercel.json`** — edge routing. Clean URLs (`/agent/<id>`, `/agent/<id>/embed`, `/a/<chainId>/<agentId>`, `/w/<widget-id>`) map to the right HTML entries.-**Important:** Because scale compensation increases the displayed size of far layers dramatically, far layers (depth 8) have a large amount of image content outside the visible area. Adjusting `--md-image-position` for far layers shifts through a wide panorama smoothly. For near layers (depth 1), the image is scaled less, so the same change in `--md-image-position` value moves the crop over a smaller physical distance — adjustment is more sensitive.+The embed layer's contract is the only thing third-party developers see directly. Keep its API surface small and stable; changes here are breaking changes per [SemVer](./changelog.md#versioning-policy).----## Scene Composition Principles--### Horizon Alignment--All layers should share the same horizon line — the perceived eye level of the scene. If the background sky meets the mountains at one-third of the image height, the mid-ground trees should also start roughly at one-third, with their roots near the bottom. Mismatched horizon lines make layers feel like they are from different scenes even when the content is superficially similar.+## Cross-cutting: the protocol bus-### Foreground Anchoring to the Bottom+Every layer above the Viewer subscribes to the same `agent-protocol` event bus.-Foreground elements should be rooted at the _bottom_ of the image frame, not floating in the middle. Plants, rocks, architectural elements, and terrain features that anchor to the bottom edge of the frame appear to "sit" on the ground plane, which is where the user expects near objects to be. Floating foreground elements — a tree whose trunk is not connected to the bottom of the frame — look ungrounded and break the illusion.--Set the foreground layer's `object-position` vertical value to `bottom` to ensure the anchoring is respected:--```css-.parallax__layer--foreground img {- object-position: calc(var(--md-image-position) * 1%) bottom;-}-```+- **Avatar layer** listens for `speak`, `gesture`, `skill-done`, `skill-error`, `validate`, `load-*` to pick emotion blends.+- **Identity layer** listens for `speak`, `remember`, `sign`, `skill-done`, `validate`, `load-end` and persists them.+- **Chat UI** listens for `speak` (render bubbles) and `voice:transcript` (live STT).+- **Memory** listens for `remember`.+- **`postMessage` bridge** mirrors a curated subset to host pages.-### Color Consistency+None of these modules know about each other. They subscribe by event type. That's the whole abstraction — and the reason any one of them can be ripped out and replaced.-All layers should be lit from the same direction with the same color temperature. A background with warm afternoon sun (golden, directional) combined with a foreground painted with cool overcast light (flat, blue-white) will look artificial regardless of how precise your depth values are. The eye immediately detects lighting inconsistency as a sign that the image is composited.--If your layers come from different source photographs, do color grading passes to unify the white balance, shadow tone, and highlight color before exporting. A quick way to check: convert all layers to grayscale and verify that the contrast and tonal ranges match across layers.-------## Edge Handling: Avoiding Hard Cutout Artifacts--When a transparent layer is scaled up by the CSS `scale()` transform, its edges are also scaled up. If your transparent layer has a hard pixel edge — one row of semi-transparent pixels and then fully transparent — that hard edge will become visible as a sharp line when the layer is scaled into the viewport.--Fix this by painting a soft feathered edge on transparent layers. In Photoshop: apply a `Refine Edge` or `Select and Mask` operation on your transparency mask with 20–40px feathering before exporting. In Figma: use `Blur > Layer Blur` on the edge regions at a low value (4–8px) before exporting. In Affinity Photo: use the "Feather" slider in the Pixel Selection panel.--The amount of feathering needed scales with your depth value. Layers at depth 2 (scale 3×) need more feathering than layers at depth 1 (scale 2×), because the larger scale factor amplifies edge sharpness more.-------## Testing Layers Before AVIF Conversion--AVIF conversion is lossy and takes time. Before committing to the AVIF encoding step, verify your layer composition using PNG files in a browser.--The fastest method: stack your PNG layers in a `<div>` with `position: absolute; inset: 0` on each layer, then view it in a browser. If the layers look correct as a flat composite, they will look correct in the parallax hero (depth and scroll behavior aside).--For a more accurate preview, open your layer stack in **Figma** or **Photoshop** as individual layers in a single file. Toggle each layer's visibility to confirm that each plane contains only the content intended for that depth. Check that transparent regions are genuinely transparent, not filled with white or black.--Pay particular attention to:--- The mid-background layer's sky region (should be transparent, not solid)-- The foreground layer's upper region (should be transparent above the foreground objects)-- The exact bottom edge of all non-background layers (should feather out, not hard-cut)--Once you are satisfied with the PNG composite, convert to AVIF using `squoosh`, `avifenc`, or your image editing application's export dialog. Encode at quality 60–75 for photographic content and 75–85 for illustrated/painted content. Check the output file in a browser before publishing.-------## File Placement--Place finished AVIF files at:--```-docs/assets/hero/[email protected]-docs/assets/hero/[email protected]-docs/assets/hero/[email protected]-docs/assets/hero/[email protected]-```--MkDocs Material automatically copies the entire `docs/assets/` directory to the built site's `assets/` directory. No additional configuration is required. The paths used in `home.html` should reference `/assets/hero/` (without the `docs/` prefix) because MkDocs strips the `docs/` root from all asset paths in the build output.--**Linux file path note:** File paths on Linux (including MkDocs' build process and most CI environments) are case-sensitive. `[email protected]` and `[email protected]` are different files. Always use lowercase filenames and verify paths match exactly between the file system and your HTML templates.-------## The `<picture>` Element Structure in `home.html`--Each layer is rendered using a `<picture>` element to support both AVIF and WebP with a PNG fallback:--```html-<picture class="parallax__layer" style="--md-parallax-depth: 8; --md-image-position: 50">- <source type="image/avif" srcset="/assets/hero/[email protected]" />- <source type="image/webp" srcset="/assets/hero/[email protected]" />- <img src="/assets/hero/[email protected]" alt="" loading="eager" decoding="async" />-</picture>-```--Browsers read `<source>` elements in order and use the first type they support. An AVIF-capable browser (Chrome 85+, Firefox 93+, Safari 16+) uses the AVIF. A browser with WebP but no AVIF (Safari 14–15) uses the WebP. Any older browser falls back to the PNG.--The `alt=""` on the `<img>` is intentional. Parallax background images are decorative — they do not convey content that a screen reader user needs. An empty `alt` attribute tells assistive technology to ignore the image entirely, which is the correct behavior.--The `loading="eager"` attribute on the first (far background) layer ensures it begins loading immediately, avoiding a flash of empty background. Layers at depth 2 and 1 (near and foreground) can use `loading="lazy"` if desired, since they are partially revealed only as the user scrolls.--### Adding a WebP Fallback Source--If you only export AVIF files initially and want to add WebP fallbacks later:--1. Convert each AVIF source to WebP using `squoosh` or `cwebp`: `cwebp -q 80 [email protected] -o docs/assets/hero/[email protected]`-2. Place the WebP files alongside the AVIF files in `docs/assets/hero/`-3. Add a `<source type="image/webp">` element to each `<picture>` block, between the AVIF source and the `<img>` tag-------## Common Mistakes--**Depth values too close together.** Using depths like `4`, `3`, `2`, `1` produces almost no visible parallax separation. The scroll rate difference between depth 4 (`rate = 1/5 = 20%`) and depth 3 (`rate = 1/4 = 25%`) is only 5 percentage points. Spread your values further apart.--**Forgetting transparency on non-background layers.** The mid-ground and near-ground layers must have transparent backgrounds. Exported PNGs with white or black backgrounds turn into opaque rectangles that cover the layers behind them, making the scene look like a stack of colored blocks.--**Wrong file paths (case-sensitive on Linux).** The most common deploy-time bug. The file is `[email protected]` but the template references `[email protected]`. Works fine on macOS (case-insensitive filesystem), fails silently on Linux CI and production. Standardize on all-lowercase filenames.--**Not accounting for scale when evaluating image quality.** A layer at depth 5 (scale factor 6×) will be rendered at 6× its natural size. Zoom into your AVIF file at 600% in a browser before publishing to check that it does not show blocking artifacts or excessive blurring at the scale it will be displayed.--**Using portrait or square images.** The parallax CSS renders layers in a wide landscape viewport. Portrait images will be cropped heavily, often showing nothing but a narrow vertical strip of content. Always work with landscape-format (wider-than-tall) source images.--**Opacity on individual layers without considering blending.** If you add `opacity` to a mid-ground layer to create a haze effect, note that CSS `opacity` creates a new stacking context, which can interact unexpectedly with `z-index`. Use `mix-blend-mode` or AVIF-level transparency instead.+If you're building a custom layer (a 2D sprite avatar, a vector-store memory backend, a different LLM provider), you only need to listen to and emit the same event vocabulary. Everything else is wiring.----## Swapping Layers Without Breaking the Site--To replace existing layer images:+## Build targets-1. Prepare your new AVIF (and optionally WebP) files following the naming conventions above.-2. Place them in `docs/assets/hero/`.-3. Open `docs/overrides/home.html` (or wherever your theme's `home.html` override lives).-4. Update the `srcset` path in each `<source>` element and the `src` in the `<img>` fallback to point to your new filenames.-5. Adjust `--md-parallax-depth` and `--md-image-position` custom properties on each `<picture>` element if your new scene has different depth requirements or needs a horizontal crop offset.-6. Run `mkdocs serve` locally and scroll through the hero to visually verify the layers.-7. Check that transparent layers do not show hard edges or cutout artifacts.-8. Run `mkdocs build` to generate the static site and confirm the AVIF files appear in `site/assets/hero/`.+The same source tree produces three independent builds:-If you want to update only one layer — for example, replacing the foreground with a seasonal variation — you only need to update that one `<picture>` block and its associated file. The other layers are independent.+- **App** — `npm run build`. The full SPA into `dist/`. Editor, agent pages, discover, studio, PWA manifest. Multi-page Rollup config with a Vercel-style dev middleware.+- **Library** — `npm run build:lib`. `src/lib.js` → `dist-lib/agent-3d.js` (ES module + UMD). Three.js and ethers stay bundled — the file is intentionally self-contained so a single `<script type="module">` is the only thing a third party needs.+- **Artifact** — `vite.config.artifact.js`. A zero-dependency bundle for Claude artifact embeds. Inlined everything, no external script tags, no dynamic imports.-After a layer swap, clear your browser cache or use an incognito window to test, since browsers aggressively cache image resources and may serve the old image even after a rebuild.+Versioned CDN bundles are published at `/agent-3d/<version>/agent-3d.js`. Use `latest` for auto-updates or pin to a version for stability. See [changelog.md](./changelog.md) for release history.----## Quick Reference: Layer Properties--| Property | Far Background | Mid-Background | Near-Ground | Foreground |-| --------------------- | -------------- | -------------- | ----------- | ---------- |-| `--md-parallax-depth` | `8` | `5` | `2` | `1` |-| Scale factor | `9×` | `6×` | `3×` | `2×` |-| Visual scroll rate | ~11% | ~17% | ~33% | ~50% |-| Needs transparency | No | Yes | Yes | Yes |-| Recommended width | 3000px | 2800px | 2400px | 2400px |-| `loading` attribute | `eager` | `eager` | `lazy` | `lazy` |-| `z-index` (auto) | 2 | 5 | 8 | 9 |+## What's next-Adjust `--md-parallax-depth` first when you want to change how dramatic the parallax separation feels. Adjust `--md-image-position` when you want to shift the horizontal crop without changing the depth behavior.+- **[Architecture overview](./architecture.md)** — module-by-module deep dive+- **[Agent system](./agent-system.md)** — runtime, skills, memory in detail+- **[Embedding](./embedding.md)** — the public face of the embed layer+- **[SDK reference](./sdk.md)** — `@three-ws/sdk` and friendsdiff --git a/public/docs/mcp.md b/public/docs/mcp.mdindex 8b5c26997..7b51ea6d0 100644--- a/public/docs/mcp.md+++ b/public/docs/mcp.md@@ -104,7 +104,7 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)"mcpServers": {"3dagent": {"command": "npx",- "args": ["-y", "@3dagent/mcp-server", "--url", "https://three.ws/"]+ "args": ["-y", "@3d-agent/mcp-server", "--url", "https://three.ws/"]}}}@@ -349,7 +349,7 @@ Here is a realistic conversation showing how Claude uses the MCP tools end-to-en1. `get_avatar({ slug: "storm-mage" })` — resolves the UUID and model URL.-2. `validate_model({ url: "https://cdn.three.wsu/…/storm-mage.glb" })` — runs the Khronos validator.+2. `validate_model({ url: "https://cdn.three.ws/u/…/storm-mage.glb" })` — runs the Khronos validator.Response:```@@ -358,7 +358,7 @@ Here is a realistic conversation showing how Claude uses the MCP tools end-to-en[WRN] NODE_EMPTY: node "Armature" has no mesh and no children```-3. `inspect_model({ url: "https://cdn.three.wsu/…/storm-mage.glb" })` — structural overview.+3. `inspect_model({ url: "https://cdn.three.ws/u/…/storm-mage.glb" })` — structural overview.Response:```@@ -417,7 +417,7 @@ Tool execution errors (avatar not found, fetch failure, validation library crashClone the repo and start the dev server:```bash-git clone https://github.com/3dagent/3dagent+git clone https://github.com/nirholas/three.wsnpm installnpm run dev# MCP endpoint: http://localhost:5173/api/mcpdiff --git a/public/docs/memory.md b/public/docs/memory.mdindex 3240c1bd0..036f56aff 100644--- a/public/docs/memory.md+++ b/public/docs/memory.md@@ -1,6 +1,6 @@# Memory System-Agent memory lets a three.ws remember things between sessions. Without it, every conversation starts fresh — the agent has no idea who you are, what you talked about last time, or what preferences you've stated. With memory, the agent builds up a persistent model of the user and context that it draws on automatically at the start of each conversation.+Agent memory lets an agent remember things between sessions. Without it, every conversation starts fresh — the agent has no idea who you are, what you talked about last time, or what preferences you've stated. With memory, the agent builds up a persistent model of the user and context that it draws on automatically at the start of each conversation.This document covers how agent memory works, how to configure storage modes, and how to read and write memories from code.diff --git a/public/docs/multi-agent.md b/public/docs/multi-agent.mdindex 4e4c63fbb..e35e8ec1a 100644--- a/public/docs/multi-agent.md+++ b/public/docs/multi-agent.md@@ -17,7 +17,7 @@ This guide covers the two main approaches — a **shared stage** (one WebGL contThe `<agent-stage>` element is a shared scene host. All `<agent-3d>` children render inside a single WebGL canvas — one renderer, one context, positioned automatically in a named formation.```html-<script type="module" src="https://cdn.three.ws/agent-3d.js"></script>+<script type="module" src="https://three.ws/agent-3d/latest/agent-3d.js"></script><agent-stage id="stage" formation="row" style="width:100%;height:540px"><agent-3ddiff --git a/public/docs/permissions.md b/public/docs/permissions.mdindex 697bfda3a..22e0784af 100644--- a/public/docs/permissions.md+++ b/public/docs/permissions.md@@ -62,11 +62,11 @@ When a skill or agent action requires a delegation that doesn't yet exist, the g### Programmatically-Use `encodeScopedDelegation` and `signDelegation` from `@3dagent/sdk/permissions` (or directly from [src/permissions/toolkit.js](../../src/permissions/toolkit.js)):+Use `encodeScopedDelegation` and `signDelegation` from `@three-ws/sdk/permissions` (or directly from [src/permissions/toolkit.js](../../src/permissions/toolkit.js)):```js-import { encodeScopedDelegation, signDelegation } from '@3dagent/sdk/permissions';-import { CAVEAT_ENFORCERS } from '@3dagent/sdk/erc7710';+import { encodeScopedDelegation, signDelegation } from '@three-ws/sdk/permissions';+import { CAVEAT_ENFORCERS } from '@three-ws/sdk/erc7710';import { AbiCoder } from 'ethers';const CHAIN_ID = 84532; // Base Sepolia@@ -129,7 +129,7 @@ const res = await fetch('/api/permissions/grant', {Skills call `redeemFromSkill` from [src/runtime/delegation-redeem.js](../../src/runtime/delegation-redeem.js). This is the main entrypoint for any on-chain action a skill needs to take:```js-import { redeemFromSkill } from '@3dagent/sdk/runtime';+import { redeemFromSkill } from '@three-ws/sdk/runtime';// Inside a skill handler:export async function execute_swap({ tokenIn, tokenOut, amount }, ctx) {@@ -164,7 +164,7 @@ export async function execute_swap({ tokenIn, tokenOut, amount }, ctx) {To monitor redemption events:```js-import { subscribeRedeemEvents } from '@3dagent/sdk/runtime';+import { subscribeRedeemEvents } from '@three-ws/sdk/runtime';const unsubscribe = subscribeRedeemEvents((event) => {console.log(event.type, event.payload);@@ -181,7 +181,7 @@ const unsubscribe = subscribeRedeemEvents((event) => {Mount the panel for an agent:```js-import { mountManagePanel } from '@3dagent/sdk/permissions';+import { mountManagePanel } from '@three-ws/sdk/permissions';const { unmount } = mountManagePanel({container: document.getElementById('permissions-container'),@@ -197,7 +197,7 @@ Revoking has two parts: the on-chain transaction and the server-side mirror.```jsimport { Contract, BrowserProvider } from 'ethers';-import { DELEGATION_MANAGER_DEPLOYMENTS, DELEGATION_MANAGER_ABI } from '@3dagent/sdk/erc7710';+import { DELEGATION_MANAGER_DEPLOYMENTS, DELEGATION_MANAGER_ABI } from '@three-ws/sdk/erc7710';// 1. Submit disableDelegation on-chainconst provider = new BrowserProvider(window.ethereum);diff --git a/public/docs/quick-start.md b/public/docs/quick-start.mdindex 99e297626..ce56c9a70 100644--- a/public/docs/quick-start.md+++ b/public/docs/quick-start.md@@ -8,7 +8,7 @@ Get a live three.ws on your page in under 10 minutes.- **Browser:** Chrome 90+, Firefox 89+, or Safari 15+ (WebGL 2.0 required)- **A 3D model:** GLB/glTF file. No model yet? Use the sample avatar below.-- **Node.js 18+:** Only needed if you're running the dev server or building from source.+- **Node.js 24.x:** Only needed if you're running the dev server or building from source.---@@ -27,8 +27,8 @@ The fastest path. No npm, no bundler, no build step.</style></head><body>- <script type="module" src="https://cdn.three.wsagent-3d.js"></script>- <agent-3d body="https://cdn.three.wsmodels/sample-avatar.glb"></agent-3d>+ <script type="module" src="https://three.ws/agent-3d/latest/agent-3d.js"></script>+ <agent-3d body="https://cdn.three.ws/models/sample-avatar.glb"></agent-3d></body></html>```@@ -49,16 +49,16 @@ The fastest path. No npm, no bundler, no build step.## Option B — npm Install-For projects that have a build step (Vite, Webpack, Create React App, etc.):+For projects that have a build step (Vite, Webpack, Create React App, Next.js, etc.):```bash-npm install @3dagent/sdk+npm install @three-ws/sdk```### Plain JS / Vite```js-import '@3dagent/sdk'; // registers <agent-3d> as a side effect+import '@three-ws/sdk'; // registers <agent-3d> as a side effect// The custom element is now available in HTML, or create it programmatically:const agent = document.createElement('agent-3d');@@ -67,10 +67,10 @@ agent.style.cssText = 'width:400px;height:500px;display:block';document.body.appendChild(agent);```-### React+### React / Next.js```jsx-import '@3dagent/sdk';+import '@three-ws/sdk';export function AgentWidget() {return (@@ -82,7 +82,14 @@ export function AgentWidget() {}```-React passes unknown attributes to native elements as-is, so all `<agent-3d>` attributes work without wrappers.+React passes unknown attributes to native elements as-is, so all `<agent-3d>` attributes work without wrappers. In Next.js App Router, mark the importing module as a client component (`'use client'`).++> Other published SDKs you may want alongside `@three-ws/sdk`:+>+> - `@three-ws/agent-ui` — pre-built chat panel, voice button, accessory dock+> - `@three-ws/avatar` — programmatic avatar loader and animator (Node + browser)+> - `@three-ws/solana-agent` — Solana identity + Metaplex Core helpers+> - `@3d-agent/mcp-server` — MCP server you point Claude Desktop, Cursor, or Claude Code at---@@ -115,7 +122,7 @@ See the [CORS gotcha](#cors) below if your GLB is on a different domain.## Adding an AI Brain-The `brain` attribute turns the 3D viewer into a conversational agent. Pass a Claude model ID:+The `brain` attribute turns the 3D viewer into a conversational agent:```html<agent-3d@@ -130,7 +137,7 @@ The `brain` attribute turns the 3D viewer into a conversational agent. Pass a Cl| Attribute | What it does ||-----------|--------------|-| `brain` | Claude model ID to use for the LLM brain (`claude-sonnet-4-6`, `claude-opus-4-7`, `claude-haiku-4-5-20251001`). Omit for a viewer-only display with no AI. |+| `brain` | LLM model ID. Anthropic: `claude-sonnet-4-6`, `claude-opus-4-7`, `claude-haiku-4-5`. OpenAI: `gpt-4o`, `gpt-4o-mini`. Omit for a viewer-only display with no AI. || `instructions` | System prompt for the agent's personality and role. || `mode` | Layout mode: `inline` (flows with page content), `floating` (fixed bubble in a corner), `fullscreen`, or `section`. Default: `inline`. |@@ -141,7 +148,7 @@ The chat input and microphone button appear automatically when `brain` is set. TIf you've registered an agent on the platform, load it by its UUID instead:```html-<agent-three.ws-id="a1b2c3d4-e5f6-7890-abcd-ef1234567890"></agent-3d>+<agent-3d agent-id="a1b2c3d4-e5f6-7890-abcd-ef1234567890"></agent-3d>```The element fetches the agent manifest — which includes the model URL, instructions, skills, and memory configuration — from the API. No other attributes needed.@@ -154,7 +161,7 @@ The fastest path to an embeddable 3D experience is an iframe widget. Build one i```html<iframe- src="https://three.ws/widget#widget=wdgt_YOUR_ID&kiosk=true"+ src="https://three.ws/app#widget=wdgt_YOUR_ID&kiosk=true"width="600"height="600"style="border:0;border-radius:12px;max-width:100%"@@ -173,7 +180,7 @@ The fastest path to an embeddable 3D experience is an iframe widget. Build one i| `passport` | On-chain identity card backed by ERC-8004. || `hotspot-tour` | Annotated 3D scenes with clickable points of interest. |-For the full widget API including `postMessage` events, see the [Widget docs](../WIDGETS.md).+For the full widget API including `postMessage` events, see the [Widget docs](./widgets.md).---@@ -182,8 +189,8 @@ For the full widget API including `postMessage` events, see the [Widget docs](..For contributors or self-hosters:```bash-git clone https://github.com/nirholas/3d-agent.git-cd 3d-agent+git clone https://github.com/nirholas/three.ws.git+cd three.wsnpm installcp .env.example .env # fill in your API keys (see below)npm run dev@@ -256,7 +263,8 @@ The browser's `getUserMedia` API (microphone access for push-to-talk) requires HIf your page has a strict `Content-Security-Policy`, the script embed needs:```-script-src 'self' https://cdn.three.ws;+script-src 'self' https://three.ws;+connect-src 'self' https://three.ws https://cdn.three.ws;```If you're embedding inside a sandboxed iframe, make sure the parent grants `allow-scripts allow-same-origin`. For sandboxed environments where the script embed won't work, use the iframe widget instead — it runs in its own browsing context and is unaffected by the parent CSP.@@ -271,7 +279,8 @@ If you're embedding inside a sandboxed iframe, make sure the parent grants `allo## Next Steps-- [Embed Guide](../how-it-works.md) — deep dive on attributes, events, and the JS API-- [Widget Types](../WIDGETS.md) — full reference for iframe embeds and postMessage-- [Agent System](../ARCHITECTURE.md) — how the brain, memory, and skills layer work-- [API Reference](../API.md) — backend endpoints for uploading models and managing agents+- [Embedding Guide](./embedding.md) — deep dive on attributes, events, and the JS API+- [Widget Types](./widgets.md) — full reference for iframe embeds and postMessage+- [Agent System](./agent-system.md) — how the brain, memory, and skills layers work+- [REST API](./api-reference.md) and [JavaScript API](./js-api.md) — backend and in-browser surfaces+- [SDK Reference](./sdk.md) — `@three-ws/sdk`, `@three-ws/agent-ui`, `@three-ws/avatar`, `@three-ws/solana-agent`diff --git a/public/docs/reputation.md b/public/docs/reputation.mdindex 55e089e8d..1f78e869b 100644--- a/public/docs/reputation.md+++ b/public/docs/reputation.md@@ -45,7 +45,7 @@ A full reputation dashboard — showing aggregate stats and all recent reviews### Via the SDK```js-import { submitReputation } from '@3dagent/sdk/erc8004';+import { submitReputation } from '@three-ws/sdk/erc8004';const txHash = await submitReputation({chainId: 8453, // Base mainnet@@ -84,7 +84,7 @@ The `ReputationDashboard` class ([src/reputation-ui.js](../../src/reputation-ui.### Via the SDK```js-import { getReputation, getRecentReviews } from '@3dagent/sdk/erc8004';+import { getReputation, getRecentReviews } from '@three-ws/sdk/erc8004';// Aggregate statsconst { total, count, average } = await getReputation({diff --git a/public/docs/sdk.md b/public/docs/sdk.mdindex 31df4724c..084d1044e 100644--- a/public/docs/sdk.md+++ b/public/docs/sdk.md@@ -5,7 +5,7 @@ This document covers programmatic use of three.ws beyond simple embedding. There| Artifact | Package | Use case ||---|---|---|| **Web component bundle** | `agent-3d.js` (CDN or `TARGET=lib` build) | Drop-in `<agent-3d>` element + programmatic viewer/runtime APIs |-| **AgentKit SDK** | `@nirholas/agent-kit` | Ship an ERC-8004 agent: chat panel, on-chain registration, `.well-known` manifests |+| **AgentKit SDK** | `@three-ws/sdk` | Ship an ERC-8004 agent: chat panel, on-chain registration, `.well-known` manifests |Both are Apache-2.0 licensed. Neither requires the other.@@ -32,7 +32,7 @@ Both are Apache-2.0 licensed. Neither requires the other.```bash# The main repo — build TARGET=lib yourself, or import src/lib.js directly-git clone https://github.com/3dagent/3dagent+git clone https://github.com/nirholas/three.wsnpm installnpm run build:lib # → dist-lib/agent-3d.js + dist-lib/agent-3d.umd.cjs```@@ -135,14 +135,14 @@ const json = await res.json();----## @nirholas/agent-kit SDK+## @three-ws/sdkA separate package for shipping ERC-8004 agents. It does not depend on the viewer — it's backend-friendly and works in any JS environment (Node, browser, edge functions).### Installation```bash-npm install @nirholas/agent-kit+npm install @three-ws/sdk````ethers@^6` is a peer dependency — only needed for on-chain operations (`register`, `connectWallet`).@@ -150,8 +150,8 @@ npm install @nirholas/agent-kit### Quick start```js-import { AgentKit } from '@nirholas/agent-kit';-import '@nirholas/agent-kit/styles';+import { AgentKit } from '@three-ws/sdk';+import '@three-ws/sdk/styles';const agent = new AgentKit({name: 'Aria',@@ -245,7 +245,7 @@ import {IDENTITY_REGISTRY_ABI,REGISTRY_DEPLOYMENTS,agentRegistryId,-} from '@nirholas/agent-kit';+} from '@three-ws/sdk';```**Connect a wallet:**@@ -280,7 +280,7 @@ const { agentId, registrationCID, txHash } = await registerAgent({Grant, verify, and revoke scoped spending delegations:```js-import { PermissionsClient } from '@nirholas/agent-kit/permissions';+import { PermissionsClient } from '@three-ws/sdk/permissions';const client = new PermissionsClient({ baseUrl: 'https://three.ws/' });@@ -315,7 +315,7 @@ For tree-shaking and direct toolkit access:import {encodeScopedDelegation,isDelegationValid,-} from '@nirholas/agent-kit/permissions/advanced';+} from '@three-ws/sdk/permissions/advanced';```### TypeScript support@@ -336,7 +336,7 @@ import type {PermissionsClient,DelegationScope,ScopePreset,-} from '@nirholas/agent-kit';+} from '@three-ws/sdk';const options: AgentKitOptions = {name: 'Aria',@@ -353,7 +353,7 @@ const result: RegistrationResult = await agent.register();## Building from source```bash-git clone https://github.com/3dagent/3dagent+git clone https://github.com/nirholas/three.wsnpm install# Build the web component library (agent-3d.js + agent-3d.umd.cjs)diff --git a/public/docs/security.md b/public/docs/security.mdindex 866a8235f..aaecc1343 100644--- a/public/docs/security.md+++ b/public/docs/security.md@@ -192,7 +192,7 @@ Scopes are checked on every request via `hasScope(bearer.scope, 'required:scope'## On-chain identity security-The ERC-8004 identity, reputation, and validation registries introduce a distinct security surface. Key threats and mitigations from the [threat model](https://github.com/3dagent/3dagent):+The ERC-8004 identity, reputation, and validation registries introduce a distinct security surface. Key threats and mitigations from the [threat model](https://github.com/nirholas/three.ws):### Model integrity (V2)diff --git a/public/docs/skills.md b/public/docs/skills.mdindex da5351cbb..b7155cc79 100644--- a/public/docs/skills.md+++ b/public/docs/skills.md@@ -1,6 +1,6 @@# Skills System-Skills are the extension mechanism for three.wss — modular, portable capability bundles that tell an agent *what it can do* and *how to do it*. A skill packages together the LLM instructions, the tool schema, and the JavaScript handler that runs when the tool is called. Because a skill is just a directory of files served from any URL, the same wave skill can be installed in every agent you build without copying any code.+Skills are the extension mechanism for three.ws — modular, portable capability bundles that tell an agent *what it can do* and *how to do it*. A skill packages together the LLM instructions, the tool schema, and the JavaScript handler that runs when the tool is called. Because a skill is just a directory of files served from any URL, the same wave skill can be installed in every agent you build without copying any code.This document covers how to install skills, how to write them, the full context API available to handlers, the security model, and the lifecycle events that let host pages observe skill execution.@@ -70,7 +70,7 @@ Reference skills by URI in the agent's `manifest.json`. The runtime fetches and```json{"skills": [- { "uri": "https://cdn.three.wsskills/wave/", "version": "0.1.0" },+ { "uri": "https://cdn.three.ws/skills/wave/", "version": "0.1.0" },{ "uri": "ipfs://bafy.../validate-model/", "version": "^1.0.0" }]}@@ -85,7 +85,7 @@ Pass a JSON array to the `skills` attribute:```html<agent-3dagent-id="my-agent"- skills='[{"uri":"https://cdn.three.wsskills/wave/","version":"0.1.0"}]'+ skills='[{"uri":"https://cdn.three.ws/skills/wave/","version":"0.1.0"}]'></agent-3d>```@@ -121,7 +121,7 @@ await el.agent.skills.install({ uri: 'https://example.com/skills/weather/' });// Skill dependencies — installed recursively before this skill"dependencies": {- "https://cdn.three.wsskills/gesture-base/": "^1.0.0"+ "https://cdn.three.ws/skills/gesture-base/": "^1.0.0"},// What this skill adds to the agent@@ -396,8 +396,8 @@ Skills can depend on other skills. The registry installs dependencies recursivel"name": "full-coaching-kit","version": "1.0.0","dependencies": {- "https://cdn.three.wsskills/wave/": "^0.1.0",- "https://cdn.three.wsskills/validate-model/": "^1.0.0"+ "https://cdn.three.ws/skills/wave/": "^0.1.0",+ "https://cdn.three.ws/skills/validate-model/": "^1.0.0"},"provides": { "tools": [] }}@@ -632,7 +632,7 @@ The handler tries to load a style-specific GLB clip from the bundle (e.g. `clips},"brain": {"provider": "anthropic",- "model": "claude-opus-4-6",+ "model": "claude-opus-4-7","instructions": "instructions.md","temperature": 0.8,"maxTokens": 2048diff --git a/public/docs/smart-contracts.md b/public/docs/smart-contracts.mdindex 4f7bc7300..bdc8daea4 100644--- a/public/docs/smart-contracts.md+++ b/public/docs/smart-contracts.md@@ -39,7 +39,7 @@ Chains: BSC Testnet (97), Ethereum Sepolia (11155111), Base Sepolia (84532), ArbAlways read addresses from the SDK rather than hardcoding them:```js-import { REGISTRY_DEPLOYMENTS } from '@3dagent/sdk/erc8004';+import { REGISTRY_DEPLOYMENTS } from '@three-ws/sdk/erc8004';const { identityRegistry, reputationRegistry, validationRegistry } =REGISTRY_DEPLOYMENTS[chainId];@@ -52,6 +52,8 @@ Vanity-prefixed CREATE2 deployer used to obtain matching addresses across chains| Chain | Address | Deployer EOA ||---|---|---|| BSC (56) | `0x00000000D49195AE81759cd247cFeDD9D0B479df` | `0x4022de2D...C0564f402` |+| Base (8453) | `0x00000000D49195AE81759cd247cFeDD9D0B479df` | `0x4022de2D...C0564f402` |+| Arbitrum One (42161) | `0x00000000D49195AE81759cd247cFeDD9D0B479df` | `0x4022de2D...C0564f402` |The 8-byte zero prefix (`0x00000000…`) saves calldata gas on every call. Source is `ThreeWSFactory.sol` (solc 0.8.35, optimizer 200 runs, MIT, verified on BscScan).diff --git a/public/docs/troubleshooting.md b/public/docs/troubleshooting.mdindex fb4c74453..907fc32e4 100644--- a/public/docs/troubleshooting.md+++ b/public/docs/troubleshooting.md@@ -113,7 +113,7 @@ Organized by symptom. Find your problem, check the likely causes, follow the fix1. Check the `brain` attribute. The agent only activates LLM mode when `brain` is set to a model name:```html- <agent-3d brain="claude-opus-4-6" ...></agent-3d>+ <agent-3d brain="claude-opus-4-7" ...></agent-3d>```Without this attribute, `brain.provider` defaults to `none` and the agent uses `NullProvider`, which returns empty responses silently.2. Open DevTools → Network. Filter for `/api/chat` or `/api/llm`. Look at the response:diff --git a/public/docs/web-component.md b/public/docs/web-component.mdindex 526b1db12..2bc59d61a 100644--- a/public/docs/web-component.md+++ b/public/docs/web-component.md@@ -52,7 +52,7 @@ Using `body` with no manifest creates an ad-hoc agent. Its name, instructions, abody="/avatars/guide.glb"name="Guide"instructions="You are a friendly 3D guide."- brain="claude-opus-4-6"+ brain="claude-opus-4-7"></agent-3d>```@@ -74,7 +74,7 @@ Using `body` with no manifest creates an ad-hoc agent. Its name, instructions, a| Attribute | Type | Default | Description ||-----------|------|---------|-------------|-| `brain` | model ID | from manifest | LLM model to use, e.g. `claude-opus-4-6`. Set to `none` to disable the brain entirely. |+| `brain` | model ID | from manifest | LLM model to use, e.g. `claude-opus-4-7`. Set to `none` to disable the brain entirely. || `instructions` | URL or inline text | from manifest | System prompt. Can be a URL ending in `.md` or an inline string. Overrides `manifest.brain.instructions`. || `api-key` | string | — | API key injected directly. **Development use only.** Prefer `key-proxy` for any page that will be public. || `key-proxy` | URL | — | URL of your backend that injects API keys into outbound LLM requests. |@@ -699,7 +699,7 @@ declare namespace JSX {}// Usage-import '@3dagent/sdk';+import '@three-ws/sdk';function AgentCard() {return (@@ -766,7 +766,7 @@ export default defineConfig({</template><script setup>-import '@3dagent/sdk';+import '@three-ws/sdk';function onReady(e) {console.log('ready', e.detail.manifest.name);@@ -780,7 +780,7 @@ Svelte handles custom elements natively. No configuration needed.```svelte<script>- import '@3dagent/sdk';+ import '@three-ws/sdk';let el;function onReady(e) {diff --git a/public/docs/widget-studio.md b/public/docs/widget-studio.mdindex b9cddca1c..8859431e6 100644--- a/public/docs/widget-studio.md+++ b/public/docs/widget-studio.md@@ -2,7 +2,7 @@Widget Studio is the no-code builder for creating embeddable 3D widgets. Pick an avatar, choose a widget type, configure your brand settings, and get a one-line embed snippet — no code required.-**Access Widget Studio:** [three.wsstudio](https://three.ws/studio)+**Access Widget Studio:** [three.ws/studio](https://three.ws/studio)---@@ -34,7 +34,7 @@ Widget Studio requires an account. When you open the Studio without signing in,### Create a new widget from scratch-1. Go to [three.wsstudio](https://three.ws/studio)+1. Go to [three.ws/studio](https://three.ws/studio)2. Sign in if prompted3. The Studio opens with the default type (Turntable Showcase) pre-selected4. Follow the three steps described below@@ -162,7 +162,7 @@ The oEmbed protocol handles the conversion automatically — no plugin needed.## Managing your widgets-Go to [three.wsdashboard](https://three.ws/dashboard) and click the **Widgets** tab.+Go to [three.ws/dashboard](https://three.ws/dashboard) and click the **Widgets** tab.From the dashboard you can:@@ -188,7 +188,7 @@ Chat message content from Talking Agent widgets is never logged.## Widget gallery-Public widgets are listed at [three.wswidgets](https://three.ws/widgets). Browse the gallery to find inspiration, discover what other creators have built, and copy embed snippets for any listed widget.+Public widgets are listed at [three.ws/widgets](https://three.ws/widgets). Browse the gallery to find inspiration, discover what other creators have built, and copy embed snippets for any listed widget.Filter by widget type, search by name, or sort by popularity or recency.diff --git a/public/docs/widgets.md b/public/docs/widgets.mdindex 80623074b..5db647b26 100644--- a/public/docs/widgets.md+++ b/public/docs/widgets.md@@ -406,7 +406,7 @@ The `config` object is validated against the type's schema (see [widget-types.js**Widget share URL:** Every widget has a canonical share URL at `https://three.ws/w/<id>`. This URL is server-rendered with Open Graph metadata and a 1200×630 preview image, making it safe to post in Slack, Discord, X, or any link-preview-aware surface.-For the full API reference including request/response shapes, error codes, and pagination, see [API.md](../docs/API.md).+For the full API reference including request/response shapes, error codes, and pagination, see [api-reference.md](./api-reference.md).---diff --git a/src/home-act2-viewer.js b/src/home-act2-viewer.jsindex 169037c14..1d1bc52ed 100644--- a/src/home-act2-viewer.js+++ b/src/home-act2-viewer.js@@ -76,6 +76,7 @@ export class Act2Viewer {const ro = new ResizeObserver(() => this._resize());ro.observe(canvas);+ this._disposed = false;this._tick = this._tick.bind(this);requestAnimationFrame(this._tick);}@@ -92,6 +93,7 @@ export class Act2Viewer {}_tick() {+ if (this._disposed) return;const dt = this._clock.getDelta();if (this.mixer) this.mixer.update(dt);if (this.model && !this._externalOrbit) {@@ -102,6 +104,13 @@ export class Act2Viewer {requestAnimationFrame(this._tick);}+ dispose() {+ this._disposed = true;+ if (this.mixer) { this.mixer.stopAllAction(); this.mixer = null; }+ if (this.model) { this.scene.remove(this.model); this.model = null; }+ this.renderer.dispose();+ }+async _loadManifest() {if (this._manifest.length) return this._manifest;if (this._manifestPromise) return this._manifestPromise;diff --git a/src/home-v4-hero.js b/src/home-v4-hero.jsindex be315407a..1e1d5d807 100644--- a/src/home-v4-hero.js+++ b/src/home-v4-hero.js@@ -117,7 +117,7 @@ export class HeroScene {this._visibilityObserver = new IntersectionObserver((entries) => {- this._visible = entries[0].isIntersecting;+ this._visible = entries.at(-1).isIntersecting;if (this._visible && !this._raf) {this._clock.start();this._raf = requestAnimationFrame(this._tick);diff --git a/src/home-v4-scroll.js b/src/home-v4-scroll.jsindex 91adb8b64..861903f84 100644--- a/src/home-v4-scroll.js+++ b/src/home-v4-scroll.js@@ -36,7 +36,8 @@ const LOW_MEMORY = typeof navigator.deviceMemory === 'number' && navigator.devicconst agentEl = document.querySelector('[data-stat="agents"]');const onchainEl = document.querySelector('[data-stat="onchain"]');if (agentEl && data.agents != null) agentEl.textContent = formatNum(data.agents);- if (onchainEl && data.onchain != null) onchainEl.textContent = formatNum(data.onchain);+ const onchainVal = data.onchain_agents ?? data.onchain;+ if (onchainEl && onchainVal != null) onchainEl.textContent = formatNum(onchainVal);} catch { /* stats are non-critical enhancement */ }})();@@ -53,7 +54,7 @@ function observeViewerVisibility(canvas, viewer) {const observer = new IntersectionObserver((entries) => {- visible = entries[0].isIntersecting;+ visible = entries.at(-1).isIntersecting;if (visible && paused) {paused = false;viewer._clock.start();@@ -85,7 +86,7 @@ function observeViewerVisibility(canvas, viewer) {const observer = new IntersectionObserver((entries) => {- if (entries[0].isIntersecting && !viewer) {+ if (entries.at(-1).isIntersecting && !viewer) {observer.disconnect();boot();}@@ -146,7 +147,7 @@ function observeViewerVisibility(canvas, viewer) {const observer = new IntersectionObserver((entries) => {- if (entries[0].isIntersecting) {+ if (entries.at(-1).isIntersecting) {observer.disconnect();boot();}