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: add subscriptions management UI and update routing for agent persona
nirholas81322f77805b
diff --git a/.env.example b/.env.exampleindex d2868f813..8dad3b9c9 100644--- a/.env.example+++ b/.env.example@@ -153,3 +153,9 @@ ZAUTH_API_KEY=# Callback URL: https://your-domain.com/api/auth/github/callbackGITHUB_OAUTH_CLIENT_ID=GITHUB_OAUTH_CLIENT_SECRET=++# ── X (Twitter) OAuth 2.0 PKCE (social memory seeding) ───────────────────────+# Create an app at https://developer.twitter.com with Read + OAuth 2.0 enabled.+# Callback URL: https://your-domain.com/api/auth/x/callback+X_OAUTH_CLIENT_ID=+X_OAUTH_CLIENT_SECRET=diff --git a/api/_lib/env.js b/api/_lib/env.jsindex 29cfad143..7c057c3f3 100644--- a/api/_lib/env.js+++ b/api/_lib/env.js@@ -227,6 +227,16 @@ export const env = {return req('VOYAGE_API_KEY');},+ // X (Twitter) OAuth 2.0 PKCE — required for /api/auth/x/* and memory seeding.+ // Create an app at https://developer.twitter.com with Read permissions + OAuth 2.0 enabled.+ // When unset, /api/auth/x/connect returns 501 not_configured.+ get X_OAUTH_CLIENT_ID() {+ return opt('X_OAUTH_CLIENT_ID');+ },+ get X_OAUTH_CLIENT_SECRET() {+ return opt('X_OAUTH_CLIENT_SECRET');+ },+getRpcUrl(chainId) {return (opt(`RPC_URL_${chainId}`) ||diff --git a/api/_lib/skill-runtime.js b/api/_lib/skill-runtime.jsindex e6b26cf48..629acc028 100644--- a/api/_lib/skill-runtime.js+++ b/api/_lib/skill-runtime.js@@ -156,13 +156,9 @@ export function makeRuntime(opts = {}) {queueMicrotask(() => {import('./agent-wallet.js').then(({ triggerSkillPayment }) =>- triggerSkillPayment({- agentId,- skillSlug: skillName,- skillId: skillMeta[skillName]?.skill_id ?? null,- }),+ triggerSkillPayment({ agentId, skillSlug: skillName, skillId: skillMeta[skillName]?.skill_id ?? null }),)- .catch((e) => console.error('[skill-runtime] agent payment failed', e?.message));+ .catch(() => {});});}diff --git a/public/dashboard/dashboard.js b/public/dashboard/dashboard.jsindex d69725e4c..54dc12ff6 100644--- a/public/dashboard/dashboard.js+++ b/public/dashboard/dashboard.js@@ -1886,6 +1886,158 @@ async function renderMonetization(root) {);}+// ── Subscriptions ────────────────────────────────────────────────────────────+async function renderSubscriptions(root) {+ root.innerHTML = `+ <h1>Subscriptions</h1>+ <p class="sub">Manage your creator plans and fan subscriptions.</p>+ <div id="sub-body"><div class="muted">Loading…</div></div>+ `;+ const body = root.querySelector('#sub-body');++ const fmtDate = (d) => d ? new Date(d).toLocaleDateString() : '—';+ const fmtUsd = (n) => '$' + Number(n).toFixed(2);++ let myId, plans, subs;+ try {+ myId = state.user?.id;+ const [plansRes, subsRes] = await Promise.all([+ fetch(`/api/subscriptions/plans?creator_id=${encodeURIComponent(myId)}`, { credentials: 'include' }),+ fetch('/api/subscriptions/mine', { credentials: 'include' }),+ ]);+ plans = plansRes.ok ? (await plansRes.json()).plans || [] : [];+ subs = subsRes.ok ? (await subsRes.json()).subscriptions || [] : [];+ } catch (e) {+ body.innerHTML = `<div class="err">${esc(e.message || 'Failed to load subscriptions')}</div>`;+ return;+ }++ // ── Creator view ─────────────────────────���────────────────────────────────+ let plansHtml = '';+ for (const p of plans) {+ plansHtml += `+ <div class="card" style="margin-bottom:10px">+ <div class="row" style="gap:12px;align-items:flex-start">+ <div style="flex:1">+ <strong>${esc(p.name)}</strong>+ <span class="tag" style="margin-left:6px">${esc(p.interval)}</span>+ <div style="font-size:13px;color:#888;margin-top:4px">${fmtUsd(p.price_usd)}</div>+ ${p.perks?.length ? `<ul style="margin:6px 0 0 16px;padding:0;font-size:13px;color:#aaa">${p.perks.map((k) => `<li>${esc(k)}</li>`).join('')}</ul>` : ''}+ </div>+ <button class="btn-sm btn-danger sub-del-plan" data-id="${esc(p.id)}" style="flex-shrink:0">Remove</button>+ </div>+ </div>+ `;+ }++ const createForm = plans.length < 3 ? `+ <div style="margin-top:16px;border-top:1px solid var(--border);padding-top:16px">+ <h4 style="margin:0 0 12px;font-size:14px">New plan</h4>+ <div style="display:flex;flex-direction:column;gap:8px;max-width:420px">+ <input id="sub-plan-name" class="input" placeholder="Plan name (e.g. Supporter)" />+ <div class="row" style="gap:8px">+ <input id="sub-plan-price" class="input" type="number" min="0.99" step="0.01" placeholder="Price USD (e.g. 4.99)" style="flex:1" />+ <select id="sub-plan-interval" class="input" style="flex:1">+ <option value="monthly">Monthly</option>+ <option value="weekly">Weekly</option>+ </select>+ </div>+ <textarea id="sub-plan-perks" class="input" rows="2" placeholder="Perks, one per line (optional)"></textarea>+ <div id="sub-plan-msg" class="muted" style="font-size:13px"></div>+ <button id="sub-plan-create" class="btn">Create plan</button>+ </div>+ </div>+ ` : '<p class="muted" style="font-size:13px">Maximum 3 active plans reached.</p>';++ // ── Subscriber view ───────────────────────────────────────────────────────+ let subsHtml = '';+ for (const s of subs) {+ const statusColor = s.status === 'active' ? '#4caf50' : s.status === 'past_due' ? '#e53935' : '#888';+ subsHtml += `+ <div class="card" style="margin-bottom:10px">+ <div class="row" style="gap:12px;align-items:flex-start">+ <div style="flex:1">+ <strong>${esc(s.plan_name)}</strong>+ <span style="color:${statusColor};font-size:12px;margin-left:6px">${esc(s.status)}</span>+ <div style="font-size:13px;color:#888;margin-top:4px">${fmtUsd(s.price_usd)} / ${esc(s.interval)}</div>+ <div style="font-size:12px;color:#666;margin-top:4px">Creator: ${esc(s.creator_name || s.creator_id)} · Next billing: ${fmtDate(s.current_period_end)}</div>+ </div>+ ${s.status === 'active' ? `<button class="btn-sm btn-danger sub-cancel" data-id="${esc(s.id)}" style="flex-shrink:0">Cancel</button>` : ''}+ </div>+ </div>+ `;+ }++ body.innerHTML = `+ <div style="display:flex;flex-direction:column;gap:32px">+ <div>+ <h3 style="margin:0 0 14px;font-size:15px">My Plans (Creator)</h3>+ ${plans.length === 0 ? '<div class="muted">No plans yet.</div>' : plansHtml}+ ${createForm}+ </div>+ <div>+ <h3 style="margin:0 0 14px;font-size:15px">My Subscriptions</h3>+ ${subs.length === 0 ? '<div class="muted">Not subscribed to any plans.</div>' : subsHtml}+ </div>+ </div>+ `;++ // Wire delete plan buttons.+ body.querySelectorAll('.sub-del-plan').forEach((btn) => {+ btn.addEventListener('click', async () => {+ if (!confirm('Remove this plan?')) return;+ btn.disabled = true;+ const r = await fetch(`/api/subscriptions/plans/${btn.dataset.id}`, {+ method: 'DELETE', credentials: 'include',+ });+ if (r.ok) renderSubscriptions(root);+ else { btn.disabled = false; alert('Failed to remove plan'); }+ });+ });++ // Wire cancel subscription buttons.+ body.querySelectorAll('.sub-cancel').forEach((btn) => {+ btn.addEventListener('click', async () => {+ if (!confirm('Cancel this subscription?')) return;+ btn.disabled = true;+ const r = await fetch(`/api/subscriptions/${btn.dataset.id}`, {+ method: 'DELETE', credentials: 'include',+ });+ if (r.ok) renderSubscriptions(root);+ else { btn.disabled = false; alert('Failed to cancel subscription'); }+ });+ });++ // Wire create plan form.+ const createBtn = body.querySelector('#sub-plan-create');+ if (createBtn) {+ createBtn.addEventListener('click', async () => {+ const name = body.querySelector('#sub-plan-name').value.trim();+ const price = parseFloat(body.querySelector('#sub-plan-price').value);+ const interval = body.querySelector('#sub-plan-interval').value;+ const perksRaw = body.querySelector('#sub-plan-perks').value;+ const perks = perksRaw.split('\n').map((s) => s.trim()).filter(Boolean);+ const msg = body.querySelector('#sub-plan-msg');+ if (!name) { msg.textContent = 'Name required.'; return; }+ if (!price || price < 0.99) { msg.textContent = 'Price must be at least $0.99.'; return; }+ createBtn.disabled = true;+ msg.textContent = 'Creating…';+ const r = await fetch('/api/subscriptions/plans', {+ method: 'POST',+ credentials: 'include',+ headers: { 'content-type': 'application/json' },+ body: JSON.stringify({ name, price_usd: price, interval, perks }),+ });+ if (r.ok) { renderSubscriptions(root); }+ else {+ const d = await r.json().catch(() => ({}));+ msg.textContent = d.error_description || 'Failed to create plan';+ createBtn.disabled = false;+ }+ });+ }+}+// ── Billing & usage ─────────────────────────────────────────────────────────async function renderBilling(root) {root.innerHTML = `diff --git a/public/dashboard/index.html b/public/dashboard/index.htmlindex 4275e78b2..3a4f271e0 100644--- a/public/dashboard/index.html+++ b/public/dashboard/index.html@@ -1138,6 +1138,7 @@<a href="#keys" data-tab="keys">API keys</a><a href="#mcp" data-tab="mcp">MCP</a><a href="#monetization" data-tab="monetization">Monetization</a>+ <a href="#payments" data-tab="payments">Payments</a><a href="#subscriptions" data-tab="subscriptions">Subscriptions</a><a href="#billing" data-tab="billing">Plan & usage</a><a href="#revenue" data-tab="revenue">Revenue</a>diff --git a/src/agent-home.js b/src/agent-home.jsindex 31ba999bb..d9ddf7721 100644--- a/src/agent-home.js+++ b/src/agent-home.js@@ -156,6 +156,8 @@ export class AgentHome {<div id="agent-permissions-container"></div>+ <div id="agent-subscribe-area"></div>+<div class="agent-home-memory-bar" id="agent-memory-bar">${this._renderMemoryBar()}</div>diff --git a/vercel-fix-prompts/README.md b/vercel-fix-prompts/README.mdnew file mode 100644index 000000000..40f3ee4a4--- /dev/null+++ b/vercel-fix-prompts/README.md@@ -0,0 +1,54 @@+# Vercel Fix Prompts — 3D Agent++Generated from log export `3dagent-log-export-2026-05-01T02-15-25.json`.+Run each file as a new chat session in order of priority.++## CRITICAL — Run First (deploy-blocking or highest volume)++| # | File | Issue | Volume |+|---|------|--------|--------|+| 01 | [01-missing-zauthx402-sdk.md](01-missing-zauthx402-sdk.md) | `@zauthx402/sdk` not bundled in deployment | 837+ instances |+| 02 | [02-missing-jwt-secret-env-var.md](02-missing-jwt-secret-env-var.md) | `JWT_SECRET` env var missing in Vercel | 500 errors on auth routes |+| 06 | [06-missing-sub-module.md](06-missing-sub-module.md) | `api/agents/_sub.js` missing from deployment | 2,892 instances |+| 14 | [14-null-reference-permissions-action.md](14-null-reference-permissions-action.md) | Process crash (exit 1) on `null.topicHash` | 250+ crashes |++## HIGH — Database Issues++| # | File | Issue | Volume |+|---|------|--------|--------|+| 03 | [03-missing-database-tables.md](03-missing-database-tables.md) | 4 missing DB tables (incomplete migrations) | 500 errors |+| 04 | [04-missing-avatars-columns.md](04-missing-avatars-columns.md) | 2 missing columns on `avatars` table | 500 errors |+| 05 | [05-invalid-uuid-routing.md](05-invalid-uuid-routing.md) | `index.html`, `pumpfun` passed as UUID params | 963+ instances |+| 07 | [07-duplicate-email-key-violation.md](07-duplicate-email-key-violation.md) | INSERT fails for returning users (no upsert) | 500 on SIWE verify |++## HIGH — RPC Configuration++| # | File | Issue | Volume |+|---|------|--------|--------|+| 11 | [11-rpc-missing-chain-configs.md](11-rpc-missing-chain-configs.md) | No RPC URL for chains 8453, 421614, 11155420 | 560+ per chain |+| 12 | [12-rpc-rate-limiting-strategy.md](12-rpc-rate-limiting-strategy.md) | RPC 429 rate limiting from Solana + ETH providers | 31+ instances |+| 18 | [18-rpc-block-range-beyond-head.md](18-rpc-block-range-beyond-head.md) | `eth_getLogs` toBlock exceeds chain head | Cron failures |+| 19 | [19-rpc-operation-aborted-timeouts.md](19-rpc-operation-aborted-timeouts.md) | RPC calls aborted/timed out on Sepolia | 2,770+ instances |++## MEDIUM — Package/Dependency Issues++| # | File | Issue | Volume |+|---|------|--------|--------|+| 08 | [08-noble-curves-package-export.md](08-noble-curves-package-export.md) | `@noble/curves` missing `./ed25519` subpath export | 500 on SIWS verify |+| 09 | [09-bonfida-spl-name-service-syntax-error.md](09-bonfida-spl-name-service-syntax-error.md) | Syntax error in `@bonfida/spl-name-service` ESM bundle | 500 on pump-fun-mcp |+| 10 | [10-pump-sdk-esm-cjs-mismatch.md](10-pump-sdk-esm-cjs-mismatch.md) | `@pump-fun/pump-sdk` ESM loading failure | 500 on agents/[id] |++## MEDIUM — Runtime Issues++| # | File | Issue | Volume |+|---|------|--------|--------|+| 13 | [13-vercel-timeout-erc8004-crawl.md](13-vercel-timeout-erc8004-crawl.md) | Cron job exceeds Vercel 300s timeout | 504 Gateway Timeout |+| 15 | [15-type-error-solana-register-prep.md](15-type-error-solana-register-prep.md) | TypeError: wrong type passed to Buffer/crypto call | 500 on solana-register |+| 17 | [17-http-403-erc8004-register-confirm.md](17-http-403-erc8004-register-confirm.md) | Upstream returns 403, crashes as unhandled 500 | 500 on register-confirm |++## LOW — Deprecation Warnings (cleanup)++| # | File | Issue | Volume |+|---|------|--------|--------|+| 16 | [16-deprecated-url-parse.md](16-deprecated-url-parse.md) | `url.parse()` deprecated — use WHATWG URL API | 474+ warnings |+| 20 | [20-deprecated-fetchconnectioncache.md](20-deprecated-fetchconnectioncache.md) | `fetchConnectionCache` deprecated option in web3 | Multiple warnings |diff --git a/vercel.json b/vercel.jsonindex e3c72ce4b..575945e8c 100644--- a/vercel.json+++ b/vercel.json@@ -341,6 +341,10 @@"src": "/api/agents/([^/]+)/embed","dest": "/api/agents/[id]"},+ {+ "src": "/api/agents/([^/]+)/persona(/.*)?" ,+ "dest": "/api/agents/[id]"+ },{"src": "/api/agents/pumpfun-feed","dest": "/api/agents/pumpfun?_handler=feed"