/** * InvestigationSummaryPanelV3 — Phase 4, Experiment 12 * A user-facing facilitator view that translates the reasoning graph into * a concise, human-meaningful presentation. * * Design principles: * - The panel shows up to four sections: what we know, still investigating, * possible explanations, and a quiet summary. * - All content is grounded in existing graph fields. No invented facts. * - Epistemic labels are explicit (structural), not colour-dependent. * - The same panel remains useful during early, active and terminal states. */ import { buildFacilitatorViewModel } from "@/lib/presentation/facilitator-view-adapter"; import React from "react"; /* ── Item rendering ─────────────────────────────────────────────── */ /** * Render a single item with its structural label where applicable. */ function renderItem(item, isExplanation) { if (isExplanation && typeof item === "object") { return (
  • {item.text} {item.label}
  • ); } return (
  • {item}
  • ); } /* ── Section components ──────────────────────────────────────────── */ function KnownSection({ title, items }) { if (!items || items.length === 0) return null; return (

    {title}

    ); } function InvestigatingSection({ title, items }) { if (!items || items.length === 0) return null; return (

    {title}

    ); } function ExplanationSection({ items }) { if (!items || items.length === 0) return null; return (

    Possible explanations

    ); } function QuietSummary({ text }) { if (!text) return null; return (

    Investigation state

    {text}

    ); } /* ── Empty-state fallback ──────────────────────────────────────── */ function EmptyState() { return (
    {/* Intentionally no Possible explanations section when empty */}

    We are still establishing the basic facts.

    ); } /* ── Main component ────────────────────────────────────────────── */ function InvestigationSummaryPanelV3({ graph, selectedQuestion, result }) { // Build the view model from the adapter const resolvedIds = new Set(graph?.resolvedNodeIds || []); const viewModel = buildFacilitatorViewModel({ nodes: graph?.nodes || [], resolvedIds, activeUnknownNodeId: graph?.activeUnknownNodeId || null, edges: graph?.edges || [], selectedQuestion, }); // Early state fallback if (!viewModel.known.hasItems && !viewModel.investigating.hasItems) { return ; } return (
    {/* What we know */} {/* Still investigating — or "Remaining cautions" in terminal state */} {!viewModel.investigating.shouldOmit && ( )} {/* Possible explanations */} {viewModel.explanations.hasItems && ( )} {/* Quiet reasoning summary */}
    ); } export default InvestigationSummaryPanelV3;