Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat: enhance talking-agent defaults with additional properties and chat functionality
nirholas29e527e40ba0
diff --git a/README.md b/README.mdindex eab10e44a..5a9f15f1c 100644--- a/README.md+++ b/README.md@@ -496,6 +496,7 @@ For deeper technical detail, see the `docs/` directory:| **[Development](docs/DEVELOPMENT.md)** | Local setup, code style, how-things-work guide, common tasks (new GUI controls, components, environments), debugging techniques, browser compatibility, and performance notes || **[Backend Setup](docs/SETUP.md)** | Environment variables, Neon/R2/Upstash provisioning, schema migration, CORS, and deploy || **[Widgets](docs/WIDGETS.md)** | Widget types, URL params, postMessage API, oEmbed, and privacy model |+| **[Pages](docs/PAGES.md)** | Full audit of every user-facing page URL (marketing, app, dashboard, agent, studio, widgets, legal, etc.) || **[MCP](docs/MCP.md)** | Model Context Protocol endpoint (`/api/mcp`) + OAuth integration || **[Contributing](CONTRIBUTING.md)** | Bug reporting, feature requests, PR workflow, commit conventions, code guidelines, and testing checklist |diff --git a/api/_lib/schema.sql b/api/_lib/schema.sqlindex d4cbb9afa..54b6e4545 100644--- a/api/_lib/schema.sql+++ b/api/_lib/schema.sql@@ -620,3 +620,10 @@ create table if not exists password_resets (create index if not exists password_resets_user on password_resets(user_id) where consumed_at is null;create index if not exists password_resets_expiry on password_resets(expires_at);++-- ── user_prefs — per-user UI preferences (dashboard layout, filters, etc.) ──+create table if not exists user_prefs (+ user_id uuid primary key references users(id) on delete cascade,+ prefs jsonb not null default '{}'::jsonb,+ updated_at timestamptz not null default now()+);diff --git a/docs/PAGES.md b/docs/PAGES.mdnew file mode 100644index 000000000..a367e3467--- /dev/null+++ b/docs/PAGES.md@@ -0,0 +1,109 @@+---+title: Page URL Audit+description: Comprehensive list of every user-facing page URL served by three.ws (excludes /api/* endpoints).+---++# Page URL Audit++Comprehensive list of every user-facing page URL in the three.ws codebase. Excludes `/api/*` endpoints. Routing is defined in [vercel.json](vercel.json).++## Marketing & Landing++| URL | Source |+| :-- | :-- |+| `/` | [index.html](index.html) |+| `/home` | [home.html](home.html) |+| `/features`, `/features/` | [public/features/index.html](public/features/index.html) |+| `/discover`, `/discover/` | [public/discover/index.html](public/discover/index.html) |+| `/explore` | 301 redirect → `/discover` |++## App / Core Flow++| URL | Source |+| :-- | :-- |+| `/app` | [app.html](app.html) |+| `/deploy` | [app.html](app.html) (alias) |+| `/create`, `/create/` | [create.html](create.html) |+| `/login` | [login.html](login.html) |+| `/register` | [register.html](register.html) |+| `/profile` | [profile.html](profile.html) |+| `/u/[username]` | [profile.html](profile.html) (dynamic) |+| `/first-meet` | [public/first-meet/index.html](public/first-meet/index.html) |++## Agent Pages (Dynamic)++| URL | Source |+| :-- | :-- |+| `/agent` | [agent-home.html](agent-home.html) |+| `/agent/[id]` | [agent-home.html](agent-home.html) |+| `/agent/[id]/embed` | [agent-embed.html](agent-embed.html) (CSP `frame-ancestors *`) |+| `/agent/[id]/edit` | [agent-edit.html](agent-edit.html) |+| `/a/[chain]/[id]` | API-rendered (OG tags) |+| `/a/[chain]/[id]/embed` | [a-embed.html](a-embed.html) |+| `/a/[chain]/[id]/edit` | [a-edit.html](a-edit.html) |+| `/my-agents`, `/my-agents/` | [public/my-agents/index.html](public/my-agents/index.html) — disallowed in [robots.txt](public/robots.txt) |++## Dashboard++| URL | Source |+| :-- | :-- |+| `/dashboard`, `/dashboard/` | [public/dashboard/index.html](public/dashboard/index.html) |+| `/dashboard/actions` | [public/dashboard/actions.html](public/dashboard/actions.html) |+| `/dashboard/embed-policy` | [public/dashboard/embed-policy.html](public/dashboard/embed-policy.html) |+| `/dashboard/sessions` | [public/dashboard/sessions.html](public/dashboard/sessions.html) |+| `/dashboard/storage` | [public/dashboard/storage.html](public/dashboard/storage.html) |+| `/dashboard/usage` | [public/dashboard/usage.html](public/dashboard/usage.html) |+| `/dashboard/wallets` | [public/dashboard/wallets.html](public/dashboard/wallets.html) |++## Studio / Creation Tools++| URL | Source |+| :-- | :-- |+| `/studio`, `/studio/` | [public/studio/index.html](public/studio/index.html) |+| `/hydrate`, `/hydrate/` | [public/hydrate/index.html](public/hydrate/index.html) |+| `/validation`, `/validation/` | [public/validation/index.html](public/validation/index.html) |++## Widgets / Artifacts++| URL | Source |+| :-- | :-- |+| `/widgets`, `/widgets/` | [public/widgets-gallery/index.html](public/widgets-gallery/index.html) |+| `/w/[id]` | API-rendered (OG + oEmbed) |+| `/artifact`, `/artifact/` | [public/artifact/index.html](public/artifact/index.html) |+| `/artifact/snippet` | [public/artifact/snippet.html](public/artifact/snippet.html) |+| `/artifact-example` | [artifact-example.html](artifact-example.html) |+| `/wallet-connect-demo` | [wallet-connect-demo.html](wallet-connect-demo.html) |++## Admin / Reputation++| URL | Source |+| :-- | :-- |+| `/admin` | [public/admin/index.html](public/admin/index.html) |+| `/reputation` | [public/reputation/index.html](public/reputation/index.html) |++## Integrations / Locales++| URL | Source |+| :-- | :-- |+| `/cz`, `/cz/` | [public/cz/index.html](public/cz/index.html) |+| `/cz/offline` | [public/cz/offline/index.html](public/cz/offline/index.html) |+| `/lobehub/iframe`, `/lobehub/iframe/` | [public/lobehub/iframe/index.html](public/lobehub/iframe/index.html) |++## Legal & Docs++| URL | Source |+| :-- | :-- |+| `/legal/privacy` | [legal/privacy.html](legal/privacy.html) |+| `/legal/tos` | [legal/tos.html](legal/tos.html) |+| `/docs/widgets` | [docs-widgets.html](docs-widgets.html) |++## SEO Files++| URL | Source |+| :-- | :-- |+| `/sitemap.xml` | [public/sitemap.xml](public/sitemap.xml) |+| `/robots.txt` | [public/robots.txt](public/robots.txt) |++---++**Total:** ~50 unique URLs (excluding trailing-slash duplicates and dynamic param expansions).diff --git a/home.html b/home.htmlindex 72811c53f..809ef4959 100644--- a/home.html+++ b/home.html@@ -230,8 +230,8 @@shadow-intensity="0.6"exposure="1.0"environment-image="neutral"- camera-orbit="0deg 75deg 4.5m"- field-of-view="28deg"+ camera-orbit="0deg 78deg 12m"+ field-of-view="16deg"loading="lazy"></model-viewer></div>@@ -573,9 +573,9 @@let mouseX = 0, mouseY = 0;let scrollProgress = 0;+ let dollyOffset = 0; /* additive zoom from click reaction */const BASE_THETA = -45, BASE_PHI = 80, BASE_R = 8.5;let curTheta = BASE_THETA, curPhi = BASE_PHI, curR = BASE_R;- let trickActive = false;window.addEventListener('mousemove', (e) => {mouseX = (e.clientX / innerWidth) * 2 - 1;@@ -596,10 +596,10 @@const cursorPhi = mouseY * 6;const targetTheta = BASE_THETA + scrollTheta + cursorTheta;const targetPhi = BASE_PHI + scrollPhi + cursorPhi;- const targetR = BASE_R + scrollR;+ const targetR = BASE_R + scrollR + dollyOffset;curTheta += (targetTheta - curTheta) * 0.07;curPhi += (targetPhi - curPhi) * 0.07;- curR += (targetR - curR) * 0.06;+ curR += (targetR - curR) * 0.12;mv.setAttribute('camera-orbit',curTheta.toFixed(1) + 'deg ' +curPhi.toFixed(1) + 'deg ' +@@ -611,83 +611,110 @@/* Click → random fun trick (CZ has no extra animations, so we doit with CSS transforms on the wrap: fall over, spin, push-up,jump). State is auto-cleared. */- /* clicks always trigger something fun and energetic — dance or jump.- idle easter eggs can mix in spins / falls / push-ups for variety. */- const CLICK_TRICKS = ['cz-dance', 'cz-jump'];- const IDLE_TRICKS = ['cz-dance', 'cz-jump', 'cz-spin', 'cz-fall', 'cz-pushup'];- function playTrick(name) {- if (trickActive) return;- trickActive = true;- /* apply animation to the model-viewer only, NOT the wrap.- the ring/glow/badge stay static — the avatar appears to- move *within* its frame, not tilt the whole page. */- mv.classList.add(name);- const onEnd = () => {- mv.classList.remove(name);- trickActive = false;- mv.removeEventListener('animationend', onEnd);- };- mv.addEventListener('animationend', onEnd);- }+ /* CZ has only one baked animation in his GLB (Idle), so faking+ skeletal motion with CSS transforms looks plastic. Instead,+ clicking does a real camera dolly-zoom — actual rendering+ on the real animated model = looks natural, like /app. */+ let dollyActive = false;mv.style.cursor = 'pointer';mv.addEventListener('click', () => {- playTrick(CLICK_TRICKS[Math.floor(Math.random() * CLICK_TRICKS.length)]);+ if (dollyActive) return;+ dollyActive = true;+ const t0 = performance.now();+ const dur = 700;+ function step(now) {+ const t = Math.min((now - t0) / dur, 1);+ const wave = Math.sin(t * Math.PI); /* 0 → 1 → 0 */+ dollyOffset = -3.2 * wave; /* zoom in 3.2m closer at peak */+ if (t < 1) requestAnimationFrame(step);+ else { dollyOffset = 0; dollyActive = false; }+ }+ requestAnimationFrame(step);});-- /* Idle easter egg: every 18-32s, CZ does something fun on his own */- function scheduleIdleTrick() {- const delay = 18000 + Math.random() * 14000;- setTimeout(() => {- if (!trickActive && document.visibilityState === 'visible') {- playTrick(IDLE_TRICKS[Math.floor(Math.random() * IDLE_TRICKS.length)]);- }- scheduleIdleTrick();- }, delay);- }- scheduleIdleTrick();})();- // Avatar picker + animation chips (Act 2)+ // Avatar picker + dynamic animation chips (Act 2) — same UX as /app(function () {const mv = document.getElementById('home-act2-mv');const opts = document.querySelectorAll('.h-av-opt');- const chips = document.querySelectorAll('.h-anim-chip');- if (!mv) return;+ const chipsWrap = document.querySelector('[data-role="anim-chips"]');+ if (!mv || !chipsWrap) return;++ const ANIM_EMOJI = {+ Dance: '💃', Wave: '👋', Jump: '⬆', ThumbsUp: '👍',+ Punch: '🥊', No: '🙅', Yes: '🙆', Idle: '😐',+ Walk: '🚶', Walking: '🚶', Run: '🏃', Running: '🏃',+ TPose: '🧍', Sitting: '💺', Standing: '🧍',+ WalkJump: '🤸', Death: '💀',+ };++ function prettyLabel(name) {+ /* Strip stuff like "V4.2(maya_head)" or anything in parens */+ let clean = name.replace(/\s*\([^)]*\)/g, '')+ .replace(/V\d+(\.\d+)?$/, '')+ .replace(/_/g, ' ')+ .trim();+ if (!clean) clean = name;+ const key = clean.replace(/\s+/g, '');+ const emoji = ANIM_EMOJI[key] || '✨';+ return emoji + ' ' + clean;+ }- function syncChips() {+ /* Generate one chip per available animation in the loaded model */+ function rebuildChips() {const avail = mv.availableAnimations || [];- chips.forEach(c => {- c.hidden = avail.length > 0 && !avail.includes(c.dataset.anim);- });+ chipsWrap.innerHTML = '';+ if (!avail.length) return;+ for (const animName of avail) {+ const btn = document.createElement('button');+ btn.type = 'button';+ btn.className = 'h-anim-chip';+ btn.dataset.anim = animName;+ btn.textContent = prettyLabel(animName);+ btn.addEventListener('click', () => {+ chipsWrap.querySelectorAll('.h-anim-chip').forEach(c => delete c.dataset.active);+ btn.dataset.active = 'true';+ mv.animationName = animName;+ mv.play();+ });+ chipsWrap.appendChild(btn);+ }+ /* mark first chip active to mirror the auto-played animation */+ const first = chipsWrap.querySelector('.h-anim-chip');+ if (first) first.dataset.active = 'true';}- // Avatar switch+ /* Avatar switch — load model, rebuild chips for whatever animations it has */opts.forEach(btn => {btn.addEventListener('click', () => {opts.forEach(b => b.setAttribute('aria-pressed', 'false'));btn.setAttribute('aria-pressed', 'true');- chips.forEach(c => delete c.dataset.active);- mv.src = btn.dataset.src;mv.addEventListener('load', () => {- syncChips();- mv.animationName = mv.availableAnimations?.[0] || '';- mv.play();+ rebuildChips();+ const first = (mv.availableAnimations || [])[0];+ if (first) {+ mv.animationName = first;+ mv.play();+ }}, { once: true });+ mv.src = btn.dataset.src;});});- // Animation chips- chips.forEach(chip => {- chip.addEventListener('click', () => {- chips.forEach(c => delete c.dataset.active);- chip.dataset.active = 'true';- mv.animationName = chip.dataset.anim;- mv.play();- });+ /* Click-to-zoom toggle — default is wide so the full body is visible,+ click zooms in closer for a portrait shot, click again to reset. */+ const ORBIT_DEFAULT = '0deg 78deg 12m';+ const ORBIT_ZOOMED = '0deg 78deg 6m';+ let zoomed = false;+ mv.addEventListener('click', (e) => {+ /* don't fire when interacting with the chip area */+ if (e.target.closest('.h-anim-chip, .h-av-opt')) return;+ zoomed = !zoomed;+ mv.cameraOrbit = zoomed ? ORBIT_ZOOMED : ORBIT_DEFAULT;});- // Initial sync once model loads- mv.addEventListener('load', syncChips, { once: true });+ /* Initial chip build once model loads */+ mv.addEventListener('load', rebuildChips, { once: true });})();// Chain ribbon (Act 3)diff --git a/public/agent-edit/edit.js b/public/agent-edit/edit.jsindex 79cfbf0cd..07f660a00 100644--- a/public/agent-edit/edit.js+++ b/public/agent-edit/edit.js@@ -70,7 +70,8 @@ async function main() {renderForm(agent.meta?.persona || DEFAULT_PERSONA);initVoicePicker();bindEvents();- document.getElementById('save-btn').disabled = false;+ // Save button stays disabled until the user edits a field; input listeners+ // re-enable it via markDirty().}function showForbidden() {@@ -127,6 +128,7 @@ function renderTemplates() {function applyTemplate(tpl) {renderForm({ ...DEFAULT_PERSONA, ...tpl.persona });+ markDirty();toast('Template applied — review and save.');}@@ -275,6 +277,7 @@ function setVoiceProvider(p) {.querySelectorAll('.vp-toggle-btn').forEach((b) => b.classList.toggle('active', b.dataset.vp === p));renderVoiceSection();+ scheduleSave();}function renderVoiceSection() {@@ -419,6 +422,7 @@ function selectVoiceItem(el, vid) {.forEach((i) => i.classList.remove('selected'));el.classList.add('selected');_voiceId = vid;+ scheduleSave();}function previewWebVoice(name, btn) {@@ -488,18 +492,53 @@ function readForm() {// ── Save ───────────────────────────────────────────────────────────────────+function setSaveStatus(state) {+ const el = document.getElementById('save-status');+ if (!el) return;+ el.classList.remove('saving', 'saved');+ if (state === 'saving') {+ el.classList.add('saving');+ el.textContent = 'Saving…';+ } else if (state === 'saved') {+ el.classList.add('saved');+ el.textContent = 'Saved';+ clearTimeout(setSaveStatus._t);+ setSaveStatus._t = setTimeout(() => {+ if (el.classList.contains('saved')) el.textContent = '';+ }, 2000);+ } else {+ el.textContent = '';+ }+}++function markDirty() {+ const btn = document.getElementById('save-btn');+ if (btn) btn.disabled = false;+ setSaveStatus('');+}+function scheduleSave() {- // Not auto-saving — just here for future use if needed.+ markDirty();+ clearTimeout(_saveDebounce);+ _saveDebounce = setTimeout(() => {+ save({ auto: true });+ }, 2000);}-async function save() {+async function save({ auto = false } = {}) {+ clearTimeout(_saveDebounce);const btn = document.getElementById('save-btn');btn.disabled = true;+ const prevLabel = btn.textContent;btn.textContent = 'Saving…';+ setSaveStatus('saving');try {const persona = readForm();if (!persona.name) {- toast('Name is required.', true);+ if (!auto) toast('Name is required.', true);+ setSaveStatus('');+ btn.disabled = false;+ btn.textContent = prevLabel;return;}@@ -524,11 +563,21 @@ async function save() {// Update local agent reference so subsequent saves carry forward the new meta.agent = { ...agent, name: persona.name, description: persona.bio, meta: newMeta };- toast('Saved!');- reloadPreview();+ setSaveStatus('saved');+ btn.textContent = 'Save';+ btn.disabled = true; // clean — re-enabled by next edit+ if (!auto) {+ toast('Saved!');+ reloadPreview();+ }} catch (err) {- toast(err.message || 'Save failed.', true);- } finally {+ if (auto) {+ console.warn('Autosave failed:', err);+ setSaveStatus('');+ } else {+ toast(err.message || 'Save failed.', true);+ setSaveStatus('');+ }btn.disabled = false;btn.textContent = 'Save';}@@ -537,16 +586,20 @@ async function save() {// ── Events ─────────────────────────────────────────────────────────────────function bindEvents() {- document.getElementById('save-btn').addEventListener('click', save);+ document.getElementById('save-btn').addEventListener('click', () => save({ auto: false }));- // Char counts+ // Char counts + dirty tracking + autosave['f-name', 'f-bio', 'f-system-prompt'].forEach((id) => {- document.getElementById(id)?.addEventListener('input', updateCharCounts);+ const el = document.getElementById(id);+ if (!el) return;+ el.addEventListener('input', updateCharCounts);+ el.addEventListener('input', scheduleSave);});// Sentiment bias labeldocument.getElementById('f-sentiment-bias').addEventListener('input', (e) => {document.getElementById('bias-value').textContent = Number(e.target.value).toFixed(2);+ scheduleSave();});// Add catchphrase@@ -563,11 +616,13 @@ function bindEvents() {if (word && !_doNotSay.includes(word)) {_doNotSay.push(word);rebuildChipDom();+ scheduleSave();}e.target.value = '';} else if (e.key === 'Backspace' && !e.target.value && _doNotSay.length) {_doNotSay.pop();rebuildChipDom();+ scheduleSave();}});@@ -577,6 +632,7 @@ function bindEvents() {if (existing?.systemPrompt) {document.getElementById('f-system-prompt').value = existing.systemPrompt;updateCharCounts();+ markDirty();toast('Reset to last saved prompt.');} else {toast('No saved prompt to reset to.', false);diff --git a/public/agent-edit/index.html b/public/agent-edit/index.htmlindex 3710b3d37..a278dada2 100644--- a/public/agent-edit/index.html+++ b/public/agent-edit/index.html@@ -337,6 +337,20 @@background: #252534;}+ .save-status {+ font-size: 12px;+ color: #888;+ min-width: 64px;+ text-align: right;+ transition: opacity 0.2s;+ }+ .save-status.saving {+ color: #aaa;+ }+ .save-status.saved {+ color: #4ade80;+ }+.toast {position: fixed;bottom: 24px;@@ -536,6 +550,7 @@<a id="view-link" href="#" class="btn sec" style="text-decoration: none">View page →</a>+ <span id="save-status" class="save-status" aria-live="polite"></span><button id="save-btn" class="btn" disabled>Save</button></div></header>diff --git a/public/dashboard/dashboard.js b/public/dashboard/dashboard.jsindex 91af6a5a3..02760879e 100644--- a/public/dashboard/dashboard.js+++ b/public/dashboard/dashboard.js@@ -1714,9 +1714,45 @@ function saveWidgetPrefs(prefs) {try {localStorage.setItem(WIDGET_PREFS_KEY, JSON.stringify(prefs));} catch {}+ scheduleRemotePrefsSync(prefs);+}++// ── Remote prefs sync (best-effort backup) ─────────────────────────────────+let _remotePrefsTimer = null;+function scheduleRemotePrefsSync(prefs) {+ clearTimeout(_remotePrefsTimer);+ _remotePrefsTimer = setTimeout(() => {+ fetch('/api/dashboard/prefs', {+ method: 'POST',+ credentials: 'include',+ headers: { 'content-type': 'application/json' },+ body: JSON.stringify({ prefs: { widgets: prefs } }),+ }).catch(() => {});+ }, 500);+}++let _remotePrefsHydrated = false;+async function hydrateWidgetPrefsFromRemote() {+ if (_remotePrefsHydrated) return;+ _remotePrefsHydrated = true;+ try {+ const res = await fetch('/api/dashboard/prefs', { credentials: 'include' });+ if (!res.ok) return;+ const data = await res.json();+ const remote = data?.prefs?.widgets;+ if (remote && typeof remote === 'object') {+ localStorage.setItem(+ WIDGET_PREFS_KEY,+ JSON.stringify({ ...DEFAULT_WIDGET_PREFS, ...remote }),+ );+ }+ } catch {+ // Network/auth failure → fall back to localStorage silently.+ }}async function renderWidgets(root) {+ await hydrateWidgetPrefsFromRemote();const prefs = loadWidgetPrefs();root.innerHTML = `<div class="widgets-header">diff --git a/public/studio/studio.js b/public/studio/studio.jsindex a9afedc6c..0d601b440 100644--- a/public/studio/studio.js+++ b/public/studio/studio.js@@ -51,7 +51,24 @@ const BRAND_DEFAULTS = Object.freeze({const TYPE_DEFAULTS = {turntable: { rotationSpeed: 0.5 },'animation-gallery': { defaultClip: '', loopAll: false, showClipPicker: true },- 'talking-agent': { greeting: 'Hi! What would you like to know?', brain: 'none', proxyURL: '' },+ 'talking-agent': {+ agentName: '',+ agentTitle: 'AI Agent',+ avatar: 'embedded',+ brainProvider: 'anthropic',+ proxyURL: '',+ systemPrompt: '',+ greeting: 'Hi! Ask me anything.',+ temperature: 0.7,+ maxTurns: 20,+ skills: { speak: true, wave: true, lookAt: true, playClip: true, remember: false },+ showChatHistory: true,+ voiceInput: true,+ voiceOutput: true,+ chatPosition: 'right',+ poweredByBadge: true,+ visitorRateLimit: { msgsPerMinute: 8, msgsPerSession: 50 },+ },passport: {chain: 'base-sepolia',agentId: null,diff --git a/vercel.json b/vercel.jsonindex 0b936427e..a6d7aa53b 100644--- a/vercel.json+++ b/vercel.json@@ -45,6 +45,7 @@{ "src": "/studio/", "dest": "/studio/index.html" },{ "src": "/studio/(.*)", "dest": "/studio/$1" },+ { "src": "/api/dashboard/prefs", "dest": "/api/dashboard/prefs" },{ "src": "/api/agents/me", "dest": "/api/agents" },{ "src": "/api/agents/suggest", "dest": "/api/agents/suggest" },{ "src": "/api/agents/by-wallet", "dest": "/api/agents/by-wallet" },