Documentation
¶
Index ¶
- Constants
- func CreateRunID(now time.Time) (string, error)
- func FormatEvent(event Event) (string, error)
- func ParsePrompt(input string) (string, error)
- func ResolveImages(events []InputEvent) ([]zeroruntime.ImageBlock, error)
- func ResolvePrompt(events []InputEvent) (string, error)
- type CheckpointInfo
- type Display
- type Event
- type EventType
- type InputEvent
- type InputImage
- type InputType
- type ProtocolError
Constants ¶
View Source
const SchemaVersion = 2
Variables ¶
This section is empty.
Functions ¶
func FormatEvent ¶
func ParsePrompt ¶
func ResolveImages ¶
func ResolveImages(events []InputEvent) ([]zeroruntime.ImageBlock, error)
ResolveImages decodes every base64 image attached to the input events into raw-byte ImageBlocks. Each image's media type is normalized and validated against the supported allow-list, and its decoded size is capped. Returns nil when no events carry images.
func ResolvePrompt ¶
func ResolvePrompt(events []InputEvent) (string, error)
Types ¶
type CheckpointInfo ¶
type CheckpointInfo struct {
Sequence int `json:"sequence,omitempty"`
Tool string `json:"tool,omitempty"`
Files []string `json:"files,omitempty"`
FilesRestored int `json:"filesRestored,omitempty"`
FilesDeleted int `json:"filesDeleted,omitempty"`
Skipped []string `json:"skipped,omitempty"`
}
CheckpointInfo describes a captured file checkpoint or an applied restore.
type Display ¶
type Display struct {
Summary string `json:"summary,omitempty"`
Kind string `json:"kind,omitempty"`
}
Display is a compact structured summary of a tool result.
type Event ¶
type Event struct {
SchemaVersion int `json:"schemaVersion"`
Type EventType `json:"type"`
RunID string `json:"runId"`
SessionID string `json:"sessionId,omitempty"`
Cwd string `json:"cwd,omitempty"`
Provider string `json:"provider,omitempty"`
Model string `json:"model,omitempty"`
APIModel string `json:"apiModel,omitempty"`
Delta string `json:"delta,omitempty"`
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Args any `json:"args,omitempty"`
Action string `json:"action,omitempty"`
Permission string `json:"permission,omitempty"`
PermissionGranted *bool `json:"permissionGranted,omitempty"`
PermissionMode string `json:"permissionMode,omitempty"`
Autonomy string `json:"autonomy,omitempty"`
SideEffect string `json:"sideEffect,omitempty"`
Reason string `json:"reason,omitempty"`
DecisionReason string `json:"decisionReason,omitempty"`
Risk *sandbox.Risk `json:"risk,omitempty"`
Block *sandbox.Block `json:"block,omitempty"`
GrantMatched bool `json:"grantMatched,omitempty"`
Grant *sandbox.Grant `json:"grant,omitempty"`
Status string `json:"status,omitempty"`
Output string `json:"output,omitempty"`
Truncated *bool `json:"truncated,omitempty"`
Redacted *bool `json:"redacted,omitempty"`
ChangedFiles []string `json:"changedFiles,omitempty"`
Display *Display `json:"display,omitempty"`
Checkpoint *CheckpointInfo `json:"checkpoint,omitempty"`
Meta map[string]string `json:"meta,omitempty"`
PromptTokens *int `json:"promptTokens,omitempty"`
CompletionTokens *int `json:"completionTokens,omitempty"`
TotalTokens *int `json:"totalTokens,omitempty"`
CostUSD *float64 `json:"costUsd,omitempty"`
Text string `json:"text,omitempty"`
Message string `json:"message,omitempty"`
Code string `json:"code,omitempty"`
Recoverable *bool `json:"recoverable,omitempty"`
ExitCode *int `json:"exitCode,omitempty"`
}
type EventType ¶
type EventType string
const ( EventRunStart EventType = "run_start" EventText EventType = "text" EventReasoning EventType = "reasoning" EventToolCall EventType = "tool_call" EventPermission EventType = "permission" EventPermissionRequest EventType = "permission_request" EventPermissionDecision EventType = "permission_decision" EventToolResult EventType = "tool_result" EventCheckpoint EventType = "checkpoint" EventRestore EventType = "restore" EventUsage EventType = "usage" EventFinal EventType = "final" EventWarning EventType = "warning" EventError EventType = "error" EventRunEnd EventType = "run_end" )
type InputEvent ¶
type InputEvent struct {
SchemaVersion int `json:"schemaVersion"`
Type InputType `json:"type"`
Role string `json:"role,omitempty"`
Content string `json:"content"`
Images []InputImage `json:"images,omitempty"`
}
func ParseInput ¶
func ParseInput(input string) ([]InputEvent, error)
type InputImage ¶
InputImage carries a base64-encoded image attached to a stream-json message event. MediaType is a MIME type (e.g. "image/png"); Data is the standard base64 encoding of the raw image bytes (no data: URI prefix).
type ProtocolError ¶
type ProtocolError struct {
// contains filtered or unexported fields
}
func (ProtocolError) Error ¶
func (err ProtocolError) Error() string
Click to show internal directories.
Click to hide internal directories.