"""Chat turns, claims, and audit graph state.""" from __future__ import annotations from typing import Literal, TypedDict class Citation(TypedDict): title: str uri: str class ChatTurn(TypedDict): id: str role: Literal["user", "assistant"] content: str class Claim(TypedDict): id: str message_id: str order: int text: str is_claim: bool comment: str verdict: Literal["supported", "uncertain", "contradicted", "non_claim"] reason: str citations: list[Citation] class ParagraphAudit(TypedDict): index: int raw_text: str bullets: str claims: list[Claim] class MessageAudit(TypedDict, total=False): message_id: str role: Literal["user", "assistant"] content: str rewritten: str paragraphs: list[ParagraphAudit] claims: list[Claim] status: Literal["pending", "running", "done", "error"] # Progressive audit stream stages (published while status == running). phase: Literal[ "queued", "extracting", "searching", "judging", "done", "error", ] evidence_text: str class AuditState(TypedDict, total=False): turns: list[ChatTurn] message_audits: list[MessageAudit] claims: list[Claim] rewritten_transcript: str injected_context: str use_web_search: bool