package webui import ( "encoding/json" "fmt" "html" "os" "path/filepath" "regexp" "sort" "strconv" "strings" "bee/audit/internal/schema" ) // renderTopo renders the /topo page: a read-only visualization of the server // topology (CPU sockets, NUMA-affine PCIe devices, PSU/BMC) plus a separate // NVLink topology card. It is pure visualization: everything it reads either // already exists in the audit.json contract, or comes from the persisted // techdump captured once per audit cycle (platform.CaptureTechnicalDump) — // nothing here shells out to nvidia-smi itself, writes to // schema.HardwarePCIeDevice or any other contract type, or talks to // Reanimator Core. func renderTopo(opts HandlerOptions) string { data, err := loadSnapshot(opts.AuditPath) if err != nil { return topoCard("Topology", `No audit data`) } var ingest schema.HardwareIngestRequest if err := json.Unmarshal(data, &ingest); err != nil { return topoCard("Topology", `Parse error`) } hw := ingest.Hardware var b strings.Builder b.WriteString(renderTopoMainDiagram(hw, opts.ExportDir)) if nv := renderTopoNVLinkCard(hw, opts.ExportDir); nv != "" { b.WriteString(nv) } return b.String() } func topoCard(title, body string) string { return `
| GPU A | GPU B | NVLinks |
|---|---|---|
| GPU %d | GPU %d | %d |