Repository navigation
refactor(go/plugins/a2ui)!: carry A2UI messages under the spec's messages key - #7092
Merged
Merged
Conversation
Contributor
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
This was referenced Nov 5, 2026
refactor(a2ui)!: drop client helpers and align the a2ui part with the spec
genkit-ai/genkit-dart#710
Merged
pavelgj
marked this pull request as ready for review
November 18, 2026 18:45
chrisraygill
left a comment
Contributor
There was a problem hiding this comment.
The "messages" rename and shared messagesOf helper look clean. Found two edge cases in messagesOf and some missing test cases inline.
(Coordination note: go/samples/basic-middleware/a2ui pairs with js/testapps/a2ui/web / @genkit-ai/a2ui/client, so #7091 should merge before or alongside this.)
chrisraygill
approved these changes
Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's new
The a2ui part now carries its A2UI messages under the spec's
messageskey instead of our ownenvelopes:{ "data": { "messages": [ { "version": "v0.9", "createSurface": { "surfaceId": "tokyo-weather", "catalogId": "..." } } ] }, "metadata": { "mimeType": "application/a2ui+json" } }newPartwrites"messages".IsPartandEnvelopesFromPartsaccept either key, so parts written before this change (persisted sessions, older agents) are still read:IsPartnow also requires the value to be a list, matching the JS plugin; before, any value underenvelopesmade a part count as a2ui.Why
The A2UI extension spec puts the message list directly in a data part's
data. Genkit requiresdatato be an object (Dart expects a map), so we wrapped the list, but under a key we made up. The spec already has a wrapper for exactly this, the{ messages: [...] }payload, which renderer SDKs read as-is. Using it means one less Genkit-specific shape between an agent and a renderer.This keeps the plugins in step across languages: Genkit Dart made the same change in genkit-ai/genkit-dart#710, and the JS plugin gets it in #7091. Until all three ship, a newer agent and an older client disagree on the key, which is why every reader accepts both.
messagesmessagesorenvelopesmessagesmessagesorenvelopesmessagesmessagesorenvelopesBreaking Changes
The plugin is experimental (
exp), but code that reads the part's data map directly needs updating:Code that uses
EnvelopesFromPartsneeds no change.Not in this PR
envelopesfallback. Reading it costs nothing and keeps old sessions replaying; it can go once the plugin leavesexp.EnvelopesFromPartsor theEnvelopetype. Only the wire key changes.