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 fallback confirmation for risk acknowledgment and enhance dialog handling
nrpoc16c9f477863
diff --git a/.gitignore b/.gitignoreindex 9f5fee220..7468898fa 100644--- a/.gitignore+++ b/.gitignore@@ -82,6 +82,10 @@ scripts/pump-usdc-race.mjs# Wallet / private-key material — NEVER commit*.privkey.txt*.b58.txt+*keypair*.json+solana-wallets-backup.zip+*wallets-backup*.zip+*wallet-backup*.zip*-pump-wallet.json.fresh-pump-wallet.json.coin-keypair-*.jsondiff --git a/docs/internal/MAINNET-TEST-2026-07-03.md b/docs/internal/MAINNET-TEST-2026-07-03.mdnew file mode 100644index 000000000..0ba2a563c--- /dev/null+++ b/docs/internal/MAINNET-TEST-2026-07-03.md@@ -0,0 +1,24 @@+# Mainnet end-to-end test — 2026-07-03++Real-SOL verification of every money-touching surface, run against production three.ws with a throwaway burner wallet. Audience: engineers. Every claim below carries a transaction signature or an HTTP transcript reference.++## Parameters++| | |+| --- | --- |+| Burner wallet | `FGwp62JfNaX2oqQctKZkmY7PM3ey21HgtsRda6A1B3rg` (secret at `~/.threews-test-keypair.json`, mode 600, off-repo) |+| Funded | 0.759860663 SOL — sig [`39JT2pCBRCVK5E11jkzDd66auF71bPxtkgJb63NTLCa6hXsSWnyJjcEYaxLKPnKwANpVcikPFf8Trqcrik2Lfkup`](https://solscan.io/tx/39JT2pCBRCVK5E11jkzDd66auF71bPxtkgJb63NTLCa6hXsSWnyJjcEYaxLKPnKwANpVcikPFf8Trqcrik2Lfkup) at 2026-07-03T23:24:32Z |+| Sweep-back address | `wwwqvAbN4RjaRvfGsorxMuauq7SWVcV13Aa7GaqHGUn` (owner-provided) |+| Rails | No mainnet sniper strategies armed (prod auto-funder foot-gun). Master/treasury untouched. Spend caps + withdraw allowlist on every custodial wallet at creation. Full sweep-back at end. |++## Ledger++Running log, newest last. ✅ pass · ❌ fail · ⚠ degraded/blocked (with reason).++| # | Time (UTC) | Surface | Action | Result | Proof |+| --- | --- | --- | --- | --- | --- |+| 0 | 23:24 | funding | 0.759860663 SOL received | ✅ | `39JT2pCB…Lfkup` |++## Findings++(Populated as tiers complete.)diff --git a/maintenance/index.html b/maintenance/index.htmlnew file mode 100644index 000000000..1b1c0a005--- /dev/null+++ b/maintenance/index.html@@ -0,0 +1,121 @@+<!DOCTYPE html>+<html lang="en">+<head>+<meta charset="utf-8" />+<meta name="viewport" content="width=device-width, initial-scale=1" />+<title>three.ws — back in a moment</title>+<meta name="description" content="three.ws is deploying an update. Make a 3D AI agent from a selfie in 60 seconds — back online shortly." />+<meta name="robots" content="noindex" />+<meta property="og:title" content="three.ws — back in a moment" />+<meta property="og:description" content="We're shipping an update. Back online shortly." />+<meta name="theme-color" content="#0a0a0a" />+<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%230a0a0a'/%3E%3Ctext x='16' y='22' font-family='monospace' font-size='16' font-weight='700' fill='%238b5cf6' text-anchor='middle'%3E3%3C/text%3E%3C/svg%3E" />+<style>+ :root{+ --bg:#0a0a0a; --bg-1:#101012; --ink:#f4f4f5; --ink-2:#a1a1aa; --ink-3:#71717a;+ --line:rgba(255,255,255,.08); --violet:#8b5cf6; --blue:#4fc3ff; --amber:#ffb454;+ --font-body:'Inter',system-ui,-apple-system,sans-serif;+ --font-mono:'JetBrains Mono','SF Mono',ui-monospace,monospace;+ }+ *{box-sizing:border-box}+ html,body{margin:0;padding:0;height:100%}+ body{+ background:var(--bg); color:var(--ink); font-family:var(--font-body);+ -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;+ min-height:100dvh; display:grid; place-items:center; padding:24px;+ overflow:hidden; position:relative;+ }+ /* ambient aurora */+ .aura{position:fixed;inset:0;z-index:0;pointer-events:none;filter:blur(60px);opacity:.55}+ .aura::before,.aura::after{content:"";position:absolute;border-radius:50%}+ .aura::before{width:46vmax;height:46vmax;left:-12vmax;top:-16vmax;+ background:radial-gradient(circle,rgba(139,92,246,.45),transparent 62%);+ animation:drift1 16s ease-in-out infinite alternate}+ .aura::after{width:40vmax;height:40vmax;right:-14vmax;bottom:-18vmax;+ background:radial-gradient(circle,rgba(79,195,255,.32),transparent 62%);+ animation:drift2 20s ease-in-out infinite alternate}+ @keyframes drift1{to{transform:translate(8vmax,6vmax) scale(1.1)}}+ @keyframes drift2{to{transform:translate(-7vmax,-5vmax) scale(1.15)}}++ main{position:relative;z-index:1;width:100%;max-width:560px;text-align:center;+ animation:rise .8s cubic-bezier(.2,.7,.2,1) both}+ @keyframes rise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}++ .mark{width:64px;height:64px;margin:0 auto 28px;border-radius:16px;+ display:grid;place-items:center;font-family:var(--font-mono);font-weight:700;font-size:30px;+ color:#fff;background:linear-gradient(135deg,var(--violet),#6d28d9);+ box-shadow:0 10px 40px -8px rgba(139,92,246,.6), inset 0 1px 0 rgba(255,255,255,.25);+ position:relative}+ .mark::after{content:"";position:absolute;inset:0;border-radius:16px;+ border:1px solid rgba(255,255,255,.14)}++ .badge{display:inline-flex;align-items:center;gap:8px;margin-bottom:22px;+ padding:6px 13px;border:1px solid var(--line);border-radius:999px;+ background:rgba(255,255,255,.03);font-family:var(--font-mono);font-size:11.5px;+ letter-spacing:.04em;text-transform:uppercase;color:var(--ink-2)}+ .dot{width:8px;height:8px;border-radius:50%;background:var(--amber);+ box-shadow:0 0 0 0 rgba(255,180,84,.7);animation:pulse 2s infinite}+ @keyframes pulse{0%{box-shadow:0 0 0 0 rgba(255,180,84,.55)}+ 70%{box-shadow:0 0 0 9px rgba(255,180,84,0)}100%{box-shadow:0 0 0 0 rgba(255,180,84,0)}}++ h1{margin:0 0 14px;font-size:clamp(28px,6vw,42px);line-height:1.08;letter-spacing:-.02em;font-weight:700}+ h1 .grad{background:linear-gradient(100deg,var(--violet),var(--blue));+ -webkit-background-clip:text;background-clip:text;color:transparent}+ p.lede{margin:0 auto 30px;max-width:46ch;color:var(--ink-2);font-size:16.5px;line-height:1.6}++ .track{width:min(340px,86%);height:3px;margin:0 auto 30px;border-radius:99px;+ background:rgba(255,255,255,.07);overflow:hidden}+ .track i{display:block;height:100%;width:40%;border-radius:99px;+ background:linear-gradient(90deg,transparent,var(--violet),var(--blue),transparent);+ animation:load 1.5s ease-in-out infinite}+ @keyframes load{0%{transform:translateX(-120%)}100%{transform:translateX(320%)}}++ .links{display:flex;gap:10px;justify-content:center;flex-wrap:wrap}+ a.btn{display:inline-flex;align-items:center;gap:7px;padding:10px 17px;border-radius:11px;+ font-size:14px;font-weight:600;text-decoration:none;transition:.18s ease;+ border:1px solid var(--line);color:var(--ink)}+ a.btn:hover{transform:translateY(-2px);border-color:rgba(255,255,255,.22);background:rgba(255,255,255,.04)}+ a.btn.primary{background:linear-gradient(135deg,var(--violet),#6d28d9);border-color:transparent;color:#fff;+ box-shadow:0 8px 24px -8px rgba(139,92,246,.7)}+ a.btn.primary:hover{box-shadow:0 10px 30px -6px rgba(139,92,246,.85)}+ a.btn:focus-visible{outline:2px solid var(--blue);outline-offset:2px}++ footer{position:fixed;bottom:18px;left:0;right:0;z-index:1;text-align:center;+ font-family:var(--font-mono);font-size:11px;color:var(--ink-3)}+ footer code{color:var(--ink-2)}+ @media (prefers-reduced-motion:reduce){+ .aura::before,.aura::after,.track i,.dot,main{animation:none}+ }+</style>+</head>+<body>+ <div class="aura" aria-hidden="true"></div>+ <main>+ <div class="mark">3</div>+ <span class="badge"><span class="dot"></span> Shipping an update</span>+ <h1>We'll be right back.<br><span class="grad">Deploying now.</span></h1>+ <p class="lede">three.ws is rolling out an update. Nothing is lost — your agents, wallets,+ and launches are safe. The platform will be back online shortly.</p>+ <div class="track" aria-hidden="true"><i></i></div>+ <div class="links">+ <a class="btn primary" href="https://x.com/threedotws" rel="noopener">Follow for updates</a>+ <a class="btn" href="https://t.me/threews" rel="noopener">Telegram</a>+ </div>+ </main>+ <footer>three.ws · <code>$THREE</code> · thanks for your patience</footer>+ <script>+ // Auto-recover: quietly poll the real app; when it answers, reload into it.+ // Uses a HEAD to the homepage; only reloads on a 2xx so we never bounce users+ // into another error page.+ (function(){+ var TRY_EVERY = 20000;+ function probe(){+ fetch('/?_probe=' + Date.now(), {method:'HEAD',cache:'no-store'})+ .then(function(r){ if(r.ok && r.status < 300 && !r.headers.get('x-vercel-error')) location.reload(); })+ .catch(function(){});+ }+ setInterval(probe, TRY_EVERY);+ })();+ </script>+</body>+</html>diff --git a/public/risk-ack.js b/public/risk-ack.jsindex 71bb44611..e0c48f646 100644--- a/public/risk-ack.js+++ b/public/risk-ack.js@@ -270,66 +270,108 @@ export function ensureRiskAck({ context = 'real-funds' } = {}) {if (_inFlight) return _inFlight;_inFlight = new Promise((resolve) => {- _ensureStyles();- const dialog = _buildDialog();- document.body.appendChild(dialog);-- const checkbox = dialog.querySelector('[data-risk-ack-check]');- const acceptBtn = dialog.querySelector('[data-risk-ack-accept]');- const declineBtn = dialog.querySelector('[data-risk-ack-decline]');- const prevOverflow = document.body.style.overflow;- const trigger = document.activeElement;- let settled = false;-- const finish = (accepted) => {- if (settled) return;- settled = true;- dialog.classList.add('risk-ack--closing');- setTimeout(() => {- if (dialog.open) dialog.close();- dialog.remove();- document.body.style.overflow = prevOverflow;- if (trigger instanceof Element) trigger.focus?.();- }, 210);+ // The gate must never brick a feature: if the dialog can't render or open+ // (no <dialog> support, detached document, CSP on injected styles), fall+ // back to the plain-confirm acknowledgment instead of throwing.+ try {+ _openDialog({ context, resolve });+ } catch {_inFlight = null;- resolve(accepted);- };+ resolve(fallbackConfirmAck({ context }));+ }+ });++ return _inFlight;+}- checkbox.addEventListener('change', () => {- acceptBtn.disabled = !checkbox.checked;- });- acceptBtn.addEventListener('click', () => {- if (settled || !checkbox.checked) return;- const record = {- version: RISK_ACK_VERSION,- acceptedAt: new Date().toISOString(),- context,- };+/**+ * Last-resort acknowledgment when the dialog cannot render: a native confirm()+ * carrying the core acceptance text. Accepting persists + records exactly like+ * the dialog path. Exported so wrappers (src/shared/risk-ack.js, x402.js) can+ * reuse the same wording if this module itself fails to load.+ * @param {{context?: string}} [opts]+ * @returns {boolean}+ */+export function fallbackConfirmAck({ context = 'real-funds' } = {}) {+ try {+ const ok = globalThis.confirm?.(RISK_ACK_CONFIRM_TEXT) === true;+ if (ok) {+ const record = { version: RISK_ACK_VERSION, acceptedAt: new Date().toISOString(), context };_persist(record);_recordServerSide(record);- finish(true);- });- declineBtn.addEventListener('click', () => finish(false));- dialog.addEventListener('cancel', (e) => {- e.preventDefault();- finish(false);- });- dialog.addEventListener('click', (e) => {- // Only a click on the <dialog> element itself can be a ::backdrop click —- // clicks on inner content target the inner nodes. Checking coordinates- // alone misfires on keyboard/programmatic activations, which report (0,0).- if (e.target !== dialog) return;- const rect = dialog.getBoundingClientRect();- const outside =- e.clientX < rect.left || e.clientX > rect.right ||- e.clientY < rect.top || e.clientY > rect.bottom;- if (outside) finish(false);- });+ }+ return ok;+ } catch {+ return false;+ }+}++export const RISK_ACK_CONFIRM_TEXT =+ 'Real funds — risk acknowledgment\n\n' ++ 'three.ws is experimental software. Losses can be total, fast, and irreversible; ' ++ 'autonomous features can trade and pay on your behalf without asking again; nothing here is financial advice; ' ++ 'and three.ws is not responsible for any losses. Full text: three.ws/legal/risk\n\n' ++ 'Press OK to accept that you use real funds entirely at your own risk, or Cancel to stop.';++function _openDialog({ context, resolve }) {+ _ensureStyles();+ const dialog = _buildDialog();+ document.body.appendChild(dialog);- document.body.style.overflow = 'hidden';- dialog.showModal();- checkbox.focus();+ const checkbox = dialog.querySelector('[data-risk-ack-check]');+ const acceptBtn = dialog.querySelector('[data-risk-ack-accept]');+ const declineBtn = dialog.querySelector('[data-risk-ack-decline]');+ const prevOverflow = document.body.style.overflow;+ const trigger = document.activeElement;+ let settled = false;++ const finish = (accepted) => {+ if (settled) return;+ settled = true;+ dialog.classList.add('risk-ack--closing');+ setTimeout(() => {+ if (dialog.open) dialog.close();+ dialog.remove();+ document.body.style.overflow = prevOverflow;+ if (trigger instanceof Element) trigger.focus?.();+ }, 210);+ _inFlight = null;+ resolve(accepted);+ };++ checkbox.addEventListener('change', () => {+ acceptBtn.disabled = !checkbox.checked;+ });+ acceptBtn.addEventListener('click', () => {+ if (settled || !checkbox.checked) return;+ const record = {+ version: RISK_ACK_VERSION,+ acceptedAt: new Date().toISOString(),+ context,+ };+ _persist(record);+ _recordServerSide(record);+ finish(true);+ });+ declineBtn.addEventListener('click', () => finish(false));+ dialog.addEventListener('cancel', (e) => {+ e.preventDefault();+ finish(false);+ });+ dialog.addEventListener('click', (e) => {+ // Only a click on the <dialog> element itself can be a ::backdrop click —+ // clicks on inner content target the inner nodes. Checking coordinates+ // alone misfires on keyboard/programmatic activations, which report (0,0).+ if (e.target !== dialog) return;+ const rect = dialog.getBoundingClientRect();+ const outside =+ e.clientX < rect.left || e.clientX > rect.right ||+ e.clientY < rect.top || e.clientY > rect.bottom;+ if (outside) finish(false);});- return _inFlight;+ document.body.style.overflow = 'hidden';+ dialog.showModal();+ checkbox.focus();}+