Documentation
¶
Index ¶
- Variables
- type AgentMessage
- type AgentMessageEvent
- type AgentReasoningEvent
- type Class
- type ContentItem
- type CustomToolCall
- type CustomToolCallOutput
- type EventMsg
- type ExecCommandEnd
- type File
- type FileSources
- type FunctionCall
- type FunctionCallOutput
- type GitInfo
- type InterAgentCommunication
- type InterAgentMeta
- type ItemCompleted
- type Line
- type MCPToolCallEnd
- type Message
- type PatchApplyEnd
- type PatchChange
- type RawPayload
- type Reasoning
- type ResponseItem
- type SessionMeta
- type Shape
- type Source
- type SubAgentActivity
- type TaskComplete
- type TaskStarted
- type ThreadClass
- type ThreadRolledBack
- type ThreadSettingsApplied
- type ThreadSpawn
- type TokenCount
- type TokenInfo
- type TokenUsageRecord
- type ToolSearchCall
- type ToolSearchOutput
- type Tree
- type TurnAborted
- type TurnContext
- type Usage
- type UserMessage
- type WebSearchCall
- type WebSearchEnd
Constants ¶
This section is empty.
Variables ¶
var ErrIncompleteFirstLine = errors.New("incomplete first rollout line")
Functions ¶
This section is empty.
Types ¶
type AgentMessage ¶
type AgentMessageEvent ¶
type AgentReasoningEvent ¶
type AgentReasoningEvent struct {
Text string `json:"text"`
}
type Class ¶
type Class string
Class is the closed outer rollout record class.
const ( ClassSessionMeta Class = "session_meta" ClassTurnContext Class = "turn_context" ClassResponseItem Class = "response_item" ClassEventMsg Class = "event_msg" ClassCompacted Class = "compacted" ClassWorldState Class = "world_state" ClassInterAgentMetadata Class = "inter_agent_communication_metadata" ClassInterAgentCommunication Class = "inter_agent_communication" ClassTokenUsageRecord Class = "token_usage_record" ClassRealtime Class = "realtime_item" )
type ContentItem ¶
type CustomToolCall ¶
type CustomToolCallOutput ¶
type CustomToolCallOutput struct {
ID string `json:"id,omitempty"`
CallID string `json:"call_id"`
Output json.RawMessage `json:"output"`
}
type EventMsg ¶
type EventMsg struct {
Type string `json:"type"`
Raw json.RawMessage `json:"raw"`
TaskStarted *TaskStarted `json:"task_started,omitempty"`
TaskComplete *TaskComplete `json:"task_complete,omitempty"`
TurnAborted *TurnAborted `json:"turn_aborted,omitempty"`
UserMessage *UserMessage `json:"user_message,omitempty"`
AgentMessage *AgentMessageEvent `json:"agent_message,omitempty"`
AgentReasoning *AgentReasoningEvent `json:"agent_reasoning,omitempty"`
TokenCount *TokenCount `json:"token_count,omitempty"`
ExecCommandEnd *ExecCommandEnd `json:"exec_command_end,omitempty"`
PatchApplyEnd *PatchApplyEnd `json:"patch_apply_end,omitempty"`
MCPToolCallEnd *MCPToolCallEnd `json:"mcp_tool_call_end,omitempty"`
WebSearchEnd *WebSearchEnd `json:"web_search_end,omitempty"`
SubAgentActivity *SubAgentActivity `json:"sub_agent_activity,omitempty"`
ThreadSettingsApplied *ThreadSettingsApplied `json:"thread_settings_applied,omitempty"`
ThreadRolledBack *ThreadRolledBack `json:"thread_rolled_back,omitempty"`
ItemCompleted *ItemCompleted `json:"item_completed,omitempty"`
ContextCompacted bool `json:"context_compacted,omitempty"`
ThreadGoalUpdated *RawPayload `json:"thread_goal_updated,omitempty"`
}
EventMsg is a closed saved lifecycle/UI event. Exactly one typed pointer is set.
type ExecCommandEnd ¶
type ExecCommandEnd struct {
CallID string `json:"call_id"`
TurnID string `json:"turn_id,omitempty"`
Status string `json:"status,omitempty"`
ExitCode *int `json:"exit_code,omitempty"`
Command json.RawMessage `json:"command,omitempty"`
CWD string `json:"cwd,omitempty"`
Stdout string `json:"stdout,omitempty"`
Stderr string `json:"stderr,omitempty"`
AggregatedOutput string `json:"aggregated_output,omitempty"`
FormattedOutput string `json:"formatted_output,omitempty"`
}
type File ¶
type File struct {
Path string `json:"path"`
Meta *SessionMeta `json:"session_meta"`
Lines []Line `json:"lines"`
TornFinalLine bool `json:"torn_final_line"`
}
type FileSources ¶
type FileSources = traceprocessing.FileSources
type FunctionCall ¶
type FunctionCallOutput ¶
type FunctionCallOutput struct {
ID string `json:"id,omitempty"`
CallID string `json:"call_id"`
Output json.RawMessage `json:"output"`
}
type InterAgentCommunication ¶
type InterAgentCommunication struct {
Author string `json:"author,omitempty"`
Recipient string `json:"recipient,omitempty"`
OtherRecipients []string `json:"other_recipients,omitempty"`
Content json.RawMessage `json:"content,omitempty"`
TriggerTurn *bool `json:"trigger_turn,omitempty"`
Raw json.RawMessage `json:"raw"`
}
type InterAgentMeta ¶
type InterAgentMeta struct {
TriggerTurn bool `json:"trigger_turn"`
Raw json.RawMessage `json:"raw"`
}
type ItemCompleted ¶
type ItemCompleted struct {
ThreadID string `json:"thread_id"`
TurnID string `json:"turn_id"`
Item json.RawMessage `json:"item"`
}
type Line ¶
type Line struct {
Ordinal int `json:"ordinal"`
Timestamp time.Time `json:"timestamp"`
Type string `json:"type"`
Class Class `json:"class"`
Raw json.RawMessage `json:"raw"`
Payload json.RawMessage `json:"payload"`
SessionMeta *SessionMeta `json:"session_meta,omitempty"`
TurnContext *TurnContext `json:"turn_context,omitempty"`
ResponseItem *ResponseItem `json:"response_item,omitempty"`
EventMsg *EventMsg `json:"event_msg,omitempty"`
Compacted *RawPayload `json:"compacted,omitempty"`
WorldState *RawPayload `json:"world_state,omitempty"`
InterAgentMetadata *InterAgentMeta `json:"inter_agent_communication_metadata,omitempty"`
InterAgentCommunication *InterAgentCommunication `json:"inter_agent_communication,omitempty"`
TokenUsageRecord *TokenUsageRecord `json:"token_usage_record,omitempty"`
Realtime *RawPayload `json:"realtime_item,omitempty"`
}
Line is one decoded rollout envelope. Exactly one typed payload pointer is set according to Class; Raw and Payload retain the complete source record.
type MCPToolCallEnd ¶
type MCPToolCallEnd struct {
CallID string `json:"call_id"`
Invocation json.RawMessage `json:"invocation,omitempty"`
Result json.RawMessage `json:"result,omitempty"`
}
type Message ¶
type Message struct {
ID string `json:"id,omitempty"`
Role string `json:"role"`
Content json.RawMessage `json:"content"`
Phase *string `json:"phase,omitempty"`
}
func (*Message) Items ¶
func (m *Message) Items() ([]ContentItem, error)
type PatchApplyEnd ¶
type PatchApplyEnd struct {
CallID string `json:"call_id"`
TurnID string `json:"turn_id,omitempty"`
Status string `json:"status,omitempty"`
Success *bool `json:"success,omitempty"`
Stdout string `json:"stdout,omitempty"`
Stderr string `json:"stderr,omitempty"`
Changes map[string]PatchChange `json:"changes,omitempty"`
}
type PatchChange ¶
type RawPayload ¶
type RawPayload struct {
Raw json.RawMessage `json:"raw"`
}
RawPayload is a known context-only payload whose vendor fields stay opaque.
type Reasoning ¶
type Reasoning struct {
ID string `json:"id,omitempty"`
Summary json.RawMessage `json:"summary,omitempty"`
Content json.RawMessage `json:"content,omitempty"`
EncryptedContent string `json:"encrypted_content,omitempty"`
}
type ResponseItem ¶
type ResponseItem struct {
Type string `json:"type"`
Raw json.RawMessage `json:"raw"`
Message *Message `json:"message,omitempty"`
AgentMessage *AgentMessage `json:"agent_message,omitempty"`
Reasoning *Reasoning `json:"reasoning,omitempty"`
FunctionCall *FunctionCall `json:"function_call,omitempty"`
FunctionOutput *FunctionCallOutput `json:"function_call_output,omitempty"`
CustomCall *CustomToolCall `json:"custom_tool_call,omitempty"`
CustomOutput *CustomToolCallOutput `json:"custom_tool_call_output,omitempty"`
ToolSearchCall *ToolSearchCall `json:"tool_search_call,omitempty"`
ToolSearchOutput *ToolSearchOutput `json:"tool_search_output,omitempty"`
WebSearchCall *WebSearchCall `json:"web_search_call,omitempty"`
Compaction *RawPayload `json:"compaction,omitempty"`
ImageGeneration *RawPayload `json:"image_generation_call,omitempty"`
}
ResponseItem is a closed Responses API item. Exactly one typed pointer is set.
type SessionMeta ¶
type SessionMeta struct {
ID string `json:"id"`
SessionID string `json:"session_id"`
ParentThreadID string `json:"parent_thread_id,omitempty"`
ForkedFromID string `json:"forked_from_id,omitempty"`
Timestamp *time.Time `json:"timestamp,omitempty"`
CWD string `json:"cwd,omitempty"`
CLIVersion string `json:"cli_version,omitempty"`
Source Source `json:"source"`
ThreadSource string `json:"thread_source,omitempty"`
AgentPath string `json:"agent_path,omitempty"`
AgentNickname string `json:"agent_nickname,omitempty"`
AgentRole string `json:"agent_role,omitempty"`
ModelProvider *string `json:"model_provider,omitempty"`
HistoryMode string `json:"history_mode,omitempty"`
HistoryBase json.RawMessage `json:"history_base,omitempty"`
SubagentHistoryStartOrdinal *int `json:"subagent_history_start_ordinal,omitempty"`
MultiAgentVersion *string `json:"multi_agent_version,omitempty"`
Git *GitInfo `json:"git,omitempty"`
Raw json.RawMessage `json:"raw"`
}
type Shape ¶
type Source ¶
type Source struct {
Unit string `json:"unit,omitempty"`
Custom string `json:"custom,omitempty"`
Internal string `json:"internal,omitempty"`
Subagent string `json:"subagent,omitempty"`
Other string `json:"other,omitempty"`
ThreadSpawn *ThreadSpawn `json:"thread_spawn,omitempty"`
Raw json.RawMessage `json:"raw"`
}
type SubAgentActivity ¶
type TaskComplete ¶
type TaskStarted ¶
type TaskStarted struct {
TurnID string `json:"turn_id"`
}
type ThreadClass ¶
type ThreadClass string
ThreadClass decides whether one rollout enters a session tree.
const ( ThreadRoot ThreadClass = "root" ThreadChild ThreadClass = "child" ThreadInternal ThreadClass = "internal" )
func ClassifyThread ¶
func ClassifyThread(lines []Line) (ThreadClass, error)
ClassifyThread uses only the first session_meta.
type ThreadRolledBack ¶
type ThreadRolledBack struct {
NumTurns int `json:"num_turns"`
}
type ThreadSettingsApplied ¶
type ThreadSettingsApplied struct {
ThreadSettings json.RawMessage `json:"thread_settings"`
}
type ThreadSpawn ¶
type TokenCount ¶
type TokenCount struct {
Info *TokenInfo `json:"info"`
RateLimits json.RawMessage `json:"rate_limits,omitempty"`
}
type TokenUsageRecord ¶
type TokenUsageRecord struct {
ThreadID string `json:"thread_id,omitempty"`
TurnID string `json:"turn_id,omitempty"`
SessionID string `json:"session_id,omitempty"`
RootTurnID string `json:"root_turn_id,omitempty"`
ResponseID string `json:"response_id,omitempty"`
Usage Usage `json:"usage"`
TurnTokenUsage Usage `json:"turn_token_usage"`
ThreadTokenUsage Usage `json:"thread_token_usage"`
Raw json.RawMessage `json:"raw"`
}
TokenUsageRecord is the top-level per-request usage record newer Codex versions write a few lines before the matching token_count event. Usage is the request's own usage (token_count's last_token_usage) and ThreadTokenUsage is the thread's running total (token_count's total_token_usage).
type ToolSearchCall ¶
type ToolSearchOutput ¶
type Tree ¶
type Tree struct {
Root *File
Children []*File
ForkSources []*File
// contains filtered or unexported fields
}
Tree is the explicitly listed, fully decoded rollout set for one session.
func DecodeFiles ¶
func DecodeFiles[T FileSources](fsys fs.FS, files T) (*Tree, error)
func DecodeLocalFiles ¶
func DecodeLocalFiles[T FileSources](files T) (*Tree, error)
func SingleFileTree ¶
type TurnAborted ¶
type TurnContext ¶
type TurnContext struct {
Fields map[string]json.RawMessage `json:"fields"`
Raw json.RawMessage `json:"raw"`
}
TurnContext retains every top-level setting and provides typed accessors for the fields used while mapping.
func (*TurnContext) AttributeFields ¶
func (c *TurnContext) AttributeFields() map[string]json.RawMessage
AttributeFields returns the settings snapshot without the turn identity.
func (*TurnContext) CWD ¶
func (c *TurnContext) CWD() string
func (*TurnContext) Model ¶
func (c *TurnContext) Model() string
func (*TurnContext) String ¶
func (c *TurnContext) String(key string) string
func (*TurnContext) TurnID ¶
func (c *TurnContext) TurnID() string
type Usage ¶
type Usage struct {
InputTokens *int64 `json:"input_tokens,omitempty"`
CachedInputTokens *int64 `json:"cached_input_tokens,omitempty"`
CacheWriteInputTokens *int64 `json:"cache_write_input_tokens,omitempty"`
OutputTokens *int64 `json:"output_tokens,omitempty"`
ReasoningOutputTokens *int64 `json:"reasoning_output_tokens,omitempty"`
TotalTokens *int64 `json:"total_tokens,omitempty"`
}
type UserMessage ¶
type UserMessage struct {
Message string `json:"message"`
Images json.RawMessage `json:"images,omitempty"`
LocalImages json.RawMessage `json:"local_images,omitempty"`
Audio json.RawMessage `json:"audio,omitempty"`
LocalAudio json.RawMessage `json:"local_audio,omitempty"`
TextElements json.RawMessage `json:"text_elements,omitempty"`
}
type WebSearchCall ¶
type WebSearchCall struct {
Status string `json:"status,omitempty"`
Action json.RawMessage `json:"action,omitempty"`
}
type WebSearchEnd ¶
type WebSearchEnd struct {
CallID string `json:"call_id,omitempty"`
Query string `json:"query,omitempty"`
Action json.RawMessage `json:"action,omitempty"`
Results json.RawMessage `json:"results,omitempty"`
}