replayer¶
import "github.com/jbcom/radioactive-ralph/internal/session/cassette/replayer"
Package main is the cassette replayer binary.
When pointed at a cassette via RALPH_CASSETTE_PATH, it replays the recorded stream-json frames to stdout and expects the same stdin sequence from the client. This lets tests use session.Session exactly as they would with a real `claude -p` subprocess, without needing API credentials in CI.
Usage is identical to `claude -p`:
session.Spawn(ctx, session.Options{
ClaudeBin: ".../replayer", // built from this package
})
The replayer:
honors –session-id and –resume by copying the value into the first “system”/init frame it emits (so s.SessionID() still observes a sensible value in replay mode),
waits for stdin to send each recorded “in” line before emitting the subsequent “out” frames (ensures Send→Reply ordering matches),
falls back to a fast-forward mode (ignoring recorded timing) when RALPH_CASSETTE_FAST=1 is set; otherwise it respects the recorded time offsets within a cap to avoid sleeping forever on slow cassettes.
Index¶
Generated by gomarkdoc