Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix: replace connectWallet with ensureWallet for wallet connection
nirholas96930cdc3634
diff --git a/agent-home.html b/agent-home.htmlindex e3b4f5c1b..7251a8da0 100644--- a/agent-home.html+++ b/agent-home.html@@ -644,7 +644,7 @@shadow-intensity="0"exposure="0.7"environment-image="neutral"- camera-orbit="0deg 80deg 5m"+ camera-orbit="0deg 80deg 9m"field-of-view="45deg"loading="lazy"></model-viewer>@@ -681,6 +681,7 @@<div class="h-footer-inner"><div class="h-footer-brand-col"><div class="h-footer-brand">+ <img class="wordmark-logo" src="/three.svg" alt="" aria-hidden="true" /><span class="wordmark-dot" aria-hidden="true"></span><span>three.ws</span></div>diff --git a/create.html b/create.htmlindex 112c9f3c2..8ef996c92 100644--- a/create.html+++ b/create.html@@ -751,7 +751,7 @@shadow-intensity="0"exposure="0.7"environment-image="neutral"- camera-orbit="0deg 80deg 4m"+ camera-orbit="0deg 80deg 9m"field-of-view="35deg"loading="lazy"></model-viewer>@@ -788,6 +788,7 @@<div class="h-footer-inner"><div class="h-footer-brand-col"><div class="h-footer-brand">+ <img class="wordmark-logo" src="/three.svg" alt="" aria-hidden="true" /><span class="wordmark-dot" aria-hidden="true"></span><span>three.ws</span></div>diff --git a/footer.css b/footer.cssindex a8972f97c..a2b1c4d36 100644--- a/footer.css+++ b/footer.css@@ -275,6 +275,14 @@color: #fff;}+.h-footer-brand .wordmark-logo {+ width: 22px;+ height: 22px;+ display: inline-block;+ vertical-align: middle;+ flex-shrink: 0;+}+.h-footer-brand .wordmark-dot {display: inline-block;width: 8px;diff --git a/home.html b/home.htmlindex c744b9c0d..d53d8d2e6 100644--- a/home.html+++ b/home.html@@ -491,7 +491,7 @@shadow-intensity="0"exposure="0.7"environment-image="neutral"- camera-orbit="0deg 80deg 5m"+ camera-orbit="0deg 80deg 9m"field-of-view="45deg"loading="lazy"></model-viewer>@@ -529,6 +529,7 @@<div class="h-footer-inner"><div class="h-footer-brand-col"><div class="h-footer-brand">+ <img class="wordmark-logo" src="/three.svg" alt="" aria-hidden="true" /><span class="wordmark-dot" aria-hidden="true"></span><span>three.ws</span></div>diff --git a/profile.html.tmp.650204.1777424377882 b/profile.html.tmp.650204.1777424377882new file mode 100644index 000000000..8d7b8b66c--- /dev/null+++ b/profile.html.tmp.650204.1777424377882@@ -0,0 +1,546 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <title>Agent Profile</title>+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <meta name="description" content="On-chain agent identity profile." />+ <meta name="theme-color" content="#000000" />++ <link rel="shortcut icon" href="/favicon.ico" />+ <link rel="preconnect" href="https://fonts.googleapis.com" />+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />+ <link rel="stylesheet" href="/style.css" />+ <link rel="stylesheet" href="/footer.css" />+ <script defer src="/footer-newsletter.js"></script>+ <link+ href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500&display=swap"+ rel="stylesheet"+ />+ <script+ type="module"+ src="https://ajax.googleapis.com/ajax/libs/model-viewer/4.0.0/model-viewer.min.js"+ ></script>++ <meta property="og:type" content="profile" />+ <meta property="og:site_name" content="three.ws">+ <meta property="og:url" content="" id="og-url">+ <meta property="og:title" content="Agent Profile" id="og-title" />+ <meta property="og:description" content="On-chain agent identity." id="og-description" />+ <meta property="og:image" content="https://three.ws/assets/og-image.png" id="og-image">+ <meta property="og:image:width" content="1200">+ <meta property="og:image:height" content="630">+ <meta name="twitter:card" content="summary_large_image">+ <meta name="twitter:title" content="Agent Profile" id="tw-title">+ <meta name="twitter:description" content="On-chain agent identity." id="tw-description">+ <meta name="twitter:image" content="https://three.ws/assets/og-image.png" id="tw-image">++ <style>+ body {+ overflow: auto;+ display: flex;+ flex-direction: column;+ min-height: 100vh;+ }++ .profile-page-header {+ display: flex;+ align-items: center;+ gap: 1rem;+ padding: 1rem 1.618rem;+ border-bottom: 1px solid rgba(255, 255, 255, 0.06);+ justify-content: space-between;+ }++ .profile-page-header a {+ color: rgba(255, 255, 255, 0.4);+ text-decoration: none;+ font-size: 0.764rem;+ }++ .profile-page-header a:hover {+ color: rgba(255, 255, 255, 0.8);+ }++ .profile-root {+ max-width: 960px;+ margin: 0 auto;+ padding: 2.5rem 1.5rem 5rem;+ width: 100%;+ }++ /* ── Hero ────────────────────────────────────────────────────────── */+ .up-hero {+ display: flex;+ align-items: center;+ gap: 1.5rem;+ margin-bottom: 2.5rem;+ }++ .up-avatar-ring {+ width: 72px;+ height: 72px;+ border-radius: 50%;+ border: 1px solid rgba(255, 255, 255, 0.12);+ background: radial-gradient(ellipse at center, rgba(255, 215, 0, 0.06) 0%, transparent 70%);+ display: flex;+ align-items: center;+ justify-content: center;+ flex-shrink: 0;+ }++ .up-avatar-glyph {+ font-size: 1.618rem;+ color: rgba(255, 215, 0, 0.5);+ }++ .up-address {+ font-size: 1.382rem;+ font-weight: 300;+ color: #e5e5e5;+ letter-spacing: -0.02em;+ margin: 0 0 0.25rem;+ }++ .up-muted {+ color: rgba(255, 255, 255, 0.3);+ font-size: 0.764rem;+ margin: 0;+ line-height: 1.5;+ }++ .up-full-address {+ font-family: monospace;+ font-size: 0.618rem;+ word-break: break-all;+ }++ /* ── Chain filter pills ───────────────────────────────────────────── */+ .up-chain-bar {+ display: flex;+ flex-wrap: wrap;+ gap: 0.382rem;+ margin-bottom: 1.618rem;+ }++ .up-chain-pill {+ background: transparent;+ border: 1px solid rgba(255, 255, 255, 0.1);+ color: rgba(255, 255, 255, 0.4);+ font-size: 0.618rem;+ padding: 0.25rem 0.618rem;+ border-radius: 999px;+ cursor: pointer;+ font-family: inherit;+ transition: color 0.15s, border-color 0.15s, background 0.15s;+ }++ .up-chain-pill:hover {+ color: rgba(255, 255, 255, 0.8);+ border-color: rgba(255, 255, 255, 0.2);+ }++ .up-chain-pill--active {+ background: rgba(255, 215, 0, 0.1);+ border-color: rgba(255, 215, 0, 0.3);+ color: rgba(255, 215, 0, 0.9);+ }++ /* ── Agent grid ──────────────────────────────────────────────────── */+ .up-grid {+ display: grid;+ grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));+ gap: 1rem;+ }++ .up-empty {+ color: rgba(255, 255, 255, 0.3);+ font-size: 0.85rem;+ grid-column: 1 / -1;+ text-align: center;+ padding: 3rem 0;+ }++ .up-empty a {+ color: rgba(255, 215, 0, 0.7);+ text-decoration: none;+ }++ .up-empty a:hover {+ color: #ffd700;+ }++ /* ── Card ────────────────────────────────────────────────────────── */+ .up-card {+ background: rgba(255, 255, 255, 0.02);+ border: 1px solid rgba(255, 255, 255, 0.07);+ border-radius: 12px;+ overflow: hidden;+ transition: border-color 0.15s, background 0.15s;+ display: flex;+ flex-direction: column;+ }++ .up-card:hover {+ border-color: rgba(255, 255, 255, 0.14);+ background: rgba(255, 255, 255, 0.04);+ }++ .up-card-thumb-link {+ display: block;+ text-decoration: none;+ }++ .up-card-thumb {+ width: 100%;+ aspect-ratio: 1;+ background: radial-gradient(ellipse at center, rgba(255, 215, 0, 0.03) 0%, transparent 70%);+ overflow: hidden;+ position: relative;+ }++ .up-card-thumb-placeholder {+ width: 100%;+ height: 100%;+ display: flex;+ align-items: center;+ justify-content: center;+ font-size: 2.5rem;+ color: rgba(255, 255, 255, 0.08);+ }++ .up-card-body {+ padding: 0.75rem 0.875rem 0.875rem;+ display: flex;+ flex-direction: column;+ gap: 0.25rem;+ flex: 1;+ }++ .up-card-chain {+ font-size: 0.55rem;+ text-transform: uppercase;+ letter-spacing: 0.1em;+ color: rgba(255, 215, 0, 0.5);+ font-weight: 500;+ }++ .up-card-name {+ font-size: 0.875rem;+ font-weight: 500;+ color: rgba(255, 255, 255, 0.85);+ text-decoration: none;+ line-height: 1.3;+ display: -webkit-box;+ -webkit-line-clamp: 2;+ -webkit-box-orient: vertical;+ overflow: hidden;+ }++ .up-card-name:hover {+ color: #fff;+ }++ .up-card-desc {+ font-size: 0.618rem;+ color: rgba(255, 255, 255, 0.3);+ margin: 0;+ line-height: 1.5;+ display: -webkit-box;+ -webkit-line-clamp: 2;+ -webkit-box-orient: vertical;+ overflow: hidden;+ }++ .up-card-footer {+ display: flex;+ align-items: center;+ justify-content: space-between;+ margin-top: auto;+ padding-top: 0.382rem;+ }++ .up-card-id {+ font-size: 0.55rem;+ font-family: monospace;+ color: rgba(255, 255, 255, 0.18);+ }++ .up-card-edit {+ font-size: 0.618rem;+ color: rgba(255, 215, 0, 0.4);+ text-decoration: none;+ transition: color 0.15s;+ }++ .up-card-edit:hover {+ color: rgba(255, 215, 0, 0.8);+ }++ /* ── Error / loading ─────────────────────────────────────────────── */+ .up-error {+ text-align: center;+ color: rgba(255, 255, 255, 0.3);+ font-size: 0.85rem;+ padding: 4rem 1rem;+ }++ /* ── Copy button ─────────────────────────────────────────────────── */+ .profile-copy-btn {+ background: transparent;+ border: 1px solid rgba(255, 255, 255, 0.1);+ color: rgba(255, 255, 255, 0.4);+ font-size: 0.618rem;+ padding: 0.25rem 0.618rem;+ border-radius: 6px;+ cursor: pointer;+ font-family: inherit;+ transition: color 0.15s, border-color 0.15s;+ }++ .profile-copy-btn:hover {+ color: rgba(255, 255, 255, 0.8);+ border-color: rgba(255, 255, 255, 0.2);+ }++ .profile-copy-btn.copied {+ color: #4ade80;+ border-color: rgba(74, 222, 128, 0.3);+ }++ @media (max-width: 480px) {+ .up-hero {+ flex-direction: column;+ align-items: flex-start;+ }++ .up-grid {+ grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));+ }+ }+ </style>+ </head>+ <body>+ <header class="profile-page-header">+ <a href="/" aria-label="Back to three.ws home">← three.ws</a>+ <button class="profile-copy-btn" id="copy-profile-btn" aria-label="Copy profile link">+ copy link+ </button>+ </header>++ <main>+ <div class="profile-root" id="profile-root">+ <div class="up-error">Loading profile…</div>+ </div>+ </main>++ <footer class="h-footer-horizon">+ <div class="h-footer-glow-line" aria-hidden="true"></div>+ <div class="h-footer-floor" aria-hidden="true"></div>+ <div class="h-footer-haze" aria-hidden="true"></div>+ <div class="h-footer-watermark" aria-hidden="true">three.ws</div>+ <div class="h-footer-avatar" aria-hidden="true">+ <model-viewer+ src="/animations/robotexpressive.glb"+ auto-rotate+ auto-rotate-delay="0"+ rotation-per-second="20deg"+ interaction-prompt="none"+ camera-controls="false"+ disable-zoom+ shadow-intensity="0"+ exposure="0.7"+ environment-image="neutral"+ camera-orbit="0deg 80deg 9m"+ field-of-view="35deg"+ loading="lazy"+ ></model-viewer>+ </div>+ <div class="h-footer-cta">+ <div class="h-footer-newsletter">+ <h3>Stay in the loop</h3>+ <p>Get updates on new features, agent tooling, and protocol changes.</p>+ <form class="h-footer-newsletter-form" data-newsletter-form novalidate>+ <input+ type="email"+ class="h-footer-newsletter-input"+ name="email"+ placeholder="Enter your email"+ aria-label="Email address"+ autocomplete="email"+ required+ />+ <button type="submit" class="h-footer-newsletter-btn" aria-label="Subscribe">+ <svg viewBox="0 0 16 16" aria-hidden="true"><path fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" d="M2 8h11m0 0L9 4m4 4l-4 4"/></svg>+ </button>+ </form>+ <p class="h-footer-newsletter-msg" data-newsletter-msg aria-live="polite"></p>+ </div>+ <div class="h-footer-community">+ <h3>Join the community</h3>+ <p>Follow along for builds, demos, and conversations with the team.</p>+ <a class="h-footer-community-btn" href="https://x.com/nichxbt" target="_blank" rel="noopener">+ <svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>+ Follow on X+ </a>+ </div>+ </div>+ <div class="h-footer-inner">+ <div class="h-footer-brand-col">+ <div class="h-footer-brand">+ <span class="wordmark-dot" aria-hidden="true"></span>+ <span>three.ws</span>+ </div>+ <p class="h-footer-tagline">Give your AI a body.</p>+ <div class="h-footer-socials">+ <a class="h-footer-social" href="https://x.com/nichxbt" target="_blank" rel="noopener" aria-label="three.ws on X">+ <svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>+ </a>+ <a class="h-footer-social" href="https://github.com/nirholas/three.ws" target="_blank" rel="noopener" aria-label="three.ws on GitHub">+ <svg viewBox="0 0 16 16" aria-hidden="true"><path fill="currentColor" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>+ </a>+ </div>+ </div>+ <nav class="h-footer-links" aria-label="Footer">+ <div class="h-footer-link-col">+ <h4 class="h-footer-link-heading">Product</h4>+ <a href="/create">Create</a>+ <a href="/studio">Studio</a>+ <a href="/widgets">Widgets</a>+ <a href="/discover">Discover</a>+ </div>+ <div class="h-footer-link-col">+ <h4 class="h-footer-link-heading">Developers</h4>+ <a href="/docs">Docs</a>+ <a href="https://github.com/nirholas/three.ws" target="_blank" rel="noopener">GitHub</a>+ <a href="https://eips.ethereum.org/EIPS/eip-8004" target="_blank" rel="noopener">ERC-8004</a>+ </div>+ <div class="h-footer-link-col">+ <h4 class="h-footer-link-heading">Resources</h4>+ <a href="/features">Features</a>+ <a href="/dashboard">Dashboard</a>+ </div>+ </nav>+ </div>+ <div class="h-footer-bottom">+ <p class="h-footer-legal">© 2026 three.ws — All rights reserved.</p>+ <div class="h-footer-legal-links">+ <a href="/legal/privacy">Privacy Policy</a>+ <a href="/legal/tos">Terms of Use</a>+ </div>+ </div>+ </footer>++ <script type="module">+ import { mountUserProfile } from './src/erc8004/user-profile.js';++ const esc = (s) =>+ String(s ?? '').replace(+ /[&<>"']/g,+ (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c],+ );+ const attr = (s) => esc(s).replace(/"/g, '"');++ const segments = location.pathname.split('/').filter(Boolean);+ const slug = segments[1]; // /u/<slug>++ const root = document.getElementById('profile-root');+ const copyBtn = document.getElementById('copy-profile-btn');++ if (!slug) {+ root.innerHTML = `<div class="up-error">No profile specified.</div>`;+ } else if (/^0x[0-9a-fA-F]{40}$/.test(slug)) {+ // Legacy: on-chain wallet address profile+ const short = slug.slice(0, 6) + '…' + slug.slice(-4);+ document.title = `${short} — Agents`;+ const profileUrl = `${location.origin}/u/${slug}`;+ document.querySelector('#og-title')?.setAttribute('content', `${short} — Agents`);+ document.querySelector('#og-description')?.setAttribute('content', `On-chain agent identity profile for ${slug}`);+ document.querySelector('#og-url')?.setAttribute('content', profileUrl);+ document.querySelector('#tw-title')?.setAttribute('content', `${short} — Agents`);+ document.querySelector('#tw-description')?.setAttribute('content', `On-chain agent identity profile for ${slug}`);+ mountUserProfile(root, slug).catch((err) => {+ root.innerHTML = `<div class="up-error">Could not load profile: ${esc(err.message)}</div>`;+ });+ } else {+ // Username-based profile+ mountUsernameProfile(root, slug).catch((err) => {+ root.innerHTML = `<div class="up-error">Could not load profile: ${esc(err.message)}</div>`;+ });+ }++ async function mountUsernameProfile(rootEl, username) {+ rootEl.innerHTML = `<div class="up-error">Loading…</div>`;++ const res = await fetch(`/api/users/${encodeURIComponent(username)}`);+ if (!res.ok) {+ const data = await res.json().catch(() => ({}));+ const msg = res.status === 404 ? 'User not found.' : (data.error_description || res.statusText);+ rootEl.innerHTML = `<div class="up-error">${esc(msg)}</div>`;+ return;+ }+ const { user, avatars } = await res.json();++ // Update page meta+ const title = `@${user.username} — three.ws`;+ document.title = title;+ const profileUrl = `${location.origin}/u/${encodeURIComponent(user.username)}`;+ document.querySelector('#og-title')?.setAttribute('content', title);+ document.querySelector('#og-description')?.setAttribute('content', `${user.display_name || user.username}'s avatars on three.ws`);+ document.querySelector('#og-url')?.setAttribute('content', profileUrl);+ document.querySelector('#tw-title')?.setAttribute('content', title);+ document.querySelector('#tw-description')?.setAttribute('content', `${user.display_name || user.username}'s public avatars on three.ws`);++ const avatarCards = avatars.map((a) => {+ const thumb = a.thumbnail_url+ ? `<img src="${attr(a.thumbnail_url)}" alt="${attr(a.name)}" style="width:100%;height:100%;object-fit:cover">`+ : `<div class="up-card-thumb-placeholder">◎</div>`;+ const tags = (a.tags || []).slice(0, 3).map((t) => `<span style="font-size:0.55rem;color:rgba(154,140,255,0.6);margin-right:4px">#${esc(t)}</span>`).join('');+ return `+ <article class="up-card">+ <a href="/avatars/${attr(a.id)}" class="up-card-thumb-link" tabindex="-1" aria-hidden="true">+ <div class="up-card-thumb">${thumb}</div>+ </a>+ <div class="up-card-body">+ <a href="/avatars/${attr(a.id)}" class="up-card-name">${esc(a.name)}</a>+ ${a.description ? `<p class="up-card-desc">${esc(a.description)}</p>` : ''}+ <div class="up-card-footer">+ <div>${tags}</div>+ </div>+ </div>+ </article>+ `;+ }).join('');++ rootEl.innerHTML = `+ <div class="up-hero">+ <div class="up-avatar-ring">+ <span class="up-avatar-glyph">◎</span>+ </div>+ <div class="up-hero-info">+ <h1 class="up-address">${esc(user.display_name || user.username)}</h1>+ <p class="up-muted">@${esc(user.username)}</p>+ <p class="up-muted" style="margin-top:4px">${avatars.length} public avatar${avatars.length === 1 ? '' : 's'}</p>+ </div>+ </div>+ <div class="up-grid">+ ${avatarCards || `<p class="up-empty">No public avatars yet.</p>`}+ </div>+ `;+ }++ // Copy profile URL to clipboard+ copyBtn.addEventListener('click', async () => {+ try {+ await navigator.clipboard.writeText(location.href);+ copyBtn.textContent = 'copied ✓';+ copyBtn.classList.add('copied');+ setTimeout(() => {+ copyBtn.textContent = 'copy link';+ copyBtn.classList.remove('copied');+ }, 1800);+ } catch {}+ });+ </script>+ </body>+</html>diff --git a/public/login.html b/public/login.htmlindex 6db67c870..37a49ddc7 100644--- a/public/login.html+++ b/public/login.html@@ -48,39 +48,13 @@0 30px 80px rgba(0, 0, 0, 0.85),0 0 120px rgba(200, 210, 255, 0.04);}- .panel {- flex: 1;- position: relative;- display: flex;- align-items: center;- justify-content: center;- background:- radial-gradient(120% 90% at 30% 20%, rgba(154, 140, 255, 0.55), transparent 60%),- radial-gradient(120% 90% at 80% 90%, rgba(255, 140, 200, 0.35), transparent 55%),- linear-gradient(135deg, #2a2350 0%, #1a1a2e 100%);- overflow: hidden;- }- .agent-avatar {- position: relative;- width: 320px;- height: 320px;- pointer-events: none;- }- .agent-avatar model-viewer {- width: 100%;- height: 100%;- --poster-color: transparent;- background: transparent;- }+ /* .panel, .agent-avatar, .agent-avatar model-viewer come from /auth.css.+ Override only what's specific to this page below. */.agent-avatar::after {- content: '';- position: absolute;- left: 50%;- bottom: -2px;width: 90px;height: 10px;background: radial-gradient(ellipse, rgba(220, 230, 255, 0.25), transparent 70%);- transform: translateX(-50%);+ bottom: -2px;filter: blur(6px);}a {@@ -104,23 +78,12 @@justify-content: center;overflow-y: auto;}+ /* Mobile shell/panel/agent-avatar adjustments come from /auth.css. */@media (max-width: 860px) {- .shell {- flex-direction: column;- min-height: 0;- }- .panel {- min-height: 220px;- order: -1;- }.card {padding: 32px 28px;max-width: none;}- .agent-avatar {- width: 180px;- height: 180px;- }}@media (max-height: 720px) and (min-width: 861px) {.panel { display: none; }@@ -202,11 +165,6 @@.field-err.show {display: block;}- .caps-warn {- margin: 6px 0 0;- font-size: 12px;- color: #d8c074;- }.err {margin-top: 14px;padding: 10px 12px;@@ -314,40 +272,7 @@}}- /* ── Password field ── */- .password-wrap {- position: relative;- }- .password-wrap input {- padding-right: 44px;- }- .password-toggle {- position: absolute;- top: 50%;- right: 6px;- transform: translateY(-50%);- width: 32px;- height: 32px;- margin: 0;- padding: 0;- background: transparent;- color: #666;- border: 0;- border-radius: 6px;- cursor: pointer;- display: flex;- align-items: center;- justify-content: center;- transition: color 0.1s ease, background 0.1s ease;- }- .password-toggle:hover {- color: #ddd;- background: rgba(255, 255, 255, 0.04);- }- .password-toggle svg {- width: 18px;- height: 18px;- }+ /* .password-wrap, .password-toggle, .caps-warn come from /auth.css. *//* ── Wallet chain tabs ── */.chain-tabs {@@ -473,7 +398,7 @@</svg></button></div>- <p class="caps-warn" id="caps-warn" hidden>Caps Lock is on</p>+ <p class="caps-warn" id="caps-warn">Caps Lock is on</p><p class="field-err" id="password-err" role="alert"></p><div class="remember-row">@@ -604,11 +529,11 @@// ── Caps lock warn ──function checkCaps(e) {const on = e.getModifierState && e.getModifierState('CapsLock');- capsWarn.hidden = !on;+ capsWarn.classList.toggle('show', !!on);}passwordInput.addEventListener('keydown', checkCaps);passwordInput.addEventListener('keyup', checkCaps);- passwordInput.addEventListener('blur', () => { capsWarn.hidden = true; });+ passwordInput.addEventListener('blur', () => { capsWarn.classList.remove('show'); });// ── Inline field errors ──function setFieldError(input, errEl, msg) {diff --git a/public/register.html b/public/register.htmlindex df216a6d9..e82e34516 100644--- a/public/register.html+++ b/public/register.html@@ -271,6 +271,72 @@height: 1px;background: #2a2a36;}+ .method-tabs {+ display: flex;+ gap: 4px;+ background: #0f0f17;+ border: 1px solid #2a2a36;+ border-radius: 10px;+ padding: 3px;+ margin: 0 0 16px;+ }+ .method-tab {+ flex: 1;+ margin-top: 0;+ padding: 9px 10px;+ border: 1px solid transparent;+ border-radius: 7px;+ background: transparent;+ color: #888;+ font-size: 14px;+ font-weight: 500;+ cursor: pointer;+ transition: background 0.1s, color 0.1s, transform 0.08s cubic-bezier(0.34, 1.56, 0.64, 1);+ width: auto;+ }+ .method-tab.active {+ background: #1e1e2e;+ color: #eee;+ border-color: #2a2a36;+ }+ .method-tab:hover:not(.active) { color: #bbb; }+ .method-tab:active { transform: scale(0.97); }+ .method-panel { display: none; }+ .method-panel.active {+ display: block;+ animation: panel-fade-in 0.18s ease-out both;+ }+ @keyframes panel-fade-in {+ from { opacity: 0; transform: translateY(4px); }+ to { opacity: 1; transform: translateY(0); }+ }+ .field-err {+ margin: 6px 0 0;+ font-size: 12px;+ color: #ff7a7a;+ display: none;+ }+ .field-err.show { display: block; }+ .chain-tab[disabled] { opacity: 0.4; cursor: not-allowed; }+ #wallet-mount:empty::before,+ #solana-wallet-mount:empty::before {+ content: '';+ display: block;+ height: 44px;+ border-radius: 10px;+ background: linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 100%);+ background-size: 200% 100%;+ animation: wallet-skel 1.4s linear infinite;+ }+ @keyframes wallet-skel {+ 0% { background-position: 200% 0; }+ 100% { background-position: -200% 0; }+ }+ @media (prefers-reduced-motion: reduce) {+ .method-panel.active,+ #wallet-mount:empty::before,+ #solana-wallet-mount:empty::before { animation: none; }+ }.chain-tabs {display: flex;gap: 4px;@@ -278,7 +344,7 @@border: 1px solid #2a2a36;border-radius: 10px;padding: 3px;- margin-bottom: 4px;+ margin-bottom: 12px;}.chain-tab {flex: 1;@@ -322,62 +388,74 @@</head><body><div class="shell">- <form class="card" id="f">+ <form class="card" id="f" autocomplete="on"><a href="/" class="brand"><img src="/three.svg" alt="" class="header-logo" aria-hidden="true" />three.ws</a><h1>Create account</h1><p class="sub">Get started free. <span class="badge">✓ No email needed</span></p>- <label for="username">Username</label>- <input- id="username"- type="text"- autocomplete="username"- required- minlength="3"- maxlength="30"- pattern="[a-zA-Z0-9_-]+"- placeholder="e.g. cool_agent"- aria-describedby="username-hint err"- />- <p class="hint" id="username-hint">3–30 characters, letters, numbers, _ or -</p>- <label for="password">Password</label>- <div class="password-wrap">++ <div class="method-tabs" role="tablist" aria-label="Sign-up method">+ <button type="button" class="method-tab active" data-method="username" role="tab" aria-selected="true" aria-controls="username-panel">Username</button>+ <button type="button" class="method-tab" data-method="wallet" role="tab" aria-selected="false" aria-controls="wallet-panel">Wallet</button>+ </div>++ <div id="username-panel" class="method-panel active" role="tabpanel">+ <label for="username">Username</label><input- id="password"- type="password"- autocomplete="new-password"+ id="username"+ name="username"+ type="text"+ inputmode="text"+ autocapitalize="none"+ autocomplete="username"+ autofocusrequired- minlength="10"- maxlength="200"- aria-describedby="strength-label caps-warn err"+ minlength="3"+ maxlength="30"+ pattern="[a-zA-Z0-9_-]+"+ placeholder="e.g. cool_agent"+ aria-describedby="username-hint err"/>- <button type="button" class="password-toggle" id="password-toggle" aria-label="Show password" aria-pressed="false">- <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">- <path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z" />- <circle cx="12" cy="12" r="3" />- </svg>- </button>- </div>- <p class="caps-warn" id="caps-warn">Caps Lock is on</p>- <div class="strength-bar"><div class="strength-fill" id="strength-fill"></div></div>- <p class="strength-label" id="strength-label">Minimum 10 characters</p>- <button id="submit" type="submit">Create account</button>- <div class="err" id="err" role="alert" aria-live="polite"></div>- <div class="divider">or connect wallet</div>- <div class="chain-tabs" role="tablist" aria-label="Wallet chain">- <button type="button" class="chain-tab active" data-chain="evm" role="tab" aria-selected="true" aria-controls="evm-panel">EVM</button>- <button type="button" class="chain-tab" data-chain="solana" role="tab" aria-selected="false" aria-controls="solana-panel">Solana</button>- </div>- <div id="evm-panel" class="chain-panel active" role="tabpanel">- <div id="wallet-mount"></div>+ <p class="hint" id="username-hint">3–30 characters, letters, numbers, _ or -</p>+ <label for="password">Password</label>+ <div class="password-wrap">+ <input+ id="password"+ name="password"+ type="password"+ autocomplete="new-password"+ required+ minlength="10"+ maxlength="200"+ aria-describedby="strength-label caps-warn err"+ />+ <button type="button" class="password-toggle" id="password-toggle" aria-label="Show password" aria-pressed="false">+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z" />+ <circle cx="12" cy="12" r="3" />+ </svg>+ </button>+ </div>+ <p class="caps-warn" id="caps-warn">Caps Lock is on</p>+ <div class="strength-bar"><div class="strength-fill" id="strength-fill"></div></div>+ <p class="strength-label" id="strength-label">Minimum 10 characters</p>+ <button id="submit" type="submit">Create account</button></div>- <div id="solana-panel" class="chain-panel" role="tabpanel">- <div id="solana-wallet-mount"></div>- <div class="chain-hints" id="solana-hints" style="margin-top:8px;font-size:12px;color:#555;display:flex;gap:8px;justify-content:center;">- <button type="button" class="wallet-hint-btn" data-wallet="phantom">Phantom</button>- <button type="button" class="wallet-hint-btn" data-wallet="backpack">Backpack</button>- <button type="button" class="wallet-hint-btn" data-wallet="solflare">Solflare</button>++ <div id="wallet-panel" class="method-panel" role="tabpanel">+ <div class="chain-tabs" role="tablist" aria-label="Wallet chain">+ <button type="button" class="chain-tab active" data-chain="evm" role="tab" aria-selected="true" aria-controls="evm-panel">EVM</button>+ <button type="button" class="chain-tab" data-chain="solana" role="tab" aria-selected="false" aria-controls="solana-panel">Solana</button>+ </div>+ <div id="evm-panel" class="chain-panel active" role="tabpanel">+ <div id="wallet-mount"></div>+ </div>+ <div id="solana-panel" class="chain-panel" role="tabpanel">+ <div id="solana-wallet-mount"></div></div>+ <p class="hint" style="margin-top:10px;text-align:center;font-size:11px;color:#555;cursor:help" title="Your wallet will prompt twice — once to connect, once to sign.">Wallet prompts to connect, then to sign.</p></div>++ <div class="err" id="err" role="alert" aria-live="polite"></div><p class="foot">Already have an account? <a href="/login">Sign in</a></p><p class="legal">By creating an account you agree to our <a href="/legal/tos">Terms of Service</a> and <a href="/legal/privacy">Privacy Policy</a>.</p></form>@@ -532,6 +610,71 @@});})();+ // ── Method tabs (Username / Wallet) + Solana detection ──+ (function () {+ const tabs = document.querySelectorAll('.method-tab');+ const panels = {+ username: document.getElementById('username-panel'),+ wallet: document.getElementById('wallet-panel'),+ };+ const usernameInput = document.getElementById('username');+ const passwordInput = document.getElementById('password');+ const METHOD_KEY = '3dagent:register-method';+ let active = 'username';+ function setMethod(name, persist = true) {+ if (!panels[name]) return;+ active = name;+ tabs.forEach((t) => {+ const on = t.dataset.method === name;+ t.classList.toggle('active', on);+ t.setAttribute('aria-selected', on ? 'true' : 'false');+ });+ Object.entries(panels).forEach(([k, el]) => el.classList.toggle('active', k === name));+ const usernameActive = name === 'username';+ usernameInput.required = usernameActive;+ passwordInput.required = usernameActive;+ if (persist) {+ try { localStorage.setItem(METHOD_KEY, name); } catch { /* ignore */ }+ }+ }+ window.__getActiveMethod = () => active;+ tabs.forEach((t) => t.addEventListener('click', () => setMethod(t.dataset.method)));+ try {+ if (localStorage.getItem(METHOD_KEY) === 'wallet') setMethod('wallet', false);+ } catch { /* ignore */ }++ // Wallet chain tabs + Solana detection+ const solanaTab = document.querySelector('.chain-tab[data-chain="solana"]');+ const hasSolana = !!(window.solana || window.phantom?.solana || window.backpack || window.solflare);+ if (solanaTab && !hasSolana) {+ solanaTab.disabled = true;+ solanaTab.title = 'Install Phantom, Backpack, or Solflare to use Solana';+ }+ document.querySelectorAll('.chain-tab').forEach((t) => {+ t.addEventListener('click', () => {+ if (t.disabled) return;+ const chain = t.dataset.chain;+ document.querySelectorAll('.chain-tab').forEach((x) => {+ const on = x.dataset.chain === chain;+ x.classList.toggle('active', on);+ x.setAttribute('aria-selected', on ? 'true' : 'false');+ });+ document.getElementById('evm-panel').classList.toggle('active', chain === 'evm');+ document.getElementById('solana-panel').classList.toggle('active', chain === 'solana');+ });+ });++ // Mobile scroll-into-view on focus+ const isTouch = matchMedia('(hover: none)').matches;+ if (isTouch) {+ document.querySelectorAll('#f input').forEach((input) => {+ input.addEventListener('focus', () => {+ setTimeout(() => input.scrollIntoView({ block: 'center', behavior: 'smooth' }), 250);+ });+ });+ }+ })();+// Registration form submitconst params = new URLSearchParams(location.search);const next = params.get('next') || sessionStorage.getItem('login_redirect') || '/create';@@ -541,6 +684,7 @@const btn = document.getElementById('submit');form.addEventListener('submit', async (e) => {e.preventDefault();+ if (window.__getActiveMethod && window.__getActiveMethod() !== 'username') return;err.style.display = 'none';btn.disabled = true;btn.textContent = 'Creating account…';@@ -554,8 +698,15 @@password: document.getElementById('password').value,}),});- const data = await res.json();- if (!res.ok) throw new Error(data.error_description || 'Registration failed');+ const data = await res.json().catch(() => ({}));+ if (!res.ok) {+ const msg = res.status === 429+ ? 'Too many attempts. Try again in a moment.'+ : res.status === 409+ ? 'That username is taken.'+ : (data.error_description || 'Registration failed');+ throw new Error(msg);+ }try {localStorage.setItem('3dagent:auth-hint', JSON.stringify({ authed: true, ts: Date.now() }));} catch { /* ignore */ }diff --git a/scripts/test-pages.mjs b/scripts/test-pages.mjsindex 1ee843b57..e71ab81c4 100644--- a/scripts/test-pages.mjs+++ b/scripts/test-pages.mjs@@ -89,8 +89,13 @@ async function checkRoute(browser, route) {});page.on('console', (msg) => {if (msg.type() !== 'error') return;- const text = `console.error: ${msg.text()}`;- if (!shouldIgnore(text)) errors.push(text);+ const text = msg.text();+ // "Failed to load resource: …" is a cascade message from a failed+ // request — the actual URL is already captured by requestfailed/response+ // handlers below, where ignore patterns can be applied properly.+ if (text.startsWith('Failed to load resource')) return;+ const formatted = `console.error: ${text}`;+ if (!shouldIgnore(formatted)) errors.push(formatted);});page.on('requestfailed', (req) => {const url = req.url();diff --git a/src/cz-flow.js b/src/cz-flow.jsindex e332560bd..50b176aba 100644--- a/src/cz-flow.js+++ b/src/cz-flow.js@@ -21,7 +21,7 @@ export async function startClaim({ state, onProgress }) {try {// Step 1: Connect walletlog('connect_wallet', 'connecting');- const { address, chainId, signer } = await connectWallet();+ const { address, chainId, signer } = await ensureWallet();log('connect_wallet', 'connected', { address, chainId });// Step 2: Check statediff --git a/src/element.js b/src/element.jsindex 4b7b406dc..7e536c841 100644--- a/src/element.js+++ b/src/element.js@@ -279,8 +279,19 @@ class Agent3DElement extends HTMLElement {this._applyLayout();this._setupResponsive();this._observeViewport();- // Defer boot until visible unless `eager` attr is present- if (this.hasAttribute('eager')) this._boot();+ // Defer boot until visible unless `eager` attr is present.+ // Skip boot entirely if no source — wait for src/manifest/body/agent-id+ // to be set, which triggers reboot via attributeChangedCallback.+ if (this.hasAttribute('eager') && this._hasSource()) this._boot();+ }++ _hasSource() {+ return (+ this.hasAttribute('src') ||+ this.hasAttribute('manifest') ||+ this.hasAttribute('body') ||+ this.hasAttribute('agent-id')+ );}disconnectedCallback() {@@ -288,7 +299,20 @@ class Agent3DElement extends HTMLElement {}attributeChangedCallback(name, oldVal, newVal) {- if (!this._mounted || this._suppressAttrChange) return;+ if (this._suppressAttrChange) return;+ // Source attribute set on a not-yet-booted (eager but no source) element+ // — boot now instead of rebooting.+ if (+ !this._mounted &&+ !this._booting &&+ this.isConnected &&+ ['src', 'manifest', 'body', 'agent-id'].includes(name) &&+ newVal+ ) {+ this._boot();+ return;+ }+ if (!this._mounted) return;if (['mode', 'position', 'width', 'height', 'responsive'].includes(name))this._applyLayout();if (name === 'background') this._applyBackground();diff --git a/src/erc8004/batch-tab.js b/src/erc8004/batch-tab.jsindex 22839f10a..3e7963a81 100644--- a/src/erc8004/batch-tab.js+++ b/src/erc8004/batch-tab.js@@ -11,7 +11,7 @@* helpers already exported by agent-registry.js.*/-import { connectWallet, getIdentityRegistry } from './agent-registry.js';+import { ensureWallet, getIdentityRegistry } from './agent-registry.js';import { REGISTRY_DEPLOYMENTS } from './abi.js';import { CHAIN_META, switchChain, txExplorerUrl } from './chain-meta.js';@@ -197,7 +197,7 @@ Agent 2,Does more,MCP,https://agent2.com</pre>}}- const { signer } = await connectWallet();+ const { signer } = await ensureWallet();const registry = getIdentityRegistry(chainId, signer);const identityAddr = REGISTRY_DEPLOYMENTS[chainId].identityRegistry;diff --git a/src/erc8004/deploy-button.js b/src/erc8004/deploy-button.jsindex 9d0eecf70..cbd7bf40c 100644--- a/src/erc8004/deploy-button.js+++ b/src/erc8004/deploy-button.js@@ -17,7 +17,7 @@* one-click chip surfaced on the agent's profile page for the owner.*/-import { connectWallet, getIdentityRegistry } from './agent-registry.js';+import { ensureWallet, getIdentityRegistry } from './agent-registry.js';import { REGISTRY_DEPLOYMENTS } from './abi.js';import {CHAIN_META,@@ -238,9 +238,7 @@ export class DeployButton {// ── Connect wallet on the selected chain ───────────────────────────let signer, walletChainId;try {- ({ signer, chainId: walletChainId } = await connectWallet({- chainId: this._chainId,- }));+ ({ signer, chainId: walletChainId } = await ensureWallet());} catch (err) {if (_isUserRejection(err)) return this._renderDeployButton();this._renderError(`Wallet connection failed: ${_humanError(err)}`);diff --git a/src/erc8004/index.js b/src/erc8004/index.jsindex 25fea7b30..df06929d1 100644--- a/src/erc8004/index.js+++ b/src/erc8004/index.js@@ -7,6 +7,12 @@ export {} from './abi.js';export {connectWallet,+ eagerConnectWallet,+ ensureWallet,+ disconnectWallet,+ getWalletState,+ getSigner,+ onWalletChange,registerAgent,buildRegistrationJSON,pinFile,diff --git a/src/permissions/grant-modal.js b/src/permissions/grant-modal.jsindex 8362b0ccd..b75a1ab59 100644--- a/src/permissions/grant-modal.js+++ b/src/permissions/grant-modal.js@@ -9,7 +9,7 @@*/import { AbiCoder, getAddress } from 'ethers';-import { connectWallet } from '../erc8004/agent-registry.js';+import { ensureWallet } from '../erc8004/agent-registry.js';import { encodeScopedDelegation, signDelegation } from './toolkit.js';import { CAVEAT_ENFORCERS } from '../erc7710/abi.js';@@ -761,7 +761,7 @@ export class GrantPermissionsModal {let signer;try {- const wallet = await connectWallet();+ const wallet = await ensureWallet();signer = wallet.signer;} catch (err) {this._setStatus('✗', `Wallet connection failed: ${err.message}`, 'gm-status--error');@@ -958,7 +958,7 @@ export async function openGrantModal({ agentId, chainId, preset, delegateAddress// 1. Connect wallet — delegator is whoever is currently signed inlet delegatorAddress;try {- const { address } = await connectWallet();+ const { address } = await ensureWallet();delegatorAddress = address;} catch (err) {return { ok: false, reason: `wallet_connection_failed: ${err.message}` };diff --git a/src/runtime/delegation-redeem.js b/src/runtime/delegation-redeem.jsindex e3b4befaf..944ef4466 100644--- a/src/runtime/delegation-redeem.js+++ b/src/runtime/delegation-redeem.js@@ -153,8 +153,8 @@ async function _redeemClient(delegation, calls, chainId) {throw new Error('no_redemption_path');}- const { connectWallet } = await import('../erc8004/agent-registry.js');- const { signer } = await connectWallet();+ const { ensureWallet } = await import('../erc8004/agent-registry.js');+ const { signer } = await ensureWallet();const { redeemDelegation } = await import('../permissions/toolkit.js');const { txHash } = await redeemDelegation({ delegation, calls, signer, chainId });diff --git a/src/validation-ui.js b/src/validation-ui.jsindex edc035255..ccee51f34 100644--- a/src/validation-ui.js+++ b/src/validation-ui.js@@ -9,7 +9,7 @@* - ethers for wallet connection*/-import { connectWallet } from './erc8004/agent-registry.js';+import { ensureWallet } from './erc8004/agent-registry.js';import {getLatestValidation,recordValidation,@@ -239,7 +239,7 @@ export class ValidationDashboard {this.els.submitReportBtn.disabled = true;this.showToast('Connecting wallet...');- const wallet = await connectWallet();+ const wallet = await ensureWallet();const signer = wallet.signer;this.showToast('Submitting validation record on-chain...');diff --git a/src/wallet-auth.js b/src/wallet-auth.jsindex bb6a190e8..b4a3765c9 100644--- a/src/wallet-auth.js+++ b/src/wallet-auth.js@@ -1,12 +1,21 @@-import { connectWallet } from './erc8004/agent-registry.js';+import { ensureWallet } from './erc8004/agent-registry.js';// ─── Public API ─────────────────────────────────────────────────────────────/**- * @returns {Promise<{user: object, wallet: object}>}+ * Sign in with Ethereum (EIP-4361). If a valid session cookie already exists,+ * skip the wallet prompt entirely and return the current user — keeps the user+ * authenticated across the whole site without re-signing.+ *+ * @returns {Promise<{user: object, wallet?: object}>}*/export async function signInWithWallet() {- const { signer, address, chainId } = await connectWallet();+ // Short-circuit: if the session cookie is still valid, no need to prompt+ // the wallet or re-sign anything.+ const existing = await getCurrentUser();+ if (existing) return { user: existing };++ const { signer, address, chainId } = await ensureWallet();// GET nonce — sets __Host-csrf-siwe cookie, returns csrf tokenconst nonceRes = await fetch('/api/auth/siwe/nonce', {diff --git a/vite.config.js b/vite.config.jsindex 0035560f3..caff70299 100644--- a/vite.config.js+++ b/vite.config.js@@ -250,7 +250,11 @@ const libConfig = {},rollupOptions: {// No externals — we want a self-contained drop-in embed.- output: { inlineDynamicImports: false },+ // inlineDynamicImports must be true: UMD output is incompatible+ // with code-splitting, and the lib is meant to be a single drop-in+ // bundle anyway. Splitting can come later via a separate ES-only+ // build target.+ output: { inlineDynamicImports: true },},},};