Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
THREE intel deep reports, club, animation slots, economy, sitemap, and changelog updates
nirholase050c12fe3b3
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 055a3c5a8..28f17dede 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,6 +6,9 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr## 2026-06-18+- **$THREE Intel · Live on-chain intelligence** (`/three-intel`) — The first real utility surface for $THREE beyond price and chart: a live on-chain signal terminal powered by the Coin Intelligence Engine, live market data, and sentiment. Hold $THREE to unlock the live feed and holder narrative layer; spend $THREE for a synthesized per-token Deep Report — risk, organic-strength, distribution, and a scored read.+- **$THREE Intel — the token's first real on-chain intelligence terminal** — A new page at /three-intel turns $THREE from a chart-and-buy token into a working tool. It's a live on-chain intelligence terminal: a real-time feed of newly observed Solana coins with derived signals (bundle vs organic launch, top-wallet concentration, sniping, fresh-wallet farming, risk flags) and a one-word verdict on each — powered by the three.ws Coin Intelligence Engine, live market data, and on-chain sentiment. Holding $THREE (Bronze tier and up) unlocks the feed live; everyone else sees the same signals on a 30-minute delay, so the hold is a real edge, not a paywall. A free Token Scanner reads any mint's signals, market, and sentiment on demand. And spending $THREE buys a per-token Deep Report — a synthesized dossier with a scored read, risk and organic-strength gauges, wallet distribution, and key findings — paid once on-chain, single-use, and saved so a retry never charges twice. This is the start of making the only coin actually do things. (`/three-intel`) `[feature]`+- **Chat avatar no longer kneels to pray on every new chat** — The 3D avatar in chat used to drop to its knees and play a praying animation each time a new conversation loaded — and again whenever it got curious mid-chat. That jarring entrance is gone. The avatar now stays calmly in its idle pose and shows attention through subtle gaze and facial expression instead of a full-body kneel. `[fix, improvement]`- **Coin community worlds no longer get stuck on “Connecting…”** — Opening a coin community world could occasionally hang on “Connecting…” forever — you'd see only yourself, with chat, voice, and shared building all stalled and no way to recover short of a reload. It happened when the game server accepted the connection but never finished the join handshake, for instance while a server instance was waking from idle. The connection now has a firm time limit: if the handshake doesn't complete in time it retries on its own, and if the server stays unreachable it drops you cleanly into single-player so you can still explore and build locally — with the status pill tappable to reconnect. The same safeguard covers the open /walk world and the IRL map. `[fix]`- **Connect a wallet and your $THREE tier is recognized — no account needed** — You no longer need a three.ws account to be seen as a $THREE holder. Connect your Solana wallet and the site reads your tier straight from your on-chain holdings: the holder chip in the top bar shows your live tier (◆ Bronze, Silver, Gold…) and holder features like High-quality generation on Forge unlock from the connected wallet alone. When a feature needs proof the wallet is yours, you approve a single free signature that moves no funds. Switch or disconnect a wallet and your tier updates instantly, no reload. Signed-in accounts keep working exactly as before. (`/forge`) `[improvement]`- **Forge checkout no longer dead-ends when generation is briefly busy** — When the 3D generator was momentarily rate-limited mid-checkout, Forge could show a raw technical error and look like the payment had failed for good. Now a brief upstream slowdown shows a clear message — your payment was not taken, and the generation retries in a few seconds — and the checkout auto-retries on its own before ever asking you to try again. Your payment only settles once the model is actually produced, so a busy moment never costs you anything. (`/forge`) `[fix]`diff --git a/api/_lib/intel-deep-payment.js b/api/_lib/intel-deep-payment.jsnew file mode 100644index 000000000..5fb21ad81--- /dev/null+++ b/api/_lib/intel-deep-payment.js@@ -0,0 +1,141 @@+// Pay-per-use proof for the $THREE Intel Deep Report — the consumption lever of+// Token Utility applied to intelligence.+//+// Anyone (holder or not) may pay $THREE for ONE per-token Deep Report instead of+// the report being a held perk. The payment runs through the existing token rail+// (api/_lib/token: quote → settle), which records a settled `consumption` row in+// token_payments bound to ref_type:'intel' and the client nonce as ref_id. The+// client then POSTs the report request with { payment_id, ref_id }, and this+// module is the server's authority on whether that proof buys a report.+//+// Unlike the Forge redemption ledger, this one STORES the generated dossier:+// • assertIntelPayment() — read-only validation: the payment is a settled+// `consumption` for intel.deep, ref-bound, correctly priced, and recent.+// • getStoredReport() — the dossier already bought with this payment, or+// null. A retry (network hiccup on the way back) returns the SAME report —+// the buyer never loses a paid report and is never charged twice.+// • claimReport() — atomically persist the freshly generated dossier.+// The payment_id PRIMARY KEY makes it race-safe: a concurrent generation that+// stored first wins, and this caller is handed the stored copy instead.+//+// Security model: authorization rests on the (payment_id, ref_id) pair. payment_id+// is a server-minted UUID returned only to the settling client; ref_id is the+// client nonce recorded on the payment at quote time. Each pair buys exactly one+// report, for exactly the one token mint it was first redeemed against.++import { sql } from './db.js';+import { priceForAction } from './pricing/catalog.js';++// How long after settlement a payment may be redeemed for a report. Generous: a+// report is normally generated seconds after settling, but a buyer may pay, get+// distracted, and come back. Older than this is treated as stale.+const REDEMPTION_WINDOW_MS = 24 * 60 * 60 * 1000;++const INTEL_DEEP_ACTION = 'intel.deep';+const INTEL_REF_TYPE = 'intel';+const CONSUMPTION_PURPOSE = 'consumption';++function payErr(message, status, code, extra = {}) {+ return Object.assign(new Error(message), { status, code, ...extra });+}++// Direct lookup of one settled payment — lighter than listPayments (which pulls+// in the on-chain settle/verify module) and all this path needs.+async function lookupPayment(paymentId) {+ const [row] = await sql`+ select id, purpose, usd, ref_type, ref_id, confirmed_at, created_at+ from token_payments+ where id = ${paymentId}+ limit 1+ `;+ return row || null;+}++/**+ * The dossier already bought with this payment (with the mint it covers), or null.+ * @param {string} paymentId+ * @returns {Promise<{ mint: string, report: object } | null>}+ */+export async function getStoredReport(paymentId) {+ if (!paymentId) return null;+ const [row] = await sql`+ select mint, report from intel_deep_reports where payment_id = ${paymentId} limit 1+ `;+ return row ? { mint: row.mint, report: row.report } : null;+}++/**+ * Validate that a settled $THREE payment proves entitlement to one Deep Report.+ * Read-only: does not consume or store anything.+ *+ * @param {object} params+ * @param {string} params.paymentId token_payments.id returned by settle+ * @param {string} params.refId the client nonce the payment was bound to+ * @param {number} [params.discountBps] holder fee discount (bps) when a tier pass+ * rode along at quote time, so the expected+ * price matches what the client was quoted+ * @returns {Promise<{ ok: true, payment: { id, usd, settledAt } }>}+ * @throws 402 payment_invalid | 402 payment_expired | 400 bad_request+ */+export async function assertIntelPayment({ paymentId, refId, discountBps = 0 }) {+ if (!paymentId || !refId) {+ throw payErr('payment_id and ref_id are required', 400, 'bad_request');+ }++ const payment = await lookupPayment(paymentId);+ if (!payment) {+ throw payErr('No settled $THREE payment found for this report.', 402, 'payment_invalid');+ }+ if (payment.purpose !== CONSUMPTION_PURPOSE || payment.ref_type !== INTEL_REF_TYPE) {+ throw payErr('This payment is not an Intel Deep Report payment.', 402, 'payment_invalid');+ }+ if (payment.ref_id !== refId) {+ throw payErr('This payment does not match this report.', 402, 'payment_invalid');+ }++ // Price must equal the catalog price for intel.deep (holder discount applied+ // when a pass rides along), so an underpaid quote can't be redeemed.+ const expectedUsd = Number(priceForAction(INTEL_DEEP_ACTION, { discountBps }).usd);+ const paidUsd = Number(payment.usd);+ if (!(Math.abs(paidUsd - expectedUsd) < 0.005)) {+ throw payErr(+ `This payment ($${paidUsd.toFixed(2)}) does not cover a Deep Report ($${expectedUsd.toFixed(2)}).`,+ 402,+ 'payment_invalid',+ );+ }++ const settledAt = payment.confirmed_at || payment.created_at;+ const ageMs = Date.now() - new Date(settledAt).getTime();+ if (!(ageMs >= 0) || ageMs > REDEMPTION_WINDOW_MS) {+ throw payErr('This payment has expired — pay again for a fresh report.', 402, 'payment_expired');+ }++ return { ok: true, payment: { id: payment.id, usd: paidUsd, settledAt } };+}++/**+ * Atomically persist a generated dossier against its payment. Race-safe via the+ * payment_id PRIMARY KEY: if a concurrent generation stored first, nothing is+ * inserted and the already-stored report is returned instead — so two racing+ * requests for the same payment always converge on one dossier.+ *+ * @param {object} params+ * @param {string} params.paymentId+ * @param {string} params.refId+ * @param {string} params.mint+ * @param {object} params.report+ * @returns {Promise<{ report: object, fresh: boolean }>}+ */+export async function claimReport({ paymentId, refId, mint, report }) {+ const rows = await sql`+ insert into intel_deep_reports (payment_id, ref_id, mint, report)+ values (${paymentId}, ${refId}, ${mint}, ${JSON.stringify(report)}::jsonb)+ on conflict (payment_id) do nothing+ returning report+ `;+ if (rows.length > 0) return { report: rows[0].report, fresh: true };+ // Lost the race (or a re-POST): return whatever is stored for this payment.+ const stored = await getStoredReport(paymentId);+ return { report: stored?.report ?? report, fresh: false };+}diff --git a/api/_lib/intel/assess.js b/api/_lib/intel/assess.jsnew file mode 100644index 000000000..354647bcd--- /dev/null+++ b/api/_lib/intel/assess.js@@ -0,0 +1,81 @@+// Signal assessment — the analytical core of $THREE Intel.+//+// Pure, deterministic, dependency-free: it turns the raw on-chain signals the+// Coin Intelligence Engine records (bundle/organic/snipe/concentration/fresh-+// wallet ratios, quality score, risk flags) into a transparent read — a risk+// score, an organic-strength score, a one-word verdict, and the human-readable+// reasons behind them. Every reason traces to a real observed signal, so the+// terminal explains itself rather than asking the user to trust a black box.+//+// Importable on the server (the feed + deep report) and pure enough to unit-test.++// Signals arrive as either 0–1 ratios or 0–100 scores depending on the column;+// normalize everything to a 0–100 scale so the weighting is uniform. null/NaN → 0.+function pct(v) {+ const n = Number(v);+ if (!Number.isFinite(n) || n <= 0) return 0;+ return n <= 1 ? Math.round(n * 100) : Math.min(100, Math.round(n));+}++const clamp = (n) => Math.max(0, Math.min(100, Math.round(n)));++/**+ * Assess one coin's intelligence row.+ * @param {object} row shaped coin-intel fields (quality_score, bundle_score,+ * organic_score, snipe_ratio, concentration_top10, fresh_wallet_ratio,+ * risk_flags, dev_sold, buy_count, sell_count, unique_buyers)+ * @returns {{ risk:number, organic:number, verdict:string, verdictLabel:string, reasons:string[] }}+ */+export function assessCoin(row = {}) {+ const quality = pct(row.quality_score);+ const bundle = pct(row.bundle_score);+ const organic = pct(row.organic_score);+ const snipe = pct(row.snipe_ratio);+ const concentration = pct(row.concentration_top10);+ const fresh = pct(row.fresh_wallet_ratio);+ const flags = Array.isArray(row.risk_flags) ? row.risk_flags : [];++ // Risk: a weighted blend of the adversarial signals, plus a penalty per flag.+ let risk =+ bundle * 0.3 + concentration * 0.25 + snipe * 0.2 + fresh * 0.15 + (100 - organic) * 0.1;+ risk += flags.length * 6;+ if (row.dev_sold) risk += 12;+ risk = clamp(risk);++ // Organic strength: real demand signals net of the adversarial ones.+ const buyers = Number(row.unique_buyers) || 0;+ const buys = Number(row.buy_count) || 0;+ const sells = Number(row.sell_count) || 0;+ const buyPressure = buys + sells > 0 ? (buys / (buys + sells)) * 100 : 50;+ let strength =+ organic * 0.4 + quality * 0.3 + Math.min(100, buyers * 2) * 0.15 + buyPressure * 0.15;+ strength = clamp(strength - bundle * 0.2);++ const reasons = [];+ if (bundle >= 50) reasons.push(`Bundled launch detected (${bundle}% bundle signal)`);+ else if (bundle > 0 && bundle < 25) reasons.push('Low bundle signal — launch looks unbundled');+ if (concentration >= 50) reasons.push(`Top-10 wallets hold a concentrated share (${concentration}%)`);+ if (snipe >= 40) reasons.push(`Heavy first-block sniping (${snipe}% snipe ratio)`);+ if (fresh >= 60) reasons.push(`Mostly fresh wallets (${fresh}%) — possible coordinated farming`);+ if (organic >= 60) reasons.push(`Strong organic demand signal (${organic}%)`);+ if (buyers >= 30) reasons.push(`${buyers} unique buyers observed early`);+ if (row.dev_sold) reasons.push('Dev wallet has already sold');+ for (const f of flags.slice(0, 4)) reasons.push(`Flag: ${String(f).replace(/_/g, ' ')}`);+ if (reasons.length === 0) reasons.push('No strong risk signals in the observed window');++ // Verdict: risk dominates; organic strength breaks ties for the safe band.+ let verdict = 'mixed';+ if (risk >= 70) verdict = 'high_risk';+ else if (risk >= 45) verdict = 'caution';+ else if (strength >= 55) verdict = 'organic';+ else verdict = 'mixed';++ const verdictLabel = {+ organic: 'Organic',+ mixed: 'Mixed',+ caution: 'Caution',+ high_risk: 'High risk',+ }[verdict];++ return { risk, organic: strength, verdict, verdictLabel, reasons };+}diff --git a/api/_lib/migrations/2026-06-18-intel-deep-reports.sql b/api/_lib/migrations/2026-06-18-intel-deep-reports.sqlnew file mode 100644index 000000000..822e15061--- /dev/null+++ b/api/_lib/migrations/2026-06-18-intel-deep-reports.sql@@ -0,0 +1,39 @@+-- Migration: intel_deep_reports — single-use ledger + result store for the+-- pay-per-use $THREE Intel Deep Report (catalog action `intel.deep`).+-- Apply: node scripts/apply-migrations.mjs --apply --file 2026-06-18-intel-deep-reports.sql+-- Idempotent.+--+-- Token Utility — the consumption lever, applied to intelligence. A caller pays+-- $THREE for ONE per-token Deep Report (api/_lib/token quote → settle records the+-- payment in token_payments as a `consumption`/ref_type:'intel' row). This table+-- binds ONE settled payment to ONE generated report:+-- • PRIMARY KEY on payment_id ⇒ "one payment = one report", forever.+-- • The full report jsonb is stored alongside, so a network hiccup on the way+-- back never costs the buyer their paid report — a retry returns the SAME+-- stored dossier (idempotent), it never regenerates or double-charges.+-- • mint is recorded so a payment redeemed for one token can't be replayed+-- against another; a mismatched retry is rejected, a matching one is served+-- from the store.+--+-- No secrets are stored: payment_id references the public token_payments ledger+-- and the report is derived entirely from public on-chain + market intelligence.++begin;++create table if not exists intel_deep_reports (+ -- The settled consumption payment this report was bought with (one row ever).+ payment_id uuid primary key references token_payments(id) on delete cascade,+ -- The client nonce the payment was quoted/settled against (token_payments.ref_id).+ -- Re-checked on redemption so possession of payment_id alone can't redeem.+ ref_id text not null,+ -- The token mint the report covers. Binds the payment to one subject.+ mint text not null,+ -- The full generated dossier, returned verbatim on every idempotent retry.+ report jsonb not null,+ created_at timestamptz not null default now()+);++create index if not exists intel_deep_reports_created+ on intel_deep_reports (created_at desc);++commit;diff --git a/api/three-intel/[action].js b/api/three-intel/[action].jsnew file mode 100644index 000000000..8bab5ebb4--- /dev/null+++ b/api/three-intel/[action].js@@ -0,0 +1,465 @@+// $THREE Intel — the live on-chain intelligence terminal's HTTP surface.+//+// This is the first real *use* of $THREE beyond Forge: holding the coin unlocks+// live intelligence; spending it buys a synthesized per-token dossier. Three+// actions, one currency:+//+// GET /api/three-intel/feed — the live radar feed. Holders (Bronze+)+// ?limit=&min_quality= see it live; everyone else sees the SAME+// feed on a 30-minute delay (the held edge).+// GET /api/three-intel/token?mint= — a free per-token scan: on-chain signals+// + live market + sentiment + a verdict.+// GET /api/three-intel/deep-report — the price quote for the paid Deep Report.+// POST /api/three-intel/deep-report — redeem a settled $THREE payment for a+// { mint, payment_id, ref_id } synthesized dossier (idempotent, single-use).+//+// Every datum is real: the radar feed is the Coin Intelligence Engine's on-chain+// observations (pump_coin_intel), market data is the shared keyless market module,+// sentiment is live pump.fun commentary scored by the in-repo lexicon, and the+// narrative layer is aixbt when a key is configured. No external key is required+// for the core — aixbt enrichment degrades gracefully when absent.++import { wrap, cors, method, json, error, readJson, rateLimited } from '../_lib/http.js';+import { limits, clientIp } from '../_lib/rate-limit.js';+import { sql } from '../_lib/db.js';+import { resolveCallerLevel } from '../_lib/require-three.js';+import { fetchTokenMarketData } from '../_lib/market/token-market.js';+import { assessCoin } from '../_lib/intel/assess.js';+import { aixbtEnabled, getIntel, getProjects } from '../_lib/aixbt.js';+import { catalogEntry } from '../_lib/pricing/catalog.js';+import { assertIntelPayment, getStoredReport, claimReport } from '../_lib/intel-deep-payment.js';++const SOLANA_MINT_RE = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;+const INTEL_MIN_LEVEL = 1; // Bronze+ — mirrors GATED_FEATURES['intel.terminal'].minLevel+const NON_HOLDER_DELAY_MIN = 30; // the held edge: non-holders see the feed 30 min late+const PUMPFUN_BASE = 'https://frontend-api-v3.pump.fun';++const lamportsToSol = (v) => (v == null ? null : Number(BigInt(v)) / 1e9);+const num = (v) => (v == null ? null : Number(v));++// Compact terminal-row shape: the headline signals the feed renders, plus the+// derived assessment. (The full 30-field intel row is available via ?mint=.)+function shapeFeedRow(r) {+ const row = {+ mint: r.mint,+ symbol: r.symbol,+ name: r.name,+ image_uri: r.image_uri,+ category: r.category,+ narrative: r.narrative,+ quality_score: num(r.quality_score),+ bundle_score: num(r.bundle_score),+ organic_score: num(r.organic_score),+ snipe_ratio: num(r.snipe_ratio),+ concentration_top10: num(r.concentration_top10),+ fresh_wallet_ratio: num(r.fresh_wallet_ratio),+ risk_flags: r.risk_flags || [],+ first_seen_at: r.first_seen_at,+ observation_seconds: r.observation_seconds,+ buy_count: r.buy_count,+ sell_count: r.sell_count,+ unique_buyers: r.unique_buyers,+ dev_buy_sol: lamportsToSol(r.dev_buy_lamports),+ dev_sold: r.dev_sold,+ };+ row.assessment = assessCoin(row);+ return row;+}++// Live pump.fun commentary, scored by the shared lexicon. Best-effort: any failure+// (rate limit, network, no comments) returns null so a scan/report never 500s on a+// flaky third-party endpoint.+async function fetchSentiment(mint, limit = 80) {+ try {+ const { scoreSentiment } = await import('../../src/social/sentiment.js');+ const controller = new AbortController();+ const t = setTimeout(() => controller.abort(), 7000);+ let res;+ try {+ res = await fetch(`${PUMPFUN_BASE}/replies/${mint}?limit=${limit}&offset=0`, {+ signal: controller.signal,+ });+ } finally {+ clearTimeout(t);+ }+ if (!res.ok) return null;+ const data = await res.json().catch(() => null);+ const replies = Array.isArray(data?.replies) ? data.replies : Array.isArray(data) ? data : [];+ const posts = replies+ .map((r) => ({ text: String(r.text || r.message || '').slice(0, 2000) }))+ .filter((p) => p.text);+ if (posts.length === 0) return null;+ const s = scoreSentiment(posts);+ return {+ score: s.score,+ posPct: Math.round(s.posPct),+ negPct: Math.round(s.negPct),+ neuPct: Math.round(s.neuPct),+ count: s.count,+ examples: s.examples,+ };+ } catch {+ return null;+ }+}++// The full on-chain intel row for one mint (the ?mint= scan + the report subject).+async function fetchCoinIntel(mint, { withWallets = false } = {}) {+ const [row] = await sql`select * from pump_coin_intel where mint = ${mint} limit 1`;+ if (!row) return null;+ const coin = {+ mint: row.mint,+ symbol: row.symbol,+ name: row.name,+ image_uri: row.image_uri,+ description: row.description,+ socials: { twitter: row.twitter, telegram: row.telegram, website: row.website },+ category: row.category,+ tags: row.tags || [],+ narrative: row.narrative,+ first_seen_at: row.first_seen_at,+ observation_seconds: row.observation_seconds,+ quality_score: num(row.quality_score),+ bundle_score: num(row.bundle_score),+ organic_score: num(row.organic_score),+ snipe_ratio: num(row.snipe_ratio),+ concentration_top10: num(row.concentration_top10),+ fresh_wallet_ratio: num(row.fresh_wallet_ratio),+ bubblemap_connectivity: num(row.bubblemap_connectivity),+ risk_flags: row.risk_flags || [],+ dev_buy_sol: lamportsToSol(row.dev_buy_lamports),+ dev_sold: row.dev_sold,+ buy_count: row.buy_count,+ sell_count: row.sell_count,+ unique_buyers: row.unique_buyers,+ unique_sellers: row.unique_sellers,+ };+ if (withWallets) {+ const wallets = await sql`+ select wallet, buy_lamports, sell_lamports, is_creator+ from pump_coin_wallets where mint = ${mint}+ order by (buy_lamports + sell_lamports) desc limit 10+ `;+ coin.top_wallets = wallets.map((w) => ({+ wallet: w.wallet,+ buy_sol: lamportsToSol(w.buy_lamports),+ sell_sol: lamportsToSol(w.sell_lamports),+ is_creator: w.is_creator,+ }));+ }+ return coin;+}++// ── feed ──────────────────────────────────────────────────────────────────────+async function handleFeed(req, res) {+ const rl = await limits.mcpIp(clientIp(req));+ if (!rl.success) return rateLimited(res, rl);++ const params = new URL(req.url, `http://${req.headers.host || 'x'}`).searchParams;+ const limit = Math.max(1, Math.min(50, parseInt(params.get('limit'), 10) || 24));+ const minQuality = params.get('min_quality') != null ? parseInt(params.get('min_quality'), 10) : null;++ const caller = await resolveCallerLevel(req, res, null);+ const eligible = caller.level >= INTEL_MIN_LEVEL;+ const delayMin = eligible ? 0 : NON_HOLDER_DELAY_MIN;+ // Non-holders get a capped window so the live edge is real, not cosmetic.+ const effLimit = eligible ? limit : Math.min(limit, 12);++ // A DB hiccup degrades to an empty feed (the UI has a designed empty state) —+ // the access/gating context still renders, so the page never 500s on a read.+ let feed = [];+ try {+ const rows = await sql`+ select mint, symbol, name, image_uri, category, narrative,+ quality_score, bundle_score, organic_score, snipe_ratio,+ concentration_top10, fresh_wallet_ratio, risk_flags,+ first_seen_at, observation_seconds, buy_count, sell_count,+ unique_buyers, dev_buy_lamports, dev_sold+ from pump_coin_intel+ where network = 'mainnet'+ and first_seen_at <= now() - make_interval(mins => ${delayMin})+ and (${Number.isFinite(minQuality) ? minQuality : null}::int is null+ or quality_score >= ${Number.isFinite(minQuality) ? minQuality : null})+ order by first_seen_at desc+ limit ${effLimit}+ `;+ feed = rows.map(shapeFeedRow);+ } catch {+ feed = [];+ }++ // Narrative layer (aixbt) is a holder enrichment and only when a key exists.+ let narrativeIntel = null;+ if (eligible && aixbtEnabled()) {+ try {+ const { intel } = await getIntel({ limit: 8 });+ narrativeIntel = Array.isArray(intel) ? intel : null;+ } catch {+ narrativeIntel = null;+ }+ }++ return json(+ res,+ 200,+ {+ ok: true,+ access: {+ eligible,+ level: caller.level,+ required_level: INTEL_MIN_LEVEL,+ delay_minutes: delayMin,+ reason: eligible ? 'eligible' : caller.hasWallet ? 'insufficient_tier' : caller.hasUser ? 'link_wallet' : 'connect',+ },+ feed,+ narrative_intel: narrativeIntel,+ aixbt_enabled: aixbtEnabled(),+ generatedAt: new Date().toISOString(),+ },+ // Holders bust cache (live); the delayed feed can be edge-cached briefly.+ { 'cache-control': eligible ? 'private, no-store' : 'public, max-age=30, s-maxage=60' },+ );+}++// ── token scan (free) ───────────────────────────────────────────────────────────+async function handleToken(req, res) {+ const rl = await limits.mcpIp(clientIp(req));+ if (!rl.success) return rateLimited(res, rl);++ const params = new URL(req.url, `http://${req.headers.host || 'x'}`).searchParams;+ const mint = (params.get('mint') || '').trim();+ if (!SOLANA_MINT_RE.test(mint)) {+ return error(res, 400, 'invalid_mint', 'mint must be a base58 Solana pubkey');+ }++ const [coin, market, sentiment] = await Promise.all([+ fetchCoinIntel(mint).catch(() => null),+ fetchTokenMarketData(mint).catch(() => null),+ fetchSentiment(mint).catch(() => null),+ ]);++ let outcome = null;+ if (coin) {+ const [o] = await sql`+ select outcome, graduated, rugged, ath_multiple, last_market_cap_usd+ from pump_coin_outcomes where mint = ${mint} limit 1+ `.catch(() => []);+ outcome = o+ ? {+ outcome: o.outcome,+ graduated: o.graduated,+ rugged: o.rugged,+ ath_multiple: num(o.ath_multiple),+ last_market_cap_usd: num(o.last_market_cap_usd),+ }+ : null;+ }++ return json(+ res,+ 200,+ {+ ok: true,+ mint,+ observed: Boolean(coin),+ coin,+ assessment: coin ? assessCoin(coin) : null,+ market: market+ ? {+ price_usd: market.price_usd,+ price_change_24h: market.price_change_24h,+ market_cap: market.market_cap,+ volume_24h: market.volume_24h,+ liquidity: market.liquidity,+ holders: market.holders,+ }+ : null,+ sentiment,+ outcome,+ generatedAt: new Date().toISOString(),+ },+ { 'cache-control': 'public, max-age=15, s-maxage=30' },+ );+}++// ── deep report (paid) ──────────────────────────────────────────────────────────++// Turn the gathered real signals into a synthesized read. Rules-based and fully+// transparent — every number traces to an observed signal, no black box.+function synthesize({ mint, coin, market, sentiment, assessment }) {+ const findings = [];+ let score = 50; // 0 = avoid, 100 = strong — starts neutral, moved by real signals.++ if (assessment) {+ score -= (assessment.risk - 50) * 0.5;+ score += (assessment.organic - 50) * 0.4;+ findings.push(...assessment.reasons.map((r) => ({ kind: 'onchain', text: r })));+ }+ if (market) {+ const chg = Number(market.price_change_24h);+ if (Number.isFinite(chg)) {+ score += Math.max(-15, Math.min(15, chg / 4));+ findings.push({+ kind: 'market',+ text: `24h price ${chg >= 0 ? '+' : ''}${chg.toFixed(1)}%${market.liquidity ? `, $${Math.round(market.liquidity).toLocaleString()} liquidity` : ''}`,+ });+ }+ const liq = Number(market.liquidity);+ if (Number.isFinite(liq) && liq < 5000) {+ score -= 10;+ findings.push({ kind: 'market', text: 'Thin liquidity — exit risk is elevated' });+ }+ }+ if (sentiment && sentiment.count >= 5) {+ score += Math.max(-12, Math.min(12, sentiment.score * 24));+ findings.push({+ kind: 'sentiment',+ text: `Community sentiment ${sentiment.score >= 0.15 ? 'positive' : sentiment.score <= -0.15 ? 'negative' : 'neutral'} across ${sentiment.count} recent comments (${sentiment.posPct}% pos / ${sentiment.negPct}% neg)`,+ });+ }++ score = Math.max(0, Math.min(100, Math.round(score)));+ let stance = 'watch';+ if (score >= 66) stance = 'accumulate-watch';+ else if (score <= 38) stance = 'avoid';+ const stanceLabel = { 'accumulate-watch': 'Constructive', watch: 'Neutral / watch', avoid: 'Defensive' }[stance];++ const symbol = coin?.symbol || market?.symbol || mint.slice(0, 4);+ const headline = `${symbol}: ${assessment?.verdictLabel || 'Unscored'} on-chain, ${stanceLabel.toLowerCase()} read`;++ return {+ headline,+ score,+ stance,+ stanceLabel,+ verdict: assessment?.verdict || 'unknown',+ findings,+ disclaimer:+ 'Signal-based intelligence derived from on-chain observation, live market data, and community sentiment. Not financial advice.',+ };+}++async function buildDeepReport(mint) {+ const [coin, market, sentiment] = await Promise.all([+ fetchCoinIntel(mint, { withWallets: true }).catch(() => null),+ fetchTokenMarketData(mint).catch(() => null),+ fetchSentiment(mint, 120).catch(() => null),+ ]);+ const assessment = coin ? assessCoin(coin) : null;++ // Narrative match from aixbt momentum-ranked projects, when a key is present.+ let narrative = null;+ if (aixbtEnabled()) {+ try {+ const { projects } = await getProjects({ limit: 12 });+ const sym = (coin?.symbol || '').toLowerCase();+ narrative =+ (Array.isArray(projects) &&+ projects.find((p) => String(p.ticker || p.name || '').toLowerCase().includes(sym) && sym)) ||+ null;+ } catch {+ narrative = null;+ }+ }++ const synthesis = synthesize({ mint, coin, market, sentiment, assessment });++ return {+ mint,+ subject: {+ symbol: coin?.symbol || null,+ name: coin?.name || null,+ image_uri: coin?.image_uri || null,+ category: coin?.category || null,+ socials: coin?.socials || null,+ },+ market: market+ ? {+ price_usd: market.price_usd,+ price_change_24h: market.price_change_24h,+ market_cap: market.market_cap,+ volume_24h: market.volume_24h,+ liquidity: market.liquidity,+ holders: market.holders,+ }+ : null,+ onchain: coin,+ assessment,+ sentiment,+ distribution: coin?.top_wallets+ ? {+ top_wallets: coin.top_wallets,+ note: 'Top 10 observed wallets by traded volume in the intelligence window.',+ }+ : null,+ narrative,+ synthesis,+ generatedAt: new Date().toISOString(),+ };+}++async function handleDeepReport(req, res) {+ // GET → the price quote so the client knows what to pay (no payment needed).+ if (req.method === 'GET') {+ const entry = catalogEntry('intel.deep');+ return json(res, 200, { ok: true, action: 'intel.deep', label: entry.label, usd: entry.usd }, {+ 'cache-control': 'public, max-age=300',+ });+ }++ const rl = await limits.mcpIp(clientIp(req));+ if (!rl.success) return rateLimited(res, rl);++ let body;+ try {+ body = await readJson(req);+ } catch {+ return error(res, 400, 'invalid_json', 'invalid json');+ }+ const mint = String(body?.mint || '').trim();+ const paymentId = String(body?.payment_id || '').trim();+ const refId = String(body?.ref_id || '').trim();+ if (!SOLANA_MINT_RE.test(mint)) {+ return error(res, 400, 'invalid_mint', 'mint must be a base58 Solana pubkey');+ }++ // Idempotency / single-use: a payment already redeemed returns its stored+ // dossier for the same mint, or is rejected if replayed against another token.+ const stored = await getStoredReport(paymentId).catch(() => null);+ if (stored) {+ if (stored.mint === mint) {+ return json(res, 200, { ok: true, paid: true, cached: true, report: stored.report });+ }+ return error(res, 409, 'payment_already_used', 'This payment already bought a report for a different token.');+ }++ try {+ await assertIntelPayment({ paymentId, refId });+ } catch (err) {+ return error(res, err.status || 402, err.code || 'payment_invalid', err.message || 'payment could not be verified');+ }++ const report = await buildDeepReport(mint);+ const { report: finalReport } = await claimReport({ paymentId, refId, mint, report });+ return json(res, 200, { ok: true, paid: true, cached: false, report: finalReport });+}++const DISPATCH = {+ feed: { GET: handleFeed },+ token: { GET: handleToken },+ 'deep-report': { GET: handleDeepReport, POST: handleDeepReport },+};++export default wrap(async (req, res) => {+ if (cors(req, res, { methods: 'GET,POST,OPTIONS', credentials: true })) return;++ const action = req.query?.action ?? new URL(req.url, 'http://x').pathname.split('/').pop();+ const handlers = DISPATCH[action];+ if (!handlers) return error(res, 404, 'not_found', `unknown intel action: ${action}`);+ const handler = handlers[req.method];+ if (!handler) {+ if (!method(req, res, Object.keys(handlers))) return;+ return;+ }+ return handler(req, res);+});diff --git a/data/changelog.json b/data/changelog.jsonindex 2bfafb845..42b1258e2 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,24 @@{"$comment": "Curated changelog entries for three.ws \u2014 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-18",+ "title": "Chat avatar no longer kneels to pray on every new chat",+ "summary": "The 3D avatar in chat used to drop to its knees and play a praying animation each time a new conversation loaded — and again whenever it got curious mid-chat. That jarring entrance is gone. The avatar now stays calmly in its idle pose and shows attention through subtle gaze and facial expression instead of a full-body kneel.",+ "tags": [+ "fix",+ "improvement"+ ]+ },+ {+ "date": "2026-06-18",+ "title": "$THREE Intel — the token's first real on-chain intelligence terminal",+ "summary": "A new page at /three-intel turns $THREE from a chart-and-buy token into a working tool. It's a live on-chain intelligence terminal: a real-time feed of newly observed Solana coins with derived signals (bundle vs organic launch, top-wallet concentration, sniping, fresh-wallet farming, risk flags) and a one-word verdict on each — powered by the three.ws Coin Intelligence Engine, live market data, and on-chain sentiment. Holding $THREE (Bronze tier and up) unlocks the feed live; everyone else sees the same signals on a 30-minute delay, so the hold is a real edge, not a paywall. A free Token Scanner reads any mint's signals, market, and sentiment on demand. And spending $THREE buys a per-token Deep Report — a synthesized dossier with a scored read, risk and organic-strength gauges, wallet distribution, and key findings — paid once on-chain, single-use, and saved so a retry never charges twice. This is the start of making the only coin actually do things.",+ "tags": [+ "feature"+ ],+ "link": "/three-intel"+ },{"date": "2026-06-18","title": "Graduated coins show a live price on agent and community cards",diff --git a/data/pages.json b/data/pages.jsonindex ab5183818..0965f23e7 100644--- a/data/pages.json+++ b/data/pages.json@@ -709,6 +709,14 @@"changefreq": "weekly","added": "2026-06-15"},+ {+ "path": "/three-intel",+ "title": "$THREE Intel \u00b7 Live on-chain intelligence",+ "description": "The first real utility surface for $THREE beyond price and chart: a live on-chain signal terminal powered by the Coin Intelligence Engine, live market data, and sentiment. Hold $THREE to unlock the live feed and holder narrative layer; spend $THREE for a synthesized per-token Deep Report \u2014 risk, organic-strength, distribution, and a scored read.",+ "priority": 0.8,+ "changefreq": "always",+ "added": "2026-06-18"+ },{"path": "/fact-checker","title": "Fact Checker",diff --git a/pages/club.html b/pages/club.htmlindex a78219251..a870b5ea8 100644--- a/pages/club.html+++ b/pages/club.html@@ -1817,6 +1817,9 @@.club-pick-tile.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255, 59, 214, 0.3); }.club-pick-tile.busy { opacity: 0.6; pointer-events: none; }.club-pick-tile.failed { border-color: var(--danger); }+ .club-pick-tile.undanceable { opacity: 0.4; cursor: not-allowed; filter: grayscale(0.7); }+ .club-pick-tile.undanceable:hover { transform: none; border-color: var(--border); background: transparent; }+ .club-pick-tile.undanceable .club-pick-name { text-decoration: line-through; }.club-pick-thumb {aspect-ratio: 1;border-radius: 9px;@@ -1840,6 +1843,7 @@background: rgba(255, 59, 214, 0.18);color: var(--accent);}+ .club-pick-badge.is-dead { background: rgba(255, 90, 90, 0.16); color: var(--danger); }.club-pick-spinner {position: absolute;inset: 0;diff --git a/pages/three-intel.html b/pages/three-intel.htmlnew file mode 100644index 000000000..5512beb58--- /dev/null+++ b/pages/three-intel.html@@ -0,0 +1,33 @@+<!doctype html>+<html lang="en">+ <head>+ <script>/* three.ws theme boot — no-flash; runtime in /theme-switcher.js */(function(){try{var m=localStorage.getItem('twx_theme');var l=m==='auto'?(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches):m==='light';document.documentElement.setAttribute('data-theme',l?'light':'dark');}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();</script>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width,initial-scale=1" />+ <title>$THREE Intel · Live on-chain intelligence terminal · three.ws</title>+ <meta name="description" content="The $THREE Intel terminal — live on-chain signal feed, per-token scanner, and paid Deep Reports. Hold $THREE to unlock the live feed; spend $THREE for a synthesized per-token dossier. Real utility for the only coin." />+ <meta property="og:title" content="$THREE Intel · Live on-chain intelligence" />+ <meta property="og:description" content="Hold $THREE to unlock a live on-chain signal feed; spend $THREE for a synthesized per-token Deep Report. The first real utility surface for the only coin." />+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/three-intel" />+ <meta property="og:image" content="https://three.ws/og-image.png" />+ <meta property="og:image:width" content="1200" />+ <meta property="og:image:height" content="630" />+ <meta name="twitter:card" content="summary_large_image" />+ <meta name="twitter:site" content="@trythreews" />+ <meta name="twitter:title" content="$THREE Intel · Live on-chain intelligence terminal" />+ <meta name="twitter:description" content="Hold $THREE to unlock live on-chain signals; spend $THREE for a synthesized per-token Deep Report." />+ <meta name="twitter:image" content="https://three.ws/og-image.png" />+ <meta name="theme-color" content="#0a0b10" />+ <link rel="icon" href="/favicon.ico" sizes="any" />+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />+ <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />+ <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />+ <link rel="manifest" href="/site.webmanifest" />+ </head>+ <body>+ <script type="module" src="/src/three-intel.js"></script>+ </body>+</html>diff --git a/public/changelog.json b/public/changelog.jsonindex 3b2cec008..0b3ffb28c 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,11 +1,42 @@{- "generated_at": "2026-06-18T03:00:36.961Z",+ "generated_at": "2026-06-18T03:43:39.576Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws","url": "https://three.ws"},"entries": [+ {+ "date": "2026-06-18",+ "type": "launch",+ "title": "$THREE Intel · Live on-chain intelligence",+ "summary": "The first real utility surface for $THREE beyond price and chart: a live on-chain signal terminal powered by the Coin Intelligence Engine, live market data, and sentiment. Hold $THREE to unlock the live feed and holder narrative layer; spend $THREE for a synthesized per-token Deep Report — risk, organic-strength, distribution, and a scored read.",+ "link": "/three-intel",+ "tags": [+ "launch"+ ]+ },+ {+ "date": "2026-06-18",+ "type": "update",+ "title": "$THREE Intel — the token's first real on-chain intelligence terminal",+ "summary": "A new page at /three-intel turns $THREE from a chart-and-buy token into a working tool. It's a live on-chain intelligence terminal: a real-time feed of newly observed Solana coins with derived signals (bundle vs organic launch, top-wallet concentration, sniping, fresh-wallet farming, risk flags) and a one-word verdict on each — powered by the three.ws Coin Intelligence Engine, live market data, and on-chain sentiment. Holding $THREE (Bronze tier and up) unlocks the feed live; everyone else sees the same signals on a 30-minute delay, so the hold is a real edge, not a paywall. A free Token Scanner reads any mint's signals, market, and sentiment on demand. And spending $THREE buys a per-token Deep Report — a synthesized dossier with a scored read, risk and organic-strength gauges, wallet distribution, and key findings — paid once on-chain, single-use, and saved so a retry never charges twice. This is the start of making the only coin actually do things.",+ "link": "/three-intel",+ "tags": [+ "feature"+ ]+ },+ {+ "date": "2026-06-18",+ "type": "update",+ "title": "Chat avatar no longer kneels to pray on every new chat",+ "summary": "The 3D avatar in chat used to drop to its knees and play a praying animation each time a new conversation loaded — and again whenever it got curious mid-chat. That jarring entrance is gone. The avatar now stays calmly in its idle pose and shows attention through subtle gaze and facial expression instead of a full-body kneel.",+ "link": null,+ "tags": [+ "fix",+ "improvement"+ ]+ },{"date": "2026-06-18","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex 38eb89819..51467dd2e 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -6,6 +6,30 @@<atom:link href="https://three.ws/changelog.xml" rel="self" type="application/rss+xml"/><description>What's new on three.ws — features, improvements, and releases, newest first.</description><language>en</language>+ <item>+ <title>$THREE Intel · Live on-chain intelligence</title>+ <link>https://three.ws/three-intel</link>+ <guid isPermaLink="false">2026-06-18:$THREE Intel · Live on-chain intelligence</guid>+ <pubDate>Thu, 18 Jun 2026 12:00:00 GMT</pubDate>+ <category>launch</category>+ <description>The first real utility surface for $THREE beyond price and chart: a live on-chain signal terminal powered by the Coin Intelligence Engine, live market data, and sentiment. Hold $THREE to unlock the live feed and holder narrative layer; spend $THREE for a synthesized per-token Deep Report — risk, organic-strength, distribution, and a scored read.</description>+ </item>+ <item>+ <title>$THREE Intel — the token's first real on-chain intelligence terminal</title>+ <link>https://three.ws/three-intel</link>+ <guid isPermaLink="false">2026-06-18:$THREE Intel — the token's first real on-chain intelligence terminal</guid>+ <pubDate>Thu, 18 Jun 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>A new page at /three-intel turns $THREE from a chart-and-buy token into a working tool. It's a live on-chain intelligence terminal: a real-time feed of newly observed Solana coins with derived signals (bundle vs organic launch, top-wallet concentration, sniping, fresh-wallet farming, risk flags) and a one-word verdict on each — powered by the three.ws Coin Intelligence Engine, live market data, and on-chain sentiment. Holding $THREE (Bronze tier and up) unlocks the feed live; everyone else sees the same signals on a 30-minute delay, so the hold is a real edge, not a paywall. A free Token Scanner reads any mint's signals, market, and sentiment on demand. And spending $THREE buys a per-token Deep Report — a synthesized dossier with a scored read, risk and organic-strength gauges, wallet distribution, and key findings — paid once on-chain, single-use, and saved so a retry never charges twice. This is the start of making the only coin actually do things.</description>+ </item>+ <item>+ <title>Chat avatar no longer kneels to pray on every new chat</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-06-18:Chat avatar no longer kneels to pray on every new chat</guid>+ <pubDate>Thu, 18 Jun 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>The 3D avatar in chat used to drop to its knees and play a praying animation each time a new conversation loaded — and again whenever it got curious mid-chat. That jarring entrance is gone. The avatar now stays calmly in its idle pose and shows attention through subtle gaze and facial expression instead of a full-body kneel.</description>+ </item><item><title>Coin community worlds no longer get stuck on “Connecting…”</title><link>https://three.ws/changelog</link>diff --git a/public/features.json b/public/features.jsonindex 3c2e8c690..6142af23b 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-18T03:00:36.928Z",+ "generated_at": "2026-06-18T03:43:39.553Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",@@ -866,6 +866,16 @@"tags": [],"showcase": false},+ {+ "path": "/three-intel",+ "title": "$THREE Intel · Live on-chain intelligence",+ "description": "The first real utility surface for $THREE beyond price and chart: a live on-chain signal terminal powered by the Coin Intelligence Engine, live market data, and sentiment. Hold $THREE to unlock the live feed and holder narrative layer; spend $THREE for a synthesized per-token Deep Report — risk, organic-strength, distribution, and a scored read.",+ "added": "2026-06-18",+ "auth": null,+ "indexable": true,+ "tags": [],+ "showcase": false+ },{"path": "/fact-checker","title": "Fact Checker",diff --git a/public/llms-full.txt b/public/llms-full.txtindex 3e1cb2387..200938577 100644--- a/public/llms-full.txt+++ b/public/llms-full.txt@@ -524,6 +524,12 @@ URL: https://three.ws/threeHow three.ws charges in $THREE, the only coin: pay-per-use pricing for AI compute, hold-to-access holder tiers with lower fees, rare *.threews.sol names, and a holder-rewards loop. No burns — every spend funds the treasury or reflects back to holders.+### $THREE Intel · Live on-chain intelligence++URL: https://three.ws/three-intel++The first real utility surface for $THREE beyond price and chart: a live on-chain signal terminal powered by the Coin Intelligence Engine, live market data, and sentiment. Hold $THREE to unlock the live feed and holder narrative layer; spend $THREE for a synthesized per-token Deep Report — risk, organic-strength, distribution, and a scored read.+### Fact CheckerURL: https://three.ws/fact-checkerdiff --git a/public/llms.txt b/public/llms.txtindex a64807cc2..516c89bed 100644--- a/public/llms.txt+++ b/public/llms.txt@@ -108,6 +108,7 @@ On-chain features: pay-per-call, token launches, vanity wallets.- [GMGN Smart Money](https://three.ws/gmgn): Live smart-money signals narrated by a 3D AI agent. Tracks which wallets are loading on Solana, Ethereum, Base, and BNB Chain in real time.- [$THREE Live · Protocol Pulse](https://three.ws/three-live): The $THREE protocol as a living 3D organism. Real on-chain trades pulse through it in real time — each transaction emits a particle burst, whales send shockwaves, with a live trade feed and a HUD of price, market cap, holders, and volume.- [The $THREE Economy](https://three.ws/three): How three.ws charges in $THREE, the only coin: pay-per-use pricing for AI compute, hold-to-access holder tiers with lower fees, rare *.threews.sol names, and a holder-rewards loop. No burns — every spend funds the treasury or reflects back to holders.+- [$THREE Intel · Live on-chain intelligence](https://three.ws/three-intel): The first real utility surface for $THREE beyond price and chart: a live on-chain signal terminal powered by the Coin Intelligence Engine, live market data, and sentiment. Hold $THREE to unlock the live feed and holder narrative layer; spend $THREE for a synthesized per-token Deep Report — risk, organic-strength, distribution, and a scored read.- [Fact Checker](https://three.ws/fact-checker): Pay $0.10 per claim. The agent searches across authoritative sources, pays per retrieval via x402, and returns a verdict with cited evidence and a signed attestation.- [Pay-As-You-Learn Tutor](https://three.ws/tutor): Ask anything and pay a cent per answer. A pay-as-you-learn AI tutor that bills $0.01 per explanation in USDC over x402, with a live itemized session invoice and signed attestation.- [Unstoppable Agent](https://three.ws/unstoppable): Live dashboard for an autonomous agent that funds itself via x402 micropayments. Watch its balance, earnings, costs, and daily reflections in real time.diff --git a/public/sitemap/index.html b/public/sitemap/index.htmlindex 7bcf2ec13..8e22172e0 100644--- a/public/sitemap/index.html+++ b/public/sitemap/index.html@@ -65,7 +65,7 @@<main class="sm-wrap"><div class="sm-hero"><h1>Sitemap</h1>- <p>All 281 pages on three.ws, grouped by purpose. Looking for the machine-readable versions?</p>+ <p>All 282 pages on three.ws, grouped by purpose. Looking for the machine-readable versions?</p><div class="sm-formats"><a href="/sitemap.xml"><code>sitemap.xml</code> · for search engines</a><a href="/llms.txt"><code>llms.txt</code> · for AI agents</a>@@ -77,7 +77,7 @@</div><div class="sm-filter"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/></svg>- <input id="sm-filter-input" type="search" placeholder="Filter 281 pages by name, path, or description…" aria-label="Filter pages" autocomplete="off" spellcheck="false" />+ <input id="sm-filter-input" type="search" placeholder="Filter 282 pages by name, path, or description…" aria-label="Filter pages" autocomplete="off" spellcheck="false" /><kbd aria-hidden="true">/</kbd></div><p class="sm-filter-count" id="sm-filter-count" role="status" aria-live="polite"></p>@@ -487,7 +487,7 @@<section class="sm-section" id="crypto"><header>- <h2>Crypto<span class="sm-count" data-count>45</span></h2>+ <h2>Crypto<span class="sm-count" data-count>46</span></h2><p class="sm-section-desc">On-chain features: pay-per-call, token launches, vanity wallets.</p></header><ul class="sm-list">@@ -708,6 +708,13 @@<span class="sm-desc">How three.ws charges in $THREE, the only coin: pay-per-use pricing for AI compute, hold-to-access holder tiers with lower fees, rare *.threews.sol names, and a holder-rewards loop. No burns — every spend funds the treasury or reflects back to holders.</span></a></li>+ <li>+ <a href="/three-intel">+ <span class="sm-title">$THREE Intel · Live on-chain intelligence</span>+ <span class="sm-path">/three-intel</span>+ <span class="sm-desc">The first real utility surface for $THREE beyond price and chart: a live on-chain signal terminal powered by the Coin Intelligence Engine, live market data, and sentiment. Hold $THREE to unlock the live feed and holder narrative layer; spend $THREE for a synthesized per-token Deep Report — risk, organic-strength, distribution, and a scored read.</span>+ </a>+ </li><li><a href="/fact-checker"><span class="sm-title">Fact Checker</span>diff --git a/src/club.js b/src/club.jsindex e87d40373..6c9449483 100644--- a/src/club.js+++ b/src/club.js@@ -699,20 +699,32 @@ class PoleStation {* @param {Array} animationDefs* @param {import('three').Object3D} [fallback]*/- attachAvatar(template, animationDefs, fallback = null) {+ async attachAvatar(template, animationDefs, fallback = null) {+ // Each attach claims a generation token. The idle retarget is async, so a+ // later attach (a user avatar swap, say) may begin before this one's+ // fallback resolves — without this guard, the boot rig's late fallen-pose+ // fallback would detach the new rig and slam the default back on, silently+ // undoing the user's pick. A stale attach bails before mutating the scene.+ const gen = (this._attachGen = (this._attachGen || 0) + 1);+ const isStale = () => this._attachGen !== gen;+this.anim = new AnimationManager();let root = this._buildAvatarRoot(template);this.rig.add(root);this.anim.attach(root);- if (!this.anim.supportsCanonicalClips() && fallback && fallback !== template) {+ const canFallback = !!fallback && fallback !== template;+ let usedFallback = false;++ if (!this.anim.supportsCanonicalClips() && canFallback) {log.warn(`[club] dancer ${this.id} rig not drivable — falling back to default avatar`);this.anim.detach();this.rig.remove(root);root = this._buildAvatarRoot(fallback);this.rig.add(root);this.anim.attach(root);+ usedFallback = true;}this.skinned = root;@@ -720,8 +732,10 @@ class PoleStation {// Await idle so we can detect if the fallen-pose guard rejects the// retarget — in which case swap to the fallback rig rather than leave// the dancer frozen in her bind pose.- this.anim.play('idle').then((ok) => {- if (ok || !fallback || fallback === template) return;+ const ok = await this.anim.play('idle').catch(() => false);+ if (isStale()) return { ok: ok || usedFallback, usedFallback, stale: true };++ if (!ok && canFallback && !usedFallback) {log.warn(`[club] dancer ${this.id} idle retarget rejected — falling back to default avatar`);this.anim.detach();this.rig.remove(root);@@ -730,11 +744,15 @@ class PoleStation {this.anim.attach(fbRoot);this.skinned = fbRoot;this.anim.setAnimationDefs(animationDefs);- this.anim.play('idle').catch(() => {});- }).catch(() => {});+ await this.anim.play('idle').catch(() => {});+ if (isStale()) return { ok: true, usedFallback: true, stale: true };+ usedFallback = true;+ }+// Pre-load the walk clip so the first tip's walk starts immediately// without a network round-trip mid-performance.this.anim.ensureLoaded(WALK_CLIP).catch(() => {});+ return { ok: ok || usedFallback, usedFallback, stale: false };}/**@@ -749,6 +767,9 @@ class PoleStation {** @param {import('three').Object3D} template* @param {import('three').Object3D} [fallback]+ * @returns {Promise<{ ok: boolean, usedFallback: boolean, stale: boolean }>}+ * `usedFallback` true when the chosen rig couldn't be driven and the default+ * was substituted; `stale` true when a newer swap superseded this one.*/swapAvatar(template, fallback = null) {// Cancel any in-flight performance: drop to idle, resolve pending@@ -772,7 +793,7 @@ class PoleStation {this._accentTarget = 0.4;updatePoleCardStatus(this.id, 'idle');- this.attachAvatar(template, animationDefs, fallback);+ return this.attachAvatar(template, animationDefs, fallback);}get backstagePos() {@@ -1587,6 +1608,12 @@ const catalogUrls = new Set();// url → Promise<Object3D>, so a re-pick (or two poles sharing a look) loads once.const avatarTemplateCache = new Map();let fallbackTemplateRef = null;+// Catalog keys discovered at swap time to be un-driveable by the clip library:+// their rig can't be retargeted, so the dancer would freeze (or show a mismatched+// default). We learn this lazily — a GLB's drivability isn't knowable until it's+// loaded and an idle clip is retargeted onto it — then dim the tile so the same+// dead pick isn't offered again this session.+const undanceableAvatars = new Set();function registerAvatar(entry) {if (!entry?.key || !entry?.url || avatarCatalog.has(entry.key) || catalogUrls.has(entry.url)) return;@@ -1679,13 +1706,39 @@ const pickSubEl = document.getElementById('club-pick-sub');let pickerPoleId = null;function pickTile(a, currentKey) {- return `<button type="button" class="club-pick-tile${a.key === currentKey ? ' selected' : ''}" data-key="${escapeText(a.key)}" title="${escapeText(a.name)}">+ const dead = undanceableAvatars.has(a.key);+ const cls = `club-pick-tile${a.key === currentKey ? ' selected' : ''}${dead ? ' undanceable' : ''}`;+ const title = dead ? `${a.name} — this rig can't dance` : a.name;+ const badge = dead+ ? '<span class="club-pick-badge is-dead">can’t dance</span>'+ : (a.starter ? '<span class="club-pick-badge">starter</span>' : '');+ return `<button type="button" class="${cls}" data-key="${escapeText(a.key)}"${dead ? ' aria-disabled="true"' : ''} title="${escapeText(title)}"><span class="club-pick-thumb">${avatarThumbHTML(a, a.name)}</span><span class="club-pick-name">${escapeText(a.name)}</span>- ${a.starter ? '<span class="club-pick-badge">starter</span>' : ''}+ ${badge}</button>`;}+// Dim a tile in place once its rig is found un-driveable, without a full+// re-render (which would lose any in-flight spinner on a sibling tile).+function markTileUndanceable(key) {+ const tile = pickGridEl?.querySelector(`.club-pick-tile[data-key="${CSS.escape(key)}"]`);+ if (!tile) return;+ tile.classList.add('undanceable');+ tile.classList.remove('selected');+ tile.setAttribute('aria-disabled', 'true');+ const entry = avatarCatalog.get(key);+ if (entry) tile.title = `${entry.name} — this rig can't dance`;+ let badge = tile.querySelector('.club-pick-badge');+ if (!badge) {+ badge = document.createElement('span');+ badge.className = 'club-pick-badge';+ tile.appendChild(badge);+ }+ badge.textContent = 'can’t dance';+ badge.classList.add('is-dead');+}+function renderPickerGrid() {if (!pickGridEl) return;const entries = [...avatarCatalog.values()];@@ -1724,6 +1777,13 @@ if (pickerEl) {const tile = e.target.closest('.club-pick-tile');if (!tile || pickerPoleId == null) return;const key = tile.dataset.key;+ // A rig already known to be un-driveable: don't swap to a frozen pose —+ // say why and leave her on her current look.+ if (undanceableAvatars.has(key)) {+ const name = avatarCatalog.get(key)?.name || 'That avatar';+ setStatus(`${name} isn't rigged to dance — pick another.`, { kind: 'warn' });+ return;+ }if (key === currentAvatarKey(pickerPoleId)) { closePicker(); return; }pickGridEl.querySelectorAll('.club-pick-tile').forEach((t) => t.classList.remove('selected'));tile.classList.add('selected', 'busy');@@ -1735,21 +1795,55 @@ if (pickerEl) {spinner.remove();if (ok) {closePicker();- } else {+ } else if (!undanceableAvatars.has(key)) {+ // Transient load failure — flash and let them retry. A dead rig is+ // already dimmed by swapPoleAvatar, so don't also flash that case.tile.classList.add('failed');setTimeout(() => tile.classList.remove('failed'), 1500);}});}-// Load the chosen rig and hot-swap it onto the pole. Returns true on success.+// Re-apply a known-good look to a pole without the discovery/feedback wrapper —+// used to restore the previous avatar after a dead pick so the stage stays+// exactly as it was rather than stranding her on a mismatched default.+async function restorePoleAvatar(poleId, key) {+ const station = stations.find((s) => s.id === poleId);+ const entry = avatarCatalog.get(key);+ if (!station || !entry) return;+ try {+ const template = await loadAvatarTemplate(entry.url);+ await station.swapAvatar(template, fallbackTemplateRef || template);+ } catch (err) {+ log.warn(`[club] avatar restore failed for pole ${poleId}`, err);+ }+}++// Load the chosen rig and hot-swap it onto the pole. Returns true only when the+// chosen rig actually took and is dancing; false when it couldn't load, couldn't+// be driven by the clip library (prior look restored), or was superseded by a+// newer pick.async function swapPoleAvatar(poleId, key) {const station = stations.find((s) => s.id === poleId);const entry = avatarCatalog.get(key);if (!station || !entry) return false;+ const prevKey = currentAvatarKey(poleId);try {const template = await loadAvatarTemplate(entry.url);- station.swapAvatar(template, fallbackTemplateRef || template);+ const res = await station.swapAvatar(template, fallbackTemplateRef || template);+ // A newer pick already claimed the stage — let it own the outcome.+ if (res?.stale) return false;+ if (res?.usedFallback) {+ // The chosen rig isn't retargetable, so it would stand frozen and the+ // default was substituted. Don't pretend it worked: mark it dead,+ // restore the prior working look, and explain.+ undanceableAvatars.add(key);+ markTileUndanceable(key);+ if (prevKey !== key) await restorePoleAvatar(poleId, prevKey);+ const keptName = avatarCatalog.get(prevKey)?.name || dancerNameFor(poleId);+ setStatus(`${entry.name} isn't rigged to dance — kept ${keptName}.`, { kind: 'warn' });+ return false;+ }savePoleAvatar(poleId, key);refreshAvatarButton(poleId);setStatus(`${dancerNameFor(poleId)} now wearing ${entry.name}.`, { kind: 'ok' });diff --git a/src/intel-pay.js b/src/intel-pay.jsnew file mode 100644index 000000000..ca37923c4--- /dev/null+++ b/src/intel-pay.js@@ -0,0 +1,271 @@+// Pay-per-use for the $THREE Intel Deep Report — the client flow that lets anyone+// pay $THREE for one synthesized per-token dossier. Drives the same server-+// authoritative quote → sign → settle rail Forge uses (src/token-pay.js →+// /api/token/quote|settle) behind a designed status modal, then hands the settled+// { paymentId, refId } back so the caller can redeem it at /api/three-intel/deep-report.+//+// One entry point:+// import { payForDeepReport } from './intel-pay.js';+// const r = await payForDeepReport({ usd: 0.1, symbol: 'THREE' });+// if (r.ok) fetchReport({ paymentId: r.paymentId, refId: r.refId });+//+// Every state is designed: confirm, the live phases (pricing → approve → confirming+// → verifying), and the recoverable errors (no wallet, sign-in, cancelled, not+// enough $THREE → Get $THREE, settlement failure → retry). Resolves { ok:false } on+// cancel/error and { ok:true, paymentId, refId } on a verified on-chain payment.++import { payWithToken } from './token-pay.js';++const ECONOMY_URL = '/three';+const SIGN_IN_URL = '/login';+const WALLET_URL = 'https://phantom.app/';++let _stylesInjected = false;++function escapeHtml(s) {+ return String(s ?? '').replace(+ /[&<>"']/g,+ (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c],+ );+}++function clientNonce() {+ const id =+ (typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID()) ||+ `${Date.now()}-${Math.random().toString(16).slice(2)}`;+ return `intel-deep-${id}`;+}++const usdLabel = (usd) => `$${(Number(usd) || 0).toFixed(2)}`;++const PHASE_COPY = {+ quoting: 'Pricing in $THREE…',+ awaiting_signature: 'Approve the payment in your wallet…',+ confirming: 'Confirming on Solana…',+ settling: 'Verifying your payment…',+};++function classifyError(err) {+ const code = err?.code || '';+ const msg = String(err?.message || '');+ if (code === 'no_wallet' || code === 'not_connected' || code === 'no_pubkey') {+ return {+ title: 'No Solana wallet',+ detail: 'Connect a Solana wallet (Phantom) to pay in $THREE, then try again.',+ cta: { label: 'Get Phantom', href: WALLET_URL, external: true },+ };+ }+ if (code === 'unauthorized') {+ return {+ title: 'Sign in to pay',+ detail: 'Sign in to three.ws first so we can issue your $THREE payment quote.',+ cta: { label: 'Sign in', href: SIGN_IN_URL },+ };+ }+ if (/reject|denied|cancel|declin|user.*reject/i.test(msg)) {+ return {+ title: 'Payment cancelled',+ detail: 'You dismissed the wallet request — no $THREE was spent.',+ cta: { label: 'Try again', retry: true },+ };+ }+ if (code === 'insufficient_funds' || /insufficient|0x1\b|not enough|debit|exceeds.*balance/i.test(msg)) {+ return {+ title: 'Not enough $THREE',+ detail: "Your wallet doesn't hold enough $THREE for this report.",+ cta: { label: 'Get $THREE', href: ECONOMY_URL },+ };+ }+ if (code === 'price_unavailable') {+ return {+ title: 'Price feed unavailable',+ detail: 'We couldn’t price $THREE just now. Try again in a moment.',+ cta: { label: 'Try again', retry: true },+ };+ }+ return {+ title: 'Payment didn’t go through',+ detail:+ msg && msg.length < 160+ ? msg+ : 'Something interrupted the payment. Try again — no $THREE is spent unless it settles.',+ cta: { label: 'Try again', retry: true },+ };+}++function injectStyles() {+ if (_stylesInjected) return;+ _stylesInjected = true;+ const css = `+.ipay-overlay{position:fixed;inset:0;z-index:2147483000;display:grid;place-items:center;padding:20px;+ background:rgba(6,7,12,.66);backdrop-filter:blur(6px);opacity:0;transition:opacity .22s ease}+.ipay-overlay.ipay-in{opacity:1}+.ipay-modal{width:min(420px,94vw);background:linear-gradient(180deg,#15161d,#0e0f15);+ border:1px solid rgba(255,255,255,.1);border-radius:18px;padding:22px;color:#f2f3f7;+ box-shadow:0 30px 80px rgba(0,0,0,.6);transform:translateY(8px) scale(.99);transition:transform .22s ease}+.ipay-overlay.ipay-in .ipay-modal{transform:none}+.ipay-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:4px}+.ipay-title{font:600 15px/1.3 system-ui,sans-serif;letter-spacing:.2px}+.ipay-x{appearance:none;background:transparent;border:0;color:#9aa0ad;font-size:20px;line-height:1;+ cursor:pointer;padding:4px;border-radius:8px}+.ipay-x:hover{color:#fff;background:rgba(255,255,255,.07)}+.ipay-x:focus-visible{outline:2px solid #7cc4ff;outline-offset:2px}+.ipay-sub{font:400 13px/1.5 system-ui,sans-serif;color:#aeb4c2;margin:8px 0 16px}+.ipay-status{font:500 13.5px/1.5 system-ui,sans-serif;color:#cdd2dd;min-height:20px;+ display:flex;align-items:center;gap:9px;margin-bottom:14px}+.ipay-status--ok{color:#6ee7a8}+.ipay-spinner{width:15px;height:15px;border-radius:50%;border:2px solid rgba(255,255,255,.22);+ border-top-color:#7cc4ff;animation:ipay-spin .7s linear infinite;flex:0 0 auto}+@keyframes ipay-spin{to{transform:rotate(360deg)}}+.ipay-err-title{font:600 14px/1.4 system-ui,sans-serif;color:#ffb4b4;margin-bottom:5px}+.ipay-err-detail{font:400 13px/1.5 system-ui,sans-serif;color:#b9bdc8;margin-bottom:14px}+.ipay-actions{display:flex;gap:9px;flex-wrap:wrap}+.ipay-btn{appearance:none;border:0;border-radius:11px;padding:10px 16px;cursor:pointer;+ font:600 13.5px/1 system-ui,sans-serif;transition:filter .15s ease,transform .1s ease}+.ipay-btn:active{transform:translateY(1px)}+.ipay-btn:focus-visible{outline:2px solid #7cc4ff;outline-offset:2px}+.ipay-btn--primary{background:linear-gradient(180deg,#8a7bff,#6c5cf0);color:#fff}+.ipay-btn--primary:hover{filter:brightness(1.08)}+.ipay-btn--ghost{background:rgba(255,255,255,.06);color:#cdd2dd}+.ipay-btn--ghost:hover{background:rgba(255,255,255,.11)}+@media (prefers-reduced-motion:reduce){.ipay-overlay,.ipay-modal,.ipay-spinner{transition:none;animation:none}}`;+ const style = document.createElement('style');+ style.setAttribute('data-intel-pay', '');+ style.textContent = css;+ document.head.appendChild(style);+}++/**+ * Run the pay-per-use flow for one Intel Deep Report.+ * @param {{ usd:number, symbol?:string }} params+ * @returns {Promise<{ ok:true, paymentId:string, refId:string } | { ok:false, cancelled?:boolean }>}+ */+export function payForDeepReport({ usd, symbol = '' }) {+ injectStyles();+ return new Promise((resolve) => {+ const refId = clientNonce();+ let settled = false;++ const overlay = document.createElement('div');+ overlay.className = 'ipay-overlay';+ overlay.setAttribute('role', 'dialog');+ overlay.setAttribute('aria-modal', 'true');+ overlay.setAttribute('aria-label', 'Pay for a Deep Report in $THREE');+ const subj = symbol ? `${escapeHtml(symbol)} ` : '';+ overlay.innerHTML = `+<div class="ipay-modal">+ <div class="ipay-head">+ <div class="ipay-title">Deep Report</div>+ <button type="button" class="ipay-x" data-ipay-x aria-label="Close">×</button>+ </div>+ <div class="ipay-sub">A synthesized ${subj}dossier: on-chain signals, live market, sentiment, and a scored read — paid once in $THREE.</div>+ <div class="ipay-status"></div>+ <div class="ipay-actions"></div>+</div>`;+ document.body.appendChild(overlay);++ const statusEl = overlay.querySelector('.ipay-status');+ const actionsEl = overlay.querySelector('.ipay-actions');++ const cleanup = () => {+ if (overlay._onKey) document.removeEventListener('keydown', overlay._onKey);+ overlay.classList.remove('ipay-in');+ const remove = () => overlay.remove();+ overlay.addEventListener('transitionend', remove, { once: true });+ setTimeout(remove, 280);+ };+ const finish = (result) => {+ if (overlay._done) return;+ overlay._done = true;+ cleanup();+ resolve(result);+ };+ const close = () => finish({ ok: false, cancelled: true });++ function showStatus(text, { busy = false, ok = false } = {}) {+ statusEl.className = 'ipay-status' + (ok ? ' ipay-status--ok' : '');+ statusEl.innerHTML = busy+ ? `<span class="ipay-spinner" aria-hidden="true"></span><span>${escapeHtml(text)}</span>`+ : escapeHtml(text);+ }++ function showConfirm() {+ showStatus(`One Deep Report for ${symbol ? escapeHtml(symbol) : 'this token'}, paid in $THREE.`);+ actionsEl.innerHTML =+ `<button type="button" class="ipay-btn ipay-btn--primary" data-ipay-pay>Pay ${usdLabel(usd)}</button>` ++ `<button type="button" class="ipay-btn ipay-btn--ghost" data-ipay-cancel>Cancel</button>`;+ actionsEl.querySelector('[data-ipay-pay]').addEventListener('click', startPayment);+ actionsEl.querySelector('[data-ipay-cancel]').addEventListener('click', close);+ actionsEl.querySelector('[data-ipay-pay]').focus();+ }++ function showError(err) {+ const { title, detail, cta } = classifyError(err);+ statusEl.className = 'ipay-status';+ statusEl.innerHTML = `<div><div class="ipay-err-title">${escapeHtml(title)}</div><div class="ipay-err-detail">${escapeHtml(detail)}</div></div>`;+ actionsEl.innerHTML = '';+ if (cta?.retry) {+ const b = document.createElement('button');+ b.className = 'ipay-btn ipay-btn--primary';+ b.textContent = cta.label;+ b.addEventListener('click', showConfirm);+ actionsEl.appendChild(b);+ } else if (cta?.href) {+ const a = document.createElement('a');+ a.className = 'ipay-btn ipay-btn--primary';+ a.textContent = cta.label;+ a.href = cta.href;+ if (cta.external) {+ a.target = '_blank';+ a.rel = 'noopener';+ }+ actionsEl.appendChild(a);+ }+ const cancel = document.createElement('button');+ cancel.className = 'ipay-btn ipay-btn--ghost';+ cancel.textContent = 'Close';+ cancel.addEventListener('click', close);+ actionsEl.appendChild(cancel);+ }++ async function startPayment() {+ actionsEl.innerHTML = '';+ showStatus(PHASE_COPY.quoting, { busy: true });+ try {+ const result = await payWithToken({+ purpose: 'consumption',+ usd,+ refType: 'intel',+ refId,+ onStatus: (phase) => showStatus(PHASE_COPY[phase] || 'Working…', { busy: true }),+ });+ if (!result?.ok || !result.payment_id) {+ throw Object.assign(new Error('Payment could not be verified.'), {+ code: 'verification_failed',+ });+ }+ settled = true;+ showStatus('Payment confirmed — building your report…', { ok: true });+ setTimeout(() => finish({ ok: true, paymentId: result.payment_id, refId }), 700);+ } catch (err) {+ if (settled) return;+ showError(err);+ }+ }++ overlay.addEventListener('click', (e) => {+ if (e.target === overlay) close();+ });+ overlay.querySelector('[data-ipay-x]').addEventListener('click', close);+ const onKey = (e) => {+ if (e.key === 'Escape') close();+ };+ overlay._onKey = onKey;+ document.addEventListener('keydown', onKey);++ requestAnimationFrame(() => {+ overlay.classList.add('ipay-in');+ showConfirm();+ });+ });+}diff --git a/src/runtime/animation-slots.js b/src/runtime/animation-slots.jsindex 3d862b0a4..2e5d28b00 100644--- a/src/runtime/animation-slots.js+++ b/src/runtime/animation-slots.js@@ -22,7 +22,12 @@ export const DEFAULT_ANIMATION_MAP = {wave: 'reaction',nod: 'reaction',shake: 'angry',- think: 'pray',+ // Thinking/curiosity is a calm state, not a full-body action. The previous+ // 'pray' clip knelt the avatar to the ground, which read as the character+ // being dropped in (and praying) every time it loaded — the first-encounter+ // curiosity burst fires this slot on every fresh mount. Map it to a no-op+ // idle so curiosity is conveyed by gaze + facial morphs, never a kneel.+ think: 'idle',celebrate: 'celebrate',concern: 'defeated',bow: 'sitclap',diff --git a/src/three-economy.js b/src/three-economy.jsindex 9c7e543d1..ff0d1ee6b 100644--- a/src/three-economy.js+++ b/src/three-economy.js@@ -314,6 +314,11 @@ function injectStyles() {.ta-why { display:block; font-size:12px; color:var(--muted-2); margin-top:3px; line-height:1.45; }.ta-row-status { display:flex; align-items:center; gap:10px; flex-shrink:0; }.ta-ppu { font-size:12px; color:var(--muted-2); white-space:nowrap; font-variant-numeric:tabular-nums; }+ .ta-open { font-size:12px; font-weight:700; color:var(--blue,#7cc4ff); text-decoration:none; white-space:nowrap;+ padding:5px 10px; border-radius:999px; border:1px solid rgba(124,196,255,.28); background:rgba(124,196,255,.08);+ transition:background .15s ease; }+ .ta-open:hover { background:rgba(124,196,255,.16); }+ .ta-open:focus-visible { outline:2px solid var(--blue,#7cc4ff); outline-offset:2px; }.ta-pill { display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:700; border-radius:999px;padding:5px 11px; white-space:nowrap; }.ta-pill--ok { color:var(--green); background:rgba(110,231,168,.1); border:1px solid rgba(110,231,168,.26); }@@ -835,12 +840,25 @@ function accessRowHTML(f) {? `<span class="ta-why">${esc(f.why)}</span>`: '';const cls = !enforced ? ' ta-row--planned' : ok ? ' ta-row--ok' : '';+ // A live, reachable surface gets an "Open" link so an unlocked perk is one click+ // from being used — the matrix isn't just a status board, it's a launchpad.+ const open =+ enforced && ok && FEATURE_LINKS[f.feature]+ ? `<a class="ta-open" href="${esc(FEATURE_LINKS[f.feature])}">Open →</a>`+ : '';return `<li class="ta-row${cls}"><div class="ta-row-info"><span class="ta-row-label">${esc(f.label)}</span>${sub}</div>- <div class="ta-row-status">${pill}${ppu}</div>+ <div class="ta-row-status">${pill}${ppu}${open}</div></li>`;}+// Gated features that point at a real, usable surface. When a holder has unlocked+// one, the access matrix links straight to it.+const FEATURE_LINKS = Object.freeze({+ 'forge.high': '/forge',+ 'intel.terminal': '/three-intel',+});+// The populated matrix: a current-tier chip + how many ENFORCED features it unlocks// (planned perks are counted separately, never as "unlocked"), then one real list row// per gated feature. A signed-in user with no linked wallet is read as Member and tolddiff --git a/src/three-intel.css b/src/three-intel.cssnew file mode 100644index 000000000..c4e3a3ba6--- /dev/null+++ b/src/three-intel.css@@ -0,0 +1,426 @@+/* $THREE Intel terminal — premium, dark, signal-dense. Scoped to .ti- classes. */++.ti-root {+ --ti-bg: #0a0b10;+ --ti-panel: #12131b;+ --ti-panel-2: #0e0f16;+ --ti-line: rgba(255, 255, 255, 0.08);+ --ti-line-strong: rgba(255, 255, 255, 0.14);+ --ti-text: #f2f3f7;+ --ti-dim: #aeb4c2;+ --ti-faint: #7c8294;+ --ti-violet: #8a7bff;+ --ti-blue: #7cc4ff;+ --ti-green: #6ee7a8;+ --ti-gold: #f5c451;+ --ti-red: #ff8a8a;+ --ti-radius: 16px;+ color: var(--ti-text);+ background:+ radial-gradient(1200px 600px at 80% -10%, rgba(138, 123, 255, 0.1), transparent 60%),+ radial-gradient(900px 500px at -10% 10%, rgba(124, 196, 255, 0.07), transparent 55%),+ var(--ti-bg);+ min-height: 100vh;+ font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;+}++.ti-wrap {+ max-width: 1160px;+ margin: 0 auto;+ padding: 22px 20px 80px;+}++/* ── Top bar ─────────────────────────────────────────────────────────────── */+.ti-top {+ display: flex;+ align-items: center;+ gap: 16px;+ flex-wrap: wrap;+ padding-bottom: 18px;+ border-bottom: 1px solid var(--ti-line);+}+.ti-brand {+ display: flex;+ flex-direction: column;+ gap: 2px;+ margin-right: auto;+}+.ti-brand a { text-decoration: none; color: inherit; }+.ti-brand-title {+ font-size: 19px;+ font-weight: 700;+ letter-spacing: 0.2px;+ display: flex;+ align-items: center;+ gap: 9px;+}+.ti-dot {+ width: 8px;+ height: 8px;+ border-radius: 50%;+ background: var(--ti-green);+ box-shadow: 0 0 0 0 rgba(110, 231, 168, 0.6);+ animation: ti-pulse 2.4s ease-out infinite;+}+@keyframes ti-pulse {+ 0% { box-shadow: 0 0 0 0 rgba(110, 231, 168, 0.5); }+ 70% { box-shadow: 0 0 0 7px rgba(110, 231, 168, 0); }+ 100% { box-shadow: 0 0 0 0 rgba(110, 231, 168, 0); }+}+.ti-brand-sub { font-size: 12.5px; color: var(--ti-faint); }++.ti-ticker {+ display: flex;+ align-items: center;+ gap: 8px;+ padding: 7px 12px;+ background: var(--ti-panel);+ border: 1px solid var(--ti-line);+ border-radius: 12px;+ font-size: 13px;+}+.ti-ticker b { color: var(--ti-text); }+.ti-ticker .ti-chg-pos { color: var(--ti-green); }+.ti-ticker .ti-chg-neg { color: var(--ti-red); }++.ti-badge-slot { display: inline-flex; }+.ti-connect {+ appearance: none;+ border: 1px solid var(--ti-line-strong);+ background: rgba(255, 255, 255, 0.04);+ color: var(--ti-text);+ border-radius: 12px;+ padding: 8px 14px;+ font-size: 13px;+ font-weight: 600;+ cursor: pointer;+ transition: background 0.15s ease, transform 0.1s ease;+}+.ti-connect:hover { background: rgba(255, 255, 255, 0.09); }+.ti-connect:active { transform: translateY(1px); }+.ti-connect:focus-visible { outline: 2px solid var(--ti-blue); outline-offset: 2px; }++/* ── Layout ──────────────────────────────────────────────────────────────── */+.ti-grid {+ display: grid;+ grid-template-columns: 1fr 360px;+ gap: 20px;+ margin-top: 20px;+ align-items: start;+}+@media (max-width: 900px) {+ .ti-grid { grid-template-columns: 1fr; }+ .ti-aside { order: -1; }+}++.ti-panel {+ background: linear-gradient(180deg, var(--ti-panel), var(--ti-panel-2));+ border: 1px solid var(--ti-line);+ border-radius: var(--ti-radius);+ overflow: hidden;+}+.ti-panel-head {+ display: flex;+ align-items: center;+ gap: 10px;+ padding: 15px 16px;+ border-bottom: 1px solid var(--ti-line);+}+.ti-panel-head h2 {+ font-size: 14px;+ font-weight: 650;+ margin: 0;+ letter-spacing: 0.2px;+}+.ti-panel-head .ti-spacer { margin-left: auto; }++.ti-status-pill {+ font-size: 11px;+ font-weight: 700;+ letter-spacing: 0.4px;+ text-transform: uppercase;+ padding: 4px 9px;+ border-radius: 999px;+ display: inline-flex;+ align-items: center;+ gap: 6px;+}+.ti-status-pill.live { color: var(--ti-green); background: rgba(110, 231, 168, 0.12); }+.ti-status-pill.delayed { color: var(--ti-gold); background: rgba(245, 196, 81, 0.12); }++.ti-select {+ appearance: none;+ background: rgba(255, 255, 255, 0.05);+ border: 1px solid var(--ti-line);+ color: var(--ti-dim);+ border-radius: 9px;+ padding: 6px 28px 6px 10px;+ font-size: 12.5px;+ cursor: pointer;+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23aeb4c2' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");+ background-repeat: no-repeat;+ background-position: right 9px center;+}+.ti-select:focus-visible { outline: 2px solid var(--ti-blue); outline-offset: 1px; }++/* ── Delayed / unlock banner ─────────────────────────────────────────────── */+.ti-unlock {+ margin: 14px 16px 0;+ padding: 13px 15px;+ display: flex;+ align-items: center;+ gap: 12px;+ background: linear-gradient(180deg, rgba(245, 196, 81, 0.08), rgba(245, 196, 81, 0.03));+ border: 1px solid rgba(245, 196, 81, 0.22);+ border-radius: 12px;+ flex-wrap: wrap;+}+.ti-unlock-txt { font-size: 12.8px; color: var(--ti-dim); line-height: 1.5; flex: 1 1 220px; }+.ti-unlock-txt b { color: var(--ti-gold); }+.ti-cta {+ appearance: none;+ text-decoration: none;+ border: 0;+ border-radius: 10px;+ padding: 8px 14px;+ font-size: 12.5px;+ font-weight: 700;+ cursor: pointer;+ white-space: nowrap;+ transition: filter 0.15s ease, transform 0.1s ease;+}+.ti-cta:active { transform: translateY(1px); }+.ti-cta:focus-visible { outline: 2px solid var(--ti-blue); outline-offset: 2px; }+.ti-cta--gold { background: linear-gradient(180deg, #ffd970, #f5c451); color: #2a2204; }+.ti-cta--violet { background: linear-gradient(180deg, #8a7bff, #6c5cf0); color: #fff; }+.ti-cta--ghost { background: rgba(255, 255, 255, 0.06); color: var(--ti-text); }+.ti-cta--gold:hover, .ti-cta--violet:hover, .ti-cta--ghost:hover { filter: brightness(1.08); }++/* ── Feed list ───────────────────────────────────────────────────────────── */+.ti-feed { padding: 8px; display: flex; flex-direction: column; gap: 7px; }+.ti-row {+ display: grid;+ grid-template-columns: 38px 1fr auto;+ gap: 12px;+ align-items: center;+ padding: 11px 12px;+ border: 1px solid transparent;+ border-radius: 12px;+ transition: background 0.15s ease, border-color 0.15s ease;+}+.ti-row:hover { background: rgba(255, 255, 255, 0.035); border-color: var(--ti-line); }+.ti-av {+ width: 38px;+ height: 38px;+ border-radius: 10px;+ object-fit: cover;+ background: #1b1d27;+ border: 1px solid var(--ti-line);+}+.ti-row-main { min-width: 0; }+.ti-row-top { display: flex; align-items: center; gap: 8px; }+.ti-sym { font-weight: 700; font-size: 13.5px; }+.ti-name { font-size: 12px; color: var(--ti-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }+.ti-chips { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }+.ti-chip {+ font-size: 10.5px;+ font-weight: 600;+ padding: 3px 7px;+ border-radius: 7px;+ background: rgba(255, 255, 255, 0.05);+ color: var(--ti-dim);+ border: 1px solid var(--ti-line);+ white-space: nowrap;+}+.ti-chip.warn { color: var(--ti-gold); border-color: rgba(245, 196, 81, 0.3); background: rgba(245, 196, 81, 0.08); }+.ti-chip.bad { color: var(--ti-red); border-color: rgba(255, 138, 138, 0.3); background: rgba(255, 138, 138, 0.08); }+.ti-chip.good { color: var(--ti-green); border-color: rgba(110, 231, 168, 0.3); background: rgba(110, 231, 168, 0.08); }++.ti-row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }+.ti-verdict {+ font-size: 11px;+ font-weight: 800;+ letter-spacing: 0.3px;+ padding: 4px 9px;+ border-radius: 999px;+ text-transform: uppercase;+}+.ti-verdict.organic { color: var(--ti-green); background: rgba(110, 231, 168, 0.13); }+.ti-verdict.mixed { color: var(--ti-blue); background: rgba(124, 196, 255, 0.12); }+.ti-verdict.caution { color: var(--ti-gold); background: rgba(245, 196, 81, 0.13); }+.ti-verdict.high_risk { color: var(--ti-red); background: rgba(255, 138, 138, 0.13); }+.ti-row-actions { display: flex; gap: 6px; }+.ti-mini {+ appearance: none;+ border: 1px solid var(--ti-line-strong);+ background: rgba(255, 255, 255, 0.04);+ color: var(--ti-dim);+ border-radius: 8px;+ padding: 5px 9px;+ font-size: 11.5px;+ font-weight: 600;+ cursor: pointer;+ transition: background 0.15s ease, color 0.15s ease;+}+.ti-mini:hover { background: rgba(255, 255, 255, 0.09); color: var(--ti-text); }+.ti-mini:focus-visible { outline: 2px solid var(--ti-blue); outline-offset: 1px; }+.ti-mini.violet { border-color: rgba(138, 123, 255, 0.4); color: #b9b0ff; }++/* ── Scanner / aside ─────────────────────────────────────────────────────── */+.ti-aside { display: flex; flex-direction: column; gap: 20px; }+.ti-scan-form { padding: 14px 16px; display: flex; gap: 8px; }+.ti-input {+ flex: 1;+ min-width: 0;+ background: rgba(255, 255, 255, 0.04);+ border: 1px solid var(--ti-line);+ color: var(--ti-text);+ border-radius: 10px;+ padding: 9px 11px;+ font-size: 12.5px;+ font-family: ui-monospace, 'SF Mono', Menlo, monospace;+}+.ti-input::placeholder { color: var(--ti-faint); }+.ti-input:focus-visible { outline: 2px solid var(--ti-blue); outline-offset: 1px; }++.ti-scan-body { padding: 0 16px 16px; }+.ti-scan-empty, .ti-feed-empty {+ padding: 28px 16px;+ text-align: center;+ color: var(--ti-faint);+ font-size: 12.8px;+ line-height: 1.6;+}+.ti-scan-empty b, .ti-feed-empty b { color: var(--ti-dim); display: block; margin-bottom: 4px; font-size: 13.5px; }++.ti-scan-card { display: flex; flex-direction: column; gap: 13px; }+.ti-scan-head { display: flex; align-items: center; gap: 10px; }+.ti-scan-head img { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--ti-line); }+.ti-scan-head .s { font-weight: 700; font-size: 14px; }+.ti-scan-head .n { font-size: 11.5px; color: var(--ti-faint); }++.ti-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }+.ti-metric { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--ti-line); border-radius: 10px; padding: 9px 11px; }+.ti-metric .k { font-size: 10.5px; color: var(--ti-faint); text-transform: uppercase; letter-spacing: 0.4px; }+.ti-metric .v { font-size: 14px; font-weight: 700; margin-top: 2px; }+.ti-metric .v.pos { color: var(--ti-green); }+.ti-metric .v.neg { color: var(--ti-red); }++.ti-gauge { display: flex; flex-direction: column; gap: 5px; }+.ti-gauge-row { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ti-dim); }+.ti-bar { height: 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }+.ti-bar > i { display: block; height: 100%; border-radius: 999px; transition: width 0.5s ease; }+.ti-bar.risk > i { background: linear-gradient(90deg, var(--ti-green), var(--ti-gold), var(--ti-red)); }+.ti-bar.org > i { background: linear-gradient(90deg, #3a3f4d, var(--ti-green)); }++.ti-reasons { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }+.ti-reasons li {+ font-size: 12px;+ color: var(--ti-dim);+ line-height: 1.45;+ padding-left: 16px;+ position: relative;+}+.ti-reasons li::before { content: '›'; position: absolute; left: 2px; color: var(--ti-violet); font-weight: 700; }++.ti-narr-item { padding: 10px 0; border-bottom: 1px solid var(--ti-line); }+.ti-narr-item:last-child { border-bottom: 0; }+.ti-narr-item .t { font-size: 12.5px; color: var(--ti-text); line-height: 1.45; }+.ti-narr-item .m { font-size: 11px; color: var(--ti-faint); margin-top: 3px; }++/* ── Skeletons ───────────────────────────────────────────────────────────── */+.ti-sk { background: rgba(255, 255, 255, 0.04); border-radius: 8px; position: relative; overflow: hidden; }+.ti-sk::after {+ content: '';+ position: absolute;+ inset: 0;+ transform: translateX(-100%);+ background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);+ animation: ti-shimmer 1.3s infinite;+}+@keyframes ti-shimmer { 100% { transform: translateX(100%); } }+.ti-sk-row { display: grid; grid-template-columns: 38px 1fr 60px; gap: 12px; padding: 11px 12px; align-items: center; }+.ti-sk-av { width: 38px; height: 38px; border-radius: 10px; }+.ti-sk-line { height: 11px; }++.ti-error {+ padding: 22px 16px;+ text-align: center;+ color: var(--ti-dim);+ font-size: 12.8px;+}+.ti-error b { color: var(--ti-red); display: block; margin-bottom: 6px; }++.ti-foot {+ margin-top: 26px;+ text-align: center;+ font-size: 11.5px;+ color: var(--ti-faint);+ line-height: 1.6;+}+.ti-foot a { color: var(--ti-dim); }++/* ── Deep report dossier (modal) ─────────────────────────────────────────── */+.ti-dossier-overlay {+ position: fixed;+ inset: 0;+ z-index: 2147482000;+ display: grid;+ place-items: center;+ padding: 20px;+ background: rgba(6, 7, 12, 0.7);+ backdrop-filter: blur(7px);+ opacity: 0;+ transition: opacity 0.22s ease;+ overflow: auto;+}+.ti-dossier-overlay.in { opacity: 1; }+.ti-dossier {+ width: min(560px, 96vw);+ max-height: 90vh;+ overflow: auto;+ background: linear-gradient(180deg, #14151d, #0d0e14);+ border: 1px solid var(--ti-line-strong);+ border-radius: 18px;+ padding: 22px;+ box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);+}+.ti-dossier h3 { margin: 0 0 2px; font-size: 16px; }+.ti-dossier .sc { font-size: 12px; color: var(--ti-faint); margin-bottom: 16px; }+.ti-score-wrap { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }+.ti-score-ring {+ width: 72px;+ height: 72px;+ border-radius: 50%;+ display: grid;+ place-items: center;+ font-size: 22px;+ font-weight: 800;+ flex: 0 0 auto;+}+.ti-stance { font-size: 14px; font-weight: 700; }+.ti-stance-sub { font-size: 12px; color: var(--ti-dim); margin-top: 3px; line-height: 1.4; }+.ti-sec { margin-top: 16px; }+.ti-sec h4 {+ font-size: 11px;+ text-transform: uppercase;+ letter-spacing: 0.5px;+ color: var(--ti-faint);+ margin: 0 0 8px;+}+.ti-dossier-x {+ float: right;+ appearance: none;+ background: transparent;+ border: 0;+ color: var(--ti-faint);+ font-size: 22px;+ cursor: pointer;+ line-height: 1;+}+.ti-dossier-x:hover { color: #fff; }+.ti-disc { font-size: 10.5px; color: var(--ti-faint); margin-top: 18px; line-height: 1.5; border-top: 1px solid var(--ti-line); padding-top: 12px; }++@media (prefers-reduced-motion: reduce) {+ .ti-dot, .ti-sk::after, .ti-dossier-overlay, .ti-bar > i { animation: none; transition: none; }+}diff --git a/src/three-intel.js b/src/three-intel.jsnew file mode 100644index 000000000..c31e54445--- /dev/null+++ b/src/three-intel.js@@ -0,0 +1,521 @@+// $THREE Intel (/three-intel) — the live on-chain intelligence terminal.+//+// The first real *use* of $THREE beyond Forge: holding the coin unlocks the live+// signal feed; spending it buys a synthesized per-token Deep Report. This module+// is the page: a live radar feed (server-gated live vs 30-min-delayed by holder+// tier), a free per-token scanner, a holder-only narrative panel (aixbt), and the+// pay-per-use Deep Report. Every datum is real — the feed is the Coin Intelligence+// Engine's on-chain observations, market is the shared keyless market module, and+// sentiment is live pump.fun commentary. Every state is designed.+//+// Identity reuses the platform's shared wallet/tier plumbing (the hidden global+// connect button + the tier pass), so a connected holder is recognized here+// exactly as in the nav and Forge — one source of truth.++import './three-intel.css';+import { createThreeTokenData } from './pump/three-token-data.js';+import { initWalletButton, getConnectedWalletAddress } from './wallet.js';+import { mountTierBadge, attachTierPass, primeTierPass, getTierPass } from './three-access.js';+import { payForDeepReport } from './intel-pay.js';++const FEED_URL = '/api/three-intel/feed';+const TOKEN_URL = '/api/three-intel/token';+const REPORT_URL = '/api/three-intel/deep-report';+const ECONOMY_URL = '/three';+const THREE_MINT_DEFAULT = 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump';+const JUPITER_URL = `https://jup.ag/swap/SOL-${THREE_MINT_DEFAULT}`;++// ── formatters ──────────────────────────────────────────────────────────────+const esc = (s) =>+ String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));+const fmtUsd = (n, max = 2) => {+ const v = Number(n);+ if (!Number.isFinite(v)) return '—';+ return v.toLocaleString('en-US', { style: 'currency', currency: 'USD', maximumFractionDigits: v !== 0 && Math.abs(v) < 1 ? 6 : max });+};+const fmtCompact = (n) => {+ const v = Number(n);+ if (!Number.isFinite(v)) return '—';+ if (Math.abs(v) >= 1e9) return `$${(v / 1e9).toFixed(2)}B`;+ if (Math.abs(v) >= 1e6) return `$${(v / 1e6).toFixed(2)}M`;+ if (Math.abs(v) >= 1e3) return `$${(v / 1e3).toFixed(1)}K`;+ return fmtUsd(v);+};+const fmtPct = (n) => {+ const v = Number(n);+ if (!Number.isFinite(v)) return '';+ return `${v >= 0 ? '+' : ''}${v.toFixed(2)}%`;+};+function timeAgo(ts) {+ const t = new Date(ts).getTime();+ if (!Number.isFinite(t)) return '';+ const s = Math.max(0, (Date.now() - t) / 1000);+ if (s < 60) return `${Math.floor(s)}s ago`;+ if (s < 3600) return `${Math.floor(s / 60)}m ago`;+ if (s < 86400) return `${Math.floor(s / 3600)}h ago`;+ return `${Math.floor(s / 86400)}d ago`;+}+const pct100 = (v) => {+ const n = Number(v);+ if (!Number.isFinite(n) || n <= 0) return 0;+ return n <= 1 ? Math.round(n * 100) : Math.min(100, Math.round(n));+};+const scoreColor = (s) => (s >= 66 ? '#6ee7a8' : s <= 38 ? '#ff8a8a' : '#f5c451');++// authed fetch — carries the cached holder tier pass (so a connected holder gets+// the live feed) and the session cookie.+function intelFetch(url, opts = {}) {+ const headers = attachTierPass({ ...(opts.headers || {}) });+ return fetch(url, { credentials: 'include', ...opts, headers });+}++// ── signal chips ──────────────────────────────────────────────────────────────+function signalChips(row) {+ const chips = [];+ const bundle = pct100(row.bundle_score);+ const organic = pct100(row.organic_score);+ const conc = pct100(row.concentration_top10);+ if (Number.isFinite(Number(row.quality_score))) chips.push(`<span class="ti-chip">Q ${Math.round(Number(row.quality_score))}</span>`);+ if (organic >= 55) chips.push(`<span class="ti-chip good">Organic ${organic}%</span>`);+ if (bundle >= 45) chips.push(`<span class="ti-chip warn">Bundle ${bundle}%</span>`);+ if (conc >= 50) chips.push(`<span class="ti-chip warn">Top10 ${conc}%</span>`);+ if (row.dev_sold) chips.push('<span class="ti-chip bad">Dev sold</span>');+ for (const f of (row.risk_flags || []).slice(0, 2)) chips.push(`<span class="ti-chip bad">${esc(String(f).replace(/_/g, ' '))}</span>`);+ if (row.category) chips.push(`<span class="ti-chip">${esc(row.category)}</span>`);+ return chips.join('');+}++function coinRow(row) {+ const a = row.assessment || {};+ const img = row.image_uri+ ? `<img class="ti-av" src="${esc(row.image_uri)}" alt="" loading="lazy" onerror="this.style.visibility='hidden'">`+ : '<div class="ti-av"></div>';+ return `+<div class="ti-row" data-mint="${esc(row.mint)}" data-sym="${esc(row.symbol || '')}">+ ${img}+ <div class="ti-row-main">+ <div class="ti-row-top">+ <span class="ti-sym">${esc(row.symbol || row.mint.slice(0, 4))}</span>+ <span class="ti-name">${esc(row.name || '')}${row.first_seen_at ? ' · ' + timeAgo(row.first_seen_at) : ''}</span>+ </div>+ <div class="ti-chips">${signalChips(row)}</div>+ </div>+ <div class="ti-row-end">+ ${a.verdict ? `<span class="ti-verdict ${esc(a.verdict)}">${esc(a.verdictLabel)}</span>` : ''}+ <div class="ti-row-actions">+ <button class="ti-mini" data-scan="${esc(row.mint)}">Scan</button>+ <button class="ti-mini violet" data-report="${esc(row.mint)}" data-rsym="${esc(row.symbol || '')}">Report</button>+ </div>+ </div>+</div>`;+}++function skeletonRows(n = 6) {+ return Array.from({ length: n })+ .map(+ () => `<div class="ti-sk-row"><div class="ti-sk ti-sk-av"></div>+ <div><div class="ti-sk ti-sk-line" style="width:42%"></div><div class="ti-sk ti-sk-line" style="width:70%;margin-top:8px"></div></div>+ <div class="ti-sk ti-sk-line" style="width:54px;height:18px"></div></div>`,+ )+ .join('');+}++// ── feed ──────────────────────────────────────────────────────────────────────+let _lastMinQuality = '';++async function loadFeed() {+ const feedEl = document.getElementById('ti-feed');+ const headEl = document.getElementById('ti-feed-status');+ const unlockEl = document.getElementById('ti-unlock');+ if (!feedEl) return;+ feedEl.innerHTML = skeletonRows();+ try {+ const qs = _lastMinQuality ? `?min_quality=${encodeURIComponent(_lastMinQuality)}` : '';+ const r = await intelFetch(`${FEED_URL}${qs}`);+ const data = await r.json();+ if (!r.ok || !data?.ok) throw new Error(data?.message || `feed ${r.status}`);+ renderFeed(data, { feedEl, headEl, unlockEl });+ renderNarrative(data);+ } catch {+ feedEl.innerHTML = `<div class="ti-error"><b>Couldn't load the feed</b>The intelligence feed is unreachable right now. <button class="ti-mini" id="ti-feed-retry">Retry</button></div>`;+ document.getElementById('ti-feed-retry')?.addEventListener('click', loadFeed);+ }+}++function renderFeed(data, { feedEl, headEl, unlockEl }) {+ const acc = data.access || {};+ if (headEl) {+ headEl.className = `ti-status-pill ${acc.eligible ? 'live' : 'delayed'}`;+ headEl.innerHTML = acc.eligible+ ? '<span class="ti-dot"></span>Live'+ : `Delayed ${acc.delay_minutes || 30}m`;+ }+ // Unlock banner for non-holders.+ if (unlockEl) {+ if (acc.eligible) {+ unlockEl.hidden = true;+ unlockEl.innerHTML = '';+ } else {+ unlockEl.hidden = false;+ const hasWallet = Boolean(getConnectedWalletAddress());+ unlockEl.innerHTML = `+ <div class="ti-unlock-txt">You're seeing signals on a <b>${acc.delay_minutes || 30}-minute delay</b>. Hold $THREE (Bronze+) to unlock the <b>live</b> feed and the holder narrative layer.</div>+ <a class="ti-cta ti-cta--gold" href="${JUPITER_URL}" target="_blank" rel="noopener">Get $THREE</a>+ ${hasWallet ? '<button class="ti-cta ti-cta--ghost" id="ti-verify">I hold — verify</button>' : `<a class="ti-cta ti-cta--ghost" href="${ECONOMY_URL}">Tiers</a>`}`;+ document.getElementById('ti-verify')?.addEventListener('click', async (e) => {+ const btn = e.currentTarget;+ btn.textContent = 'Verifying…';+ btn.disabled = true;+ try {+ await getTierPass({ interactive: true });+ } catch {+ /* user may cancel the signature — fall through to reload */+ }+ loadFeed();+ });+ }+ }+ if (!data.feed || data.feed.length === 0) {+ feedEl.innerHTML = `<div class="ti-feed-empty"><b>No coins in the window yet</b>The intelligence engine surfaces coins as they're observed on-chain. Check back in a moment, or scan a specific mint on the right.</div>`;+ return;+ }+ feedEl.innerHTML = data.feed.map(coinRow).join('');+ feedEl.querySelectorAll('[data-scan]').forEach((b) =>+ b.addEventListener('click', () => runScan(b.getAttribute('data-scan'))),+ );+ feedEl.querySelectorAll('[data-report]').forEach((b) =>+ b.addEventListener('click', () => runDeepReport(b.getAttribute('data-report'), b.getAttribute('data-rsym'))),+ );+}++function renderNarrative(data) {+ const panel = document.getElementById('ti-narrative-panel');+ const body = document.getElementById('ti-narrative');+ if (!panel || !body) return;+ const items = data.narrative_intel;+ if (!data.access?.eligible) {+ panel.hidden = false;+ body.innerHTML = `<div class="ti-scan-empty">Narrative intelligence is a <b>holder</b> layer. Hold $THREE to see the live narrative feed alongside the signals.</div>`;+ return;+ }+ if (!data.aixbt_enabled) {+ panel.hidden = true; // no narrative source configured — hide rather than show an empty promise+ return;+ }+ panel.hidden = false;+ if (!Array.isArray(items) || items.length === 0) {+ body.innerHTML = `<div class="ti-scan-empty">No fresh narrative items right now.</div>`;+ return;+ }+ body.innerHTML = items+ .slice(0, 6)+ .map((it) => {+ const title = it.title || it.headline || it.summary || it.text || 'Intel';+ const meta = [it.category, it.chain, it.created_at ? timeAgo(it.created_at) : '']+ .filter(Boolean)+ .join(' · ');+ return `<div class="ti-narr-item"><div class="t">${esc(String(title).slice(0, 180))}</div>${meta ? `<div class="m">${esc(meta)}</div>` : ''}</div>`;+ })+ .join('');+}++// ── scanner ─────────────────────────────────────────────────────────────────+const MINT_RE = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;++async function runScan(mint) {+ const body = document.getElementById('ti-scan-body');+ const input = document.getElementById('ti-scan-input');+ if (input && mint) input.value = mint;+ if (!body) return;+ mint = String(mint || '').trim();+ if (!MINT_RE.test(mint)) {+ body.innerHTML = `<div class="ti-scan-empty"><b>Enter a token mint</b>Paste a Solana mint address to pull its on-chain signals, market, and sentiment.</div>`;+ return;+ }+ body.innerHTML = `<div class="ti-scan-card"><div class="ti-sk ti-sk-line" style="height:40px"></div><div class="ti-sk ti-sk-line" style="height:60px;margin-top:10px"></div><div class="ti-sk ti-sk-line" style="height:80px;margin-top:10px"></div></div>`;+ try {+ const r = await intelFetch(`${TOKEN_URL}?mint=${encodeURIComponent(mint)}`);+ const data = await r.json();+ if (!r.ok || !data?.ok) throw new Error(data?.message || `scan ${r.status}`);+ renderScan(data);+ } catch {+ body.innerHTML = `<div class="ti-error"><b>Scan failed</b>Couldn't read that token. Check the mint and try again.</div>`;+ }+}++function renderScan(data) {+ const body = document.getElementById('ti-scan-body');+ if (!body) return;+ const { coin, assessment: a, market: m, sentiment: s, observed } = data;+ const sym = coin?.symbol || data.mint.slice(0, 4);+ const head = `+<div class="ti-scan-head">+ ${coin?.image_uri ? `<img src="${esc(coin.image_uri)}" alt="" onerror="this.style.visibility='hidden'">` : '<div class="ti-av"></div>'}+ <div><div class="s">${esc(sym)}${a ? ` <span class="ti-verdict ${esc(a.verdict)}" style="vertical-align:middle">${esc(a.verdictLabel)}</span>` : ''}</div>+ <div class="n">${esc(coin?.name || data.mint.slice(0, 10) + '…')}</div></div>+</div>`;++ const metrics = m+ ? `<div class="ti-metrics">+ <div class="ti-metric"><div class="k">Price</div><div class="v">${fmtUsd(m.price_usd, 6)}</div></div>+ <div class="ti-metric"><div class="k">24h</div><div class="v ${Number(m.price_change_24h) >= 0 ? 'pos' : 'neg'}">${m.price_change_24h != null ? fmtPct(m.price_change_24h) : '—'}</div></div>+ <div class="ti-metric"><div class="k">Mkt cap</div><div class="v">${fmtCompact(m.market_cap)}</div></div>+ <div class="ti-metric"><div class="k">Liquidity</div><div class="v">${fmtCompact(m.liquidity)}</div></div>+ </div>`+ : '<div class="ti-scan-empty">No live market data for this mint.</div>';++ const gauges = a+ ? `<div class="ti-gauge">+ <div class="ti-gauge-row"><span>Risk</span><span>${a.risk}/100</span></div>+ <div class="ti-bar risk"><i style="width:${a.risk}%"></i></div>+ <div class="ti-gauge-row" style="margin-top:8px"><span>Organic strength</span><span>${a.organic}/100</span></div>+ <div class="ti-bar org"><i style="width:${a.organic}%"></i></div>+ </div>`+ : `<div class="ti-scan-empty">${observed ? '' : 'Not observed by the intelligence engine (launched before it, or too old). Market + sentiment shown above.'}</div>`;++ const sentiment = s+ ? `<div class="ti-sec"><h4>Sentiment · ${s.count} comments</h4>+ <div class="ti-gauge-row"><span class="ti-chip good">${s.posPct}% pos</span><span class="ti-chip bad">${s.negPct}% neg</span><span class="ti-chip">${s.neuPct}% neu</span></div></div>`+ : '';++ const reasons = a?.reasons?.length+ ? `<div class="ti-sec"><h4>Signal read</h4><ul class="ti-reasons">${a.reasons.map((r) => `<li>${esc(r)}</li>`).join('')}</ul></div>`+ : '';++ body.innerHTML = `<div class="ti-scan-card">${head}${metrics}${gauges}${sentiment}${reasons}+ <button class="ti-cta ti-cta--violet" id="ti-scan-report" data-rsym="${esc(coin?.symbol || '')}">Deep Report · pay in $THREE</button></div>`;+ document.getElementById('ti-scan-report')?.addEventListener('click', () => runDeepReport(data.mint, coin?.symbol || ''));+}++// ── deep report (paid) ────────────────────────────────────────────────────────+let _reportPrice = null;+async function reportPrice() {+ if (_reportPrice != null) return _reportPrice;+ try {+ const r = await fetch(REPORT_URL);+ const d = await r.json();+ _reportPrice = Number(d?.usd) || 0.1;+ } catch {+ _reportPrice = 0.1;+ }+ return _reportPrice;+}++async function runDeepReport(mint, symbol) {+ mint = String(mint || '').trim();+ if (!MINT_RE.test(mint)) return;+ const usd = await reportPrice();+ const pay = await payForDeepReport({ usd, symbol });+ if (!pay.ok) return;+ const loading = openDossier(null, { loading: true, symbol });+ try {+ const r = await intelFetch(REPORT_URL, {+ method: 'POST',+ headers: { 'content-type': 'application/json' },+ body: JSON.stringify({ mint, payment_id: pay.paymentId, ref_id: pay.refId }),+ });+ const data = await r.json();+ if (!r.ok || !data?.ok) throw new Error(data?.message || 'report failed');+ loading.update(data.report);+ } catch (err) {+ loading.error(err);+ }+}++function openDossier(report, { loading = false, symbol = '' } = {}) {+ const overlay = document.createElement('div');+ overlay.className = 'ti-dossier-overlay';+ overlay.setAttribute('role', 'dialog');+ overlay.setAttribute('aria-modal', 'true');+ overlay.setAttribute('aria-label', 'Deep Report');+ overlay.innerHTML = `<div class="ti-dossier"><button class="ti-dossier-x" aria-label="Close">×</button><div class="ti-dossier-inner"></div></div>`;+ document.body.appendChild(overlay);+ const inner = overlay.querySelector('.ti-dossier-inner');+ const close = () => {+ document.removeEventListener('keydown', onKey);+ overlay.classList.remove('in');+ setTimeout(() => overlay.remove(), 240);+ };+ const onKey = (e) => e.key === 'Escape' && close();+ document.addEventListener('keydown', onKey);+ overlay.addEventListener('click', (e) => e.target === overlay && close());+ overlay.querySelector('.ti-dossier-x').addEventListener('click', close);+ requestAnimationFrame(() => overlay.classList.add('in'));++ const renderLoading = () => {+ inner.innerHTML = `<h3>Building report${symbol ? ` · ${esc(symbol)}` : ''}</h3><div class="sc">Synthesizing on-chain signals, market data, and sentiment…</div>+ <div class="ti-sk ti-sk-line" style="height:72px"></div><div class="ti-sk ti-sk-line" style="height:60px;margin-top:12px"></div><div class="ti-sk ti-sk-line" style="height:90px;margin-top:12px"></div>`;+ };+ if (loading) renderLoading();+ else if (report) inner.innerHTML = dossierHtml(report);++ return {+ update: (rep) => {+ inner.innerHTML = dossierHtml(rep);+ },+ error: (err) => {+ inner.innerHTML = `<h3>Report unavailable</h3><div class="sc">${esc(err?.message || 'Something went wrong building the report.')} Your payment is recorded — retry from the same token to claim it without paying again.</div><button class="ti-cta ti-cta--ghost" id="ti-dossier-close">Close</button>`;+ inner.querySelector('#ti-dossier-close')?.addEventListener('click', close);+ },+ close,+ };+}++function dossierHtml(rep) {+ const syn = rep.synthesis || {};+ const subj = rep.subject || {};+ const m = rep.market;+ const a = rep.assessment;+ const s = rep.sentiment;+ const sym = subj.symbol || rep.mint.slice(0, 4);+ const col = scoreColor(syn.score ?? 50);+ const market = m+ ? `<div class="ti-metrics" style="margin-top:4px">+ <div class="ti-metric"><div class="k">Price</div><div class="v">${fmtUsd(m.price_usd, 6)}</div></div>+ <div class="ti-metric"><div class="k">24h</div><div class="v ${Number(m.price_change_24h) >= 0 ? 'pos' : 'neg'}">${m.price_change_24h != null ? fmtPct(m.price_change_24h) : '—'}</div></div>+ <div class="ti-metric"><div class="k">Mkt cap</div><div class="v">${fmtCompact(m.market_cap)}</div></div>+ <div class="ti-metric"><div class="k">Liquidity</div><div class="v">${fmtCompact(m.liquidity)}</div></div>+ </div>`+ : '';+ const findings = (syn.findings || []).length+ ? `<div class="ti-sec"><h4>Key findings</h4><ul class="ti-reasons">${syn.findings.map((f) => `<li>${esc(f.text)}</li>`).join('')}</ul></div>`+ : '';+ const dist =+ rep.distribution?.top_wallets?.length+ ? `<div class="ti-sec"><h4>Distribution · top observed wallets</h4><ul class="ti-reasons">${rep.distribution.top_wallets+ .slice(0, 5)+ .map((w) => `<li>${esc(w.wallet.slice(0, 4))}…${esc(w.wallet.slice(-4))} — ${(Number(w.buy_sol) || 0).toFixed(2)} SOL in${w.is_creator ? ' · creator' : ''}</li>`)+ .join('')}</ul></div>`+ : '';+ const sent = s+ ? `<div class="ti-sec"><h4>Sentiment · ${s.count} comments</h4><div class="ti-gauge-row"><span class="ti-chip good">${s.posPct}% pos</span><span class="ti-chip bad">${s.negPct}% neg</span><span class="ti-chip">${s.neuPct}% neu</span></div></div>`+ : '';+ const gauges = a+ ? `<div class="ti-sec"><h4>On-chain</h4><div class="ti-gauge">+ <div class="ti-gauge-row"><span>Risk</span><span>${a.risk}/100</span></div><div class="ti-bar risk"><i style="width:${a.risk}%"></i></div>+ <div class="ti-gauge-row" style="margin-top:8px"><span>Organic strength</span><span>${a.organic}/100</span></div><div class="ti-bar org"><i style="width:${a.organic}%"></i></div></div></div>`+ : '';+ return `+<h3>${esc(sym)} · Deep Report</h3>+<div class="sc">${esc(subj.name || rep.mint.slice(0, 12) + '…')}${subj.category ? ' · ' + esc(subj.category) : ''}</div>+<div class="ti-score-wrap">+ <div class="ti-score-ring" style="background:conic-gradient(${col} ${(syn.score ?? 50) * 3.6}deg, rgba(255,255,255,.07) 0);color:${col}"><span style="background:#14151d;width:56px;height:56px;border-radius:50%;display:grid;place-items:center">${syn.score ?? '—'}</span></div>+ <div><div class="ti-stance" style="color:${col}">${esc(syn.stanceLabel || '—')}</div><div class="ti-stance-sub">${esc(syn.headline || '')}</div></div>+</div>+${market}${gauges}${findings}${sent}${dist}+<div class="ti-disc">${esc(syn.disclaimer || 'Signal-based intelligence. Not financial advice.')}</div>`;+}++// ── shell ─────────────────────────────────────────────────────────────────────+function buildShell() {+ const root = document.createElement('div');+ root.className = 'ti-root';+ root.innerHTML = `+<div class="ti-wrap">+ <div class="ti-top">+ <div class="ti-brand">+ <a href="/three-token"><div class="ti-brand-title"><span class="ti-dot"></span>$THREE Intel</div></a>+ <div class="ti-brand-sub">Live on-chain intelligence — hold to unlock, spend for the deep read.</div>+ </div>+ <div class="ti-ticker" id="ti-ticker" hidden></div>+ <span class="ti-badge-slot" id="ti-badge"></span>+ <button class="ti-connect" id="ti-connect-chip" type="button">Connect</button>+ </div>++ <div class="ti-grid">+ <section class="ti-panel">+ <div class="ti-panel-head">+ <h2>Live Terminal</h2>+ <span class="ti-status-pill delayed" id="ti-feed-status">·</span>+ <span class="ti-spacer"></span>+ <select class="ti-select" id="ti-quality" aria-label="Minimum quality">+ <option value="">All signals</option>+ <option value="50">Quality ≥ 50</option>+ <option value="70">Quality ≥ 70</option>+ <option value="85">Quality ≥ 85</option>+ </select>+ </div>+ <div class="ti-unlock" id="ti-unlock" hidden></div>+ <div class="ti-feed" id="ti-feed"></div>+ </section>++ <aside class="ti-aside">+ <section class="ti-panel">+ <div class="ti-panel-head"><h2>Token Scanner</h2></div>+ <form class="ti-scan-form" id="ti-scan-form">+ <input class="ti-input" id="ti-scan-input" placeholder="Paste a Solana mint…" autocomplete="off" spellcheck="false" />+ <button class="ti-cta ti-cta--violet" type="submit">Scan</button>+ </form>+ <div class="ti-scan-body" id="ti-scan-body">+ <div class="ti-scan-empty"><b>Scan any token</b>On-chain signals, live market, sentiment, and a verdict — free. Or open a paid Deep Report for the full synthesis.</div>+ </div>+ </section>++ <section class="ti-panel" id="ti-narrative-panel" hidden>+ <div class="ti-panel-head"><h2>Narrative</h2><span class="ti-status-pill live" style="margin-left:auto">Holder</span></div>+ <div class="ti-scan-body" id="ti-narrative"></div>+ </section>+ </aside>+ </div>++ <div class="ti-foot">+ Powered by the three.ws Coin Intelligence Engine, live market data, and on-chain sentiment. $THREE is the only coin.+ · <a href="/three">How the economy works</a> · <a href="/three-token">$THREE price & chart</a>+ </div>+</div>++<button id="connect-wallet-btn" type="button" hidden aria-hidden="true" tabindex="-1"><span data-wallet-label>Connect wallet</span></button>`;+ document.body.appendChild(root);+}++function wireTicker() {+ const el = document.getElementById('ti-ticker');+ if (!el) return;+ const store = createThreeTokenData({ pollMs: 30000 });+ store.subscribe((state) => {+ const t = state.protocol?.token;+ if (!t || !(Number(t.price_usd) > 0)) return;+ const chg = Number(t.price_change_24h);+ el.hidden = false;+ el.innerHTML = `$THREE <b>${fmtUsd(t.price_usd, 6)}</b>${+ Number.isFinite(chg) ? ` <span class="${chg >= 0 ? 'ti-chg-pos' : 'ti-chg-neg'}">${fmtPct(chg)}</span>` : ''+ }`;+ });+ window.addEventListener('beforeunload', () => store.destroy());+}++function init() {+ buildShell();+ try {+ initWalletButton();+ } catch {+ /* wallet button is best-effort */+ }+ mountTierBadge('#ti-badge').catch(() => {});+ primeTierPass();+ wireTicker();++ document.getElementById('ti-connect-chip')?.addEventListener('click', () =>+ document.getElementById('connect-wallet-btn')?.click(),+ );+ document.getElementById('ti-scan-form')?.addEventListener('submit', (e) => {+ e.preventDefault();+ runScan(document.getElementById('ti-scan-input')?.value || '');+ });+ document.getElementById('ti-quality')?.addEventListener('change', (e) => {+ _lastMinQuality = e.target.value || '';+ loadFeed();+ });++ // A wallet connect/switch can change live vs delayed — re-read the feed + badge.+ window.addEventListener('wallet:changed', () => {+ primeTierPass();+ mountTierBadge('#ti-badge').catch(() => {});+ loadFeed();+ });++ loadFeed();+}++if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init);+else init();diff --git a/src/three-token-page.js b/src/three-token-page.jsindex bd2ada4de..382129338 100644--- a/src/three-token-page.js+++ b/src/three-token-page.js@@ -347,6 +347,11 @@ function boot() {</div><button class="tk-ca" data-ca title="Copy contract address">${esc(shortAddr(THREE_MINT))} · copy</button></div>+ <a class="tk-utility" href="/three-intel" style="display:flex;align-items:center;gap:14px;flex-wrap:wrap;text-decoration:none;margin:4px 0 2px;padding:14px 16px;border-radius:14px;border:1px solid rgba(138,123,255,.28);background:linear-gradient(180deg,rgba(138,123,255,.12),rgba(138,123,255,.04))">+ <span style="font-size:18px" aria-hidden="true">🛰️</span>+ <span style="flex:1;min-width:200px;color:#cdd2dd;font-size:13.5px;line-height:1.5"><b style="color:#b9b0ff">New · $THREE Intel</b> — hold $THREE to unlock a live on-chain intelligence terminal, or spend it for a per-token Deep Report. The token's first real utility surface.</span>+ <span style="font-weight:700;color:#b9b0ff;font-size:13px;white-space:nowrap">Open terminal →</span>+ </a><div class="tk-stats" data-stats>${Array.from({ length: 4 }, () => `<div class="tk-stat"><div class="tk-skel" style="height:48px"></div></div>`).join('')}</div>@@ -367,6 +372,7 @@ function boot() {</div></div><div class="tk-foot">+ <a href="/three-intel">🛰️ Intel Terminal</a><a href="/dashboard/holders">🏆 Holder leaderboard</a><a href="/three-live">⚡ Protocol Pulse (live 3D)</a><a href="/dashboard/three-token">📊 $THREE dashboard</a>diff --git a/tests/intel-assess.test.js b/tests/intel-assess.test.jsnew file mode 100644index 000000000..a416e96a3--- /dev/null+++ b/tests/intel-assess.test.js@@ -0,0 +1,65 @@+// Unit tests for the $THREE Intel signal-assessment core — the transparent,+// deterministic model that turns raw on-chain signals into a risk/organic read.+import { describe, it, expect } from 'vitest';+import { assessCoin } from '../api/_lib/intel/assess.js';++describe('assessCoin', () => {+ it('flags a clearly adversarial launch as high risk', () => {+ const a = assessCoin({+ quality_score: 20,+ bundle_score: 0.9,+ organic_score: 0.1,+ snipe_ratio: 0.8,+ concentration_top10: 0.85,+ fresh_wallet_ratio: 0.9,+ risk_flags: ['bundle_launch', 'sniper_cluster'],+ dev_sold: true,+ });+ expect(a.verdict).toBe('high_risk');+ expect(a.risk).toBeGreaterThanOrEqual(70);+ expect(a.reasons.some((r) => /bundle/i.test(r))).toBe(true);+ expect(a.reasons.some((r) => /dev wallet/i.test(r))).toBe(true);+ });++ it('reads a clean, demand-driven launch as organic', () => {+ const a = assessCoin({+ quality_score: 85,+ bundle_score: 0.05,+ organic_score: 0.8,+ snipe_ratio: 0.05,+ concentration_top10: 0.15,+ fresh_wallet_ratio: 0.1,+ risk_flags: [],+ unique_buyers: 60,+ buy_count: 120,+ sell_count: 20,+ });+ expect(a.verdict).toBe('organic');+ expect(a.organic).toBeGreaterThanOrEqual(55);+ expect(a.risk).toBeLessThan(45);+ });++ it('accepts both 0–1 ratios and 0–100 scores (normalization)', () => {+ const ratio = assessCoin({ bundle_score: 0.6, concentration_top10: 0.6 });+ const score = assessCoin({ bundle_score: 60, concentration_top10: 60 });+ expect(ratio.risk).toBe(score.risk);+ });++ it('never throws and clamps scores to 0–100 on empty/garbage input', () => {+ for (const input of [undefined, {}, { bundle_score: 9999, risk_flags: 'nope' }]) {+ const a = assessCoin(input);+ expect(a.risk).toBeGreaterThanOrEqual(0);+ expect(a.risk).toBeLessThanOrEqual(100);+ expect(a.organic).toBeGreaterThanOrEqual(0);+ expect(a.organic).toBeLessThanOrEqual(100);+ expect(['organic', 'mixed', 'caution', 'high_risk']).toContain(a.verdict);+ expect(Array.isArray(a.reasons)).toBe(true);+ expect(a.reasons.length).toBeGreaterThan(0);+ }+ });++ it('always returns a non-empty, holder-readable reason list', () => {+ const a = assessCoin({ quality_score: 50, organic_score: 0.5, bundle_score: 0.2 });+ expect(a.reasons.every((r) => typeof r === 'string' && r.length > 0)).toBe(true);+ });+});diff --git a/tests/three-access.test.js b/tests/three-access.test.jsindex ee6cdbcba..91fd227b9 100644--- a/tests/three-access.test.js+++ b/tests/three-access.test.js@@ -28,6 +28,7 @@ const WALLET = 'So11111111111111111111111111111111111111112';// silent change to the registry (a shifted threshold, a dropped feature) fails here.const MIN_LEVEL = {'forge.high': 1,+ 'intel.terminal': 1,'worlds.private': 2,'mcp.priority': 2,'worlds.branded': 3,@@ -36,6 +37,7 @@ const MIN_LEVEL = {};const REQUIRED_TIER_ID = {'forge.high': 'bronze',+ 'intel.terminal': 'bronze','worlds.private': 'silver','mcp.priority': 'silver','worlds.branded': 'gold',@@ -44,18 +46,21 @@ const REQUIRED_TIER_ID = {};const PAY_PER_USE = {'forge.high': 'forge.high',+ 'intel.terminal': null,'worlds.private': null,'mcp.priority': null,'worlds.branded': null,'drops.early': null,'names.first_dibs': 'name.auction',};-// Only forge.high is WIRED today (the High-tier Forge gate). The rest are planned —-// registered so the UI can show them, but not yet enforced anywhere. /three reads-// this flag to mark each perk "Live" vs "Planned"; pinning it here makes flipping a-// feature to enforced a deliberate, tested change rather than a silent one.+// forge.high and intel.terminal are WIRED today (the High-tier Forge gate and the+// Intel Terminal feed). The rest are planned — registered so the UI can show them,+// but not yet enforced anywhere. /three reads this flag to mark each perk "Live" vs+// "Planned"; pinning it here makes flipping a feature to enforced a deliberate,+// tested change rather than a silent one.const ENFORCED = {'forge.high': true,+ 'intel.terminal': true,'worlds.private': false,'mcp.priority': false,'worlds.branded': false,@@ -79,7 +84,7 @@ beforeEach(() => {});describe('registry shape', () => {- it('exposes exactly the six gated features and is deeply frozen', () => {+ it('exposes exactly the seven gated features and is deeply frozen', () => {expect(listGatedFeatures().sort()).toEqual(FEATURE_IDS.slice().sort());expect(Object.isFrozen(GATED_FEATURES)).toBe(true);for (const id of FEATURE_IDS) {@@ -102,9 +107,9 @@ describe('registry shape', () => {}});- it('marks only forge.high enforced today — the rest are planned', () => {+ it('marks forge.high and intel.terminal enforced today — the rest are planned', () => {const enforced = FEATURE_IDS.filter((id) => GATED_FEATURES[id].enforced);- expect(enforced).toEqual(['forge.high']);+ expect(enforced.sort()).toEqual(['forge.high', 'intel.terminal']);});it('references no coin other than $THREE in its copy', () => {diff --git a/vercel.json b/vercel.jsonindex 561fd7754..e37501cb2 100644--- a/vercel.json+++ b/vercel.json@@ -587,6 +587,10 @@"src": "/three-token/?","dest": "/three-token.html"},+ {+ "src": "/three-intel/?",+ "dest": "/three-intel.html"+ },{"src": "/three/?","dest": "/three.html"diff --git a/vite.config.js b/vite.config.jsindex 8d7fb1287..7122ca9bc 100644--- a/vite.config.js+++ b/vite.config.js@@ -365,6 +365,7 @@ const appConfig = {three: resolve(__dirname, 'pages/three.html'),'three-live': resolve(__dirname, 'pages/three-live.html'),'three-token': resolve(__dirname, 'pages/three-token.html'),+ 'three-intel': resolve(__dirname, 'pages/three-intel.html'),'avatar-artifact': resolve(__dirname, 'pages/avatar-artifact.html'),'launch-week': resolve(__dirname, 'pages/three-ws-launch-week.html'),community: resolve(__dirname, 'pages/community.html'),@@ -776,6 +777,8 @@ support: resolve(__dirname, 'pages/support.html'),'/three-live/': resolve(root, 'pages/three-live.html'),'/three-token': resolve(root, 'pages/three-token.html'),'/three-token/': resolve(root, 'pages/three-token.html'),+ '/three-intel': resolve(root, 'pages/three-intel.html'),+ '/three-intel/': resolve(root, 'pages/three-intel.html'),'/avatar-artifact': resolve(root, 'pages/avatar-artifact.html'),'/avatar-artifact/': resolve(root, 'pages/avatar-artifact.html'),'/walk': resolve(root, 'pages/walk.html'),