GenUiTraceRecorder class
Records a session so it can be replayed later.
Attach it to the controller and send the agent's messages through it instead of straight to the controller:
final recorder = GenUiTraceRecorder.attach(
controller,
catalogId: catalog.catalogId,
redact: const ['/user/email'],
);
transport.messages.listen(recorder.handleMessage);
...
await File('bug-4821.a2ui-trace').writeAsString(recorder.build().encode());
What it keeps: every message the agent sent, the contents of each surface's data model whenever they changed, and every action or error the app sent back. That is everything the renderer saw, which is what makes the replay faithful rather than approximate.
What it cannot keep: anything a catalog item reads from outside the data model. A component that asks the clock or the network for something renders from that, not from the trace, and replays differently. Keep those behind a function the catalog declares, and the trace covers them too.
Constructors
Properties
- catalogId → String?
-
The catalog the session runs against, written into the trace.
final
- controller → SurfaceController
-
The controller messages are forwarded to.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
) → GenUiTrace - The session so far.
-
dispose(
) → void - Stops recording and releases what it was listening to.
-
handleMessage(
A2uiMessage message) → void -
Records
messageand hands it to the controller. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited