Skip to content

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

Strategy Lab page, sniper Telegram fields UI, rotating Solana RPC, executor intel-confirmed trigger

nirholas70d9ac6eff73
diff --git a/api/solana-rpc.js b/api/solana-rpc.js
index dca7a3a3d..78a3d83cc 100644
--- a/api/solana-rpc.js
+++ b/api/solana-rpc.js
@@ -18,9 +18,10 @@
import { cors, method, wrap, readJson, error, rateLimited } from './_lib/http.js';
import { limits, clientIp } from './_lib/rate-limit.js';
-
-const PUBLIC_MAINNET = 'https://api.mainnet-beta.solana.com';
-const PUBLIC_DEVNET = 'https://api.devnet.solana.com';
+import {
+ solanaRpcEndpoints,
+ makeRotatingFetch,
+} from './_lib/solana/connection.js';
// Methods a browser Connection needs to read balances/accounts, build, simulate,
// send, and confirm transactions. Deliberately excludes getProgramAccounts and
@@ -69,11 +70,12 @@ function isBoundedProgramScan(entry) {
// calls and sidestep the per-request rate limit.
const MAX_BATCH = 10;
-function upstreamUrl(network) {
- if (network === 'devnet') {
- return process.env.SOLANA_RPC_URL_DEVNET || PUBLIC_DEVNET;
- }
- return process.env.SOLANA_RPC_URL || PUBLIC_MAINNET;
+// Returns a fetch function that rotates across Helius → Alchemy → Ankr → public,
+// skipping any endpoint currently in the process-wide cooldown map (same cooldown
+// state shared by solanaConnection() so a quota-dead provider stays skipped).
+function upstreamFetch(network) {
+ const endpoints = solanaRpcEndpoints(network === 'devnet' ? 'devnet' : 'mainnet');
+ return makeRotatingFetch(endpoints);
}
// Validate one or a batch of JSON-RPC payloads. Returns an error code string,
@@ -129,7 +131,8 @@ export default wrap(async function handler(req, res) {
let upstream;
try {
- upstream = await fetch(upstreamUrl(network), {
+ const rotateFetch = upstreamFetch(network);
+ upstream = await rotateFetch(null, {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify(body),
diff --git a/data/changelog.json b/data/changelog.json
index 29a5ce074..f1f0e0f50 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,20 @@
{
"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-06-16",
+ "title": "Strategy Lab: backtest Oracle strategies before you deploy",
+ "summary": "New standalone page at /strategy-lab lets you pick a conviction tier and time window, then see exactly how that filter would have performed: win rate, graduates, 3×/5× hit count, per-tier breakdown, and the top performers in the window. Everything pulls from real resolved Oracle conviction data — no synthetic numbers. Run a backtest, then deploy directly to the sniper from the results page.",
+ "tags": ["feature"],
+ "link": "/strategy-lab"
+ },
+ {
+ "date": "2026-06-16",
+ "title": "Sniper: personal Telegram trade notifications",
+ "summary": "Each sniper strategy can now send buy and sell alerts to your own Telegram chat instead of (or in addition to) the platform ops channel. Add your Telegram chat ID in the Notifications section of any strategy form on the sniper dashboard. Get instant alerts the moment your agent opens or closes a position, with coin name, size, PnL, and Solscan proof link.",
+ "tags": ["feature"],
+ "link": "/dashboard/sniper"
+ },
{
"date": "2026-06-16",
"title": "Agents: Oracle and Sniper trading status on agent cards",
diff --git a/pages/strategy-lab.html b/pages/strategy-lab.html
new file mode 100644
index 000000000..828941b81
--- /dev/null
+++ b/pages/strategy-lab.html
@@ -0,0 +1,388 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <script>/* three.ws theme boot — no-flash */(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" />
+ <title>Strategy Lab · three.ws</title>
+ <meta name="description" content="Design your agent's trading strategy, backtest it against Oracle conviction history, and deploy it in one click. See exactly how your parameters would have performed." />
+ <meta property="og:type" content="website" />
+ <meta property="og:site_name" content="three.ws" />
+ <meta property="og:url" content="https://three.ws/strategy-lab" />
+ <meta property="og:title" content="Strategy Lab · three.ws" />
+ <meta property="og:description" content="Design, backtest, and deploy autonomous trading strategies powered by Oracle conviction scoring." />
+ <meta property="og:image" content="https://three.ws/og-image.png" />
+ <meta name="twitter:card" content="summary_large_image" />
+ <meta name="twitter:site" content="@trythreews" />
+ <meta name="twitter:title" content="Strategy Lab · three.ws" />
+ <meta name="twitter:description" content="Design, backtest, and deploy your agent's trading strategy. Real Oracle data, real numbers." />
+ <meta name="twitter:image" content="https://three.ws/og-image.png" />
+ <meta name="theme-color" content="#0a0a0a" />
+ <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="/site.webmanifest" />
+ <link rel="stylesheet" href="/fonts/fonts.css" />
+ <link rel="stylesheet" href="/nav.css" />
+ <link rel="stylesheet" href="/footer.css" />
+ <link rel="canonical" href="https://three.ws/strategy-lab" />
+ <style>
+ :root {
+ --sl-bg: #080a10;
+ --sl-panel: rgba(15,18,28,0.9);
+ --sl-border: rgba(255,255,255,0.07);
+ --sl-accent: #a78bfa;
+ --sl-green: #34d399;
+ --sl-red: #f87171;
+ --sl-yellow: #fbbf24;
+ --sl-blue: #60a5fa;
+ --sl-dim: rgba(255,255,255,0.45);
+ --sl-faint: rgba(255,255,255,0.22);
+ --sl-ink: rgba(255,255,255,0.9);
+ }
+ [data-theme="light"] {
+ --sl-bg: #f4f5f9;
+ --sl-panel: rgba(255,255,255,0.92);
+ --sl-border: rgba(0,0,0,0.08);
+ --sl-dim: rgba(0,0,0,0.5);
+ --sl-faint: rgba(0,0,0,0.3);
+ --sl-ink: rgba(0,0,0,0.88);
+ }
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
+ html { background: var(--sl-bg); color: var(--sl-ink); font-family: var(--font-sans, system-ui, sans-serif); font-size: 15px; }
+ body { min-height: 100vh; }
+
+ /* ── layout ── */
+ .sl-shell { max-width: 1200px; margin: 0 auto; padding: 0 20px 80px; }
+ .sl-hero { padding: 72px 0 40px; }
+ .sl-kicker { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--sl-accent); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
+ .sl-kicker::before { content: ''; width: 28px; height: 2px; background: var(--sl-accent); border-radius: 2px; display: block; }
+ .sl-title { font-size: clamp(28px,5vw,48px); font-weight: 700; letter-spacing: -.02em; line-height: 1.1; margin-bottom: 12px; }
+ .sl-sub { font-size: 16px; color: var(--sl-dim); max-width: 560px; line-height: 1.6; }
+
+ .sl-grid { display: grid; grid-template-columns: 380px 1fr; gap: 24px; align-items: start; }
+ @media (max-width: 860px) { .sl-grid { grid-template-columns: 1fr; } }
+
+ /* ── panels ── */
+ .sl-panel { background: var(--sl-panel); border: 1px solid var(--sl-border); border-radius: 14px; padding: 22px; backdrop-filter: blur(12px); }
+ .sl-panel-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--sl-dim); margin-bottom: 18px; }
+
+ /* ── form ── */
+ .sl-form { display: flex; flex-direction: column; gap: 16px; }
+ .sl-field { display: flex; flex-direction: column; gap: 5px; }
+ .sl-label { font-size: 12px; font-weight: 500; color: var(--sl-dim); }
+ .sl-input, .sl-select { background: rgba(255,255,255,0.04); border: 1px solid var(--sl-border); border-radius: 8px; color: var(--sl-ink); font-size: 14px; padding: 9px 12px; width: 100%; outline: none; transition: border-color .15s; }
+ [data-theme="light"] .sl-input, [data-theme="light"] .sl-select { background: rgba(0,0,0,0.04); }
+ .sl-input:focus, .sl-select:focus { border-color: var(--sl-accent); }
+ .sl-hint { font-size: 11px; color: var(--sl-faint); line-height: 1.5; }
+ .sl-run-btn { background: var(--sl-accent); color: #fff; border: none; border-radius: 10px; padding: 13px 24px; font-size: 14px; font-weight: 600; cursor: pointer; transition: opacity .15s, transform .1s; width: 100%; letter-spacing: -.01em; }
+ .sl-run-btn:hover { opacity: .88; }
+ .sl-run-btn:active { transform: scale(.98); }
+ .sl-run-btn:disabled { opacity: .45; cursor: default; }
+
+ .sl-section { margin-top: 4px; }
+ .sl-section-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--sl-faint); margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--sl-border); }
+
+ .sl-deploy-cta { margin-top: 16px; text-align: center; }
+ .sl-deploy-btn { display: inline-block; background: rgba(167,139,250,.12); border: 1px solid var(--sl-accent); color: var(--sl-accent); border-radius: 8px; padding: 10px 20px; font-size: 13px; font-weight: 600; text-decoration: none; transition: background .15s; }
+ .sl-deploy-btn:hover { background: rgba(167,139,250,.22); }
+
+ /* ── results ── */
+ .sl-results { display: flex; flex-direction: column; gap: 20px; min-height: 300px; }
+ .sl-state { display: flex; align-items: center; justify-content: center; min-height: 260px; color: var(--sl-faint); font-size: 14px; flex-direction: column; gap: 12px; text-align: center; }
+ .sl-state-icon { font-size: 36px; opacity: .5; }
+
+ .sl-kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
+ @media (max-width: 680px) { .sl-kpi-row { grid-template-columns: repeat(2, 1fr); } }
+ .sl-kpi { background: var(--sl-panel); border: 1px solid var(--sl-border); border-radius: 12px; padding: 16px; }
+ .sl-kpi-val { font-size: 26px; font-weight: 700; letter-spacing: -.03em; line-height: 1; margin-bottom: 4px; }
+ .sl-kpi-lbl { font-size: 11px; color: var(--sl-dim); text-transform: uppercase; letter-spacing: .06em; }
+ .sl-kpi-sub { font-size: 12px; color: var(--sl-faint); margin-top: 3px; }
+ .sl-pos { color: var(--sl-green); }
+ .sl-neg { color: var(--sl-red); }
+
+ /* ── tier table ── */
+ .sl-tier-table { width: 100%; border-collapse: collapse; font-size: 13px; }
+ .sl-tier-table th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--sl-faint); text-align: left; padding: 0 10px 10px; }
+ .sl-tier-table th:not(:first-child) { text-align: right; }
+ .sl-tier-table td { padding: 9px 10px; border-top: 1px solid var(--sl-border); }
+ .sl-tier-table td:not(:first-child) { text-align: right; color: var(--sl-dim); }
+ .sl-tier-table tr:hover td { background: rgba(255,255,255,.03); }
+ .sl-tier-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
+
+ /* ── top performers ── */
+ .sl-top-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
+ .sl-coin-card { background: var(--sl-panel); border: 1px solid var(--sl-border); border-radius: 10px; padding: 12px 14px; text-decoration: none; color: var(--sl-ink); transition: border-color .15s, transform .1s; display: block; }
+ .sl-coin-card:hover { border-color: var(--sl-accent); transform: translateY(-1px); }
+ .sl-coin-sym { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
+ .sl-coin-ath { font-size: 20px; font-weight: 700; color: var(--sl-green); }
+ .sl-coin-meta { font-size: 11px; color: var(--sl-faint); margin-top: 3px; }
+
+ /* ── period tabs ── */
+ .sl-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
+ .sl-tab { background: transparent; border: 1px solid var(--sl-border); border-radius: 6px; padding: 5px 12px; font-size: 12px; font-weight: 500; color: var(--sl-dim); cursor: pointer; transition: background .12s, color .12s, border-color .12s; }
+ .sl-tab.active { background: var(--sl-accent); border-color: var(--sl-accent); color: #fff; }
+ .sl-tab:hover:not(.active) { border-color: var(--sl-accent); color: var(--sl-accent); }
+
+ /* ── skeleton ── */
+ .sl-sk { background: var(--sl-border); border-radius: 6px; animation: sl-pulse 1.4s ease-in-out infinite; }
+ @keyframes sl-pulse { 0%,100% { opacity: .5; } 50% { opacity: 1; } }
+
+ /* ── tier colors ── */
+ .tier-prime { color: #c084fc; }
+ .tier-strong { color: var(--sl-green); }
+ .tier-lean { color: var(--sl-yellow); }
+ .tier-watch { color: #94a3b8; }
+ .tier-avoid { color: var(--sl-red); }
+ .dot-prime { background: #c084fc; }
+ .dot-strong { background: var(--sl-green); }
+ .dot-lean { background: var(--sl-yellow); }
+ .dot-watch { background: #94a3b8; }
+ .dot-avoid { background: var(--sl-red); }
+ </style>
+</head>
+<body>
+ <header><div id="nav-container"></div></header>
+ <script src="/nav.js"></script>
+
+ <main class="sl-shell">
+ <section class="sl-hero">
+ <p class="sl-kicker">Oracle-powered</p>
+ <h1 class="sl-title">Strategy Lab</h1>
+ <p class="sl-sub">Design your agent's conviction filter, see how it would have performed against real Oracle history, then deploy it in one click.</p>
+ </section>
+
+ <div class="sl-grid">
+ <!-- ── left: strategy configurator ── -->
+ <aside>
+ <div class="sl-panel">
+ <div class="sl-panel-title">Strategy parameters</div>
+ <form class="sl-form" id="sl-form">
+ <div class="sl-section">
+ <div class="sl-section-title">Oracle conviction filter</div>
+ <div class="sl-field">
+ <label class="sl-label" for="sl-tier">Conviction tier</label>
+ <select class="sl-select" id="sl-tier" name="tier">
+ <option value="all">All tiers</option>
+ <option value="prime">Prime only</option>
+ <option value="strong">Strong+</option>
+ <option value="lean">Lean+</option>
+ <option value="watch">Watch+</option>
+ <option value="avoid">Avoid (test only)</option>
+ </select>
+ <span class="sl-hint">Prime = highest conviction. Strong = solid. Lean = OK. Watch = low confidence. Avoid = likely rug or poor setup.</span>
+ </div>
+ </div>
+
+ <div class="sl-section">
+ <div class="sl-section-title">Backtest window</div>
+ <div class="sl-field">
+ <label class="sl-label">Period</label>
+ <div class="sl-tabs" id="sl-period-tabs">
+ <button type="button" class="sl-tab" data-period="1d">1 day</button>
+ <button type="button" class="sl-tab active" data-period="7d">7 days</button>
+ <button type="button" class="sl-tab" data-period="30d">30 days</button>
+ <button type="button" class="sl-tab" data-period="90d">90 days</button>
+ <button type="button" class="sl-tab" data-period="all">All time</button>
+ </div>
+ <span class="sl-hint">Only coins with a resolved outcome (graduated, rugged, or ATH known) are counted — open positions are excluded so the win rate is honest.</span>
+ </div>
+ </div>
+
+ <button type="submit" class="sl-run-btn" id="sl-run">Run backtest</button>
+ </form>
+
+ <div class="sl-deploy-cta">
+ <a class="sl-deploy-btn" href="/dashboard/sniper" id="sl-deploy-link">Deploy this strategy →</a>
+ </div>
+ </div>
+ </aside>
+
+ <!-- ── right: results ── -->
+ <section id="sl-results" class="sl-results">
+ <div class="sl-state" id="sl-state">
+ <div class="sl-state-icon">⚗️</div>
+ <div>Run a backtest to see how your strategy would have performed.</div>
+ <div style="font-size:12px;color:var(--sl-faint)">Powered by real Oracle conviction data from every scored pump.fun launch.</div>
+ </div>
+ </section>
+ </div>
+ </main>
+
+ <script src="/brand.js" defer></script>
+ <div id="footer-container"></div>
+ <script src="/footer.js"></script>
+
+ <script type="module">
+ const TIER_COLOR = { prime: '#c084fc', strong: '#34d399', lean: '#fbbf24', watch: '#94a3b8', avoid: '#f87171' };
+ const TIER_ORDER = ['prime', 'strong', 'lean', 'watch', 'avoid'];
+ const fmt1 = (v) => v != null ? Number(v).toFixed(1) + '×' : '—';
+ const fmtPct = (v) => v != null ? `${Math.round(v)}%` : '—';
+ const esc = (s) => String(s ?? '').replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;');
+
+ let period = '7d';
+ let loading = false;
+
+ // Period tabs
+ document.getElementById('sl-period-tabs').addEventListener('click', (e) => {
+ const btn = e.target.closest('[data-period]');
+ if (!btn) return;
+ period = btn.dataset.period;
+ document.querySelectorAll('.sl-tab').forEach(b => b.classList.toggle('active', b === btn));
+ });
+
+ document.getElementById('sl-form').addEventListener('submit', async (e) => {
+ e.preventDefault();
+ if (loading) return;
+ await runBacktest();
+ });
+
+ async function runBacktest() {
+ const tier = document.getElementById('sl-tier').value;
+ const btn = document.getElementById('sl-run');
+ const results = document.getElementById('sl-results');
+ const state = document.getElementById('sl-state');
+
+ loading = true;
+ btn.disabled = true;
+ btn.textContent = 'Running…';
+
+ // Skeletons while loading
+ results.innerHTML = `
+ <div class="sl-kpi-row">
+ ${[0,1,2,3].map(() => `<div class="sl-kpi"><div class="sl-sk" style="height:26px;width:80%;margin-bottom:6px"></div><div class="sl-sk" style="height:11px;width:55%"></div></div>`).join('')}
+ </div>
+ <div class="sl-panel" style="min-height:180px"><div class="sl-sk" style="height:100%;min-height:180px;width:100%;border-radius:10px"></div></div>
+ <div class="sl-panel" style="min-height:130px"><div class="sl-sk" style="height:100%;min-height:130px;width:100%;border-radius:10px"></div></div>
+ `;
+
+ try {
+ const url = `/api/oracle/backtest?period=${encodeURIComponent(period)}&tier=${encodeURIComponent(tier)}&network=mainnet`;
+ const resp = await fetch(url);
+ if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
+ const data = await resp.json();
+ renderResults(data, tier, period);
+ updateDeployLink(tier);
+ } catch (err) {
+ results.innerHTML = `<div class="sl-state"><div class="sl-state-icon">⚠️</div><div>Backtest unavailable — ${esc(err.message)}. Try again in a moment.</div></div>`;
+ } finally {
+ loading = false;
+ btn.disabled = false;
+ btn.textContent = 'Run backtest';
+ }
+ }
+
+ function updateDeployLink(tier) {
+ const link = document.getElementById('sl-deploy-link');
+ const label = tier === 'all' ? 'Deploy to sniper →' : `Deploy ${tier} strategy →`;
+ link.textContent = label;
+ // Append tier as a query hint for the sniper page (cosmetic — sniper reads DB)
+ link.href = `/dashboard/sniper`;
+ }
+
+ function renderResults(data, tier, per) {
+ const agg = data.aggregate || {};
+ const rows = (data.tiers || []).sort((a, b) => TIER_ORDER.indexOf(a.tier) - TIER_ORDER.indexOf(b.tier));
+ const top = data.top_performers || [];
+
+ const winRate = agg.win_rate;
+ const resolved = (agg.wins || 0) + (agg.losses || 0);
+ const winRateClass = winRate >= 60 ? 'sl-pos' : winRate < 40 ? 'sl-neg' : '';
+
+ const tierLabel = tier === 'all' ? 'All tiers' : tier.charAt(0).toUpperCase() + tier.slice(1);
+ const periodLabel = { '1d': 'Last 24 h', '7d': 'Last 7 days', '30d': 'Last 30 days', '90d': 'Last 90 days', all: 'All time' }[per] || per;
+
+ const noData = !agg.total || agg.total === 0;
+
+ document.getElementById('sl-results').innerHTML = `
+ <div style="display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap">
+ <div style="font-size:13px;color:var(--sl-dim)">${esc(tierLabel)} · ${esc(periodLabel)} · ${(agg.total || 0).toLocaleString()} resolved</div>
+ ${noData ? '<div style="font-size:12px;color:var(--sl-faint)">No resolved outcomes yet in this window</div>' : ''}
+ </div>
+
+ <div class="sl-kpi-row">
+ <div class="sl-kpi">
+ <div class="sl-kpi-val ${winRateClass}">${fmtPct(winRate)}</div>
+ <div class="sl-kpi-lbl">Win rate</div>
+ <div class="sl-kpi-sub">${resolved ? `${agg.wins}W / ${agg.losses}L` : 'no data'}</div>
+ </div>
+ <div class="sl-kpi">
+ <div class="sl-kpi-val">${agg.graduated || 0}</div>
+ <div class="sl-kpi-lbl">Graduated</div>
+ <div class="sl-kpi-sub">to Raydium</div>
+ </div>
+ <div class="sl-kpi">
+ <div class="sl-kpi-val sl-pos">${agg.three_x || 0}</div>
+ <div class="sl-kpi-lbl">Hit 3×+</div>
+ <div class="sl-kpi-sub">${agg.total ? `${Math.round(((agg.three_x||0)/agg.total)*100)}% of scored` : '—'}</div>
+ </div>
+ <div class="sl-kpi">
+ <div class="sl-kpi-val sl-pos">${agg.five_x || 0}</div>
+ <div class="sl-kpi-lbl">Hit 5×+</div>
+ <div class="sl-kpi-sub">${agg.total ? `${Math.round(((agg.five_x||0)/agg.total)*100)}% of scored` : '—'}</div>
+ </div>
+ </div>
+
+ ${rows.length > 1 ? `
+ <div class="sl-panel">
+ <div class="sl-panel-title">Per-tier breakdown</div>
+ <table class="sl-tier-table">
+ <thead>
+ <tr>
+ <th>Tier</th>
+ <th>Win rate</th>
+ <th>Resolved</th>
+ <th>3×+</th>
+ <th>5×+</th>
+ <th>Avg ATH</th>
+ </tr>
+ </thead>
+ <tbody>
+ ${rows.map(r => {
+ const wr = r.win_rate;
+ const wrClass = wr >= 60 ? 'sl-pos' : wr < 40 ? 'sl-neg' : '';
+ return `<tr>
+ <td><span class="sl-tier-dot dot-${esc(r.tier)}"></span><span class="tier-${esc(r.tier)}" style="font-weight:600">${esc(r.tier)}</span></td>
+ <td><span class="${wrClass}">${fmtPct(wr)}</span></td>
+ <td>${(r.wins + r.losses).toLocaleString()}</td>
+ <td>${r.three_x || 0}</td>
+ <td>${r.five_x || 0}</td>
+ <td>${fmt1(r.avg_ath)}</td>
+ </tr>`;
+ }).join('')}
+ </tbody>
+ </table>
+ </div>` : ''}
+
+ ${top.length ? `
+ <div class="sl-panel">
+ <div class="sl-panel-title">Top performers in this window</div>
+ <div class="sl-top-grid">
+ ${top.map(c => `
+ <a class="sl-coin-card" href="/oracle?mint=${encodeURIComponent(c.mint)}" title="Open Oracle conviction for ${esc(c.symbol || c.name)}">
+ <div class="sl-coin-sym">${esc(c.symbol || c.name || c.mint.slice(0,6))}</div>
+ <div class="sl-coin-ath">${c.ath_multiple != null ? Number(c.ath_multiple).toFixed(1) + '×' : c.graduated ? 'Grad' : '—'}</div>
+ <div class="sl-coin-meta tier-${esc(c.tier)}">${esc(c.tier)}${c.score != null ? ` · ${c.score}` : ''}</div>
+ </a>
+ `).join('')}
+ </div>
+ </div>` : ''}
+
+ <div class="sl-panel" style="background:rgba(167,139,250,.06);border-color:rgba(167,139,250,.2)">
+ <div style="font-size:13px;font-weight:600;margin-bottom:8px">Ready to deploy?</div>
+ <p style="font-size:13px;color:var(--sl-dim);line-height:1.6;margin-bottom:14px">
+ Your agent can act on Oracle conviction automatically. Arm a sniper strategy with a min conviction tier and let it trade while you sleep.
+ </p>
+ <div style="display:flex;gap:10px;flex-wrap:wrap">
+ <a class="sl-deploy-btn" href="/dashboard/sniper">Open Sniper →</a>
+ <a class="sl-deploy-btn" href="/oracle" style="background:transparent;border-color:var(--sl-border);color:var(--sl-dim)">Browse Oracle →</a>
+ </div>
+ </div>
+ `;
+ }
+
+ // Auto-run with default params on load
+ runBacktest();
+ </script>
+</body>
+</html>
diff --git a/src/avatar-pose.js b/src/avatar-pose.js
index 8b4edd55f..25c99c897 100644
--- a/src/avatar-pose.js
+++ b/src/avatar-pose.js
@@ -16,7 +16,7 @@ import {
WebGLRenderer,
Box3,
Vector3,
- Clock,
+ Timer,
HemisphereLight,
DirectionalLight,
AmbientLight,
@@ -73,7 +73,7 @@ export class PoseStage {
this.scene = null;
this.camera = null;
this.controls = null;
- this.clock = new Clock();
+ this.clock = new Timer();
this.model = null;
this.anim = new AnimationManager();
@@ -201,10 +201,11 @@ export class PoseStage {
start() {
if (this._running || this._disposed) return;
this._running = true;
- this.clock.getDelta(); // discard the gap accumulated while hidden
+ this.clock.update(); // discard the gap accumulated while hidden
const tick = () => {
if (!this._running) return;
this._frame = requestAnimationFrame(tick);
+ this.clock.update();
const delta = this.clock.getDelta();
this.anim.update(delta);
this.controls.update();
diff --git a/src/dashboard-next/pages/sniper.js b/src/dashboard-next/pages/sniper.js
index 979e643f8..b89988f74 100644
--- a/src/dashboard-next/pages/sniper.js
+++ b/src/dashboard-next/pages/sniper.js
@@ -98,6 +98,9 @@ const STYLE = `<style>
.sn-field input, .sn-field select { background: var(--nxt-bg-2); border: 1px solid var(--nxt-stroke); border-radius: var(--nxt-radius-sm); color: var(--nxt-ink); padding: 7px 10px; font-size: 13px; font-family: inherit; width: 100%; transition: border-color .12s; }
.sn-field input:focus, .sn-field select:focus { outline: none; border-color: var(--nxt-accent); }
.sn-field .sn-hint { font-size: 11px; color: var(--nxt-ink-faint); }
+.sn-field-full { grid-column: 1 / -1; }
+.sn-link { color: var(--nxt-accent); text-decoration: none; }
+.sn-link:hover { text-decoration: underline; }
.sn-section-head { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--nxt-ink-dim); margin: 16px 0 8px; grid-column: 1 / -1; }
.sn-save-row { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.sn-btn { font-size: 13px; padding: 8px 18px; border-radius: var(--nxt-radius-sm); border: 1px solid transparent; cursor: pointer; transition: opacity .14s, transform .14s; }
@@ -434,6 +437,13 @@ function stratForm(s) {
${s.trigger === 'first_claim' ? firstClaimFields(s) : ''}
${s.trigger === 'intel_confirmed' ? intelFields(s) : ''}
+ <div class="sn-section-head">Notifications</div>
+ <div class="sn-field sn-field-full">
+ <label>Telegram chat ID (optional)</label>
+ <input name="telegram_chat_id" type="text" inputmode="numeric" value="${s.telegram_chat_id || ''}" placeholder="e.g. 123456789" autocomplete="off" />
+ <span class="sn-hint">Get buy/sell alerts in your own Telegram chat. Message <a class="sn-link" href="https://t.me/userinfobot" target="_blank" rel="noopener">@userinfobot</a> to find your chat ID, then forward its reply here. Leave blank to use the platform ops channel.</span>
+ </div>
+
<div class="sn-save-row">
<button type="submit" class="sn-btn primary" data-save="${esc(s.agent_id)}">Save changes</button>
<span class="sn-save-msg" data-msg="${esc(s.agent_id)}"></span>
@@ -781,6 +791,7 @@ async function saveForm(form, root) {
require_socials: fd.require_socials === 'true',
require_sol_quote: fd.require_sol_quote !== 'false',
min_oracle_score: fd.min_oracle_score !== '' ? Math.round(Number(fd.min_oracle_score)) : null,
+ telegram_chat_id: fd.telegram_chat_id && /^-?[0-9]+$/.test(fd.telegram_chat_id.trim()) ? fd.telegram_chat_id.trim() : null,
};
if (fd.trigger === 'first_claim') {
body.min_claim_lamports = fd.min_claim_lamports_sol !== '' ? solToLamports(fd.min_claim_lamports_sol) : null;
diff --git a/src/play-agent-wallet.js b/src/play-agent-wallet.js
index 0f82dae4f..8c40cd549 100644
--- a/src/play-agent-wallet.js
+++ b/src/play-agent-wallet.js
@@ -11,7 +11,7 @@
// the side panel in lockstep. No mocks: the $0.01 leaves the wallet for real.
import {
- Scene, PerspectiveCamera, WebGLRenderer, Group, Clock, Color, FogExp2,
+ Scene, PerspectiveCamera, WebGLRenderer, Group, Timer, Color, FogExp2,
HemisphereLight, DirectionalLight, Mesh, MeshStandardMaterial, MeshBasicMaterial,
CircleGeometry, BoxGeometry, PlaneGeometry, RingGeometry, CylinderGeometry,
CanvasTexture, SRGBColorSpace, DoubleSide, GridHelper, Vector3, MathUtils,
@@ -414,7 +414,7 @@ function drawBoard() {
// ── render loop ─────────────────────────────────────────────────────────────
-const clock = new Clock();
+const clock = new Timer();
let redrawAcc = 0;
function resize() {
const w = stageEl.clientWidth, h = stageEl.clientHeight;
@@ -426,6 +426,7 @@ new ResizeObserver(resize).observe(stageEl);
resize();
renderer.setAnimationLoop(() => {
+ clock.update();
const dt = Math.min(clock.getDelta(), 0.1);
t += dt;
if (avatarReady) { tickWalk(dt); anim.update(dt); }
diff --git a/src/scene-compose.js b/src/scene-compose.js
index 6ab783888..50c7f0f50 100644
--- a/src/scene-compose.js
+++ b/src/scene-compose.js
@@ -2,7 +2,7 @@
* Scene Composer — real-time multi-object 3D editor with Forge integration.
*
* Improvements over v1:
- * - THREE.Clock + AnimationMixer: avatar animations play automatically
+ * - THREE.Timer + AnimationMixer: avatar animations play automatically
* - Undo/redo command system (Ctrl+Z / Ctrl+Y), 50-deep stack
* - F to frame/focus the selected object (smooth dolly)
* - Ctrl+D to duplicate selected object
@@ -191,7 +191,7 @@ rimLight.position.set(0, 5, -8);
scene.add(rimLight);
// Clock + mixer
-const clock = new THREE.Clock();
+const clock = new THREE.Timer();
let mixer = null;
// ── Resize ────────────────────────────────────────────────────────────────────
@@ -208,6 +208,7 @@ resize();
// ── Render loop ───────────────────────────────────────────────────────────────
function animate() {
requestAnimationFrame(animate);
+ clock.update();
const delta = clock.getDelta();
if (mixer) mixer.update(delta);
orbit.update();
diff --git a/workers/agent-sniper/executor.js b/workers/agent-sniper/executor.js
index 7c6649e76..8cd0b0c88 100644
--- a/workers/agent-sniper/executor.js
+++ b/workers/agent-sniper/executor.js
@@ -124,7 +124,7 @@ export async function executeBuy({ cfg, strat, mint, throttle }) {
WHERE id = ${posId}
`;
log.trade('buy', { ...tag, mode: cfg.mode, sig, sol: lamportsToSol(perTrade), base: baseAmount.toString(), impact: Number(quote.priceImpactPct).toFixed(2) });
- notifyBuy({ agentName: strat.agent_name || strat.agent_id, symbol: mint.symbol, mint: mint.mint, solSpent: lamportsToSol(perTrade), mode: cfg.mode, sig });
+ notifyBuy({ agentName: strat.agent_name || strat.agent_id, symbol: mint.symbol, mint: mint.mint, solSpent: lamportsToSol(perTrade), mode: cfg.mode, sig, chatId: strat.telegram_chat_id || null });
return { status: 'open', sig };
} catch (err) {
return await fail(posId, tag, errCode(err), err);
@@ -182,7 +182,7 @@ export async function executeSell({ cfg, position, reason }) {
WHERE id = ${position.id}
`;
log.trade('sell', { ...tag, mode: cfg.mode, sig, pnl_sol: lamportsToSol(pnl), pnl_pct: pnlPct.toFixed(1) });
- notifySell({ agentName: position.agent_name || position.agent_id, symbol: position.symbol, mint: position.mint, pnlSol: lamportsToSol(pnl), pnlPct, exitReason: reason, mode: cfg.mode, sig });
+ notifySell({ agentName: position.agent_name || position.agent_id, symbol: position.symbol, mint: position.mint, pnlSol: lamportsToSol(pnl), pnlPct, exitReason: reason, mode: cfg.mode, sig, chatId: position.telegram_chat_id || null });
return { status: 'closed', sig, pnl: pnl.toString() };
} catch (err) {
// A failed sell must NOT terminate the position — leave it 'open' so the
diff --git a/workers/agent-sniper/strategy-store.js b/workers/agent-sniper/strategy-store.js
index 7519a52c0..bd7932e9a 100644
--- a/workers/agent-sniper/strategy-store.js
+++ b/workers/agent-sniper/strategy-store.js
@@ -59,7 +59,7 @@ export async function getOpenPositions(network) {
return sql`
SELECT p.*, s.take_profit_pct, s.stop_loss_pct, s.trailing_stop_pct,
s.max_hold_seconds, s.slippage_bps, s.user_id AS strat_user_id,
- s.kill_switch
+ s.kill_switch, s.telegram_chat_id
FROM agent_sniper_positions p
JOIN agent_sniper_strategies s ON s.id = p.strategy_id
WHERE p.network = ${network}