gleamunison/transcript
Types
One recorded effect call. args/result are inspect-renderings: faithful for the JSON-at-the-boundary abilities (LLM, HTTP), best-effort for opaque values. Live replay uses the raw captured values, not these.
pub type OpRecord {
OpRecord(
ability: String,
op: Int,
args_repr: String,
result_repr: String,
seq: Int,
)
}
Constructors
-
OpRecord( ability: String, op: Int, args_repr: String, result_repr: String, seq: Int, )
Opaque handle to a playback cursor over raw captured values.
pub opaque type Playback
Values
pub fn capture(rec: Recorder) -> Tape
Capture the log as a Tape: serializable entries plus the raw values needed for in-process replay.
pub fn diff(a: Tape, b: Tape) -> List(DiffEntry)
First-divergence diff between two tapes, aligned by seq.
pub fn entries(rec: Recorder) -> List(OpRecord)
Entries recorded so far, in call order (inspect-rendered view).
pub fn from_entries(entries: List(OpRecord)) -> Tape
Build a tape from bare entries (no raw values: audit/diff only, playback from it is empty by construction).
pub fn from_json(json: String) -> Result(Tape, String)
Parse an audit JSON tape. Entry fields decode as strings; a malformed payload is an Error, never a partial tape.
pub fn playback(tape: Tape) -> Playback
Start replaying a tape. Replay consumes raw captured values in order; a tape built from JSON or from_entries has no raw values and replays as exhausted.
pub fn playback_remaining(pb: Playback) -> Int
pub fn replay_frames(
pb: Playback,
frames: List(effects.HandlerFrame),
) -> List(effects.HandlerFrame)
Frames whose handlers serve recorded results in order, never calling the inner handler. A mismatch or exhausted tape raises: replay is for verification, and silent drift must be loud.
pub fn stop_playback(pb: Playback) -> Nil
pub fn to_json(tape: Tape) -> String
Audit serialization: one JSON object per entry, in order.
pub fn wrap_frames(
rec: Recorder,
frames: List(effects.HandlerFrame),
) -> List(effects.HandlerFrame)
Wrap every op handler in every frame: each call is appended to the log with its ability key, op index, raw args and raw result. The recorded result is what the inner handler passes to the continuation.