Skip to content

feat(ag-ui): project sources listed in state as message citations - #1598

Merged
blove merged 4 commits into
mainfrom
blove/ag-ui-citations
Nov 15, 2026
Merged

blove merged 4 commits into
mainfrom
blove/ag-ui-citations

Conversation

@blove

@blove blove commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Stacked on #1596 (base blove/ag-ui-agent-session), which is stacked on #1595. Merge those first.

What

Assistant messages projected from an AG-UI session now carry citations. In a live check before this change, the backend's markers showed as raw text ([^ng-signals-overview]) and there was no Sources panel.

Behavior

  • AG-UI has no citation event, so a backend sends sources as application state. projectMessages reads state.citations[messageId] and attaches the list to that assistant message as core Citation values. This is the same convention the Angular adapter's bridgeCitationsState reads.
  • An entry may be a URL string or a record. id or refId, title or name, url, href or source, and snippet, content or excerpt are read; a missing id or index is filled from the entry's position. The rules match the LangGraph runtime's citation projection.
  • An empty, missing or malformed listing adds nothing. Only assistant messages get citations.
  • A message keeps its reference when the list is unchanged, or replaced by an equal one in a state snapshot.
  • Through createAgentSession, a change to a message's sources notifies subscribers; other state changes stay silent.

Limits

  • The key must be the message's current identifier. The LangGraph adapter lists sources under the saved identifier, so they appear when the final messages snapshot arrives, not while the answer streams.
  • Sources for child-attributed records are not projected.

Verification

  • Runtime: 4 new tests in message-projection.spec.ts (aliases and defaults, malformed listings, identity, and a state delta followed by a renaming messages snapshot through the real session). React: Chat over the real session shows the Sources panel and no raw marker.
  • Mutation check: disabling the lookup fails 3 runtime tests and the Chat test.
  • Live check in a browser against examples/ag-ui/python (gpt-5-mini): the answer showed numbered markers and "Sources 3"; no raw marker was visible.
  • npx nx run-many -t test,type-tests,lint,runtime-quality,runtime-type-tests -p ag-ui,react and the four builds: pass.
  • verify-ag-ui-candidate.mjs, verify-ag-ui-client-tools.mjs, review-native-ag-ui.mjs --verify, verify-packages.mjs, inventory.mjs --check --drift warn, and the 225 verifier spec tests: pass.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
threadplane Ready Ready Preview Nov 15, 2026 7:26pm UTC

Request Review

@blove
blove merged commit 97b6150 into main Nov 15, 2026
4 of 5 checks passed
@blove
blove deleted the blove/ag-ui-citations branch November 15, 2026 19:08

This branch was successfully deployed

1 active deployment
Preview – threadplane — d9947c6e Deployed Nov 15, 2026 by vercel[bot]
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