Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromCmd ¶
func FromCmd(events []Event, sessionID string) []types.AgentEvent
FromCmd converts a sequence of cmd session events into the canonical AgentEvent stream. It walks the native events in order, emitting zero or more canonical events per native event. Tool results are merged into the preceding tool-call by matching toolCallId.
Types ¶
type ContentBlock ¶
type ContentBlock struct {
Type ContentBlockType `json:"type"`
Text string `json:"text,omitempty"`
ToolCallID string `json:"toolCallId,omitempty"`
ToolName string `json:"toolName,omitempty"`
Input json.RawMessage `json:"input,omitempty"`
Output *ToolOutput `json:"output,omitempty"`
}
ContentBlock is one element in a content array.
type ContentBlockType ¶
type ContentBlockType string
ContentBlockType discriminates the type of a content block.
const ( BlockTypeText ContentBlockType = "text" BlockTypeReasoning ContentBlockType = "reasoning" BlockTypeToolCall ContentBlockType = "tool-call" BlockTypeToolResult ContentBlockType = "tool-result" )
type Event ¶
type Event struct {
ID string `json:"id"`
Timestamp string `json:"timestamp"`
SessionID string `json:"sessionId"`
ParentID string `json:"parentId"`
Role Role `json:"role"`
Content json.RawMessage `json:"content"` // string or []ContentBlock
GitBranch string `json:"gitBranch,omitempty"`
Metadata *EventMetadata `json:"metadata,omitempty"`
}
Event models one JSONL line from a cmd session file.
type EventMetadata ¶
type EventMetadata struct {
Timestamp string `json:"timestamp,omitempty"`
Source string `json:"source,omitempty"`
Version int `json:"version,omitempty"`
Entrypoint string `json:"entrypoint,omitempty"`
MessageID string `json:"messageId,omitempty"`
IsAutomated bool `json:"isAutomated,omitempty"`
}
EventMetadata contains optional metadata fields.
type ToolOutput ¶
ToolOutput wraps the result of a tool execution.
Click to show internal directories.
Click to hide internal directories.