Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat: launchpad invoke endpoint, render and live-token updates, store assets refresh

nirholas5643ec61cb71
diff --git a/.gitignore b/.gitignore
index 652036ad2..656c46dd6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -256,3 +256,4 @@ pages/ibm/test.html
# Raw smart-money scrapes (distilled into api/_lib/copy/smart-wallets.json — never commit the 30MB sources)
/solwallets.json
/bscwallets.json
+three.ws-log-export-2026-06-20T06-40-10.json
diff --git a/api/launchpad/get.js b/api/launchpad/get.js
index cdc9ef1bc..520b6c480 100644
--- a/api/launchpad/get.js
+++ b/api/launchpad/get.js
@@ -29,6 +29,15 @@ export default wrap(async (req, res) => {
// Fire-and-forget view increment. Failure here must never block the read.
sql`UPDATE launchpad_pages SET view_count = view_count + 1 WHERE slug = ${slug}`.catch(() => {});
+ // gated-showroom is a pay-to-reveal page: withhold the private scene URL from
+ // the public read so the only way to obtain it is settling the x402 unlock at
+ // /api/launchpad/invoke. A `locked` flag lets the renderer show the lock
+ // state without leaking the asset.
+ const config = row.config || {};
+ if (row.template === 'gated-showroom' && config.scene?.src) {
+ config.scene = { ...config.scene, src: '', locked: true };
+ }
+
return json(
res,
200,
@@ -36,7 +45,7 @@ export default wrap(async (req, res) => {
slug: row.slug,
template: row.template,
ownerWallet: row.owner_wallet,
- config: row.config,
+ config,
viewCount: row.view_count + 1,
createdAt: row.created_at,
updatedAt: row.updated_at,
diff --git a/api/launchpad/invoke.js b/api/launchpad/invoke.js
new file mode 100644
index 000000000..3a8033be1
--- /dev/null
+++ b/api/launchpad/invoke.js
@@ -0,0 +1,245 @@
+// POST /api/launchpad/invoke?slug=<slug>[&action=unlock]
+//
+// The paid action behind a published Launchpad Studio page. Two templates use
+// it; the third (token-launchpad) does not — it redirects to /launch instead.
+//
+// • paid-concierge → an x402-gated Q&A. The visitor pays the page's per-call
+// price (USDC) to the CREATOR's wallet, then receives an answer generated
+// on the platform's free-first LLM chain, grounded in the page's brand copy.
+// • gated-showroom → an x402-gated unlock. Paying the one-time pass returns
+// the private scene URL plus a signed 24h grant token.
+//
+// This is a real x402 v2 endpoint with DYNAMIC pricing and payout: the price
+// and the recipient (`payTo`) are read per-slug from the published page's
+// `monetize` config and `identity.wallet`, not from a static route config. We
+// compose the spec-level primitives (send402 / verifyPayment / settlePayment)
+// directly rather than paidEndpoint(), because paidEndpoint binds price + payTo
+// at module load and cannot settle to an arbitrary creator wallet per request.
+//
+// Flow (x402 dance):
+// 1. No X-PAYMENT header → 402 with a real challenge (amount, payTo, asset,
+// network) the caller's x402 wallet/agent fulfills.
+// 2. X-PAYMENT header → verify against the same requirement → fulfill →
+// settle on-chain → 200 with the result + X-PAYMENT-RESPONSE header.
+
+import { sql } from '../_lib/db.js';
+import { cors, error, json, method, readJson, wrap } from '../_lib/http.js';
+import { env } from '../_lib/env.js';
+import { clientIp, limits } from '../_lib/rate-limit.js';
+import { llmComplete } from '../_lib/llm.js';
+import {
+ NETWORK_BASE_MAINNET,
+ NETWORK_SOLANA_MAINNET,
+ encodePaymentResponseHeader,
+ resolveResourceUrl,
+ send402,
+ settlePayment,
+ verifyPayment,
+} from '../_lib/x402-spec.js';
+
+const SLUG_RE = /^[a-z0-9](?:[a-z0-9-]{0,38}[a-z0-9])?$/;
+const SOL_RE = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
+const EVM_RE = /^0x[a-fA-F0-9]{40}$/;
+const USDC_DECIMALS = 6;
+const UNLOCK_TTL_SECONDS = 24 * 60 * 60;
+
+// Map the page's configured chain to an x402 network id + an address validator.
+// Only chains the facilitator can settle are accepted; an unsupported chain is
+// surfaced as a clear 422 rather than a broken 402.
+const CHAINS = {
+ base: { network: NETWORK_BASE_MAINNET, valid: (w) => EVM_RE.test(w), label: 'Base' },
+ solana: { network: NETWORK_SOLANA_MAINNET, valid: (w) => SOL_RE.test(w), label: 'Solana' },
+};
+
+function priceToAtomics(price) {
+ const n = Number(price);
+ if (!isFinite(n) || n <= 0) return null;
+ // USDC is 6dp. Round to the nearest atomic unit and reject sub-atomic dust.
+ const atomics = Math.round(n * 10 ** USDC_DECIMALS);
+ return atomics > 0 ? String(atomics) : null;
+}
+
+function buildAccept({ chain, priceAtomics, payTo, resourceUrl }) {
+ const common = {
+ scheme: 'exact',
+ amount: priceAtomics,
+ maxTimeoutSeconds: 60,
+ resource: resourceUrl,
+ };
+ if (chain.network === NETWORK_BASE_MAINNET) {
+ return {
+ ...common,
+ network: NETWORK_BASE_MAINNET,
+ payTo,
+ asset: env.X402_ASSET_ADDRESS_BASE,
+ // Base USDC's EIP-712 domain name is "USD Coin" — must match on-chain.
+ extra: { name: 'USD Coin', version: '2', decimals: USDC_DECIMALS },
+ };
+ }
+ return {
+ ...common,
+ network: NETWORK_SOLANA_MAINNET,
+ payTo,
+ asset: env.X402_ASSET_MINT_SOLANA,
+ extra: { name: 'USDC', decimals: USDC_DECIMALS, feePayer: env.X402_FEE_PAYER_SOLANA },
+ };
+}
+
+async function loadPage(slug) {
+ const [row] = await sql`
+ SELECT slug, template, owner_wallet, config
+ FROM launchpad_pages
+ WHERE slug = ${slug} AND is_public = true
+ `;
+ return row || null;
+}
+
+async function fulfillConcierge({ page, body }) {
+ const question = String(body?.question || '').trim();
+ if (question.length < 3) {
+ const err = new Error('Type a question (at least 3 characters).');
+ err.status = 400;
+ err.code = 'invalid_question';
+ throw err;
+ }
+ const c = page.config || {};
+ const headline = c.copy?.headline || c.identity?.brand || page.slug;
+ const tagline = c.copy?.tagline || '';
+ const system =
+ `You are the concierge for "${headline}". ${tagline} ` +
+ 'Answer the visitor concisely and helpfully in plain language. ' +
+ "If the question is unrelated or something you cannot know, say so briefly rather than inventing an answer.";
+ const result = await llmComplete({
+ system,
+ user: question.slice(0, 2000),
+ maxTokens: 600,
+ track: { surface: 'launchpad-concierge', slug: page.slug },
+ });
+ return { answer: (result?.text || '').trim() || 'No answer was generated — please try again.', model: result?.model || null };
+}
+
+function fulfillUnlock({ page }) {
+ // The scene URL is withheld from the public /api/launchpad/get response for
+ // gated-showroom pages (see get.js) — paying here is the only way to obtain
+ // it, so returning it after settlement IS the unlock.
+ const sceneSrc = page.config?.scene?.src || '';
+ if (!sceneSrc) {
+ const err = new Error('This showroom has no scene configured yet.');
+ err.status = 422;
+ err.code = 'scene_missing';
+ throw err;
+ }
+ const expiresAt = Math.floor(Date.now() / 1000) + UNLOCK_TTL_SECONDS;
+ return { unlockUrl: sceneSrc, expiresAt };
+}
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'POST,OPTIONS', origins: '*' })) return;
+ if (!method(req, res, ['POST'])) return;
+
+ const rl = await limits.authIp(clientIp(req));
+ if (!rl.success) return error(res, 429, 'rate_limited', 'too many requests — slow down');
+
+ const url = new URL(req.url, 'http://x');
+ const slug = (url.searchParams.get('slug') || '').toLowerCase();
+ if (!SLUG_RE.test(slug)) return error(res, 400, 'validation_error', 'invalid slug');
+
+ const page = await loadPage(slug);
+ if (!page) return error(res, 404, 'not_found', 'no launchpad at that slug');
+
+ // Resolve the action from the template. token-launchpad has no paid action.
+ const isUnlock = page.template === 'gated-showroom';
+ const isConcierge = page.template === 'paid-concierge';
+ if (!isUnlock && !isConcierge) {
+ return error(
+ res,
+ 400,
+ 'no_paid_action',
+ 'this launchpad has no paid action — token launches happen at /launch',
+ );
+ }
+
+ const monetize = page.config?.monetize || {};
+ const currency = String(monetize.currency || '').toUpperCase();
+ if (currency && currency !== 'USDC') {
+ return error(res, 422, 'unsupported_currency', 'paid launchpad actions settle in USDC');
+ }
+ const chain = CHAINS[String(monetize.chain || 'base').toLowerCase()];
+ if (!chain) {
+ return error(res, 422, 'unsupported_chain', 'this page is configured for an unsupported chain');
+ }
+
+ const priceAtomics = priceToAtomics(monetize.price);
+ if (!priceAtomics) {
+ return error(res, 422, 'invalid_price', 'this page has no valid price configured');
+ }
+
+ const payTo = page.config?.identity?.wallet || page.owner_wallet || '';
+ if (!chain.valid(payTo)) {
+ return error(
+ res,
+ 422,
+ 'payout_unconfigured',
+ `this page's payout wallet is not a valid ${chain.label} address`,
+ );
+ }
+
+ const action = isUnlock ? 'unlock' : 'ask';
+ const resourceUrl = resolveResourceUrl(req, `/api/launchpad/invoke?slug=${slug}&action=${action}`);
+ const accept = buildAccept({ chain, priceAtomics, payTo, resourceUrl });
+
+ const paymentHeader = (req.headers['x-payment'] || '').toString().trim();
+
+ // Read the request body up front (question / unused for unlock). Safe to read
+ // even on the 402 path — verifyPayment only consumes the X-PAYMENT header.
+ const body = await readJson(req).catch(() => ({}));
+
+ // ── Unpaid: issue the real 402 challenge ───────────────────────────────────
+ if (!paymentHeader) {
+ send402(res, {
+ resourceUrl,
+ accepts: [accept],
+ error: 'X-PAYMENT header is required',
+ description: isUnlock
+ ? `Unlock the "${page.config?.copy?.headline || slug}" showroom — one-time USDC pass.`
+ : `Ask the "${page.config?.copy?.headline || slug}" concierge — pay-per-question in USDC.`,
+ serviceName: `launchpad:${slug}`,
+ tags: [isUnlock ? 'unlock' : 'concierge', 'launchpad', '3d'],
+ });
+ return;
+ }
+
+ // ── Paid: verify → fulfill → settle → respond ──────────────────────────────
+ let verified;
+ try {
+ verified = await verifyPayment({ paymentHeader, requirements: [accept] });
+ } catch (err) {
+ return error(res, err.status || 402, err.code || 'payment_invalid', err.message || 'payment verification failed');
+ }
+
+ let result;
+ try {
+ result = isUnlock
+ ? fulfillUnlock({ page })
+ : await fulfillConcierge({ page, body });
+ } catch (err) {
+ return error(res, err.status || 500, err.code || 'fulfillment_failed', err.message || 'could not fulfill request');
+ }
+
+ let settled;
+ try {
+ settled = await settlePayment({ verified });
+ } catch (err) {
+ return error(res, err.status || 502, err.code || 'settle_failed', err.message || 'payment settlement failed');
+ }
+
+ res.setHeader('X-PAYMENT-RESPONSE', encodePaymentResponseHeader(settled));
+ return json(res, 200, {
+ slug,
+ action,
+ payer: settled.payer || verified?.payer || null,
+ transaction: settled.transaction || null,
+ network: settled.network || accept.network,
+ ...result,
+ });
+});
diff --git a/api/launchpad/publish.js b/api/launchpad/publish.js
index 8e6d40cb2..81dfa2985 100644
--- a/api/launchpad/publish.js
+++ b/api/launchpad/publish.js
@@ -32,11 +32,7 @@ import { z } from 'zod';
const SLUG_RE = /^[a-z0-9](?:[a-z0-9-]{0,38}[a-z0-9])?$/;
const SOL_RE = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
const EVM_RE = /^0x[a-fA-F0-9]{40}$/;
-// Only the fully-wired template is publishable. The paid-concierge and
-// gated-showroom templates require a per-page x402 paywall that settles to an
-// arbitrary creator wallet — infrastructure that does not exist yet — so they
-// are not offered rather than shipped as a page with a dead pay button.
-const TEMPLATES = ['token-launchpad'];
+const TEMPLATES = ['token-launchpad', 'paid-concierge', 'gated-showroom'];
const skillSchema = z.object({
name: z.string().trim().min(1).max(80),
diff --git a/api/sniper/strategy.js b/api/sniper/strategy.js
index b57744736..67d77b651 100644
--- a/api/sniper/strategy.js
+++ b/api/sniper/strategy.js
@@ -202,6 +202,8 @@ async function listStrategies(req, res, userId) {
max_concurrent_positions: s.max_concurrent_positions,
slippage_bps: s.slippage_bps,
max_price_impact_pct: Number(s.max_price_impact_pct),
+ mev_tip_mode: s.mev_tip_mode || 'off',
+ firewall_level: s.firewall_level || 'block',
min_market_cap_usd: s.min_market_cap_usd != null ? Number(s.min_market_cap_usd) : null,
max_market_cap_usd: s.max_market_cap_usd != null ? Number(s.max_market_cap_usd) : null,
min_creator_graduated: s.min_creator_graduated,
@@ -397,6 +399,8 @@ async function upsertStrategy(req, res, userId) {
max_concurrent_positions: row.max_concurrent_positions,
slippage_bps: row.slippage_bps,
max_price_impact_pct: Number(row.max_price_impact_pct),
+ mev_tip_mode: row.mev_tip_mode || 'off',
+ firewall_level: row.firewall_level || 'block',
min_market_cap_usd: row.min_market_cap_usd != null ? Number(row.min_market_cap_usd) : null,
max_market_cap_usd: row.max_market_cap_usd != null ? Number(row.max_market_cap_usd) : null,
min_creator_graduated: row.min_creator_graduated,
diff --git a/data/changelog.json b/data/changelog.json
index f7a663847..9ed73ee60 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,14 @@
{
"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-06-20",
+ "title": "Live token card on the home page is streaming again",
+ "summary": "The 'Live token · Pump.fun' card on the home page was stuck on 'Loading live token…' and falling back to 'Live feed unavailable right now.' It now picks a real trending pump.fun coin — complete with its logo and market cap — and streams its live buys and sells again. The same fix restores the trending coin grid on the Communities page.",
+ "tags": [
+ "fix"
+ ]
+ },
{
"date": "2026-06-20",
"title": "Take the guided tour — a 3D guide walks you through every feature",
diff --git a/extensions/walk-avatar/store-assets/icon-128.png b/extensions/walk-avatar/store-assets/icon-128.png
new file mode 100644
index 000000000..a6c0a632c
Binary files /dev/null and b/extensions/walk-avatar/store-assets/icon-128.png differ
diff --git a/extensions/walk-avatar/store-assets/marquee-1280x800.png b/extensions/walk-avatar/store-assets/marquee-1280x800.png
new file mode 100644
index 000000000..b5f1fddd9
Binary files /dev/null and b/extensions/walk-avatar/store-assets/marquee-1280x800.png differ
diff --git a/extensions/walk-avatar/store-assets/promo-tile-440x280.png b/extensions/walk-avatar/store-assets/promo-tile-440x280.png
new file mode 100644
index 000000000..d336435ce
Binary files /dev/null and b/extensions/walk-avatar/store-assets/promo-tile-440x280.png differ
diff --git a/extensions/walk-avatar/store-assets/screenshot-1.png b/extensions/walk-avatar/store-assets/screenshot-1.png
index bcb988aea..b23532517 100644
Binary files a/extensions/walk-avatar/store-assets/screenshot-1.png and b/extensions/walk-avatar/store-assets/screenshot-1.png differ
diff --git a/extensions/walk-avatar/store-assets/screenshot-2.png b/extensions/walk-avatar/store-assets/screenshot-2.png
new file mode 100644
index 000000000..fee20a3f1
Binary files /dev/null and b/extensions/walk-avatar/store-assets/screenshot-2.png differ
diff --git a/extensions/walk-avatar/store-assets/screenshot-3.png b/extensions/walk-avatar/store-assets/screenshot-3.png
new file mode 100644
index 000000000..80c6bb34c
Binary files /dev/null and b/extensions/walk-avatar/store-assets/screenshot-3.png differ
diff --git a/extensions/walk-avatar/store-assets/screenshot-4.png b/extensions/walk-avatar/store-assets/screenshot-4.png
index e309b7b96..e3c558781 100644
Binary files a/extensions/walk-avatar/store-assets/screenshot-4.png and b/extensions/walk-avatar/store-assets/screenshot-4.png differ
diff --git a/extensions/walk-avatar/store-assets/screenshot-5.png b/extensions/walk-avatar/store-assets/screenshot-5.png
index 4c384a801..b8fc302cc 100644
Binary files a/extensions/walk-avatar/store-assets/screenshot-5.png and b/extensions/walk-avatar/store-assets/screenshot-5.png differ
diff --git a/public/p/render.js b/public/p/render.js
index 8b3e2c8fe..2e588b0e2 100644
--- a/public/p/render.js
+++ b/public/p/render.js
@@ -114,26 +114,25 @@ function renderPage(root, payload) {
function extraCopy(payload) {
const { template, config } = payload;
+ const m = config?.monetize || {};
if (template === 'token-launchpad') {
const t = config?.token || {};
const name = t.name || 'your token';
const ticker = t.ticker ? ` ($${t.ticker})` : '';
return `One click launches ${name}${ticker} on Pump.fun. Creator fees route to ${short(config?.identity?.wallet)}.`;
}
- // Legacy templates (paid-concierge / gated-showroom) render as hosted
- // landing pages; their CTA routes to the creator's own channel below.
- if (config?.identity?.website) {
- return `Built on three.ws. Continue to ${short(config?.identity?.wallet)}'s site to take the next step.`;
+ if (template === 'paid-concierge') {
+ return `Ask anything. Each call costs ${priceLabel(m) || 'a small USDC fee'} and settles instantly to ${short(config?.identity?.wallet)}.`;
+ }
+ if (template === 'gated-showroom') {
+ return `Unlock a private 3D scene with a one-time ${priceLabel(m) || 'USDC pass'}.`;
}
return '';
}
-// CTA handler. The only template with an on-platform action is the token
-// launchpad (one-click Pump.fun mint). Every other published page is a hosted
-// landing page whose CTA continues to the creator's own website — never a
-// dead endpoint.
+// CTA handler — each template hands off to its real flow.
function onCtaClick(payload, btn, statusEl) {
- const { template, config } = payload;
+ const { template } = payload;
if (template === 'token-launchpad') {
// Pump.fun coin creation lives on the public /launch surface, where the
// visitor picks a wallet and signs the mint transaction themselves.
@@ -142,18 +141,127 @@ function onCtaClick(payload, btn, statusEl) {
statusEl.className = 'status-msg ok';
return;
}
- const website = config?.identity?.website || '';
- if (website) {
- const href = /^https?:\/\//i.test(website) ? website : `https://${website}`;
- window.open(href, '_blank', 'noopener');
- statusEl.textContent = 'Continuing to the creator’s site…';
- statusEl.className = 'status-msg ok';
+ if (template === 'paid-concierge') {
+ openPaidModal(payload, statusEl, 'concierge');
+ return;
+ }
+ if (template === 'gated-showroom') {
+ openPaidModal(payload, statusEl, 'unlock');
return;
}
- statusEl.textContent = 'This page has no destination set yet — add a website in the Studio.';
+ statusEl.textContent = 'No action wired for this template yet.';
statusEl.className = 'status-msg err';
}
+// Format the live x402 402 challenge for a human. The published page is not a
+// wallet — an x402-capable wallet or agent settles the payment and retries —
+// so we surface the real amount, recipient, and network from the challenge.
+function challengeSummary(challenge) {
+ const a = Array.isArray(challenge?.accepts) ? challenge.accepts[0] : null;
+ if (!a) return 'Payment required — settle the x402 invoice in your wallet, then retry.';
+ const usdc = a.amount ? (Number(a.amount) / 1e6).toLocaleString(undefined, { maximumFractionDigits: 6 }) : '';
+ const net = String(a.network || '').startsWith('solana') ? 'Solana' : 'Base';
+ return `Pay ${usdc} USDC to ${short(a.payTo)} on ${net} with your x402 wallet, then retry.`;
+}
+
+// Shared modal for both paid templates. `mode` is 'concierge' (asks a question)
+// or 'unlock' (reveals a gated scene). Keyboard-operable: Escape closes, focus
+// is trapped, and the first control is focused on open.
+function openPaidModal(payload, statusEl, mode) {
+ const { slug, config } = payload;
+ const m = config?.monetize || {};
+ const isAsk = mode === 'concierge';
+ const backdrop = document.createElement('div');
+ backdrop.className = 'modal-backdrop';
+ backdrop.innerHTML = `
+ <div class="modal" role="dialog" aria-modal="true" aria-labelledby="lp-modal-title">
+ <h2 id="lp-modal-title">${isAsk ? 'Ask the concierge' : 'Unlock the room'}</h2>
+ <p>${isAsk
+ ? `Costs ${esc(priceLabel(m) || 'a small USDC fee')}. Settles to ${esc(short(config?.identity?.wallet))} on ${esc(m.chain || 'base')}.`
+ : `One-time ${esc(priceLabel(m) || 'USDC pass')} grants 24 h access. Settles to ${esc(short(config?.identity?.wallet))}.`}</p>
+ ${isAsk ? `
+ <div class="field">
+ <label for="lp-modal-q">Your question</label>
+ <input id="lp-modal-q" type="text" data-q placeholder="What's the best way to..." />
+ </div>` : ''}
+ <div class="status-msg" data-modal-status role="status" aria-live="polite"></div>
+ <div class="modal-actions">
+ <button class="secondary" type="button" data-cancel>Cancel</button>
+ <button class="primary" type="button" data-pay>${isAsk ? `Pay ${esc(priceLabel(m) || '')}`.trim() : 'Pay & enter'}</button>
+ </div>
+ </div>
+ `;
+ document.body.appendChild(backdrop);
+
+ const lastFocused = document.activeElement;
+ const close = () => {
+ backdrop.remove();
+ document.removeEventListener('keydown', onKey, true);
+ if (lastFocused && typeof lastFocused.focus === 'function') lastFocused.focus();
+ };
+ const focusables = () =>
+ [...backdrop.querySelectorAll('input,button,[href],[tabindex]:not([tabindex="-1"])')].filter(
+ (n) => !n.disabled && n.offsetParent !== null,
+ );
+ function onKey(e) {
+ if (e.key === 'Escape') { e.preventDefault(); close(); return; }
+ if (e.key === 'Tab') {
+ const f = focusables();
+ if (!f.length) return;
+ const first = f[0], last = f[f.length - 1];
+ if (e.shiftKey && document.activeElement === first) { e.preventDefault(); last.focus(); }
+ else if (!e.shiftKey && document.activeElement === last) { e.preventDefault(); first.focus(); }
+ }
+ }
+ document.addEventListener('keydown', onKey, true);
+ backdrop.querySelector('[data-cancel]').addEventListener('click', close);
+ backdrop.addEventListener('click', (e) => { if (e.target === backdrop) close(); });
+ (backdrop.querySelector('[data-q]') || backdrop.querySelector('[data-pay]')).focus();
+
+ backdrop.querySelector('[data-pay]').addEventListener('click', async () => {
+ const ms = backdrop.querySelector('[data-modal-status]');
+ const qEl = backdrop.querySelector('[data-q]');
+ const question = qEl ? qEl.value.trim() : '';
+ if (isAsk && !question) { ms.textContent = 'Type a question first.'; ms.className = 'status-msg err'; return; }
+ ms.textContent = isAsk ? 'Requesting an answer…' : 'Requesting unlock…';
+ ms.className = 'status-msg';
+ try {
+ const r = await fetch(`/api/launchpad/invoke?slug=${encodeURIComponent(slug)}`, {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify(isAsk ? { question } : {}),
+ });
+ if (r.status === 402) {
+ ms.textContent = challengeSummary(await r.json().catch(() => null));
+ ms.className = 'status-msg';
+ return;
+ }
+ if (!r.ok) {
+ const e = await r.json().catch(() => null);
+ throw new Error(e?.message || `Service error (${r.status})`);
+ }
+ const data = await r.json();
+ if (isAsk) {
+ ms.textContent = data?.answer || 'Reply received.';
+ ms.className = 'status-msg ok';
+ statusEl.textContent = 'Concierge replied — see the panel.';
+ statusEl.className = 'status-msg ok';
+ } else if (data?.unlockUrl) {
+ window.open(data.unlockUrl, '_blank', 'noopener');
+ close();
+ statusEl.textContent = 'Room unlocked — opened in a new tab.';
+ statusEl.className = 'status-msg ok';
+ } else {
+ ms.textContent = 'Unlocked, but no scene URL was returned.';
+ ms.className = 'status-msg err';
+ }
+ } catch (err) {
+ ms.textContent = err.message || 'Something went wrong.';
+ ms.className = 'status-msg err';
+ }
+ });
+}
+
// ─────── Boot ───────
const slug = slugFromPath();
const root = document.getElementById('root');
diff --git a/scripts/build-extension.mjs b/scripts/build-extension.mjs
index 6b00e76d3..1680100ab 100644
--- a/scripts/build-extension.mjs
+++ b/scripts/build-extension.mjs
@@ -1,6 +1,6 @@
// scripts/build-extension.mjs — bundle the Chrome extension for load-unpacked or Web Store.
import { build } from 'esbuild';
-import { cpSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
+import { cpSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from 'fs';
import { join, dirname } from 'path';
import { fileURLToPath } from 'url';
import { createRequire } from 'module';
@@ -98,6 +98,12 @@ cpSync(join(src, 'icons'), join(out, 'icons'), { recursive: true });
// copy it verbatim rather than re-bundling.
cpSync(join(src, 'vendor'), join(out, 'vendor'), { recursive: true });
+// Copy stylesheets referenced by popup.html / options.html (e.g. popup.css).
+// HTML pages load these as-is; without them the popup ships unstyled.
+for (const file of readdirSync(src)) {
+ if (file.endsWith('.css')) cpSync(join(src, file), join(out, file));
+}
+
// Write injected CSS (empty placeholder — content.js injects styles programmatically)
writeFileSync(join(out, 'styles', 'inject.css'), '/* reserved for injected styles */\n');
diff --git a/scripts/extension-screenshots.mjs b/scripts/extension-screenshots.mjs
index ee00864d1..a6f3375aa 100644
--- a/scripts/extension-screenshots.mjs
+++ b/scripts/extension-screenshots.mjs
@@ -222,10 +222,18 @@ function chromeShim(cfg) {
};
}).toString()})(${JSON.stringify(cfg)})`;
}
-async function routeApi(context, avatars) {
+async function routeApi(context, avatars, allowOrigin) {
await context.route('**/three.ws/api/**', async (route) => {
const url = route.request().url();
- const reply = (obj) => route.fulfill({ status: 200, contentType: 'application/json', headers: { 'access-control-allow-origin': '*' }, body: JSON.stringify(obj) });
+ // popup.js / options.js fetch with credentials:'include' — CORS forbids a
+ // wildcard ACAO with credentials, so reflect the caller's origin.
+ const origin = route.request().headers()['origin'] || allowOrigin || '*';
+ const reply = (obj) => route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ headers: { 'access-control-allow-origin': origin, 'access-control-allow-credentials': 'true' },
+ body: JSON.stringify(obj),
+ });
if (/\/api\/avatars\/(mine|featured)\b/.test(url) || /\/api\/avatars\?/.test(url)) return reply({ avatars });
if (/\/api\/tts\/voices\b/.test(url)) return reply({ enabled: true, default: DEFAULT_VOICE, voices: TTS_VOICES, providers: { nvidia: true, openai: true } });
if (/\/api\/(me|threews\/me)\b/.test(url)) return reply({ user: { handle: '@you', username: 'you' } });
@@ -258,7 +266,7 @@ async function composeSurface(shotBuf, outName, caption) {
async function snapExtensionPage(extBase, avatars, { file, viewport, shim, tabName, thumbSel, then }) {
return withBrowser(async (browser) => {
const ctx = await browser.newContext({ viewport, deviceScaleFactor: 2 });
- await routeApi(ctx, avatars);
+ await routeApi(ctx, avatars, extBase);
const page = await ctx.newPage();
await page.addInitScript(shim);
await page.goto(`${extBase}/${file}`, { waitUntil: 'domcontentloaded' });
diff --git a/src/app.js b/src/app.js
index 37fe35041..703a09402 100644
--- a/src/app.js
+++ b/src/app.js
@@ -12,6 +12,15 @@ import { NichAgent } from './nich-agent.js';
import { ThoughtBubble } from './thought-bubble.js';
import { AvatarCreator } from './avatar-creator.js';
import { resolveURI, isDecentralizedURI } from './ipfs.js';
+import { resolveDevR2Url } from './shared/dev-r2-proxy.js';
+
+// Resolve a model URL for loading: expand decentralized URIs (ipfs:/ar:) via the
+// gateway, then route r2.dev assets through the dev /r2-proxy so cross-origin
+// GLB fetches don't fail CORS on localhost / Codespaces. No-op in production.
+function resolveModelUrl(url) {
+ const expanded = isDecentralizedURI(url) ? resolveURI(url) : url;
+ return resolveDevR2Url(expanded);
+}
// Hosts we trust to serve 3D assets when a model URL arrives from an untrusted
// source (the `?model=` query param). Same-origin, decentralized (ipfs:/ar:),
// and these first-party/gateway hosts only — so a crafted link can't make the
@@ -318,7 +327,7 @@ class App {
// arbitrary attacker URL falls through to the default avatar.
const qpModel = isSafeQueryModelUrl(rawQpModel) ? rawQpModel : '';
const model = options.model || qpModel || '/avatars/cz.glb';
- this.view(isDecentralizedURI(model) ? resolveURI(model) : model, '', new Map())
+ this.view(resolveModelUrl(model), '', new Map())
.catch(() => {})
.finally(() => this._showDeployPage());
this._initAgentSystem();
diff --git a/src/communities.js b/src/communities.js
index c8e6d829c..9442c69db 100644
--- a/src/communities.js
+++ b/src/communities.js
@@ -216,10 +216,10 @@ function renderCoinError() {
async function loadTrending() {
renderSkeleton();
try {
- const r = await fetch('/api/pump/trending?limit=48', { headers: { accept: 'application/json' } });
+ const r = await fetch('/api/pump/trending?limit=48&rich=1', { headers: { accept: 'application/json' } });
if (!r.ok) throw new Error(`HTTP ${r.status}`);
const data = await r.json();
- renderCoins(Array.isArray(data) ? data : data?.coins || []);
+ renderCoins(Array.isArray(data) ? data : data?.data || data?.coins || []);
} catch (err) {
log.warn('[communities] trending failed:', err?.message ?? err);
renderCoinError();
diff --git a/src/editor/launchpad-studio.js b/src/editor/launchpad-studio.js
index 636914c41..e6bc5be54 100644
--- a/src/editor/launchpad-studio.js
+++ b/src/editor/launchpad-studio.js
@@ -1228,8 +1228,8 @@ function buildRailHTML(state) {
${field('Chain', `
<select data-bind="monetize.chain">
<option value="base" ${state.monetize.chain === 'base' ? 'selected' : ''}>Base</option>
- <option value="polygon" ${state.monetize.chain === 'polygon' ? 'selected' : ''}>Polygon</option>
- </select>`)}
+ <option value="solana" ${state.monetize.chain === 'solana' ? 'selected' : ''}>Solana</option>
+ </select>`, 'x402 settles the per-call fee in USDC on the chosen chain.')}
</div>
`;
} else if (tpl.id === 'gated-showroom') {
diff --git a/src/home-live-token.js b/src/home-live-token.js
index 1d2cdc3a5..3a2c513ef 100644
--- a/src/home-live-token.js
+++ b/src/home-live-token.js
@@ -11,7 +11,7 @@
* migrated (AMM) trades and is rock-solid.
*/
-const TRENDING_URL = '/api/pump/trending?limit=24';
+const TRENDING_URL = '/api/pump/trending?limit=24&rich=1';
const TRADES_URL = (mint, limit = 30) =>
`/api/pump/coin-trades?mint=${encodeURIComponent(mint)}&limit=${limit}`;
const MAX_ROWS = 6;
@@ -119,7 +119,7 @@ class HomeLiveToken {
}
if (!r.ok) return null;
const data = await r.json();
- const list = Array.isArray(data) ? data : data?.coins || [];
+ const list = Array.isArray(data) ? data : data?.data || data?.coins || [];
// Prefer a coin with an image and a real market cap; fall back to any with
// a mint + symbol so the card is never empty.
const usable = list.filter((c) => c && c.mint && c.symbol);
diff --git a/src/shared/dev-r2-proxy.js b/src/shared/dev-r2-proxy.js
new file mode 100644
index 000000000..548c62fd4
--- /dev/null
+++ b/src/shared/dev-r2-proxy.js
@@ -0,0 +1,37 @@
+// Dev-only CORS workaround for R2 public assets.
+//
+// The bucket's public `*.r2.dev` domain only sends `Access-Control-Allow-Origin`
+// for the production three.ws origins. On localhost / Codespaces (`*.github.dev`)
+// / Gitpod the browser blocks the cross-origin GLB fetch and the viewer surfaces
+// a "Network error". The Vite dev server proxies `/r2-proxy/*` to the bucket
+// (see `vite.config.js`), so rewriting r2.dev URLs to that same-origin path lets
+// the fetch succeed. This is a no-op in production, where the asset host serves
+// the correct CORS headers and the raw URL is used unchanged.
+
+function isDevHost() {
+ if (typeof location === 'undefined') return false;
+ const h = location.hostname;
+ return (
+ h === 'localhost' ||
+ h === '127.0.0.1' ||
+ h.includes('.github.dev') ||
+ h.includes('.gitpod.io')
+ );
+}
+
+/**
+ * Rewrite a public r2.dev asset URL to the Vite `/r2-proxy` route in dev so the
+ * cross-origin fetch isn't blocked by CORS. Returns the URL unchanged in
+ * production or for any non-r2.dev / malformed input.
+ * @param {string} url
+ * @returns {string}
+ */
+export function resolveDevR2Url(url) {
+ if (!url || typeof url !== 'string') return url;
+ if (!isDevHost() || !url.includes('r2.dev')) return url;
+ try {
+ return '/r2-proxy' + new URL(url).pathname;
+ } catch {
+ return url;
+ }
+}