Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files290 unmodified lines291292293294295296297135 unmodified lines4334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734746 unmodified lines481482483484485486487785 unmodified lines12731274127512761277127867 unmodified lines1346134713481349135013511352135313541355135630 unmodified lines138713881389139013911392139313944 unmodified lines1399140014011402140314045 unmodified lines141014111412141314141415290 unmodified lines.severity-fill.high { background: var(--red); }/* Arena agent action scrollable area */.agent-actions-scroll { max-height: 220px; overflow-y: auto; }/* ════════════════════════ PLAYGROUND TAB ════════════════════════ */.pg-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }135 unmodified lines<div class="guide-banner arena"><strong>Welcome to the CounterFeint Arena!</strong>Click <strong>Run Auto Match</strong> to watch a live simulation. The Fraudster agent crafts deceptive ads while the Investigator reviews each one.Watch the reward curves evolve in real-time as agents compete. Adjust the task difficulty and random seed for different scenarios.</div><!-- Architecture overview --><div class="panel" style="margin-bottom:18px"><div class="panel-body"><div class="arch-diagram"><div class="arch-node" style="border-color: rgba(239,68,68,0.3);"><div class="agent-icon fraudster"><svg viewBox="0 0 40 40" width="26" height="26"><rect x="6" y="12" width="28" height="22" rx="5" fill="none" stroke="#ef4444" stroke-width="2.5"/><circle cx="15" cy="22" r="3" fill="#ef4444"/><circle cx="25" cy="22" r="3" fill="#ef4444"/><path d="M14 30 Q20 35 26 30" fill="none" stroke="#ef4444" stroke-width="2"/><line x1="12" y1="12" x2="8" y2="4" stroke="#ef4444" stroke-width="2.5" stroke-linecap="round"/><line x1="28" y1="12" x2="32" y2="4" stroke="#ef4444" stroke-width="2.5" stroke-linecap="round"/></svg></div><span class="agent-label fraudster">Fraudster</span><span class="arch-node-desc">Proposes & modifies<br/>deceptive ads</span></div><span class="arch-arrow">➡</span><div class="arch-node" style="border-color: rgba(6,182,212,0.3); min-width: 160px;"><div style="font-size:22px">📜</div><span class="arch-node-name" style="color:var(--cyan)">Shared Ad Queue</span><span class="arch-node-desc">Ads accumulate here.<br/>Both agents see it.</span></div><span class="arch-arrow">➡</span><div class="arch-node" style="border-color: rgba(99,102,241,0.3);"><div class="agent-icon investigator"><svg viewBox="0 0 40 40" width="26" height="26"><rect x="6" y="12" width="28" height="22" rx="5" fill="none" stroke="#6366f1" stroke-width="2.5"/><circle cx="15" cy="22" r="3" fill="#6366f1"/><circle cx="25" cy="22" r="3" fill="#6366f1"/><line x1="14" y1="30" x2="26" y2="30" stroke="#6366f1" stroke-width="2" stroke-linecap="round"/><circle cx="20" cy="8" r="3" fill="#6366f1" opacity="0.6"/><line x1="20" y1="11" x2="20" y2="12" stroke="#6366f1" stroke-width="2"/></svg></div><span class="agent-label investigator">Investigator</span><span class="arch-node-desc">Investigates ads &<br/>renders verdicts</span></div><span class="arch-arrow">➡</span><div class="arch-node" style="border-color: rgba(245,158,11,0.3);"><div class="agent-icon auditor"><svg viewBox="0 0 40 40" width="26" height="26"><rect x="6" y="12" width="28" height="22" rx="5" fill="none" stroke="#f59e0b" stroke-width="2.5"/><circle cx="15" cy="22" r="3" fill="#f59e0b"/><circle cx="25" cy="22" r="3" fill="#f59e0b"/><line x1="14" y1="30" x2="26" y2="30" stroke="#f59e0b" stroke-width="2" stroke-linecap="round"/><line x1="20" y1="5" x2="20" y2="12" stroke="#f59e0b" stroke-width="2"/><line x1="14" y1="7" x2="26" y2="7" stroke="#f59e0b" stroke-width="2.5" stroke-linecap="round"/><circle cx="14" cy="9" r="2" fill="#f59e0b" opacity="0.6"/><circle cx="26" cy="9" r="2" fill="#f59e0b" opacity="0.6"/></svg></div><span class="agent-label auditor">Auditor</span><span class="arch-node-desc">Audits reasoning<br/>& plausibility</span></div></div></div>6 unmodified lines<option value="task_2">Task 2 — Sophisticated fraud (12 ads)</option><option value="task_3">Task 3 — Fraud networks (20 ads)</option></select><input type="number" id="arena-seed" value="42" min="0" style="width:80px;padding:10px;border-radius:var(--radius-sm);background:#0f172a;color:#f1f5f9;border:1px solid rgba(148,163,184,0.35);font-family:inherit;font-size:0.78rem;" placeholder="Seed" /><button class="btn btn-primary" id="btn-auto">▶ Run Auto Match</button><span id="arena-status" style="font-size:0.72rem;color:var(--text-dim);margin-left:8px;">Ready</span></div>785 unmodified linesconst FINDING_RE = /^\[(ad_\d+)\s*\/\s*([a-z_]+)\]/;let lastObs = null, pgVerdicts = {}, pgCumReward = 0, pgCumHistory = [], pgMaxBudget = 0, pgStep = 0, pgDone = false;function logLine(msg, cls) {const a = document.getElementById('log-area');67 unmodified lines'<div style="font-size:0.68rem;color:var(--text-dim);margin-bottom:8px">Category: <strong style="color:var(--text)">' + esc(cat) + '</strong></div>' +(copy ? '<div class="ad-copy-block">' + esc(copy) + '</div>' : '');}function renderPgFindings(obs) {const raw = obs.investigation_findings || '';const inv = parseFindings(raw);const focused = focusedFromInfo(obs.current_ad_info || '');const adInv = (focused && inv[focused]) || {};const grid = document.getElementById('findings-grid');grid.innerHTML = '';TARGETS.forEach(t => {30 unmodified linesfunction applyPgObs(data) {const obs = data.observation || {};lastObs = obs;renderPgStats(obs); renderPgQueue(obs); renderPgProfile(obs);renderPgFindings(obs); fillAdSelects(obs); renderPgChart(); renderPgVerdicts();}function toggleActionFields() {const t = document.getElementById('act-type').value;4 unmodified linesdocument.getElementById('grp-reason').classList.toggle('hidden', t !== 'link_accounts');}document.getElementById('act-type').addEventListener('change', toggleActionFields);document.getElementById('btn-reset').onclick = async () => {try {5 unmodified linesconst data = await res.json();if (!res.ok) throw new Error(data.detail || res.statusText);pgVerdicts = {}; pgCumReward = 0; pgCumHistory = []; pgStep = 0; pgDone = false;pgMaxBudget = (data.observation && data.observation.queue_status && data.observation.queue_status.investigation_budget) || 25;applyPgObs(data);document.getElementById('btn-step').disabled = false;290 unmodified lines291292293294295296297298299300301302303135 unmodified lines4394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924936 unmodified lines500501502503504505506785 unmodified lines129212931294129512961297129867 unmodified lines136613671368136913701371137213731374137513761377137813791380138113821383138430 unmodified lines1415141614171418141914201421142214234 unmodified lines14281429143014311432143314345 unmodified lines1440144114421443144414451446290 unmodified lines.severity-fill.high { background: var(--red); }/* Arena agent action scrollable area */.agent-actions-scroll {max-height: 400px; overflow-y: auto; scroll-behavior: smooth;scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent;}.agent-actions-scroll::-webkit-scrollbar { width: 5px; }.agent-actions-scroll::-webkit-scrollbar-track { background: transparent; }.agent-actions-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }/* ════════════════════════ PLAYGROUND TAB ════════════════════════ */.pg-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }135 unmodified lines<div class="guide-banner arena"><strong>Welcome to the CounterFeint Arena!</strong>Click <strong>Run Auto Match</strong> to watch a live simulation using <strong>deterministic scripted agents</strong> — a reactive Fraudster, a heuristic Investigator, and a rule-based Auditor.Watch reward curves evolve in real-time as agents compete step by step. For <strong>LLM-based agent</strong> results and trained model comparisons, check the <strong>Results</strong> tab.</div><!-- Architecture overview — Auditor oversees from above --><div class="panel" style="margin-bottom:18px"><div class="panel-body"><div style="display:flex;flex-direction:column;align-items:center;padding:24px 20px;gap:0;"><!-- Auditor (top tier — oversight) --><div class="arch-node" style="border-color:rgba(245,158,11,0.35);box-shadow:0 0 24px var(--amber-glow);z-index:1;"><div class="agent-icon auditor"><svg viewBox="0 0 40 40" width="26" height="26"><rect x="6" y="12" width="28" height="22" rx="5" fill="none" stroke="#f59e0b" stroke-width="2.5"/><circle cx="15" cy="22" r="3" fill="#f59e0b"/><circle cx="25" cy="22" r="3" fill="#f59e0b"/><line x1="14" y1="30" x2="26" y2="30" stroke="#f59e0b" stroke-width="2" stroke-linecap="round"/><line x1="20" y1="5" x2="20" y2="12" stroke="#f59e0b" stroke-width="2"/><line x1="14" y1="7" x2="26" y2="7" stroke="#f59e0b" stroke-width="2.5" stroke-linecap="round"/><circle cx="14" cy="9" r="2" fill="#f59e0b" opacity="0.6"/><circle cx="26" cy="9" r="2" fill="#f59e0b" opacity="0.6"/></svg></div><span class="agent-label auditor">Auditor</span><span class="arch-node-desc">Post-hoc reasoning &<br/>plausibility auditor</span></div><!-- Hierarchy arrows --><svg width="340" height="40" style="display:block;overflow:visible;flex-shrink:0;" viewBox="0 0 340 40"><line x1="170" y1="0" x2="60" y2="36" stroke="#f59e0b" stroke-width="1.5" stroke-dasharray="5,3" opacity="0.5"/><polygon points="56,32 60,40 66,34" fill="#f59e0b" opacity="0.5"/><line x1="170" y1="0" x2="280" y2="36" stroke="#f59e0b" stroke-width="1.5" stroke-dasharray="5,3" opacity="0.5"/><polygon points="274,34 280,40 284,32" fill="#f59e0b" opacity="0.5"/><text x="170" y="26" text-anchor="middle" fill="#f59e0b" font-size="9" font-family="Inter,sans-serif" font-weight="600" letter-spacing="1" opacity="0.7">AUDITS BOTH AGENTS</text></svg><!-- Bottom tier: Fraudster → Queue → Investigator --><div style="display:flex;align-items:center;justify-content:center;gap:24px;flex-wrap:wrap;"><div class="arch-node" style="border-color:rgba(239,68,68,0.3);"><div class="agent-icon fraudster"><svg viewBox="0 0 40 40" width="26" height="26"><rect x="6" y="12" width="28" height="22" rx="5" fill="none" stroke="#ef4444" stroke-width="2.5"/><circle cx="15" cy="22" r="3" fill="#ef4444"/><circle cx="25" cy="22" r="3" fill="#ef4444"/><path d="M14 30 Q20 35 26 30" fill="none" stroke="#ef4444" stroke-width="2"/><line x1="12" y1="12" x2="8" y2="4" stroke="#ef4444" stroke-width="2.5" stroke-linecap="round"/><line x1="28" y1="12" x2="32" y2="4" stroke="#ef4444" stroke-width="2.5" stroke-linecap="round"/></svg></div><span class="agent-label fraudster">Fraudster</span><span class="arch-node-desc">Proposes & modifies<br/>deceptive ads</span></div><span class="arch-arrow">➡</span><div class="arch-node" style="border-color:rgba(6,182,212,0.3);min-width:160px;"><div style="font-size:22px">📜</div><span class="arch-node-name" style="color:var(--cyan)">Shared Ad Queue</span><span class="arch-node-desc">Ads accumulate here.<br/>Both agents see it.</span></div><span class="arch-arrow">➡</span><div class="arch-node" style="border-color:rgba(99,102,241,0.3);"><div class="agent-icon investigator"><svg viewBox="0 0 40 40" width="26" height="26"><rect x="6" y="12" width="28" height="22" rx="5" fill="none" stroke="#6366f1" stroke-width="2.5"/><circle cx="15" cy="22" r="3" fill="#6366f1"/><circle cx="25" cy="22" r="3" fill="#6366f1"/><line x1="14" y1="30" x2="26" y2="30" stroke="#6366f1" stroke-width="2" stroke-linecap="round"/><circle cx="20" cy="8" r="3" fill="#6366f1" opacity="0.6"/><line x1="20" y1="11" x2="20" y2="12" stroke="#6366f1" stroke-width="2"/></svg></div><span class="agent-label investigator">Investigator</span><span class="arch-node-desc">Investigates ads &<br/>renders verdicts</span></div></div></div></div>6 unmodified lines<option value="task_2">Task 2 — Sophisticated fraud (12 ads)</option><option value="task_3">Task 3 — Fraud networks (20 ads)</option></select><input type="number" id="arena-seed" value="77" min="0" style="width:80px;padding:10px;border-radius:var(--radius-sm);background:#0f172a;color:#f1f5f9;border:1px solid rgba(148,163,184,0.35);font-family:inherit;font-size:0.78rem;" placeholder="Seed" /><button class="btn btn-primary" id="btn-auto">▶ Run Auto Match</button><span id="arena-status" style="font-size:0.72rem;color:var(--text-dim);margin-left:8px;">Ready</span></div>785 unmodified linesconst FINDING_RE = /^\[(ad_\d+)\s*\/\s*([a-z_]+)\]/;let lastObs = null, pgVerdicts = {}, pgCumReward = 0, pgCumHistory = [], pgMaxBudget = 0, pgStep = 0, pgDone = false;let allParsedFindings = {};function logLine(msg, cls) {const a = document.getElementById('log-area');67 unmodified lines'<div style="font-size:0.68rem;color:var(--text-dim);margin-bottom:8px">Category: <strong style="color:var(--text)">' + esc(cat) + '</strong></div>' +(copy ? '<div class="ad-copy-block">' + esc(copy) + '</div>' : '');}function mergeFindings(obs) {const raw = obs.investigation_findings || '';const inv = parseFindings(raw);for (const adId in inv) {if (!allParsedFindings[adId]) allParsedFindings[adId] = {};for (const target in inv[adId]) {allParsedFindings[adId][target] = inv[adId][target];}}}function renderPgFindings(adId) {adId = adId || document.getElementById('act-ad').value || focusedFromInfo((lastObs && lastObs.current_ad_info) || '');const adInv = (adId && allParsedFindings[adId]) || {};const grid = document.getElementById('findings-grid');grid.innerHTML = '';TARGETS.forEach(t => {30 unmodified linesfunction applyPgObs(data) {const obs = data.observation || {};lastObs = obs;mergeFindings(obs);renderPgStats(obs); renderPgQueue(obs); renderPgProfile(obs);renderPgFindings(); fillAdSelects(obs); renderPgChart(); renderPgVerdicts();}function toggleActionFields() {const t = document.getElementById('act-type').value;4 unmodified linesdocument.getElementById('grp-reason').classList.toggle('hidden', t !== 'link_accounts');}document.getElementById('act-type').addEventListener('change', toggleActionFields);document.getElementById('act-ad').addEventListener('change', () => { renderPgFindings(); });document.getElementById('btn-reset').onclick = async () => {try {5 unmodified linesconst data = await res.json();if (!res.ok) throw new Error(data.detail || res.statusText);pgVerdicts = {}; pgCumReward = 0; pgCumHistory = []; pgStep = 0; pgDone = false;allParsedFindings = {};pgMaxBudget = (data.observation && data.observation.queue_status && data.observation.queue_status.investigation_budget) || 25;applyPgObs(data);document.getElementById('btn-step').disabled = false;
server/static/investigate_hq.html+65-34