Skip to content

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.

feat: implement eager wallet connection on app boot

nirholas46d5f053dd76
diff --git a/.gitignore b/.gitignore
index ee65fd7d2..345abdf5d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,7 @@
node_modules
dist
+dist-lib
+dist-artifact
.cache
.vercel
.DS_Store
diff --git a/api/admin/[resource].js b/api/admin/[resource].js
new file mode 100644
index 000000000..964e9fd1a
--- /dev/null
+++ b/api/admin/[resource].js
@@ -0,0 +1,89 @@
+import { sql } from '../_lib/db.js';
+import { cors, json, method, wrap } from '../_lib/http.js';
+import { requireAdmin } from '../_lib/admin.js';
+
+export default wrap(async (req, res) => {
+ const resource = req.query?.resource;
+
+ if (cors(req, res, { methods: 'GET,OPTIONS', credentials: true })) return;
+ if (!method(req, res, ['GET'])) return;
+ if (!(await requireAdmin(req, res))) return;
+
+ if (resource === 'stats') {
+ const [counts] = await sql`
+ select
+ (select count(*) from users where deleted_at is null)::int as total_users,
+ (select count(*) from users where deleted_at is null and created_at > now() - interval '7 days')::int as new_users_7d,
+ (select count(*) from users where deleted_at is null and created_at > now() - interval '30 days')::int as new_users_30d,
+ (select count(*) from avatars where deleted_at is null)::int as total_avatars,
+ (select coalesce(sum(size_bytes),0) from avatars where deleted_at is null)::bigint as total_bytes,
+ (select count(*) from agent_identities where deleted_at is null)::int as total_agents,
+ (select count(*) from sessions where revoked_at is null and expires_at > now())::int as active_sessions,
+ (select count(*) from users where plan='pro' and deleted_at is null)::int as pro_users,
+ (select count(*) from users where plan='team' and deleted_at is null)::int as team_users,
+ (select count(*) from users where plan='enterprise' and deleted_at is null)::int as enterprise_users,
+ (select count(*) from subscriptions where status='active')::int as active_subscriptions
+ `;
+
+ const recentSignups = await sql`
+ select date_trunc('day', created_at)::date as day, count(*)::int as users
+ from users
+ where deleted_at is null and created_at > now() - interval '30 days'
+ group by 1 order by 1
+ `;
+
+ const planBreakdown = await sql`
+ select plan, count(*)::int as users
+ from users where deleted_at is null
+ group by plan order by users desc
+ `;
+
+ const chainBreakdown = await sql`
+ select chain_type, count(*)::int as wallets
+ from user_wallets
+ group by chain_type order by wallets desc
+ `;
+
+ return json(res, 200, { counts, recentSignups, planBreakdown, chainBreakdown });
+ }
+
+ if (resource === 'users') {
+ const params = new URL(req.url, 'http://x').searchParams;
+ const q = (params.get('q') || '').trim().slice(0, 200);
+ const plan = params.get('plan') || null;
+ const page = Math.max(1, parseInt(params.get('page') || '1', 10));
+ const limit = Math.min(100, Math.max(1, parseInt(params.get('limit') || '50', 10)));
+ const offset = (page - 1) * limit;
+
+ const users = await sql`
+ select
+ u.id, u.email, u.display_name, u.plan, u.is_admin,
+ u.wallet_address, u.created_at, u.deleted_at,
+ (
+ select json_agg(json_build_object('address', w.address, 'chain_type', w.chain_type, 'is_primary', w.is_primary))
+ from user_wallets w where w.user_id = u.id
+ ) as wallets,
+ (select count(*)::int from avatars a where a.owner_id = u.id and a.deleted_at is null) as avatar_count
+ from users u
+ where
+ u.deleted_at is null
+ and (${q} = '' or u.email ilike ${'%' + q + '%'} or u.display_name ilike ${'%' + q + '%'} or u.wallet_address ilike ${'%' + q + '%'})
+ and (${plan} is null or u.plan = ${plan})
+ order by u.created_at desc
+ limit ${limit} offset ${offset}
+ `;
+
+ const [{ total }] = await sql`
+ select count(*)::int as total from users u
+ where
+ u.deleted_at is null
+ and (${q} = '' or u.email ilike ${'%' + q + '%'} or u.display_name ilike ${'%' + q + '%'} or u.wallet_address ilike ${'%' + q + '%'})
+ and (${plan} is null or u.plan = ${plan})
+ `;
+
+ return json(res, 200, { users, total, page, limit });
+ }
+
+ res.statusCode = 404;
+ return res.end();
+});
diff --git a/api/admin/stats.js b/api/admin/stats.js
deleted file mode 100644
index 3f8129cd4..000000000
--- a/api/admin/stats.js
+++ /dev/null
@@ -1,52 +0,0 @@
-// GET /api/admin/stats — aggregate platform metrics.
-
-import { sql } from '../_lib/db.js';
-import { cors, json, method, wrap } from '../_lib/http.js';
-import { requireAdmin } from '../_lib/admin.js';
-
-export default wrap(async (req, res) => {
- if (cors(req, res, { methods: 'GET,OPTIONS', credentials: true })) return;
- if (!method(req, res, ['GET'])) return;
- if (!await requireAdmin(req, res)) return;
-
- const [counts] = await sql`
- select
- (select count(*) from users where deleted_at is null)::int as total_users,
- (select count(*) from users where deleted_at is null and created_at > now() - interval '7 days')::int as new_users_7d,
- (select count(*) from users where deleted_at is null and created_at > now() - interval '30 days')::int as new_users_30d,
- (select count(*) from avatars where deleted_at is null)::int as total_avatars,
- (select coalesce(sum(size_bytes),0) from avatars where deleted_at is null)::bigint as total_bytes,
- (select count(*) from agent_identities where deleted_at is null)::int as total_agents,
- (select count(*) from sessions where revoked_at is null and expires_at > now())::int as active_sessions,
- (select count(*) from users where plan='pro' and deleted_at is null)::int as pro_users,
- (select count(*) from users where plan='team' and deleted_at is null)::int as team_users,
- (select count(*) from users where plan='enterprise' and deleted_at is null)::int as enterprise_users,
- (select count(*) from subscriptions where status='active')::int as active_subscriptions
- `;
-
- const recentSignups = await sql`
- select date_trunc('day', created_at)::date as day, count(*)::int as users
- from users
- where deleted_at is null and created_at > now() - interval '30 days'
- group by 1 order by 1
- `;
-
- const planBreakdown = await sql`
- select plan, count(*)::int as users
- from users where deleted_at is null
- group by plan order by users desc
- `;
-
- const chainBreakdown = await sql`
- select chain_type, count(*)::int as wallets
- from user_wallets
- group by chain_type order by wallets desc
- `;
-
- return json(res, 200, {
- counts,
- recentSignups,
- planBreakdown,
- chainBreakdown,
- });
-});
diff --git a/api/admin/users.js b/api/admin/users.js
deleted file mode 100644
index 923e1e8e2..000000000
--- a/api/admin/users.js
+++ /dev/null
@@ -1,47 +0,0 @@
-// GET /api/admin/users?q=&plan=&page=&limit=
-// Returns paginated user list with wallet summary.
-
-import { sql } from '../_lib/db.js';
-import { cors, json, method, wrap } from '../_lib/http.js';
-import { requireAdmin } from '../_lib/admin.js';
-
-export default wrap(async (req, res) => {
- if (cors(req, res, { methods: 'GET,OPTIONS', credentials: true })) return;
- if (!method(req, res, ['GET'])) return;
- if (!await requireAdmin(req, res)) return;
-
- const params = new URL(req.url, 'http://x').searchParams;
- const q = (params.get('q') || '').trim().slice(0, 200);
- const plan = params.get('plan') || null;
- const page = Math.max(1, parseInt(params.get('page') || '1', 10));
- const limit = Math.min(100, Math.max(1, parseInt(params.get('limit') || '50', 10)));
- const offset = (page - 1) * limit;
-
- const users = await sql`
- select
- u.id, u.email, u.display_name, u.plan, u.is_admin,
- u.wallet_address, u.created_at, u.deleted_at,
- (
- select json_agg(json_build_object('address', w.address, 'chain_type', w.chain_type, 'is_primary', w.is_primary))
- from user_wallets w where w.user_id = u.id
- ) as wallets,
- (select count(*)::int from avatars a where a.owner_id = u.id and a.deleted_at is null) as avatar_count
- from users u
- where
- u.deleted_at is null
- and (${q} = '' or u.email ilike ${'%' + q + '%'} or u.display_name ilike ${'%' + q + '%'} or u.wallet_address ilike ${'%' + q + '%'})
- and (${plan} is null or u.plan = ${plan})
- order by u.created_at desc
- limit ${limit} offset ${offset}
- `;
-
- const [{ total }] = await sql`
- select count(*)::int as total from users u
- where
- u.deleted_at is null
- and (${q} = '' or u.email ilike ${'%' + q + '%'} or u.display_name ilike ${'%' + q + '%'} or u.wallet_address ilike ${'%' + q + '%'})
- and (${plan} is null or u.plan = ${plan})
- `;
-
- return json(res, 200, { users, total, page, limit });
-});
diff --git a/api/auth/session/[action].js b/api/auth/session/[action].js
new file mode 100644
index 000000000..1bab13d6d
--- /dev/null
+++ b/api/auth/session/[action].js
@@ -0,0 +1,104 @@
+import { getSessionUser, createSession, sessionCookie } from '../../_lib/auth.js';
+import { sha256 } from '../../_lib/crypto.js';
+import { sql } from '../../_lib/db.js';
+import { cors, json, error, method, wrap, readJson } from '../../_lib/http.js';
+import { clientIp } from '../../_lib/rate-limit.js';
+
+function readCookieToken(req) {
+ const cookie = req.headers.cookie || '';
+ const m = cookie.match(/(?:^|;\s*)__Host-sid=([^;]+)/) || cookie.match(/(?:^|;\s*)sid=([^;]+)/);
+ return m ? decodeURIComponent(m[1]) : null;
+}
+
+export default wrap(async (req, res) => {
+ const action = req.query?.action;
+
+ if (action === 'list') {
+ if (cors(req, res, { methods: 'GET,OPTIONS', credentials: true })) return;
+ if (!method(req, res, ['GET'])) return;
+
+ const user = await getSessionUser(req);
+ if (!user) return error(res, 401, 'unauthorized', 'sign in required');
+
+ const token = readCookieToken(req);
+ const currentHash = token ? await sha256(token) : null;
+
+ const rows = await sql`
+ select id, created_at, last_seen_at, user_agent, ip, token_hash
+ from sessions
+ where user_id = ${user.id} and revoked_at is null and expires_at > now()
+ order by created_at desc
+ `;
+
+ const sessions = await Promise.all(
+ rows.map(async (s) => ({
+ id: s.id,
+ createdAt: s.created_at,
+ lastUsedAt: s.last_seen_at,
+ userAgent: s.user_agent,
+ ipHash: s.ip ? (await sha256(s.ip)).slice(0, 8) : null,
+ current: currentHash !== null && s.token_hash === currentHash,
+ })),
+ );
+
+ return json(res, 200, { ok: true, sessions });
+ }
+
+ if (action === 'refresh') {
+ if (cors(req, res, { methods: 'POST,OPTIONS', credentials: true })) return;
+ if (!method(req, res, ['POST'])) return;
+
+ const user = await getSessionUser(req);
+ if (!user) return error(res, 401, 'unauthorized', 'sign in required');
+
+ const token = readCookieToken(req);
+ if (!token) return error(res, 401, 'unauthorized', 'no session cookie');
+
+ const oldHash = await sha256(token);
+ await sql`update sessions set revoked_at = now() where token_hash = ${oldHash} and revoked_at is null`;
+
+ const newSecret = await createSession({
+ userId: user.id,
+ userAgent: req.headers['user-agent'] || null,
+ ip: clientIp(req),
+ });
+
+ res.setHeader('set-cookie', sessionCookie(newSecret));
+ return json(res, 200, { ok: true, rotatedAt: new Date().toISOString() });
+ }
+
+ if (action === 'revoke') {
+ if (cors(req, res, { methods: 'POST,OPTIONS', credentials: true })) return;
+ if (!method(req, res, ['POST'])) return;
+
+ const user = await getSessionUser(req);
+ if (!user) return error(res, 401, 'unauthorized', 'sign in required');
+
+ const body = await readJson(req);
+
+ if (body.all === true) {
+ const revoked = await sql`
+ update sessions set revoked_at = now()
+ where user_id = ${user.id} and revoked_at is null
+ returning id
+ `;
+ res.setHeader('set-cookie', sessionCookie('', { clear: true }));
+ return json(res, 200, { ok: true, revoked: revoked.length });
+ }
+
+ if (body.sessionId) {
+ const revoked = await sql`
+ update sessions set revoked_at = now()
+ where id = ${body.sessionId} and user_id = ${user.id} and revoked_at is null
+ returning id
+ `;
+ if (revoked.length === 0)
+ return error(res, 404, 'not_found', 'session not found or already revoked');
+ return json(res, 200, { ok: true, revoked: revoked.length });
+ }
+
+ return error(res, 400, 'validation_error', 'provide sessionId or all: true');
+ }
+
+ return error(res, 404, 'not_found', 'unknown session action');
+});
diff --git a/api/auth/session/list.js b/api/auth/session/list.js
deleted file mode 100644
index a0a8a0623..000000000
--- a/api/auth/session/list.js
+++ /dev/null
@@ -1,45 +0,0 @@
-import { getSessionUser } from '../../_lib/auth.js';
-import { sha256 } from '../../_lib/crypto.js';
-import { sql } from '../../_lib/db.js';
-import { cors, json, error, method, wrap } from '../../_lib/http.js';
-
-// Reads __Host-sid (or legacy sid) from the cookie header.
-function readCookieToken(req) {
- const cookie = req.headers.cookie || '';
- const m = cookie.match(/(?:^|;\s*)__Host-sid=([^;]+)/) || cookie.match(/(?:^|;\s*)sid=([^;]+)/);
- return m ? decodeURIComponent(m[1]) : null;
-}
-
-// GET /api/auth/session/list
-// Returns all non-revoked sessions for the authenticated user.
-// ipHash is the first 8 hex chars of sha256(ip) — raw IP is never returned.
-export default wrap(async (req, res) => {
- if (cors(req, res, { methods: 'GET,OPTIONS', credentials: true })) return;
- if (!method(req, res, ['GET'])) return;
-
- const user = await getSessionUser(req);
- if (!user) return error(res, 401, 'unauthorized', 'sign in required');
-
- const token = readCookieToken(req);
- const currentHash = token ? await sha256(token) : null;
-
- const rows = await sql`
- select id, created_at, last_seen_at, user_agent, ip, token_hash
- from sessions
- where user_id = ${user.id} and revoked_at is null and expires_at > now()
- order by created_at desc
- `;
-
- const sessions = await Promise.all(
- rows.map(async (s) => ({
- id: s.id,
- createdAt: s.created_at,
- lastUsedAt: s.last_seen_at,
- userAgent: s.user_agent,
- ipHash: s.ip ? (await sha256(s.ip)).slice(0, 8) : null,
- current: currentHash !== null && s.token_hash === currentHash,
- })),
- );
-
- return json(res, 200, { ok: true, sessions });
-});
diff --git a/api/auth/session/refresh.js b/api/auth/session/refresh.js
deleted file mode 100644
index e7e88f7c6..000000000
--- a/api/auth/session/refresh.js
+++ /dev/null
@@ -1,40 +0,0 @@
-import { getSessionUser, createSession, sessionCookie } from '../../_lib/auth.js';
-import { sha256 } from '../../_lib/crypto.js';
-import { sql } from '../../_lib/db.js';
-import { cors, json, error, method, wrap } from '../../_lib/http.js';
-import { clientIp } from '../../_lib/rate-limit.js';
-
-// Reads __Host-sid (or legacy sid) from the cookie header.
-function readCookieToken(req) {
- const cookie = req.headers.cookie || '';
- const m = cookie.match(/(?:^|;\s*)__Host-sid=([^;]+)/) || cookie.match(/(?:^|;\s*)sid=([^;]+)/);
- return m ? decodeURIComponent(m[1]) : null;
-}
-
-// POST /api/auth/session/refresh
-// Rotates the current browser session: revokes the old row, issues a fresh one
-// for the same user, and sets a new __Host-sid cookie.
-// Rate limit: no matching preset in limits.* and getLimiter is not exported —
-// skipped; add limits.sessionRefresh(userId) when available.
-export default wrap(async (req, res) => {
- if (cors(req, res, { methods: 'POST,OPTIONS', credentials: true })) return;
- if (!method(req, res, ['POST'])) return;
-
- const user = await getSessionUser(req);
- if (!user) return error(res, 401, 'unauthorized', 'sign in required');
-
- const token = readCookieToken(req);
- if (!token) return error(res, 401, 'unauthorized', 'no session cookie');
-
- const oldHash = await sha256(token);
- await sql`update sessions set revoked_at = now() where token_hash = ${oldHash} and revoked_at is null`;
-
- const newSecret = await createSession({
- userId: user.id,
- userAgent: req.headers['user-agent'] || null,
- ip: clientIp(req),
- });
-
- res.setHeader('set-cookie', sessionCookie(newSecret));
- return json(res, 200, { ok: true, rotatedAt: new Date().toISOString() });
-});
diff --git a/api/auth/session/revoke.js b/api/auth/session/revoke.js
deleted file mode 100644
index 0d2cf7fbb..000000000
--- a/api/auth/session/revoke.js
+++ /dev/null
@@ -1,39 +0,0 @@
-import { getSessionUser, sessionCookie } from '../../_lib/auth.js';
-import { sql } from '../../_lib/db.js';
-import { cors, json, error, method, wrap, readJson } from '../../_lib/http.js';
-
-// POST /api/auth/session/revoke
-// Body { sessionId: string } — revoke one session owned by the caller.
-// Body { all: true } — revoke every session (including current); clears cookie.
-export default wrap(async (req, res) => {
- if (cors(req, res, { methods: 'POST,OPTIONS', credentials: true })) return;
- if (!method(req, res, ['POST'])) return;
-
- const user = await getSessionUser(req);
- if (!user) return error(res, 401, 'unauthorized', 'sign in required');
-
- const body = await readJson(req);
-
- if (body.all === true) {
- const revoked = await sql`
- update sessions set revoked_at = now()
- where user_id = ${user.id} and revoked_at is null
- returning id
- `;
- res.setHeader('set-cookie', sessionCookie('', { clear: true }));
- return json(res, 200, { ok: true, revoked: revoked.length });
- }
-
- if (body.sessionId) {
- const revoked = await sql`
- update sessions set revoked_at = now()
- where id = ${body.sessionId} and user_id = ${user.id} and revoked_at is null
- returning id
- `;
- if (revoked.length === 0)
- return error(res, 404, 'not_found', 'session not found or already revoked');
- return json(res, 200, { ok: true, revoked: revoked.length });
- }
-
- return error(res, 400, 'validation_error', 'provide sessionId or all: true');
-});
diff --git a/api/pinning/[action].js b/api/pinning/[action].js
new file mode 100644
index 000000000..5ba513c6a
--- /dev/null
+++ b/api/pinning/[action].js
@@ -0,0 +1,231 @@
+import { sql } from '../_lib/db.js';
+import { getSessionUser, authenticateBearer, extractBearer } from '../_lib/auth.js';
+import { cors, json, method, readJson, wrap, error } from '../_lib/http.js';
+import { limits, clientIp } from '../_lib/rate-limit.js';
+
+const MAX_R2_BYTES = 50 * 1024 * 1024;
+const MAX_DATA_URL_BYTES = 10 * 1024 * 1024;
+const CID_RE = /^[a-zA-Z0-9]+$/;
+
+function isOwnedR2Url(url) {
+ const domain = process.env.S3_PUBLIC_DOMAIN;
+ if (!domain) return false;
+ try {
+ const trimmed = domain.replace(/\/$/, '');
+ return url.startsWith(trimmed + '/');
+ } catch {
+ return false;
+ }
+}
+
+async function pinViaPinata(buf, filename) {
+ const form = new FormData();
+ form.append('file', new Blob([buf]), filename);
+ const resp = await fetch('https://api.pinata.cloud/pinning/pinFileToIPFS', {
+ method: 'POST',
+ headers: { Authorization: `Bearer ${process.env.PINATA_JWT}` },
+ body: form,
+ });
+ if (!resp.ok) {
+ const detail = await resp.text().catch(() => '');
+ throw Object.assign(new Error(`Pinata error ${resp.status}`), { status: 502, detail });
+ }
+ const data = await resp.json();
+ return { cid: data.IpfsHash, provider: 'pinata' };
+}
+
+async function pinViaWeb3Storage(buf, filename) {
+ const resp = await fetch('https://api.web3.storage/upload', {
+ method: 'POST',
+ headers: {
+ Authorization: `Bearer ${process.env.WEB3_STORAGE_TOKEN}`,
+ 'X-NAME': filename,
+ },
+ body: buf,
+ });
+ if (!resp.ok) {
+ const detail = await resp.text().catch(() => '');
+ throw Object.assign(new Error(`Web3.Storage error ${resp.status}`), {
+ status: 502,
+ detail,
+ });
+ }
+ const data = await resp.json();
+ return { cid: data.cid, provider: 'web3.storage' };
+}
+
+async function ensurePinsTable() {
+ await sql`
+ create table if not exists pins (
+ id bigserial primary key,
+ user_id text not null,
+ source_url text not null,
+ cid text not null,
+ provider text not null,
+ kind text not null,
+ created_at timestamptz not null default now()
+ )
+ `;
+}
+
+export default wrap(async (req, res) => {
+ const action = req.query?.action;
+
+ if (action === 'pin') {
+ if (cors(req, res, { methods: 'POST,OPTIONS', credentials: true })) return;
+ if (!method(req, res, ['POST'])) return;
+
+ const session = await getSessionUser(req);
+ const bearer = session ? null : await authenticateBearer(extractBearer(req));
+ if (!session && !bearer)
+ return error(res, 401, 'unauthorized', 'sign in or provide a valid bearer token');
+ const userId = session?.id ?? bearer.userId;
+
+ const rl = await limits.pinUser(userId);
+ if (!rl.success) return error(res, 429, 'rate_limited', 'pinning rate exceeded (30/hour)');
+
+ const body = await readJson(req);
+ const { sourceUrl, kind } = body || {};
+
+ if (!sourceUrl || typeof sourceUrl !== 'string') {
+ return error(res, 400, 'validation_error', 'sourceUrl is required');
+ }
+ if (kind !== 'manifest' && kind !== 'glb') {
+ return error(res, 400, 'validation_error', 'kind must be "manifest" or "glb"');
+ }
+
+ const pinataJwt = process.env.PINATA_JWT;
+ const w3sToken = process.env.WEB3_STORAGE_TOKEN;
+ if (!pinataJwt && !w3sToken) {
+ return error(
+ res,
+ 503,
+ 'pinning_unconfigured',
+ 'no pinning provider configured; set PINATA_JWT or WEB3_STORAGE_TOKEN',
+ );
+ }
+
+ let buf;
+ let filename = kind === 'glb' ? 'avatar.glb' : 'manifest.json';
+
+ if (sourceUrl.startsWith('data:')) {
+ const commaIdx = sourceUrl.indexOf(',');
+ if (commaIdx === -1) return error(res, 400, 'validation_error', 'invalid data: URL');
+ const meta = sourceUrl.slice(0, commaIdx);
+ const payload = sourceUrl.slice(commaIdx + 1);
+ buf = meta.includes('base64')
+ ? Buffer.from(payload, 'base64')
+ : Buffer.from(decodeURIComponent(payload));
+ if (buf.byteLength > MAX_DATA_URL_BYTES) {
+ return error(res, 413, 'payload_too_large', 'data: URL content exceeds 10 MB');
+ }
+ } else {
+ if (!isOwnedR2Url(sourceUrl)) {
+ return error(
+ res,
+ 400,
+ 'validation_error',
+ 'sourceUrl must be an owned R2 URL or a data: URL',
+ );
+ }
+ const head = await fetch(sourceUrl, { method: 'HEAD' });
+ if (!head.ok) return error(res, 400, 'validation_error', 'source URL is not accessible');
+ const contentLength = parseInt(head.headers.get('content-length') || '0', 10);
+ if (contentLength > MAX_R2_BYTES) {
+ return error(res, 413, 'payload_too_large', 'source exceeds 50 MB limit');
+ }
+ const fetched = await fetch(sourceUrl);
+ if (!fetched.ok) return error(res, 502, 'fetch_failed', 'failed to fetch source URL');
+ buf = Buffer.from(await fetched.arrayBuffer());
+ const urlPath = new URL(sourceUrl).pathname;
+ filename = urlPath.split('/').pop() || filename;
+ }
+
+ const { cid, provider } = pinataJwt
+ ? await pinViaPinata(buf, filename)
+ : await pinViaWeb3Storage(buf, filename);
+
+ await ensurePinsTable();
+ await sql`
+ insert into pins (user_id, source_url, cid, provider, kind)
+ values (${userId}, ${sourceUrl}, ${cid}, ${provider}, ${kind})
+ `;
+
+ return json(res, 200, {
+ ok: true,
+ cid,
+ gatewayUrl: `https://ipfs.io/ipfs/${cid}`,
+ provider,
+ });
+ }
+
+ if (action === 'status') {
+ if (cors(req, res, { methods: 'GET,OPTIONS' })) return;
+ if (!method(req, res, ['GET'])) return;
+
+ const ip = clientIp(req);
+ const rl = await limits.pinStatusIp(ip);
+ if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
+
+ const cid = req.query?.cid || new URL(req.url, 'http://x').searchParams.get('cid');
+ if (!cid || !CID_RE.test(cid)) {
+ return error(
+ res,
+ 400,
+ 'validation_error',
+ 'cid query parameter is required and must be alphanumeric',
+ );
+ }
+
+ const pinataJwt = process.env.PINATA_JWT;
+ const w3sToken = process.env.WEB3_STORAGE_TOKEN;
+ const checks = [];
+
+ if (pinataJwt) {
+ checks.push(
+ fetch(
+ `https://api.pinata.cloud/data/pinList?hashContains=${encodeURIComponent(cid)}&status=pinned`,
+ { headers: { Authorization: `Bearer ${pinataJwt}` } },
+ )
+ .then(async (r) => {
+ if (!r.ok) return null;
+ const data = await r.json();
+ const pinned = (data.rows || []).some((row) => row.ipfs_pin_hash === cid);
+ return pinned ? 'pinata' : null;
+ })
+ .catch(() => null),
+ );
+ }
+
+ if (w3sToken) {
+ checks.push(
+ fetch(`https://api.web3.storage/status/${encodeURIComponent(cid)}`, {
+ headers: { Authorization: `Bearer ${w3sToken}` },
+ })
+ .then(async (r) => {
+ if (!r.ok) return null;
+ const data = await r.json();
+ return data.cid === cid ? 'web3.storage' : null;
+ })
+ .catch(() => null),
+ );
+ }
+
+ const providerResults = await Promise.all(checks);
+ const activeProviders = providerResults.filter(Boolean);
+ const pinned = activeProviders.length > 0;
+
+ return json(res, 200, {
+ cid,
+ pinned,
+ provider: activeProviders[0] || null,
+ gatewayUrls: [
+ `https://ipfs.io/ipfs/${cid}`,
+ `https://cloudflare-ipfs.com/ipfs/${cid}`,
+ `https://dweb.link/ipfs/${cid}`,
+ ],
+ });
+ }
+
+ return error(res, 404, 'not_found', 'unknown pinning action');
+});
diff --git a/api/pinning/pin.js b/api/pinning/pin.js
deleted file mode 100644
index 10f07bff9..000000000
--- a/api/pinning/pin.js
+++ /dev/null
@@ -1,160 +0,0 @@
-// POST /api/pinning/pin
-// Pins a manifest or GLB to IPFS via Pinata (preferred) or Web3.Storage (fallback).
-// Auth required. Rate-limited to 30/hour per user.
-
-import { sql } from '../_lib/db.js';
-import { getSessionUser, authenticateBearer, extractBearer } from '../_lib/auth.js';
-import { cors, json, method, readJson, wrap, error } from '../_lib/http.js';
-import { limits } from '../_lib/rate-limit.js';
-
-const MAX_R2_BYTES = 50 * 1024 * 1024;
-const MAX_DATA_URL_BYTES = 10 * 1024 * 1024;
-
-function isOwnedR2Url(url) {
- const domain = process.env.S3_PUBLIC_DOMAIN;
- if (!domain) return false;
- try {
- const trimmed = domain.replace(/\/$/, '');
- return url.startsWith(trimmed + '/');
- } catch {
- return false;
- }
-}
-
-async function pinViaPinata(buf, filename) {
- const form = new FormData();
- form.append('file', new Blob([buf]), filename);
- const resp = await fetch('https://api.pinata.cloud/pinning/pinFileToIPFS', {
- method: 'POST',
- headers: { Authorization: `Bearer ${process.env.PINATA_JWT}` },
- body: form,
- });
- if (!resp.ok) {
- const detail = await resp.text().catch(() => '');
- throw Object.assign(new Error(`Pinata error ${resp.status}`), { status: 502, detail });
- }
- const data = await resp.json();
- return { cid: data.IpfsHash, provider: 'pinata' };
-}
-
-async function pinViaWeb3Storage(buf, filename) {
- const resp = await fetch('https://api.web3.storage/upload', {
- method: 'POST',
- headers: {
- Authorization: `Bearer ${process.env.WEB3_STORAGE_TOKEN}`,
- 'X-NAME': filename,
- },
- body: buf,
- });
- if (!resp.ok) {
- const detail = await resp.text().catch(() => '');
- throw Object.assign(new Error(`Web3.Storage error ${resp.status}`), {
- status: 502,
- detail,
- });
- }
- const data = await resp.json();
- return { cid: data.cid, provider: 'web3.storage' };
-}
-
-async function ensurePinsTable() {
- await sql`
- create table if not exists pins (
- id bigserial primary key,
- user_id text not null,
- source_url text not null,
- cid text not null,
- provider text not null,
- kind text not null,
- created_at timestamptz not null default now()
- )
- `;
-}
-
-export default wrap(async (req, res) => {
- if (cors(req, res, { methods: 'POST,OPTIONS', credentials: true })) return;
- if (!method(req, res, ['POST'])) return;
-
- const session = await getSessionUser(req);
- const bearer = session ? null : await authenticateBearer(extractBearer(req));
- if (!session && !bearer)
- return error(res, 401, 'unauthorized', 'sign in or provide a valid bearer token');
- const userId = session?.id ?? bearer.userId;
-
- const rl = await limits.pinUser(userId);
- if (!rl.success) return error(res, 429, 'rate_limited', 'pinning rate exceeded (30/hour)');
-
- const body = await readJson(req);
- const { sourceUrl, kind } = body || {};
-
- if (!sourceUrl || typeof sourceUrl !== 'string') {
- return error(res, 400, 'validation_error', 'sourceUrl is required');
- }
- if (kind !== 'manifest' && kind !== 'glb') {
- return error(res, 400, 'validation_error', 'kind must be "manifest" or "glb"');
- }
-
- const pinataJwt = process.env.PINATA_JWT;
- const w3sToken = process.env.WEB3_STORAGE_TOKEN;
- if (!pinataJwt && !w3sToken) {
- return error(
- res,
- 503,
- 'pinning_unconfigured',
- 'no pinning provider configured; set PINATA_JWT or WEB3_STORAGE_TOKEN',
- );
- }
-
- let buf;
- let filename = kind === 'glb' ? 'avatar.glb' : 'manifest.json';
-
- if (sourceUrl.startsWith('data:')) {
- const commaIdx = sourceUrl.indexOf(',');
- if (commaIdx === -1) return error(res, 400, 'validation_error', 'invalid data: URL');
- const meta = sourceUrl.slice(0, commaIdx);
- const payload = sourceUrl.slice(commaIdx + 1);
- buf = meta.includes('base64')
- ? Buffer.from(payload, 'base64')
- : Buffer.from(decodeURIComponent(payload));
- if (buf.byteLength > MAX_DATA_URL_BYTES) {
- return error(res, 413, 'payload_too_large', 'data: URL content exceeds 10 MB');
- }
- } else {
- if (!isOwnedR2Url(sourceUrl)) {
- return error(
- res,
- 400,
- 'validation_error',
- 'sourceUrl must be an owned R2 URL or a data: URL',
- );
- }
- const head = await fetch(sourceUrl, { method: 'HEAD' });
- if (!head.ok) return error(res, 400, 'validation_error', 'source URL is not accessible');
- const contentLength = parseInt(head.headers.get('content-length') || '0', 10);
- if (contentLength > MAX_R2_BYTES) {
- return error(res, 413, 'payload_too_large', 'source exceeds 50 MB limit');
- }
- const fetched = await fetch(sourceUrl);
- if (!fetched.ok) return error(res, 502, 'fetch_failed', 'failed to fetch source URL');
- buf = Buffer.from(await fetched.arrayBuffer());
- const urlPath = new URL(sourceUrl).pathname;
- filename = urlPath.split('/').pop() || filename;
- }
-
- const { cid, provider } = pinataJwt
- ? await pinViaPinata(buf, filename)
- : await pinViaWeb3Storage(buf, filename);
-
- await ensurePinsTable();
- await sql`
- insert into pins (user_id, source_url, cid, provider, kind)
- values (${userId}, ${sourceUrl}, ${cid}, ${provider}, ${kind})
- `;
-
- return json(res, 200, {
- ok: true,
- cid,
- gatewayUrl: `https://ipfs.io/ipfs/${cid}`,
- provider,
- });
-});
diff --git a/api/pinning/status.js b/api/pinning/status.js
deleted file mode 100644
index e608c7b06..000000000
--- a/api/pinning/status.js
+++ /dev/null
@@ -1,77 +0,0 @@
-// GET /api/pinning/status?cid=...
-// Public endpoint — checks pin status across configured providers.
-// Rate-limited to 60/min per IP.
-
-import { cors, json, method, wrap, error } from '../_lib/http.js';
-import { limits, clientIp } from '../_lib/rate-limit.js';
-
-const CID_RE = /^[a-zA-Z0-9]+$/;
-
-export default wrap(async (req, res) => {
- if (cors(req, res, { methods: 'GET,OPTIONS' })) return;
- if (!method(req, res, ['GET'])) return;
-
- const ip = clientIp(req);
- const rl = await limits.pinStatusIp(ip);
- if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
-
- const cid = req.query?.cid || new URL(req.url, 'http://x').searchParams.get('cid');
- if (!cid || !CID_RE.test(cid)) {
- return error(
- res,
- 400,
- 'validation_error',
- 'cid query parameter is required and must be alphanumeric',
- );
- }
-
- const pinataJwt = process.env.PINATA_JWT;
- const w3sToken = process.env.WEB3_STORAGE_TOKEN;
-
- const checks = [];
-
- if (pinataJwt) {
- checks.push(
- fetch(
- `https://api.pinata.cloud/data/pinList?hashContains=${encodeURIComponent(cid)}&status=pinned`,
- { headers: { Authorization: `Bearer ${pinataJwt}` } },
- )
- .then(async (r) => {
- if (!r.ok) return null;
- const data = await r.json();
- const pinned = (data.rows || []).some((row) => row.ipfs_pin_hash === cid);
- return pinned ? 'pinata' : null;
- })
- .catch(() => null),
- );
- }
-
- if (w3sToken) {
- checks.push(
- fetch(`https://api.web3.storage/status/${encodeURIComponent(cid)}`, {
- headers: { Authorization: `Bearer ${w3sToken}` },
- })
- .then(async (r) => {
- if (!r.ok) return null;
- const data = await r.json();
- return data.cid === cid ? 'web3.storage' : null;
- })
- .catch(() => null),
- );
- }
-
- const providerResults = await Promise.all(checks);
- const activeProviders = providerResults.filter(Boolean);
- const pinned = activeProviders.length > 0;
-
- return json(res, 200, {
- cid,
- pinned,
- provider: activeProviders[0] || null,
- gatewayUrls: [
- `https://ipfs.io/ipfs/${cid}`,
- `https://cloudflare-ipfs.com/ipfs/${cid}`,
- `https://dweb.link/ipfs/${cid}`,
- ],
- });
-});
diff --git a/home.html b/home.html
index 29c00a84b..c744b9c0d 100644
--- a/home.html
+++ b/home.html
@@ -139,9 +139,9 @@
</div>
<h2 class="h-title h-reveal">Give your AI<br />a <em>body</em>.</h2>
<p class="h-subtitle h-reveal">
- Drop a 3D model. Add a brain. Embed it anywhere.
- Your agent gets a face — and an identity
- every A2A or MCP client can verify on-chain.
+ Born in 3D. Raised on-chain. Yours forever.
+ Your AI has been a chatbox long enough — give it a body, a personality,
+ and a permanent home open to every human, app, and agent that comes looking.
</p>
<div class="h-cta-row h-reveal">
<a href="/create" class="h-btn-primary">
diff --git a/package.json b/package.json
index 372780238..b571717ac 100644
--- a/package.json
+++ b/package.json
@@ -9,6 +9,9 @@
"overrides": {
"serialize-javascript": ">=7.0.5"
},
+ "engines": {
+ "node": ">=20.0.0"
+ },
"keywords": [
"3d-viewer",
"gltf-viewer",
diff --git a/public/agent-edit/index.html b/public/agent-edit/index.html
index a278dada2..ebf8f7d24 100644
--- a/public/agent-edit/index.html
+++ b/public/agent-edit/index.html
@@ -543,7 +543,7 @@
<body>
<header>
<div class="header-left">
- <a class="brand" href="/">three.ws</a>
+ <a class="brand" href="/"><img src="/three.svg" alt="" class="header-logo" aria-hidden="true" />three.ws</a>
<span class="header-title" id="header-title">Edit Persona</span>
</div>
<div class="header-actions">
diff --git a/public/agents/index.html b/public/agents/index.html
index d7aeac0fd..f9c8f24d3 100644
--- a/public/agents/index.html
+++ b/public/agents/index.html
@@ -343,6 +343,7 @@
</head>
<body>
<header>
+ <a href="/" class="brand"><img src="/three.svg" alt="" class="header-logo" aria-hidden="true" />three.ws</a>
<h1>Agent Directory</h1>
<p>Discover registered agents across the ecosystem</p>
</header>
diff --git a/public/auth.css b/public/auth.css
index 3ca7430a5..520c607de 100644
--- a/public/auth.css
+++ b/public/auth.css
@@ -1,6 +1,10 @@
/* Shared auth-page styling: shell layout, avatar panel, password toggle,
caps-lock warning, remember-me row, inline-validation hints. */
+[hidden] {
+ display: none !important;
+}
+
* { box-sizing: border-box; }
body {
diff --git a/public/cz/cz.css b/public/cz/cz.css
index 4ebf7601a..07e8f5d42 100644
--- a/public/cz/cz.css
+++ b/public/cz/cz.css
@@ -1,3 +1,7 @@
+[hidden] {
+ display: none !important;
+}
+
:root {
color-scheme: dark;
--accent: #f0b429;
diff --git a/public/cz/index.html b/public/cz/index.html
index c3dd8a5e1..6b216a166 100644
--- a/public/cz/index.html
+++ b/public/cz/index.html
@@ -16,7 +16,7 @@
</head>
<body>
<header>
- <span class="logo">⬡ three.ws</span>
+ <span class="logo"><img src="/three.svg" alt="" class="header-logo" aria-hidden="true" />three.ws</span>
</header>
<main>
<div class="agent-wrap">
diff --git a/public/dashboard/sessions.html b/public/dashboard/sessions.html
index 0a4dcddcd..0092e0744 100644
--- a/public/dashboard/sessions.html
+++ b/public/dashboard/sessions.html
@@ -191,7 +191,7 @@
</head>
<body data-auth-pending>
<header>
- <div class="brand"><a href="/">three.ws</a></div>
+ <div class="brand"><a href="/"><img src="/three.svg" alt="" class="header-logo" aria-hidden="true" />three.ws</a></div>
<button class="btn sec" onclick="signOut()">Sign out</button>
</header>
<main>
diff --git a/public/dashboard/wallets.html b/public/dashboard/wallets.html
index 8676ed61a..e0ad5f789 100644
--- a/public/dashboard/wallets.html
+++ b/public/dashboard/wallets.html
@@ -182,7 +182,7 @@
</head>
<body data-auth-pending>
<header>
- <div class="brand"><a href="/">three.ws</a></div>
+ <div class="brand"><a href="/"><img src="/three.svg" alt="" class="header-logo" aria-hidden="true" />three.ws</a></div>
<div class="row">
<a href="/dashboard" class="muted" style="font-size:13px">← Dashboard</a>
<span class="muted" id="user-email"></span>
diff --git a/public/discover/index.html b/public/discover/index.html
index 7b5257bd9..cddc153c5 100644
--- a/public/discover/index.html
+++ b/public/discover/index.html
@@ -39,7 +39,7 @@
<body class="features-page explore-page">
<header>
<h1>
- <a href="/"><span class="wordmark-dot" aria-hidden="true"></span>three.ws</a>
+ <a href="/"><img src="/three.svg" alt="three.ws" class="header-logo" /></a>
</h1>
<nav class="features-nav">
<a href="/app">Viewer</a>
diff --git a/public/forgot-password.html b/public/forgot-password.html
index 41a52ccad..b0d757692 100644
--- a/public/forgot-password.html
+++ b/public/forgot-password.html
@@ -5,134 +5,94 @@
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Forgot password · three.ws</title>
<link rel="icon" href="/favicon.ico" />
+ <link rel="stylesheet" href="/auth.css" />
<script
type="module"
src="https://ajax.googleapis.com/ajax/libs/model-viewer/4.0.0/model-viewer.min.js"
></script>
<style>
- :root {
- color-scheme: dark;
- --accent: #6a5cff;
- --accent2: #ff5ca8;
- }
- * {
- box-sizing: border-box;
- }
- body {
- font:
- 15px/1.5 -apple-system,
- system-ui,
- Segoe UI,
- Roboto,
- sans-serif;
- background: radial-gradient(1200px 600px at 50% -100px, #1a1a2e 0, #080814 60%);
- color: #eee;
- margin: 0;
- min-height: 100vh;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 24px;
- }
- a {
- color: #9a8cff;
- }
+ :root { color-scheme: dark; }
+ body { background: #000; color: #f0f0f0; }
+ a { color: #c8d0e0; text-decoration: none; }
+ a:hover { color: #fff; }
.shell {
- display: flex;
- width: 100%;
- max-width: 1080px;
- min-height: 640px;
- border-radius: 24px;
- overflow: hidden;
- background: #14141c;
- border: 1px solid #2a2a36;
- box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
- }
- .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.6), transparent 60%),
- radial-gradient(120% 90% at 80% 90%, rgba(255, 92, 168, 0.4), 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;
+ background: #0c0c0c;
+ border: 1px solid rgba(255, 255, 255, 0.08);
+ box-shadow:
+ 0 0 0 1px rgba(255, 255, 255, 0.03),
+ 0 30px 80px rgba(0, 0, 0, 0.85),
+ 0 0 120px rgba(200, 210, 255, 0.04);
}
.card {
- background: #14141c;
+ background: #0c0c0c;
border: 0;
border-radius: 0;
padding: 56px 56px;
flex: 1;
width: 100%;
max-width: 520px;
- box-shadow: none;
display: flex;
flex-direction: column;
justify-content: center;
overflow-y: auto;
}
@media (max-width: 860px) {
- .shell {
- flex-direction: column;
- min-height: 0;
- }
- .panel {
- min-height: 220px;
- order: -1;
- }
- .agent-avatar {
- width: 180px;
- height: 180px;
- }
- .card {
- padding: 32px 28px;
- max-width: none;
- }
+ .card { padding: 32px 28px; max-width: none; }
}
h1 {
font-size: 22px;
+ font-weight: 600;
margin: 0 0 4px;
- letter-spacing: -0.01em;
+ letter-spacing: -0.02em;
+ color: #fff;
}
.sub {
color: #888;
- margin: 0 0 24px;
+ margin: 0 0 22px;
font-size: 14px;
}
+ .brand {
+ margin: 0 0 18px;
+ text-decoration: none;
+ display: inline-block;
+ opacity: 0.85;
+ transition: opacity 0.15s;
+ }
+ .brand img { height: 40px; width: auto; display: block; }
+ .brand:hover { opacity: 1; }
label {
display: block;
- font-size: 13px;
- color: #aaa;
- margin: 14px 0 6px;
+ font-size: 12px;
+ font-weight: 500;
+ letter-spacing: 0.02em;
+ color: #666;
+ margin: 16px 0 6px;
+ text-transform: uppercase;
+ transition: color 0.1s ease;
}
+ label.lit { color: #bbb; }
input {
width: 100%;
- padding: 11px 13px;
- background: #0f0f17;
- border: 1px solid #2a2a36;
- border-radius: 9px;
- color: #eee;
+ padding: 11px 14px;
+ background: #060606;
+ border: 1px solid rgba(255, 255, 255, 0.07);
+ border-radius: 10px;
+ color: #f0f0f0;
font-size: 15px;
+ transition: border-color 0.08s ease, box-shadow 0.08s ease, background 0.08s ease;
}
+ input::placeholder { color: #333; }
input:focus {
outline: none;
- border-color: var(--accent);
- box-shadow: 0 0 0 3px rgba(106, 92, 255, 0.15);
+ border-color: rgba(255, 255, 255, 0.45);
+ box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
+ background: #080808;
+ }
+ .field-hint {
+ font-size: 12px;
+ margin-top: 4px;
+ color: #555;
+ transition: color 0.15s;
}
button {
width: 100%;
@@ -140,23 +100,24 @@
padding: 12px 16px;
border: 0;
border-radius: 10px;
- background: linear-gradient(135deg, var(--accent), var(--accent2));
- color: #fff;
+ background: #fff;
+ color: #000;
font-weight: 600;
font-size: 15px;
cursor: pointer;
+ letter-spacing: -0.01em;
+ transition: background 0.15s, opacity 0.15s, transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1);
}
- button:disabled {
- opacity: 0.6;
- cursor: default;
- }
+ button:hover:not(:disabled) { background: #e8ecf4; }
+ button:active:not(:disabled) { transform: scale(0.965); }
+ button:disabled { opacity: 0.35; cursor: default; }
.err {
margin-top: 14px;
padding: 10px 12px;
- background: rgba(255, 92, 92, 0.1);
- border: 1px solid rgba(255, 92, 92, 0.3);
+ background: rgba(255, 255, 255, 0.04);
+ border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 8px;
- color: #ffb3b3;
+ color: #aaa;
font-size: 13px;
display: none;
}
@@ -170,43 +131,38 @@
font-size: 13px;
}
.foot {
- margin-top: 20px;
+ margin-top: 22px;
text-align: center;
font-size: 13px;
- color: #888;
- }
- .brand {
- font-size: 12px;
- letter-spacing: 0.1em;
- text-transform: uppercase;
- color: var(--accent);
- margin: 0 0 8px;
+ color: #666;
}
</style>
</head>
<body>
<div class="shell">
<form class="card" id="f">
- <p class="brand">three.ws</p>
- <h1>Forgot password</h1>
- <p class="sub">Enter your email and we'll send you a reset link.</p>
- <label for="email">Email</label>
- <input
- id="email"
- type="email"
- autocomplete="email"
- required
- aria-describedby="email-hint"
- />
- <button id="submit" type="submit">Send reset link</button>
- <div class="err" id="err" role="alert"></div>
- <div class="ok" id="ok" style="display:none">
- If an account exists for that email, a reset link has been sent.
- </div>
- <p class="foot"><a href="/login">Back to sign in</a></p>
- </form>
- <div class="panel" aria-hidden="true">
- <div class="agent-avatar">
+ <a href="/" class="brand"><img src="/three.svg" alt="three.ws" /></a>
+ <h1>Forgot password</h1>
+ <p class="sub">Enter your email and we'll send you a reset link.</p>
+ <label for="email">Email</label>
+ <input
+ id="email"
+ type="email"
+ autocomplete="email"
+ required
+ aria-describedby="email-hint"
+ />
+ <p class="field-hint" id="email-hint">We'll send you a link to reset your password.</p>
+ <button id="submit" type="submit">Send reset link</button>
+ <div class="err" id="err" role="alert"></div>
+ <div class="ok" id="ok" style="display:none">
+ If an account exists for that email, a reset link has been sent.
+ </div>
+ <p class="foot"><a href="/login">Back to sign in</a></p>
+ </form>
+ <div class="panel">
+ <a href="/" class="panel-brand" aria-label="three.ws home">three.ws</a>
+ <div class="agent-avatar loading" id="forgot-avatar-wrap" aria-hidden="true">
<model-viewer
id="forgot-avatar"
src="/avatars/cz.glb"
@@ -228,27 +184,38 @@
</div>
</div>
<script>
+ // Avatar look-around + parallax + skeleton
(function () {
const viewer = document.getElementById('forgot-avatar');
+ const wrap = document.getElementById('forgot-avatar-wrap');
if (!viewer) return;
+ viewer.addEventListener('load', () => wrap?.classList.remove('loading'));
+ const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
const BASE_AZ = 0, BASE_POL = 88, AZ_RANGE = 30, POL_RANGE = 14;
let targetAz = BASE_AZ, targetPol = BASE_POL;
let curAz = BASE_AZ, curPol = BASE_POL;
+ let targetTx = 0, targetTy = 0, curTx = 0, curTy = 0;
let nod = 0;
const lerp = (a, b, t) => a + (b - a) * t;
function tick() {
curAz = lerp(curAz, targetAz, 0.1);
curPol = lerp(curPol, targetPol + nod, 0.18);
+ curTx = lerp(curTx, targetTx, 0.08);
+ curTy = lerp(curTy, targetTy, 0.08);
nod *= 0.85;
viewer.setAttribute('camera-orbit', `${curAz}deg ${curPol}deg 4.8m`);
+ if (wrap) wrap.style.transform = `translate(${curTx.toFixed(2)}px, ${curTy.toFixed(2)}px)`;
requestAnimationFrame(tick);
}
+ if (reducedMotion) return;
requestAnimationFrame(tick);
window.addEventListener('mousemove', (e) => {
const nx = e.clientX / window.innerWidth - 0.5;
const ny = e.clientY / window.innerHeight - 0.5;
targetAz = BASE_AZ - nx * AZ_RANGE * 2;
targetPol = BASE_POL + ny * POL_RANGE * 2;
+ targetTx = -nx * 10;
+ targetTy = -ny * 8;
}, { passive: true });
document.querySelectorAll('#f input').forEach((el) => {
el.addEventListener('keydown', (e) => {
@@ -258,6 +225,36 @@
});
});
})();
+
+ // Inline email validation hint
+ (function () {
+ const input = document.getElementById('email');
+ const hint = document.getElementById('email-hint');
+ if (!input || !hint) return;
+ const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
+ input.addEventListener('input', () => {
+ const v = input.value.trim();
+ if (!v) {
+ hint.classList.remove('valid', 'invalid');
+ hint.textContent = "We'll send you a link to reset your password.";
+ } else if (re.test(v)) {
+ hint.classList.add('valid'); hint.classList.remove('invalid');
+ hint.textContent = '✓ Looks valid';
+ } else {
+ hint.classList.add('invalid'); hint.classList.remove('valid');
+ hint.textContent = 'Enter a valid email address.';
+ }
+ });
+ })();
+
+ // Label "lit" on focus
+ document.querySelectorAll('#f input').forEach((input) => {
+ const label = document.querySelector(`label[for="${input.id}"]`);
+ if (!label) return;
+ input.addEventListener('focus', () => label.classList.add('lit'));
+ input.addEventListener('blur', () => label.classList.remove('lit'));
+ });
+
const form = document.getElementById('f');
const err = document.getElementById('err');
const ok = document.getElementById('ok');
@@ -276,10 +273,8 @@
email: document.getElementById('email').value,
}),
});
- // Anti-enumeration: always show the same success message.
ok.style.display = 'block';
} catch {
- // Even on network failure we keep the same message to avoid leaking signal.
ok.style.display = 'block';
} finally {
btn.disabled = false;
diff --git a/public/legal/privacy.html b/public/legal/privacy.html
index 2683399d2..8db550c43 100644
--- a/public/legal/privacy.html
+++ b/public/legal/privacy.html
@@ -33,7 +33,7 @@
</head>
<body>
<div class="wrap">
- <a class="brand" href="/">three.ws</a>
+ <a class="brand" href="/"><img src="/three.svg" alt="" class="header-logo" aria-hidden="true" />three.ws</a>
<h1>Privacy Policy</h1>
<p class="meta">Effective: April 27, 2026 &nbsp;·&nbsp; <a href="/legal/tos.html">Terms of Service</a></p>
diff --git a/public/legal/tos.html b/public/legal/tos.html
index b2d7792d6..3a95dda45 100644
--- a/public/legal/tos.html
+++ b/public/legal/tos.html
@@ -30,7 +30,7 @@
</head>
<body>
<div class="wrap">
- <a class="brand" href="/">three.ws</a>
+ <a class="brand" href="/"><img src="/three.svg" alt="" class="header-logo" aria-hidden="true" />three.ws</a>
<h1>Terms of Service</h1>
<p class="meta">Effective: April 27, 2026 &nbsp;·&nbsp; <a href="/legal/privacy.html">Privacy Policy</a></p>
diff --git a/public/login.html b/public/login.html
index 06ca736f4..6db67c870 100644
--- a/public/login.html
+++ b/public/login.html
@@ -280,7 +280,39 @@
transform: scale(0.97);
}
.method-panel { display: none; }
- .method-panel.active { display: block; }
+ .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); }
+ }
+ .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;
+ }
+ }
/* ── Password field ── */
.password-wrap {
@@ -420,7 +452,7 @@
<div id="email-panel" class="method-panel active" role="tabpanel">
<label for="email">Email or username</label>
- <input id="email" name="username" type="text" autocomplete="username email" required aria-describedby="email-err" />
+ <input id="email" name="username" type="text" inputmode="email" autocapitalize="none" autocomplete="username email" autofocus required aria-describedby="email-err" />
<p class="field-err" id="email-err" role="alert"></p>
<label for="password">Password</label>
@@ -511,7 +543,8 @@
wallet: document.getElementById('wallet-panel'),
};
let activeMethod = 'email';
- function setMethod(name) {
+ const METHOD_KEY = '3dagent:login-method';
+ function setMethod(name, persist = true) {
if (!methodPanels[name]) return;
activeMethod = name;
methodTabs.forEach((t) => {
@@ -526,14 +559,29 @@
const emailActive = name === 'email';
emailInput.required = emailActive;
passwordInput.required = emailActive;
+ if (persist) {
+ try { localStorage.setItem(METHOD_KEY, name); } catch { /* ignore */ }
+ }
+ if (emailActive && !emailInput.value) emailInput.focus();
}
methodTabs.forEach((t) =>
t.addEventListener('click', () => setMethod(t.dataset.method)),
);
+ try {
+ const saved = localStorage.getItem(METHOD_KEY);
+ if (saved === 'wallet') setMethod('wallet', false);
+ } catch { /* ignore */ }
// ── Wallet chain tabs ──
+ 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;
@@ -580,16 +628,31 @@
emailInput.addEventListener('input', () => setFieldError(emailInput, emailErr, ''));
passwordInput.addEventListener('input', () => setFieldError(passwordInput, passwordErr, ''));
- // ── Label "lit" on focus ──
+ // ── Label "lit" on focus + mobile scroll-into-view ──
+ const isTouch = matchMedia('(hover: none)').matches;
document.querySelectorAll('#f input').forEach((input) => {
const label = document.querySelector(`label[for="${input.id}"]`);
- if (!label) return;
- input.addEventListener('focus', () => label.classList.add('lit'));
- input.addEventListener('blur', () => label.classList.remove('lit'));
+ input.addEventListener('focus', () => {
+ if (label) label.classList.add('lit');
+ if (isTouch) {
+ setTimeout(() => input.scrollIntoView({ block: 'center', behavior: 'smooth' }), 250);
+ }
+ });
+ if (label) input.addEventListener('blur', () => label.classList.remove('lit'));
});
- // ── Auth redirect ──
+ // ── Email prefill ──
const params = new URLSearchParams(location.search);
+ const LAST_EMAIL_KEY = '3dagent:last-email';
+ const prefillEmail = params.get('email') || (() => {
+ try { return localStorage.getItem(LAST_EMAIL_KEY) || ''; } catch { return ''; }
+ })();
+ if (prefillEmail) {
+ emailInput.value = prefillEmail;
+ passwordInput.focus();
+ }
+
+ // ── Auth redirect ──
const next =
params.get('next') || sessionStorage.getItem('login_redirect') || '/create';
sessionStorage.removeItem('login_redirect');
@@ -632,9 +695,16 @@
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ email, password, remember: document.getElementById('remember')?.checked || false }),
});
- const data = await res.json();
- if (!res.ok) throw new Error(data.error_description || 'Sign-in failed');
+ const data = await res.json().catch(() => ({}));
+ if (!res.ok) {
+ const err429 = res.status === 429;
+ const msg = err429
+ ? 'Too many attempts. Try again in a moment.'
+ : 'Email or password is incorrect.';
+ throw new Error(msg);
+ }
try {
+ localStorage.setItem(LAST_EMAIL_KEY, email);
localStorage.setItem(
'3dagent:auth-hint',
JSON.stringify({
diff --git a/public/my-agents/index.html b/public/my-agents/index.html
index d3e52c1a9..84666446d 100644
--- a/public/my-agents/index.html
+++ b/public/my-agents/index.html
@@ -12,7 +12,7 @@
</head>
<body>
<header class="my-agents-header">
- <div class="my-agents-header__brand"><a href="/">three.ws</a></div>
+ <div class="my-agents-header__brand"><a href="/"><img src="/three.svg" alt="" class="header-logo" aria-hidden="true" />three.ws</a></div>
<nav class="my-agents-header__nav" aria-label="Page navigation">
<a href="/app">Viewer</a>
<a href="/create">Create</a>
diff --git a/public/my-agents/my-agents.css b/public/my-agents/my-agents.css
index fdb02ed47..d06747ce6 100644
--- a/public/my-agents/my-agents.css
+++ b/public/my-agents/my-agents.css
@@ -1,5 +1,9 @@
/* my-agents.css — My on-chain agents page styles */
+[hidden] {
+ display: none !important;
+}
+
/* ── Design tokens (mirrored from dashboard) ─────────────────────────── */
:root {
color-scheme: dark;
diff --git a/public/register.html b/public/register.html
index 4c7d9726f..df216a6d9 100644
--- a/public/register.html
+++ b/public/register.html
@@ -323,7 +323,7 @@
<body>
<div class="shell">
<form class="card" id="f">
- <a href="/" class="brand">three.ws</a>
+ <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>
@@ -382,7 +382,7 @@
<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>
<div class="panel">
- <a href="/" class="panel-brand" aria-label="three.ws home">three.ws</a>
+ <a href="/" class="panel-brand" aria-label="three.ws home"><img src="/three.svg" alt="" class="header-logo" aria-hidden="true" />three.ws</a>
<div class="agent-avatar loading" id="register-avatar-wrap" aria-hidden="true">
<model-viewer
id="register-avatar"
@@ -408,28 +408,38 @@
<script type="module" src="/wallet-login.js"></script>
<script>
- // Avatar mouse tracking
+ // Avatar mouse tracking + parallax + skeleton
(function () {
const viewer = document.getElementById('register-avatar');
+ const wrap = document.getElementById('register-avatar-wrap');
if (!viewer) return;
+ viewer.addEventListener('load', () => wrap?.classList.remove('loading'));
+ const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
const BASE_AZ = 0, BASE_POL = 88, AZ_RANGE = 30, POL_RANGE = 14;
let targetAz = BASE_AZ, targetPol = BASE_POL;
let curAz = BASE_AZ, curPol = BASE_POL;
+ let targetTx = 0, targetTy = 0, curTx = 0, curTy = 0;
let nod = 0;
const lerp = (a, b, t) => a + (b - a) * t;
function tick() {
curAz = lerp(curAz, targetAz, 0.1);
curPol = lerp(curPol, targetPol + nod, 0.18);
+ curTx = lerp(curTx, targetTx, 0.08);
+ curTy = lerp(curTy, targetTy, 0.08);
nod *= 0.85;
viewer.setAttribute('camera-orbit', `${curAz}deg ${curPol}deg 4.8m`);
+ if (wrap) wrap.style.transform = `translate(${curTx.toFixed(2)}px, ${curTy.toFixed(2)}px)`;
requestAnimationFrame(tick);
}
+ if (reducedMotion) return;
requestAnimationFrame(tick);
window.addEventListener('mousemove', (e) => {
const nx = e.clientX / window.innerWidth - 0.5;
const ny = e.clientY / window.innerHeight - 0.5;
targetAz = BASE_AZ - nx * AZ_RANGE * 2;
targetPol = BASE_POL + ny * POL_RANGE * 2;
+ targetTx = -nx * 10;
+ targetTy = -ny * 8;
}, { passive: true });
document.querySelectorAll('#f input').forEach((el) => {
el.addEventListener('keydown', (e) => {
@@ -440,6 +450,54 @@
});
})();
+ // Password show/hide toggle
+ (function () {
+ const pw = document.getElementById('password');
+ const tog = document.getElementById('password-toggle');
+ if (!pw || !tog) return;
+ tog.addEventListener('click', () => {
+ const show = pw.type === 'password';
+ pw.type = show ? 'text' : 'password';
+ tog.setAttribute('aria-pressed', show ? 'true' : 'false');
+ tog.setAttribute('aria-label', show ? 'Hide password' : 'Show password');
+ });
+ })();
+
+ // Caps Lock warning on password
+ (function () {
+ const pw = document.getElementById('password');
+ const warn = document.getElementById('caps-warn');
+ if (!pw || !warn) return;
+ function check(e) {
+ const on = e.getModifierState && e.getModifierState('CapsLock');
+ warn.classList.toggle('show', !!on);
+ }
+ pw.addEventListener('keydown', check);
+ pw.addEventListener('keyup', check);
+ pw.addEventListener('blur', () => warn.classList.remove('show'));
+ })();
+
+ // Inline username validation
+ (function () {
+ const u = document.getElementById('username');
+ const hint = document.getElementById('username-hint');
+ if (!u || !hint) return;
+ const re = /^[a-zA-Z0-9_-]{3,30}$/;
+ u.addEventListener('input', () => {
+ const v = u.value;
+ if (!v) { hint.classList.remove('valid', 'invalid'); hint.textContent = '3–30 characters, letters, numbers, _ or -'; return; }
+ if (re.test(v)) {
+ hint.classList.add('valid'); hint.classList.remove('invalid');
+ hint.textContent = '✓ Looks good';
+ } else {
+ hint.classList.add('invalid'); hint.classList.remove('valid');
+ if (v.length < 3) hint.textContent = 'Too short — 3 characters minimum.';
+ else if (v.length > 30) hint.textContent = 'Too long — 30 characters maximum.';
+ else hint.textContent = 'Only letters, numbers, _ and - allowed.';
+ }
+ });
+ })();
+
// Password strength indicator
(function () {
const pw = document.getElementById('password');
diff --git a/public/reputation/index.html b/public/reputation/index.html
index ff0951486..f7d3f69b4 100644
--- a/public/reputation/index.html
+++ b/public/reputation/index.html
@@ -393,6 +393,13 @@
</div>
</main>
+ <script type="importmap">
+ {
+ "imports": {
+ "ethers": "https://esm.sh/[email protected]"
+ }
+ }
+ </script>
<script type="module" src="./reputation.js"></script>
</body>
</html>
diff --git a/public/reset-password.html b/public/reset-password.html
index 9f35d2eb6..be45abf63 100644
--- a/public/reset-password.html
+++ b/public/reset-password.html
@@ -128,7 +128,7 @@
</head>
<body>
<form class="card" id="f">
- <p class="brand">three.ws</p>
+ <p class="brand"><img src="/three.svg" alt="" class="header-logo" aria-hidden="true" />three.ws</p>
<h1>Reset password</h1>
<p class="sub">Choose a new password for your account.</p>
<label for="password">New password</label>
@@ -156,7 +156,7 @@
<p class="foot"><a href="/login">Back to sign in</a></p>
</form>
<div class="card" id="done" style="display:none">
- <p class="brand">three.ws</p>
+ <p class="brand"><img src="/three.svg" alt="" class="header-logo" aria-hidden="true" />three.ws</p>
<h1>Password reset</h1>
<div class="ok">Password reset. You can now log in.</div>
<p class="foot"><a href="/login">Go to sign in</a></p>
diff --git a/public/studio/studio.css b/public/studio/studio.css
index 712f81cda..214300060 100644
--- a/public/studio/studio.css
+++ b/public/studio/studio.css
@@ -2,6 +2,10 @@
tokens so it does not depend on /style.css being served at the root
(the deployed build hashes that file under /assets/). */
+[hidden] {
+ display: none !important;
+}
+
:root {
--space-3xs: 0.146rem;
--space-2xs: 0.236rem;
diff --git a/public/validation/index.html b/public/validation/index.html
index 78a1dd66a..3bc9d2376 100644
--- a/public/validation/index.html
+++ b/public/validation/index.html
@@ -394,7 +394,7 @@
</head>
<body>
<header>
- <div class="brand"><a href="/">three.ws</a></div>
+ <div class="brand"><a href="/"><img src="/three.svg" alt="" class="header-logo" aria-hidden="true" />three.ws</a></div>
<nav>
<a href="/">Home</a>
<a href="/dashboard">Dashboard</a>
@@ -488,7 +488,7 @@
</div>
<script type="module">
- const { ValidationDashboard } = await import(/* @vite-ignore */ '/validation/boot.js');
+ import { ValidationDashboard } from '/src/validation-ui.js';
const dashboard = new ValidationDashboard(document.getElementById('main'), {
agentInput: document.getElementById('agent-input'),
diff --git a/public/widgets-gallery/gallery.css b/public/widgets-gallery/gallery.css
index 201fe0196..dee8823f9 100644
--- a/public/widgets-gallery/gallery.css
+++ b/public/widgets-gallery/gallery.css
@@ -1,5 +1,9 @@
/* Widget gallery — black/white palette, single blue accent on primary CTA. */
+[hidden] {
+ display: none !important;
+}
+
/* Local token overrides — keep purple out of this page */
.gallery-body {
--accent: #ffffff;
diff --git a/scripts/seed-public-avatars.mjs b/scripts/seed-public-avatars.mjs
new file mode 100644
index 000000000..d652ad1df
--- /dev/null
+++ b/scripts/seed-public-avatars.mjs
@@ -0,0 +1,309 @@
+/**
+ * seed-public-avatars.mjs
+ * ───────────────────────
+ * Populate the avatars table with public, embeddable GLBs so /discover has
+ * something to show besides the (currently sparse) onchain index.
+ *
+ * Sources:
+ * • local: GLBs already in the repo (cz, soldier, robotexpressive, etc.)
+ * • khronos: Khronos glTF Sample Assets (CC0/CC-BY)
+ * • threejs: three.js example models
+ *
+ * Owner: a seed user (default [email protected]). Override with --email=<addr>.
+ * Visibility: public. Idempotent on (owner_id, slug).
+ *
+ * Usage:
+ * node scripts/seed-public-avatars.mjs # all sources
+ * node scripts/seed-public-avatars.mjs --source=local # one source
+ * node scripts/seed-public-avatars.mjs --dry-run # plan only
+ * node scripts/seed-public-avatars.mjs [email protected] # custom owner
+ *
+ * Required env: DATABASE_URL, S3_ENDPOINT, S3_ACCESS_KEY_ID,
+ * S3_SECRET_ACCESS_KEY, S3_BUCKET, S3_PUBLIC_DOMAIN.
+ */
+
+import { neon } from '@neondatabase/serverless';
+import { S3Client, PutObjectCommand, HeadObjectCommand } from '@aws-sdk/client-s3';
+import { createHash } from 'node:crypto';
+import { readFile, stat } from 'node:fs/promises';
+import { resolve, dirname } from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const __dirname = dirname(fileURLToPath(import.meta.url));
+const REPO_ROOT = resolve(__dirname, '..');
+
+// ── args ────────────────────────────────────────────────────────────────────
+const args = Object.fromEntries(
+ process.argv.slice(2).map((a) => {
+ const [k, v] = a.replace(/^--/, '').split('=');
+ return [k, v ?? true];
+ }),
+);
+const SOURCE = args.source || 'all';
+const DRY_RUN = !!args['dry-run'];
+const OWNER_EMAIL = args.email || '[email protected]';
+const SEED_DISPLAY_NAME = 'Three.ws Showcase';
+
+if (!process.env.DATABASE_URL) {
+ console.error('Missing DATABASE_URL'); process.exit(1);
+}
+if (!DRY_RUN) {
+ for (const k of ['S3_ENDPOINT', 'S3_ACCESS_KEY_ID', 'S3_SECRET_ACCESS_KEY', 'S3_BUCKET', 'S3_PUBLIC_DOMAIN']) {
+ if (!process.env[k]) { console.error(`Missing ${k}`); process.exit(1); }
+ }
+}
+
+const sql = neon(process.env.DATABASE_URL);
+const s3 = DRY_RUN
+ ? null
+ : new S3Client({
+ region: 'auto',
+ endpoint: process.env.S3_ENDPOINT.replace(/\/$/, ''),
+ credentials: {
+ accessKeyId: process.env.S3_ACCESS_KEY_ID,
+ secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
+ },
+ requestChecksumCalculation: 'WHEN_REQUIRED',
+ responseChecksumValidation: 'WHEN_REQUIRED',
+ });
+
+// ── catalog ─────────────────────────────────────────────────────────────────
+// Each entry: { source, name, slug, description, tags, file? (local path) | url?, license }
+const KHRONOS = (path, file) =>
+ `https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/${path}/glTF-Binary/${file}`;
+const THREE_GLTF = (file) =>
+ `https://raw.githubusercontent.com/mrdoob/three.js/dev/examples/models/gltf/${file}`;
+
+const CATALOG = [
+ // ── local repo GLBs ─────────────────────────────────────────────────────
+ {
+ source: 'local', name: 'CZ', slug: 'cz',
+ description: 'Stylized humanoid avatar (CZ).',
+ tags: ['humanoid', 'character'],
+ file: 'public/avatars/cz.glb', license: 'internal',
+ },
+ {
+ source: 'local', name: 'Soldier', slug: 'soldier',
+ description: 'Mixamo-rigged soldier with walk/run/idle animations.',
+ tags: ['humanoid', 'rigged', 'mixamo'],
+ file: 'public/animations/soldier.glb', license: 'CC-BY (Mixamo)',
+ },
+ {
+ source: 'local', name: 'Robot Expressive', slug: 'robot-expressive',
+ description: 'Three.js demo robot with expressive animations.',
+ tags: ['robot', 'rigged', 'demo'],
+ file: 'public/animations/robotexpressive.glb', license: 'MIT (three.js)',
+ },
+ {
+ source: 'local', name: 'Floating Character', slug: 'floating-character',
+ description: 'Sims-style floating character.',
+ tags: ['character', 'lowpoly'],
+ file: 'sims-demo/public/Floating Character.glb', license: 'internal',
+ },
+
+ // ── Khronos glTF Sample Assets (mostly CC0 / CC-BY) ─────────────────────
+ {
+ source: 'khronos', name: 'Fox', slug: 'fox',
+ description: 'Stylized fox with idle, walk, and run animations. CC0.',
+ tags: ['animal', 'rigged', 'cc0'],
+ url: KHRONOS('Fox', 'Fox.glb'), license: 'CC0',
+ },
+ {
+ source: 'khronos', name: 'CesiumMan', slug: 'cesium-man',
+ description: 'Walking humanoid reference rig. CC-BY 4.0.',
+ tags: ['humanoid', 'rigged', 'reference'],
+ url: KHRONOS('CesiumMan', 'CesiumMan.glb'), license: 'CC-BY 4.0',
+ },
+ {
+ source: 'khronos', name: 'BrainStem', slug: 'brain-stem',
+ description: 'Animated rigged figure (Khronos sample). CC-BY 4.0.',
+ tags: ['humanoid', 'rigged', 'reference'],
+ url: KHRONOS('BrainStem', 'BrainStem.glb'), license: 'CC-BY 4.0',
+ },
+ {
+ source: 'khronos', name: 'Damaged Helmet', slug: 'damaged-helmet',
+ description: 'Battle-damaged sci-fi helmet — the canonical PBR test asset.',
+ tags: ['prop', 'pbr'],
+ url: KHRONOS('DamagedHelmet', 'DamagedHelmet.glb'), license: 'CC-BY 4.0',
+ },
+ {
+ source: 'khronos', name: 'Avocado', slug: 'avocado',
+ description: 'Photorealistic avocado. The internet\'s favorite glTF sample.',
+ tags: ['prop', 'food'],
+ url: KHRONOS('Avocado', 'Avocado.glb'), license: 'CC0',
+ },
+ {
+ source: 'khronos', name: 'Boom Box', slug: 'boom-box',
+ description: 'Vintage portable cassette player. CC0.',
+ tags: ['prop', 'object'],
+ url: KHRONOS('BoomBox', 'BoomBox.glb'), license: 'CC0',
+ },
+ {
+ source: 'khronos', name: 'Lantern', slug: 'lantern',
+ description: 'Hanging lantern with metal and glass. CC0.',
+ tags: ['prop', 'object'],
+ url: KHRONOS('Lantern', 'Lantern.glb'), license: 'CC0',
+ },
+ {
+ source: 'khronos', name: 'Water Bottle', slug: 'water-bottle',
+ description: 'Translucent plastic water bottle. CC0.',
+ tags: ['prop', 'object'],
+ url: KHRONOS('WaterBottle', 'WaterBottle.glb'), license: 'CC0',
+ },
+ {
+ source: 'khronos', name: 'Antique Camera', slug: 'antique-camera',
+ description: 'Vintage bellows camera. CC0.',
+ tags: ['prop', 'vintage'],
+ url: KHRONOS('AntiqueCamera', 'AntiqueCamera.glb'), license: 'CC0',
+ },
+
+ // ── three.js example models ─────────────────────────────────────────────
+ {
+ source: 'threejs', name: 'Michelle', slug: 'michelle',
+ description: 'Mixamo-rigged dancer (three.js example).',
+ tags: ['humanoid', 'rigged', 'mixamo'],
+ url: THREE_GLTF('Michelle.glb'), license: 'CC-BY (Mixamo)',
+ },
+ {
+ source: 'threejs', name: 'Xbot', slug: 'xbot',
+ description: 'Generic humanoid X-Bot rig (three.js example).',
+ tags: ['humanoid', 'rigged'],
+ url: THREE_GLTF('Xbot.glb'), license: 'MIT',
+ },
+ {
+ source: 'threejs', name: 'Flamingo', slug: 'flamingo',
+ description: 'Animated flamingo with looping wing flap.',
+ tags: ['animal', 'rigged'],
+ url: THREE_GLTF('Flamingo.glb'), license: 'MIT',
+ },
+ {
+ source: 'threejs', name: 'Horse', slug: 'horse',
+ description: 'Animated low-poly horse with morph-based gallop.',
+ tags: ['animal', 'rigged'],
+ url: THREE_GLTF('Horse.glb'), license: 'MIT',
+ },
+ {
+ source: 'threejs', name: 'Parrot', slug: 'parrot',
+ description: 'Animated low-poly parrot.',
+ tags: ['animal', 'rigged'],
+ url: THREE_GLTF('Parrot.glb'), license: 'MIT',
+ },
+ {
+ source: 'threejs', name: 'Stork', slug: 'stork',
+ description: 'Animated low-poly stork.',
+ tags: ['animal', 'rigged'],
+ url: THREE_GLTF('Stork.glb'), license: 'MIT',
+ },
+ {
+ source: 'threejs', name: 'Soldier (three.js)', slug: 'soldier-threejs',
+ description: 'Three.js example soldier with run/walk/idle.',
+ tags: ['humanoid', 'rigged'],
+ url: THREE_GLTF('Soldier.glb'), license: 'CC-BY (Mixamo)',
+ },
+ {
+ source: 'threejs', name: 'LittlestTokyo', slug: 'littlest-tokyo',
+ description: 'Iconic animated diorama by Glen Fox.',
+ tags: ['scene', 'diorama'],
+ url: THREE_GLTF('LittlestTokyo.glb'), license: 'CC-BY 4.0',
+ },
+];
+
+// ── runner ──────────────────────────────────────────────────────────────────
+const filtered = CATALOG.filter((e) => SOURCE === 'all' || e.source === SOURCE);
+
+console.log(`\nseed-public-avatars — owner=${OWNER_EMAIL} source=${SOURCE} dry-run=${DRY_RUN}`);
+console.log(`${filtered.length} candidates\n`);
+
+const owner = await ensureOwner(OWNER_EMAIL, SEED_DISPLAY_NAME);
+console.log(`owner user_id: ${owner.id}\n`);
+
+const results = { created: 0, skipped: 0, failed: 0 };
+
+for (const entry of filtered) {
+ try {
+ const existing = await sql`
+ select id, visibility from avatars
+ where owner_id = ${owner.id} and slug = ${entry.slug} and deleted_at is null limit 1
+ `;
+ if (existing.length) {
+ if (existing[0].visibility !== 'public' && !DRY_RUN) {
+ await sql`update avatars set visibility = 'public' where id = ${existing[0].id}`;
+ console.log(` ↑ ${entry.slug} (promoted to public)`);
+ } else {
+ console.log(` = ${entry.slug} (already exists)`);
+ }
+ results.skipped++;
+ continue;
+ }
+
+ const bytes = await fetchBytes(entry);
+ const checksum = createHash('sha256').update(bytes).digest('base64');
+ const storageKey = `u/${owner.id}/${entry.slug}/${Date.now().toString(36)}.glb`;
+
+ if (DRY_RUN) {
+ console.log(` + ${entry.slug} (${formatBytes(bytes.byteLength)}) [dry-run]`);
+ results.created++;
+ continue;
+ }
+
+ await s3.send(new PutObjectCommand({
+ Bucket: process.env.S3_BUCKET,
+ Key: storageKey,
+ Body: bytes,
+ ContentType: 'model/gltf-binary',
+ ChecksumSHA256: checksum,
+ }));
+
+ await sql`
+ insert into avatars (
+ owner_id, slug, name, description, storage_key, size_bytes, content_type,
+ source, source_meta, visibility, tags, checksum_sha256
+ ) values (
+ ${owner.id}, ${entry.slug}, ${entry.name}, ${entry.description},
+ ${storageKey}, ${bytes.byteLength}, 'model/gltf-binary',
+ 'import', ${JSON.stringify({ seed: entry.source, license: entry.license, origin: entry.url || entry.file })}::jsonb,
+ 'public', ${entry.tags}, ${checksum}
+ )
+ `;
+ console.log(` + ${entry.slug} (${formatBytes(bytes.byteLength)})`);
+ results.created++;
+ } catch (e) {
+ console.error(` ✗ ${entry.slug}: ${e.message}`);
+ results.failed++;
+ }
+}
+
+console.log(`\ndone — created=${results.created} skipped=${results.skipped} failed=${results.failed}`);
+
+// ── helpers ─────────────────────────────────────────────────────────────────
+async function ensureOwner(email, displayName) {
+ const existing = await sql`select id from users where email = ${email} limit 1`;
+ if (existing.length) return existing[0];
+ const [row] = await sql`
+ insert into users (email, display_name, email_verified, plan)
+ values (${email}, ${displayName}, true, 'pro')
+ returning id
+ `;
+ return row;
+}
+
+async function fetchBytes(entry) {
+ if (entry.file) {
+ const path = resolve(REPO_ROOT, entry.file);
+ const s = await stat(path);
+ if (!s.isFile()) throw new Error(`not a file: ${path}`);
+ return await readFile(path);
+ }
+ if (entry.url) {
+ const r = await fetch(entry.url);
+ if (!r.ok) throw new Error(`HTTP ${r.status} fetching ${entry.url}`);
+ return Buffer.from(await r.arrayBuffer());
+ }
+ throw new Error('entry missing both file and url');
+}
+
+function formatBytes(n) {
+ if (n < 1024) return `${n}B`;
+ if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)}KB`;
+ return `${(n / 1024 / 1024).toFixed(1)}MB`;
+}
diff --git a/scripts/test-pages.mjs b/scripts/test-pages.mjs
index 2adf0f072..1ee843b57 100644
--- a/scripts/test-pages.mjs
+++ b/scripts/test-pages.mjs
@@ -27,13 +27,13 @@ const ROUTES = [
'/docs/widgets',
'/cz',
'/validation',
- '/reputation',
'/hydrate',
'/my-agents',
'/discover',
'/explore',
'/features',
- '/embed.html?model=/avatar/avatar.glb',
+ '/embed.html?src=/avatar/avatar.glb',
+ `/reputation/?agent=1:${SAMPLE_AGENT}`,
'/embed-test.html',
'/avatar-page.html',
'/avatar-artifact.html',
diff --git a/scripts/update-footer.mjs b/scripts/update-footer.mjs
deleted file mode 100644
index 3533c8fc9..000000000
--- a/scripts/update-footer.mjs
+++ /dev/null
@@ -1,121 +0,0 @@
-// One-shot codemod: replace the footer body inside `h-footer-horizon` blocks
-// with the unified design (newsletter + community CTA, categorized link
-// columns, social row, privacy/terms in legal). Decorative wrappers (glow,
-// floor, haze, watermark, avatar) are preserved as-is per file.
-
-import fs from 'node:fs';
-import path from 'node:path';
-
-const ROOT = path.resolve(process.argv[2] || '.');
-
-const FILES = [
- 'home.html',
- 'index.html',
- 'create.html',
- 'profile.html',
- 'agent-home.html',
- 'avatar-page.html',
-];
-
-const NEW_BODY = `<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/3D" 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/3D" 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>
- `;
-
-// Match from `<div class="h-footer-inner">` (with any indentation before it)
-// up to (but not including) `</footer>`. The replacement preserves indentation
-// matched by the leading whitespace capture.
-const RE = /([ \t]*)<div class="h-footer-inner">[\s\S]*?(?=<\/footer>)/m;
-
-let updated = 0;
-for (const file of FILES) {
- const fp = path.join(ROOT, file);
- if (!fs.existsSync(fp)) {
- console.warn(`skip (not found): ${file}`);
- continue;
- }
- const src = fs.readFileSync(fp, 'utf8');
- if (!RE.test(src)) {
- console.warn(`skip (no footer match): ${file}`);
- continue;
- }
- const next = src.replace(RE, (_m, indent) => `${indent}${NEW_BODY}`);
- if (next === src) {
- console.warn(`skip (no change): ${file}`);
- continue;
- }
- fs.writeFileSync(fp, next, 'utf8');
- updated++;
- console.log(`updated: ${file}`);
-}
-console.log(`\n${updated} file(s) updated`);
diff --git a/src/app.js b/src/app.js
index 4fce0d954..f2b8eb572 100644
--- a/src/app.js
+++ b/src/app.js
@@ -29,6 +29,12 @@ import { Runtime } from './runtime/index.js';
import { Memory } from './memory/index.js';
import { SkillRegistry } from './skills/index.js';
+// Wallet — kick off a silent reconnect on app boot. Any page that later mounts
+// a wallet UI (deploy, reputation, validation, permissions, etc.) reads from
+// the shared signer + onWalletChange bus, so this single call surfaces an
+// already-authorized wallet site-wide without any popup.
+import { eagerConnectWallet } from './erc8004/agent-registry.js';
+
window.THREE = THREE;
window.VIEWER = {};
@@ -151,6 +157,11 @@ class App {
noControls: Boolean(hash.noControls),
};
+ // Fire-and-forget silent wallet reconnect. Cheap (single `eth_accounts`
+ // RPC), never throws, never prompts. If the user has previously authorized
+ // the site, this populates the shared signer before any wallet UI mounts.
+ eagerConnectWallet();
+
this.el = el;
this.viewer = null;
this.editor = null;
@@ -506,10 +517,16 @@ class App {
if (signOutBtn) {
signOutBtn.addEventListener('click', () => {
- fetch('/api/auth/logout', { method: 'POST', credentials: 'include' }).finally(() => {
- try { localStorage.removeItem('3dagent:auth-hint'); } catch { /* ignore */ }
- location.href = '/';
- });
+ fetch('/api/auth/logout', { method: 'POST', credentials: 'include' }).finally(
+ () => {
+ try {
+ localStorage.removeItem('3dagent:auth-hint');
+ } catch {
+ /* ignore */
+ }
+ location.href = '/';
+ },
+ );
});
}
}
diff --git a/src/cz-flow.js b/src/cz-flow.js
index d87fa725c..e332560bd 100644
--- a/src/cz-flow.js
+++ b/src/cz-flow.js
@@ -2,7 +2,7 @@
* CZ demo claim flow — manages wallet connection, claiming, and transfer flows.
*/
-import { connectWallet, getIdentityRegistry } from './erc8004/agent-registry.js';
+import { ensureWallet, getIdentityRegistry } from './erc8004/agent-registry.js';
import { REGISTRY_DEPLOYMENTS } from './erc8004/abi.js';
/**
diff --git a/src/erc8004/agent-registry.js b/src/erc8004/agent-registry.js
index d23be97be..bea6a382d 100644
--- a/src/erc8004/agent-registry.js
+++ b/src/erc8004/agent-registry.js
@@ -194,6 +194,45 @@ export function getSigner() {
return _signer;
}
+/**
+ * Get a usable wallet for an action, preferring an existing connection.
+ *
+ * Resolution order:
+ * 1. Already-connected signer (no popup)
+ * 2. Eager `eth_accounts` reconnect (no popup)
+ * 3. Explicit `connectWallet()` (popup if user hasn't authorized yet)
+ *
+ * Use this in any flow that needs `{ signer, address, chainId }` — instead of
+ * calling `connectWallet()` directly, which always shows a popup if the
+ * wallet's internal session has been forgotten.
+ *
+ * @returns {Promise<{signer: import('ethers').Signer, address: string, chainId: number}>}
+ */
+export async function ensureWallet() {
+ if (_signer && _address && _chainId) {
+ return { signer: _signer, address: _address, chainId: _chainId };
+ }
+ const eager = await eagerConnectWallet();
+ if (eager) return eager;
+ const fresh = await connectWallet();
+ return { signer: fresh.signer, address: fresh.address, chainId: fresh.chainId };
+}
+
+/**
+ * Tear down the in-memory wallet state and clear the eager-reconnect hint.
+ * Does NOT revoke wallet-side permissions — there is no standard EIP-1193 RPC
+ * for that; users must revoke from their wallet UI. After calling this, the
+ * next `ensureWallet()` will prompt unless they re-authorize.
+ */
+export function disconnectWallet() {
+ _provider = null;
+ _signer = null;
+ _address = null;
+ _chainId = null;
+ setHint(false);
+ notify('disconnected');
+}
+
// ---------------------------------------------------------------------------
// File upload — backend R2 (default) or Pinata (if token supplied)
// ---------------------------------------------------------------------------
@@ -422,9 +461,10 @@ export async function registerAgent({
}
imageUrl = imageUrl || '';
- // ── 3. Wallet + contract.
+ // ── 3. Wallet + contract. ensureWallet() reuses any prior connection
+ // (no popup) and only prompts for a brand-new authorization.
log('Connecting wallet...');
- const { signer, chainId } = await connectWallet();
+ const { signer, chainId } = await ensureWallet();
const registry = getIdentityRegistry(chainId, signer);
// ── 4. Mint with seed URI (useful metadata in the Registered event even if
diff --git a/src/erc8004/index.js b/src/erc8004/index.js
index 96ceb4933..25fea7b30 100644
--- a/src/erc8004/index.js
+++ b/src/erc8004/index.js
@@ -9,7 +9,7 @@ export {
connectWallet,
registerAgent,
buildRegistrationJSON,
- pinToIPFS,
+ pinFile,
} from './agent-registry.js';
export { RegisterUI } from './register-ui.js';
export { submitReputation, submitFeedback, getReputation, getRecentReviews } from './reputation.js';
diff --git a/src/erc8004/validation-recorder.js b/src/erc8004/validation-recorder.js
index a7538123e..c39d1009e 100644
--- a/src/erc8004/validation-recorder.js
+++ b/src/erc8004/validation-recorder.js
@@ -9,7 +9,7 @@
import { Contract, keccak256, toUtf8Bytes } from 'ethers';
import { REGISTRY_DEPLOYMENTS, VALIDATION_REGISTRY_ABI } from './abi.js';
-import { pinToIPFS } from './agent-registry.js';
+import { pinFile } from './agent-registry.js';
const KIND_GLB_SCHEMA = 'glb-schema';
@@ -70,7 +70,7 @@ export async function recordValidation({
let proofURI = '';
if (pin && apiToken) {
const blob = new Blob([JSON.stringify(report, null, 2)], { type: 'application/json' });
- const cid = await pinToIPFS(blob, apiToken);
+ const cid = await pinFile(blob, apiToken);
proofURI = `ipfs://${cid}`;
}
diff --git a/src/reputation-ui.js b/src/reputation-ui.js
index e5b9a750b..c1c82d975 100644
--- a/src/reputation-ui.js
+++ b/src/reputation-ui.js
@@ -8,7 +8,7 @@
import { JsonRpcProvider } from 'ethers';
import { getReputation, getRecentReviews, submitReputation } from './erc8004/reputation.js';
-import { connectWallet } from './erc8004/agent-registry.js';
+import { ensureWallet } from './erc8004/agent-registry.js';
import { REGISTRY_DEPLOYMENTS } from './erc8004/abi.js';
const CHAIN_NAMES = {
@@ -158,7 +158,7 @@ export class ReputationDashboard {
}
try {
- const walletInfo = await connectWallet();
+ const walletInfo = await ensureWallet();
this.connectedAddress = walletInfo.address;
const txHash = await submitReputation({
diff --git a/src/viewer.js b/src/viewer.js
index dc3f76539..3ed52700c 100644
--- a/src/viewer.js
+++ b/src/viewer.js
@@ -511,7 +511,7 @@ export class Viewer {
MANAGER.setURLModifier((url, path) => {
// URIs in a glTF file may be escaped, or not. Assume that assetMap is
// from an un-escaped source, and decode all URIs before lookups.
- // See: https://github.com/nirholas/3d-agent/issues/146
+ // See: https://github.com/nirholas/three.ws/issues/146
const normalizedURL =
rootPath +
decodeURI(url)
diff --git a/src/wallet/connect-button.js b/src/wallet/connect-button.js
index ed69057ea..77e2ef1fe 100644
--- a/src/wallet/connect-button.js
+++ b/src/wallet/connect-button.js
@@ -8,6 +8,7 @@
import { BrowserProvider } from 'ethers';
import { STATES, initialState, reduce } from './state.js';
+import { eagerConnectWallet, getWalletState } from '../erc8004/agent-registry.js';
/** Chain IDs that match known ERC-8004 registry deployments. */
const DEFAULT_CHAIN_IDS = [1, 8453, 10, 42161, 11155111, 84532];
@@ -108,6 +109,38 @@ export class ConnectWalletController extends EventTarget {
window.ethereum.on('accountsChanged', this.#onAccountsChanged);
window.ethereum.on('chainChanged', this.#onChainChanged);
}
+
+ // Hydrate from any already-resolved silent reconnect (fired during app
+ // boot). If the shared registry has a connected address, jump straight
+ // to CONNECTED so the button renders the address instead of "Connect
+ // wallet" on first paint. If not yet resolved, attempt the silent path
+ // here too (idempotent — no popup).
+ this.#tryEagerHydrate();
+ }
+
+ async #tryEagerHydrate() {
+ const existing = getWalletState();
+ if (existing.address && existing.chainId) {
+ this.#dispatch({
+ type: 'ACCOUNTS_RESOLVED',
+ address: existing.address,
+ chainId: existing.chainId,
+ });
+ if (!this.#opts.allowedChainIds.includes(existing.chainId)) {
+ this.#dispatch({ type: 'WRONG_CHAIN' });
+ }
+ return;
+ }
+ const eager = await eagerConnectWallet();
+ if (!eager) return;
+ this.#dispatch({
+ type: 'ACCOUNTS_RESOLVED',
+ address: eager.address,
+ chainId: eager.chainId,
+ });
+ if (!this.#opts.allowedChainIds.includes(eager.chainId)) {
+ this.#dispatch({ type: 'WRONG_CHAIN' });
+ }
}
get state() {
diff --git a/style.css b/style.css
index 9fcf94830..8723cb6dc 100644
--- a/style.css
+++ b/style.css
@@ -3,6 +3,10 @@
* φ = 1.618 — all spacing and type follow a phi-based scale
*/
+[hidden] {
+ display: none !important;
+}
+
.save-toast {
position: fixed;
bottom: 20px;
@@ -1328,7 +1332,9 @@ body[data-viewer-mode='deploy'] {
.header-logo {
width: 28px;
height: 28px;
- display: block;
+ display: inline-block;
+ vertical-align: middle;
+ margin-right: 0.5rem;
flex-shrink: 0;
object-fit: contain;
}
diff --git a/vercel.json b/vercel.json
index f3fd85d09..ac1d8e1e8 100644
--- a/vercel.json
+++ b/vercel.json
@@ -1,5 +1,6 @@
{
"public": true,
+ "installCommand": "npm ci --prefer-offline --no-audit --no-fund",
"routes": [
{
"src": "/openapi\\.json",