Skip to content

feat: citations + sync all @ngaf to 0.0.21#194

Merged
blove merged 16 commits into
mainfrom
claude/chat-citations-0.0.21
May 4, 2026
Merged

feat: citations + sync all @ngaf to 0.0.21#194
blove merged 16 commits into
mainfrom
claude/chat-citations-0.0.21

Conversation

@blove

@blove blove commented May 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds citations to @ngaf/chat and the LangGraph + ag-ui adapter bridges; synchronizes all 16 @Ngaf libraries to 0.0.21 per project policy.

Citations

  • Citation interface + Message.citations?: Citation[] field in @ngaf/chat
  • <chat-citations> primitive — sources panel rendered under assistant messages, with <ng-template chatCitationCard> slot
  • MarkdownCitationReferenceComponent registered in the markdown view registry under 'citation-reference' (selector chat-md-citation-reference)
  • CitationsResolverService — signal-backed, merges Message.citations (precedence) + markdown sidecar
  • Mid-stream resolved-flip: unresolved markers render greyed, flip to active links when matching citation arrives

Adapter bridges

  • @ngaf/langgraphextractCitations() reads additional_kwargs.citations (or .sources fallback). Coerces key spellings (href/sourceurl, nametitle, content/excerptsnippet).
  • @ngaf/ag-uibridgeCitationsState() reads thread state at state.citations[messageId] from STATE_DELTA / STATE_SNAPSHOT.

Synchronized version bump

All 16 @ngaf/* libraries → 0.0.21. Single tag ngaf-v0.0.21 at squash-merge commit. @cacheplane/partial-markdown peer in chat bumped to ^0.2.0.

Test plan

  • chat: 395 tests green (+7 new for citations)
  • langgraph: 7 new tests for extractCitations
  • ag-ui: 5 new tests for bridgeCitationsState
  • All chat selectors comply with chat-/chat-md- lint prefix rule
  • Existing chat-message + chat-streaming-md tests still pass

Spec: docs/superpowers/specs/2026-05-04-chat-citations-design.md
Plan: docs/superpowers/plans/2026-05-04-chat-citations.md

blove and others added 14 commits May 4, 2026 14:28
Citations as Message.citations[] populated by adapters, rendered inline by
markdown citation-reference view component and as a sources panel via
<chat-citations>. CitationsResolverService merges Message.citations and
markdown-doc sidecar with message-first precedence.

Synchronizes all 16 @Ngaf libraries to 0.0.21 per project policy.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Implements MarkdownCitationReferenceComponent (selector chat-md-citation-reference)
that renders inline citation markers resolved via CitationsResolverService.
Registers the component under the 'citation-reference' key in cacheplaneMarkdownViews.
Updates the view registry spec to cover 19 node types (v0.2 adds citation-reference).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Creates ChatCitationsComponent (chat-citations selector) with a ChatCitationCardTemplateDirective
ContentChild slot for custom card rendering, and ChatCitationsCardComponent (chat-citations-card)
for default citation display. Exports all three from the chat public surface.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds optional [message] input to ChatMessageComponent and renders
<chat-citations [message]="msg" /> after the body slot for assistant role.
Provides CitationsResolverService at the chat-message component level and
uses an effect to sync message() into the resolver's signal.
Updates the component spec to provide CitationsResolverService in the test injector.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…-streaming-md

Injects CitationsResolverService optionally in ChatStreamingMdComponent and feeds
markdownDefs from doc.citations via an effect on the root() signal. This chains
the markdown AST citation sidecar into the resolver so inline citation-reference
markers can resolve to Citation objects at render time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…face

Adds MarkdownCitationReferenceComponent to the @ngaf/chat public API so consumers
can override or inspect the inline citation marker renderer alongside the other
per-node markdown view components.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Create extractCitations() normalizer in internals/ and wire it into the
toMessage() BaseMessage → Message conversion so that
additional_kwargs.citations (or .sources fallback) flows through as
Message.citations on every assistant turn.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Create bridgeCitationsState() normalizer and wire it into reduceEvent()
after STATE_SNAPSHOT and STATE_DELTA apply their patches, so that
state.citations[messageId] arrays flow through as Message.citations on
every affected assistant message.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Per project policy: all @Ngaf packages share a single version. This bumps
all 16 libraries (a2ui, ag-ui, chat, cockpit-{docs,registry,shell,testing,ui},
db, design-tokens, example-layouts, langgraph, licensing, partial-json,
render, ui-react) to 0.0.21 alongside the citations release.
Add minimal documentation for the @Ngaf 0.0.21 citations release across all adapter libraries and changelog.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented May 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cacheplane Ready Ready Preview, Comment May 4, 2026 10:05pm

Request Review

@blove blove merged commit b5d4bb5 into main May 4, 2026
14 checks passed
@blove blove deleted the claude/chat-citations-0.0.21 branch May 4, 2026 22:11
blove added a commit that referenced this pull request Jun 9, 2026
* docs(spec): @ngaf/chat 0.0.21 citations + sync all @Ngaf to 0.0.21

Citations as Message.citations[] populated by adapters, rendered inline by
markdown citation-reference view component and as a sources panel via
<chat-citations>. CitationsResolverService merges Message.citations and
markdown-doc sidecar with message-first precedence.

Synchronizes all 16 @Ngaf libraries to 0.0.21 per project policy.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs(plan): @Ngaf 0.0.21 citations implementation plan

* feat(chat): add Citation interface

* feat(chat): add Message.citations field

* feat(chat): add CitationsResolverService

* feat(chat): add markdown citation-reference view component

Implements MarkdownCitationReferenceComponent (selector chat-md-citation-reference)
that renders inline citation markers resolved via CitationsResolverService.
Registers the component under the 'citation-reference' key in cacheplaneMarkdownViews.
Updates the view registry spec to cover 19 node types (v0.2 adds citation-reference).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(chat): add chat-citations primitive (sources panel)

Creates ChatCitationsComponent (chat-citations selector) with a ChatCitationCardTemplateDirective
ContentChild slot for custom card rendering, and ChatCitationsCardComponent (chat-citations-card)
for default citation display. Exports all three from the chat public surface.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(chat): render chat-citations under assistant messages

Adds optional [message] input to ChatMessageComponent and renders
<chat-citations [message]="msg" /> after the body slot for assistant role.
Provides CitationsResolverService at the chat-message component level and
uses an effect to sync message() into the resolver's signal.
Updates the component spec to provide CitationsResolverService in the test injector.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(chat): wire CitationsResolverService through chat-message + chat-streaming-md

Injects CitationsResolverService optionally in ChatStreamingMdComponent and feeds
markdownDefs from doc.citations via an effect on the root() signal. This chains
the markdown AST citation sidecar into the resolver so inline citation-reference
markers can resolve to Citation objects at render time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(chat): export MarkdownCitationReferenceComponent from public surface

Adds MarkdownCitationReferenceComponent to the @ngaf/chat public API so consumers
can override or inspect the inline citation marker renderer alongside the other
per-node markdown view components.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(langgraph): extract citations from additional_kwargs

Create extractCitations() normalizer in internals/ and wire it into the
toMessage() BaseMessage → Message conversion so that
additional_kwargs.citations (or .sources fallback) flows through as
Message.citations on every assistant turn.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(ag-ui): bridge state.citations into Message.citations

Create bridgeCitationsState() normalizer and wire it into reduceEvent()
after STATE_SNAPSHOT and STATE_DELTA apply their patches, so that
state.citations[messageId] arrays flow through as Message.citations on
every affected assistant message.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(release): synchronize all @Ngaf libs to 0.0.21

Per project policy: all @Ngaf packages share a single version. This bumps
all 16 libraries (a2ui, ag-ui, chat, cockpit-{docs,registry,shell,testing,ui},
db, design-tokens, example-layouts, langgraph, licensing, partial-json,
render, ui-react) to 0.0.21 alongside the citations release.

* docs: chat citations + adapter bridge documentation

Add minimal documentation for the @Ngaf 0.0.21 citations release across all adapter libraries and changelog.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore: bump @cacheplane/partial-markdown to ^0.2.0 in workspace root

* fix(chat): use inject() for ChatCitationCardTemplateDirective per lint rule

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant