Documentation
¶
Overview ¶
Package event defines presentation-neutral runtime events.
Event values produced by the engine may contain raw provider text, reasoning, tool arguments, tool results, artifact paths, and diagnostics. Public sinks, trace files, SSE streams, API responses, and host snapshots should pass events through Sanitize or SerialSink with the default policy. Raw inspection is a local debug capability: enabling SinkPolicy.AllowRaw on one sink must not be reused for default/public sinks in the same run.
Recorder is safe for concurrent Emit calls and is intended for tests. Custom sinks should either be internally synchronized or wrapped in SerialSink.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SafePathLabel ¶
func SafePathRefsText ¶
func StableHash ¶
Types ¶
type Artifact ¶
type Artifact struct {
ID string `json:"id,omitempty"`
SafeLabel string `json:"safe_label,omitempty"`
URL string `json:"url,omitempty"`
Kind string `json:"kind,omitempty"`
MIME string `json:"mime,omitempty"`
SizeBytes int64 `json:"size_bytes,omitempty"`
SHA256 string `json:"sha256,omitempty"`
Path string `json:"path,omitempty"`
}
type Event ¶
type Event struct {
Type Type `json:"type"`
TraceID string `json:"trace_id,omitempty"`
RunID string `json:"run_id"`
ThreadID string `json:"thread_id,omitempty"`
TurnID string `json:"turn_id,omitempty"`
PromptScopeID string `json:"prompt_scope_id,omitempty"`
Step int `json:"step,omitempty"`
Provider string `json:"provider,omitempty"`
Model string `json:"model,omitempty"`
Message string `json:"message,omitempty"`
ToolID string `json:"tool_id,omitempty"`
ToolName string `json:"tool_name,omitempty"`
ToolKind string `json:"tool_kind,omitempty"`
Args string `json:"args,omitempty"`
ArgsHash string `json:"args_hash,omitempty"`
Result string `json:"result,omitempty"`
Err string `json:"err,omitempty"`
FinishReason string `json:"finish_reason,omitempty"`
RawFinishReason string `json:"raw_finish_reason,omitempty"`
FinishInferred bool `json:"finish_inferred,omitempty"`
CompletionReason string `json:"completion_reason,omitempty"`
ContinuationReason string `json:"continuation_reason,omitempty"`
Duration int64 `json:"duration_ms,omitempty"`
Metrics any `json:"metrics,omitempty"`
Metadata any `json:"metadata,omitempty"`
Artifacts []Artifact `json:"artifacts,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
func SanitizePathRefs ¶
func SanitizeWithPolicy ¶
func SanitizeWithPolicy(e Event, policy SinkPolicy) Event
type Sensitivity ¶
type Sensitivity string
const ( SensitivityPublic Sensitivity = "public" SensitivityRaw Sensitivity = "raw" )
type SerialSink ¶
type SerialSink struct {
Inner Sink
Policy SinkPolicy
// contains filtered or unexported fields
}
func NewSerialSink ¶
func NewSerialSink(inner Sink, policy SinkPolicy) *SerialSink
func (*SerialSink) Emit ¶
func (s *SerialSink) Emit(e Event)
type SinkPolicy ¶
type TraceWriter ¶
type TraceWriter struct {
// contains filtered or unexported fields
}
func NewTraceWriter ¶
func NewTraceWriter(w io.Writer) *TraceWriter
func (*TraceWriter) Emit ¶
func (t *TraceWriter) Emit(e Event)
type Type ¶
type Type string
const ( StepStart Type = "step_start" ProviderRequest Type = "provider_request" ProviderDelta Type = "provider_delta" ProviderReasoning Type = "provider_reasoning" ProviderUsage Type = "provider_usage" ProviderFinish Type = "provider_finish" ProviderRetry Type = "provider_retry" ToolCall Type = "tool_call" ToolResult Type = "tool_result" ToolApprovalRequested Type = "tool_approval_requested" ToolApprovalApproved Type = "tool_approval_approved" ToolApprovalRejected Type = "tool_approval_rejected" ToolApprovalTimedOut Type = "tool_approval_timed_out" ToolApprovalCanceled Type = "tool_approval_canceled" HostedToolCall Type = "hosted_tool_call" HostedToolResult Type = "hosted_tool_result" MCPServerConnecting Type = "mcp_server_connecting" MCPServerReady Type = "mcp_server_ready" MCPServerFailed Type = "mcp_server_failed" MCPToolsListed Type = "mcp_tools_listed" MCPToolCall Type = "mcp_tool_call" MCPToolResult Type = "mcp_tool_result" SkillDetected Type = "skill_detected" SkillLoaded Type = "skill_loaded" SkillBlocked Type = "skill_blocked" SkillInstallRequired Type = "skill_install_required" SkillDisclosureApplied Type = "skill_disclosure_applied" ContextCompact Type = "context_compact" ContextContinue Type = "context_continue" ControlSignal Type = "control_signal" BudgetExceeded Type = "budget_exceeded" StepEnd Type = "step_end" RunEnd Type = "run_end" )
Click to show internal directories.
Click to hide internal directories.