Atlas // Command Center
Working
Queued
Done today
Uptime
Spend
$0.00
/ $200
Connected MCP
// Replaces LIVE.tasks/files/memories with live API calls. // Marker: Atlas v8 UI pages wiring (function(){ if (window.__atlas_v8_pages_wired__) return; window.__atlas_v8_pages_wired__ = true; async function api(path, opts){ opts = opts || {}; const base = window.ATLAS_API || ATLAS_API; try { const r = await fetch(base + path, { method: opts.method || 'GET', headers: window.atlasAuthHeaders ? window.atlasAuthHeaders(opts.headers) : { 'Content-Type': 'application/json', ...(opts.headers || {}) }, body: opts.body ? JSON.stringify(opts.body) : undefined, }); if (!r.ok) return null; return await r.json(); } catch (err) { return null; } } if (!window.api) window.api = api; function setText(id, val){ const el = document.getElementById(id); if (el) el.textContent = val; } function stateLabel(s) { return ({ active: 'Working on it', queued: 'Waiting', approval: 'Needs your okay', done: 'Done', failed: 'Failed', running: 'Working on it', complete: 'Done', completed: 'Done', error: 'Failed', })[s] || s || 'idle'; } function fmtTime(iso) { if (!iso) return ''; const d = new Date(iso); if (isNaN(d)) return ''; const now = Date.now(); const diff = now - d.getTime(); if (diff < 60000) return 'Just now'; if (diff < 3600000) return Math.floor(diff/60000) + 'm ago'; if (diff < 86400000) return Math.floor(diff/3600000) + 'h ago'; return d.toLocaleDateString(); } async function refreshTasks(){ const r = await api('/api/tasks'); if (!r || !Array.isArray(r.tasks)) return; const list = document.getElementById('taskList'); if (!list) return; if (r.tasks.length === 0) { list.innerHTML = '
No missions yet. Talk to Atlas or fire one from the API.
'; } else { list.innerHTML = r.tasks.map(t => { const st = (t.state || 'queued').toLowerCase(); const meta = t.meta || (t.provider ? (t.provider + (t.model ? ' / ' + t.model : '')) : '') || ''; return `
${escape(t.title || t.id || 'mission')}
${escape(meta)} ${t.created_at ? '· ' + escape(fmtTime(t.created_at)) : ''}
${escape(stateLabel(st))}
`; }).join(''); } const counter = document.getElementById('taskCount'); if (counter) counter.textContent = r.tasks.length + ' mission' + (r.tasks.length === 1 ? '' : 's'); const navBadge = document.getElementById('navTasksBadge'); if (navBadge) { const active = r.tasks.filter(t => ['active','running','queued'].includes((t.state||'').toLowerCase())).length; navBadge.textContent = active; navBadge.style.display = active === 0 ? 'none' : ''; } } async function refreshFiles(){ const r = await api('/api/files'); if (!r || !Array.isArray(r.files)) return; const list = document.getElementById('fileList'); if (!list) return; if (r.files.length === 0) { list.innerHTML = '
No files yet. Atlas drops outputs here as it works.
'; } else { list.innerHTML = r.files.map(f => `
${escape((f.ext || 'FILE').toUpperCase())}
${escape(f.name || f.path || 'unnamed')}
${escape(f.size ? Math.ceil(f.size/1024)+' KB' : '')} ${f.created_at ? '· ' + escape(fmtTime(f.created_at)) : escape(f.meta || '')} ${f.qa === 'ready' ? '✓ Ready' : '◷ Pending'}
`).join(''); } const counter = document.getElementById('fileCount'); if (counter) counter.textContent = r.files.length + ' file' + (r.files.length === 1 ? '' : 's'); } async function refreshMemory(){ const r = await api('/api/memory/search?q=&limit=50'); if (!r) return; const list = document.getElementById('memoryList'); if (!list) return; const items = r.items || r.memories || []; if (items.length === 0) { list.innerHTML = '
No memories yet. As Atlas runs, it builds context.
'; } else { list.innerHTML = items.map(m => { const conf = m.confidence != null ? (typeof m.confidence === 'number' ? m.confidence.toFixed(2) : m.confidence) : '—'; return `
${escape(m.type || 'note')} Confidence · ${escape(conf)}
${escape((m.content || m.text || '').toString().slice(0, 300))}
${escape(m.source_id || m.src || '')}
`; }).join(''); } const counter = document.getElementById('memoryCount'); if (counter) counter.textContent = items.length + ' memor' + (items.length === 1 ? 'y' : 'ies'); } function renderAgentCard(a) { const st = a.state || 'idle'; const isProvider = a.providerKind === 'provider'; const stClass = safeClass(st); return `
${escape((a.name || '?')[0])}
${escape(a.name || a.id || 'agent')}
${escape(a.role || '')}
${escape(st)}
${isProvider ? 'Status' : 'Right now'} ${escape(a.doing || 'Standing by.')}
${isProvider && a.defaultModel ? `
Default model${escape(a.defaultModel)}
` : ''}
`; } async function refreshAgents(){ const r = await api('/api/agents'); if (!r) return; // v9 Batch B — split into functional + providers grids const functional = r.functional || (r.agents || []).filter(a => a.providerKind !== 'provider'); const providers = r.providers || (r.agents || []).filter(a => a.providerKind === 'provider'); const grid = document.getElementById('agentGrid'); if (grid && functional.length) { grid.innerHTML = functional.map(renderAgentCard).join(''); } const provGrid = document.getElementById('providerGrid'); if (provGrid) { if (providers.length) { provGrid.innerHTML = providers.map(renderAgentCard).join(''); } else { provGrid.innerHTML = '
·
No provider data
Server may not have v9 endpoints loaded
'; } } } function eventAgent(type) { if (!type) return 'commander'; if (type.includes('forge') || type.includes('image') || type.includes('video')) return 'forge'; if (type.includes('memory') || type.includes('context') || type.includes('brain')) return 'brain'; if (type.includes('scout') || type.includes('trend')) return 'scout'; if (type.includes('opsec') || type.includes('sentinel') || type.includes('safety')) return 'sentinel'; if (type.includes('analyst') || type.includes('weekly') || type.includes('report')) return 'analyst'; return 'commander'; } // v9 Batch B — surface provider+model on mission events as the actor. // model_calls events get "ANTHROPIC HAIKU" rather than just "Brain". function shortModel(m) { if (!m) return ''; // claude-haiku-4-5-20251001 -> HAIKU 4.5 if (m.includes('haiku')) return 'Haiku'; if (m.includes('sonnet')) return 'Sonnet'; if (m.includes('opus')) return 'Opus'; if (m.includes('gemini-2.5-flash')) return 'Gemini Flash'; if (m.includes('gemini-2.5-pro')) return 'Gemini Pro'; if (m.includes('gpt-4o-mini')) return 'GPT-4o Mini'; if (m.includes('gpt-4o')) return 'GPT-4o'; if (m.includes('gpt-5')) return 'GPT-5'; if (m.includes('grok')) return 'Grok'; if (m.includes('llama')) return 'Llama'; if (m.includes('qwen')) return 'Qwen'; return m.split('/').pop().slice(0, 18); } function eventActor(e) { // If this is a provider-attributed event, use the provider as actor const p = e.payload || {}; if ((e.type || '').startsWith('mission.completed') && p.provider) { return { key: p.provider, label: p.provider.toUpperCase() + (p.model ? ' ' + shortModel(p.model) : ''), }; } if ((e.type || '').startsWith('model.fallback') && p.failed) { return { key: 'sentinel', label: 'Fallback' }; } if ((e.type || '').startsWith('mission.failed')) { return { key: 'sentinel', label: 'Failed' }; } const agent = eventAgent(e.type || ''); return { key: agent, label: agent.charAt(0).toUpperCase() + agent.slice(1) }; } function eventBody(e) { if (e.message) return String(e.message); const p = e.payload || {}; // Mission events — show title + tokens + latency if ((e.type || '').startsWith('mission.completed')) { const tok = (p.input_tokens != null && p.output_tokens != null) ? ` · ${p.input_tokens}+${p.output_tokens} tok` : ''; const lat = p.latency_ms ? ` · ${p.latency_ms}ms` : ''; return `Mission completed${tok}${lat}`; } if ((e.type || '').startsWith('mission.created')) { const alias = p.alias ? ` (${p.alias})` : ''; return `Mission accepted${alias}`; } if ((e.type || '').startsWith('mission.failed')) { return `Mission failed: ${p.error || 'unknown'}`; } if ((e.type || '').startsWith('model.fallback')) { return `${p.failed || 'primary'} failed → fallback`; } if (p.title) return String(p.title); if (p.text) return String(p.text).slice(0, 120); if (p.provider) return p.provider + (p.model ? ' / ' + p.model : '') + (p.latency_ms ? ' · ' + p.latency_ms + 'ms' : ''); return e.type || 'event'; } async function refreshActivity(){ const r = await api('/api/activity?limit=30'); if (!r) return; const events = r.events || r.activity || []; const feed = document.getElementById('activity'); if (!feed) return; if (!events.length) { feed.innerHTML = '
No activity yet. Events will appear here as agents work.
'; return; } feed.innerHTML = events.map(e => { const ts = e.ts ? new Date(e.ts) : new Date(); const tStr = isNaN(ts) ? '' : ts.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }); const actor = eventActor(e); return `
${escape(actor.label)} ${escape(tStr)}
${escape(eventBody(e))}
`; }).join(''); } function fmtUptime(sec) { if (sec == null) return '—'; if (typeof sec === 'string') return sec; sec = Math.floor(Number(sec)); if (!sec || sec < 1) return '0s'; const h = Math.floor(sec / 3600); const m = Math.floor((sec % 3600) / 60); const s = sec % 60; if (h) return `${h}h ${m}m`; if (m) return `${m}m ${s}s`; return `${s}s`; } async function refreshStatus(){ const s = await api('/api/status'); if (!s) { // Server unreachable — don't fake anything setText('m-working', '—'); setText('m-queued', '—'); setText('m-done', '—'); setText('m-uptime', '—'); setText('m-spend', '$0.00'); return; } const active = s.active != null ? s.active : (s.active_count || 0); const queued = s.queue_depth != null ? s.queue_depth : (