Update the streaming parser to support A2UI spec v0.9#962
Update the streaming parser to support A2UI spec v0.9#962nan-yu wants to merge 2 commits intogoogle:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the A2UI streaming parser to enhance support for both v0.8 and v0.9 message formats, particularly for data model updates and component handling. The changes introduce an abstract A2uiVersionHandler with version-specific implementations for message recognition, surface ID extraction, component wrapping, and data model parsing. The A2uiStreamParser now utilizes these handlers, leading to a more modular and extensible design. Key updates include a new _get_loading_placeholder helper, refined JSON buffer processing, granular v0.9 data model update handling with path-based merging, and improved component dependency tracking. Comprehensive new tests for v0.9 functionality have been added. Review comments indicate a duplicate test function in test_streaming_v09.py, an unused parameter in _get_loading_placeholder, a potentially redundant or problematic lstrip call in _process_json_chunk, a commented-out debug log that should be addressed, and two TODOs in version_handlers.py highlighting architectural debt related to data model parsing and path depth support.
fcac4be to
9f210f7
Compare
9f210f7 to
b9dba29
Compare
|
This needs to rebase once #991 is merged. |
Description
Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.
List which issues are fixed by this PR. For larger changes, raising an issue first helps reduce redundant work.
Pre-launch Checklist
If you need help, consider asking for advice on the discussion board.