/** * What-we-know section — the load-bearing structural feature of the FlowPilot * task lane (per FLOWPILOT-MIGRATION.md Section 0 architectural claim #2). * * Owns the list of confirmed facts for a session. Facts arrive via three paths: * 1. AI [PROMOTE] markers parsed in unified_chat_service (most common) * 2. Engineer "+ Add a note" (manual user_note) * 3. Engineer-initiated promotion of a question/check (future affordance) * * This component is the parent's contract: it takes a fact list + handlers * and renders the section. Loading/refresh logic lives in the parent * (AssistantChatPage) so it can coordinate with the chat send cycle. */ import { Loader2 } from 'lucide-react' import { cn } from '@/lib/utils' import type { SessionFact } from '@/api/sessionFacts' import { WhatWeKnowItem } from './WhatWeKnowItem' import { AddNoteButton } from './AddNoteButton' interface WhatWeKnowProps { facts: SessionFact[] onAddNote: (text: string, summary: string | null) => Promise | void onUpdateFact: (factId: string, text: string, summary: string | null) => Promise | void onDeleteFact: (factId: string) => Promise | void loading?: boolean } export function WhatWeKnow({ facts, onAddNote, onUpdateFact, onDeleteFact, loading, }: WhatWeKnowProps) { const count = facts.length return (
What we know · {count} {loading && ( synthesizing )}
{count === 0 && loading && (
)} {count === 0 && !loading && (
Nothing confirmed yet — facts appear here as the engineer answers questions and runs checks.
)} {facts.map((fact) => ( onUpdateFact(fact.id, text, summary)} onDelete={() => onDeleteFact(fact.id)} /> ))}
) } export default WhatWeKnow