GenUiTraceRecorder class
Records a session so it can be replayed later.
Attach it to the app's MessageProcessor and send the agent's messages
through it instead of straight to the processor:
final recorder = GenUiTraceRecorder.attach(
processor,
catalogId: catalog.id,
redact: const ['/user/email'],
);
transport.messages.listen(recorder.processMessages);
...
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 component 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
-
GenUiTraceRecorder.attach(MessageProcessor<
ComponentImplementation> processor, {String? catalogId, List<String> redact = const <String>[], Map<String, Object?> notes = const <String, Object?>{}}) -
Creates a recorder attached to
processor.
Properties
- catalogId → String?
-
The catalog the session runs against, written into the trace.
final
- changes → Listenable
-
Fires whenever a step is recorded.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
processor
→ MessageProcessor<
ComponentImplementation> -
The processor the messages are handed to.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
) → GenUiTrace - The trace so far.
-
dispose(
) → void - Stops recording and releases what the recorder listens to.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
processMessages(
Object? payload) → void -
Records
payloadand hands it to the processor. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited