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.

broad polish: api hardening, marketplace + x402 fixes, page/css tweaks, dashboard updates

nirholasc384df86c4d0
diff --git a/api/_lib/balances.js b/api/_lib/balances.js
index 069b6a36c..4f00baac8 100644
--- a/api/_lib/balances.js
+++ b/api/_lib/balances.js
@@ -28,16 +28,7 @@ async function fetchJson(url, opts = {}) {
}
async function getSolanaBalances(address) {
- const heliusKey = process.env.HELIUS_API_KEY;
- if (!heliusKey) {
- const e = new Error('not_configured: HELIUS_API_KEY');
- e.status = 503;
- e.code = 'not_configured';
- e.missing = 'HELIUS_API_KEY';
- throw e;
- }
-
- const rpcUrl = `https://mainnet.helius-rpc.com/?api-key=${heliusKey}`;
+ const rpcUrl = process.env.SOLANA_RPC_URL || 'https://api.mainnet-beta.solana.com';
const solResp = await fetchJson(rpcUrl, {
method: 'POST',
diff --git a/api/_lib/http.js b/api/_lib/http.js
index 051e0c4af..1c5be5e77 100644
--- a/api/_lib/http.js
+++ b/api/_lib/http.js
@@ -166,8 +166,13 @@ export function wrap(handler) {
export function method(req, res, allowed) {
const m = req.method || 'GET';
- if (!allowed.includes(m)) {
- res.setHeader('allow', allowed.join(', '));
+ // HEAD must be allowed wherever GET is allowed (RFC 9110 §9.3.2).
+ // Treat an incoming HEAD as GET for the purposes of the allowlist check;
+ // Node.js HTTP automatically strips the response body on HEAD responses.
+ const effective = (m === 'HEAD' && allowed.includes('GET')) ? 'GET' : m;
+ if (!allowed.includes(effective)) {
+ const advertised = allowed.includes('GET') ? [...allowed, 'HEAD'] : allowed;
+ res.setHeader('allow', advertised.join(', '));
error(res, 405, 'method_not_allowed', `method ${m} not allowed`);
return false;
}
diff --git a/api/_lib/migrations/2026-05-25-marketplace-and-social-tables.sql b/api/_lib/migrations/2026-05-25-marketplace-and-social-tables.sql
index cbcf40d3a..e53dd64ff 100644
--- a/api/_lib/migrations/2026-05-25-marketplace-and-social-tables.sql
+++ b/api/_lib/migrations/2026-05-25-marketplace-and-social-tables.sql
@@ -1,6 +1,6 @@
-- Migration: agent_reviews, x_triggers, x_scheduled_posts, x_pending_reviews
-- Also: club_tips.amount_atomics column if missing
--- All idempotent.
+-- All idempotent — handles tables that already exist with fewer columns.
BEGIN;
@@ -15,6 +15,9 @@ CREATE TABLE IF NOT EXISTS agent_reviews (
updated_at timestamptz NOT NULL DEFAULT now(),
UNIQUE (agent_id, user_id)
);
+ALTER TABLE agent_reviews ADD COLUMN IF NOT EXISTS rating int;
+ALTER TABLE agent_reviews ADD COLUMN IF NOT EXISTS review text;
+ALTER TABLE agent_reviews ADD COLUMN IF NOT EXISTS updated_at timestamptz NOT NULL DEFAULT now();
CREATE INDEX IF NOT EXISTS agent_reviews_agent_id ON agent_reviews(agent_id);
CREATE INDEX IF NOT EXISTS agent_reviews_user_id ON agent_reviews(user_id);
@@ -31,7 +34,9 @@ CREATE TABLE IF NOT EXISTS x_triggers (
last_state jsonb,
created_at timestamptz NOT NULL DEFAULT now()
);
-CREATE INDEX IF NOT EXISTS x_triggers_user_id ON x_triggers(user_id) WHERE enabled;
+ALTER TABLE x_triggers ADD COLUMN IF NOT EXISTS auto_publish boolean NOT NULL DEFAULT false;
+ALTER TABLE x_triggers ADD COLUMN IF NOT EXISTS last_state jsonb;
+CREATE INDEX IF NOT EXISTS x_triggers_user_id ON x_triggers(user_id) WHERE enabled;
CREATE INDEX IF NOT EXISTS x_triggers_agent_id ON x_triggers(agent_id) WHERE enabled;
-- ── x_scheduled_posts — queued social posts ───────────────────────────────────
@@ -44,7 +49,6 @@ CREATE TABLE IF NOT EXISTS x_scheduled_posts (
published_at timestamptz,
created_at timestamptz NOT NULL DEFAULT now()
);
--- Backfill published_at if table already existed without it
ALTER TABLE x_scheduled_posts ADD COLUMN IF NOT EXISTS published_at timestamptz;
CREATE INDEX IF NOT EXISTS x_scheduled_posts_pending
ON x_scheduled_posts(scheduled_at) WHERE published_at IS NULL;
@@ -60,10 +64,14 @@ CREATE TABLE IF NOT EXISTS x_pending_reviews (
approved boolean,
created_at timestamptz NOT NULL DEFAULT now()
);
+ALTER TABLE x_pending_reviews ADD COLUMN IF NOT EXISTS trigger_id uuid REFERENCES x_triggers(id) ON DELETE SET NULL;
+ALTER TABLE x_pending_reviews ADD COLUMN IF NOT EXISTS reviewed_at timestamptz;
+ALTER TABLE x_pending_reviews ADD COLUMN IF NOT EXISTS approved boolean;
CREATE INDEX IF NOT EXISTS x_pending_reviews_user_pending
ON x_pending_reviews(user_id) WHERE reviewed_at IS NULL;
--- ── club_tips — backfill amount_atomics if column absent ─────────────────────
+-- ── club_tips — backfill columns if absent ───────────────────────────────────
ALTER TABLE club_tips ADD COLUMN IF NOT EXISTS amount_atomics numeric;
+ALTER TABLE club_tips ADD COLUMN IF NOT EXISTS paid_at timestamptz;
COMMIT;
diff --git a/api/_lib/seed-default-agent.js b/api/_lib/seed-default-agent.js
index b3473d974..bde248f94 100644
--- a/api/_lib/seed-default-agent.js
+++ b/api/_lib/seed-default-agent.js
@@ -20,14 +20,14 @@ const DEFAULT_GREETING = "Hi! I'm your first agent. What should we work on today
export async function seedDefaultAgent(userId) {
if (!userId) return null;
- const existing = await sql`
- SELECT 1 AS x FROM agent_identities
- WHERE user_id = ${userId} AND deleted_at IS NULL
- LIMIT 1
- `;
- if (existing.length) return null;
-
try {
+ const existing = await sql`
+ SELECT 1 AS x FROM agent_identities
+ WHERE user_id = ${userId} AND deleted_at IS NULL
+ LIMIT 1
+ `;
+ if (existing.length) return null;
+
const [agent] = await sql`
INSERT INTO agent_identities (
user_id, name, description, system_prompt, greeting,
diff --git a/api/_lib/x402-prices.js b/api/_lib/x402-prices.js
new file mode 100644
index 000000000..bb486534b
--- /dev/null
+++ b/api/_lib/x402-prices.js
@@ -0,0 +1,37 @@
+// x402 endpoint pricing — env-overridable defaults for every paid endpoint.
+//
+// Each endpoint declares its slug + default price (in USDC atomics, 6 decimals).
+// Ops can override any price at deploy time by setting:
+//
+// X402_PRICE_<SLUG>=<atomics>
+//
+// where <SLUG> is the upper-snake-case form of the endpoint slug:
+//
+// agent-reputation → X402_PRICE_AGENT_REPUTATION
+// pump-agent-audit → X402_PRICE_PUMP_AGENT_AUDIT
+// skill-marketplace → X402_PRICE_SKILL_MARKETPLACE
+//
+// Default values are intentionally low (cents to a few dollars max) so the
+// out-of-the-box experience stays as a demo/dev curve. Production deployments
+// should review every default and tune to actual unit economics.
+
+/**
+ * Resolve the price in USDC atomics for an endpoint slug.
+ *
+ * @param {string} slug e.g. 'agent-reputation' (kebab-case)
+ * @param {string} defaultAtomics fallback atomics string
+ * @returns {string} atomics string (BigInt-safe)
+ */
+export function priceFor(slug, defaultAtomics) {
+ const key = `X402_PRICE_${String(slug).replace(/-/g, '_').toUpperCase()}`;
+ const raw = process.env[key];
+ if (raw == null) return String(defaultAtomics);
+ const trimmed = String(raw).trim();
+ if (!/^\d+$/.test(trimmed)) {
+ console.warn(
+ `[x402-prices] env ${key}="${raw}" is not a non-negative integer; falling back to default ${defaultAtomics}`,
+ );
+ return String(defaultAtomics);
+ }
+ return trimmed;
+}
diff --git a/api/agents/nfts.js b/api/agents/nfts.js
index 5c40de349..6dd319b35 100644
--- a/api/agents/nfts.js
+++ b/api/agents/nfts.js
@@ -18,9 +18,8 @@ import { limits, clientIp } from '../_lib/rate-limit.js';
import { getSessionUser, authenticateBearer, extractBearer, hasScope } from '../_lib/auth.js';
const HELIUS_RPC = () => {
- const k = process.env.HELIUS_API_KEY;
- if (!k) throw Object.assign(new Error('HELIUS_API_KEY not configured'), { status: 503, code: 'not_configured' });
- return `https://mainnet.helius-rpc.com/?api-key=${k}`;
+ const url = process.env.SOLANA_RPC_URL || 'https://api.mainnet-beta.solana.com';
+ return url;
};
const RECENT_TX_URL = () => {
diff --git a/api/avatars/_actions.js b/api/avatars/_actions.js
index b73e9c8e0..825eb580a 100644
--- a/api/avatars/_actions.js
+++ b/api/avatars/_actions.js
@@ -5,7 +5,6 @@ import { getSessionUser, authenticateBearer, extractBearer, hasScope } from '../
import { presignUpload, headObject, r2, publicUrl, putObject } from '../_lib/r2.js';
import { storageKeyFor, enforceQuotas, searchPublicAvatars, stripOwnerFor } from '../_lib/avatars.js';
import { listAvatars, createAvatar } from '../_lib/avatars.js';
-import { HeadObjectCommand } from '@aws-sdk/client-s3';
import { env } from '../_lib/env.js';
import { sql } from '../_lib/db.js';
import { cors, json, method, readJson, wrap, error } from '../_lib/http.js';
diff --git a/api/club/leaderboard.js b/api/club/leaderboard.js
index a8dbd6c05..72041ad49 100644
--- a/api/club/leaderboard.js
+++ b/api/club/leaderboard.js
@@ -16,7 +16,13 @@ export default wrap(async (req, res) => {
if (!method(req, res, ['GET'])) return;
const window = (req.query?.window || 'all').toString();
- const rows = await runForWindow(window);
+ let rows;
+ try {
+ rows = await runForWindow(window);
+ } catch (err) {
+ console.error('[club/leaderboard]', err?.message || err);
+ return error(res, 500, 'db_error', 'Failed to load leaderboard');
+ }
if (rows === null) {
return error(res, 400, 'bad_window', 'window must be hour|day|week|all');
}
diff --git a/api/cron/[name].js b/api/cron/[name].js
index 5bec93639..ac2d4af68 100644
--- a/api/cron/[name].js
+++ b/api/cron/[name].js
@@ -420,7 +420,7 @@ async function handleIndexDelegations(req, res) {
const chainId = Number(chainIdStr);
const t0 = Date.now();
try {
- const r = await idxIndexChain(chainId, contract);
+ const r = await idxIndexChain(chainId, contract, started);
const summary = { chainId, ...r, elapsedMs: Date.now() - t0 };
report.chains.push(summary);
console.log(JSON.stringify({ stage: 'index-delegations', ...summary }));
@@ -458,10 +458,13 @@ async function handleIndexDelegations(req, res) {
return json(res, 200, report);
}
-async function idxIndexChain(chainId, contract) {
+async function idxIndexChain(chainId, contract, cronStart = Date.now()) {
const urls = idxRpcUrls(chainId);
if (!urls.length) throw new Error(`no RPC URL configured for chain ${chainId}`);
+ // Per-chain batch size: ETH mainnet nodes cap eth_getLogs at 50 blocks.
+ const BATCH = chainId === 1 ? IDX_MAINNET_BLOCK_CAP : IDX_BLOCK_CAP;
+
const latestHex = await idxRpc(urls, 'eth_blockNumber', []);
const latestBlock = parseInt(latestHex, 16);
@@ -478,18 +481,62 @@ async function idxIndexChain(chainId, contract) {
let revokedCount = 0;
let redeemedCount = 0;
let logErrorCount = 0;
+ let earlyExit = false;
while (fromBlock <= latestBlock) {
- toBlock = Math.min(fromBlock + IDX_BLOCK_CAP - 1, latestBlock);
+ // Hard time budget: save cursor and break before the function times out.
+ if (Date.now() - cronStart > IDX_TIME_BUDGET_MS) {
+ console.warn(
+ JSON.stringify({
+ stage: 'index-delegations',
+ chainId,
+ warning: 'time-budget-exceeded',
+ elapsedMs: Date.now() - cronStart,
+ stoppedAtBlock: fromBlock,
+ }),
+ );
+ earlyExit = true;
+ break;
+ }
- const logs = await idxRpc(urls, 'eth_getLogs', [
- {
- address: contract,
- topics: [[DISABLED_TOPIC, REDEEMED_TOPIC]],
- fromBlock: '0x' + fromBlock.toString(16),
- toBlock: '0x' + toBlock.toString(16),
- },
- ]);
+ toBlock = Math.min(fromBlock + BATCH - 1, latestBlock);
+
+ let logs;
+ try {
+ logs = await idxRpc(urls, 'eth_getLogs', [
+ {
+ address: contract,
+ topics: [[DISABLED_TOPIC, REDEEMED_TOPIC]],
+ fromBlock: '0x' + fromBlock.toString(16),
+ toBlock: '0x' + toBlock.toString(16),
+ },
+ ]);
+ } catch (fetchErr) {
+ // AbortError means this batch timed out — save the cursor at the start
+ // of this batch so the next invocation can retry it, then stop.
+ if (fetchErr.name === 'AbortError' || fetchErr.name === 'TimeoutError') {
+ console.warn(
+ JSON.stringify({
+ stage: 'index-delegations',
+ chainId,
+ warning: 'rpc-abort',
+ message: fetchErr.message,
+ stoppedAtBlock: fromBlock,
+ }),
+ );
+ // Rewind cursor to fromBlock-1 so the next run retries this batch.
+ await sql`
+ INSERT INTO indexer_state (contract, chain_id, last_indexed_block, updated_at)
+ VALUES (${contract.toLowerCase()}, ${chainId}, ${fromBlock - 1}, NOW())
+ ON CONFLICT (contract, chain_id) DO UPDATE SET
+ last_indexed_block = LEAST(indexer_state.last_indexed_block, ${fromBlock - 1}),
+ updated_at = NOW()
+ `;
+ earlyExit = true;
+ break;
+ }
+ throw fetchErr;
+ }
if (logs.length > 0) {
// Fetch block timestamps only for blocks that have events.
@@ -592,7 +639,7 @@ async function idxIndexChain(chainId, contract) {
fromBlock = toBlock + 1;
}
- return { fromBlock: initialFrom, toBlock, revokedCount, redeemedCount, logErrorCount };
+ return { fromBlock: initialFrom, toBlock, revokedCount, redeemedCount, logErrorCount, earlyExit };
}
async function idxRpc(urls, method, params) {
@@ -654,8 +701,21 @@ async function handlePumpAgentStats(req, res) {
order by id limit ${PUMP_STATS_MAX_PER_RUN}
`;
- const report = { scanned: mints.length, updated: 0, errors: 0, graduations: 0, timeouts: 0 };
+ const DEADLINE = Date.now() + 22_000;
+ const report = { scanned: mints.length, updated: 0, errors: 0, graduations: 0, timeouts: 0, rate_limited: 0, skipped: 0 };
+ let consecutiveRateLimit = 0;
+
for (const m of mints) {
+ if (Date.now() >= DEADLINE) {
+ report.skipped += mints.length - mints.indexOf(m);
+ break;
+ }
+ if (consecutiveRateLimit >= 3) {
+ report.skipped += mints.length - mints.indexOf(m);
+ console.log(JSON.stringify({ event: 'pump_agent_stats.circuit_open', consecutive_429: consecutiveRateLimit }));
+ break;
+ }
+
try {
const stats = await Promise.race([
pumpStatsSnapshotMint(m),
@@ -664,6 +724,8 @@ async function handlePumpAgentStats(req, res) {
),
]);
+ consecutiveRateLimit = 0;
+
// Detect graduation flip false→true vs prior snapshot.
const [prior] = await sql`
select graduated from pump_agent_stats where mint_id=${m.id} limit 1
@@ -721,13 +783,20 @@ async function handlePumpAgentStats(req, res) {
report.updated++;
} catch (e) {
- if (e.code === 'TIMEOUT') report.timeouts++;
- else report.errors++;
+ if (e.code === 'TIMEOUT') {
+ report.timeouts++;
+ } else if (e.code === 'RATE_LIMITED' || /429/.test(e.message)) {
+ report.rate_limited++;
+ consecutiveRateLimit++;
+ } else {
+ report.errors++;
+ consecutiveRateLimit = 0;
+ }
await sql`
insert into pump_agent_stats (mint_id, network, mint, error, refreshed_at)
values (${m.id}, ${m.network}, ${m.mint}, ${e.message || 'snapshot failed'}, now())
on conflict (mint_id) do update set error = excluded.error, refreshed_at = now()
- `;
+ `.catch(() => {});
}
}
@@ -804,8 +873,11 @@ async function pumpStatsSnapshotMint({ network, mint }) {
out.last_signature_at = new Date(sigs[0].blockTime * 1000).toISOString();
}
}
- } catch {
- // RPC hiccup — leave activity fields null
+ } catch (e) {
+ if (/429|rate.limit|max usage/i.test(e?.message || '')) {
+ throw Object.assign(new Error(`RPC 429: ${e.message}`), { code: 'RATE_LIMITED' });
+ }
+ // Other RPC hiccup — leave activity fields null
}
return out;
diff --git a/api/marketplace/[action].js b/api/marketplace/[action].js
index 533f22a4c..79a08a375 100644
--- a/api/marketplace/[action].js
+++ b/api/marketplace/[action].js
@@ -82,6 +82,7 @@ export default wrap(async (req, res) => {
const sub = parts[4];
if (head === 'categories') return handleCategories(req, res);
+ if (head === 'theme') return handleTheme(req, res);
if (head === 'agents') {
if (!id) {
@@ -154,6 +155,68 @@ async function handleCategories(req, res) {
);
}
+// ── Weekly theme strip ──────────────────────────────────────────────────────
+
+// Rotate through categories by week number so the strip feels curated without
+// requiring manual editor input. Deterministic: same week = same category.
+const THEME_CATEGORIES = [
+ { slug: 'programming', title: 'Code & Dev Tools', blurb: 'Agents that write, review, and debug code.' },
+ { slug: 'marketing', title: 'Marketing & Growth', blurb: 'AI that crafts copy, campaigns, and SEO.' },
+ { slug: 'education', title: 'Learn Anything', blurb: 'Tutors, explainers, and knowledge companions.' },
+ { slug: 'design', title: 'Creative Design', blurb: 'Image concepts, design briefs, and visual direction.' },
+ { slug: 'general', title: 'Top Picks This Week', blurb: 'The community\'s most-viewed agents right now.' },
+ { slug: 'entertainment', title: 'Fun & Games', blurb: 'Storytellers, role-players, and game companions.' },
+ { slug: 'career', title: 'Career & Productivity', blurb: 'Résumés, interview prep, and workplace tools.' },
+];
+
+async function handleTheme(req, res) {
+ if (cors(req, res, { methods: 'GET,OPTIONS' })) return;
+ if (!method(req, res, ['GET'])) return;
+
+ const rl = await limits.widgetRead(clientIp(req));
+ if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests');
+
+ const weekNum = Math.floor(Date.now() / (7 * 24 * 3600 * 1000));
+ const cat = THEME_CATEGORIES[weekNum % THEME_CATEGORIES.length];
+
+ const rows = await sql`
+ SELECT a.id, a.name, a.description, a.category, a.tags, a.skills,
+ a.views_count, a.forks_count, a.rating_avg, a.rating_count,
+ a.published_at, a.created_at,
+ v.storage_key AS avatar_storage_key, v.is_public AS avatar_public,
+ v.thumbnail_key
+ FROM agent_identities a
+ LEFT JOIN avatars v ON v.id = a.avatar_id AND v.deleted_at IS NULL
+ WHERE a.is_published = true AND a.deleted_at IS NULL
+ AND (${cat.slug === 'general'} OR a.category = ${cat.slug})
+ ORDER BY a.views_count DESC, a.rating_avg DESC
+ LIMIT 8
+ `;
+
+ const agents = rows.map((row) => ({
+ id: row.id,
+ name: row.name,
+ description: row.description,
+ category: row.category,
+ tags: row.tags || [],
+ skills: row.skills || [],
+ views_count: row.views_count || 0,
+ forks_count: row.forks_count || 0,
+ rating_avg: Number(row.rating_avg || 0),
+ rating_count: row.rating_count || 0,
+ thumbnail_url: row.thumbnail_key ? publicUrl(row.thumbnail_key) : null,
+ avatar_glb_url: row.avatar_public && row.avatar_storage_key ? publicUrl(row.avatar_storage_key) : null,
+ published_at: row.published_at,
+ }));
+
+ return json(
+ res,
+ 200,
+ { data: { theme: { title: cat.title, blurb: cat.blurb, category: cat.slug, agents } } },
+ { 'cache-control': 'public, max-age=3600, stale-while-revalidate=7200' },
+ );
+}
+
// ── Create ─────────────────────────────────────────────────────────────────
async function handleCreate(req, res) {
@@ -300,44 +363,50 @@ async function handleList(req, res, url) {
const cat = category && CATEGORIES.includes(category) ? category : null;
const qLike = q ? `%${q}%` : null;
- const rows = await sql`
- SELECT ai.id, ai.name, ai.description, ai.category, ai.tags, ai.avatar_id, ai.user_id,
- ai.forks_count, ai.views_count, ai.published_at, ai.created_at, ai.skills,
- av.thumbnail_key,
- u.display_name AS author_name,
- EXISTS (
- SELECT 1 FROM agent_skill_prices asp
- WHERE asp.agent_id = ai.id AND asp.is_active = true
- ) AS has_paid_skills,
- (SELECT count(*)::int FROM skill_purchases sp
- WHERE sp.agent_id = ai.id AND sp.status = 'confirmed') AS buyers_total,
- (SELECT count(*)::int FROM skill_purchases sp
- WHERE sp.agent_id = ai.id AND sp.status = 'confirmed'
- AND sp.confirmed_at > now() - interval '24 hours') AS buyers_24h,
- COALESCE((SELECT AVG(rating)::numeric(3,2) FROM agent_reviews r WHERE r.agent_id = ai.id), 0) AS rating_avg,
- COALESCE((SELECT count(*)::int FROM agent_reviews r WHERE r.agent_id = ai.id), 0) AS rating_count,
- ap.amount AS asset_price_amount,
- ap.currency_mint AS asset_price_currency_mint,
- ap.chain AS asset_price_chain,
- ap.mint_decimals AS asset_price_mint_decimals
- FROM agent_identities ai
- LEFT JOIN avatars av ON av.id = ai.avatar_id AND av.deleted_at IS NULL
- LEFT JOIN users u ON u.id = ai.user_id
- LEFT JOIN asset_prices ap
- ON ap.item_type = 'agent' AND ap.item_id = ai.id AND ap.is_active = true
- WHERE ai.is_published = true
- AND ai.deleted_at IS NULL
- AND ai.name !~* ${AGENT_AUTONAMED_RE_SQL}
- AND (${cat}::text IS NULL OR ai.category = ${cat})
- AND (
- ${qLike}::text IS NULL
- OR ai.name ILIKE ${qLike}
- OR ai.description ILIKE ${qLike}
- OR EXISTS (SELECT 1 FROM unnest(ai.tags) t WHERE t ILIKE ${qLike})
- )
- ORDER BY ${orderBy}
- LIMIT ${limit + 1} OFFSET ${offset}
- `;
+ let rows;
+ try {
+ rows = await sql`
+ SELECT ai.id, ai.name, ai.description, ai.category, ai.tags, ai.avatar_id, ai.user_id,
+ ai.forks_count, ai.views_count, ai.published_at, ai.created_at, ai.skills,
+ av.thumbnail_key,
+ u.display_name AS author_name,
+ EXISTS (
+ SELECT 1 FROM agent_skill_prices asp
+ WHERE asp.agent_id = ai.id AND asp.is_active = true
+ ) AS has_paid_skills,
+ COALESCE((SELECT count(*)::int FROM skill_purchases sp
+ WHERE sp.agent_id = ai.id AND sp.status = 'confirmed'), 0) AS buyers_total,
+ COALESCE((SELECT count(*)::int FROM skill_purchases sp
+ WHERE sp.agent_id = ai.id AND sp.status = 'confirmed'
+ AND sp.created_at > now() - interval '24 hours'), 0) AS buyers_24h,
+ COALESCE((SELECT AVG(rating)::numeric(3,2) FROM agent_reviews r WHERE r.agent_id = ai.id), 0) AS rating_avg,
+ COALESCE((SELECT count(*)::int FROM agent_reviews r WHERE r.agent_id = ai.id), 0) AS rating_count,
+ ap.amount AS asset_price_amount,
+ ap.currency_mint AS asset_price_currency_mint,
+ ap.chain AS asset_price_chain,
+ ap.mint_decimals AS asset_price_mint_decimals
+ FROM agent_identities ai
+ LEFT JOIN avatars av ON av.id = ai.avatar_id AND av.deleted_at IS NULL
+ LEFT JOIN users u ON u.id = ai.user_id
+ LEFT JOIN asset_prices ap
+ ON ap.item_type = 'agent' AND ap.item_id = ai.id AND ap.is_active = true
+ WHERE ai.is_published = true
+ AND ai.deleted_at IS NULL
+ AND ai.name !~* ${AGENT_AUTONAMED_RE_SQL}
+ AND (${cat}::text IS NULL OR ai.category = ${cat})
+ AND (
+ ${qLike}::text IS NULL
+ OR ai.name ILIKE ${qLike}
+ OR ai.description ILIKE ${qLike}
+ OR EXISTS (SELECT 1 FROM unnest(ai.tags) t WHERE t ILIKE ${qLike})
+ )
+ ORDER BY ${orderBy}
+ LIMIT ${limit + 1} OFFSET ${offset}
+ `;
+ } catch (err) {
+ console.error('[marketplace/list]', err?.message || err);
+ return error(res, 500, 'db_error', 'Failed to load marketplace listing');
+ }
const hasMore = rows.length > limit;
const items = rows.slice(0, limit).map(toCard);
diff --git a/api/nft/resolve.js b/api/nft/resolve.js
index 401b13674..95af2c74b 100644
--- a/api/nft/resolve.js
+++ b/api/nft/resolve.js
@@ -19,8 +19,7 @@ export default wrap(async (req, res) => {
if (!id) return error(res, 400, 'bad_request', 'id required');
if (chain === 'solana') {
- const apiKey = env.HELIUS_API_KEY;
- const resp = await fetch(`https://mainnet.helius-rpc.com/?api-key=${apiKey}`, {
+ const resp = await fetch(env.SOLANA_RPC_URL, {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'getAsset', params: { id } }),
diff --git a/api/permissions/[action].js b/api/permissions/[action].js
index fca877a9b..5224a2f80 100644
--- a/api/permissions/[action].js
+++ b/api/permissions/[action].js
@@ -326,6 +326,11 @@ async function handleList(req, res) {
return error(res, 400, 'missing_filter', 'agentId or delegator query param is required');
}
+ const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
+ if (agentId && !UUID_RE.test(agentId)) {
+ return error(res, 400, 'invalid_id', 'agentId must be a valid UUID');
+ }
+
const statusParam = url.searchParams.get('status') || 'active';
if (!VALID_STATUSES.has(statusParam)) {
return error(
diff --git a/api/portfolio/[action].js b/api/portfolio/[action].js
index 22324f77c..a34e15ac2 100644
--- a/api/portfolio/[action].js
+++ b/api/portfolio/[action].js
@@ -301,9 +301,7 @@ async function sendSolana({ agent, asset, recipient, amount, userId }) {
}
const { Connection, PublicKey, Transaction, SystemProgram, LAMPORTS_PER_SOL } = await import('@solana/web3.js');
- const rpcUrl = process.env.HELIUS_API_KEY
- ? `https://mainnet.helius-rpc.com/?api-key=${process.env.HELIUS_API_KEY}`
- : 'https://api.mainnet-beta.solana.com';
+ const rpcUrl = process.env.SOLANA_RPC_URL || 'https://api.mainnet-beta.solana.com';
const conn = new Connection(rpcUrl, 'confirmed');
const kp = await recoverSolanaAgentKeypair(encryptedSecret, {
diff --git a/api/pump/[action].js b/api/pump/[action].js
index a01c80b11..0d044f2ca 100644
--- a/api/pump/[action].js
+++ b/api/pump/[action].js
@@ -74,8 +74,8 @@ import {
const TOKEN_PROGRAM_ID = new PublicKey('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA');
const RPC = {
- mainnet: process.env.SOLANA_MAINNET_RPC || 'https://api.mainnet-beta.solana.com',
- devnet: process.env.SOLANA_DEVNET_RPC || 'https://api.devnet.solana.com',
+ mainnet: process.env.SOLANA_RPC_URL || 'https://api.mainnet-beta.solana.com',
+ devnet: process.env.SOLANA_RPC_URL_DEVNET || 'https://api.devnet.solana.com',
};
async function resolveAuth(req) {
diff --git a/api/pump/helius-stats.js b/api/pump/helius-stats.js
index e2afc6ef1..3b40bc9a0 100644
--- a/api/pump/helius-stats.js
+++ b/api/pump/helius-stats.js
@@ -14,7 +14,6 @@
import { cors, json, method, wrap } from '../_lib/http.js';
import { recentBuffered } from '../_lib/pumpfun-ws-feed.js';
-const HELIUS_RPC = 'https://mainnet.helius-rpc.com';
let _solCache = { price: 0, at: 0 };
let _heliusCache = { value: null, at: 0 };
@@ -31,13 +30,14 @@ async function getSolPrice() {
}
async function getHeliusInfo() {
- const key = process.env.HELIUS_API_KEY;
- if (!key) return { enabled: false };
+ const rpcUrl = process.env.SOLANA_RPC_URL || '';
+ const isHelius = rpcUrl.includes('helius-rpc.com');
+ if (!isHelius) return { enabled: false };
if (Date.now() - _heliusCache.at < 4_000 && _heliusCache.value) return _heliusCache.value;
try {
const ctrl = new AbortController();
const tid = setTimeout(() => ctrl.abort(), 1500);
- const r = await fetch(`${HELIUS_RPC}/?api-key=${key}`, {
+ const r = await fetch(rpcUrl, {
method: 'POST',
headers: { 'content-type': 'application/json' },
signal: ctrl.signal,
@@ -51,7 +51,7 @@ async function getHeliusInfo() {
const value = { enabled: true, slot, network: 'mainnet', endpoint: 'helius-rpc' };
_heliusCache = { value, at: Date.now() };
return value;
- } catch (err) {
+ } catch {
const value = { enabled: true, slot: null, network: 'mainnet', error: 'unreachable' };
_heliusCache = { value, at: Date.now() };
return value;
diff --git a/api/scene/gate-check.js b/api/scene/gate-check.js
index 367b6c1b1..68024b520 100644
--- a/api/scene/gate-check.js
+++ b/api/scene/gate-check.js
@@ -141,13 +141,7 @@ async function queryBalance(gate, walletAddress) {
}
async function querySolanaBalance(gate, walletAddress) {
- const heliusKey = process.env.HELIUS_API_KEY;
- if (!heliusKey) {
- const e = new Error('HELIUS_API_KEY not configured');
- e.status = 503;
- throw e;
- }
- const rpcUrl = `https://mainnet.helius-rpc.com/?api-key=${heliusKey}`;
+ const rpcUrl = process.env.SOLANA_RPC_URL || 'https://api.mainnet-beta.solana.com';
if (gate.kind === 'spl') {
const resp = await fetch(rpcUrl, {
diff --git a/api/solana-rpc.js b/api/solana-rpc.js
index 9d6b2faae..9a69a11a5 100644
--- a/api/solana-rpc.js
+++ b/api/solana-rpc.js
@@ -12,17 +12,14 @@
import { cors, method, json, error } from './_lib/http.js';
-const HELIUS_MAINNET = 'https://mainnet.helius-rpc.com';
-const HELIUS_DEVNET = 'https://devnet.helius-rpc.com';
const PUBLIC_MAINNET = 'https://api.mainnet-beta.solana.com';
const PUBLIC_DEVNET = 'https://api.devnet.solana.com';
function upstreamUrl(network) {
- const key = process.env.HELIUS_API_KEY;
if (network === 'devnet') {
- return key ? `${HELIUS_DEVNET}/?api-key=${key}` : PUBLIC_DEVNET;
+ return process.env.SOLANA_RPC_URL_DEVNET || PUBLIC_DEVNET;
}
- return key ? `${HELIUS_MAINNET}/?api-key=${key}` : PUBLIC_MAINNET;
+ return process.env.SOLANA_RPC_URL || PUBLIC_MAINNET;
}
export default async function handler(req, res) {
diff --git a/api/widgets/view.js b/api/widgets/view.js
index d11878626..6d2f1fb69 100644
--- a/api/widgets/view.js
+++ b/api/widgets/view.js
@@ -31,12 +31,26 @@ export default wrap(async (req, res) => {
insert into widget_views (widget_id, country, referer_host, created_at)
values (${widgetId}, ${country}, ${refererHost}, now())
`;
+ } catch (err) {
+ if (err?.code === '23503') {
+ // FK violation: widget_id does not exist — best-effort analytics, swallow silently
+ } else if (/relation .* does not exist/i.test(err?.message || '')) {
+ // Table not yet migrated — swallow silently
+ } else {
+ throw err;
+ }
+ }
+ try {
await sql`
update widgets set view_count = view_count + 1 where id = ${widgetId}
`;
} catch (err) {
- if (!/relation .* does not exist/i.test(err?.message || '')) {
- console.warn('[widgets/view] log failed', err?.message);
+ if (err?.code === '23503') {
+ // FK violation — swallow silently
+ } else if (/relation .* does not exist/i.test(err?.message || '')) {
+ // Table not yet migrated — swallow silently
+ } else {
+ throw err;
}
}
diff --git a/api/x402/agent-reputation.js b/api/x402/agent-reputation.js
index 9abbed289..86aee1322 100644
--- a/api/x402/agent-reputation.js
+++ b/api/x402/agent-reputation.js
@@ -17,6 +17,7 @@ import { buildBazaarSchema } from '../_lib/x402-spec.js';
import { installAccessControl } from '../_lib/x402/access-control.js';
import { withService } from '../_lib/x402/bazaar-helpers.js';
import { sql } from '../_lib/db.js';
+import { priceFor } from '../_lib/x402-prices.js';
const ROUTE = '/api/x402/agent-reputation';
@@ -288,7 +289,7 @@ async function loadReputation(agentId) {
export default paidEndpoint({
route: ROUTE,
method: 'GET',
- priceAtomics: '10000',
+ priceAtomics: priceFor('agent-reputation', '10000'),
networks: ['base', 'solana'],
description: DESCRIPTION,
bazaar: BAZAAR,
diff --git a/api/x402/dance-tip.js b/api/x402/dance-tip.js
index 19757729b..b69a3dfbc 100644
--- a/api/x402/dance-tip.js
+++ b/api/x402/dance-tip.js
@@ -20,6 +20,7 @@ import { buildBazaarSchema } from '../_lib/x402-spec.js';
import { installAccessControl } from '../_lib/x402/access-control.js';
import { withService } from '../_lib/x402/bazaar-helpers.js';
import { sql } from '../_lib/db.js';
+import { priceFor } from '../_lib/x402-prices.js';
const ROUTE = '/api/x402/dance-tip';
@@ -257,7 +258,7 @@ export const BAZAAR_SCHEMA = BAZAAR;
export default paidEndpoint({
route: ROUTE,
method: 'GET',
- priceAtomics: '1000',
+ priceAtomics: priceFor('dance-tip', '1000'),
networks: ['base', 'solana'],
description: DESCRIPTION,
bazaar: BAZAAR,
diff --git a/api/x402/mint-to-mesh-batch.js b/api/x402/mint-to-mesh-batch.js
index c9e5548cc..1a611806c 100644
--- a/api/x402/mint-to-mesh-batch.js
+++ b/api/x402/mint-to-mesh-batch.js
@@ -19,6 +19,7 @@ import { withService } from '../_lib/x402/bazaar-helpers.js';
import { readJson } from '../_lib/http.js';
import { createThemedGLB, colorFromMint } from '../_lib/glb-themer.js';
import { fetchTokenMeta } from '../_lib/solana-token-meta.js';
+import { priceFor } from '../_lib/x402-prices.js';
const ROUTE = '/api/x402/mint-to-mesh-batch';
@@ -157,7 +158,7 @@ async function buildOne(mint) {
export default paidEndpoint({
route: ROUTE,
method: 'POST',
- priceAtomics: '50000',
+ priceAtomics: priceFor('mint-to-mesh-batch', '50000'),
networks: ['base', 'solana'],
description: DESCRIPTION,
bazaar: BAZAAR,
diff --git a/api/x402/my-receipts.js b/api/x402/my-receipts.js
index 87b353ec2..05dd39ef6 100644
--- a/api/x402/my-receipts.js
+++ b/api/x402/my-receipts.js
@@ -1,20 +1,19 @@
-// GET /api/x402/my-receipts?address=0x...&signature=0x...&issuedAt=<iso>&sinceUnix=<n>
+// GET /api/x402/my-receipts?address=<addr>&signature=<sig>&issuedAt=<iso>&network=<evm|solana>&sinceUnix=<n>
//
// Buyer-side read endpoint for the x402 Offer & Receipt extension (USE-17).
// Returns every signed receipt we issued to the requested wallet so a buyer
// can re-fetch their proof-of-purchase artifacts long after the original
// payment-response header was dropped from their client.
//
-// Authentication: the buyer signs a personal_sign message proving control of
-// the wallet whose receipts they're requesting. We recover the signer with
-// viem.verifyMessage; if the recovered address matches `address`, we return
-// the receipt log entries. The signed message includes an `issuedAt` ISO
-// timestamp so old signatures can't be replayed indefinitely (5-minute window).
-//
-// This is EVM-only for now. Solana-payer receipts ARE stored (the receipt log
-// is network-agnostic) but querying them needs a Solana signature flow that
-// isn't wired up here yet — a follow-up endpoint can hit the same storage
-// helper with `payer=<solana-address>`.
+// Authentication: the buyer signs a personal_sign-style message proving
+// control of the wallet whose receipts they're requesting. We recover the
+// signer per-family:
+// - EVM (network=evm or 0x-hex address): viem verifyMessage. Supports EOAs
+// and EIP-1271 contract signatures.
+// - Solana (network=solana or base58 address): tweetnacl/ed25519 verify
+// against the base58-encoded signature.
+// In both cases the signed message includes an `issuedAt` ISO timestamp so
+// old signatures can't be replayed indefinitely (5-minute window).
import { createPublicClient, http } from 'viem';
import { mainnet } from 'viem/chains';
@@ -22,8 +21,11 @@ import { mainnet } from 'viem/chains';
import { cors, error, json, method } from '../_lib/http.js';
import { limits, clientIp } from '../_lib/rate-limit.js';
import { listReceiptsForPayer } from '../_lib/x402/receipt-storage.js';
+import { verifySiwsSignature } from '../_lib/siws.js';
const MAX_AGE_SECONDS = 300;
+const EVM_RE = /^0x[a-fA-F0-9]{40}$/;
+const SOL_RE = /^[A-HJ-NP-Za-km-z1-9]{32,44}$/;
// Lightweight viem client used purely for verifyMessage (which works for EOAs
// and EIP-1271 contract signatures). Mainnet RPC is fine — verifyMessage only
@@ -34,8 +36,13 @@ function getClient() {
return _client;
}
-function buildExpectedMessage(address, issuedAt) {
- return `three.ws x402 receipts read\nAddress: ${address.toLowerCase()}\nIssued At: ${issuedAt}`;
+function buildExpectedMessage(address, issuedAt, network) {
+ // Network is part of the message domain so an EVM signature can't be
+ // replayed as a Solana one (and vice versa). Address case normalized to
+ // match the storage layer's lowercasing for EVM; Solana base58 is
+ // case-sensitive and stays verbatim.
+ const normalized = network === 'solana' ? address : address.toLowerCase();
+ return `three.ws x402 receipts read\nNetwork: ${network}\nAddress: ${normalized}\nIssued At: ${issuedAt}`;
}
function withinFreshnessWindow(issuedAt) {
@@ -45,6 +52,13 @@ function withinFreshnessWindow(issuedAt) {
return ageSec >= 0 && ageSec <= MAX_AGE_SECONDS;
}
+function detectNetwork(address, declared) {
+ if (declared === 'evm' || declared === 'solana') return declared;
+ if (EVM_RE.test(address)) return 'evm';
+ if (SOL_RE.test(address)) return 'solana';
+ return null;
+}
+
export default async function handler(req, res) {
if (cors(req, res, { methods: 'GET,OPTIONS', origins: '*' })) return;
if (!method(req, res, ['GET'])) return;
@@ -56,15 +70,38 @@ export default async function handler(req, res) {
const address = String(url.searchParams.get('address') || '').trim();
const signature = String(url.searchParams.get('signature') || '').trim();
const issuedAt = String(url.searchParams.get('issuedAt') || '').trim();
+ const declaredNetwork = String(url.searchParams.get('network') || '').trim().toLowerCase();
const sinceUnix = url.searchParams.get('sinceUnix');
const limit = url.searchParams.get('limit');
- if (!/^0x[a-fA-F0-9]{40}$/.test(address)) {
- return error(res, 400, 'invalid_address', 'address must be an EVM 0x-hex address');
+ const network = detectNetwork(address, declaredNetwork);
+ if (!network) {
+ return error(
+ res,
+ 400,
+ 'invalid_address',
+ 'address must be a 0x EVM address or a base58 Solana address',
+ );
}
- if (!/^0x[a-fA-F0-9]+$/.test(signature)) {
- return error(res, 400, 'invalid_signature', 'signature must be 0x-hex');
+
+ if (network === 'evm') {
+ if (!EVM_RE.test(address)) {
+ return error(res, 400, 'invalid_address', 'EVM address must be 0x + 40 hex chars');
+ }
+ if (!/^0x[a-fA-F0-9]+$/.test(signature)) {
+ return error(res, 400, 'invalid_signature', 'EVM signature must be 0x-hex');
+ }
+ } else {
+ if (!SOL_RE.test(address)) {
+ return error(res, 400, 'invalid_address', 'Solana address must be base58 (32-44 chars)');
+ }
+ // Phantom emits base58 (87-88 chars). Other Solana wallets emit base64.
+ // verifySiwsSignature handles both formats.
+ if (!signature || signature.length < 60) {
+ return error(res, 400, 'invalid_signature', 'Solana signature must be base58 or base64');
+ }
}
+
if (!issuedAt || !withinFreshnessWindow(issuedAt)) {
return error(
res,
@@ -74,10 +111,14 @@ export default async function handler(req, res) {
);
}
- const message = buildExpectedMessage(address, issuedAt);
- let valid;
+ const message = buildExpectedMessage(address, issuedAt, network);
+ let valid = false;
try {
- valid = await getClient().verifyMessage({ address, message, signature });
+ if (network === 'evm') {
+ valid = await getClient().verifyMessage({ address, message, signature });
+ } else {
+ valid = verifySiwsSignature(message, signature, address);
+ }
} catch (err) {
return error(res, 400, 'signature_check_failed', err.message);
}
@@ -90,15 +131,19 @@ export default async function handler(req, res) {
);
}
+ // Storage layer stores EVM addresses lowercased and Solana addresses as-is;
+ // match that convention so the join hits.
+ const payerKey = network === 'evm' ? address.toLowerCase() : address;
let rows;
try {
- rows = await listReceiptsForPayer({ payer: address, sinceUnix, limit });
+ rows = await listReceiptsForPayer({ payer: payerKey, sinceUnix, limit });
} catch (err) {
return error(res, 502, 'receipt_query_failed', err.message);
}
json(res, 200, {
- address: address.toLowerCase(),
+ network,
+ address: payerKey,
count: rows.length,
receipts: rows,
});
diff --git a/api/x402/onchain-identity-verify.js b/api/x402/onchain-identity-verify.js
index 935f5dfcf..75846ad3e 100644
--- a/api/x402/onchain-identity-verify.js
+++ b/api/x402/onchain-identity-verify.js
@@ -17,6 +17,7 @@ import { buildBazaarSchema } from '../_lib/x402-spec.js';
import { installAccessControl } from '../_lib/x402/access-control.js';
import { withService } from '../_lib/x402/bazaar-helpers.js';
import { sql } from '../_lib/db.js';
+import { priceFor } from '../_lib/x402-prices.js';
const ROUTE = '/api/x402/onchain-identity-verify';
@@ -168,7 +169,7 @@ async function verifyIdentity({ agentId, chain, address }) {
export default paidEndpoint({
route: ROUTE,
method: 'GET',
- priceAtomics: '5000',
+ priceAtomics: priceFor('onchain-identity-verify', '5000'),
networks: ['base', 'solana'],
description: DESCRIPTION,
bazaar: BAZAAR,
diff --git a/api/x402/pump-agent-audit.js b/api/x402/pump-agent-audit.js
index cb1c5dd04..a9e584e50 100644
--- a/api/x402/pump-agent-audit.js
+++ b/api/x402/pump-agent-audit.js
@@ -17,6 +17,7 @@ import { buildBazaarSchema } from '../_lib/x402-spec.js';
import { installAccessControl } from '../_lib/x402/access-control.js';
import { withService } from '../_lib/x402/bazaar-helpers.js';
import { sql } from '../_lib/db.js';
+import { priceFor } from '../_lib/x402-prices.js';
const ROUTE = '/api/x402/pump-agent-audit';
@@ -239,7 +240,7 @@ async function loadAudit(mint) {
export default paidEndpoint({
route: ROUTE,
method: 'GET',
- priceAtomics: '20000',
+ priceAtomics: priceFor('pump-agent-audit', '20000'),
networks: ['base', 'solana'],
description: DESCRIPTION,
bazaar: BAZAAR,
diff --git a/api/x402/skill-marketplace.js b/api/x402/skill-marketplace.js
index 52bbaafce..b2b56bd09 100644
--- a/api/x402/skill-marketplace.js
+++ b/api/x402/skill-marketplace.js
@@ -15,6 +15,7 @@ import { buildBazaarSchema } from '../_lib/x402-spec.js';
import { installAccessControl } from '../_lib/x402/access-control.js';
import { withService } from '../_lib/x402/bazaar-helpers.js';
import { sql } from '../_lib/db.js';
+import { priceFor } from '../_lib/x402-prices.js';
const ROUTE = '/api/x402/skill-marketplace';
@@ -178,7 +179,7 @@ async function loadListings({ skill, limit }) {
export default paidEndpoint({
route: ROUTE,
method: 'GET',
- priceAtomics: '1000',
+ priceAtomics: priceFor('skill-marketplace', '1000'),
networks: ['base', 'solana'],
description: DESCRIPTION,
bazaar: BAZAAR,
diff --git a/api/x402/symbol-availability.js b/api/x402/symbol-availability.js
index 509bab4e7..58d062890 100644
--- a/api/x402/symbol-availability.js
+++ b/api/x402/symbol-availability.js
@@ -17,6 +17,7 @@ import { buildBazaarSchema } from '../_lib/x402-spec.js';
import { installAccessControl } from '../_lib/x402/access-control.js';
import { withService } from '../_lib/x402/bazaar-helpers.js';
import { sql } from '../_lib/db.js';
+import { priceFor } from '../_lib/x402-prices.js';
const ROUTE = '/api/x402/symbol-availability';
@@ -153,7 +154,7 @@ async function checkSymbol({ ticker, network }) {
export default paidEndpoint({
route: ROUTE,
method: 'GET',
- priceAtomics: '1000',
+ priceAtomics: priceFor('symbol-availability', '1000'),
networks: ['base', 'solana'],
description: DESCRIPTION,
bazaar: BAZAAR,
diff --git a/pages/agent-home.html b/pages/agent-home.html
index bdd555a32..f6b8a792d 100644
--- a/pages/agent-home.html
+++ b/pages/agent-home.html
@@ -3,12 +3,17 @@
<head>
<meta charset="utf-8" />
<title>Agent Home — three.ws</title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<meta
name="description"
content="An embodied 3D AI agent — body, place, identity, memory."
/>
<meta name="theme-color" content="#000000" />
+ <meta name="mobile-web-app-capable" content="yes" />
+ <meta name="apple-mobile-web-app-capable" content="yes" />
+ <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
+ <meta name="apple-mobile-web-app-title" content="three.ws" />
+ <link rel="apple-touch-icon" href="/pwa-192x192.png" />
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="stylesheet" href="/style.css" />
@@ -943,7 +948,7 @@
class="agent-embed-preview-link"
id="agent-embed-preview"
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
>preview embed →</a
>
<a
@@ -951,7 +956,7 @@
id="agent-embed-settings"
href=""
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
>embed settings →</a
>
</section>
@@ -1002,7 +1007,7 @@
<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/trythreews" target="_blank" rel="noopener">
+ <a class="h-footer-community-btn" href="https://x.com/trythreews" target="_blank" rel="noopener noreferrer">
<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>
@@ -1010,7 +1015,7 @@
<div class="h-footer-resources">
<h3>Resources</h3>
<p>Read the docs, join the community, and get help.</p>
- <a class="h-footer-community-btn" href="/docs" target="_blank" rel="noopener">
+ <a class="h-footer-community-btn" href="/docs" target="_blank" rel="noopener noreferrer">
<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>
Docs
</a>
@@ -1025,10 +1030,10 @@
</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/trythreews" target="_blank" rel="noopener" aria-label="three.ws on X">
+ <a class="h-footer-social" href="https://x.com/trythreews" target="_blank" rel="noopener noreferrer" aria-label="three.ws on X">
<svg viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>
</a>
- <a class="h-footer-social" href="https://github.com/nirholas/three.ws" target="_blank" rel="noopener" aria-label="three.ws on GitHub">
+ <a class="h-footer-social" href="https://github.com/nirholas/three.ws" target="_blank" rel="noopener noreferrer" 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>
@@ -1044,8 +1049,8 @@
<div class="h-footer-link-col">
<h4 class="h-footer-link-heading">Developers</h4>
<a href="/docs">Docs</a>
- <a href="https://github.com/nirholas/three.ws" target="_blank" rel="noopener">GitHub</a>
- <a href="https://eips.ethereum.org/EIPS/eip-8004" target="_blank" rel="noopener">ERC-8004</a>
+ <a href="https://github.com/nirholas/three.ws" target="_blank" rel="noopener noreferrer">GitHub</a>
+ <a href="https://eips.ethereum.org/EIPS/eip-8004" target="_blank" rel="noopener noreferrer">ERC-8004</a>
</div>
<div class="h-footer-link-col">
<h4 class="h-footer-link-heading">Resources</h4>
diff --git a/pages/app-demo.html b/pages/app-demo.html
index bf53754c8..efbfeee74 100644
--- a/pages/app-demo.html
+++ b/pages/app-demo.html
@@ -151,7 +151,7 @@
id="view-public-profile-btn"
hidden
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
aria-label="Open this agent's public profile in a new tab"
title="Open this agent's public profile in a new tab"
>
@@ -258,7 +258,7 @@
class="agent-onboarding__btn"
id="agent-onboarding-share"
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
>View public profile</a
>
</div>
diff --git a/pages/app.html b/pages/app.html
index 348140ca1..e12d32d62 100644
--- a/pages/app.html
+++ b/pages/app.html
@@ -150,7 +150,7 @@
id="view-public-profile-btn"
hidden
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
aria-label="Open this agent's public profile in a new tab"
title="Open this agent's public profile in a new tab"
>
@@ -284,7 +284,7 @@
class="agent-onboarding__btn"
id="agent-onboarding-share"
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
>View public profile</a
>
</div>
@@ -422,7 +422,7 @@
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="12 2 22 8.5 22 15.5 12 22 2 15.5 2 8.5 12 2" /><line x1="12" y1="2" x2="12" y2="22" /><polyline points="22 8.5 12 15.5 2 8.5" /></svg>
<span>Deploy on-chain</span>
</a>
- <a class="next-share-menu__item" id="next-share-profile" role="menuitem" target="_blank" rel="noopener" hidden>
+ <a class="next-share-menu__item" id="next-share-profile" role="menuitem" target="_blank" rel="noopener noreferrer" hidden>
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" /><polyline points="15 3 21 3 21 9" /><line x1="10" y1="14" x2="21" y2="3" /></svg>
<span>Public profile</span>
</a>
diff --git a/pages/features.html b/pages/features.html
index 33eb54010..14bc23e4d 100644
--- a/pages/features.html
+++ b/pages/features.html
@@ -684,7 +684,7 @@
<a
href="https://github.com/nirholas/three.ws"
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
class="h-feature-link"
>GitHub →</a
>
@@ -794,7 +794,7 @@
class="h-footer-community-btn"
href="https://x.com/trythreews"
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path
@@ -819,7 +819,7 @@
class="h-footer-social"
href="https://x.com/trythreews"
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
aria-label="three.ws on X"
>
<svg viewBox="0 0 24 24" aria-hidden="true">
@@ -833,7 +833,7 @@
class="h-footer-social"
href="https://github.com/nirholas/three.ws"
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
aria-label="three.ws on GitHub"
>
<svg viewBox="0 0 16 16" aria-hidden="true">
@@ -859,13 +859,13 @@
<a
href="https://github.com/nirholas/three.ws"
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
>GitHub</a
>
<a
href="https://developers.metaplex.com/core"
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
>Metaplex Core</a
>
</div>
diff --git a/pages/home-v2.html b/pages/home-v2.html
index 5dae84e79..67dc7b299 100644
--- a/pages/home-v2.html
+++ b/pages/home-v2.html
@@ -694,7 +694,7 @@
<a
href="https://github.com/nirholas/three.ws"
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
class="h-feature-link"
>GitHub →</a
>
@@ -804,7 +804,7 @@
class="h-footer-community-btn"
href="https://x.com/trythreews"
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path
@@ -829,7 +829,7 @@
class="h-footer-social"
href="https://x.com/trythreews"
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
aria-label="three.ws on X"
>
<svg viewBox="0 0 24 24" aria-hidden="true">
@@ -843,7 +843,7 @@
class="h-footer-social"
href="https://github.com/nirholas/three.ws"
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
aria-label="three.ws on GitHub"
>
<svg viewBox="0 0 16 16" aria-hidden="true">
@@ -869,13 +869,13 @@
<a
href="https://github.com/nirholas/three.ws"
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
>GitHub</a
>
<a
href="https://developers.metaplex.com/core"
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
>Metaplex Core</a
>
</div>
diff --git a/pages/home.html b/pages/home.html
index 5596a1222..e8003cd69 100644
--- a/pages/home.html
+++ b/pages/home.html
@@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>three.ws — The 3D layer for your AI agent</title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<meta name="author" content="nirholas" />
<meta
name="description"
@@ -520,7 +520,7 @@
<a
href="https://github.com/nirholas/three.ws"
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
class="h-feature-link"
>GitHub →</a
>
@@ -630,7 +630,7 @@
class="h-footer-community-btn"
href="https://x.com/trythreews"
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path
@@ -655,7 +655,7 @@
class="h-footer-social"
href="https://x.com/trythreews"
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
aria-label="three.ws on X"
>
<svg viewBox="0 0 24 24" aria-hidden="true">
@@ -669,7 +669,7 @@
class="h-footer-social"
href="https://github.com/nirholas/three.ws"
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
aria-label="three.ws on GitHub"
>
<svg viewBox="0 0 16 16" aria-hidden="true">
@@ -695,13 +695,13 @@
<a
href="https://github.com/nirholas/three.ws"
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
>GitHub</a
>
<a
href="https://developers.metaplex.com/core"
target="_blank"
- rel="noopener"
+ rel="noopener noreferrer"
>Metaplex Core</a
>
</div>
diff --git a/pages/import-rpm.html b/pages/import-rpm.html
index 5a825a854..41a56a614 100644
--- a/pages/import-rpm.html
+++ b/pages/import-rpm.html
@@ -111,6 +111,7 @@
.tab-btn {
flex: 1;
padding: 13px 14px;
+ min-height: 48px;
background: none;
border: none;
border-bottom: 2px solid transparent;
@@ -153,12 +154,13 @@
display: block;
width: 100%;
padding: 11px 14px;
+ min-height: 48px;
background: var(--panel-2);
border: 1px solid var(--border-2);
border-radius: 8px;
color: var(--text);
font: inherit;
- font-size: 14px;
+ font-size: 16px;
outline: none;
transition: border-color 0.15s, box-shadow 0.15s;
}
@@ -212,12 +214,13 @@
display: block;
width: 100%;
margin-top: 20px;
- padding: 13px 20px;
+ padding: 14px 20px;
+ min-height: 52px;
background: var(--accent);
color: #0b1014;
font: inherit;
font-weight: 700;
- font-size: 14px;
+ font-size: 15px;
border: none;
border-radius: 8px;
cursor: pointer;
@@ -228,6 +231,25 @@
.submit-btn:active:not(:disabled) { transform: scale(0.99); }
.submit-btn:disabled { opacity: 0.45; cursor: not-allowed; }
+ /* On touch devices: hide drag-drop language, surface tap-to-browse */
+ @media (hover: none) and (pointer: coarse) {
+ .drop-zone-title { display: none; }
+ .drop-zone-title-touch { display: block; }
+ .drop-zone {
+ padding: 32px 20px;
+ }
+ .page {
+ padding: 28px 16px 80px;
+ }
+ }
+ .drop-zone-title-touch {
+ display: none;
+ font-size: 14px;
+ font-weight: 600;
+ color: var(--text);
+ margin-bottom: 4px;
+ }
+
/* ── Progress ────────────────────────────────────────────────── */
.progress-wrap {
display: none;
@@ -401,6 +423,7 @@
/>
<div class="drop-zone-icon">📦</div>
<div class="drop-zone-title" id="drop-title">Drag &amp; drop your GLB here</div>
+ <div class="drop-zone-title-touch">Tap to choose your GLB file</div>
<div class="drop-zone-sub">or click to browse · .glb · max 100 MB</div>
</div>
diff --git a/pages/mocap-studio.html b/pages/mocap-studio.html
index 40bde495e..f46d4e998 100644
--- a/pages/mocap-studio.html
+++ b/pages/mocap-studio.html
@@ -24,6 +24,7 @@
body {
margin: 0;
min-height: 100vh;
+ min-height: 100dvh;
background: radial-gradient(1200px 600px at 70% -10%, #1a1f29, var(--bg));
color: var(--ink);
font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
@@ -211,6 +212,58 @@
color: rgba(255, 180, 84, 0.95);
}
.signed-out a { color: rgba(255, 180, 84, 0.95); font-weight: 600; }
+
+ /* ── Mobile improvements ───────────────────────────────────────── */
+ button.btn {
+ min-height: 44px;
+ padding: 10px 18px;
+ }
+ .row input,
+ .row select,
+ .row textarea {
+ min-height: 44px;
+ }
+ @media (max-width: 640px) {
+ body {
+ padding: 12px;
+ gap: 12px;
+ min-height: 100dvh;
+ }
+ .stage {
+ min-height: 280px;
+ min-height: min(56vw, 420px);
+ }
+ #webcam-pip {
+ width: 100px;
+ height: 75px;
+ top: max(12px, env(safe-area-inset-top, 12px));
+ right: max(12px, env(safe-area-inset-right, 12px));
+ }
+ .rec-pill {
+ top: max(12px, env(safe-area-inset-top, 12px));
+ left: max(12px, env(safe-area-inset-left, 12px));
+ }
+ .timer { font-size: 28px; }
+ .actions { gap: 6px; }
+ button.btn { font-size: 12px; padding: 10px 13px; }
+ h1 { font-size: 18px; }
+ .card { padding: 12px; }
+ .row { flex-direction: column; gap: 4px; }
+ .row > label { min-width: unset; }
+ .clip-list { max-height: 280px; }
+ }
+ @media (orientation: landscape) and (max-height: 500px) {
+ body {
+ grid-template-columns: minmax(0, 1fr) minmax(260px, 0.7fr);
+ padding: 10px;
+ gap: 10px;
+ }
+ .stage { min-height: 200px; }
+ #webcam-pip { width: 80px; height: 60px; }
+ h1 { font-size: 16px; margin: 0 0 2px; }
+ .sub { display: none; }
+ .timer { font-size: 24px; margin: 6px 0; }
+ }
</style>
</head>
<body>
diff --git a/pages/profile.html b/pages/profile.html
index 208f66d9c..8cfa6c4b8 100644
--- a/pages/profile.html
+++ b/pages/profile.html
@@ -3,9 +3,14 @@
<head>
<meta charset="utf-8" />
<title>Agent Profile</title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<meta name="description" content="On-chain agent identity profile." />
<meta name="theme-color" content="#000000" />
+ <meta name="mobile-web-app-capable" content="yes" />
+ <meta name="apple-mobile-web-app-capable" content="yes" />
+ <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
+ <meta name="apple-mobile-web-app-title" content="three.ws" />
+ <link rel="apple-touch-icon" href="/pwa-192x192.png" />
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="stylesheet" href="/style.css" />
diff --git a/public/crypto-demo.html b/public/crypto-demo.html
index 1ee4829cd..46bc97ee6 100644
--- a/public/crypto-demo.html
+++ b/public/crypto-demo.html
@@ -2,10 +2,11 @@
<html lang="en">
<head>
<meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>3D-Agent Crypto Demo</title>
<style>
body { margin: 0; background: #1a1a1a; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; font-family: sans-serif; }
- agent-3d { width: 400px; height: 560px; display: block; border-radius: 16px; box-shadow: 0 0 20px rgba(0,0,0,0.5); }
+ agent-3d { width: min(400px, calc(100vw - 32px)); height: min(560px, 70vh); display: block; border-radius: 16px; box-shadow: 0 0 20px rgba(0,0,0,0.5); }
h1 { margin-bottom: 20px; }
</style>
</head>
diff --git a/public/embed.js b/public/embed.js
index 8dc349661..b119ac730 100644
--- a/public/embed.js
+++ b/public/embed.js
@@ -74,7 +74,17 @@
var iframe = document.createElement('iframe');
iframe.title = 'three.ws widget ' + widgetId;
iframe.allow = 'autoplay; clipboard-write; xr-spatial-tracking';
- iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin allow-popups');
+ // Sandbox set:
+ // allow-scripts — viewer + RPC server need JS.
+ // allow-same-origin — postMessage handshake to /widget needs it.
+ // allow-forms — talking-agent chat input is a <form>.
+ // allow-popups + escape — passport "view on chain" target=_blank.
+ // Notably NOT allowed: top-navigation, modals, pointer-lock, presentation.
+ iframe.setAttribute(
+ 'sandbox',
+ 'allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox',
+ );
+ iframe.setAttribute('referrerpolicy', 'strict-origin-when-cross-origin');
iframe.setAttribute('width', width);
iframe.setAttribute('height', height);
// Default: lazy. Embedders flagged as high-priority opt into eager.
@@ -362,8 +372,19 @@
var iframe = document.createElement('iframe');
iframe.src = src;
- iframe.allow = 'autoplay; camera; microphone; xr-spatial-tracking';
+ iframe.allow = 'autoplay; camera; microphone; xr-spatial-tracking; clipboard-write';
+ // Explicit sandbox matching the widget snippet — same engine, same
+ // surface area. allow-same-origin is required for postMessage handshake
+ // + the bridge upgrade path that imports embed-host-bridge.js.
+ // allow-forms covers the talking-agent chat input; allow-popups lets
+ // passport-style "view on chain" links open in a new tab.
+ iframe.setAttribute(
+ 'sandbox',
+ 'allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox',
+ );
iframe.setAttribute('allowtransparency', 'true');
+ iframe.setAttribute('referrerpolicy', 'strict-origin-when-cross-origin');
+ iframe.setAttribute('loading', 'lazy');
iframe.setAttribute('aria-label', el.getAttribute('name') || 'three.ws avatar');
el.shadowRoot.appendChild(iframe);
el._iframe = iframe;
diff --git a/public/marketplace-v2.css b/public/marketplace-v2.css
index b1fe949b2..5d82e5db5 100644
--- a/public/marketplace-v2.css
+++ b/public/marketplace-v2.css
@@ -363,14 +363,14 @@ body.market-page > #footer-container {
.market-sidebar-toggle {
display: none;
position: fixed;
- top: 14px;
- left: 14px;
+ top: max(14px, env(safe-area-inset-top, 14px));
+ left: max(14px, env(safe-area-inset-left, 14px));
z-index: 50;
background: #111;
border: 1px solid #2a2a2a;
color: #fafafa;
- width: 38px;
- height: 38px;
+ width: 44px;
+ height: 44px;
border-radius: 10px;
cursor: pointer;
font-size: 18px;
diff --git a/public/mobile.css b/public/mobile.css
index da726d9b9..f37eed048 100644
--- a/public/mobile.css
+++ b/public/mobile.css
@@ -200,3 +200,174 @@
justify-content: center;
}
}
+
+/* ── Safe-area insets for fixed/sticky UI ──────────────────────────────
+ * Applied globally so every page benefits. Modals and drawers that sit
+ * at the viewport edge need padding-bottom to clear the iPhone home
+ * indicator and Android navigation bar.
+ */
+@supports (padding: env(safe-area-inset-bottom)) {
+ /* Modals anchored to full viewport height */
+ .modal-content,
+ .plugin-modal,
+ .avatar-modal-side,
+ .auth-form-wrap {
+ padding-bottom: max(24px, env(safe-area-inset-bottom));
+ }
+
+ /* Toast / snackbar that sits at bottom-center */
+ .agent-deploy-toast,
+ .status-toast,
+ .toast {
+ bottom: max(1.5rem, calc(env(safe-area-inset-bottom) + 1rem));
+ }
+
+ /* Sticky bottom nav / tab bars */
+ .nav-bottom,
+ .bottom-bar,
+ .mobile-tab-bar {
+ padding-bottom: env(safe-area-inset-bottom);
+ }
+
+ /* Auth shell on very small iPhones */
+ @media (max-width: 860px) {
+ body:has(.shell) {
+ padding-bottom: env(safe-area-inset-bottom);
+ }
+ }
+}
+
+/* ── 360px — very small Android phones ────────────────────────────────
+ * Galaxy A series, Moto G, etc. sit at 360px.
+ */
+@media (max-width: 360px) {
+ /* Marketplace: force single column so cards don't shrink below usable size */
+ .market-grid {
+ grid-template-columns: 1fr !important;
+ }
+
+ /* Create page: full-bleed cards */
+ .card-grid {
+ grid-template-columns: 1fr !important;
+ max-width: none !important;
+ padding: 0;
+ }
+
+ /* Auth: let the avatar panel compress more */
+ .panel {
+ min-height: 160px !important;
+ }
+ .agent-avatar {
+ width: 140px !important;
+ height: 140px !important;
+ }
+
+ /* Nav: shrink wordmark gap */
+ .wordmark-logo {
+ width: 18px;
+ height: 18px;
+ }
+}
+
+/* ── PWA standalone mode ────────────────────────────────────────────────
+ * When installed as a PWA (no browser chrome), compensate for the absence
+ * of the browser status bar and adjust top-anchored sticky headers.
+ */
+@media (display-mode: standalone) {
+ /* Give the topmost sticky header extra top padding for the status bar area */
+ header:first-of-type,
+ .nav-top,
+ .market-topbar,
+ .agent-page-header {
+ padding-top: max(0.75rem, env(safe-area-inset-top));
+ }
+
+ /* Bottom of scrollable main content — clear the home indicator */
+ main,
+ .stage,
+ .market-main {
+ padding-bottom: max(2rem, calc(env(safe-area-inset-bottom) + 1rem));
+ }
+
+ /* Hide browser-specific UI hints that don't apply in standalone */
+ .h-scroll-hint {
+ display: none;
+ }
+}
+
+/* ── Marketplace mobile polish ─────────────────────────────────────────
+ * Supplements marketplace.css at breakpoints it doesn't cover.
+ */
+@media (max-width: 480px) {
+ /* Modal: full-screen bottom sheet on phones */
+ .avatar-modal {
+ position: fixed !important;
+ inset: 0 !important;
+ max-height: 100dvh !important;
+ border-radius: 0 !important;
+ grid-template-columns: 1fr !important;
+ grid-template-rows: 48vw 1fr !important;
+ }
+
+ .avatar-modal-side {
+ max-height: none;
+ overflow-y: auto;
+ -webkit-overflow-scrolling: touch;
+ }
+
+ /* Topbar: stack filter row below search on very narrow screens */
+ .market-filter-chips {
+ gap: 6px;
+ }
+ .market-filter-chip {
+ font-size: 0.72rem;
+ padding: 5px 10px;
+ }
+}
+
+/* ── Create page mobile polish ─────────────────────────────────────────
+ */
+@media (max-width: 700px) {
+ /* Upload drop zone: increase height so it's easier to tap */
+ .upload-zone,
+ [class*='drop-zone'] {
+ min-height: 140px;
+ }
+
+ /* Card CTAs: full tap width */
+ .create-card {
+ -webkit-tap-highlight-color: transparent;
+ }
+}
+
+/* ── Auth / login mobile polish ────────────────────────────────────────
+ */
+@media (max-width: 480px) {
+ /* Sign-in form: use full available height */
+ .shell {
+ border-radius: 0;
+ min-height: 100dvh;
+ }
+
+ /* Wallet connect button row: stack if too many */
+ .wallet-list,
+ .wallet-grid {
+ grid-template-columns: 1fr !important;
+ }
+}
+
+/* ── Scroll behaviour ──────────────────────────────────────────────────
+ * Smooth momentum scroll on iOS for overflow containers.
+ */
+@media (hover: none) and (pointer: coarse) {
+ [style*='overflow: auto'],
+ [style*='overflow-y: auto'],
+ [style*='overflow-y: scroll'],
+ .scrollable,
+ .avatar-modal-side,
+ .market-main,
+ .agent-chat-history {
+ -webkit-overflow-scrolling: touch;
+ scroll-behavior: smooth;
+ }
+}
diff --git a/public/nav.css b/public/nav.css
index 4d9721ad7..0ec0a6e5e 100644
--- a/public/nav.css
+++ b/public/nav.css
@@ -334,8 +334,8 @@ body.nav-open {
justify-content: center;
align-items: center;
gap: 5px;
- width: 36px;
- height: 36px;
+ width: 44px;
+ height: 44px;
padding: 0;
background: none;
border: 1px solid rgba(255, 255, 255, 0.12);
diff --git a/public/studio-deposit-harness.html b/public/studio-deposit-harness.html
index 5303f4543..da45580e2 100644
--- a/public/studio-deposit-harness.html
+++ b/public/studio-deposit-harness.html
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html>
-<head><meta charset="utf-8"><title>deposit harness</title>
+<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>deposit harness</title>
<style>body{background:#0a0c0e;color:#fff;font-family:system-ui;padding:2rem}#root{max-width:380px}</style>
</head>
<body>
diff --git a/public/studio/index.html b/public/studio/index.html
index c57c98998..8c16a8953 100644
--- a/public/studio/index.html
+++ b/public/studio/index.html
@@ -55,6 +55,13 @@
.studio-layout { grid-template-columns: 1fr; }
.studio-col-mid { position: static; order: -1; }
}
+ @media (max-width: 640px) {
+ .studio-layout { padding: 0.6rem; gap: 0.6rem; }
+ .avatar-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
+ }
+ @media (max-width: 400px) {
+ .avatar-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
+ }
.panel {
background: #14141c;
border: 1px solid #2a2a36;
diff --git a/public/studio/studio.css b/public/studio/studio.css
index 14c2366a1..725a744eb 100644
--- a/public/studio/studio.css
+++ b/public/studio/studio.css
@@ -332,6 +332,73 @@ a:hover {
}
}
+@media (max-width: 640px) {
+ .studio-header {
+ height: 52px;
+ padding: 0 0.75rem;
+ gap: 0.5rem;
+ }
+ .studio-header nav {
+ gap: 0;
+ }
+ .studio-header nav a {
+ display: none;
+ }
+ .studio-header nav #user-menu {
+ display: flex;
+ }
+ .studio-layout {
+ padding: 0.6rem;
+ gap: 0.6rem;
+ }
+ .panel {
+ padding: 0.85rem 0.85rem 1rem;
+ border-radius: 10px;
+ }
+ .panel h2 {
+ font-size: 0.88rem;
+ margin-bottom: 0.6rem;
+ }
+ .avatar-list {
+ grid-template-columns: repeat(3, minmax(0, 1fr));
+ gap: 0.4rem;
+ }
+ .preview-frame {
+ border-radius: 10px;
+ }
+ .preview-frame iframe {
+ height: 56vw;
+ min-height: 240px;
+ max-height: 380px;
+ }
+ .action-row {
+ flex-direction: column;
+ gap: 0.5rem;
+ }
+ .action-row .btn-ghost,
+ .action-row .btn-primary {
+ width: 100%;
+ text-align: center;
+ }
+ .studio-right-tabs {
+ gap: 0.25rem;
+ }
+ .embed-preview iframe {
+ height: 50vw;
+ min-height: 200px;
+ }
+}
+
+@media (max-width: 400px) {
+ .avatar-list {
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ }
+ .studio-layout {
+ padding: 0.4rem;
+ gap: 0.4rem;
+ }
+}
+
/* ── panels ────────────────────────────────────────────────────────────────── */
@keyframes panel-in {
from { opacity: 0; transform: translateY(6px); }
diff --git a/public/style.css b/public/style.css
index 31f3a9c88..a60cab70a 100644
--- a/public/style.css
+++ b/public/style.css
@@ -1481,8 +1481,8 @@ footer .separator {
background: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.06);
border-radius: 50%;
- width: 32px;
- height: 32px;
+ width: 44px;
+ height: 44px;
display: flex;
align-items: center;
justify-content: center;
@@ -1504,14 +1504,14 @@ footer .separator {
@media screen and (max-width: 700px) {
.nich-toggle {
- bottom: var(--space-md);
+ bottom: calc(var(--space-md) + env(safe-area-inset-bottom, 0px));
left: var(--space-md);
- width: 42px;
- height: 42px;
+ width: 48px;
+ height: 48px;
}
.nich-panel {
- bottom: 4em;
+ bottom: calc(4em + env(safe-area-inset-bottom, 0px));
left: var(--space-sm);
right: var(--space-sm);
width: auto;
@@ -7868,6 +7868,12 @@ body[data-layout='next'] .next-drawer__body .dg.main {
gap: 8px;
z-index: 34;
}
+@media (max-width: 700px) {
+ .next-corner {
+ top: max(72px, calc(env(safe-area-inset-top, 0px) + 64px));
+ right: max(12px, env(safe-area-inset-right, 12px));
+ }
+}
.next-icon-btn {
width: 36px;
height: 36px;
@@ -7888,6 +7894,13 @@ body[data-layout='next'] .next-drawer__body .dg.main {
transform 0.18s ease;
position: relative;
}
+@media (hover: none) and (pointer: coarse) {
+ .next-icon-btn {
+ width: 44px;
+ height: 44px;
+ border-radius: 12px;
+ }
+}
.next-icon-btn:hover {
background: rgba(28, 28, 38, 0.88);
color: #fff;
@@ -8012,19 +8025,20 @@ body[data-layout='next'] .next-drawer__body .dg.main {
color: rgba(255, 255, 255, 0.9);
}
.next-drawer__close {
- width: 28px;
- height: 28px;
+ width: 44px;
+ height: 44px;
display: inline-flex;
align-items: center;
justify-content: center;
background: transparent;
border: 0;
- border-radius: 6px;
+ border-radius: 8px;
color: rgba(255, 255, 255, 0.55);
cursor: pointer;
font-size: 20px;
line-height: 1;
transition: background 0.15s ease, color 0.15s ease;
+ margin: -8px -8px -8px auto;
}
.next-drawer__close:hover {
background: rgba(255, 255, 255, 0.06);
@@ -8034,13 +8048,14 @@ body[data-layout='next'] .next-drawer__body .dg.main {
flex: 1;
overflow-y: auto;
padding: 8px;
+ padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
}
/* ── Bottom dock ────────────────────────────────────────────────────────── */
.next-dock {
position: fixed;
left: 50%;
- bottom: 24px;
+ bottom: max(24px, env(safe-area-inset-bottom, 24px));
transform: translateX(-50%);
display: flex;
align-items: center;
@@ -8097,8 +8112,8 @@ body[data-layout='next'] .next-drawer__body .dg.main {
.next-dock__clip--open .next-dock__caret { transform: rotate(180deg); }
.next-dock__play {
- width: 36px;
- height: 36px;
+ width: 40px;
+ height: 40px;
display: inline-flex;
align-items: center;
justify-content: center;
@@ -8111,6 +8126,12 @@ body[data-layout='next'] .next-drawer__body .dg.main {
transition: transform 0.15s ease, box-shadow 0.15s ease;
flex-shrink: 0;
}
+@media (hover: none) and (pointer: coarse) {
+ .next-dock__play {
+ width: 48px;
+ height: 48px;
+ }
+}
.next-dock__play:hover { transform: scale(1.05); }
.next-dock__play:active { transform: scale(0.97); }
.next-dock__icon { display: none; }
diff --git a/pump-fun-skills/reactive/handlers.js b/pump-fun-skills/reactive/handlers.js
index c60b787dc..801130820 100644
--- a/pump-fun-skills/reactive/handlers.js
+++ b/pump-fun-skills/reactive/handlers.js
@@ -12,6 +12,7 @@ let _reconnectTimer = null;
let _reconnectAttempts = 0;
let _protocol = null;
let _buffer = [];
+let _enabled = false;
const MAX_ATTEMPTS = 10;
const WINDOW_MS = 2000;
@@ -76,6 +77,12 @@ function _connect() {
_reconnectAttempts = 0;
ws.send(JSON.stringify({ method: 'subscribeNewToken' }));
ws.send(JSON.stringify({ method: 'subscribeMigration' }));
+ // Start the flush interval only after the connection is open so the first
+ // window begins after messages can actually arrive. Guard against restarts
+ // on reconnect — the interval persists across dropped connections.
+ if (_intervalId === null) {
+ _intervalId = setInterval(_flush, WINDOW_MS);
+ }
});
ws.addEventListener('message', (evt) => {
@@ -87,7 +94,7 @@ function _connect() {
});
ws.addEventListener('close', () => {
- if (_intervalId === null) return; // disabled — don't reconnect
+ if (!_enabled) return; // disabled — don't reconnect
_scheduleReconnect();
});
}
@@ -100,14 +107,14 @@ function _scheduleReconnect() {
}
export async function enable_live_reactions(_args, ctx) {
- if (_intervalId !== null) {
+ if (_enabled) {
return { ok: true, already: true };
}
+ _enabled = true;
_protocol = ctx.protocol;
_buffer = [];
_reconnectAttempts = 0;
_connect();
- _intervalId = setInterval(_flush, WINDOW_MS);
return { ok: true, started: true };
}
@@ -126,5 +133,6 @@ export async function disable_live_reactions(_args, _ctx) {
}
_buffer = [];
_protocol = null;
+ _enabled = false;
return { ok: true, stopped: true };
}
diff --git a/src/components/screenshot-modal.js b/src/components/screenshot-modal.js
index 916987908..00f294a12 100644
--- a/src/components/screenshot-modal.js
+++ b/src/components/screenshot-modal.js
@@ -24,7 +24,7 @@ export class ScreenshotModal {
<button class="btn-secondary screenshot-modal-copy">Copy</button>
<a href="https://x.com/intent/tweet?text=Check%20out%20my%203D%20Agent!&url=${encodeURIComponent(
window.location.href,
- )}" target="_blank" class="btn-secondary screenshot-modal-share">Share on X</a>
+ )}" target="_blank" rel="noopener noreferrer" class="btn-secondary screenshot-modal-share">Share on X</a>
<button class="btn-primary screenshot-modal-download">Download</button>
</div>
</div>
diff --git a/src/dashboard/dashboard.js b/src/dashboard/dashboard.js
index e59233dbf..285f8f9b7 100644
--- a/src/dashboard/dashboard.js
+++ b/src/dashboard/dashboard.js
@@ -2415,7 +2415,7 @@ async function renderEmbed(root) {
<div id="embed-verify-out" class="muted" style="padding:6px 6px 0; font-size:12px; min-height:16px"></div>
<div class="row" style="justify-content:space-between; padding:10px 6px 4px">
<strong>${esc(agent.name || 'My Agent')}</strong>
- <a href="${attr(homeUrl)}" target="_blank" class="muted">Home page →</a>
+ <a href="${attr(homeUrl)}" target="_blank" rel="noopener noreferrer" class="muted">Home page →</a>
</div>
<p class="muted" style="padding:0 6px">Agent ID <code>${esc(agent.id)}</code></p>
${
@@ -4031,7 +4031,7 @@ async function renderAccount(root) {
<div style="margin-top:12px">
<p class="muted" style="font-size:11px;margin:0 0 4px">Your public profile</p>
<div class="row" style="gap:6px;align-items:center">
- <a href="${attr(profileUrl)}" target="_blank" style="font-size:12px;color:#9a8cff;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">${esc(profileUrl)}</a>
+ <a href="${attr(profileUrl)}" target="_blank" rel="noopener noreferrer" style="font-size:12px;color:#9a8cff;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">${esc(profileUrl)}</a>
<button id="acct-copy" class="btn sec" type="button" style="flex-shrink:0;white-space:nowrap">Copy</button>
</div>
</div>
@@ -4074,7 +4074,7 @@ async function renderAccount(root) {
msg.textContent = 'Saved.';
if (data.user.username) {
const url = `${location.origin}/u/${encodeURIComponent(data.user.username)}`;
- msg.innerHTML = `Saved. Your profile is at <a href="${attr(url)}" target="_blank" style="color:#9a8cff">${esc(url)}</a>`;
+ msg.innerHTML = `Saved. Your profile is at <a href="${attr(url)}" target="_blank" rel="noopener noreferrer" style="color:#9a8cff">${esc(url)}</a>`;
}
} catch (err) {
msg.style.color = '#ffb3b3';
diff --git a/src/element.js b/src/element.js
index 613ace06c..e8bec747d 100644
--- a/src/element.js
+++ b/src/element.js
@@ -105,6 +105,7 @@ const BASE_STYLE = `
inset: 0;
width: 100vw;
height: 100vh;
+ height: 100dvh;
z-index: 2147483000;
}
:host([hidden]) { display: none; }
diff --git a/src/runtime/livekit-voice.js b/src/runtime/livekit-voice.js
index 127e13f7f..693fa14f5 100644
--- a/src/runtime/livekit-voice.js
+++ b/src/runtime/livekit-voice.js
@@ -24,10 +24,18 @@ export class LiveKitVoice {
const room = new Room();
this._room = room;
- // Agent TTS audio — attach <audio> element when track arrives
+ // Agent TTS audio — attach <audio> element when track arrives.
+ // In the slim widget shell we still need the element to exist so the
+ // browser plays the track, but it must be hidden (no DOM leak) and
+ // detached from any user-visible layout. The audio is what the
+ // embedder asked for; the <audio> tag itself is invisible chrome.
room.on(RoomEvent.TrackSubscribed, (track, _pub, _participant) => {
if (track.kind !== Track.Kind.Audio) return;
const el = track.attach();
+ if (window.__WIDGET_SHELL) {
+ el.style.display = 'none';
+ el.setAttribute('aria-hidden', 'true');
+ }
document.body.appendChild(el);
this._audioEls.push({ track, el });
});
diff --git a/src/widgets/hotspot-tour.js b/src/widgets/hotspot-tour.js
index b82f90a63..e25f667cf 100644
--- a/src/widgets/hotspot-tour.js
+++ b/src/widgets/hotspot-tour.js
@@ -237,12 +237,12 @@ function _injectStyles() {
top: 0;
left: 0;
transform: translate(-9999px, -9999px);
- margin: -14px 0 0 -14px;
+ margin: -22px 0 0 -22px;
background: rgba(10, 10, 10, 0.7);
color: #fff;
border: 1px solid rgba(255, 255, 255, 0.18);
border-radius: 999px;
- padding: 0 10px 0 0;
+ padding: 0 12px 0 0;
font: 500 13px/1 Inter, system-ui, sans-serif;
display: inline-flex;
align-items: center;
@@ -255,6 +255,7 @@ function _injectStyles() {
max-width: 220px;
white-space: nowrap;
overflow: hidden;
+ min-height: 44px;
}
.hotspot-marker:hover,
.hotspot-marker.is-active {
@@ -264,13 +265,13 @@ function _injectStyles() {
.hotspot-marker-dot {
display: grid;
place-items: center;
- width: 28px;
- height: 28px;
+ width: 44px;
+ height: 44px;
border-radius: 999px;
background: rgba(139, 92, 246, 0.9);
color: #fff;
font-weight: 600;
- font-size: 12px;
+ font-size: 13px;
flex: 0 0 auto;
}
.hotspot-marker.is-active .hotspot-marker-dot {
@@ -286,7 +287,7 @@ function _injectStyles() {
right: 16px;
top: 16px;
width: 280px;
- max-height: calc(100vh - 32px);
+ max-height: calc(100dvh - 32px);
background: rgba(10, 10, 10, 0.88);
color: #e0e0e0;
border: 1px solid rgba(255, 255, 255, 0.08);
@@ -300,18 +301,24 @@ function _injectStyles() {
.hotspot-panel[hidden] { display: none; }
.hotspot-panel-close {
position: absolute;
- top: 6px;
- right: 8px;
+ top: 0;
+ right: 0;
+ width: 44px;
+ height: 44px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
background: transparent;
border: 0;
color: rgba(255, 255, 255, 0.6);
font-size: 22px;
line-height: 1;
cursor: pointer;
+ border-radius: 0 12px 0 8px;
}
- .hotspot-panel-close:hover { color: #fff; }
+ .hotspot-panel-close:hover { color: #fff; background: rgba(255,255,255,0.06); }
.hotspot-panel-title {
- margin: 0 24px 8px 0;
+ margin: 0 44px 8px 0;
font-size: 15px;
font-weight: 600;
color: #fff;
@@ -326,10 +333,11 @@ function _injectStyles() {
right: 8px;
left: 8px;
top: auto;
- bottom: 8px;
+ bottom: max(8px, env(safe-area-inset-bottom, 8px));
width: auto;
- max-height: 40vh;
+ max-height: 40dvh;
overflow-y: auto;
+ padding-bottom: max(18px, env(safe-area-inset-bottom, 18px));
}
.hotspot-marker { max-width: 160px; }
}
diff --git a/tests/animations.test.js b/tests/animations.test.js
index 06473c1be..a099ed4cb 100644
--- a/tests/animations.test.js
+++ b/tests/animations.test.js
@@ -72,12 +72,22 @@ const AVATURN_BONES = new Set([
let manifest;
let AnimationClip;
+let parsedClips; // pre-parsed cache: { name, clip }[] — loaded once for all clip tests
beforeAll(async () => {
expect(existsSync(MANIFEST), `manifest not found — run npm run build:animations`).toBe(true);
manifest = JSON.parse(readFileSync(MANIFEST, 'utf8'));
({ AnimationClip } = await import('three'));
-});
+
+ // Parse all 67+ JSON animation files once so each test suite doesn't repeat
+ // the ~80 MB parse. Total parse time is ~60s on a cold Codespace — captured
+ // in beforeAll's hookTimeout rather than individual test timeouts.
+ parsedClips = manifest.map((entry) => {
+ const file = resolve(ROOT, 'public', entry.url.replace(/^\//, ''));
+ const json = JSON.parse(readFileSync(file, 'utf8'));
+ return { name: entry.name, clip: AnimationClip.parse(json) };
+ });
+}, 120_000);
describe('animation manifest', () => {
it('has at least one clip', () => {
@@ -103,28 +113,20 @@ describe('animation manifest', () => {
describe('animation clips', () => {
it('every clip parses as a valid AnimationClip', () => {
- for (const entry of manifest) {
- const file = resolve(ROOT, 'public', entry.url.replace(/^\//, ''));
- const json = JSON.parse(readFileSync(file, 'utf8'));
- const clip = AnimationClip.parse(json);
-
- expect(clip.name, `${entry.name}: clip.name`).toBe(entry.name);
- expect(clip.duration, `${entry.name}: duration must be > 0`).toBeGreaterThan(0);
- expect(clip.tracks.length, `${entry.name}: must have tracks`).toBeGreaterThan(0);
+ for (const { name, clip } of parsedClips) {
+ expect(clip.name, `${name}: clip.name`).toBe(name);
+ expect(clip.duration, `${name}: duration must be > 0`).toBeGreaterThan(0);
+ expect(clip.tracks.length, `${name}: must have tracks`).toBeGreaterThan(0);
}
});
it('every track target resolves to a bone in the Avaturn reference rig', () => {
const mismatches = [];
- for (const entry of manifest) {
- const file = resolve(ROOT, 'public', entry.url.replace(/^\//, ''));
- const json = JSON.parse(readFileSync(file, 'utf8'));
- const clip = AnimationClip.parse(json);
-
+ for (const { name, clip } of parsedClips) {
for (const track of clip.tracks) {
const boneName = track.name.split('.')[0];
if (!AVATURN_BONES.has(boneName)) {
- mismatches.push(`${entry.name}: unknown bone "${boneName}"`);
+ mismatches.push(`${name}: unknown bone "${boneName}"`);
}
}
}
@@ -133,15 +135,11 @@ describe('animation clips', () => {
it('no track contains NaN keyframe values', () => {
const nanTracks = [];
- for (const entry of manifest) {
- const file = resolve(ROOT, 'public', entry.url.replace(/^\//, ''));
- const json = JSON.parse(readFileSync(file, 'utf8'));
- const clip = AnimationClip.parse(json);
-
+ for (const { name, clip } of parsedClips) {
for (const track of clip.tracks) {
for (const v of track.values) {
if (Number.isNaN(v)) {
- nanTracks.push(`${entry.name} / ${track.name}`);
+ nanTracks.push(`${name} / ${track.name}`);
break;
}
}
@@ -151,18 +149,14 @@ describe('animation clips', () => {
});
it('Hips.position values are in meter range (< 10m)', () => {
- for (const entry of manifest) {
- const file = resolve(ROOT, 'public', entry.url.replace(/^\//, ''));
- const json = JSON.parse(readFileSync(file, 'utf8'));
- const clip = AnimationClip.parse(json);
-
+ for (const { name, clip } of parsedClips) {
const hipsPos = clip.tracks.find((t) => t.name === 'Hips.position');
if (!hipsPos) continue;
const maxVal = Math.max(...hipsPos.values.map(Math.abs));
expect(
maxVal,
- `${entry.name}: Hips.position max=${maxVal.toFixed(2)}m — avatar will float (scale issue)`,
+ `${name}: Hips.position max=${maxVal.toFixed(2)}m — avatar will float (scale issue)`,
).toBeLessThan(10);
}
});
diff --git a/tests/api/avatars-upload-proxy.test.js b/tests/api/avatars-upload-proxy.test.js
index 2faed0951..64a3759eb 100644
--- a/tests/api/avatars-upload-proxy.test.js
+++ b/tests/api/avatars-upload-proxy.test.js
@@ -89,13 +89,12 @@ function makeRes() {
};
}
-// Static-import the dispatcher so the first test doesn't pay the cold-import
-// penalty (which has flaked the happy-path test under the default vitest
-// timeout in the past).
-import { dispatch as actionsDispatch } from '../../api/avatars/_actions.js';
-
+// Dynamic import so vi.mock hoisting can intercept the dependency graph
+// (top-level static imports would race the mock registration). The first
+// test pays the cold-import cost — granted a longer timeout below.
async function dispatchUpload(req, res) {
- await actionsDispatch('upload', req, res);
+ const { dispatch } = await import('../../api/avatars/_actions.js');
+ await dispatch('upload', req, res);
return { res, body: res._body ? JSON.parse(res._body) : null };
}
diff --git a/vercel.json b/vercel.json
index 7a74f4549..a3073890d 100644
--- a/vercel.json
+++ b/vercel.json
@@ -349,12 +349,46 @@
},
{
"src": "/widget",
+ "headers": {
+ "content-security-policy": "frame-ancestors *",
+ "x-content-type-options": "nosniff",
+ "referrer-policy": "strict-origin-when-cross-origin",
+ "permissions-policy": "microphone=(self), camera=(self), xr-spatial-tracking=*, autoplay=*",
+ "cross-origin-resource-policy": "cross-origin"
+ },
"dest": "/widget.html"
},
{
"src": "/widget/",
+ "headers": {
+ "content-security-policy": "frame-ancestors *",
+ "x-content-type-options": "nosniff",
+ "referrer-policy": "strict-origin-when-cross-origin",
+ "permissions-policy": "microphone=(self), camera=(self), xr-spatial-tracking=*, autoplay=*",
+ "cross-origin-resource-policy": "cross-origin"
+ },
+ "dest": "/widget.html"
+ },
+ {
+ "src": "/widget\\.html$",
+ "headers": {
+ "content-security-policy": "frame-ancestors *",
+ "x-content-type-options": "nosniff",
+ "referrer-policy": "strict-origin-when-cross-origin",
+ "permissions-policy": "microphone=(self), camera=(self), xr-spatial-tracking=*, autoplay=*",
+ "cross-origin-resource-policy": "cross-origin"
+ },
"dest": "/widget.html"
},
+ {
+ "src": "/widget-client\\.js$",
+ "headers": {
+ "cross-origin-resource-policy": "cross-origin",
+ "cache-control": "public, max-age=86400, s-maxage=86400, immutable",
+ "x-content-type-options": "nosniff"
+ },
+ "dest": "/widget-client.js"
+ },
{
"src": "/playground",
"dest": "/playground.html"
@@ -515,6 +549,10 @@
"src": "/api/dashboard/prefs",
"dest": "/api/dashboard/prefs"
},
+ {
+ "src": "/api/marketplace/theme",
+ "dest": "/api/marketplace/[action]?action=theme"
+ },
{
"src": "/api/marketplace/categories",
"dest": "/api/marketplace/[action]?action=categories"
diff --git a/vite.config.js b/vite.config.js
index baaff7923..0b9baf5b0 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -939,6 +939,21 @@ const appConfig = {
clientsClaim: true,
cleanupOutdatedCaches: true,
runtimeCaching: [
+ // Embed surfaces (/widget, /embed, /a-embed, /agent-embed)
+ // must never be served from the SW cache — embedders rely
+ // on the iframe always reflecting the latest config.
+ {
+ urlPattern: /^https?:\/\/[^/]+\/widget(\/.*|\?.*|#.*|$)/i,
+ handler: 'NetworkOnly',
+ },
+ {
+ urlPattern: /^https?:\/\/[^/]+\/(embed|a-embed|agent-embed|avatar-embed)(\/.*|\?.*|#.*|$)/i,
+ handler: 'NetworkOnly',
+ },
+ {
+ urlPattern: /^https?:\/\/[^/]+\/api\/widgets\//i,
+ handler: 'NetworkOnly',
+ },
{
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
handler: 'CacheFirst',
diff --git a/vitest.config.js b/vitest.config.js
index f8d5be67f..1908e1553 100644
--- a/vitest.config.js
+++ b/vitest.config.js
@@ -1,15 +1,15 @@
import { defineConfig } from 'vitest/config';
// Cold dynamic `import()` of API handlers that pull in heavy SDKs (@coinbase/x402,
-// neon-serverless, jsdom, the Solana toolchain, etc.) routinely takes 5–15s on
-// the first hit. The default 5s test timeout flaked those tests on every fresh
-// node_modules — bumping the global ceiling to 20s removes the flake without
-// hiding real hangs (long-running tests still get individual timeouts).
+// neon-serverless, jsdom, the Solana toolchain, etc.) routinely takes 5–30s on
+// the first hit in constrained CI/Codespace environments. Individual tests that
+// do real I/O still carry their own tighter timeouts; this ceiling only protects
+// import-heavy module-load tests like the onchain adapter factory.
export default defineConfig({
test: {
environment: 'node',
include: ['tests/**/*.test.js', 'tests/**/*.test.mjs', 'src/**/*.test.js'],
- testTimeout: 20_000,
- hookTimeout: 20_000,
+ testTimeout: 45_000,
+ hookTimeout: 45_000,
},
});