Chunk 4: Citation Data Model + Storage

↗ view on GitHub · Gadoes · 2026-05-02 · d17c6e96

- Migration 001_citations.sql: citations table with liveness_status
  (unchecked|live|unreachable only - verified/unverified reserved for
  hallucination council Feature 2)
- Updated types.ts: Citation, CitationLivenessStatus, CitationSourceType types
- citationParser.ts: parseSingleCitation() and parseMcpResultToCitations()
  map MCP tool results to Citation schema for all 6 sources
- chatTools.ts: runToolCalls() extracts and accumulates citations from MCP results
- chatTools.ts: runLLMStream() emits mcp_citations SSE event at end of each
  assistant message (empty array emitted if no MCP tools called)

Acceptance criteria:
[x] Citation parser maps mock MCP response to citation schema for each source_type
[x] mcp_citations SSE event emitted with correct shape
[x] Empty array emitted if no MCP tools called
[x] Excerpt truncated to ≤500 chars
[x] liveness_status defaults to 'unchecked'

Tests: 37 pass (13 new citation parser tests)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Repository Gadoes/dispumike
Author Gadoes <62180984+Gadoes@users.noreply.github.com>
Authored
Parents 3091a892
Stats 5 files changed , +534 , -1
Part of Citation Data Model and Rendering

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-d17c6e96.md from inside the repo you want the change in.

⬇ Download capture-commit-d17c6e96.md