-
Notifications
You must be signed in to change notification settings - Fork 159
Migrate package:genui onto package:a2ui_core (state engine + messages)
#974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0ed51f3
63ff2ef
7e26a0b
62bd418
967e146
5e6c5fd
af0bb83
3758fe3
df4695a
0d3b9d3
186a8c4
4427332
70ab86a
482a71a
cd6e937
fb94089
9f879bb
5a4709e
5b79216
325955b
dfbd5bc
93af987
8c76afa
44e65f1
7ebb12b
65fab55
fa9f087
b4cb2cc
7a3c568
e10ac97
a13a660
46e6731
a703c40
fc1d9d1
9626aab
1379e2f
2da7493
c223688
327042c
4e85e6d
bb50a98
014397b
c8bb06f
419fcad
a9c31da
af31e9c
860a867
77fd2cb
a1301dc
0ec37bf
817a29d
31923b2
9287405
9ad8800
94857d9
0543436
6cf6290
67a6900
e4dcf40
952811e
6047264
7cb37b2
255190d
403ba2d
20e5788
2a56d75
875ac71
e400746
d657fcb
22270d7
b9cb9c8
a9aa88e
d09677b
21bd5f9
c226b63
9fd9245
4f8f524
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # Migration Guide: 0.9.1 to 0.10.0 | ||
|
|
||
| `package:genui` now runs on the shared `package:a2ui_core` runtime (#811). Most | ||
| apps need no changes: the default AI/transport flow, catalog widgets, and | ||
| data-binding code are unaffected. You only need to act if you **implement a | ||
| custom `Transport` or construct or parse A2UI messages directly**, since those | ||
| message types moved to `a2ui_core`. | ||
|
|
||
| ## What you have to change | ||
|
|
||
| ### A2UI messages are now `a2ui_core` types | ||
|
|
||
| The genui message classes (`A2uiMessage`, `CreateSurface`, `UpdateComponents`, | ||
| `UpdateDataModel`, `DeleteSurface`) are removed. Add `a2ui_core` to your | ||
| dependencies and use its message types: | ||
|
|
||
| ```dart | ||
| // Before | ||
| controller.handleMessage( | ||
| UpdateComponents(surfaceId: 's', components: [ | ||
| Component(id: 'root', type: 'Text', properties: {'text': 'Hi'}), | ||
| ]), | ||
| ); | ||
| controller.handleMessage(CreateSurface(surfaceId: 's', catalogId: 'demo')); | ||
|
|
||
| // After | ||
| import 'package:a2ui_core/a2ui_core.dart' | ||
| show CreateSurfaceMessage, UpdateComponentsMessage; | ||
|
|
||
| controller.handleMessage( | ||
| UpdateComponentsMessage(surfaceId: 's', components: [ | ||
| {'id': 'root', 'component': 'Text', 'text': 'Hi'}, | ||
| ]), | ||
| ); | ||
| controller.handleMessage( | ||
| CreateSurfaceMessage(surfaceId: 's', catalogId: 'demo'), | ||
| ); | ||
| ``` | ||
|
|
||
| - **Custom transport:** `Transport.incomingMessages` and | ||
| `SurfaceController.handleMessage` now use `a2ui_core`'s `A2uiMessage`. Update | ||
| those signatures if you implement `Transport` or drive the controller directly. | ||
| - **Building messages:** `UpdateComponentsMessage` takes raw component JSON maps | ||
| (`{'id': ..., 'component': ..., ...props}`), not `Component` objects. | ||
| - **Parsing raw JSON:** use `A2uiMessage.fromJson(json)`. | ||
|
|
||
| ### `SurfaceController.store` is removed | ||
|
|
||
| Read a surface's data model via `SurfaceController.contextFor(id).dataModel`. | ||
|
|
||
| ## Behavior you may notice | ||
|
|
||
| - **`DataModel` writes are stricter.** Some writes that used to silently do | ||
| nothing now throw, e.g. writing through a path whose intermediate value isn't a | ||
| map or list. | ||
| - **Malformed messages are rejected more consistently** (missing or wrong | ||
| version, or more than one action key in a single message). | ||
| - **A duplicate `createSurface` for an active surface id is now an error** rather | ||
| than silently reusing the existing surface. | ||
| - **`updateDataModel` with `value: null` removes the key**, the same as omitting | ||
| the value. Distinguishing the two is pending flutter/genui#938. | ||
|
|
||
| ## What does not change | ||
|
|
||
| Your catalog widgets and data-binding code are untouched: `CatalogItemContext`, | ||
| `dataContext`, the `DataModel` / `DataPath` API, the `Bound*` widgets, and the | ||
| `SurfaceDefinition` / `Component` snapshots all keep their current shape. | ||
|
|
||
| A follow-up (#801) will unify these with the `a2ui_core` models once the upstream | ||
| Node Layer (A2UI#1282) lands. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
|
|
||
| import 'dart:async'; | ||
|
|
||
| import 'package:a2ui_core/a2ui_core.dart' as core; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are the symbol conflicts that prevent importing both libraries? I think it's worth us making sure that they don't have conflicting symbols in the longer run. If there's some easy way to avoid it now, that would be nice to, avoid all our clients adding
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you've since found them, but for future reference, the collisions are: |
||
| import 'package:genui/genui.dart'; | ||
|
|
||
| import 'agent/agent.dart'; | ||
|
|
@@ -22,7 +23,7 @@ class SimpleChatA2aTransport implements Transport { | |
| final A2uiTransportAdapter _adapter = A2uiTransportAdapter(); | ||
|
|
||
| @override | ||
| Stream<A2uiMessage> get incomingMessages => _adapter.incomingMessages; | ||
| Stream<core.A2uiMessage> get incomingMessages => _adapter.incomingMessages; | ||
|
|
||
| @override | ||
| Stream<String> get incomingText => _adapter.incomingText; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.