// AI agent showcase — animated terminal "console replay" of an agent run const AgentShowcase = () => { const D = PORTFOLIO_DATA; const run = D.agentRun; const totalDuration = run[run.length - 1].t + 1500; const [playing, setPlaying] = React.useState(true); const [elapsed, setElapsed] = React.useState(0); const [resetKey, setResetKey] = React.useState(0); React.useEffect(() => { if (!playing) return; let raf, start = performance.now() - elapsed; const tick = (now) => { const e = now - start; if (e >= totalDuration) { setElapsed(totalDuration); setPlaying(false); return; } setElapsed(e); raf = requestAnimationFrame(tick); }; raf = requestAnimationFrame(tick); return () => cancelAnimationFrame(raf); }, [playing, resetKey]); const visible = run.filter(r => r.t <= elapsed); const progress = Math.min(elapsed / totalDuration, 1); const restart = () => { setElapsed(0); setPlaying(true); setResetKey(k => k + 1); }; const lineFor = (line, i) => { const styles = { system: { prefix: "▸", color: "var(--text-faint)" }, user: { prefix: "❯", color: "var(--accent)" }, thought: { prefix: "↪", color: "var(--text-dim)" }, tool: { prefix: "⌁", color: "var(--accent-2)" }, output: { prefix: "✓", color: "var(--good)" }, }; const s = styles[line.kind]; return (
{d}