Skip to content

Time travel & traces

OmegaTimeTravelRecorder captures channel events plus an optional initial app snapshot from the OmegaFlowManager. OmegaRecordedSession stores that data so you can replay up to a chosen event index — useful for reproducing bugs and demos.


Record → stop → replay

dart
final recorder = OmegaTimeTravelRecorder();
recorder.startRecording(channel, flowManager);
// ... user drives the app; events append ...
final session = recorder.stopRecording();
// Restore state + re-emit events 0..n (inclusive)
recorder.replay(session, channel, flowManager, upToIndex: 12);

During replay the recorder sets an internal flag so re-emitted events are not appended again to the session list.


Export JSON (CI, sharing, omega trace)

Sessions can be serialized for files or backends. Typical shape includes:

  • events — list of recorded channel events
  • initialSnapshot — optional OmegaAppSnapshot JSON

Use the CLI to inspect files without opening the app:

bash
dart run omega_architecture:omega trace view ./session.json
dart run omega_architecture:omega trace validate ./session.json

omega ai explain ./session.json adds heuristics (and optional --provider-api) on top of the same file — see Omega CLI.


Snapshots & persistence

OmegaFlowManager.getAppSnapshot / restoreFromSnapshot support save / restore of flow memory and active flow id. Values you persist should be JSON-serializable if you use toJson / fromJson on snapshots.

OmegaSnapshotStorage is the hook interface your app implements (file, shared_preferences, API, …).


Example app

The example/ project includes a time-travel panel in debug (see lib/main.dart and auth flow UI) wired to record/replay. Run:

bash
cd example && flutter run