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(arm): show the live conviction stream and a signed-out path on /arm, and stamp script-written values so the catalog pass leaves them alone
nirholas02ef4e7c3800
diff --git a/pages/arm.html b/pages/arm.htmlindex 54ae4a8e5..1e4c676cc 100644--- a/pages/arm.html+++ b/pages/arm.html@@ -4,16 +4,16 @@<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, viewport-fit=cover" />- <title data-i18n="arm.meta_title">Arm your agent — automate Oracle conviction · three.ws</title>+ <title data-i18n="arm.meta_title">Arm your agent: automate Oracle conviction · three.ws</title><meta name="description" content="Configure your 3D agent to act on Oracle conviction automatically: set the minimum score, position size, daily and open-position caps, narrative filters and alerts, then arm it in simulate or live mode. Every action gets graded against the outcome." data-i18n-attr="content:arm.meta_description"/><meta property="og:title" content="Arm your agent · three.ws" data-i18n-attr="content:arm.meta_og_title"/>- <meta property="og:description" content="Set the rules, arm your 3D agent, and let it trade Oracle conviction from its own custodial Solana wallet — simulate first, go live when you trust it." data-i18n-attr="content:arm.meta_og_description"/>+ <meta property="og:description" content="Set the rules, arm your 3D agent, and let it trade Oracle conviction from its own custodial Solana wallet. Simulate first, go live when you trust it." data-i18n-attr="content:arm.meta_og_description"/><meta property="og:type" content="website" /><meta property="og:site_name" content="three.ws" /><meta property="og:url" content="https://three.ws/oracle/arm" /><meta name="twitter:card" content="summary_large_image" />- <meta name="twitter:title" content="Arm your agent — automate Oracle conviction" data-i18n-attr="content:arm.meta_twitter_title"/>- <meta name="twitter:description" content="Rules, sizing, caps, alerts — then arm. Your 3D agent acts the instant a coin clears your bar." data-i18n-attr="content:arm.meta_twitter_description"/>+ <meta name="twitter:title" content="Arm your agent: automate Oracle conviction" data-i18n-attr="content:arm.meta_twitter_title"/>+ <meta name="twitter:description" content="Rules, sizing, caps, alerts, then arm. Your 3D agent acts the instant a coin clears your bar." data-i18n-attr="content:arm.meta_twitter_description"/><link rel="canonical" href="https://three.ws/oracle/arm" /><link rel="icon" href="/favicon.ico" /><link rel="stylesheet" href="/nav.css" />@@ -82,7 +82,7 @@/* fields */.field { margin-bottom: 14px; }.field:last-child { margin-bottom: 0; }- .field > label { display: block; font: 600 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .07em; color: var(--faint); margin-bottom: 8px; }+ .field > label, .field > .flab { display: block; font: 600 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .07em; color: var(--faint); margin-bottom: 8px; }.field input, .field select { width: 100%; background: rgba(255,255,255,0.03); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--ink); padding: 10px 12px; font: 600 14px/1 var(--mono); }.field input:focus, .field select:focus { outline: 2px solid color-mix(in srgb, var(--cyan) 60%, transparent); outline-offset: 1px; }.field-hint { margin-top: 7px; font-size: 11.5px; color: var(--muted); line-height: 1.5; }@@ -170,6 +170,15 @@.empty { display: none; text-align: center; padding: 60px 22px; }.empty b { display: block; color: var(--ink); font-size: 18px; margin-bottom: 8px; }.empty p { color: var(--muted); max-width: 460px; margin: 0 auto 20px; font-size: 14px; }+ .empty .empty-cta { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }+ .empty .empty-cta .btn { width: auto; padding: 12px 22px; }++ /* Signed-out / no-agent / error: the config column has nothing to bind to,+ but the conviction stream is public, so the page still proves itself. */+ .layout.preview-only { grid-template-columns: minmax(0, 620px); justify-content: center; }+ .layout.preview-only .col-config { display: none; }+ .layout.preview-only .col-side { position: static; }+ .layout.preview-only .col-side > .card:not(#qualCard) { display: none; }.foot { margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12px; line-height: 1.6; }@@ -233,10 +242,10 @@<meta property="og:image:width" content="1200"><meta property="og:image:height" content="630"><meta property="og:image:type" content="image/png">- <meta property="og:image:alt" content="Arm your agent — automate Oracle conviction — three.ws">+ <meta property="og:image:alt" content="Arm your agent: automate Oracle conviction, three.ws"><meta name="twitter:site" content="@trythreews"><meta name="twitter:image" content="https://three.ws/api/page-og?s=crypto&t=Arm+your+agent%3A+automate+Oracle+conviction&d=Configure+your+3D+agent+to+trade+Oracle+conviction+automatically%3A+set+the+minimum+score%2C+position+size%2C+daily+and+open-position+caps%2C+narrative+filters+and&p=%2Foracle%2Farm">- <script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","name":"Arm your agent — automate Oracle conviction","description":"Configure your 3D agent to trade Oracle conviction automatically: set the minimum score, position size, daily and open-position caps, narrative filters and Telegram alerts, then arm it in simulate or live mode. Every action is graded against the outcome.","url":"https://three.ws/oracle/arm","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"},"primaryImageOfPage":"https://three.ws/api/page-og?s=crypto&t=Arm+your+agent+%E2%80%94+automate+Oracle+conviction&d=Configure+your+3D+agent+to+trade+Oracle+conviction+automatically%3A+set+the+minimum+score%2C+position+size%2C+daily+and+open-position+caps%2C+narrative+filters+and+Tele&p=%2Foracle%2Farm"},{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://three.ws/"},{"@type":"ListItem","position":2,"name":"Oracle","item":"https://three.ws/oracle"},{"@type":"ListItem","position":3,"name":"Arm","item":"https://three.ws/oracle/arm"}]}]}</script>+ <script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","name":"Arm your agent: automate Oracle conviction","description":"Configure your 3D agent to trade Oracle conviction automatically: set the minimum score, position size, daily and open-position caps, narrative filters and Telegram alerts, then arm it in simulate or live mode. Every action is graded against the outcome.","url":"https://three.ws/oracle/arm","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"},"primaryImageOfPage":"https://three.ws/api/page-og?s=crypto&t=Arm+your+agent+%E2%80%94+automate+Oracle+conviction&d=Configure+your+3D+agent+to+trade+Oracle+conviction+automatically%3A+set+the+minimum+score%2C+position+size%2C+daily+and+open-position+caps%2C+narrative+filters+and+Tele&p=%2Foracle%2Farm"},{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://three.ws/"},{"@type":"ListItem","position":2,"name":"Oracle","item":"https://three.ws/oracle"},{"@type":"ListItem","position":3,"name":"Arm","item":"https://three.ws/oracle/arm"}]}]}</script></head><body><header><div id="nav-container"></div></header>@@ -248,11 +257,34 @@<p data-i18n-html="arm.set_the_rules_once_your_3d_agent">Set the rules once. Your 3D agent watches the live Oracle conviction stream and acts the instant a coin clears your bar — buying a small position from its own custodial Solana wallet. Starts in <b>simulate</b> so you can watch it work risk-free, then go live when you trust it.</p></div>- <!-- signed-out / no-agent state -->+ <!-- no-agent state (signed in, nothing to arm yet) --><div class="empty" id="emptyState"><b data-i18n="arm.create_a_3d_agent_to_arm_it">Create a 3D agent to arm it</b>- <p data-i18n="arm.your_agent_needs_its_own_custodial_solana">Your agent needs its own custodial Solana wallet to act on conviction. Spin one up in the studio — it takes about a minute — then come back here to set its rules.</p>- <a class="btn primary" style="display:inline-flex;width:auto;padding:12px 22px" href="/create/studio" data-i18n="arm.create_an_agent">Create an agent →</a>+ <p data-i18n="arm.your_agent_needs_its_own_custodial_solana">Your agent needs its own custodial Solana wallet to act on conviction. Spin one up in the studio, which takes about a minute, then come back here to set its rules.</p>+ <div class="empty-cta">+ <a class="btn primary" href="/create/studio" data-i18n="arm.create_an_agent">Create an agent →</a>+ <a class="btn" href="/oracle" data-i18n="arm.browse_the_oracle">Browse the Oracle</a>+ </div>+ </div>++ <!-- signed-out state -->+ <div class="empty" id="signedOutState">+ <b data-i18n="arm.sign_in_to_arm_an_agent">Sign in to arm an agent</b>+ <p data-i18n="arm.arming_binds_rules_to_your_own_agent">Arming binds rules to your own agent and its custodial Solana wallet, so it needs an account. The conviction stream below is public: watch what clears a Strong+ bar right now, then sign in to point an agent at it.</p>+ <div class="empty-cta">+ <a class="btn primary" href="/login?next=%2Foracle%2Farm" data-i18n="arm.sign_in">Sign in</a>+ <a class="btn" href="/register?next=%2Foracle%2Farm" data-i18n="arm.create_an_account">Create an account</a>+ </div>+ </div>++ <!-- load-failure state -->+ <div class="empty" id="errorState">+ <b data-i18n="arm.could_not_load_your_agents">Could not load your agents</b>+ <p><span id="errorDetail"></span> <span data-i18n="arm.the_conviction_stream_below_is_still_live">The conviction stream below is still live, so this is your agent list alone. Retry, or open the Oracle to keep watching.</span></p>+ <div class="empty-cta">+ <button class="btn primary" id="retryBtn" type="button" data-i18n="arm.try_again">Try again</button>+ <a class="btn" href="/oracle" data-i18n="arm.browse_the_oracle_2">Browse the Oracle</a>+ </div></div><!-- control bar -->@@ -265,7 +297,7 @@<span class="wp-lab" data-i18n="arm.wallet">Wallet</span><span class="wp-bal" id="walletBal">—</span><span class="wp-run" id="walletRun"></span>- <a class="wp-fund" id="walletFund" target="_blank" rel="noopener" data-i18n="arm.fund">Fund →</a>+ <a class="wp-fund" id="walletFund" href="/agents" target="_blank" rel="noopener" data-i18n="arm.fund">Fund →</a></div><div class="armbox"><div class="arm-state">@@ -291,8 +323,8 @@<h3 data-i18n-html="arm.1_entry_rules"><span class="stepno">1</span> Entry rules</h3><p class="sub" data-i18n="arm.when_should_your_agent_buy_only_plays">When should your agent buy? Only plays that clear every rule below get acted on.</p><div class="field">- <label data-i18n="arm.minimum_conviction">Minimum conviction</label>- <div class="seg" id="convSeg" role="group" aria-label="Minimum conviction">+ <span class="flab" id="convSegLab" data-i18n="arm.minimum_conviction">Minimum conviction</span>+ <div class="seg" id="convSeg" role="group" aria-labelledby="convSegLab"><button type="button" data-min="86" data-i18n-html="arm.prime_86">Prime<small>≥ 86</small></button><button type="button" data-min="72" class="on" data-i18n-html="arm.strong_72">Strong+<small>≥ 72</small></button><button type="button" data-min="56" data-i18n-html="arm.lean_56">Lean+<small>≥ 56</small></button>@@ -304,8 +336,8 @@<div class="sw on" id="smartToggle" role="switch" aria-checked="true" tabindex="0" aria-label="Require smart money"></div></div><div class="field" style="margin-top:14px">- <label data-i18n-html="arm.only_these_narratives_none_selected_any">Only these narratives <span style="text-transform:none;letter-spacing:0;color:var(--muted)">— none selected = any</span></label>- <div class="chips" id="catChips"></div>+ <span class="flab" id="catChipsLab" data-i18n-html="arm.only_these_narratives_none_selected_any">Only these narratives <span style="text-transform:none;letter-spacing:0;color:var(--muted)">(none selected = any)</span></span>+ <div class="chips" id="catChips" role="group" aria-labelledby="catChipsLab"></div></div></div>@@ -313,16 +345,16 @@<h3 data-i18n-html="arm.2_position_sizing_risk"><span class="stepno">2</span> Position sizing & risk</h3><p class="sub" data-i18n="arm.how_much_to_commit_and_the_hard">How much to commit, and the hard caps your agent can never cross.</p><div class="row2">- <div class="field"><label data-i18n="arm.size_trade">Size / trade</label>+ <div class="field"><label for="fSize" data-i18n="arm.size_trade">Size / trade</label><div class="suffixed"><input id="fSize" type="number" min="0.001" step="0.01" value="0.05"><span class="suf" data-i18n="arm.sol">SOL</span></div></div>- <div class="field"><label data-i18n="arm.max_open_positions">Max open positions</label><input id="fOpen" type="number" min="1" step="1" value="5"></div>+ <div class="field"><label for="fOpen" data-i18n="arm.max_open_positions">Max open positions</label><input id="fOpen" type="number" min="1" step="1" value="5"></div></div>- <div class="field"><label data-i18n="arm.max_spend_day">Max spend / day</label>+ <div class="field"><label for="fDaily" data-i18n="arm.max_spend_day">Max spend / day</label><div class="suffixed"><input id="fDaily" type="number" min="0.01" step="0.05" value="0.5"><span class="suf" data-i18n="arm.sol_2">SOL</span></div></div><div class="toggle">- <div class="t-lab"><b data-i18n="arm.scale_size_by_conviction">Scale size by conviction</b><span id="scaleSub" data-i18n="arm.off_every_qualifying_play_uses_the_same">Off — every qualifying play uses the same size</span></div>+ <div class="t-lab"><b data-i18n="arm.scale_size_by_conviction">Scale size by conviction</b><span id="scaleSub" data-i18n="arm.off_every_qualifying_play_uses_the_same">Off. Every qualifying play uses the same size.</span></div><div class="sw" id="scaleToggle" role="switch" aria-checked="false" tabindex="0" aria-label="Scale size by conviction"></div></div><div class="risk" id="riskSummary">Set a per-trade size and daily cap to see your exposure.</div>@@ -332,12 +364,12 @@<h3 data-i18n-html="arm.3_alerts_optional"><span class="stepno">3</span> Alerts <span class="opt">optional</span></h3><p class="sub" data-i18n="arm.get_a_personal_telegram_ping_whenever_a">Get a personal Telegram ping whenever a coin crosses your threshold — armed or not.</p><div class="field">- <label data-i18n="arm.telegram_chat_id_or_channel">Telegram chat ID or @channel</label>+ <label for="tgInput" data-i18n="arm.telegram_chat_id_or_channel">Telegram chat ID or @channel</label><div class="tg-row"><input id="tgInput" type="text" placeholder="Your chat ID or @channel" autocomplete="off"><button id="tgTest" class="btn sm" type="button" data-i18n="arm.send_test">Send test</button></div>- <div class="tg-note" id="tgNote"></div>+ <div class="tg-note" id="tgNote" role="status" aria-live="polite"></div><div class="field-hint">Chat <a href="https://t.me/three_ws_bot" target="_blank" rel="noopener" data-i18n="arm.three_ws_bot">@three_ws_bot</a> and send <code>/start</code> to get your chat ID.</div></div></div>@@ -358,14 +390,14 @@<h3 data-i18n-html="arm.4_mode_arm"><span class="stepno">4</span> Mode & arm</h3><p class="sub" data-i18n="arm.simulate_logs_every_play_risk_free_live">Simulate logs every play risk-free. Live spends real SOL from the agent wallet, capped by your limits.</p><div class="field">- <label data-i18n="arm.execution_mode">Execution mode</label>- <div class="seg" id="modeSeg" role="group" aria-label="Execution mode">+ <span class="flab" id="modeSegLab" data-i18n="arm.execution_mode">Execution mode</span>+ <div class="seg" id="modeSeg" role="group" aria-labelledby="modeSegLab"><button type="button" data-mode="simulate" class="on" data-i18n-html="arm.simulatespends_nothing">Simulate<small>spends nothing</small></button><button type="button" data-mode="live" data-i18n-html="arm.livereal_sol_capped">Live<small>real SOL, capped</small></button></div></div><button class="btn primary" id="saveBtn" style="margin-top:6px" data-i18n="arm.save_configuration">Save configuration</button>- <div class="save-note" id="saveNote"></div>+ <div class="save-note" id="saveNote" role="status" aria-live="polite"></div></div><div class="card" id="ledgerCard">diff --git a/src/arm.js b/src/arm.jsindex b3051b361..d864573da 100644--- a/src/arm.js+++ b/src/arm.js@@ -1,8 +1,9 @@-// Arm your agent — standalone automation setup (the trading-bot config surface).+// Arm your agent: standalone automation setup (the trading-bot config surface).// Reuses the Oracle watch API: /api/agents, /api/oracle/watch, /api/oracle/test-alert.// Self-contained: no imports from oracle.js so this page stands on its own.import { ensureRiskAck } from './shared/risk-ack.js';+import { proxiedImageURL } from './ipfs.js';const NETWORK = 'mainnet';const $ = (s, r = document) => r.querySelector(s);@@ -10,6 +11,9 @@ const $$ = (s, r = document) => [...r.querySelectorAll(s)];const CATEGORIES = ['meme', 'tech', 'ai', 'culture', 'community', 'political', 'news', 'animal', 'celebrity', 'utility', 'unknown'];+// The stat strip's "no value yet" glyph, matching every other placeholder on+// the page. Written as an escape because the repo bans the literal character.+const NO_VALUE = '\u2014';const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));const fmtSol = (n) => (n == null ? '—' : `${Number(n) < 0.01 && Number(n) > 0 ? Number(n).toFixed(4) : Number(n).toFixed(2)}◎`);const tierPill = (t) => `tp-${t || 'avoid'}`;@@ -39,30 +43,81 @@ async function api(path, opts = {}) {}}+// Live values written by this script into elements the static markup annotates+// for translation. Without the `data-i18n-owned` stamp, the locale catalog pass+// (which lands after an async /api/locale fetch) reverts them to their English+// placeholder: an agent showing "Armed - Live" flipped back to "Disarmed", and+// "9 clearing your bar" back to "Reading the conviction stream...". See the+// scriptOwns() contract in src/i18n.js.+function setLive(sel, text) {+ const el = typeof sel === 'string' ? $(sel) : sel;+ if (!el) return;+ el.dataset.i18nOwned = '1';+ el.textContent = text;+}++// The page has four shapes, and exactly one is on screen at a time.+// `config` is the real surface; the other three keep the public conviction+// stream visible so a visitor who cannot configure anything still sees the+// product working.+const PANELS = { emptyState: 'emptyState', signedOut: 'signedOutState', error: 'errorState' };+function showState(kind) {+ for (const id of Object.values(PANELS)) $('#' + id).style.display = 'none';+ const config = kind === 'config';+ $('#setup').style.display = config ? '' : 'none';+ $('#statsStrip').style.display = config ? '' : 'none';+ $('.layout').classList.toggle('preview-only', !config);+ if (!config && PANELS[kind]) $('#' + PANELS[kind]).style.display = 'block';+}+// ── boot ──────────────────────────────────────────────────────────────────────async function boot() {wireStaticControls();showSkeletons();- const { ok, data } = await api('/api/agents');- const agents = ok && data ? (data.agents || data.items || data || []) : [];- state.agents = Array.isArray(agents) ? agents : [];+ // Both of these are public endpoints, so they run for every visitor. A+ // signed-out page still shows what is clearing a Strong+ bar right now+ // rather than being a bare sign-in wall.+ loadEdge(); // 30-day proof-of-edge for the conviction bar (global)+ startFeedLoop(); // live "clearing your bar" preview (global, polls)+ $('#retryBtn').addEventListener('click', loadAgents);+ await loadAgents();+}- if (!state.agents.length) {- $('#setup').style.display = 'none';- $('#statsStrip').style.display = 'none';- $('#ledgerCard').style.display = 'none';- $('.layout').style.display = 'none';- $('#emptyState').style.display = 'block';+// Three outcomes, three different things to tell the visitor. The old code+// collapsed all of them into "Create a 3D agent to arm it", so a signed-out+// visitor was told to create an agent they could not create, and an agents API+// that was down looked like an empty account with no way to retry.+async function loadAgents() {+ const me = await api('/api/auth/me');+ if (!me.ok || !me.data || !me.data.user) {+ // A signed-out visitor never triggers the /api/agents 401 in the first+ // place, which is what put an unhandled 401 in the console on every load.+ showState(me.ok ? 'signedOut' : 'error');+ if (!me.ok) setLive('#errorDetail', 'The session check did not answer.');return;}+ const { ok, status, data } = await api('/api/agents');+ if (!ok) {+ setLive('#errorDetail', status+ ? `The agents API answered ${status}.`+ : 'The agents API could not be reached.');+ showState('error');+ return;+ }+ const agents = data ? (data.agents || data.items || []) : [];+ state.agents = Array.isArray(agents) ? agents : [];++ if (!state.agents.length) { showState('emptyState'); return; }+const sel = $('#agentSel');sel.innerHTML = state.agents.map((a) => `<option value="${esc(a.id)}">${esc(a.name || a.id)}</option>`).join('');- sel.addEventListener('change', () => loadWatch(sel.value));+ if (sel.dataset.wired !== '1') {+ sel.dataset.wired = '1';+ sel.addEventListener('change', () => loadWatch(sel.value));+ }state.agentId = state.agents[0].id;-- loadEdge(); // 30-day proof-of-edge for the conviction bar (global)- startFeedLoop(); // live "clearing your bar" preview (global, polls)+ showState('config');loadWatch(state.agentId);}@@ -71,7 +126,7 @@ function showSkeletons() {['#statWin', '#statPnl', '#statOpen', '#statTotal'].forEach((id) => {const el = $(id); el.classList.add('sk'); el.textContent = '00%';});- $('#edgeReadout').innerHTML = '<div class="e-note">Loading 30-day track record for this bar…</div>';+ $('#edgeReadout').innerHTML = '<div class="e-note">Loading the 30-day track record for this bar…</div>';$('#qualBody').innerHTML = '<div class="qual-empty">Reading the live conviction stream…</div>';$('#ledgerBody').innerHTML = skeletonLedger();}@@ -128,12 +183,21 @@ function wireStaticControls() {function wireSwitch(sel, cb) {const el = $(sel);- el.addEventListener('click', () => {+ const flip = () => {const on = !el.classList.contains('on');el.classList.toggle('on', on);el.setAttribute('aria-checked', String(on));markDirty();if (cb) cb(on);+ };+ el.addEventListener('click', flip);+ // role="switch" + tabindex="0" made these focusable but not operable: a+ // keyboard user could tab onto the arm switch and never toggle it. Enter and+ // Space are what the switch role contracts for.+ el.addEventListener('keydown', (e) => {+ if (e.key !== 'Enter' && e.key !== ' ' && e.key !== 'Spacebar') return;+ e.preventDefault();+ flip();});}function setSwitch(sel, on) { const el = $(sel); el.classList.toggle('on', !!on); el.setAttribute('aria-checked', String(!!on)); }@@ -158,22 +222,22 @@ function updateArmStatus() {const sub = $('#armStatusSub');dot.className = 'arm-dot ' + (armed ? (live ? 'live' : 'sim') : 'off');if (!armed) {- lab.textContent = 'Disarmed';+ setLive(lab, 'Disarmed');sub.textContent = 'Your agent is idle. Flip the switch to start watching the conviction stream.';} else if (live) {- lab.textContent = 'Armed · Live';- sub.textContent = 'Spending real SOL from the agent wallet when a coin clears your bar — capped by your limits.';+ setLive(lab, 'Armed · Live');+ sub.textContent = 'Spending real SOL from the agent wallet when a coin clears your bar, capped by your limits.';} else {- lab.textContent = 'Armed · Simulate';+ setLive(lab, 'Armed · Simulate');sub.textContent = 'Logging every play it would take, risk-free. Outcomes get graded so you can trust it before going live.';}}function renderScaleSub() {const base = Number($('#fSize').value) || 0.05;- $('#scaleSub').textContent = isOn('#scaleToggle')+ setLive('#scaleSub', isOn('#scaleToggle')? `${base.toFixed(3)} SOL at your floor → up to ${(base * 1.5).toFixed(3)} SOL at score 100`- : 'Off — every qualifying play uses the same size';+ : 'Off. Every qualifying play uses the same size.');}function renderRisk() {@@ -190,7 +254,7 @@ function renderRisk() {const w = state.wallet;if (w && w.sol != null) {if (w.sol < size) {- txt += ` · <b style="color:var(--amber)">wallet holds ${fmtSol(w.sol)} — fund it before going live</b>`;+ txt += ` · <b style="color:var(--amber)">wallet holds ${fmtSol(w.sol)}, fund it before going live</b>`;} else if (w.sol < daily) {txt += ` · wallet covers ≈ ${Math.floor(w.sol / size)} ${Math.floor(w.sol / size) === 1 ? 'trade' : 'trades'} before it's dry`;}@@ -202,9 +266,11 @@ function renderRisk() {async function loadWallet(agentId) {const pill = $('#walletPill');const bal = $('#walletBal');+ // Point the deposit link at this agent before the pill is shown, so the+ // anchor is never on screen aimed at the generic agent list.+ $('#walletFund').href = `/agents/${encodeURIComponent(agentId)}/wallet#deposit`;pill.hidden = false;pill.classList.remove('low');- $('#walletFund').href = `/agents/${encodeURIComponent(agentId)}/wallet#deposit`;$('#walletRun').textContent = '';bal.classList.add('sk'); bal.textContent = '0.00◎';state.wallet = null;@@ -251,7 +317,7 @@ function renderEdge() {const el = $('#edgeReadout');const e = state.edge;if (!e) {- el.innerHTML = '<div class="e-note">Edge stats are warming up — historical win rates for this bar will show here.</div>';+ el.innerHTML = '<div class="e-note">Edge stats are warming up. Historical win rates for this bar show here as soon as enough coins resolve.</div>';return;}const inc = new Set(includedTiers(state.minScore));@@ -328,13 +394,18 @@ function renderQualifying() {(!r.requireSmart || (it.smart_wallet_count || 0) >= 1)).sort((a, b) => b.score - a.score);- countEl.textContent = matches.length+ setLive(countEl, matches.length? `${matches.length} clearing your bar`- : 'Nothing clears your bar right now';+ : 'Nothing clears your bar right now');metaEl.textContent = state.feed.length ? `live · ${state.feed.length} scored / 12h` : '';+ if (!state.feed.length) {+ // Distinct from "nothing qualifies": the feed itself never answered.+ body.innerHTML = `<div class="qual-empty">The conviction stream is not answering right now. It retries every 20 seconds, and your saved rules keep running server-side either way.</div>`;+ return;+ }if (!matches.length) {- body.innerHTML = `<div class="qual-empty">No live coin meets every rule this moment — normal for a tight bar. Loosen the conviction floor or widen narratives to see more flow, or keep it strict and let your agent wait for the real ones.</div>`;+ body.innerHTML = `<div class="qual-empty">No live coin meets every rule this moment, which is normal for a tight bar. Loosen the conviction floor or widen narratives to see more flow, or keep it strict and let your agent wait for the real ones.</div>`;return;}body.innerHTML = matches.slice(0, 8).map((it) => qualRow(it, r)).join('');@@ -342,8 +413,13 @@ function renderQualifying() {function qualRow(it, r) {const sym = esc(it.symbol || (it.mint || '').slice(0, 6));- const img = it.image_uri- ? `<img class="coinimg" src="${esc(it.image_uri)}" alt="" loading="lazy" data-fallback="remove">`+ // Coin art is creator-supplied and lives on IPFS gateways that answer without+ // the CORS/content-type headers a browser trusts, so a direct <img> is+ // ORB-blocked and every icon fails. /api/img refetches server-side across a+ // gateway list and always returns a valid image. Same pattern as oracle.js.+ const art = proxiedImageURL(it.image_uri, it.mint || it.symbol || 'coin', { width: 36 });+ const img = art+ ? `<img class="coinimg" src="${esc(art)}" alt="" loading="lazy" data-fallback="remove">`: '';const smart = (it.smart_wallet_count || 0) >= 1? `<span class="q-smart">${it.smart_wallet_count} smart in</span>`@@ -364,7 +440,10 @@ function qualRow(it, r) {async function loadWatch(agentId) {state.agentId = agentId;$('#saveNote').textContent = '';+ $('#ledgerBody').innerHTML = skeletonLedger();const { ok, data } = await api(`/api/oracle/watch?agent_id=${encodeURIComponent(agentId)}&network=${NETWORK}`);+ // This one payload carries the config, the action ledger and the summary, so+ // nothing here refetches it.const w = ok && data ? data.watch : null;state.watch = w;@@ -397,14 +476,14 @@ async function loadWatch(agentId) {$('#saveBtn').classList.remove('dirty');loadWallet(agentId);- loadActions(agentId);+ renderActions(ok ? data : null);}async function saveWatch() {// Arming in live mode commits the agent's real SOL — gate on the risk ack.if (modeIsLive() && isOn('#armToggle') && !(await ensureRiskAck({ context: 'oracle-arm' }))) return;const btn = $('#saveBtn');- btn.disabled = true; btn.textContent = 'Saving…';+ btn.disabled = true; setLive(btn, 'Saving…');const cats = $$('#catChips .cchip.on').map((b) => b.dataset.cat);const min = state.minScore;const payload = {@@ -423,7 +502,7 @@ async function saveWatch() {const { ok, data } = await api('/api/oracle/watch', {method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload),});- btn.disabled = false; btn.textContent = 'Save configuration';+ btn.disabled = false; setLive(btn, 'Save configuration');const note = $('#saveNote');if (ok && data?.watch) {state.watch = data.watch;@@ -431,14 +510,14 @@ async function saveWatch() {const tg = data.watch.telegram_chat_id ? ' Telegram alerts active.' : '';note.className = 'save-note ok';note.textContent = data.watch.armed- ? `✓ Armed in ${data.watch.mode} mode — your agent is watching the stream.${tg}`+ ? `✓ Armed in ${data.watch.mode} mode. Your agent is watching the stream.${tg}`: `✓ Saved. Flip “Armed” when you’re ready to start watching.${tg}`;// reflect any server-side clamping$('#fSize').value = data.watch.per_trade_sol;$('#fDaily').value = data.watch.max_daily_sol;$('#fOpen').value = data.watch.max_open;renderRisk();- loadActions(state.agentId);+ refreshLedger(state.agentId);} else {note.className = 'save-note warn';// The API answers `{error: "<code>", error_description: "<sentence>"}`, so@@ -460,12 +539,12 @@ async function sendTelegramTest() {return;}const btn = $('#tgTest');- btn.disabled = true; btn.textContent = 'Sending…';+ btn.disabled = true; setLive(btn, 'Sending…');const { ok, data } = await api('/api/oracle/test-alert', {method: 'POST', headers: { 'content-type': 'application/json' },body: JSON.stringify({ agent_id: state.agentId, chat_id: chatId }),});- btn.disabled = false; btn.textContent = 'Send test';+ btn.disabled = false; setLive(btn, 'Send test');if (ok && data?.ok) {note.className = 'tg-note ok';note.textContent = '✓ Test message delivered. Check Telegram.';@@ -479,11 +558,17 @@ async function sendTelegramTest() {}// ── activity ledger ───────────────────────────────────────────────────────────-async function loadActions(agentId) {- const body = $('#ledgerBody');+// A save answers with the new config only, so the graded ledger is refetched.+async function refreshLedger(agentId) {const { ok, data } = await api(`/api/oracle/watch?agent_id=${encodeURIComponent(agentId)}&network=${NETWORK}`);- const actions = ok && data ? (data.actions || []) : [];- const s = (ok && data && data.summary) || null;+ renderActions(ok ? data : null);+}++// Rendered from the payload loadWatch() already fetched.+function renderActions(payload) {+ const body = $('#ledgerBody');+ const actions = payload ? (payload.actions || []) : [];+ const s = payload ? payload.summary : null;// top stat stripconst setStat = (id, val, cls) => { const el = $(id); el.textContent = val; el.className = 'stat-val' + (cls ? ' ' + cls : ''); };@@ -492,12 +577,23 @@ async function loadActions(agentId) {setStat('#statPnl', `${s.realized_pnl_sol >= 0 ? '+' : ''}${fmtSol(s.realized_pnl_sol)}`, s.realized_pnl_sol >= 0 ? 'up' : 'dn');setStat('#statOpen', String(s.open ?? 0));setStat('#statTotal', String(s.total));+ } else if (s) {+ // A real answer that says "this agent has never acted" is a zero, not an+ // unknown. Four dashes read as a failed load.+ setStat('#statWin', NO_VALUE);+ setStat('#statPnl', fmtSol(0));+ setStat('#statOpen', '0');+ setStat('#statTotal', '0');} else {['#statWin', '#statPnl', '#statOpen', '#statTotal'].forEach((id) => setStat(id, '—'));}+ if (!payload) {+ body.innerHTML = `<div class="ledger-empty">Could not read this agent's ledger. Pick the agent again, or reload the page.</div>`;+ return;+ }if (!actions.length) {- body.innerHTML = `<div class="ledger-empty">No actions yet — once armed, every buy lands here and gets graded against the outcome in real time.</div>`;+ body.innerHTML = `<div class="ledger-empty">No actions yet. Once armed, every buy lands here and gets graded against the outcome in real time.</div>`;return;}const rows = actions.map(actionRow).join('');