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.

style: enhance brand styling and update logo in login page

nirholas16e2988edc48
diff --git a/api/cron/erc8004-backfill.js b/api/cron/erc8004-backfill.js
new file mode 100644
index 000000000..e5d1eb1eb
--- /dev/null
+++ b/api/cron/erc8004-backfill.js
@@ -0,0 +1,166 @@
+/**
+ * One-shot historical backfill for the ERC-8004 agent index.
+ *
+ * Scans every Registered event from block 0 to latest on every configured
+ * chain using Etherscan V2 getLogs, paging through all results.
+ *
+ * Usage:
+ * POST /api/cron/erc8004-backfill
+ * Authorization: Bearer $CRON_SECRET
+ *
+ * Optional body: { chainIds: [8453, 84532] } — limit to specific chains.
+ * Optional query: ?reset=1 — clear cursors first so the regular cron also
+ * re-scans from block 0 (use with care on prod).
+ */
+
+import { id as keccakId, AbiCoder, getAddress } from 'ethers';
+import { sql } from '../_lib/db.js';
+import { cors, error, json, wrap } from '../_lib/http.js';
+import { env } from '../_lib/env.js';
+import { CHAINS } from '../_lib/erc8004-chains.js';
+
+const REGISTERED_TOPIC = keccakId('Registered(uint256,string,address)');
+const ETHERSCAN_BASE = 'https://api.etherscan.io/v2/api';
+const ABI_CODER = AbiCoder.defaultAbiCoder();
+
+const PAGE_SIZE = 1000; // Etherscan V2 max offset
+const FETCH_TIMEOUT_MS = 12_000;
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'POST,OPTIONS' })) return;
+
+ const auth = req.headers['authorization'] || '';
+ const expected = env.CRON_SECRET ? `Bearer ${env.CRON_SECRET}` : null;
+ if (expected && auth !== expected) {
+ return error(res, 401, 'unauthorized', 'cron secret required');
+ }
+ if (!env.ETHERSCAN_API_KEY) {
+ return error(res, 500, 'missing_env', 'ETHERSCAN_API_KEY not configured');
+ }
+
+ let body = {};
+ try {
+ if (req.headers['content-type']?.includes('application/json')) {
+ const chunks = [];
+ for await (const chunk of req) chunks.push(chunk);
+ body = JSON.parse(Buffer.concat(chunks).toString());
+ }
+ } catch {
+ /* no body — fine */
+ }
+
+ const resetCursors = req.query?.reset === '1' || body.reset === true;
+ const onlyChains = Array.isArray(body.chainIds) ? new Set(body.chainIds.map(Number)) : null;
+ const chains = onlyChains ? CHAINS.filter((c) => onlyChains.has(c.id)) : CHAINS;
+
+ if (chains.length === 0) {
+ return error(res, 400, 'bad_request', 'no matching chains');
+ }
+
+ if (resetCursors) {
+ const ids = chains.map((c) => c.id);
+ await sql`DELETE FROM erc8004_crawl_cursor WHERE chain_id = ANY(${ids})`;
+ }
+
+ const report = { chains: [], errors: [] };
+
+ for (const chain of chains) {
+ try {
+ const r = await backfillChain(chain);
+ report.chains.push({ chainId: chain.id, name: chain.name, ...r });
+ } catch (err) {
+ report.errors.push({ chainId: chain.id, name: chain.name, error: err.message || String(err) });
+ }
+ }
+
+ return json(res, 200, report);
+});
+
+async function backfillChain(chain) {
+ let page = 1;
+ let inserted = 0;
+ let lastBlock = 0;
+ let hasMore = true;
+
+ while (hasMore) {
+ const url = new URL(ETHERSCAN_BASE);
+ url.searchParams.set('chainid', String(chain.id));
+ url.searchParams.set('module', 'logs');
+ url.searchParams.set('action', 'getLogs');
+ url.searchParams.set('address', chain.registry);
+ url.searchParams.set('topic0', REGISTERED_TOPIC);
+ url.searchParams.set('fromBlock', '0');
+ url.searchParams.set('toBlock', 'latest');
+ url.searchParams.set('page', String(page));
+ url.searchParams.set('offset', String(PAGE_SIZE));
+ url.searchParams.set('apikey', env.ETHERSCAN_API_KEY);
+
+ const body = await fetchJson(url.toString());
+
+ if (body.status === '0' && /no records/i.test(body.message || '')) {
+ break;
+ }
+ if (body.status !== '1' || !Array.isArray(body.result)) {
+ throw new Error(`etherscan ${chain.id} page ${page}: ${body.message || 'unknown'}`);
+ }
+
+ for (const log of body.result) {
+ try {
+ const agentId = BigInt(log.topics[1]).toString();
+ const ownerHex = '0x' + log.topics[2].slice(-40);
+ const owner = getAddress(ownerHex).toLowerCase();
+ const [agentURI] = ABI_CODER.decode(['string'], log.data);
+ const blockNumber = Number.parseInt(log.blockNumber, 16);
+ const timestamp = Number.parseInt(log.timeStamp, 16);
+ const registeredAt = new Date(timestamp * 1000).toISOString();
+
+ await sql`
+ INSERT INTO erc8004_agents_index
+ (chain_id, agent_id, owner, registry, agent_uri,
+ registered_block, registered_tx, registered_at, last_seen_at)
+ VALUES
+ (${chain.id}, ${agentId}, ${owner}, ${chain.registry.toLowerCase()},
+ ${agentURI || null}, ${blockNumber}, ${log.transactionHash},
+ ${registeredAt}, now())
+ ON CONFLICT (chain_id, agent_id) DO UPDATE SET
+ owner = excluded.owner,
+ agent_uri = COALESCE(excluded.agent_uri, erc8004_agents_index.agent_uri),
+ last_seen_at = now()
+ `;
+ inserted += 1;
+ if (blockNumber > lastBlock) lastBlock = blockNumber;
+ } catch (decodeErr) {
+ console.warn('[backfill] decode failed', chain.id, log.transactionHash, decodeErr.message);
+ }
+ }
+
+ // Fewer results than page size means we've reached the end.
+ hasMore = body.result.length === PAGE_SIZE;
+ page += 1;
+ }
+
+ // Advance the cron cursor so the regular crawler resumes from here.
+ if (lastBlock > 0) {
+ await sql`
+ INSERT INTO erc8004_crawl_cursor (chain_id, last_block, updated_at)
+ VALUES (${chain.id}, ${lastBlock}, now())
+ ON CONFLICT (chain_id) DO UPDATE SET
+ last_block = GREATEST(erc8004_crawl_cursor.last_block, excluded.last_block),
+ updated_at = now()
+ `;
+ }
+
+ return { inserted, pages: page - 1, lastBlock };
+}
+
+async function fetchJson(url) {
+ const ac = new AbortController();
+ const t = setTimeout(() => ac.abort(), FETCH_TIMEOUT_MS);
+ try {
+ const res = await fetch(url, { signal: ac.signal });
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
+ return await res.json();
+ } finally {
+ clearTimeout(t);
+ }
+}
diff --git a/public/login.html b/public/login.html
index c254b66c4..80bbfef85 100644
--- a/public/login.html
+++ b/public/login.html
@@ -154,17 +154,19 @@
color: #444;
}
.brand {
- font-size: 11px;
- letter-spacing: 0.14em;
- text-transform: uppercase;
- color: #444;
- margin: 0 0 10px;
- font-weight: 500;
+ 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 {
- color: #888;
+ opacity: 1;
}
.divider {
display: flex;
@@ -305,7 +307,7 @@
></model-viewer>
</div>
<form class="card" id="f">
- <a href="/" class="brand">three.ws</a>
+ <a href="/" class="brand"><img src="/three.svg" alt="three.ws" /></a>
<h1>Welcome back</h1>
<p class="sub">Sign in to manage your avatars.</p>
<label for="email">Email or username</label>
diff --git a/public/widgets-gallery/gallery.css b/public/widgets-gallery/gallery.css
index 4a887af6a..7b20672ea 100644
--- a/public/widgets-gallery/gallery.css
+++ b/public/widgets-gallery/gallery.css
@@ -1,4 +1,11 @@
-/* Widget gallery — matches root style.css tokens. */
+/* Widget gallery — black/white palette, single blue accent on primary CTA. */
+
+/* Local token overrides — keep purple out of this page */
+.gallery-body {
+ --accent: #ffffff;
+ --accent-soft: rgba(255, 255, 255, 0.08);
+ --blue: #3b82f6;
+}
html,
body.gallery-body {
@@ -120,7 +127,7 @@ body.gallery-body {
align-items: center;
gap: 0.35rem;
padding: 0.3rem 0.75rem;
- border-radius: 999px;
+ border-radius: 8px;
font-size: var(--text-sm);
font-weight: 500;
background: rgba(255, 255, 255, 0.05);
@@ -151,7 +158,7 @@ body.gallery-body {
align-items: center;
gap: var(--space-xs);
padding: var(--space-sm) var(--space-lg);
- border-radius: 999px;
+ border-radius: 8px;
font-family: var(--font-body);
font-size: var(--text-base);
font-weight: 500;
@@ -170,13 +177,13 @@ body.gallery-body {
}
.btn-primary {
- background: var(--accent);
+ background: var(--blue);
color: #fff;
}
.btn-primary:hover {
transform: translateY(-1px);
- background: #7c3aed;
+ background: #2563eb;
}
.btn-ghost {
@@ -203,7 +210,7 @@ body.gallery-body {
align-items: center;
gap: 0.4rem;
padding: 0.45rem 1rem;
- border-radius: 999px;
+ border-radius: 8px;
border: 1px solid rgba(255, 255, 255, 0.1);
background: rgba(255, 255, 255, 0.04);
color: rgba(229, 229, 229, 0.7);
@@ -403,7 +410,7 @@ body.gallery-body {
.play-btn {
width: 64px;
height: 64px;
- border-radius: 50%;
+ border-radius: 12px;
background: rgba(255, 255, 255, 0.08);
border: 1px solid rgba(255, 255, 255, 0.15);
color: #fff;
@@ -419,8 +426,8 @@ body.gallery-body {
.play-btn:hover,
.play-btn:focus-visible {
- background: color-mix(in srgb, var(--type-color, #8b5cf6) 30%, rgba(255, 255, 255, 0.12));
- border-color: var(--type-color, rgba(255, 255, 255, 0.4));
+ background: rgba(255, 255, 255, 0.14);
+ border-color: rgba(255, 255, 255, 0.35);
transform: scale(1.08);
outline: none;
}
diff --git a/style.css b/style.css
index 3db493492..967b0a835 100644
--- a/style.css
+++ b/style.css
@@ -5747,10 +5747,10 @@ textarea.erc8004-code {
align-items: center;
gap: 8px;
padding: 6px 14px;
- background: var(--accent-soft);
- border: 1px solid var(--accent);
+ background: rgba(255, 255, 255, 0.06);
+ border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 99px;
- color: var(--accent);
+ color: rgba(255, 255, 255, 0.85);
font-size: 12px;
font-weight: 600;
letter-spacing: 0.02em;
@@ -5768,16 +5768,16 @@ textarea.erc8004-code {
}
.explore-hero-chip--link:hover,
.explore-hero-chip--link:focus-visible {
- border-color: var(--accent);
- color: var(--accent);
- background: var(--accent-soft);
+ border-color: rgba(255, 255, 255, 0.4);
+ color: #fff;
+ background: rgba(255, 255, 255, 0.08);
}
.explore-hero-dot {
width: 6px;
height: 6px;
border-radius: 50%;
- background: var(--accent);
- box-shadow: 0 0 10px var(--accent);
+ background: #3b82f6;
+ box-shadow: 0 0 10px #3b82f6;
}
.explore-stats {