/* Generated by python -m aureon.autonomous.aureon_unified_ui_builder. * This component is data-driven. Re-run the builder after manifest or template changes. */ import { useEffect, useMemo, useState } from "react"; import { terminalStateUrls } from "@/config/serviceEndpoints"; import { Activity, AlertTriangle, BadgeCheck, Brain, Calculator, Code2, Database, FileText, Gauge, LineChart, Network, Radio, RefreshCw, Search, Server, ShieldCheck, Sparkles, Terminal, Zap, } from "lucide-react"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { ScrollArea } from "@/components/ui/scroll-area"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; type JsonMap = Record; const PUBLIC_ENDPOINTS: Record = { uiSpec: "/aureon_operational_ui_spec.json", wake: "/aureon_wake_up_manifest.json", organism: "/aureon_organism_runtime_status.json", switchboard: "/aureon_autonomous_capability_switchboard.json", unification: "/aureon_frontend_unification_plan.json", evolution: "/aureon_frontend_evolution_queue.json", inventory: "/aureon_saas_system_inventory.json", tradeEvidence: "/aureon_cognitive_trade_evidence.json", harmonic: "/aureon_harmonic_affect_state.json", benchmark: "/aureon_live_cognition_benchmark.json", hncProof: "/aureon_hnc_cognitive_proof.json", }; const RUNTIME_FALLBACKS = terminalStateUrls; const EXCHANGES = ["kraken", "binance", "alpaca", "capital"]; interface OperationalSnapshot { loadedAt: string; loading: boolean; data: Record; runtime: JsonMap | null; flight: JsonMap | null; reboot: JsonMap | null; runtimeEndpoint: string; errors: string[]; } async function fetchJson(url: string, signal?: AbortSignal): Promise { try { const response = await fetch(url, { cache: "no-store", signal }); if (!response.ok) return null; return (await response.json()) as T; } catch { return null; } } function uniqueStrings(values: Array): string[] { return Array.from(new Set(values.map((value) => String(value || "").trim()).filter(Boolean))); } function asNumber(value: unknown, fallback = 0): number { const numeric = Number(value); return Number.isFinite(numeric) ? numeric : fallback; } function compact(value: unknown): string { if (value === null || value === undefined || value === "") return "unavailable"; const numeric = typeof value === "number" ? value : Number(value); if (!Number.isFinite(numeric)) return "unavailable"; return numeric.toLocaleString(); } function percent(value: unknown): string { if (typeof value === "boolean" || value === null || value === undefined || value === "") return "unavailable"; const numeric = typeof value === "number" ? value : Number(value); if (!Number.isFinite(numeric)) return "unavailable"; if (numeric <= 1) return `${Math.round(numeric * 100)}%`; return `${Math.round(numeric)}%`; } function timeLabel(value: unknown): string { if (!value) return "pending"; const date = new Date(String(value)); if (Number.isNaN(date.getTime())) return String(value); return date.toLocaleTimeString(); } function shortText(value: unknown, fallback = "unknown"): string { const text = String(value ?? "").trim(); return text || fallback; } function derivedEndpoint(base: string, suffix: string): string { return base.replace(/\/api\/terminal-state$/, suffix); } function pillTone(kind: "good" | "warn" | "bad" | "info" | "quiet" = "quiet"): string { if (kind === "good") return "border-success/30 bg-success/10 text-success"; if (kind === "warn") return "border-warning/30 bg-warning/10 text-warning"; if (kind === "bad") return "border-destructive/30 bg-destructive/10 text-destructive"; if (kind === "info") return "border-primary/30 bg-primary/10 text-primary"; return "border-border/60 bg-muted/20 text-muted-foreground"; } function statusKind(value: unknown): "good" | "warn" | "bad" | "info" | "quiet" { const text = String(value ?? "").toLowerCase(); if (text.includes("blocked") || text.includes("offline") || text.includes("missing") || text.includes("fail")) return "bad"; if (text.includes("stale") || text.includes("guard") || text.includes("attention") || text.includes("pending")) return "warn"; if (text.includes("live") || text.includes("ready") || text.includes("fresh") || text.includes("online") || text.includes("clear")) return "good"; if (text.includes("observe") || text.includes("checking")) return "info"; return "quiet"; } function Pill({ label, kind = "quiet" }: { label: string; kind?: "good" | "warn" | "bad" | "info" | "quiet" }) { return {label}; } function Stat({ label, value, icon: Icon, kind = "quiet" }: { label: string; value: string; icon: typeof Activity; kind?: "good" | "warn" | "bad" | "info" | "quiet" }) { return (
{label}
{value}
); } function exchangeReady(runtime: JsonMap | null, name: string): boolean { if (!runtime) return false; return Boolean( runtime?.[`${name}_ready`] || runtime?.exchanges?.[`${name}_ready`] || runtime?.exchanges?.[name]?.ready || runtime?.[name]?.ready || runtime?.[name]?.connected ); } function exchangeError(runtime: JsonMap | null, name: string): string { return String(runtime?.errors?.[name] || runtime?.exchanges?.[name]?.error || runtime?.[name]?.error || ""); } function runtimeBlockers(runtime: JsonMap | null, flight: JsonMap | null, reboot: JsonMap | null): string[] { const blockers = new Set(); const watchdog = runtime?.runtime_watchdog || {}; const checks = flight?.checks || {}; if (runtime?.booting) blockers.add("runtime_booting"); if (runtime?.stale || watchdog?.tick_stale) blockers.add("runtime_stale"); if (runtime?.stale_reason) blockers.add(String(runtime.stale_reason)); if (watchdog?.tick_stale_reason) blockers.add(String(watchdog.tick_stale_reason)); if (asNumber(runtime?.combined?.open_positions || runtime?.open_positions) > 0 || checks?.open_positions === true) blockers.add("open_positions"); if (checks?.downtime_window === false || checks?.downtime_window_open === false) blockers.add("downtime_window_false"); if (flight?.reboot_advice?.can_reboot_now === false || reboot?.can_reboot_now === false) blockers.add("reboot_deferred"); return Array.from(blockers).filter(Boolean); } async function loadSnapshot(): Promise { const controller = new AbortController(); const timeout = window.setTimeout(() => controller.abort(), 2200); const errors: string[] = []; const data: Record = {}; try { await Promise.all(Object.entries(PUBLIC_ENDPOINTS).map(async ([key, url]) => { const payload = await fetchJson(url, controller.signal); if (payload) data[key] = payload; else errors.push(`${key} unavailable`); })); const runtimeEndpoints = uniqueStrings([data.wake?.runtime_feed_url, ...RUNTIME_FALLBACKS]); let runtime: JsonMap | null = null; let runtimeEndpoint = ""; for (const endpoint of runtimeEndpoints) { const payload = await fetchJson(endpoint, controller.signal); if (payload) { runtime = payload; runtimeEndpoint = endpoint; break; } } const flightUrl = data.wake?.runtime_flight_test_url || (runtimeEndpoint ? derivedEndpoint(runtimeEndpoint, "/api/flight-test") : ""); const rebootUrl = data.wake?.runtime_reboot_advice_url || (runtimeEndpoint ? derivedEndpoint(runtimeEndpoint, "/api/reboot-advice") : ""); const flight = flightUrl ? await fetchJson(flightUrl, controller.signal) : null; const reboot = rebootUrl ? await fetchJson(rebootUrl, controller.signal) : null; return { loadedAt: new Date().toISOString(), loading: false, data, runtime, flight, reboot, runtimeEndpoint, errors, }; } finally { window.clearTimeout(timeout); } } export function AureonGeneratedOperationalConsole() { const [snapshot, setSnapshot] = useState({ loadedAt: "", loading: true, data: {}, runtime: null, flight: null, reboot: null, runtimeEndpoint: "", errors: [], }); const [active, setActive] = useState("live"); const refresh = async () => { setSnapshot((current) => ({ ...current, loading: true })); setSnapshot(await loadSnapshot()); }; useEffect(() => { refresh(); const timer = window.setInterval(refresh, 8000); return () => window.clearInterval(timer); }, []); const { data, runtime, flight, reboot } = snapshot; const uiSpec = data.uiSpec || {}; const organism = data.organism || {}; const switchboard = data.switchboard || {}; const unification = data.unification || {}; const evolution = data.evolution || {}; const inventory = data.inventory || {}; const tradeEvidence = data.tradeEvidence || {}; const harmonic = data.harmonic || {}; const benchmark = data.benchmark || {}; const hncProof = data.hncProof || {}; const blockers = runtimeBlockers(runtime, flight, reboot); const capabilityModes = Array.isArray(switchboard.capability_modes) ? switchboard.capability_modes : []; const screens = Array.isArray(unification.canonical_screens) ? unification.canonical_screens : []; const workOrders = Array.isArray(evolution.work_orders) ? evolution.work_orders : []; const templates = Array.isArray(uiSpec.templates_used) ? uiSpec.templates_used : []; const domains = Array.isArray(organism.domains) ? organism.domains : []; const blindSpots = Array.isArray(organism.blind_spots) ? organism.blind_spots : []; const actionMode = organism.mode || (runtime?.ok === false ? "guarded_observe_plan" : runtime ? "guarded_live_action" : "safe_observation"); const runtimeConnected = Boolean(runtime); const guarded = blockers.length > 0 || runtime?.ok === false || String(actionMode).includes("guard"); const tradingAllowed = Boolean(organism?.summary?.trading_action_allowed || runtime?.trading_action_allowed); const exchangeRows = useMemo(() => EXCHANGES.map((name) => ({ name, ready: exchangeReady(runtime, name), error: exchangeError(runtime, name), governor: runtime?.api_governor?.exchanges?.[name] || {}, equity: runtime?.[name]?.equity ?? runtime?.combined?.[`${name}_equity`] ?? runtime?.combined?.[`${name}_equity_gbp`] ?? runtime?.exchanges?.[name]?.equity ?? null, })), [runtime]); return (
Aureon Designed Live Operations Interface {runtimeConnected ? (guarded ? "connected guarded" : "connected live") : "runtime offline"} {tradingAllowed ? "action path clear" : "action path waiting"} {shortText(uiSpec.status, "builder spec pending")}

This surface is generated from Aureon's own frontend inventory, unification plan, evolution queue, capability switchboard, runtime feed, HNC/Auris evidence, and existing dashboard templates.

{snapshot.runtimeEndpoint ? ( ) : null}
row.ready).length}/4`} icon={LineChart} kind={exchangeRows.every((row) => row.ready) ? "good" : "warn"} />
{blockers.slice(0, 7).map((blocker) => )}
Live Trading Mesh Whole Mind HNC/Auris Operations Self-Build Evidence
{Object.entries(uiSpec.live_interfaces || {}).map(([name, url]) => (
{name.replace(/_/g, " ")}
{String(url)}
))}
{exchangeRows.map((row) => (
{row.name}
{row.error ?
{row.error}
: null}
))}
{capabilityModes.map((mode: JsonMap) => (
{shortText(mode.title)}
{shortText(mode.authority_level).replace(/_/g, " ")}
{(mode.systems || []).slice(0, 7).map((system: string) => )}
))}
{domains.slice(0, 8).map((domain: JsonMap) => (
{shortText(domain.label || domain.id)}
))}
{(uiSpec.capability_labels || []).map((label: string) => (
{label}
))}
{screens.map((screen: JsonMap) => (
{shortText(screen.title)}
{shortText(screen.goal)}
))}
{workOrders.slice(0, 12).map((order: JsonMap) => (
{shortText(order.title)}
{shortText(order.source_path)}
))}
{Object.entries(PUBLIC_ENDPOINTS).map(([key, url]) => (
{url}
{shortText(data[key]?.status || data[key]?.generated_at, "no status")}
))}
{templates.slice(0, 32).map((template: string) => (
{template}
))}
{snapshot.errors.length ? (
{snapshot.errors.slice(0, 8).join(" | ")}
) : null}
); } export const AureonCodingOrganismConsole = AureonGeneratedOperationalConsole; function Panel({ title, icon: Icon, children }: { title: string; icon: typeof Activity; children: React.ReactNode }) { return (
{title}
{children}
); } function Datum({ label, value }: { label: string; value: string }) { return (
{label}
{value}
); } function LineList({ items }: { items: unknown[] }) { const lines = (items || []).map((item) => String(item || "").trim()).filter(Boolean); return (
{lines.length ? lines.map((line) => (
{line}
)) : (
Waiting for evidence.
)}
); }