// Agent Cockpit - full-screen agent view with live terminal, CPU/memory sparklines, self-healing ring import { store } from "../core/state"; import { escapeHtml, formatDuration, fmtNum } from "../core/helpers"; import { icon } from "../design/icons"; import { colors } from "../design/tokens"; import { renderSparkline } from "../components/charts/sparkline"; import { renderSVGDonut } from "../components/charts/donut"; import { LiveTerminal } from "../components/terminal"; import { SSEClient } from "../core/sse"; import * as api from "../core/api"; import type { FleetState, View, PipelineInfo } from "../types/api"; let terminal: LiveTerminal | null = null; let sseClient: SSEClient | null = null; let selectedAgent: number | null = null; let cpuHistory: number[] = []; let memHistory: number[] = []; function renderCockpit(data: FleetState): void { const container = document.getElementById("panel-agent-cockpit"); if (!container) return; const pipelines = data.pipelines || []; if (pipelines.length === 0 && !selectedAgent) { container.innerHTML = `
No active agents
Agent #${selectedAgent} no longer active
Select an agent to monitor
Loading...
No changes yet
Could not load changes