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
storefront + agenc roundtrip example, sns helper tests
nirholasc7a62ed76ea3
diff --git a/.env.example b/.env.exampleindex 2359819c3..73187ce70 100644--- a/.env.example+++ b/.env.example@@ -401,3 +401,19 @@ MCP_POSE_PREVIEW_BASE=https://three.ws/pose# Block window scanned for recent ReputationSubmitted/Staked events (default# 200000). Lower for high-RPS chains to keep RPC calls under provider limits.MCP_AGENT_REP_LOG_WINDOW=200000++# ── SNS subdomain minting on threews.sol ─────────────────────────────────────+# Base58-encoded 64-byte ed25519 secret for the wallet that owns the platform+# parent .sol domain (default `threews.sol`). The /api/sns-subdomain and+# /api/threews/subdomain endpoints use this key to sign createSubdomain ++# URL-record + transferSubdomain in a single atomic transaction, then hand the+# subdomain to the user. Leave unset to disable subdomain minting (both+# endpoints return 503 instead of attempting the on-chain write).+THREEWS_SOL_PARENT_SECRET_BASE58=+# Override the parent domain if the platform acquires a different root.+# Default: threews.sol.+THREEWS_SOL_PARENT_DOMAIN=threews.sol+# Origin used when writing the URL record on a freshly-minted subdomain.+# Brave's SNS resolver follows this URL when a user types `<label>.threews.sol`.+# Default: https://three.ws.+STOREFRONT_ORIGIN=https://three.wsdiff --git a/README.md b/README.mdindex 90e5e9ba1..7928cedb2 100644--- a/README.md+++ b/README.md@@ -312,7 +312,8 @@ A map of every user-facing route. Full detail (source files, feature description| **Auth** | `/login`, `/register`, `/forgot-password`, `/reset-password` | Email + wallet sign-in/up || **Agent (Platform)** | `/agent/[id]`, `/agent/[id]/embed`, `/agent/[id]/edit` | Agent chat, chromeless embed, manifest editor || **Agent (On-Chain)** | `/a/[chain]/[id]`, `/a/sol/[asset]` | ERC-8004 and Metaplex Core passports |-| **Profile** | `/profile`, `/u/[username]`, `/avatars/[id]` | User and avatar public pages |+| **Profile** | `/profile`, `/u/[username]`, `/avatars/[id]` | User and avatar public pages — SNS badge + pay-by-name modal when `[username].threews.sol` is claimed |+| **SNS Subdomain** | `/threews/claim` | Mint `[label].threews.sol`, set the URL record to your showcase, transfer ownership — single tx, platform pays || **Dashboard** | `/dashboard`, `/dashboard/actions`, `/dashboard/wallets`, `/dashboard/usage`, `/dashboard/x402` | Account management, settings, and x402 receipts/payouts || **Studio / Tools** | `/studio`, `/embed-editor`, `/pose-studio`, `/hydrate`, `/validation`, `/strategy-lab` | Widget Studio, WYSIWYG embed editor, pose authoring, on-chain import, glTF validator, DCA || **Widgets** | `/widgets`, `/w/[id]` | Widget gallery and public widget pages (OG + oEmbed) |diff --git a/STRUCTURE.md b/STRUCTURE.mdindex cb603481d..c7785ceb0 100644--- a/STRUCTURE.md+++ b/STRUCTURE.md@@ -25,6 +25,7 @@ bottom.| On-chain identity | [contracts/](contracts) | In-repo | Foundry-based on-chain agent identity, ERC-8004 || Cross-chain SDKs | [sdk/](sdk), [solana-agent-sdk/](solana-agent-sdk), [agent-payments-sdk/](agent-payments-sdk), [agent-protocol-sdk/](agent-protocol-sdk) | Published | Cross-chain agent SDKs || MCP integration | [mcp-server/](mcp-server), [mcp-bridge/](mcp-bridge) | Published as `@three-ws/mcp-server` | Model Context Protocol surface |+| SNS naming + pay-by-name | [api/sns.js](api/sns.js), [api/sns-subdomain.js](api/sns-subdomain.js), [api/threews/subdomain.js](api/threews/subdomain.js), [api/x402/pay-by-name.js](api/x402/pay-by-name.js), [src/solana/sns-subdomain.js](src/solana/sns-subdomain.js), [pages/threews-claim.html](pages/threews-claim.html) | In-repo | `*.threews.sol` subdomain mint, x402 payments addressed by name. Env: `THREEWS_SOL_PARENT_SECRET_BASE58`. See [SNS_PARTNERSHIP_PROPOSAL.md](docs/internal/SNS_PARTNERSHIP_PROPOSAL.md) |## npm workspacesdiff --git a/api/_lib/threews-sns.js b/api/_lib/threews-sns.jsindex 925b288bf..678b0f006 100644--- a/api/_lib/threews-sns.js+++ b/api/_lib/threews-sns.js@@ -1,28 +1,36 @@-// threews.sol subdomain helpers.+// API-side facade over the canonical SNS-subdomain primitive in+// src/solana/sns-subdomain.js.//-// The platform owns `threews.sol` on Solana Name Service. This module wraps-// the @bonfida/spl-name-service v3 SDK to mint `<label>.threews.sol`-// subdomains, set a URL record on them (so Brave's built-in SNS resolution-// routes the subdomain to the user's three.ws showcase page), and transfer-// ownership to the user's wallet — all in a single transaction signed by-// the platform parent-domain keypair.+// The on-chain logic — keypair loading, availability check, atomic+// create + URL-record + transfer — lives in src/solana/sns-subdomain.js+// and is shared with the agent-level mint endpoint at /api/sns-subdomain.//-// Env (required for any write op):-// THREEWS_SOL_OWNER_SECRET_BASE58 base58-encoded 64-byte ed25519 secret-// for the wallet that owns `threews.sol`.-// THREEWS_PARENT_DOMAIN (optional, default 'threews')-// the parent label whose subdomains we mint. Override only if the-// platform owns a different root.+// This module adds API-layer concerns that belong outside the on-chain+// primitive: a stricter reserved-label denylist, a fully-qualified+// `<label>.<parent>.sol` formatter for HTTP responses, and a thin+// `mintSubdomain()` wrapper that callers can use without re-spelling the+// records argument.-import { Keypair, PublicKey, Transaction } from '@solana/web3.js';-import bs58 from 'bs58';-import { solanaConnection } from './agent-pumpfun.js';+import {+ checkSubdomainAvailability,+ createNamedSubdomain,+ getParentDomain,+ getStorefrontOrigin,+ loadParentOwnerKeypair,+ normalizeLabel as normalizeLabelRaw,+ storefrontUrlForLabel,+} from '../../src/solana/sns-subdomain.js';+import { Connection } from '@solana/web3.js';-export const PARENT_LABEL = (process.env.THREEWS_PARENT_DOMAIN || 'threews').toLowerCase();+const DEFAULT_RPC_URL = process.env.SOLANA_RPC_URL || 'https://api.mainnet-beta.solana.com';-const SUBDOMAIN_RE = /^[a-z0-9-]{1,63}$/;-// Reserve labels that look like internal app paths, common impersonations,-// or short reserved words. Matches the spirit of agents/check-name's denylist.+// The platform label is the bare parent domain (e.g. 'threews' for+// 'threews.sol'). Derived from THREEWS_SOL_PARENT_DOMAIN via getParentDomain().+export const PARENT_LABEL = getParentDomain().replace(/\.sol$/, '');++// Labels we never let users claim. Either reserved app paths, impersonation+// risks, or short reserved words. Mirrors api/agents/check-name's denylist+// plus the additional surface a public-facing `<label>.threews.sol` exposes.const DENYLIST = new Set(['admin', 'root', 'system', 'api', 'app', 'www', 'mail', 'help', 'support','about', 'login', 'signup', 'logout', 'signin', 'auth', 'oauth', 'pay',@@ -32,34 +40,26 @@ const DENYLIST = new Set([export function normalizeLabel(input) {if (typeof input !== 'string') return null;- const trimmed = input+ // Users routinely paste the whole `<label>.threews.sol` or `<label>.sol`.+ // Strip those suffixes before delegating to the canonical label normalizer+ // (which insists on a single bare label).+ const stripped = input.trim().toLowerCase().replace(new RegExp(`\\.${PARENT_LABEL}(\\.sol)?$`), '').replace(/\.sol$/, '');- if (!SUBDOMAIN_RE.test(trimmed)) return null;- if (DENYLIST.has(trimmed)) return null;- return trimmed;+ const cleaned = normalizeLabelRaw(stripped);+ if (!cleaned) return null;+ if (DENYLIST.has(cleaned)) return null;+ return cleaned;}export function fullDomain(label) {return `${label}.${PARENT_LABEL}.sol`;}-/**- * Decode the platform parent-domain keypair from env. Throws when missing —- * callers must guard with `hasOwnerKey()` and return a friendly 503 otherwise.- */-export function loadParentOwnerKeypair() {- const raw = process.env.THREEWS_SOL_OWNER_SECRET_BASE58;- if (!raw) throw new Error('THREEWS_SOL_OWNER_SECRET_BASE58 not configured');- const secret = bs58.decode(raw.trim());- if (secret.length !== 64) throw new Error('THREEWS_SOL_OWNER_SECRET_BASE58 must decode to 64 bytes');- return Keypair.fromSecretKey(secret);-}-export function hasOwnerKey() {- return !!process.env.THREEWS_SOL_OWNER_SECRET_BASE58;+ return !!process.env.THREEWS_SOL_PARENT_SECRET_BASE58;}/**@@ -67,62 +67,23 @@ export function hasOwnerKey() {* subdomain has not been registered yet.*/export async function getSubdomainOwner(label) {- const sns = await import('@bonfida/spl-name-service');- const conn = solanaConnection('mainnet');- try {- const { pubkey } = sns.getDomainKeySync(`${label}.${PARENT_LABEL}`);- const { registry } = await sns.NameRegistryState.retrieve(conn, pubkey);- return registry.owner.toBase58();- } catch {- return null;- }+ const conn = new Connection(DEFAULT_RPC_URL, 'confirmed');+ const { exists, owner } = await checkSubdomainAvailability({+ connection: conn,+ parentDomain: PARENT_LABEL,+ label,+ });+ return exists ? owner : null;}/**- * Mint `<label>.threews.sol` as a single transaction signed by the platform:- * 1. create the subdomain (parent owner pays rent, becomes interim owner)- * 2. set its URL record to `urlRecordValue` (parent owner signs)- * 3. transfer ownership of the subdomain to `recipientWallet`- *- * Returns the tx signature on success.+ * Mint `<label>.<parent>.sol`, write its URL record so Brave routes to the+ * three.ws storefront, and transfer ownership to `recipientWallet`. Returns+ * { signature, fullName, owner, parent, url_record }.*/-export async function mintSubdomain({ label, recipientWallet, urlRecordValue }) {- const sns = await import('@bonfida/spl-name-service');- const conn = solanaConnection('mainnet');- const parentKp = loadParentOwnerKeypair();- const recipient = new PublicKey(recipientWallet);-- const createIxs = await sns.createSubdomain(- conn,- `${label}.${PARENT_LABEL}`,- parentKp.publicKey,- 2000,- parentKp.publicKey,- );-- const recordIx = sns.createRecordV2Instruction(- `${label}.${PARENT_LABEL}`,- sns.Record.Url,- urlRecordValue,- parentKp.publicKey,- parentKp.publicKey,- );-- const transferIx = await sns.transferSubdomain(- conn,- `${label}.${PARENT_LABEL}`,- recipient,- true,- parentKp.publicKey,- );-- const tx = new Transaction().add(...createIxs, recordIx, transferIx);- tx.feePayer = parentKp.publicKey;- const { blockhash, lastValidBlockHeight } = await conn.getLatestBlockhash('confirmed');- tx.recentBlockhash = blockhash;- tx.sign(parentKp);-- const sig = await conn.sendRawTransaction(tx.serialize(), { skipPreflight: false });- await conn.confirmTransaction({ signature: sig, blockhash, lastValidBlockHeight }, 'confirmed');- return sig;+export async function mintSubdomain({ label, recipientWallet }) {+ return createNamedSubdomain({ label, newOwner: recipientWallet });}++// Re-exports so callers don't need a second import from src/solana.+export { loadParentOwnerKeypair, getStorefrontOrigin, storefrontUrlForLabel };diff --git a/api/openapi-json.js b/api/openapi-json.jsindex 9880290be..9e3b35fb8 100644--- a/api/openapi-json.js+++ b/api/openapi-json.js@@ -352,6 +352,154 @@ export default wrap(async (req, res) => {'x-payment-info': { price: { mode: 'fixed', currency: 'USD', amount: '0.05' } },},},+ '/api/x402/model-check': {+ get: {+ operationId: 'x402_model_check',+ summary: 'Paid: glTF/GLB structural stats + optimization recommendations',+ description:+ 'Pay $0.001 USDC to fetch a glTF/GLB model from a URL and return structural stats (vertex/triangle counts, materials, textures, animations, extensions) plus a prioritized list of optimization recommendations.',+ parameters: [+ {+ name: 'url',+ in: 'query',+ required: true,+ schema: { type: 'string', format: 'uri' },+ description: 'Public HTTPS URL of a glTF/GLB model.',+ },+ ],+ responses: {+ 200: { description: 'Inspection + recommendation JSON' },+ 400: { description: 'Missing or invalid url' },+ 402: { description: 'Payment Required (x402)' },+ },+ 'x-payment-info': { price: { mode: 'fixed', currency: 'USD', amount: '0.001' } },+ },+ },+ '/api/x402/mint-to-mesh': {+ get: {+ operationId: 'x402_mint_to_mesh',+ summary: 'Paid: Single Solana mint → themed binary glTF cube',+ description:+ 'Pay $0.001 USDC to resolve a Solana fungible-token mint to a binary glTF (GLB) cube themed for that token. Color is hashed from the mint; the Metaplex JSON image, when present, is embedded as a baseColor texture.',+ parameters: [+ {+ name: 'mint',+ in: 'query',+ required: true,+ schema: { type: 'string', minLength: 32, maxLength: 64 },+ description: 'Base58 SPL mint address on Solana mainnet.',+ },+ ],+ responses: {+ 200: { description: 'Themed GLB JSON envelope' },+ 400: { description: 'Missing or invalid mint' },+ 402: { description: 'Payment Required (x402)' },+ },+ 'x-payment-info': { price: { mode: 'fixed', currency: 'USD', amount: '0.001' } },+ },+ },+ '/api/insights/revenue-vision': {+ get: {+ operationId: 'x402_revenue_vision',+ summary: 'Paid: Claude-powered next-best-move for a mission brief',+ description:+ 'Pay $0.001 USDC to receive a single prioritized next-best move, a data-grounded insight, and an honestly-calibrated confidence rating for the supplied mission brief.',+ parameters: [+ { name: 'agent_codename', in: 'query', required: true, schema: { type: 'string' } },+ {+ name: 'power_request',+ in: 'query',+ required: true,+ schema: { type: 'string', enum: ['revenue-vision'] },+ },+ {+ name: 'mission_brief',+ in: 'query',+ required: true,+ schema: { type: 'string', minLength: 4, maxLength: 4000 },+ },+ ],+ responses: {+ 200: { description: 'Next-best-move JSON' },+ 400: { description: 'Missing or invalid parameters' },+ 402: { description: 'Payment Required (x402)' },+ },+ 'x-payment-info': { price: { mode: 'fixed', currency: 'USD', amount: '0.001' } },+ },+ },+ '/api/x402/permit2-paid-demo': {+ get: {+ operationId: 'x402_permit2_paid_demo',+ summary: 'Paid: Gasless Permit2 + EIP-2612 settlement demo',+ description:+ 'Pay $0.001 USDC via the Permit2-only path so a wallet holding USDC but zero ETH can complete the flow. CDP\'s x402ExactPermit2Proxy submits the EIP-2612 permit + Permit2 transfer atomically; the response surfaces the on-chain tx hash and a Basescan link.',+ responses: {+ 200: { description: 'Settlement summary with tx hash' },+ 402: { description: 'Payment Required (x402)' },+ },+ 'x-payment-info': { price: { mode: 'fixed', currency: 'USD', amount: '0.001' } },+ },+ },+ '/api/x402/dance-tip': {+ get: {+ operationId: 'x402_dance_tip',+ summary: 'Paid: Tip a 3D dancer to perform on the pole stage',+ description:+ 'Pay $0.001 USDC to tip a dancer to perform one routine on the three.ws Pole Club 3D stage. Returns a performance ticket the /club page consumes to spawn the dancer.',+ parameters: [+ {+ name: 'dancer',+ in: 'query',+ required: true,+ schema: { type: 'string', enum: ['1', '2', '3', '4'] },+ description: 'Stage slot 1-4.',+ },+ {+ name: 'dance',+ in: 'query',+ required: true,+ schema: {+ type: 'string',+ enum: ['rumba', 'silly', 'thriller', 'capoeira', 'hiphop'],+ },+ description: 'Performance style — a clip in /animations/manifest.json.',+ },+ ],+ responses: {+ 200: { description: 'Performance ticket JSON' },+ 400: { description: 'Missing or invalid parameters' },+ 402: { description: 'Payment Required (x402)' },+ },+ 'x-payment-info': { price: { mode: 'fixed', currency: 'USD', amount: '0.001' } },+ },+ },+ '/api/x402/asset-download': {+ get: {+ operationId: 'x402_asset_download',+ summary: 'Paid: Unlock a 3D asset (GLB / avatar / accessory)',+ description:+ 'Pay in USDC once to unlock a 3D asset hosted on R2. Wallets that already paid can re-download for free by signing in with SIWX (CAIP-122). Each asset has its own price and creator payout address; the response carries a short-lived presigned R2 URL.',+ parameters: [+ {+ name: 'slug',+ in: 'query',+ required: true,+ schema: { type: 'string', minLength: 1, maxLength: 128 },+ description: 'Unique asset slug from the paid_assets catalog.',+ },+ ],+ responses: {+ 200: { description: 'Presigned R2 download URL' },+ 400: { description: 'Missing or invalid slug' },+ 402: { description: 'Payment Required (x402)' },+ 404: { description: 'Asset not found' },+ },+ 'x-payment-info': {+ price: { mode: 'variable', currency: 'USD' },+ note: 'Each asset declares its own USDC price; the live 402 challenge reflects the per-asset row.',+ },+ },+ },},},{ 'cache-control': 'public, max-age=300' },diff --git a/api/sns-subdomain.js b/api/sns-subdomain.jsindex e8670c8bc..fcf10fd45 100644--- a/api/sns-subdomain.js+++ b/api/sns-subdomain.js@@ -153,6 +153,8 @@ export default wrap(async (req, res) => {owner: minted.owner,signature: minted.signature,explorer: `https://solscan.io/tx/${minted.signature}`,+ url_record: minted.url_record,+ storefront_path: `/u/${label}`,attached_to_agent: agentId && target.agent ? agentId : null,},});diff --git a/api/threews/subdomain.js b/api/threews/subdomain.jsindex b68991b6b..1d0bc9737 100644--- a/api/threews/subdomain.js+++ b/api/threews/subdomain.js@@ -145,30 +145,28 @@ async function handleMint(req, res, auth) {recipientWallet = defaultAgent.sol;}- const urlRecord = `${env.APP_ORIGIN}/u/${user.username}`;- let signature;+ let minted;try {- signature = await mintSubdomain({- label,- recipientWallet,- urlRecordValue: urlRecord,- });+ minted = await mintSubdomain({ label, recipientWallet });} catch (err) {console.error('[threews/subdomain] mint_failed', err);- return error(res, 502, 'upstream_error', err?.message || 'subdomain mint failed');+ const status = err?.status || 502;+ const code = err?.code || 'upstream_error';+ return error(res, status, code, err?.message || 'subdomain mint failed');}const [row] = await sql`INSERT INTO user_subdomains (user_id, label, parent, owner_wallet, url_record, signature)- VALUES (${auth.userId}, ${label}, ${PARENT_LABEL}, ${recipientWallet}, ${urlRecord}, ${signature})+ VALUES (${auth.userId}, ${label}, ${PARENT_LABEL}, ${recipientWallet}, ${minted.url_record}, ${minted.signature})RETURNING id, label, parent, owner_wallet, url_record, signature, created_at`;return json(res, 201, {data: {...row,- full: fullDomain(label),+ full: minted.fullName,showcase_url: `${env.APP_ORIGIN}/u/${user.username}`,+ explorer: `https://solscan.io/tx/${minted.signature}`,},});}diff --git a/docs/internal/SNS_PARTNERSHIP_OUTBOUND.md b/docs/internal/SNS_PARTNERSHIP_OUTBOUND.mdnew file mode 100644index 000000000..07c916828--- /dev/null+++ b/docs/internal/SNS_PARTNERSHIP_OUTBOUND.md@@ -0,0 +1,48 @@+# SNS partnership — outbound pitch++A short version of [SNS_PARTNERSHIP_PROPOSAL.md](./SNS_PARTNERSHIP_PROPOSAL.md), drafted to be paste-ready for an email or DM to Bilal / SNS leadership. Trim to taste.++---++## Subject++three.ws × SNS — a working integration we'd like to make official++## Body++Hey Bilal,++three.ws is the embodiment layer for Solana agents — 3D avatars that live on-chain, accept x402 payments, and trade on Pump.fun. We've quietly built a full SNS integration over the last week and would like to make it official.++**What's already shipped on three.ws (no asks on your end):**++1. **x402 payment routing by .sol name.** Every 402-Payment-Required manifest a three.ws agent emits now carries `recipient_name` next to the wallet address. The payer sees `claude.threews.sol`, not `7xKX…9aBn`, before they sign. First implementation of pay-by-name x402 in the Solana ecosystem. `POST /api/x402/pay-by-name` resolves any of three namespaces — `@username`, raw `.sol` (including subdomains), or base58 address — and returns either a built USDC transfer tx for the payer to sign, or settles directly from the caller's agent wallet.++2. **Agent ↔ .sol binding.** Users can attach an existing .sol they own to one of their agents (`POST /api/agents/:id/sns`), or register a fresh one in-flow with either the agent's wallet paying USDC or the user's wallet paying SOL. Once bound, every public surface — agent page, x402 manifest, MCP tool list, marketplace card — displays the .sol name in place of the raw wallet.++3. **`threews.sol` subdomains, one-call mint.** We own `threews.sol`. We've built a single endpoint that mints `<label>.threews.sol`, sets a URL record pointing to the user's three.ws showcase page (so **Brave resolves the subdomain directly to the showcase**), and transfers ownership to the user — atomically, in one tx, with three.ws absorbing the SOL gas. From the user's side: type a label, click mint, done. End-to-end in ~5 seconds. Every three.ws user is one POST from owning a `*.threews.sol` and a Brave-resolvable showcase at `https://three.ws/u/<label>`.++**What we're proposing:**++- **Co-marketing** at launch. One email to the .sol holder list + one X post + one Discord drop, in exchange for symmetric coverage on our side. We're going live with the `*.threews.sol` program imminently.+- **Listed partner** on the SNS partners page as the embodiment / agent-identity partner.+- **Partner-tier rate limits** on `sns-api.bonfida.com`. Our `recipient_name` enrichment hits forward + reverse lookup on every manifest emission and showcase load, so formalising the relationship benefits both sides.+- **Shared roadmap channel** for subdomain primitives we're hitting friction on — sub-of-sub naming, transfer hooks, embedded-avatar SOL records.++**The ask is small. The demo is real.** I can show you a working flow on a 15-minute call this week: claim `claude.threews.sol`, attach it to a fresh agent, get paid by name, all confirmed on-chain. No deck. Working software.++Code references:++- Subdomain mint: [api/sns-subdomain.js](../../api/sns-subdomain.js), [src/solana/sns-subdomain.js](../../src/solana/sns-subdomain.js)+- Pay-by-name: [api/x402/pay-by-name.js](../../api/x402/pay-by-name.js), [api/_lib/x402.js](../../api/_lib/x402.js)+- User-level subdomain claim + showcase binding: [api/threews/subdomain.js](../../api/threews/subdomain.js), [api/users/by-subdomain.js](../../api/users/by-subdomain.js)+- Agent ↔ .sol attach: [api/agents/sns.js](../../api/agents/sns.js)+- Claim UI: [pages/threews-claim.html](../../pages/threews-claim.html), live at `https://three.ws/threews/claim`++— Nicholas++---++## One-liner version (for X DM / Telegram)++> Built three.ws ↔ SNS end-to-end: pay-by-`.sol`-name in x402 manifests, agent-bound .sol identities, and a one-call `*.threews.sol` subdomain mint that resolves directly in Brave. 30 of our users could claim a subdomain by Monday. Want to co-launch it?diff --git a/examples/agenc-task-roundtrip/.gitignore b/examples/agenc-task-roundtrip/.gitignorenew file mode 100644index 000000000..ca39bdcd7--- /dev/null+++ b/examples/agenc-task-roundtrip/.gitignore@@ -0,0 +1,3 @@+.cache/+node_modules/+package-lock.jsondiff --git a/examples/agenc-task-roundtrip/README.md b/examples/agenc-task-roundtrip/README.mdnew file mode 100644index 000000000..11e10b5ea--- /dev/null+++ b/examples/agenc-task-roundtrip/README.md@@ -0,0 +1,36 @@+# AgenC task roundtrip — three.ws + Solana devnet++End-to-end demonstration of a three.ws agent participating in the [AgenC](https://agenc.tech) coordination protocol on Solana devnet. A creator wallet posts a task; a worker wallet (the "three.ws agent") claims and completes it. Every step is a real on-chain transaction against the AgenC devnet program `6UcJzbTEemBz3aY5wK5qKHGMD7bdRsmR4smND29gB2ab`.++## What it does++1. **Generates two keypairs** (creator + worker), cached under `.cache/` for re-runs.+2. **Airdrops devnet SOL** from the public faucet if balances are low.+3. **Registers both wallets** as AgenC agents (1 000 000 lamport stake — the protocol minimum).+4. **Creator posts a task** with a 0.005 SOL reward, capability flag `bit 0`, deadline +1h.+5. **Worker claims** the task.+6. **Worker completes** the task with a `sha256` proof hash over its result string.+7. **Reads final on-chain state** — task state should be `Completed`, worker reputation should increment.++Every transaction prints a `https://explorer.solana.com/tx/…?cluster=devnet` URL so the run can be audited externally.++## Run it++```bash+cd examples/agenc-task-roundtrip+npm install+npm start+```++To start over with fresh keypairs:++```bash+npm run reset+```++## Notes++- The public Solana devnet faucet is heavily rate-limited. If `requestAirdrop` fails, fund the printed keypair addresses manually at <https://faucet.solana.com> and re-run.+- The "result" produced by the worker is a placeholder greeting — in a real three.ws agent runtime, this is where the LLM call, animation render, or voice synthesis would happen.+- Capabilities are a freeform `u64` bitmap defined by the task creator. This example uses bit 0 for "can answer text prompts."+- This is the **public** task path. AgenC also supports zero-knowledge private completion via `completeTaskPrivate` (RISC Zero Groth16) — see `@tetsuo-ai/sdk` for that flow.diff --git a/examples/agenc-task-roundtrip/package.json b/examples/agenc-task-roundtrip/package.jsonnew file mode 100644index 000000000..88b315a58--- /dev/null+++ b/examples/agenc-task-roundtrip/package.json@@ -0,0 +1,16 @@+{+ "name": "@three-ws/example-agenc-task-roundtrip",+ "private": true,+ "version": "0.1.0",+ "type": "module",+ "description": "End-to-end AgenC task lifecycle on Solana devnet using the three.ws Solana agent SDK.",+ "scripts": {+ "start": "node run.mjs",+ "reset": "rm -rf .cache && node run.mjs"+ },+ "dependencies": {+ "@three-ws/solana-agent": "file:../../solana-agent-sdk",+ "@solana/web3.js": "^1.98.0",+ "@tetsuo-ai/sdk": "^1.4.0"+ }+}diff --git a/examples/agenc-task-roundtrip/run.mjs b/examples/agenc-task-roundtrip/run.mjsnew file mode 100644index 000000000..a326c3beb--- /dev/null+++ b/examples/agenc-task-roundtrip/run.mjs@@ -0,0 +1,219 @@+#!/usr/bin/env node+// End-to-end AgenC task roundtrip on Solana devnet.+//+// Demonstrates a three.ws-flavored agent (worker) discovering, claiming, and+// completing a task posted by a creator on the public AgenC coordination+// protocol (agenc.tech, by Tetsuo Corp). The full lifecycle runs against the+// devnet program 6UcJzbTEemBz3aY5wK5qKHGMD7bdRsmR4smND29gB2ab — no mocks.+//+// On the first run, fresh creator + worker keypairs are generated and cached+// under .cache/, then airdropped 1 SOL each from the public devnet faucet.+// Subsequent runs reuse the same keypairs and only airdrop when balances run+// low. `npm run reset` wipes the cache to start clean.+//+// Output is an annotated log with Solana Explorer URLs for every on-chain+// step so the run can be inspected externally.++import { promises as fs } from "node:fs";+import path from "node:path";+import { createHash } from "node:crypto";+import { fileURLToPath } from "node:url";+import { Keypair, LAMPORTS_PER_SOL } from "@solana/web3.js";+import {+ createAgenCClient,+ registerAgenCAgent,+ getAgenCAgent,+ createAgenCTask,+ claimAgenCTask,+ completeAgenCTask,+ getAgenCTask,+ formatTaskState,+ deriveAgenCAgentPda,+ toAgenCAgentId,+} from "@three-ws/solana-agent";++const __dirname = path.dirname(fileURLToPath(import.meta.url));+const CACHE_DIR = path.join(__dirname, ".cache");+const CREATOR_PATH = path.join(CACHE_DIR, "creator.json");+const WORKER_PATH = path.join(CACHE_DIR, "worker.json");++const MIN_STAKE_LAMPORTS = 1_000_000; // protocol minAgentStake on devnet+const TASK_REWARD_LAMPORTS = 5_000_000; // 0.005 SOL — well above min+const TARGET_BALANCE = LAMPORTS_PER_SOL; // top up to 1 SOL when below 0.2+const TOPUP_THRESHOLD = 0.2 * LAMPORTS_PER_SOL;+const AIRDROP_AMOUNT = LAMPORTS_PER_SOL;++function step(label) {+ console.log(`\n── ${label} ──`);+}++function explorerTx(sig) {+ return `https://explorer.solana.com/tx/${sig}?cluster=devnet`;+}++function explorerAccount(pubkey) {+ return `https://explorer.solana.com/address/${pubkey.toBase58()}?cluster=devnet`;+}++async function loadOrCreateKeypair(filePath, label) {+ try {+ const raw = await fs.readFile(filePath, "utf8");+ const secret = Uint8Array.from(JSON.parse(raw));+ const kp = Keypair.fromSecretKey(secret);+ console.log(` [${label}] reusing ${kp.publicKey.toBase58()}`);+ return kp;+ } catch (err) {+ if (err.code !== "ENOENT") throw err;+ await fs.mkdir(CACHE_DIR, { recursive: true });+ const kp = Keypair.generate();+ await fs.writeFile(filePath, JSON.stringify(Array.from(kp.secretKey)));+ console.log(` [${label}] generated ${kp.publicKey.toBase58()} → ${path.relative(__dirname, filePath)}`);+ return kp;+ }+}++async function ensureBalance(connection, kp, label) {+ const bal = await connection.getBalance(kp.publicKey);+ if (bal >= TOPUP_THRESHOLD) {+ console.log(` [${label}] balance ${(bal / LAMPORTS_PER_SOL).toFixed(4)} SOL — sufficient`);+ return;+ }+ console.log(` [${label}] balance ${(bal / LAMPORTS_PER_SOL).toFixed(4)} SOL — requesting airdrop…`);+ const need = TARGET_BALANCE - bal;+ const chunk = Math.min(AIRDROP_AMOUNT, need);+ try {+ const sig = await connection.requestAirdrop(kp.publicKey, chunk);+ await connection.confirmTransaction(sig, "confirmed");+ const newBal = await connection.getBalance(kp.publicKey);+ console.log(` [${label}] airdrop confirmed: ${explorerTx(sig)}`);+ console.log(` [${label}] new balance: ${(newBal / LAMPORTS_PER_SOL).toFixed(4)} SOL`);+ } catch (err) {+ throw new Error(+ `[${label}] devnet airdrop failed — the public faucet is rate-limited. Fund ${kp.publicKey.toBase58()} manually at https://faucet.solana.com or try again later. Underlying: ${err.message || err}`,+ );+ }+}++async function ensureAgentRegistered(client, kp, label, opts) {+ const agentId = toAgenCAgentId(opts.label);+ const pda = deriveAgenCAgentPda(client, agentId);+ const existing = await getAgenCAgent(client, pda);+ if (existing) {+ console.log(` [${label}] already registered → agentPda ${pda.toBase58()}`);+ console.log(` status=${existing.status}, reputation=${existing.reputation}, activeTasks=${existing.activeTasks}`);+ return { agentPda: pda, agentId };+ }+ const result = await registerAgenCAgent(+ { ...client, signer: kp },+ {+ agentId,+ capabilities: opts.capabilities,+ endpoint: opts.endpoint,+ metadataUri: opts.metadataUri ?? null,+ stakeAmount: MIN_STAKE_LAMPORTS,+ },+ );+ console.log(` [${label}] registered → agentPda ${result.agentPda.toBase58()}`);+ console.log(` tx: ${explorerTx(result.txSignature)}`);+ return { agentPda: result.agentPda, agentId };+}++async function main() {+ console.log("AgenC task roundtrip — devnet");+ console.log(`programId: 6UcJzbTEemBz3aY5wK5qKHGMD7bdRsmR4smND29gB2ab\n`);++ step("0. load / generate keypairs");+ const creator = await loadOrCreateKeypair(CREATOR_PATH, "creator");+ const worker = await loadOrCreateKeypair(WORKER_PATH, "worker");++ const readClient = createAgenCClient({ cluster: "devnet" });+ const creatorClient = createAgenCClient({ cluster: "devnet", signer: creator });+ const workerClient = createAgenCClient({ cluster: "devnet", signer: worker });++ step("1. ensure devnet SOL balance");+ await ensureBalance(readClient.connection, creator, "creator");+ await ensureBalance(readClient.connection, worker, "worker");++ step("2. register both wallets as AgenC agents");+ const creatorAgent = await ensureAgentRegistered(creatorClient, creator, "creator", {+ label: `three-ws-creator-${creator.publicKey.toBase58()}`,+ capabilities: 0n,+ endpoint: "https://three.ws/agents/demo-creator",+ metadataUri: "https://three.ws/agents/demo-creator/manifest.json",+ });+ const workerAgent = await ensureAgentRegistered(workerClient, worker, "worker", {+ label: `three-ws-worker-${worker.publicKey.toBase58()}`,+ capabilities: 1n, // bit 0: "can answer text prompts" — capability bitmap is freeform+ endpoint: "https://three.ws/agents/demo-worker",+ metadataUri: "https://three.ws/agents/demo-worker/manifest.json",+ });++ step("3. creator posts a public task");+ const deadline = Math.floor(Date.now() / 1000) + 60 * 60; // 1 hour from now+ const taskDescription = `Render greeting via three.ws @ ${new Date().toISOString()}`;+ const created = await createAgenCTask(creatorClient, {+ creatorAgentId: creatorAgent.agentId,+ requiredCapabilities: 1n, // worker must advertise bit 0+ description: taskDescription,+ rewardAmount: TASK_REWARD_LAMPORTS,+ maxWorkers: 1,+ deadline,+ taskType: "Exclusive",+ minReputation: 0,+ });+ console.log(` taskPda: ${created.taskPda.toBase58()}`);+ console.log(` taskId : ${Buffer.from(created.taskId).toString("hex")}`);+ console.log(` tx : ${explorerTx(created.txSignature)}`);+ console.log(` account: ${explorerAccount(created.taskPda)}`);++ step("4. worker claims the task");+ const claim = await claimAgenCTask(workerClient, {+ taskPda: created.taskPda,+ workerAgentId: workerAgent.agentId,+ });+ console.log(` tx: ${explorerTx(claim.txSignature)}`);++ const afterClaim = await getAgenCTask(readClient, created.taskPda);+ console.log(` state: ${afterClaim ? formatTaskState(afterClaim.state) : "(no account)"}`);+ console.log(` workers: ${afterClaim?.currentWorkers}/${afterClaim?.maxWorkers}`);++ step("5. worker executes + submits proof");+ // In a real workflow this is where the three.ws agent runtime would+ // actually perform the work (LLM call, render, voice, etc.). For this+ // demo the "result" is a short greeting and the proof is sha256(result).+ const result = `Hello from three.ws worker ${worker.publicKey.toBase58()} — completed ${new Date().toISOString()}`;+ const proofHash = createHash("sha256").update(result, "utf8").digest();+ console.log(` result : ${result}`);+ console.log(` proofHash: 0x${proofHash.toString("hex")}`);++ const completion = await completeAgenCTask(workerClient, {+ taskPda: created.taskPda,+ workerAgentId: workerAgent.agentId,+ proofHash,+ resultData: Buffer.from(result.padEnd(64, " ").slice(0, 64), "utf8"),+ });+ console.log(` tx: ${explorerTx(completion.txSignature)}`);++ step("6. verify final on-chain state");+ const final = await getAgenCTask(readClient, created.taskPda);+ if (!final) {+ console.log(" no task account (creator may have cancelled before completion)");+ return;+ }+ console.log(` state : ${formatTaskState(final.state)}`);+ console.log(` currentWorkers: ${final.currentWorkers}/${final.maxWorkers}`);+ console.log(` completedAt : ${final.completedAt ? new Date(final.completedAt * 1000).toISOString() : "(unset)"}`);++ const finalWorker = await getAgenCAgent(readClient, workerAgent.agentPda);+ console.log(` worker reputation: ${finalWorker?.reputation ?? "?"}`);+ console.log(` worker active tasks: ${finalWorker?.activeTasks ?? "?"}`);++ console.log(`\nDone. Creator: ${explorerAccount(creator.publicKey)}`);+ console.log(` Worker : ${explorerAccount(worker.publicKey)}`);+ console.log(` Task : ${explorerAccount(created.taskPda)}`);+}++main().catch((err) => {+ console.error(`\nFATAL: ${err.stack || err.message || err}`);+ process.exit(1);+});diff --git a/package.json b/package.jsonindex e1e29d172..e4731bd32 100644--- a/package.json+++ b/package.json@@ -74,7 +74,7 @@"build:rider:full": "cd rider && npm ci --prefer-offline --no-audit --no-fund --ignore-engines && npm run build && cd .. && npm run build:rider","build:avatar-studio": "npm run build --prefix character-studio","build:fast": "npm run build",- "build:vercel": "npm run build --prefix agent-payments-sdk && npm run build:avatar-studio && NODE_OPTIONS=--max-old-space-size=4096 npm run build && npm run build:lib && node avatar-sdk/build.mjs && npm run build:rider && npm run build:chat && npm run publish:lib",+ "build:vercel": "npm run build --prefix agent-payments-sdk && npm run build:avatar-studio && npm run build:lib && node avatar-sdk/build.mjs && NODE_OPTIONS=--max-old-space-size=4096 npm run build && npm run build:rider && npm run build:chat && npm run publish:lib","build:all": "npm run build:chat && (npm run build & npm run build:lib & npm run build:rider & wait)","release:lib": "npm run build:lib && npm run publish:lib","clean": "rm -rf dist/* dist-lib/* || true",diff --git a/pages/home.html b/pages/home.htmlindex 95a371110..6438fc54d 100644--- a/pages/home.html+++ b/pages/home.html@@ -50,11 +50,9 @@<link rel="stylesheet" href="/nav.css" /><link rel="stylesheet" href="/home.css" /><link rel="stylesheet" href="/home-polish.css" />- <link rel="stylesheet" href="/home-saas.css" /><link rel="stylesheet" href="/footer.css" /><script defer src="/footer-newsletter.js"></script><script defer src="/home-polish.js"></script>- <script defer src="/home-saas.js"></script><link rel="stylesheet" href="/fonts/fonts.css" /><link rel="stylesheet" href="/mobile.css" /><script@@ -82,478 +80,6 @@<script src="/nav.js"></script><main id="main-content" class="home-parallax">- <!-- ╔══════════════════════════════════════════════════════════════╗ -->- <!-- ║ SaaS prologue — sits above the cinematic parallax hero. ║ -->- <!-- ║ Self-contained inside .h-saas; styles in /home-saas.css. ║ -->- <!-- ╚══════════════════════════════════════════════════════════════╝ -->- <div class="h-saas">- <!-- 1. Announcement bar -->- <div class="h-saas-bar" data-saas-bar role="region" aria-label="Announcement">- <div class="h-saas-bar-inner">- <span class="h-saas-bar-pill"><span class="pulse"></span>Live</span>- <span>v1.5.1 on Solana mainnet — open-source under Apache 2.0.</span>- <a- href="https://github.com/nirholas/three.ws"- target="_blank"- rel="noopener"- >Star on GitHub →</a- >- <button- type="button"- class="h-saas-bar-close"- data-saas-bar-close- aria-label="Dismiss announcement"- >- ✕- </button>- </div>- </div>-- <!-- 2. SaaS hero -->- <section class="h-saas-hero" aria-label="Product overview">- <div class="h-saas-inner h-saas-hero-inner">- <div class="h-saas-hero-copy">- <span class="h-saas-eyebrow h-saas-reveal">- <span class="dot"></span>- The 3D identity layer for AI agents- </span>- <h2 class="h-saas-h1 h-saas-reveal">- Every AI agent deserves a <em>3D body</em> and a verifiable- onchain home.- </h2>- <p class="h-saas-sub h-saas-reveal">- three.ws is the open infrastructure for spawning 3D AI agents on- Solana. Drop a GLB, connect any LLM via MCP or A2A, mint a- portable identity, and embed it anywhere with one tag — no SDK- required on the consumer side.- </p>- <div class="h-saas-cta h-saas-reveal">- <a href="/create" class="h-saas-btn h-saas-btn--primary">- <span>Start free</span>- <span class="arrow">→</span>- </a>- <a href="#pick-animate" class="h-saas-btn h-saas-btn--ghost">- Watch it live- </a>- </div>- <div class="h-saas-proof h-saas-reveal">- <div class="h-saas-avatars" aria-hidden="true">- <span class="av"></span>- <span class="av"></span>- <span class="av"></span>- <span class="av"></span>- <span class="av">+</span>- </div>- <span class="h-saas-stars" aria-hidden="true">★★★★★</span>- <span>Built for creators, devs, DAOs and brands shipping agentic UX.</span>- </div>- </div>-- <aside class="h-saas-pcard h-saas-reveal" aria-label="Live agent preview">- <div class="h-saas-pcard-bar" aria-hidden="true">- <span class="d"></span>- <span class="d"></span>- <span class="d"></span>- <span class="url">three.ws/agent/preview</span>- </div>- <div class="h-saas-pcard-stage">- <model-viewer- src="/animations/robotexpressive.glb"- auto-rotate- auto-rotate-delay="0"- rotation-per-second="22deg"- interaction-prompt="none"- camera-controls="false"- disable-zoom- shadow-intensity="0.4"- exposure="0.8"- environment-image="neutral"- camera-orbit="0deg 80deg 5m"- field-of-view="32deg"- loading="lazy"- ></model-viewer>- <div class="h-saas-pcard-hud" aria-hidden="true">- <span class="h-saas-pcard-chip">- <span class="pulse"></span>- A2A · MCP · ready- </span>- <span class="h-saas-pcard-chip tx">- <code>3DAg…uPL</code>- </span>- </div>- </div>- </aside>- </div>- </section>-- <!-- 3. Compatible-with marquee -->- <section class="h-saas-logos" aria-label="Compatible with">- <p class="h-saas-logos-title">Compatible with the stack you already use</p>- <div class="h-saas-marquee">- <div class="h-saas-marquee-track">- <span class="h-saas-mark"><span class="glyph">◎</span>Solana</span>- <span class="h-saas-mark"><span class="glyph">M</span>Metaplex Core</span>- <span class="h-saas-mark"><span class="glyph">⌘</span>MCP</span>- <span class="h-saas-mark"><span class="glyph">A</span>A2A</span>- <span class="h-saas-mark"><span class="glyph">8</span>ERC-8004</span>- <span class="h-saas-mark"><span class="glyph">G</span>glTF 2.0</span>- <span class="h-saas-mark"><span class="glyph">▲</span>Vercel</span>- <span class="h-saas-mark"><span class="glyph">◬</span>Three.js</span>- <span class="h-saas-mark"><span class="glyph">$</span>x402</span>- <span class="h-saas-mark"><span class="glyph">H</span>Helius</span>- <span class="h-saas-mark"><span class="glyph">N</span>Neon</span>- <span class="h-saas-mark"><span class="glyph">P</span>Phantom</span>- <span class="h-saas-mark" aria-hidden="true"><span class="glyph">◎</span>Solana</span>- <span class="h-saas-mark" aria-hidden="true"><span class="glyph">M</span>Metaplex Core</span>- <span class="h-saas-mark" aria-hidden="true"><span class="glyph">⌘</span>MCP</span>- <span class="h-saas-mark" aria-hidden="true"><span class="glyph">A</span>A2A</span>- <span class="h-saas-mark" aria-hidden="true"><span class="glyph">8</span>ERC-8004</span>- <span class="h-saas-mark" aria-hidden="true"><span class="glyph">G</span>glTF 2.0</span>- <span class="h-saas-mark" aria-hidden="true"><span class="glyph">▲</span>Vercel</span>- <span class="h-saas-mark" aria-hidden="true"><span class="glyph">◬</span>Three.js</span>- <span class="h-saas-mark" aria-hidden="true"><span class="glyph">$</span>x402</span>- <span class="h-saas-mark" aria-hidden="true"><span class="glyph">H</span>Helius</span>- <span class="h-saas-mark" aria-hidden="true"><span class="glyph">N</span>Neon</span>- <span class="h-saas-mark" aria-hidden="true"><span class="glyph">P</span>Phantom</span>- </div>- </div>- </section>-- <!-- 4. Live metrics (real /api/home-stats; hides if unavailable) -->- <section- class="h-saas-metrics"- data-saas-metrics- hidden- aria-label="Live platform metrics"- >- <div class="h-saas-inner">- <div class="h-saas-metrics-head h-saas-reveal">- <span class="h-saas-eyebrow"- ><span class="dot"></span>Live numbers</span- >- <h2 class="h-saas-section-title">Real agents. Real chains. Real time.</h2>- <p class="h-saas-section-sub">- Pulled directly from the index — refreshed every minute.- </p>- </div>- <div class="h-saas-metrics-grid h-saas-reveal">- <div class="h-saas-metric">- <span class="h-saas-metric-num" data-saas-metric="agents">0</span>- <span class="h-saas-metric-label">Agents created</span>- </div>- <div class="h-saas-metric">- <span class="h-saas-metric-num" data-saas-metric="onchain_agents"- >0</span- >- <span class="h-saas-metric-label">Onchain identities</span>- </div>- <div class="h-saas-metric">- <span class="h-saas-metric-num" data-saas-metric="widgets">0</span>- <span class="h-saas-metric-label">Widgets deployed</span>- </div>- <div class="h-saas-metric">- <span class="h-saas-metric-num" data-saas-metric="chains">0</span>- <span class="h-saas-metric-label">Chains indexed</span>- </div>- </div>- </div>- </section>-- <!-- 5. Audience tabs -->- <section class="h-saas-section" aria-label="Built for">- <div class="h-saas-inner">- <div class="h-saas-section-head h-saas-reveal">- <span class="h-saas-eyebrow"- ><span class="dot"></span>Built for builders</span- >- <h2 class="h-saas-section-title">- One platform.<br />- Four kinds of teams.- </h2>- <p class="h-saas-section-sub">- Whatever you ship, three.ws is the layer that gives your agent a face,- a wallet, and a home onchain.- </p>- </div>- <div class="h-saas-tabwrap h-saas-reveal">- <div class="h-saas-tabs" role="tablist" data-saas-tabs>- <button- class="h-saas-tab"- role="tab"- aria-selected="true"- data-saas-panel="<strong>Creators</strong> — turn your character into an animated 3D agent that chats on Twitter, replies to fans, and lives on its own page. Free to start, mint when you're ready."- >- Creators- </button>- <button- class="h-saas-tab"- role="tab"- aria-selected="false"- data-saas-panel="<strong>Developers</strong> — drop the <code><agent-3d></code> web component into any page; wire MCP tools and A2A endpoints; ship in minutes with no SDK on the consumer side."- >- Developers- </button>- <button- class="h-saas-tab"- role="tab"- aria-selected="false"- data-saas-panel="<strong>DAOs & protocols</strong> — give your governance agent or treasury bot a verifiable Metaplex Core identity, attestations, and a discoverable A2A endpoint."- >- DAOs- </button>- <button- class="h-saas-tab"- role="tab"- aria-selected="false"- data-saas-panel="<strong>Brands & enterprises</strong> — deploy customer-facing 3D agents with full white-label branding, embeddable widgets, and an audit trail of every interaction."- >- Brands- </button>- </div>- <p class="h-saas-tabpanel" data-saas-tabpanel></p>- </div>- </div>- </section>-- <!-- 6. Use cases (real avatars) -->- <section class="h-saas-section" aria-label="What you can build">- <div class="h-saas-inner">- <div class="h-saas-section-head h-saas-reveal">- <span class="h-saas-eyebrow"- ><span class="dot"></span>What you can build</span- >- <h2 class="h-saas-section-title">From character to chain in 60 seconds.</h2>- <p class="h-saas-section-sub">- Three real agents shipped on three.ws — hover any card to interact.- </p>- </div>- <div class="h-saas-cases">- <article class="h-saas-case h-saas-reveal">- <div class="h-saas-case-stage">- <model-viewer- src="/animations/robotexpressive.glb"- auto-rotate- auto-rotate-delay="0"- rotation-per-second="24deg"- interaction-prompt="none"- camera-controls="false"- disable-zoom- shadow-intensity="0"- exposure="0.85"- environment-image="neutral"- camera-orbit="15deg 80deg 4m"- field-of-view="38deg"- loading="lazy"- ></model-viewer>- </div>- <div class="h-saas-case-body">- <span class="h-saas-case-kicker">Character agent</span>- <h3 class="h-saas-case-title">Robot — animated, embeddable.</h3>- <p class="h-saas-case-desc">- Drop a GLB, pick from 12+ animations, drop one tag on any- page. Used by creators on Twitter and personal sites.- </p>- <a class="h-saas-case-link" href="/app">Open the viewer →</a>- </div>- </article>- <article class="h-saas-case h-saas-reveal">- <div class="h-saas-case-stage">- <model-viewer- src="/animations/soldier.glb"- auto-rotate- auto-rotate-delay="0"- rotation-per-second="24deg"- interaction-prompt="none"- camera-controls="false"- disable-zoom- shadow-intensity="0"- exposure="0.85"- environment-image="neutral"- camera-orbit="15deg 80deg 4m"- field-of-view="38deg"- loading="lazy"- ></model-viewer>- </div>- <div class="h-saas-case-body">- <span class="h-saas-case-kicker">Studio</span>- <h3 class="h-saas-case-title">Soldier — full animation library.</h3>- <p class="h-saas-case-desc">- Idle, walk, run, jump, dance, wave, punch. Bring your own- Mixamo or load any glTF rig directly in the studio.- </p>- <a class="h-saas-case-link" href="/studio">Open Widget Studio →</a>- </div>- </article>- <article class="h-saas-case h-saas-reveal">- <div class="h-saas-case-stage">- <model-viewer- src="/avatars/cz.glb"- auto-rotate- auto-rotate-delay="0"- rotation-per-second="24deg"- interaction-prompt="none"- camera-controls="false"- disable-zoom- shadow-intensity="0"- exposure="0.85"- environment-image="neutral"- camera-orbit="15deg 80deg 4m"- field-of-view="38deg"- loading="lazy"- ></model-viewer>- </div>- <div class="h-saas-case-body">- <span class="h-saas-case-kicker">Live onchain</span>- <h3 class="h-saas-case-title">CZ — full talking agent.</h3>- <p class="h-saas-case-desc">- A real agent shipped on three.ws: 3D avatar, voice chat,- animations, x402-paid skills, and a Solana wallet.- </p>- <a class="h-saas-case-link" href="/cz">Visit /cz →</a>- </div>- </article>- </div>- </div>- </section>-- <!-- 7. Copyable snippet -->- <section class="h-saas-section" aria-label="Drop one tag">- <div class="h-saas-inner">- <div class="h-saas-section-head h-saas-reveal">- <span class="h-saas-eyebrow"- ><span class="dot"></span>Ship in two lines</span- >- <h2 class="h-saas-section-title">- Drop one script. Drop one tag. Done.- </h2>- <p class="h-saas-section-sub">- The <code><agent-3d></code> web component lazy-loads, renders- anywhere — Notion, Ghost, WordPress, Framer, your custom Next.js- app — and connects to your stack via MCP or A2A.- </p>- </div>- <div class="h-saas-codecard h-saas-reveal">- <div class="h-saas-codecard-bar" aria-hidden="true">- <span class="d"></span>- <span class="d"></span>- <span class="d"></span>- <span class="filename">index.html</span>- <button- type="button"- class="h-saas-copy"- data-saas-copy="#h-saas-snippet"- aria-label="Copy code"- >- Copy- </button>- </div>- <pre id="h-saas-snippet"><code><span class="c"><!-- 1. Load the component (lazy, ~14kb gzipped) --></span>-<span class="tag"><script</span> <span class="attr">type</span>=<span class="val">"module"</span>- <span class="attr">src</span>=<span class="val">"https://three.ws/agent-3d/latest/agent-3d.js"</span><span class="tag">></script></span>--<span class="c"><!-- 2. Drop the tag — that's it --></span>-<span class="tag"><agent-3d</span>- <span class="attr">agent-id</span>=<span class="val">"3DAg…uPL"</span>- <span class="attr">kiosk</span>-<span class="tag">></agent-3d></span></code></pre>- </div>- </div>- </section>-- <!-- 8. Integration grid -->- <section class="h-saas-section" aria-label="Integrations">- <div class="h-saas-inner">- <div class="h-saas-section-head h-saas-reveal">- <span class="h-saas-eyebrow"- ><span class="dot"></span>Open by design</span- >- <h2 class="h-saas-section-title">- Plays nicely with everything in your stack.- </h2>- <p class="h-saas-section-sub">- No vendor lock-in. Standards-first. Bring your own LLM, wallet, RPC,- and host — three.ws stays out of the way.- </p>- </div>- <div class="h-saas-int-grid h-saas-reveal">- <div class="h-saas-int"><span class="glyph">◎</span><span class="h-saas-int-name">Solana</span></div>- <div class="h-saas-int"><span class="glyph">M</span><span class="h-saas-int-name">Metaplex Core</span></div>- <div class="h-saas-int"><span class="glyph">⌘</span><span class="h-saas-int-name">MCP</span></div>- <div class="h-saas-int"><span class="glyph">A</span><span class="h-saas-int-name">A2A</span></div>- <div class="h-saas-int"><span class="glyph">8</span><span class="h-saas-int-name">ERC-8004</span></div>- <div class="h-saas-int"><span class="glyph">G</span><span class="h-saas-int-name">glTF 2.0</span></div>- <div class="h-saas-int"><span class="glyph">◬</span><span class="h-saas-int-name">Three.js</span></div>- <div class="h-saas-int"><span class="glyph">▲</span><span class="h-saas-int-name">Vercel</span></div>- <div class="h-saas-int"><span class="glyph">$</span><span class="h-saas-int-name">x402</span></div>- <div class="h-saas-int"><span class="glyph">H</span><span class="h-saas-int-name">Helius</span></div>- <div class="h-saas-int"><span class="glyph">N</span><span class="h-saas-int-name">Neon</span></div>- <div class="h-saas-int"><span class="glyph">P</span><span class="h-saas-int-name">Phantom</span></div>- </div>- </div>- </section>-- <!-- 9. Pricing teaser -->- <section class="h-saas-section" aria-label="Pricing">- <div class="h-saas-inner h-saas-price">- <div class="h-saas-price-copy h-saas-reveal">- <span class="h-saas-eyebrow"- ><span class="dot"></span>Free to start</span- >- <h2>No subscription.<br />Just per-mint costs.</h2>- <p>- Use the viewer, embed widgets, build agents, and explore the studio- for free. Pay only the Solana network fee — about a cent — when you- mint an onchain identity. Optional paid plans unlock higher quotas,- team seats and audit logs.- </p>- <ul class="h-saas-price-bullets">- <li>Unlimited drafts and animations in the studio.</li>- <li>Embed widgets on any site with one tag.</li>- <li>Native MCP + A2A endpoints out of the box.</li>- <li>Your keys, your asset — owned on Solana.</li>- </ul>- <a href="/pricing" class="h-saas-btn h-saas-btn--ghost">- Compare plans- <span class="arrow">→</span>- </a>- </div>- <div class="h-saas-price-card h-saas-reveal">- <span class="h-saas-price-tier">Free forever</span>- <div class="h-saas-price-amount">$0<small>/month</small></div>- <p class="h-saas-price-note">+ ~$0.01 one-time mint fee on Solana</p>- <a href="/create" class="h-saas-btn h-saas-btn--primary">- <span>Create your agent</span>- <span class="arrow">→</span>- </a>- <div class="h-saas-price-foot">- <span>No credit card.</span>- <a href="/docs">Read the docs</a>- </div>- </div>- </div>- </section>-- <!-- 10. Closing CTA band -->- <section class="h-saas-cta-band" aria-label="Get started">- <span class="h-saas-eyebrow h-saas-reveal"- ><span class="dot"></span>Ship today</span- >- <h2 class="h-saas-cta-h h-saas-reveal">- Give your AI a <em>body</em>.<br />In 60 seconds.- </h2>- <p class="h-saas-cta-p h-saas-reveal">- No install. No SDK on the consumer side. Free to start. Owned on Solana.- </p>- <div class="h-saas-cta-row h-saas-reveal">- <a href="/create" class="h-saas-btn h-saas-btn--primary">- <span>Start free</span>- <span class="arrow">→</span>- </a>- <a href="/docs" class="h-saas-btn h-saas-btn--ghost">Read the docs</a>- </div>- </section>- </div>-<!-- ── Hero (parallax act) ── --><section class="h-hero-act"><!-- Depth 8: fluid particles + nebula -->@@ -766,10 +292,9 @@></div><div class="h-act-cta">- <a href="/app" class="h-btn-primary"- ><span>Open full viewer</span><span class="arrow">→</span></a+ <a href="/create" class="h-btn-primary"+ ><span>Create your agent</span><span class="arrow">→</span></a>- <a href="/create" class="h-btn-ghost">Create your agent</a></div></div></section>diff --git a/pages/profile.html b/pages/profile.htmlindex e43612ee2..a47894ad8 100644--- a/pages/profile.html+++ b/pages/profile.html@@ -900,58 +900,138 @@</span>`: '';- // SNS subdomain pill + pay-by-name button.- // Look up `<username>.threews.sol`; if claimed, badge it as a verified- // on-chain handle and surface the pay-by-name action.+ // SNS subdomain pill + pay-by-name button. Look up+ // `<username>.threews.sol`; if claimed, badge it as a verified+ // on-chain handle and surface the pay-by-name action. If unclaimed+ // AND the visitor owns this profile, surface a claim CTA instead.const snsPillSlot = `<span id="up-sns-pill"></span><span id="up-pay-slot"></span>`;(async () => {try {- const r = await fetch(`/api/threews/subdomain?label=${encodeURIComponent(user.username)}`);- if (!r.ok) return;- const j = await r.json();- const d = j?.data;- if (!d?.claim || d.claim.username !== user.username) return;- const pill = document.getElementById('up-sns-pill');- if (pill) {- pill.outerHTML = `<a class="up-wallet-pill" style="text-decoration:none" href="https://www.sns.id/domain?domain=${attr(d.full)}" target="_blank" rel="noopener" title="${attr(d.full)}">- <svg width="10" height="10" viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M8 0l2.39 4.84L16 5.92l-4 3.9L13 16l-5-2.63L3 16l1-6.18L0 5.92l5.61-1.08z"/></svg>- ${esc(d.full)}- </a>`;+ const [snsRes, meRes] = await Promise.all([+ fetch(`/api/threews/subdomain?label=${encodeURIComponent(user.username)}`),+ fetch('/api/auth/me', { credentials: 'include' }).catch(() => null),+ ]);+ const viewerId = meRes?.ok ? (await meRes.json())?.user?.id : null;+ const isOwner = viewerId && user.id && viewerId === user.id;++ if (snsRes.ok) {+ const j = await snsRes.json();+ const d = j?.data;+ if (d?.claim && d.claim.username === user.username) {+ const pill = document.getElementById('up-sns-pill');+ if (pill) {+ pill.outerHTML = `<a class="up-wallet-pill" style="text-decoration:none" href="https://www.sns.id/domain?domain=${attr(d.full)}" target="_blank" rel="noopener" title="${attr(d.full)}">+ <svg width="10" height="10" viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M8 0l2.39 4.84L16 5.92l-4 3.9L13 16l-5-2.63L3 16l1-6.18L0 5.92l5.61-1.08z"/></svg>+ ${esc(d.full)}+ </a>`;+ }+ const paySlot = document.getElementById('up-pay-slot');+ if (paySlot) {+ paySlot.outerHTML = `<button class="up-wallet-pill" id="up-pay-btn" style="cursor:pointer;border:0;font-family:inherit" data-name="${attr(d.full)}" data-handle="${attr(user.username)}">+ Pay @${esc(user.username)} in USDC+ </button>`;+ document.getElementById('up-pay-btn')?.addEventListener('click', () => openPayModal(d.full, user.username));+ }+ return;+ }}- const paySlot = document.getElementById('up-pay-slot');- if (paySlot) {- paySlot.outerHTML = `<button class="up-wallet-pill" id="up-pay-btn" style="cursor:pointer;border:0;font-family:inherit" data-name="${attr(d.full)}">- Pay @${esc(user.username)} in USDC- </button>`;- document.getElementById('up-pay-btn')?.addEventListener('click', () => openPay(d.full));++ // Unclaimed. If visitor is the profile owner, show a claim CTA.+ if (isOwner) {+ const pill = document.getElementById('up-sns-pill');+ if (pill) {+ pill.outerHTML = `<a class="up-wallet-pill" style="text-decoration:none;background:rgba(105,225,111,.08);border-color:rgba(105,225,111,.35);color:#69e16f" href="/threews/claim" title="Claim ${attr(user.username)}.threews.sol">+ Claim ${esc(user.username)}.threews.sol →+ </a>`;+ }}} catch {}})();- async function openPay(name) {- const amount = prompt(`How much USDC do you want to send to ${name}?`, '1');- if (!amount) return;- const num = Number(amount);- if (!Number.isFinite(num) || num <= 0) { alert('invalid amount'); return; }- const payerWallet = prompt('Your Solana wallet address (the one paying):', '');- if (!payerWallet) return;- try {- const res = await fetch('/api/x402/pay-by-name', {- method: 'POST',- headers: { 'content-type': 'application/json' },- body: JSON.stringify({ mode: 'prep', name, amount_usdc: num, payer_wallet: payerWallet.trim() }),- });- const data = await res.json();- if (!res.ok) {- alert(data?.error_description || 'Could not prepare payment.');+ function openPayModal(name, handle) {+ // Remove any open modal first.+ document.getElementById('up-pay-modal')?.remove();+ const modal = document.createElement('div');+ modal.id = 'up-pay-modal';+ modal.setAttribute('role', 'dialog');+ modal.setAttribute('aria-modal', 'true');+ modal.style.cssText = 'position:fixed;inset:0;background:rgba(0,0,0,.7);display:flex;align-items:center;justify-content:center;z-index:9999;padding:1rem;backdrop-filter:blur(6px)';+ modal.innerHTML = `+ <div class="up-pay-card" style="background:#0a0a0a;border:1px solid rgba(255,255,255,.1);border-radius:14px;padding:1.5rem;max-width:420px;width:100%;color:rgba(255,255,255,.95)">+ <div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:.4rem">+ <h3 style="margin:0;font-weight:500;font-size:1.1rem">Pay @${esc(handle)}</h3>+ <button id="up-pay-close" aria-label="Close" style="background:transparent;border:0;color:rgba(255,255,255,.5);font-size:1.4rem;cursor:pointer;line-height:1;padding:0">×</button>+ </div>+ <p style="color:rgba(255,255,255,.5);font-size:.85rem;margin:0 0 1.2rem">Resolves on-chain via <code style="background:rgba(255,255,255,.06);padding:.1em .4em;border-radius:4px">${esc(name)}</code>. Returns an unsigned USDC transfer for your wallet to sign.</p>+ <label style="display:block;font-size:.85rem;color:rgba(255,255,255,.5);margin-bottom:.4rem">Amount (USDC)</label>+ <input id="up-pay-amount" type="number" min="0.000001" step="0.01" value="1" style="width:100%;background:#000;color:#fff;border:1px solid rgba(255,255,255,.12);border-radius:8px;padding:.7rem .9rem;font-size:1rem;font-family:inherit;margin-bottom:1rem;box-sizing:border-box">+ <label style="display:block;font-size:.85rem;color:rgba(255,255,255,.5);margin-bottom:.4rem">Your Solana wallet (payer)</label>+ <input id="up-pay-payer" type="text" placeholder="base58 address" autocomplete="off" spellcheck="false" style="width:100%;background:#000;color:#fff;border:1px solid rgba(255,255,255,.12);border-radius:8px;padding:.7rem .9rem;font-size:.95rem;font-family:ui-monospace,Menlo,monospace;margin-bottom:.5rem;box-sizing:border-box">+ <div id="up-pay-status" style="min-height:1.2em;font-size:.85rem;color:rgba(255,255,255,.5);margin-bottom:.8rem"></div>+ <button id="up-pay-go" style="width:100%;background:#fff;color:#000;border:0;border-radius:10px;padding:.85rem;font-size:1rem;font-weight:500;font-family:inherit;cursor:pointer">Prepare payment</button>+ <div id="up-pay-result" style="display:none;margin-top:1rem;padding:1rem;border:1px solid rgba(105,225,111,.3);background:rgba(105,225,111,.05);border-radius:10px;font-size:.85rem"></div>+ </div>+ `;+ document.body.appendChild(modal);+ const close = () => modal.remove();+ modal.addEventListener('click', (e) => { if (e.target === modal) close(); });+ modal.querySelector('#up-pay-close').addEventListener('click', close);+ document.addEventListener('keydown', function esc(e) { if (e.key === 'Escape') { close(); document.removeEventListener('keydown', esc); } });++ const goBtn = modal.querySelector('#up-pay-go');+ const statusEl = modal.querySelector('#up-pay-status');+ const resultEl = modal.querySelector('#up-pay-result');+ goBtn.addEventListener('click', async () => {+ const amount = Number(modal.querySelector('#up-pay-amount').value);+ const payer = modal.querySelector('#up-pay-payer').value.trim();+ if (!Number.isFinite(amount) || amount <= 0) {+ statusEl.textContent = 'Enter a positive USDC amount.';+ statusEl.style.color = '#ff7a7a';return;}- const d = data.data;- alert(`Payment prepared.\n\nTo: ${d.recipient.resolved} (${d.recipient.address.slice(0,6)}…${d.recipient.address.slice(-4)})\nAmount: ${d.amount_usdc} USDC\n\nSign and broadcast the returned transaction with your Solana wallet (base64 tx is in the console).`);- console.log('[pay-by-name tx_base64]', d.tx_base64);- } catch (err) {- alert(err?.message || 'Network error.');- }+ if (!/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(payer)) {+ statusEl.textContent = 'Payer must be a base58 Solana address.';+ statusEl.style.color = '#ff7a7a';+ return;+ }+ statusEl.style.color = 'rgba(255,255,255,.5)';+ statusEl.textContent = 'Preparing transaction…';+ goBtn.disabled = true;+ try {+ const res = await fetch('/api/x402/pay-by-name', {+ method: 'POST',+ headers: { 'content-type': 'application/json' },+ body: JSON.stringify({ mode: 'prep', name, amount_usdc: amount, payer_wallet: payer }),+ });+ const data = await res.json();+ if (!res.ok) {+ statusEl.textContent = data?.error_description || 'Could not prepare payment.';+ statusEl.style.color = '#ff7a7a';+ goBtn.disabled = false;+ return;+ }+ const d = data.data;+ statusEl.textContent = '';+ resultEl.style.display = 'block';+ resultEl.innerHTML = `+ <div style="font-weight:500;color:#69e16f;margin-bottom:.4em">Transaction ready.</div>+ <div style="color:rgba(255,255,255,.7);line-height:1.5">+ To: <code style="background:rgba(255,255,255,.06);padding:.1em .4em;border-radius:4px">${esc(d.recipient.resolved)}</code><br>+ Amount: <strong>${esc(String(d.amount_usdc))} USDC</strong><br>+ Recipient wallet: <span style="font-family:ui-monospace,Menlo,monospace;font-size:.85em">${esc(d.recipient.address.slice(0,6))}…${esc(d.recipient.address.slice(-4))}</span>+ </div>+ <details style="margin-top:.6em">+ <summary style="cursor:pointer;color:rgba(255,255,255,.5)">Show base64 transaction</summary>+ <textarea readonly style="width:100%;height:5em;margin-top:.4em;background:#000;color:#69e16f;border:1px solid rgba(255,255,255,.1);border-radius:6px;padding:.4em;font-family:ui-monospace,Menlo,monospace;font-size:.7rem;box-sizing:border-box">${esc(d.tx_base64)}</textarea>+ </details>+ <div style="margin-top:.6em;color:rgba(255,255,255,.5)">Sign and broadcast this transaction with your Solana wallet (Phantom, Solflare, Backpack) to complete the payment.</div>+ `;+ } catch (err) {+ statusEl.textContent = err?.message || 'Network error.';+ statusEl.style.color = '#ff7a7a';+ goBtn.disabled = false;+ }+ });}// Stats stripdiff --git a/public/demos/pricing.html b/public/demos/pricing.htmlindex ad810f842..47c11ea52 100644--- a/public/demos/pricing.html+++ b/public/demos/pricing.html@@ -374,8 +374,11 @@// activeTier: tier she's currently associated with (declared above)let walkT = 0, walkStart = null, walkEnd = null, walkDur = 0.85;let jumpT = 0, jumpStart = null, jumpEnd = null, jumpLift = 0;+ let lastMoveKind = null; // 'walk' | 'jump' — read by landOnTierconst WALK_SPEED = 5; // world units per second- const JUMP_S = 0.85;+ // Matches the av-superhero-jump clip (2.0s) — finishing a touch+ // early so the landing-clamp pose doesn't sit frozen too long.+ const JUMP_S = 1.7;function smoothstep(t) { return t * t * (3 - 2 * t); }@@ -401,6 +404,7 @@beginMove(tierEl);phase = 'walking';+ lastMoveKind = 'walk';walkT = 0;walkStart = { x: avatar.position.x, y: avatar.position.y };walkEnd = standOnTopOf(tierEl);@@ -419,13 +423,16 @@beginMove(tierEl);phase = 'jumping';+ lastMoveKind = 'jump';jumpT = 0;jumpStart = { x: avatar.position.x, y: avatar.position.y };jumpEnd = standOnTopOf(tierEl);- // Lift the arc proportionally to horizontal distance + a baseline+ // Bigger arc — the hip-Y of the clip is suppressed by the+ // render hook so the parabola is the only visible airborne lift.+ // 2.2 baseline reads clearly even for short adjacent hops.const dx = Math.abs(jumpEnd.x - jumpStart.x);- jumpLift = Math.max(1.2, dx * 0.32);- setAnimation('jump', { loop: false, hold: true });+ jumpLift = Math.max(2.2, dx * 0.55);+ setAnimation('av-superhero-jump', { loop: false, hold: true });// Face direction of travel — slight yaw, not full profileconst dir = Math.sign(jumpEnd.x - jumpStart.x) || 0;gsap.to(avatar.rotation, { y: dir * 0.25, duration: 0.2, overwrite: true });@@ -480,11 +487,21 @@});// Face camera so the gesture reads cleanlygsap.to(avatar.rotation, { y: 0, duration: 0.25, overwrite: true });- const persona = personalityFor(t);- setAnimation(persona.land, { loop: false, hold: false });- setTimeout(() => {- if (phase === 'idle' && activeTier === t) setAnimation('idle', { loop: true });- }, persona.settleMs);+ if (lastMoveKind === 'jump') {+ // The superhero-jump clip already ends in a landing crouch;+ // layering another "land" reaction on top reads as a glitch+ // (crouch → forward-roll). Hold the clip's final frame+ // briefly, then crossfade to idle.+ setTimeout(() => {+ if (phase === 'idle' && activeTier === t) setAnimation('idle', { loop: true });+ }, 600);+ } else {+ const persona = personalityFor(t);+ setAnimation(persona.land, { loop: false, hold: false });+ setTimeout(() => {+ if (phase === 'idle' && activeTier === t) setAnimation('idle', { loop: true });+ }, persona.settleMs);+ }scheduleFidget();}@@ -580,7 +597,7 @@// Loaded up front so per-tier personality + idle fidgets can play// instantly without a fetch hiccup mid-hover.const CLIPS = [- 'idle', 'walk', 'jump', 'falltolanding',+ 'idle', 'walk', 'av-superhero-jump', 'falltolanding',];new GLTFLoader().load('/avatars/cz.glb', gltf => {@@ -603,7 +620,17 @@if (rootBone) baseRootPos = rootBone.position.clone();const _r = renderer.render.bind(renderer);renderer.render = (sc, cam) => {- try { if (rootBone && baseRootPos) rootBone.position.copy(baseRootPos); } catch (_) {}+ try {+ if (rootBone && baseRootPos) {+ // Always pin X/Z so the avatar stays on the parent+ // transform we control. Y is also pinned by default,+ // but the jump phase needs the clip's hip descent to+ // show through so the landing crouch reads with weight.+ rootBone.position.x = baseRootPos.x;+ rootBone.position.z = baseRootPos.z;+ if (phase !== 'jumping') rootBone.position.y = baseRootPos.y;+ }+ } catch (_) {}_r(sc, cam);};diff --git a/solana-agent-sdk/scripts/agenc-devnet-probe.mjs b/solana-agent-sdk/scripts/agenc-devnet-probe.mjsnew file mode 100644index 000000000..0ec72a752--- /dev/null+++ b/solana-agent-sdk/scripts/agenc-devnet-probe.mjs@@ -0,0 +1,19 @@+// Probe AgenC devnet state so the roundtrip example knows the real+// preconditions (protocol initialized? minimum stake? rate limits?).+// Run once during integration work; not part of the published surface.+import { createAgenCClient } from "../dist/index.js";+import { getProtocolConfig, getZkConfig } from "@tetsuo-ai/sdk";++const client = createAgenCClient({ cluster: "devnet" });+console.log("rpc:", client.connection.rpcEndpoint);+console.log("programId:", client.programId.toBase58());++const protocol = await getProtocolConfig(client.program);+console.log("protocol:", protocol ? JSON.parse(JSON.stringify(protocol, (_, v) =>+ typeof v === "bigint" ? v.toString() : v?.toBase58?.() ?? v,+)) : null);++const zk = await getZkConfig(client.program);+console.log("zkConfig:", zk ? JSON.parse(JSON.stringify(zk, (_, v) =>+ typeof v === "bigint" ? v.toString() : v?.toBase58?.() ?? v,+)) : null);diff --git a/solana-agent-sdk/src/actions/agenc/client.ts b/solana-agent-sdk/src/actions/agenc/client.tsindex da0e58c55..8b5b6c63f 100644--- a/solana-agent-sdk/src/actions/agenc/client.ts+++ b/solana-agent-sdk/src/actions/agenc/client.ts@@ -63,11 +63,23 @@ function resolveSigner(signer: AgenCClientOptions["signer"],): Keypair | null {if (!signer) return null;- if (signer instanceof Keypair) return signer;+ // Duck-type Keypair so calling code that resolved a different copy of+ // @solana/web3.js (npm dedup misses are common in monorepos / file:+ // installs) still works.+ if (+ typeof signer === "object" &&+ !Array.isArray(signer) &&+ !(signer instanceof Uint8Array) &&+ "secretKey" in (signer as object) &&+ "publicKey" in (signer as object)+ ) {+ const candidate = signer as { secretKey: Uint8Array };+ return Keypair.fromSecretKey(Uint8Array.from(candidate.secretKey));+ }if (typeof signer === "string") {return Keypair.fromSecretKey(bs58.decode(signer));}- return Keypair.fromSecretKey(Uint8Array.from(signer));+ return Keypair.fromSecretKey(Uint8Array.from(signer as Uint8Array | number[]));}function buildWallet(signer: Keypair | null): Wallet {diff --git a/src/solana/sns-subdomain.js b/src/solana/sns-subdomain.jsindex effad8a55..e4cfa7ca2 100644--- a/src/solana/sns-subdomain.js+++ b/src/solana/sns-subdomain.js@@ -1,15 +1,21 @@/**- * Create a subdomain under a .sol parent owned by the platform.+ * Create a subdomain under a .sol parent owned by the platform, write a+ * Brave-resolvable URL record pointing at the user's storefront page, and+ * transfer ownership to the user — all atomically in one VersionedTransaction.** The platform holds the keypair for the parent domain (e.g. `threews.sol`).- * `createSubdomain` itself opens the new registry with the parent owner set- * as the owner of the subdomain; we then immediately transfer it to the- * requested final owner — both instructions are bundled into one tx so the- * subdomain is never claimable by a third party between create and transfer.+ * Order matters:+ * 1. createSubdomain — parent owner becomes owner of the new registry.+ * 2. createRecordV2Instruction(URL → https://three.ws/u/<label>) — written+ * while the platform still owns the subdomain. Once Brave's SNS resolver+ * sees this record, typing `<label>.threews.sol` redirects to the+ * storefront.+ * 3. transferSubdomain — hands the subdomain (and any records attached to+ * it; record accounts persist past ownership transfer) to the user.*- * The parent owner is the only signer. We use it as fee payer as well — gas- * is small (well under 0.01 SOL per subdomain) and absorbing it removes any- * wallet-signing UX from the user.+ * The parent owner is the only signer and fee payer — gas is well under 0.01+ * SOL per subdomain and absorbing it removes wallet-signing friction from the+ * user.*/import { Connection, Keypair, PublicKey, TransactionMessage, VersionedTransaction } from '@solana/web3.js';@@ -51,6 +57,17 @@ export function getParentDomain() {return (process.env.THREEWS_SOL_PARENT_DOMAIN || 'threews.sol').toLowerCase();}+// Public origin three.ws is reachable on. Used to build the URL record so a+// Brave user typing `<label>.threews.sol` lands on the matching storefront.+export function getStorefrontOrigin() {+ const raw = process.env.STOREFRONT_ORIGIN || 'https://three.ws';+ return raw.replace(/\/$/, '');+}++export function storefrontUrlForLabel(label) {+ return `${getStorefrontOrigin()}/u/${encodeURIComponent(label)}`;+}+const LABEL_RE = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;/**@@ -119,9 +136,22 @@ export async function createNamedSubdomain({ label, newOwner, space = 2000, rpcUconst sns = await import('@bonfida/spl-name-service');const createIxs = await sns.createSubdomain(connection, fullName, parentKp.publicKey, space);++ // Write the URL record while the platform still owns the subdomain.+ // This makes `<label>.threews.sol` resolve in Brave (and any other SNS-+ // aware client) to the user's storefront page on three.ws.+ const url = storefrontUrlForLabel(cleanLabel);+ const urlRecordIx = sns.createRecordV2Instruction(+ fullName,+ sns.Record.Url,+ url,+ parentKp.publicKey,+ parentKp.publicKey,+ );+const transferIxs = await sns.transferSubdomain(connection, fullName, newOwnerKey, true);- const ixs = [...createIxs, ...transferIxs];+ const ixs = [...createIxs, urlRecordIx, ...transferIxs];const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash('confirmed');const message = new TransactionMessage({payerKey: parentKp.publicKey,@@ -139,5 +169,6 @@ export async function createNamedSubdomain({ label, newOwner, space = 2000, rpcUfullName: `${fullName}.sol`,owner: newOwnerKey.toBase58(),parent: `${parentDomain}.sol`,+ url_record: url,};}diff --git a/tests/api/threews-sns-helper.test.js b/tests/api/threews-sns-helper.test.jsnew file mode 100644index 000000000..21ad7d095--- /dev/null+++ b/tests/api/threews-sns-helper.test.js@@ -0,0 +1,122 @@+// api/_lib/threews-sns.js — pure-function tests for the API-side facade over+// the canonical SNS-subdomain helper. We avoid touching Solana or the+// database; everything tested here is local-only.++import { describe, it, expect, beforeAll } from 'vitest';++// Set the parent domain env var before the module is imported so PARENT_LABEL+// derives from a predictable value. Without this, the tests would depend on+// whatever the shell happened to export.+beforeAll(() => {+ process.env.THREEWS_SOL_PARENT_DOMAIN = 'threews.sol';+});++const mod = await import('../../api/_lib/threews-sns.js');++describe('PARENT_LABEL', () => {+ it('derives from THREEWS_SOL_PARENT_DOMAIN without the .sol suffix', () => {+ expect(mod.PARENT_LABEL).toBe('threews');+ });+});++describe('fullDomain()', () => {+ it('appends the parent + .sol suffix', () => {+ expect(mod.fullDomain('nich')).toBe('nich.threews.sol');+ expect(mod.fullDomain('a')).toBe('a.threews.sol');+ });+});++describe('normalizeLabel()', () => {+ it('lowercases and trims valid labels', () => {+ expect(mod.normalizeLabel('Nich')).toBe('nich');+ expect(mod.normalizeLabel(' vernington ')).toBe('vernington');+ });++ it('accepts digits and hyphens in the middle', () => {+ expect(mod.normalizeLabel('agent-007')).toBe('agent-007');+ expect(mod.normalizeLabel('a1b2c3')).toBe('a1b2c3');+ });++ it('strips a .sol suffix if the user pasted the whole name', () => {+ expect(mod.normalizeLabel('nich.sol')).toBe('nich');+ });++ it('rejects empty input', () => {+ expect(mod.normalizeLabel('')).toBeNull();+ expect(mod.normalizeLabel(null)).toBeNull();+ expect(mod.normalizeLabel(undefined)).toBeNull();+ });++ it('rejects labels with disallowed characters', () => {+ expect(mod.normalizeLabel('nich!')).toBeNull();+ expect(mod.normalizeLabel('nich.foo')).toBeNull();+ expect(mod.normalizeLabel('nich foo')).toBeNull();+ expect(mod.normalizeLabel('niçh')).toBeNull();+ });++ it('rejects leading or trailing hyphens', () => {+ expect(mod.normalizeLabel('-nich')).toBeNull();+ expect(mod.normalizeLabel('nich-')).toBeNull();+ expect(mod.normalizeLabel('-')).toBeNull();+ });++ it('rejects labels longer than 63 characters', () => {+ const sixtyThree = 'a'.repeat(63);+ const sixtyFour = 'a'.repeat(64);+ expect(mod.normalizeLabel(sixtyThree)).toBe(sixtyThree);+ expect(mod.normalizeLabel(sixtyFour)).toBeNull();+ });++ it('rejects reserved app-path labels regardless of case', () => {+ // Sampling the denylist — these would otherwise pass the regex but get+ // stopped by the reserved-word set in the API-side facade.+ for (const reserved of ['admin', 'root', 'api', 'www', 'threews', 'claude', 'login']) {+ expect(mod.normalizeLabel(reserved), `denylist should reject ${reserved}`).toBeNull();+ expect(mod.normalizeLabel(reserved.toUpperCase())).toBeNull();+ }+ });++ it('still accepts legitimate labels that merely contain a reserved substring', () => {+ // "admin-tools" contains "admin" but isn't on the denylist, so it passes.+ expect(mod.normalizeLabel('admin-tools')).toBe('admin-tools');+ expect(mod.normalizeLabel('claudette')).toBe('claudette');+ });+});++describe('hasOwnerKey()', () => {+ it('returns false when THREEWS_SOL_PARENT_SECRET_BASE58 is unset', () => {+ const saved = process.env.THREEWS_SOL_PARENT_SECRET_BASE58;+ delete process.env.THREEWS_SOL_PARENT_SECRET_BASE58;+ expect(mod.hasOwnerKey()).toBe(false);+ if (saved !== undefined) process.env.THREEWS_SOL_PARENT_SECRET_BASE58 = saved;+ });++ it('returns true when THREEWS_SOL_PARENT_SECRET_BASE58 is set', () => {+ const saved = process.env.THREEWS_SOL_PARENT_SECRET_BASE58;+ process.env.THREEWS_SOL_PARENT_SECRET_BASE58 = 'placeholder';+ expect(mod.hasOwnerKey()).toBe(true);+ if (saved === undefined) delete process.env.THREEWS_SOL_PARENT_SECRET_BASE58;+ else process.env.THREEWS_SOL_PARENT_SECRET_BASE58 = saved;+ });+});++describe('storefrontUrlForLabel()', () => {+ it('builds an /u/<label> URL on the configured storefront origin', () => {+ const saved = process.env.STOREFRONT_ORIGIN;+ process.env.STOREFRONT_ORIGIN = 'https://three.ws';+ expect(mod.storefrontUrlForLabel('nich')).toBe('https://three.ws/u/nich');+ // Special characters in the label are URL-encoded — defence in depth even+ // though normalizeLabel would already have rejected them.+ expect(mod.storefrontUrlForLabel('a b')).toBe('https://three.ws/u/a%20b');+ if (saved === undefined) delete process.env.STOREFRONT_ORIGIN;+ else process.env.STOREFRONT_ORIGIN = saved;+ });++ it('strips a trailing slash on the configured origin', () => {+ const saved = process.env.STOREFRONT_ORIGIN;+ process.env.STOREFRONT_ORIGIN = 'https://three.ws/';+ expect(mod.storefrontUrlForLabel('nich')).toBe('https://three.ws/u/nich');+ if (saved === undefined) delete process.env.STOREFRONT_ORIGIN;+ else process.env.STOREFRONT_ORIGIN = saved;+ });+});diff --git a/tests/api/threews-subdomain-availability.test.js b/tests/api/threews-subdomain-availability.test.jsnew file mode 100644index 000000000..be398c206--- /dev/null+++ b/tests/api/threews-subdomain-availability.test.js@@ -0,0 +1,131 @@+// /api/threews/subdomain — GET availability check. Exercises the+// validation/denylist paths (no external calls) and the+// "already-claimed-in-our-DB" short-circuit (sql mock only, no Solana RPC).+//+// The "go look on-chain" path is not covered here because it would require+// mocking the Bonfida SDK at the module-graph level. That branch is tested+// indirectly by tests/api/sns.test.js, which covers the Bonfida `resolve()`+// flow on the same parent + subdomain machinery.++import { describe, it, expect, vi, beforeEach, beforeAll } from 'vitest';++const sqlMock = vi.fn();+vi.mock('../../api/_lib/db.js', () => ({ sql: (...a) => sqlMock(...a) }));++vi.mock('../../api/_lib/rate-limit.js', () => ({+ limits: { authIp: vi.fn(async () => ({ success: true })) },+ clientIp: () => '127.0.0.1',+}));++vi.mock('../../api/_lib/env.js', () => ({+ env: { APP_ORIGIN: 'https://three.ws' },+}));++beforeAll(() => {+ process.env.THREEWS_SOL_PARENT_DOMAIN = 'threews.sol';+});++const { default: handler } = await import('../../api/threews/subdomain.js');++function makeReq(url, method = 'GET', body = null) {+ const req = { url, method, headers: { host: 'x' }, query: {} };+ if (body !== null) {+ req.headers['content-type'] = 'application/json';+ const buf = Buffer.from(JSON.stringify(body));+ // Minimal Readable stream that calling readJson() can consume.+ req.on = (ev, fn) => {+ if (ev === 'data') queueMicrotask(() => fn(buf));+ if (ev === 'end') queueMicrotask(fn);+ return req;+ };+ }+ return req;+}+function makeRes() {+ return {+ statusCode: 200,+ _h: {},+ setHeader(k, v) { this._h[k.toLowerCase()] = v; },+ getHeader(k) { return this._h[k.toLowerCase()]; },+ end(body) { this._body = body; },+ };+}+async function call(url, method = 'GET', body = null) {+ const res = makeRes();+ await handler(makeReq(url, method, body), res);+ let parsed = null;+ try { parsed = JSON.parse(res._body); } catch {}+ return { res, body: parsed };+}++beforeEach(() => {+ sqlMock.mockReset();+});++describe('GET /api/threews/subdomain?label=…', () => {+ it('reports a claim from our DB without hitting Solana', async () => {+ sqlMock.mockResolvedValueOnce([{+ label: 'nich',+ parent: 'threews',+ owner_wallet: 'HKKp49zUBeaABFMpBWKCJPoNDLiR4AEEr8FJKuZPn6Nk',+ url_record: 'https://three.ws/u/nich',+ created_at: '2026-05-23T00:00:00.000Z',+ user_id: '00000000-0000-0000-0000-000000000001',+ username: 'nich',+ display_name: 'Nicholas',+ }]);+ const { res, body } = await call('/api/threews/subdomain?label=nich');+ expect(res.statusCode).toBe(200);+ expect(body.data.available).toBe(false);+ expect(body.data.full).toBe('nich.threews.sol');+ expect(body.data.label).toBe('nich');+ expect(body.data.owner).toBe('HKKp49zUBeaABFMpBWKCJPoNDLiR4AEEr8FJKuZPn6Nk');+ expect(body.data.claim).toMatchObject({+ user_id: '00000000-0000-0000-0000-000000000001',+ username: 'nich',+ display_name: 'Nicholas',+ });+ expect(body.data.showcase_url).toBe('https://three.ws/u/nich');+ expect(res.getHeader('cache-control')).toMatch(/max-age=30/);+ // Only one query — the DB row short-circuits the RPC lookup.+ expect(sqlMock).toHaveBeenCalledTimes(1);+ });++ it('rejects malformed labels with 400 before any DB or RPC call', async () => {+ const { res, body } = await call('/api/threews/subdomain?label=!bad');+ expect(res.statusCode).toBe(400);+ expect(body.error).toBe('validation_error');+ expect(sqlMock).not.toHaveBeenCalled();+ });++ it('rejects reserved labels with 400 before any DB or RPC call', async () => {+ for (const reserved of ['admin', 'root', 'www', 'threews']) {+ sqlMock.mockReset();+ const { res, body } = await call(`/api/threews/subdomain?label=${reserved}`);+ expect(res.statusCode, `${reserved} should be rejected`).toBe(400);+ expect(body.error).toBe('validation_error');+ expect(sqlMock).not.toHaveBeenCalled();+ }+ });++ it('strips a .threews.sol suffix the user typed in by mistake', async () => {+ sqlMock.mockResolvedValueOnce([]);+ // Don't mock the on-chain getSubdomainOwner — it'll try a real RPC and+ // throw. We catch the result and assert that whatever returns, the label+ // was normalized down to "nich".+ try {+ const { body } = await call('/api/threews/subdomain?label=nich.threews.sol');+ if (body?.data) expect(body.data.label).toBe('nich');+ } catch {+ // RPC reachout failed in the test sandbox — that's expected and the+ // normalization invariant is the assertion that matters.+ }+ // The sql call (if it happened) used the normalized label.+ if (sqlMock.mock.calls.length > 0) {+ // The sql template's interpolated values include the label as the+ // second positional value — find it among the args.+ const flatArgs = sqlMock.mock.calls.flat(Infinity);+ expect(flatArgs).toContain('nich');+ }+ });+});diff --git a/tests/api/users-by-subdomain.test.js b/tests/api/users-by-subdomain.test.jsnew file mode 100644index 000000000..c3de587ed--- /dev/null+++ b/tests/api/users-by-subdomain.test.js@@ -0,0 +1,105 @@+// /api/users/by-subdomain — reverse-lookup from a `<label>.<parent>.sol` to+// the three.ws user_id that claimed it. Mocks the DB so the test stays+// offline.++import { describe, it, expect, vi, beforeEach, beforeAll } from 'vitest';++const sqlMock = vi.fn();+vi.mock('../../api/_lib/db.js', () => ({ sql: (...a) => sqlMock(...a) }));++vi.mock('../../api/_lib/rate-limit.js', () => ({+ limits: { snsResolve: vi.fn(async () => ({ success: true })) },+ clientIp: () => '127.0.0.1',+}));++beforeAll(() => {+ process.env.THREEWS_SOL_PARENT_DOMAIN = 'threews.sol';+});++const { default: handler } = await import('../../api/users/by-subdomain.js');++function makeReq(url, method = 'GET') {+ return { url, method, headers: { host: 'x' }, query: {} };+}+function makeRes() {+ return {+ statusCode: 200,+ _h: {},+ setHeader(k, v) { this._h[k.toLowerCase()] = v; },+ getHeader(k) { return this._h[k.toLowerCase()]; },+ end(body) { this._body = body; },+ };+}+async function call(url, method) {+ const res = makeRes();+ await handler(makeReq(url, method), res);+ let body = null;+ try { body = JSON.parse(res._body); } catch {}+ return { res, body };+}++beforeEach(() => {+ sqlMock.mockReset();+});++describe('/api/users/by-subdomain', () => {+ it('returns the user + display fields for a claimed subdomain', async () => {+ sqlMock.mockResolvedValueOnce([{+ label: 'nich',+ parent: 'threews',+ owner_wallet: 'HKKp49zUBeaABFMpBWKCJPoNDLiR4AEEr8FJKuZPn6Nk',+ url_record: 'https://three.ws/u/nich',+ created_at: '2026-05-23T00:00:00.000Z',+ user_id: '00000000-0000-0000-0000-000000000001',+ username: 'nich',+ display_name: 'Nicholas',+ }]);+ const { res, body } = await call('/api/users/by-subdomain?label=nich');+ expect(res.statusCode).toBe(200);+ expect(body.data.label).toBe('nich');+ expect(body.data.full).toBe('nich.threews.sol');+ expect(body.data.user).toEqual({+ id: '00000000-0000-0000-0000-000000000001',+ username: 'nich',+ display_name: 'Nicholas',+ });+ expect(body.data.owner_wallet).toBe('HKKp49zUBeaABFMpBWKCJPoNDLiR4AEEr8FJKuZPn6Nk');+ expect(body.data.url_record).toBe('https://three.ws/u/nich');+ // Reverse lookups are cached at the edge — verify the hint is there.+ expect(res.getHeader('cache-control')).toMatch(/max-age=120/);+ });++ it('returns 404 when no claim exists for the label', async () => {+ sqlMock.mockResolvedValueOnce([]);+ const { res, body } = await call('/api/users/by-subdomain?label=ghost');+ expect(res.statusCode).toBe(404);+ expect(body.error).toBe('not_found');+ expect(body.error_description).toMatch(/not claimed/);+ });++ it('rejects missing label', async () => {+ const { res, body } = await call('/api/users/by-subdomain');+ expect(res.statusCode).toBe(400);+ expect(body.error).toBe('validation_error');+ expect(sqlMock).not.toHaveBeenCalled();+ });++ it('rejects reserved (denylisted) labels before hitting the DB', async () => {+ const { res, body } = await call('/api/users/by-subdomain?label=admin');+ expect(res.statusCode).toBe(400);+ expect(body.error).toBe('validation_error');+ expect(sqlMock).not.toHaveBeenCalled();+ });++ it('rejects malformed labels before hitting the DB', async () => {+ const { res, body } = await call('/api/users/by-subdomain?label=!invalid');+ expect(res.statusCode).toBe(400);+ expect(body.error).toBe('validation_error');+ expect(sqlMock).not.toHaveBeenCalled();+ });++ it('rejects non-GET methods', async () => {+ const { res } = await call('/api/users/by-subdomain?label=nich', 'POST');+ expect(res.statusCode).toBe(405);+ });+});diff --git a/tests/api/x402.test.js b/tests/api/x402.test.jsindex a05b539d6..b33807129 100644--- a/tests/api/x402.test.js+++ b/tests/api/x402.test.js@@ -40,9 +40,9 @@ function makeAgent(overrides = {}) {}describe('emit402', () => {- it('returns 402 with a canonical manifest', () => {+ it('returns 402 with a canonical manifest', async () => {const res = makeRes();- emit402(res, {+ await emit402(res, {agent: makeAgent(),skill: 'summarize',amount: '10000',@@ -68,18 +68,18 @@ describe('emit402', () => {expect(body.valid_until).toBeGreaterThan(Date.now() / 1000);});- it('refuses to 402 when payments are not configured', () => {+ it('refuses to 402 when payments are not configured', async () => {const res = makeRes();const agent = { id: 'x', name: 'x', meta: { payments: { configured: false } } };// emit402 should fall through to error() — we just assert it didn't 402.- emit402(res, { agent, skill: 's', amount: '1', currency: 'X' });+ await emit402(res, { agent, skill: 's', amount: '1', currency: 'X' });expect(res.statusCode).not.toBe(402);});- it('honors validForSec', () => {+ it('honors validForSec', async () => {const res = makeRes();const before = Math.floor(Date.now() / 1000);- emit402(res, {+ await emit402(res, {agent: makeAgent(),skill: 's',amount: '1',@@ -93,7 +93,7 @@ describe('emit402', () => {});describe('manifestOnly', () => {- it('returns the same manifest shape with status 200', () => {+ it('returns the same manifest shape with status 200', async () => {// We mock just enough of the http json() helper to get a captured body.const captured = {};const res = {@@ -107,7 +107,7 @@ describe('manifestOnly', () => {captured.status = this.statusCode;},};- manifestOnly(res, {+ await manifestOnly(res, {agent: makeAgent(),skill: 'echo',amount: '5000',