// Agents / Tasks / Trading / Settings views const MOCK_AGENTS_VIEW = [ { name: "Prime", role: "Orchestrator", model: "Sonnet 4.6", status: "live", color: "cyan", load: 0.52, tasks: 12, cost: "$18.40", uptime: "13d 4h" }, { name: "Market Sentry", role: "Markets & risk", model: "Haiku 4.5", status: "live", color: "gold", load: 0.68, tasks: 4, cost: "$7.10", uptime: "13d 4h" }, { name: "Creative Director", role: "Brand & copy", model: "Sonnet 4.6", status: "working", color: "cyan", load: 0.42, tasks: 2, cost: "$6.30", uptime: "6d 12h" }, { name: "Research Specialist", role: "Primary research", model: "Sonnet 4.6", status: "live", color: "cyan", load: 0.31, tasks: 3, cost: "$4.80", uptime: "6d 12h" }, { name: "Ops Steward", role: "Infra & secrets", model: "Haiku 4.5", status: "idle", color: "cyan", load: 0.08, tasks: 1, cost: "$0.90", uptime: "13d 4h" }, { name: "Scribe", role: "Git & docs", model: "Haiku 4.5", status: "working", color: "cyan", load: 0.22, tasks: 5, cost: "$1.40", uptime: "3d 2h" }, { name: "Tape Reader", role: "Tick ingest", model: "Haiku 4.5", status: "live", color: "gold", load: 0.81, tasks: 1, cost: "$2.30", uptime: "13d 4h" }, ]; function AgentsView() { const G = window.Gastronaut; const liveAgents = G?.useAgents ? G.useAgents([]) : []; const agents = liveAgents.length ? liveAgents.map(a => ({ name: a.name, role: a.role, model: a.model ? a.model.replace("claude-", "").replace(/-/g, " ") : "", status: a.status, color: a.color, load: a.load ?? 0, tasks: a.tasksCompleted ?? a.tasks ?? 0, cost: a.cost || "$0.00", uptime: a.uptime || "—", })) : MOCK_AGENTS_VIEW; return (
} />
Agent
Model
Status
Load
Tasks (24h)
Cost · today
Uptime
{agents.map((a, i) => )}
); } function AgentRow({ name, role, model, status, color, load, tasks, cost, uptime }) { const c = color === "gold" ? "var(--gold)" : "var(--accent)"; return (
e.currentTarget.style.background = "rgba(255,255,255,0.015)"} onMouseLeave={(e) => e.currentTarget.style.background = "transparent"} >
{name}
{role}
{model}
{status}
{Math.round(load*100)}%
{tasks}
{cost}
{uptime}
); } // ---- Tasks ---- function TasksView({ openTask }) { const G = window.Gastronaut; const live = !!G?.live; const tasks = G?.useTasks ? G.useTasks([]) : []; const cols = [ { title: "Queued", status: "queued", items: tasks.filter(t => t.status === "queued") }, { title: "Running", status: "running", items: tasks.filter(t => t.status === "running") }, { title: "Done", status: "done", items: tasks.filter(t => t.status === "done") }, { title: "Error", status: "error", items: tasks.filter(t => t.status === "error") }, ]; const totalActive = tasks.filter(t => t.status === "queued" || t.status === "running").length; return (
} />
{cols.map(c => (
{c.title}
{c.items.length}
{c.items.length === 0 && (
empty
)} {c.items.map((t) => )}
))}
); } function TaskCard({ task, onOpen }) { const color = task.agentColor === "gold" ? "var(--gold)" : "var(--accent)"; const elapsedMs = task.finishedAt ? new Date(task.finishedAt) - new Date(task.createdAt) : (task.startedAt ? Date.now() - new Date(task.startedAt) : 0); const elapsed = elapsedMs > 0 ? `${Math.round(elapsedMs / 1000)}s` : ""; return ( onOpen?.(task.id)} onMouseEnter={(e) => e.currentTarget.style.borderColor = "var(--line-2)"} onMouseLeave={(e) => e.currentTarget.style.borderColor = "var(--line-1)"} >
{task.prompt}
{task.status === "running" && (
)}
{task.agentName || task.agentId}
{elapsed || task.priority}
); } window.AgentsView = AgentsView; window.TasksView = TasksView;