Skip to main content

codex_rollout_trace/
lib.rs

1//! Trace bundle format, writer, and reducer for Codex rollouts.
2//!
3//! This crate owns the trace schema. Hot-path Codex code should depend on the
4//! small writer API here; semantic replay and viewer projections stay outside
5//! `codex-core`.
6//!
7//! See `README.md` for the system diagram and reducer model.
8
9mod bundle;
10mod code_cell;
11mod compaction;
12mod inference;
13mod mcp;
14mod model;
15mod payload;
16mod protocol_event;
17mod raw_event;
18mod reducer;
19mod thread;
20mod tool_dispatch;
21mod writer;
22
23/// Conventional reduced-state cache name written next to a raw trace bundle.
24pub use bundle::REDUCED_STATE_FILE_NAME;
25/// No-op-capable handle for recording one code-mode runtime cell.
26pub use code_cell::CodeCellTraceContext;
27/// Raw checkpoint payload for a remote compaction install event.
28pub use compaction::CompactionCheckpointTracePayload;
29/// No-op-capable handle for recording remote-compaction requests.
30pub use compaction::CompactionTraceAttempt;
31/// Shared recorder context for a compaction checkpoint.
32pub use compaction::CompactionTraceContext;
33/// No-op-capable handle for recording one upstream inference attempt.
34pub use inference::InferenceTraceAttempt;
35/// Shared recorder context for inference attempts within one Codex turn.
36pub use inference::InferenceTraceContext;
37/// Trace-owned MCP execution correlation propagated to bridge request metadata.
38pub use mcp::McpCallTraceContext;
39/// Public reduced trace model returned by replay.
40pub use model::*;
41/// Stable identifier for one raw payload inside a rollout bundle.
42pub use payload::RawPayloadId;
43/// Coarse role labels for raw payload files.
44pub use payload::RawPayloadKind;
45/// Reference to a raw request/response/log payload stored in the bundle.
46pub use payload::RawPayloadRef;
47/// Monotonic sequence number assigned by the raw trace writer.
48pub use raw_event::RawEventSeq;
49/// Runtime requester observed before semantic reduction.
50pub use raw_event::RawToolCallRequester;
51/// One append-only raw trace event from `trace.jsonl`.
52pub use raw_event::RawTraceEvent;
53/// Event-envelope context supplied by hot-path trace producers.
54pub use raw_event::RawTraceEventContext;
55/// Typed payload for one raw trace event.
56pub use raw_event::RawTraceEventPayload;
57/// Replay a raw trace bundle and write/read its reduced `RolloutTrace`.
58pub use reducer::replay_bundle;
59/// Raw payload captured when a child agent reports completion to its parent.
60pub use thread::AgentResultTracePayload;
61/// Environment variable that enables local trace-bundle recording.
62pub use thread::CODEX_ROLLOUT_TRACE_ROOT_ENV;
63/// Raw metadata captured when a thread starts.
64pub use thread::ThreadStartedTraceMetadata;
65/// No-op-capable handle for recording one thread in a rollout bundle.
66pub use thread::ThreadTraceContext;
67/// Request data for the canonical Codex tool boundary.
68pub use tool_dispatch::ToolDispatchInvocation;
69/// Tool input observed at the registry boundary.
70pub use tool_dispatch::ToolDispatchPayload;
71/// Runtime source that caused a dispatch-level tool call.
72pub use tool_dispatch::ToolDispatchRequester;
73/// Result data returned from a dispatch-level tool call.
74pub use tool_dispatch::ToolDispatchResult;
75/// No-op-capable handle for recording one resolved tool dispatch.
76pub use tool_dispatch::ToolDispatchTraceContext;
77/// Append-only writer used by hot-path Codex instrumentation.
78pub use writer::TraceWriter;