genui_mock library
Record, save, and replay GenUI streaming sessions as deterministic, git-diffable JSON fixtures — so you can test how a Catalog widget renders against real recorded model output without burning an API call or tolerating non-deterministic responses.
See the package README for the recommended record → save → replay
workflow. GenUiFixture, GenUiSessionRecorder, and GenUiFixturePlayer
have no dependency on package:genui; GenUiMockTransport is the small,
isolated adapter that plugs a fixture into GenUI's actual Transport
interface.
Classes
- GenUiFixture
- A recorded GenUI session: one or more RecordedTurns captured from a real, live conversation, saved so it can be replayed later without any network access.
- GenUiFixturePlayer
-
Replays the turns of a GenUiFixture in order, one per call to
playNextTurn — mirroring how a real GenUI
Transportgets onesendRequestcall per user turn and streams back one response per call. - GenUiMockTransport
-
A
Transportthat replays a recorded GenUiFixture instead of talking to a real model. - GenUiSessionRecorder
- Records one or more turns of a live GenUI session for later replay.
- RecordedChunk
- A single chunk of text as it was received from the model, plus how long after the previous chunk (or after the request was sent, for the first chunk of a turn) it arrived.
- RecordedTurn
-
All the chunks that made up one streamed model response, i.e. everything
that arrived after a single call to
Transport.sendRequest.
Enums
- PlaybackMode
- Controls how quickly a recorded turn is replayed.
Constants
- genUiFixtureFormatVersion → const int
-
The JSON schema version written by this release of
genui_mock.
Functions
-
replayTurn(
RecordedTurn turn, {PlaybackMode mode = PlaybackMode.instant, double speedMultiplier = 1.0}) → Stream< String> -
Replays a single RecordedTurn as a
Stream<String>.