${esc(f.title)} ${esc(f.severity)}
${f.suggested_human_action?`Acção: ${esc(f.suggested_human_action)}
`:''}(function () { const esc = (s) => String(s ?? '').replace(/&/g,'&').replace(//g,'>'); async function api(path, opts = {}) { const h = { ...(opts.headers || {}) }; const t = window.DeskAuth?.getToken?.(); if (t) h.Authorization = `Bearer ${t}`; const r = await fetch(`/api/v1/agents${path}`, { ...opts, headers: h }); if (!r.ok) throw new Error(`${r.status}`); return r.json(); } async function renderAgenticOps() { const el = document.getElementById('agentic-ops-content'); if (!el) return; el.innerHTML = '
Carregando Agentic Ops…
'; try { const [health, scenarios, findings, log] = await Promise.all([ api('/health'), api('/scenarios'), api('/findings?limit=30'), api('/action-log?limit=40'), ]); const tier = health.tier === 't1' ? 'T1 LLM' : 'T0'; const ollama = health.ollama ? 'Ollama OK' : 'Ollama offline'; const sRows = (scenarios.scenarios || []).map(s => `${esc(s.id)}Acção: ${esc(f.suggested_human_action)}
`:''}Sem findings abertos.
'; const lRows = (log.events || []).map(e => `${esc(e.event_type)}| ID | Título | Último | Quando |
|---|
| Quando | Evento | Mensagem |
|---|
Erro: ${esc(err.message)}
`; } } window.renderAgenticOps = renderAgenticOps; })();