[feat-004] References inline display

↗ view on GitHub · Nick Whitehouse · 2026-05-04 · e7f59072

Surfaces every legal_search and web_search result as a clickable card in
the assistant message, decoupling source-link visibility from Olava's
synthesis. Even when the model under-summarises (which it does because
it's a small reasoning model), the user sees every source and can click
through.

Backend
- chatTools.ts: new ReferenceResult type, accumulated by runToolCalls,
  returned alongside docsRead/docsCreated/etc. legal_search and
  web_search dispatch cases push one ReferenceResult per result and
  emit a "reference_added" SSE event for each (live streaming so cards
  appear as soon as fetched).
- runLLMStream's runTools callback iterates references and pushes
  reference_added events into the assistant message's events array, so
  reloading a chat keeps the cards visible.
- Backend AssistantEvent union extended with reference_added shape.

Frontend
- types.ts: AssistantEvent union extended to mirror the backend shape.
- useAssistantChat.ts: handles reference_added SSE events live.
- AssistantMessage.tsx: new ReferenceBlock card component (title +
  source label + date + snippet, blue dot connector, hover state,
  opens URL in new tab). Dispatch case interleaves cards
  chronologically with content and other tool events.

Same card style works for both legal and web sources - feat-005's
multi-pass orchestrator will produce many of these per turn and they'll
all render with one component.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Repository nwhitehouse/mike
Author Nick Whitehouse <nick.whitehouse@mccarthyfinch.com>
Authored
Parents 00e1dd66
Stats 5 files changed , +178 , -1
Part of References inline display + collapsible-wrapper fix

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-e7f59072.md from inside the repo you want the change in.

⬇ Download capture-commit-e7f59072.md