"use client"; import { BrainAssetMemory } from "@/lib/types"; export function BlumMemoryPanel({ memory }: { memory: BrainAssetMemory | null }) { if (!memory) { return (
Blum MemoryLoading
Historical memory is loading for this instrument.
); } const similarity = memory.historical_similarity; return (
Blum Memory {memory.learning_state}

{memory.blum_memory_summary}

Historical Similarity {similarity.explanation}

Why Confidence Changed

{(memory.why_confidence_changed.length ? memory.why_confidence_changed : ["No confidence change has been recorded yet."]).slice(0, 5).map((item) => ( {item} ))}

What Blum Learned

{memory.what_blum_learned.slice(0, 5).map((item) => {item})}

Confidence Evolution

{memory.confidence_evolution.slice(0, 8).map((item) => (
{Number(item.adjusted_confidence ?? 0).toFixed(1)} {Number(item.adjustment ?? 0).toFixed(1)} pts | {item.signal_type ?? "signal"}
))} {!memory.confidence_evolution.length &&
No confidence history yet.
}

Signal Outcome History

{memory.signal_outcome_history.slice(0, 8).map((row) => (
{row.horizon_days}D {row.outcome} {row.signal_type} | return {displayPercent(row.realized_return)} | data {row.data_quality_score.toFixed(0)}
))} {!memory.signal_outcome_history.length &&
No evaluated signal horizons yet.
}
{!!memory.similar_historical_setups.length && (
{memory.similar_historical_setups.slice(0, 6).map((item) => ( {item.outcome_summary?.historical_ticker ?? "Case"} | {Number(item.similarity_score ?? 0).toFixed(0)} similarity | {item.outcome_summary?.final_outcome ?? "pending"} ))}
)}

{memory.governance_note}

); } function MemoryMetric({ label, value }: { label: string; value: number | string }) { return
{label}{value}
; } function displayPercent(value: number | null | undefined) { if (value === null || value === undefined) return "Pending"; return `${Number(value).toFixed(2)}%`; } function ratio(value: number | null | undefined) { if (value === null || value === undefined) return "Pending"; return `${Math.round(Number(value) * 100)}%`; }