import type { MemorySamples } from '../types' interface MemoryVizProps { samples: MemorySamples } export function MemoryViz({ samples }: MemoryVizProps) { const { traces, total } = samples // Create a grid of weight values for the heatmap const cellSize = 8 const cols = 20 const rows = Math.ceil(traces.length / cols) return (
{total.toLocaleString()} total traces
weight
1.0
{traces.map((trace, i) => { const w = trace.weight const color = w >= 0.75 ? '#a78bfa' : w >= 0.5 ? '#7c3aed' : w >= 0.25 ? '#4c2a8e' : '#1e1e30' return (
= 0.5 ? `0 0 4px ${color}80` : 'none', }} > {trace.meta && (
)}
id:{trace.id} w:{trace.weight.toFixed(2)} {trace.tag && `ยท ${trace.tag}`}
) })}
) }