signaltrail / tree / src/dashboard.js · raw (this view has old GitHub links rewritten for the mirror; raw is byte-exact)
export const DASHBOARD = `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>SignalTrail: practice-trading narrative agent</title>
<style>body{font:15px/1.5 system-ui,sans-serif;background:#0b0f19;color:#e1e6ee;margin:0;padding:24px;max-width:1150px;margin:auto}a{color:#64aaff}h1{margin:0}.sub{color:#8c96a5}.card{background:#161b26;border:1px solid #2d3748;border-radius:10px;padding:14px 16px;margin:12px 0}.OPEN_PRACTICE_LONG{border-left:5px solid #50dc82}.SKIP{border-left:5px solid #ff5c5c}.tag{display:inline-block;background:#232c40;border-radius:12px;padding:1px 10px;margin-right:6px;font-size:13px}code{font-size:13px;color:#9ad}ul{margin:4px 0 4px 18px;padding:0}.b{color:#50dc82}.r{color:#ff8080}.dim{color:#8c96a5}button{background:#2563eb;color:#fff;border:0;border-radius:8px;padding:8px 14px;font-size:15px;cursor:pointer}</style></head><body>
<h1>SignalTrail</h1><div class="sub">Multi-KOL narrative agent · practice (paper) trades only · signed, hash-chained, replayable reasoning trail · <a href="/v1">API</a> · <a href="https://agentgate-source.pages.dev/signaltrail/">source</a></div>
<div class="card dim">Not financial advice. No real funds, wallets or exchanges. The demo creators (@demo_*) are fictional personas.</div>
<div id="pf" class="card">Loading portfolio…</div><div id="trail"></div>
<script>
const $=(h)=>{const d=document.createElement('div');d.innerHTML=h;return d.firstChild};
const esc=(s)=>String(s).replace(/[&<>"]/g,c=>({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;'}[c]));
const BOOK=(new URLSearchParams(location.search).get('book')||'demo').replace(/[^a-z0-9-]/g,'');fetch('/v1/portfolio?book='+BOOK).then(r=>r.json()).then(p=>{document.getElementById('pf').innerHTML='<b>Practice portfolio</b> <span class="tag">book '+esc(p.book)+'</span> · start $'+p.start_usd+' · cash $'+p.cash_usd+' · equity (marked) $'+p.equity_marked_usd+'<ul>'+p.positions.map(x=>'<li>'+esc(x.symbol)+': $'+x.size_usd+' @ '+x.entry_price_usd+' → mark '+(x.mark_price_usd==null?'n/a':+Number(x.mark_price_usd).toPrecision(4))+' ('+(x.unrealized_pnl_usd>=0?'+':'')+x.unrealized_pnl_usd+' USD) · stop '+x.stop_price_usd+' · target '+x.take_profit_price_usd+'</li>').join('')+'</ul>'});
fetch('/v1/trail?limit=12').then(r=>r.json()).then(t=>{const el=document.getElementById('trail');el.appendChild($('<h3>Reasoning trail ('+t.count+' receipts, newest first)</h3>'));for(const r of t.receipts){if(r.type!=='decision'){el.appendChild($('<div class="card"><b>#'+r.chain.seq+' EXIT '+esc(r.symbol)+'</b> '+esc(r.exit.rule)+'</div>'));continue}const d=r.decision,n=r.evidence.narrative;el.appendChild($('<div class="card '+d.action+'"><b>#'+r.chain.seq+' '+esc(d.verdict)+'</b> <span class="tag">'+esc(n.narrative)+'</span><span class="tag">'+n.voices.bullish.length+' bullish / '+n.voices.bearish.length+' bearish</span><div class="b">Bull: <ul>'+d.bull_case.map(x=>'<li>'+esc(x)+'</li>').join('')+'</ul></div><div class="r">Bear: '+(d.bear_case.length?'<ul>'+d.bear_case.map(x=>'<li>'+esc(x)+'</li>').join('')+'</ul>':'<span class="dim">no objections</span>')+'</div>'+(r.book?'<span class="tag">book '+esc(r.book)+'</span>':'')+(d.vetoes.length?'<div class="r">Vetoes: '+d.vetoes.map(esc).join(' · ')+'</div>':'')+'<div class="dim"><code>hash '+r.integrity.hash.slice(0,24)+'…</code> · <a href="/v1/receipt/'+r.chain.seq+'">receipt</a> · <a href="/v1/replay/'+r.chain.seq+'">replay</a></div></div>'))}});
</script></body></html>`;

agentgate-source: code mirror on Cloudflare Pages. All repos