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
feat(duels): add the single-duel page and the duels panel on trader profiles
nirholas2c94b8ea35ac
diff --git a/pages/duel.html b/pages/duel.htmlnew file mode 100644index 000000000..55d06b1fa--- /dev/null+++ b/pages/duel.html@@ -0,0 +1,59 @@+<!doctype html>+<html lang="en">+ <head>+ <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" />+ <script src="/referral-capture.js"></script>+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>Trader Duel · three.ws</title>+ <meta name="description" content="A three.ws trader duel: call which of two pump.fun trader agents books more realized profit over a fixed UTC window. Both live records, the in-window race and the rules, resolved from the on-chain ledger. Free to play; points have no cash value." />+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:title" content="Trader Duel · three.ws" />+ <meta property="og:description" content="Which trader books more realized profit this window? Make your call. Free to play; points have no cash value." />+ <meta property="og:image" content="https://three.ws/api/page-og?s=crypto&t=Trader+Duels&d=Call+which+trader+books+more+realized+profit.+Free+to+play%2C+resolved+from+the+on-chain+ledger.&p=%2Fduels" />+ <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="theme-color" content="#0a0a0a" />+ <meta name="robots" content="index, follow, max-image-preview:large" />+ <link rel="icon" href="/favicon.ico" sizes="any" />+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />+ <link rel="manifest" href="/manifest.webmanifest" />+ <link rel="stylesheet" href="/fonts/fonts.css" />+ <link rel="stylesheet" href="/nav.css" />+ <link rel="stylesheet" href="/src/syndicates.css" />+ <link rel="stylesheet" href="/src/duels.css" />+ <link rel="stylesheet" href="/footer.css" />+ <script defer src="/footer-newsletter.js"></script>+ </head>+ <body>+ <header><div id="nav-container"></div></header>+ <script src="/nav.js"></script>++ <main class="sy" id="dxRoot" aria-busy="true">+ <p style="margin:0 0 14px"><a class="sy-faint" href="/duels" style="text-decoration:none;font-weight:700;font-size:13.5px">← All duels</a></p>+ <div id="dxContent" aria-live="polite">+ <div style="display:grid;gap:14px" aria-hidden="true">+ <div class="sy-skel" style="height:110px"></div>+ <div class="dx-traders">+ <div class="sy-skel" style="height:300px"></div>+ <div class="sy-skel" style="height:300px"></div>+ </div>+ <div class="sy-skel" style="height:140px"></div>+ </div>+ </div>+ </main>++ <div id="syToast" class="sy-toast" role="status" aria-live="polite"></div>++ <script type="module" src="/src/duel.js"></script>+ <script src="/brand.js" defer></script>+ <div id="footer-container"></div>+ <script src="/footer.js"></script>+ <!-- Runtime i18n: detects locale, swaps annotated copy, mounts <lang-switcher>. -->+ <script type="module" src="/i18n.js"></script>+ </body>+</html>diff --git a/src/trader-duels.js b/src/trader-duels.jsnew file mode 100644index 000000000..7e769c3d4--- /dev/null+++ b/src/trader-duels.js@@ -0,0 +1,45 @@+// Trader duels on a trader profile: the open and live duels featuring this+// trader, with a link to call them. Reads GET /api/duels?agent=<agent id>.+// Mounted by src/trader.js under the syndicates panel. Points only; free to play.++import { esc } from './syndicate-shared.js';+import { until } from './duels-shared.js';++export async function mountTraderDuels(el, { agentId, name, network = 'mainnet' }) {+ if (!el || !agentId) return;+ const who = esc(name || 'this trader');+ el.innerHTML = `<h2>Trader duels</h2><p class="tp-sk" style="width:60%;height:14px;display:block"></p>`;+ let body;+ try {+ const q = new URLSearchParams({ agent: agentId, network, phase: 'all', limit: '6' });+ const r = await fetch(`/api/duels?${q}`, { credentials: 'include', headers: { accept: 'application/json' } });+ if (!r.ok) throw new Error(String(r.status));+ body = await r.json();+ } catch {+ el.innerHTML = `<h2>Trader duels</h2><p>Couldn't load the duels featuring ${who}. <a href="/duels">See every duel</a>.</p>`;+ return;+ }+ const active = (body.duels || []).filter((d) => d.phase === 'open' || d.phase === 'live');+ if (!active.length) {+ el.innerHTML = `+ <h2>Trader duels</h2>+ <p>${who} is not in a duel right now. Duels pair traders who sit next to each other on the 30-day board, and new ones open every UTC day. Free to play; points have no cash value.</p>+ <div class="cp-actions"><a class="lb-btn" href="/duels">See every duel</a></div>`;+ return;+ }+ el.innerHTML = `+ <h2>Call ${who}'s next duel</h2>+ <ul style="list-style:none;margin:0 0 12px;padding:0;display:grid;gap:8px">+ ${active.map((d) => {+ const me = d.a.agent_id === agentId ? d.a : d.b;+ const rival = me === d.a ? d.b : d.a;+ const when = d.phase === 'open' ? `Open · locks in ${until(d.window_start)}` : `Live · ends in ${until(d.window_end)}`;+ return `+ <li><a href="${esc(d.url)}" style="display:flex;align-items:center;justify-content:space-between;gap:12px;text-decoration:none;color:inherit;padding:10px 12px;border:1px solid var(--stroke, #26262b);border-radius:12px">+ <span style="min-width:0"><b style="display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">vs ${esc(rival.name)}</b><small style="opacity:.7">${esc(d.window_kind === 'week' ? 'Week duel' : '24h duel')} · ${esc(when)}</small></span>+ <b style="white-space:nowrap">${d.phase === 'open' ? 'Make your call →' : 'Watch →'}</b>+ </a></li>`;+ }).join('')}+ </ul>+ <div class="cp-actions"><a class="lb-btn" href="/duels?agent=${esc(agentId)}">All duels with ${who}</a></div>`;+}