Documentation
¶
Overview ¶
Package codexitem decodes Codex items, the units of a Codex session (a user message, an agent message, a command, a file change, a tool call), from both of Codex's encodings — the rollout file's item_completed events and the app-server's item notifications — into one normalized Item, so the stored transcript and a live stream map them identically.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Change ¶
type Change struct {
Path string
Kind string // add, delete, update
MovePath string // update with a move
Diff string // the unified diff; for add and delete, the file's content
}
Change is one file of a file change.
type Item ¶
type Item struct {
ID string
TurnID string
Kind Kind
Status Status
StartedAtMs int64
CompletedAtMs int64
LineTS string // rollout: the line's timestamp, as written (fallback for a missing completed_at_ms)
Parts []string // user: the text of each content part, in order
Text string // agent: the message text (rollout: the parts' text joined with no separator)
Command string // command: the script (see scriptOfArgv / scriptOfString)
CWD string
Output string // command: aggregated output; mcpTool: result text
ExitCode *int
Changes []Change // fileChange, sorted by Path
Server string // mcpTool
Tool string // mcpTool, collabTool (e.g. spawnAgent)
Arguments json.RawMessage // mcpTool
Error string // mcpTool: the error message, if any
Query string // webSearch
Path string // imageView
Prompt string // collabTool
ReceiverThreadIDs []string // collabTool
AgentThreadID string // subAgentActivity
AgentPath string // subAgentActivity
ActivityKind string // subAgentActivity: started, interacted, interrupted, completed
}
Item is a decoded Codex item. Only the fields of its Kind are set.
func DecodeDaemon ¶
DecodeDaemon decodes an app-server item/started or item/completed notification's params; ok is false for other methods and for an item it can't read or that has no ID.
func DecodeRollout ¶
DecodeRollout decodes one rollout line; ok is true for an event_msg item_completed line whose item it can read (Kind other included) and that has an ID.
type Kind ¶
type Kind string
Kind is what an item is.
const ( KindUser Kind = "user" KindAgent Kind = "agent" KindCommand Kind = "command" KindFileChange Kind = "fileChange" KindMCPTool Kind = "mcpTool" KindWebSearch Kind = "webSearch" KindImageView Kind = "imageView" KindCollabTool Kind = "collabTool" KindSubAgent Kind = "subAgentActivity" KindOther Kind = "other" // reasoning, compaction, plans, dynamic tools, other extensions )