CodexReplay
A CodexAppServer that replays a recorded session with no process.
CodexAgent.layer().pipe(Layer.provide(CodexReplay.layer(jsonlText)))A recording is what CodexAppServer.layer({ record }) writes: one JSON
object per line, {"dir":"out","msg":...} for client->server frames and
{"dir":"in","msg":...} for server->client frames. A line
{"dir":"exit","exitCode":null,"signal":"SIGKILL"} simulates app-server
dying at that point.
Each client request is matched to the next recorded out request with the
same method; the recorded in frames after it are then delivered, up to
the next recorded out request. Response ids are rewritten to the client’s
request ids, and recorded clientUserMessageIds to the client’s.
Since v0.1.0
Models
Section titled “Models”Frame (type alias)
Section titled “Frame (type alias)”One line of a recording.
Signature
type Frame = | { readonly dir: "out" | "in"; readonly msg: P.Message } | { readonly dir: "exit" readonly exitCode: number | null readonly signal: string | null }Since v0.1.0
Testing
Section titled “Testing”recording is JSONL text (as written by record) or parsed frames.
Signature
declare const layer: ( recording: string | ReadonlyArray<Frame>,) => Layer.Layer<CodexAppServer>Since v0.1.0
parseRecording
Section titled “parseRecording”Parses JSONL recording text into frames. Throws on a line that isn’t one.
Signature
declare const parseRecording: (jsonl: string) => ReadonlyArray<Frame>Since v0.1.0