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
<!doctype html>
<html lang="en">
<head>
<style>/* three.ws hidden-guard — make the `hidden` attribute authoritative; see scripts/lib/hidden-guard.mjs */[hidden]{display:none!important}</style>
<script>/* three.ws theme boot */(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.0, viewport-fit=cover" />
<title data-i18n="trending.meta_title">Trending · three.ws</title>
<meta name="description" content="What's hot on three.ws — top AI agents by real chat activity, the most trusted agents by real wallet-trust score, and top Oracle conviction coins." data-i18n-attr="content:trending.meta_description"/>
<link rel="icon" href="/favicon.ico" sizes="any" />
<link rel="stylesheet" href="/fonts/fonts.css" />
<link rel="canonical" href="https://three.ws/trending" />
<meta property="og:title" content="Trending — three.ws" data-i18n-attr="content:trending.meta_og_title"/>
<meta property="og:description" content="Top 3D AI agents by real chat activity. Top conviction coins by Oracle score." data-i18n-attr="content:trending.meta_og_description"/>
<meta property="og:image" content="https://three.ws/api/page-og?s=crypto&t=Trending%3A+Top+Agents+%26+Coins+on+three.ws&d=What%E2%80%99s+hot+on+three.ws+right+now.+Top+3D+AI+agents+ranked+by+real+chat+activity+and+top+Oracle+conviction+coins+by+score%2C+with+24h%2F7d%2Fall-time+windows.&p=%2Ftrending" />
<meta name="twitter:card" content="summary_large_image" />
<meta property="og:type" content="website">
<meta property="og:site_name" content="three.ws">
<meta property="og:url" content="https://three.ws/trending">
<meta name="twitter:title" content="Trending — Top Agents & Coins on three.ws · three.ws" data-i18n-attr="content:trending.meta_twitter_title">
<meta name="twitter:description" content="What’s hot on three.ws right now. Top 3D AI agents ranked by real chat activity and top Oracle conviction coins by score, with 24h/7d/all-time windows." data-i18n-attr="content:trending.meta_twitter_description">
<meta name="twitter:image" content="https://three.ws/api/page-og?s=crypto&t=Trending%3A+Top+Agents+%26+Coins+on+three.ws&d=What%E2%80%99s+hot+on+three.ws+right+now.+Top+3D+AI+agents+ranked+by+real+chat+activity+and+top+Oracle+conviction+coins+by+score%2C+with+24h%2F7d%2Fall-time+windows.&p=%2Ftrending">
<script type="application/ld+json">{"@context":"https://schema.org","@type":"WebPage","name":"Trending — Top Agents & Coins on three.ws","description":"What’s hot on three.ws right now. Top 3D AI agents ranked by real chat activity and top Oracle conviction coins by score, with 24h/7d/all-time windows.","url":"https://three.ws/trending","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}}</script>
<meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1">
<meta property="og:locale" content="en_US">
<meta property="og:image:alt" content="Trending — Top Agents & Coins on three.ws — three.ws">
<meta name="twitter:site" content="@trythreews">
</head>
<body>
<div id="nav-container"></div>
<main class="tr-main" id="main">
<div class="tr-head">
<h1 class="tr-h1" data-i18n="trending.trending">Trending</h1>
<p class="tr-sub" data-i18n="trending.what_s_hot_on_three_ws_right">What's hot on three.ws right now.</p>
</div>
<div class="tr-controls">
<div class="tr-tabs" role="tablist" aria-label="Trending leaderboard">
<button class="tr-tab active" role="tab" id="tab-agents" aria-selected="true" aria-controls="sec-agents" tabindex="0" type="button" data-tab="agents" data-i18n="trending.agents">Agents</button>
<button class="tr-tab" role="tab" id="tab-trusted" aria-selected="false" aria-controls="sec-trusted" tabindex="-1" type="button" data-tab="trusted" data-i18n="trending.trusted">Trusted</button>
<button class="tr-tab" role="tab" id="tab-coins" aria-selected="false" aria-controls="sec-coins" tabindex="-1" type="button" data-tab="coins" data-i18n="trending.coins">Coins</button>
</div>
<div class="tr-windows" id="trWindows" role="group" aria-label="Time window">
<button class="tr-win active" type="button" aria-pressed="true" data-win="24h" data-i18n="trending.24h">24h</button>
<button class="tr-win" type="button" aria-pressed="false" data-win="7d" data-i18n="trending.7d">7d</button>
<button class="tr-win" type="button" aria-pressed="false" data-win="all" data-i18n="trending.all_time">All time</button>
</div>
</div>
<div class="tr-content">
<section class="tr-section active" id="sec-agents" role="tabpanel" tabindex="0" aria-labelledby="tab-agents">
<div class="tr-legend">
<span data-i18n="trending.agent">Agent</span>
<span class="tr-legend-r" data-i18n-html="trending.chats_24h">Chats <span class="tr-legend-window" id="legendWindow">24h</span></span>
</div>
<ol class="tr-list" id="agentList" aria-live="polite">
<li class="tr-skeleton"></li>
<li class="tr-skeleton"></li>
<li class="tr-skeleton"></li>
<li class="tr-skeleton"></li>
<li class="tr-skeleton"></li>
</ol>
<div class="tr-empty" id="agentEmpty" hidden>
<span class="tr-empty-title" data-i18n="trending.no_agent_chats_in_this_window">No agent chats in this window yet.</span>
<span class="tr-empty-sub" data-i18n-html="trending.widen_the_window_or_build_an_agent">Widen the window above, or <a href="/create">build an agent</a> and put it on the board.</span>
</div>
<div class="tr-error" id="agentError" role="alert" hidden>
<span class="tr-error-icon" aria-hidden="true">⚠️</span>
<span class="tr-error-title" data-i18n="trending.couldn_t_load_trending_agents">Couldn't load trending agents</span>
<span class="tr-error-sub" data-i18n="trending.check_your_connection_and_try_again">Check your connection and try again.</span>
<button class="tr-retry" id="agentRetry" type="button" data-i18n="trending.retry">↻ Retry</button>
</div>
</section>
<section class="tr-section" id="sec-trusted" role="tabpanel" tabindex="0" aria-labelledby="tab-trusted">
<div class="tr-legend">
<span data-i18n="trending.agent_2">Agent</span>
<span class="tr-legend-r" data-i18n="trending.trust_score">Trust score</span>
</div>
<ol class="tr-list" id="trustedList" aria-live="polite">
<li class="tr-skeleton"></li>
<li class="tr-skeleton"></li>
<li class="tr-skeleton"></li>
<li class="tr-skeleton"></li>
<li class="tr-skeleton"></li>
</ol>
<div class="tr-empty" id="trustedEmpty" hidden>
<span class="tr-empty-title" data-i18n="trending.no_agents_have_earned_a_track_record">No agents have earned a track record yet.</span>
<span class="tr-empty-sub" data-i18n-html="trending.trust_is_built_from_real_money_and_time">Trust is built from real money and time. <a href="/create">Launch an agent</a> and be the first.</span>
</div>
<div class="tr-error" id="trustedError" role="alert" hidden>
<span class="tr-error-icon" aria-hidden="true">⚠️</span>
<span class="tr-error-title" data-i18n="trending.couldn_t_load_the_trust_leaderboard">Couldn't load the trust leaderboard</span>
<span class="tr-error-sub" data-i18n="trending.check_your_connection_and_try_again_2">Check your connection and try again.</span>
<button class="tr-retry" id="trustedRetry" type="button" data-i18n="trending.retry_2">↻ Retry</button>
</div>
</section>
<section class="tr-section" id="sec-coins" role="tabpanel" tabindex="0" aria-labelledby="tab-coins">
<div class="tr-legend">
<span data-i18n="trending.coin">Coin</span>
<span class="tr-legend-r" data-i18n-html="trending.oracle_score_scored_window">Oracle score <span class="tr-legend-window" id="coinLegendWindow">24h</span></span>
</div>
<ol class="tr-list" id="coinList" aria-live="polite">
<li class="tr-skeleton"></li>
<li class="tr-skeleton"></li>
<li class="tr-skeleton"></li>
<li class="tr-skeleton"></li>
<li class="tr-skeleton"></li>
</ol>
<div class="tr-empty" id="coinEmpty" hidden>
<span class="tr-empty-title"><span data-i18n="trending.no_coins_scored_in_the">No coins scored in the</span> <span id="coinEmptyWindow">last 24 hours</span>.</span>
<span class="tr-empty-sub" data-i18n-html="trending.widen_the_window_or_read_the_oracle">Widen the window above, or read how scoring works in the <a href="/oracle">Oracle</a>.</span>
</div>
<div class="tr-error" id="coinError" role="alert" hidden>
<span class="tr-error-icon" aria-hidden="true">⚠️</span>
<span class="tr-error-title" data-i18n="trending.couldn_t_load_conviction_coins">Couldn't load conviction coins</span>
<span class="tr-error-sub" data-i18n="trending.check_your_connection_and_try_again_3">Check your connection and try again.</span>
<button class="tr-retry" id="coinRetry" type="button" data-i18n="trending.retry_3">↻ Retry</button>
</div>
</section>
</div>
<p class="tr-footnote" data-i18n-html="trending.agents_chats_with_real_users_via_embedded">
Agents: chats with real users via embedded widgets. Trusted: a real, non-gameable wallet-trust score (0 to 100) from settled volume, tips from distinct funded wallets, age, payment reliability, fork lineage, and on-chain identity. Every input is auditable, and each row links to its breakdown. Coins: <a href="/oracle">Oracle</a> conviction score (pedigree + structure + narrative + momentum), rescored every 2 minutes; the window above filters to coins scored inside it.
</p>
</main>
<div id="footer-container"></div>
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-family: Inter, system-ui, sans-serif; background: #050508; color: #e5e7eb; }
.tr-main {
max-width: 740px; margin: 0 auto;
padding: 40px 20px 80px;
}
/* ── head ── */
.tr-head { margin-bottom: 28px; }
.tr-h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 800; color: #f9fafb; letter-spacing: -.02em; }
.tr-sub { margin-top: 6px; font-size: 14px; color: #8b93a3; }
/* ── controls ── */
.tr-controls {
display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
margin-bottom: 24px;
}
.tr-tabs { display: flex; gap: 2px; background: rgba(255,255,255,.05); border-radius: 10px; padding: 3px; }
.tr-tab {
padding: 7px 18px; border-radius: 8px; border: none; cursor: pointer;
font-size: 13px; font-weight: 600; background: transparent; color: #8b93a3;
transition: background .15s, color .15s;
}
.tr-tab.active { background: rgba(99,102,241,.25); color: #a5b4fc; }
.tr-tab:not(.active):hover { color: #d1d5db; background: rgba(255,255,255,.05); }
.tr-windows { display: flex; gap: 6px; }
.tr-win {
padding: 5px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,.1);
font-size: 12px; font-weight: 600; cursor: pointer;
background: transparent; color: #8b93a3;
transition: border-color .15s, color .15s, background .15s;
}
.tr-win.active { border-color: rgba(99,102,241,.6); color: #a5b4fc; background: rgba(99,102,241,.1); }
.tr-win:not(.active):hover { color: #d1d5db; border-color: rgba(255,255,255,.2); }
/* ── section / legend ── */
.tr-section { display: none; }
.tr-section.active { display: block; }
.tr-legend {
display: flex; justify-content: space-between;
font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
color: #7d8595; padding: 0 16px 10px;
}
/* ── list rows ── */
.tr-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.tr-row {
display: flex; align-items: center; gap: 14px;
padding: 13px 16px; border-radius: 12px;
border: 1px solid rgba(255,255,255,.07);
background: rgba(255,255,255,.025);
text-decoration: none; color: inherit;
transition: border-color .2s, background .2s, transform .15s;
}
.tr-row:hover { border-color: rgba(99,102,241,.35); background: rgba(99,102,241,.06); transform: translateX(2px); }
.tr-rank {
width: 22px; text-align: center; flex-shrink: 0;
font-size: 11px; font-weight: 700; color: #7d8595;
}
.tr-rank-1 { color: #f59e0b; }
.tr-rank-2 { color: #9ca3af; }
.tr-rank-3 { color: #b45309; }
/* agent avatar */
.tr-av {
width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
background: linear-gradient(135deg, #312e81, #4f46e5);
display: flex; align-items: center; justify-content: center;
font-size: 16px; font-weight: 700; color: rgba(255,255,255,.8);
overflow: hidden;
}
.tr-av img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
/* coin badge */
.tr-coin-badge {
width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
background: linear-gradient(135deg, #064e3b, #065f46);
display: flex; align-items: center; justify-content: center;
font-size: 12px; font-weight: 800; color: #6ee7b7;
letter-spacing: -.03em;
}
.tr-body { flex: 1; min-width: 0; }
.tr-name {
font-size: 14px; font-weight: 700; color: #f3f4f6;
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tr-desc {
margin-top: 2px;
font-size: 12px; color: #8b93a3;
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tr-meta { text-align: right; flex-shrink: 0; }
.tr-metric { font-size: 15px; font-weight: 700; color: #f3f4f6; }
.tr-metric-label { font-size: 10px; color: #8b93a3; margin-top: 1px; }
/* tier pill */
.tr-tier {
display: inline-flex; align-items: center; gap: 4px;
font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
padding: 2px 7px; border-radius: 6px; border: 1px solid;
}
.tr-tier-prime { color: #f59e0b; border-color: rgba(245,158,11,.3); background: rgba(245,158,11,.08); }
.tr-tier-strong { color: #10b981; border-color: rgba(16,185,129,.3); background: rgba(16,185,129,.08); }
.tr-tier-lean { color: #3b82f6; border-color: rgba(59,130,246,.3); background: rgba(59,130,246,.08); }
.tr-tier-watch { color: #8b5cf6; border-color: rgba(139,92,246,.3); background: rgba(139,92,246,.08); }
.tr-tier-avoid { color: #8b93a3; border-color: rgba(107,114,128,.2); background: rgba(107,114,128,.05); }
/* reputation tier pill (matches TIERS accents in wallet-reputation.js) */
.tr-rt {
display: inline-flex; align-items: center; gap: 4px;
font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
padding: 2px 7px; border-radius: 6px; border: 1px solid;
}
.tr-rt-new { color: #9ca3af; border-color: rgba(156,163,175,.28); background: rgba(156,163,175,.06); }
.tr-rt-emerging { color: var(--accent-violet, #c4b5fd); border-color: rgba(196,181,253,.3); background: rgba(196,181,253,.08); }
.tr-rt-established { color: var(--accent-violet-strong, #a78bfa); border-color: rgba(167,139,250,.32); background: rgba(167,139,250,.09); }
.tr-rt-trusted { color: var(--success, #4ade80); border-color: rgba(74,222,128,.32); background: rgba(74,222,128,.08); }
.tr-rt-elite { color: var(--warn, #fbbf24); border-color: rgba(251,191,36,.34); background: rgba(251,191,36,.09); }
.tr-trust-num { color: #f3f4f6; }
.tr-trust-slash { color: #8b93a3; font-weight: 600; }
/* onchain badge */
.tr-onchain {
font-size: 9px; font-weight: 700; letter-spacing: .08em;
color: #10b981; border: 1px solid rgba(16,185,129,.3);
padding: 1px 5px; border-radius: 4px; margin-left: 6px;
}
/* skeleton */
.tr-skeleton {
height: 68px; border-radius: 12px;
background: linear-gradient(90deg, rgba(255,255,255,.04) 0%, rgba(255,255,255,.07) 50%, rgba(255,255,255,.04) 100%);
background-size: 200% 100%;
animation: skeleton-sweep 1.4s ease-in-out infinite;
}
@keyframes skeleton-sweep { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.tr-empty, .tr-error {
padding: 40px 20px; text-align: center;
font-size: 14px; color: #8b93a3;
}
.tr-empty {
display: flex; flex-direction: column; align-items: center; gap: 7px;
border: 1px dashed rgba(255,255,255,.09); border-radius: 12px;
background: rgba(255,255,255,.015);
}
.tr-empty-title { font-size: 14px; font-weight: 600; color: #d1d5db; }
.tr-empty-sub { font-size: 12.5px; color: #8b93a3; max-width: 40ch; line-height: 1.55; }
.tr-empty-sub a { color: #818cf8; text-decoration: none; border-bottom: 1px solid rgba(129,140,248,.35); }
.tr-empty-sub a:hover { color: #a5b4fc; border-bottom-color: rgba(165,180,252,.7); }
.tr-error {
display: flex; flex-direction: column; align-items: center; gap: 14px;
padding: 36px 24px; border: 1px solid rgba(248,113,113,.28);
background: rgba(248,113,113,.05); border-radius: 12px;
}
.tr-error-icon { font-size: 26px; opacity: .85; line-height: 1; }
.tr-error-title { font-size: 14px; font-weight: 600; color: #e5e7eb; }
.tr-error-sub { font-size: 12.5px; color: #8b93a3; }
.tr-retry {
display: inline-flex; align-items: center; gap: 7px;
padding: 9px 18px; border-radius: 10px; cursor: pointer;
font-size: 13px; font-weight: 600;
color: #c7d2fe; background: rgba(99,102,241,.18);
border: 1px solid rgba(99,102,241,.45);
transition: background .15s, border-color .15s, color .15s;
}
.tr-retry:hover:not(:disabled) { background: rgba(99,102,241,.3); border-color: rgba(99,102,241,.7); color: #e0e7ff; }
.tr-retry:disabled { opacity: .6; cursor: progress; }
.tr-retry-spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid rgba(199,210,254,.3); border-top-color: #c7d2fe; animation: tr-spin .7s linear infinite; }
@keyframes tr-spin { to { transform: rotate(360deg); } }
.tr-footnote {
margin-top: 32px;
font-size: 12px; color: #7d8595; line-height: 1.6;
border-top: 1px solid rgba(255,255,255,.06); padding-top: 16px;
}
/* Underlined, not color-only: the link has to be distinguishable from the
muted prose around it without relying on hue (WCAG 1.4.1). */
.tr-footnote a { color: #818cf8; text-decoration: underline; text-underline-offset: 2px; }
.tr-footnote a:hover { color: #a5b4fc; }
/* ── focus ── */
/* One designed ring for every interactive element on the page, so keyboard
users get the same affordance the UA outline gives, in the page's palette. */
.tr-tab:focus-visible, .tr-win:focus-visible, .tr-retry:focus-visible,
.tr-row:focus-visible, .tr-empty-sub a:focus-visible, .tr-footnote a:focus-visible,
.tr-section:focus-visible {
outline: 2px solid #818cf8; outline-offset: 2px; border-radius: 10px;
}
.tr-section:focus-visible { outline-offset: 4px; }
/* ── narrow screens ── */
/* The shared wallet chip is a nowrap pill sized for a wide row. Inside a
320px row it would push the whole page into a horizontal scroll, so let
it wrap and shrink instead of clipping the Tip action out of reach. */
.tr-wallet { min-width: 0; max-width: 100%; }
.tr-wallet .twc { max-width: 100%; flex-wrap: wrap; white-space: normal; }
@media (max-width: 480px) {
.tr-controls { flex-direction: column; align-items: flex-start; }
.tr-desc { display: none; }
.tr-row { gap: 10px; padding: 12px; }
.tr-av, .tr-coin-badge { width: 34px; height: 34px; }
.tr-metric { font-size: 14px; }
.tr-wallet .twc { row-gap: 4px; }
}
</style>
<script type="module">
import { walletChipHTML, wireWalletChips } from '/src/shared/agent-wallet-chip.js';
const $ = (s) => document.querySelector(s);
const $$ = (s) => document.querySelectorAll(s);
const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) =>
({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
let currentTab = 'agents';
let currentWin = '24h';
let cache = {}; // cache[key] = data
const TABS = ['agents', 'trusted', 'coins'];
const WIN_LABEL = { '24h': '24h', '7d': '7d', 'all': 'all time' };
const WIN_PHRASE = { '24h': 'last 24 hours', '7d': 'last 7 days', 'all': 'window we retain' };
// The legends and the coin empty state name the selected window. They live
// inside translated markup, so re-stamp them after a locale swap and never
// assume a node survived it.
function setText(sel, value) {
const el = $(sel);
if (el) el.textContent = value;
}
function syncWindowLabels() {
setText('#legendWindow', WIN_LABEL[currentWin]);
setText('#coinLegendWindow', WIN_LABEL[currentWin]);
setText('#coinEmptyWindow', WIN_PHRASE[currentWin]);
}
window.addEventListener('i18n:change', syncWindowLabels);
// ── Tab switching ───────────────────────────────────────────────────
function syncTab(tab, { focus = false, push = false } = {}) {
currentTab = tab;
$$('.tr-tab').forEach(b => {
const on = b.dataset.tab === tab;
b.classList.toggle('active', on);
b.setAttribute('aria-selected', String(on));
// Roving tabindex: the tablist is one tab stop, arrows move within it.
b.tabIndex = on ? 0 : -1;
if (on && focus) b.focus();
});
$$('.tr-section').forEach(s => s.classList.toggle('active', s.id === `sec-${tab}`));
// Trust is an all-time signal, so the time-window control doesn't apply.
$('#trWindows').hidden = tab === 'trusted';
if (push) writeUrl();
if (tab === 'trusted') loadTrusted();
}
// Keep ?tab= in the address bar so any view is shareable and the back
// button walks the tabs the visitor actually opened.
function writeUrl(replace = false) {
const url = new URL(location.href);
if (currentTab === 'agents') url.searchParams.delete('tab');
else url.searchParams.set('tab', currentTab);
const next = url.pathname + url.search + url.hash;
if (next === location.pathname + location.search + location.hash) return;
history[replace ? 'replaceState' : 'pushState']({ tab: currentTab }, '', next);
}
$$('.tr-tab').forEach(btn => {
btn.addEventListener('click', () => {
const tab = btn.dataset.tab;
if (tab === currentTab) return;
syncTab(tab, { push: true });
});
});
$('.tr-tabs').addEventListener('keydown', (e) => {
const i = TABS.indexOf(currentTab);
let next = null;
if (e.key === 'ArrowRight' || e.key === 'ArrowDown') next = TABS[(i + 1) % TABS.length];
else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') next = TABS[(i - 1 + TABS.length) % TABS.length];
else if (e.key === 'Home') next = TABS[0];
else if (e.key === 'End') next = TABS[TABS.length - 1];
if (!next) return;
e.preventDefault();
syncTab(next, { focus: true, push: true });
});
window.addEventListener('popstate', () => {
const t = new URL(location.href).searchParams.get('tab');
syncTab(TABS.includes(t) ? t : 'agents');
});
// ── Window switching ────────────────────────────────────────────────
$$('.tr-win').forEach(btn => {
btn.addEventListener('click', () => {
const win = btn.dataset.win;
if (win === currentWin) return;
currentWin = win;
$$('.tr-win').forEach(b => {
const on = b.dataset.win === win;
b.classList.toggle('active', on);
b.setAttribute('aria-pressed', String(on));
});
syncWindowLabels();
loadData();
});
});
// ── Retry buttons ───────────────────────────────────────────────────
function retry(btn, fn) {
btn.disabled = true;
const prev = btn.innerHTML;
btn.innerHTML = '<span class="tr-retry-spin" aria-hidden="true"></span>Retrying…';
fn().finally(() => { btn.disabled = false; btn.innerHTML = prev; });
}
$('#agentRetry').addEventListener('click', (e) => retry(e.currentTarget, loadData));
$('#coinRetry').addEventListener('click', (e) => retry(e.currentTarget, loadData));
$('#trustedRetry').addEventListener('click', (e) => retry(e.currentTarget, () => loadTrusted(true)));
// ── Tier pill ───────────────────────────────────────────────────────
function tierPill(tier) {
if (!tier) return '';
return `<span class="tr-tier tr-tier-${esc(tier)}">${esc(tier)}</span>`;
}
// ── Compact number ──────────────────────────────────────────────────
const compact = new Intl.NumberFormat('en', { notation: 'compact', maximumFractionDigits: 1 });
function fmt(n) { return n == null ? '—' : compact.format(Number(n)); }
// ── Safe link target ────────────────────────────────────────────────
// API-supplied URLs are absolute (https://three.ws/...), which would bounce a
// visitor off whatever host they are on. Prefer the route we can build
// ourselves and keep navigation same-origin; only fall back to the server's
// URL, and only when it is a path or an http(s) URL we can actually open.
function safeHref(internal, raw) {
if (internal) return internal;
const v = typeof raw === 'string' ? raw.trim() : '';
if (v && (v.startsWith('/') || /^https?:\/\//i.test(v))) return v;
return null;
}
// ── Render agents ───────────────────────────────────────────────────
function renderAgents(agents) {
const list = $('#agentList');
const empty = $('#agentEmpty');
const error = $('#agentError');
error.hidden = true;
if (!agents.length) { list.innerHTML = ''; empty.hidden = false; return; }
empty.hidden = true;
list.innerHTML = agents.map(a => {
const count = currentWin === 'all' ? a.chat_count : (a.window_chats ?? a.chat_count);
const initial = (a.name || 'A')[0].toUpperCase();
const avHtml = a.avatar_thumbnail_url
? `<img src="${esc(a.avatar_thumbnail_url)}" alt="" loading="lazy" />`
: esc(initial);
const onchainBadge = a.is_onchain ? '<span class="tr-onchain">◈ on-chain</span>' : '';
const rankCls = a.rank <= 3 ? ` tr-rank-${a.rank}` : '';
const name = a.name || 'Unnamed agent';
const internal = a.id != null ? `/agents/${encodeURIComponent(a.id)}` : null;
const href = safeHref(internal, a.agent_url);
const tag = href ? 'a' : 'div';
const attrs = href
? ` href="${esc(href)}" aria-label="Rank ${a.rank}: ${esc(name)}, ${esc(fmt(count))} chats"`
: ` role="group" aria-label="Rank ${a.rank}: ${esc(name)}, ${esc(fmt(count))} chats (no profile available)"`;
return `<li>
<${tag} class="tr-row"${attrs}>
<span class="tr-rank${rankCls}">${a.rank}</span>
<span class="tr-av">${avHtml}</span>
<span class="tr-body">
<span class="tr-name">${esc(a.name || 'Unnamed agent')}${onchainBadge}</span>
${a.description ? `<span class="tr-desc">${esc(a.description)}</span>` : ''}
${a.solana_address ? `<span class="tr-wallet" style="margin-top:4px;display:inline-flex">${walletChipHTML(a, { link: false, showPending: false, tip: false, popover: false })}</span>` : ''}
</span>
<span class="tr-meta">
<span class="tr-metric">${fmt(count)}</span>
<span class="tr-metric-label">chats</span>
</span>
</${tag}>
</li>`;
}).join('');
// Hydrate each chip's live balance. The whole row is a link to the agent,
// so the chip renders without its Tip button and without the popover
// trigger: both are interactive controls, and nested inside an anchor the
// browser followed the row instead of running them, which made Tip a
// button that lied. Tipping lives on the agent page this row opens.
wireWalletChips(list);
}
// ── Render coins ────────────────────────────────────────────────────
function renderCoins(coins) {
const list = $('#coinList');
const empty = $('#coinEmpty');
const error = $('#coinError');
error.hidden = true;
if (!coins.length) { list.innerHTML = ''; empty.hidden = false; return; }
empty.hidden = true;
list.innerHTML = coins.map(c => {
const sym = (c.symbol || '?').slice(0, 5);
const symFull = c.symbol || 'coin';
const rankCls = c.rank <= 3 ? ` tr-rank-${c.rank}` : '';
// Primary: our full coin page. Fall back to the server-provided link.
const internal = c.mint ? `/oracle/coin/${encodeURIComponent(c.mint)}` : null;
const href = safeHref(internal, c.coin_url);
const tag = href ? 'a' : 'div';
const label = `Rank ${c.rank}: $${symFull}, Oracle score ${c.score} of 100`;
const attrs = href
? ` href="${esc(href)}" aria-label="${esc(label)}"`
: ` role="group" aria-label="${esc(label)} (no detail page available)"`;
return `<li>
<${tag} class="tr-row"${attrs}>
<span class="tr-rank${rankCls}">${c.rank}</span>
<span class="tr-coin-badge">$${esc(sym)}</span>
<span class="tr-body">
<span class="tr-name">$${esc(c.symbol || '—')}</span>
<span class="tr-desc">${tierPill(c.tier)} · momentum ${c.momentum}/100 · wallets ${fmt(c.smart_wallet_count)}</span>
</span>
<span class="tr-meta">
<span class="tr-metric">${c.score}</span>
<span class="tr-metric-label">/100 score</span>
</span>
</${tag}>
</li>`;
}).join('');
}
// ── Render trusted agents ───────────────────────────────────────────
// The platform's real leaderboard of trusted agents, ranked by the same
// non-gameable wallet-trust score the badge shows everywhere else — backed
// by real money and time, fully auditable. Each row links straight to the
// agent's trust breakdown (#reputation), where every input is explained.
function renderTrusted(agents) {
const list = $('#trustedList');
const empty = $('#trustedEmpty');
const error = $('#trustedError');
error.hidden = true;
if (!agents.length) { list.innerHTML = ''; empty.hidden = false; return; }
empty.hidden = true;
list.innerHTML = agents.map(a => {
const initial = (a.name || 'A')[0].toUpperCase();
const avHtml = a.avatar_thumbnail_url
? `<img src="${esc(a.avatar_thumbnail_url)}" alt="" loading="lazy" />`
: esc(initial);
const rankCls = a.rank <= 3 ? ` tr-rank-${a.rank}` : '';
const name = a.name || 'Unnamed agent';
const tier = String(a.tier || 'emerging');
const tierLabel = a.tier_label || tier;
const internal = a.id != null ? `/agents/${encodeURIComponent(a.id)}/wallet#reputation` : null;
const href = safeHref(internal, a.breakdown_url);
const tag = href ? 'a' : 'div';
const score = Math.round(Number(a.score) || 0);
const attrs = href
? ` href="${esc(href)}" aria-label="Rank ${a.rank}: ${esc(name)}, trust score ${score} of 100, ${esc(tierLabel)}"`
: ` role="group" aria-label="Rank ${a.rank}: ${esc(name)}, trust score ${score} of 100, ${esc(tierLabel)}"`;
// Wallet chip without its own rep badge here: the meta column is the
// headline trust number on this surface, so the badge would be redundant.
return `<li>
<${tag} class="tr-row"${attrs}>
<span class="tr-rank${rankCls}">${a.rank}</span>
<span class="tr-av">${avHtml}</span>
<span class="tr-body">
<span class="tr-name">${esc(name)} <span class="tr-rt tr-rt-${esc(tier)}">${esc(tierLabel)}</span></span>
${a.solana_address ? `<span class="tr-wallet" style="margin-top:4px;display:inline-flex">${walletChipHTML(a, { link: false, showPending: false, reputation: false, tip: false, popover: false })}</span>` : ''}
</span>
<span class="tr-meta">
<span class="tr-metric"><span class="tr-trust-num">${score}</span><span class="tr-trust-slash">/100</span></span>
<span class="tr-metric-label">trust</span>
</span>
</${tag}>
</li>`;
}).join('');
wireWalletChips(list);
}
// ── Load trusted (lazy: only when the tab is first opened) ───────────
let trustedData = null;
async function loadTrusted(force = false) {
if (trustedData && !force) { renderTrusted(trustedData); return; }
setSkeletons('trustedList');
$('#trustedEmpty').hidden = true;
$('#trustedError').hidden = true;
try {
const r = await fetch('/api/reputation/leaderboard?limit=25');
if (!r.ok) throw new Error('HTTP ' + r.status);
const data = await r.json();
trustedData = data.agents || [];
renderTrusted(trustedData);
} catch {
$('#trustedList').innerHTML = '';
$('#trustedError').hidden = false;
}
}
// ── Skeleton states ─────────────────────────────────────────────────
function setSkeletons(listId, count = 5) {
const list = $('#' + listId);
list.innerHTML = Array.from({ length: count }, () => '<li class="tr-skeleton"></li>').join('');
}
// ── Load ────────────────────────────────────────────────────────────
async function loadData() {
const key = currentWin;
if (cache[key]) {
renderAgents(cache[key].agents);
renderCoins(cache[key].coins);
return;
}
setSkeletons('agentList');
setSkeletons('coinList');
$('#agentEmpty').hidden = true;
$('#agentError').hidden = true;
$('#coinEmpty').hidden = true;
$('#coinError').hidden = true;
try {
const r = await fetch(`/api/trending?window=${encodeURIComponent(key)}&limit=10`);
if (!r.ok) throw new Error('HTTP ' + r.status);
const data = await r.json();
cache[key] = data;
renderAgents(data.agents || []);
renderCoins(data.coins || []);
} catch {
$('#agentList').innerHTML = '';
$('#coinList').innerHTML = '';
$('#agentError').hidden = false;
$('#coinError').hidden = false;
}
}
// Honor a shareable ?tab= deep link (e.g. /trending?tab=trusted) and drop a
// value we don't serve, so the address bar always matches what is on screen.
const initialTab = new URL(location.href).searchParams.get('tab');
if (initialTab && initialTab !== 'agents') syncTab(TABS.includes(initialTab) ? initialTab : 'agents');
writeUrl(true);
syncWindowLabels();
loadData();
</script>
<script src="/nav.js" defer></script>
<script src="/footer.js" defer></script>
<!-- Runtime i18n: detects locale, swaps annotated copy, mounts <lang-switcher>. -->
<script type="module" src="/i18n.js"></script>
</body>
</html>