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
- func Redact(value string) string
- func SafePathLabel(path string) string
- func SafePathRefsText(value string) string
- func StableHash(value string) string
- type Artifact
- type Event
- type Recorder
- type Redactor
- type Sensitivity
- type SerialSink
- type Sink
- type SinkPolicy
- type SourceRef
- type TraceWriter
- type Type
Constants ¶
View Source
const ( StepStart = observation.EventTypeStepStart ProviderRequest = observation.EventTypeProviderRequest ProviderDelta = observation.EventTypeProviderDelta ProviderReasoning = observation.EventTypeProviderReasoning ProviderToolCallStart = observation.EventTypeProviderToolCallStart ProviderToolCallDelta = observation.EventTypeProviderToolCallDelta ProviderToolCallEnd = observation.EventTypeProviderToolCallEnd ProviderUsage = observation.EventTypeProviderUsage ProviderSources = observation.EventTypeProviderSources ProviderFinish = observation.EventTypeProviderFinish ProviderRetry = observation.EventTypeProviderRetry ToolCall = observation.EventTypeToolCall ToolDispatchStarted = observation.EventTypeToolDispatchStarted ToolActivityUpdated = observation.EventTypeToolActivityUpdated ToolResult = observation.EventTypeToolResult ToolApprovalRequested = observation.EventTypeToolApprovalRequested ToolApprovalApproved = observation.EventTypeToolApprovalApproved ToolApprovalRejected = observation.EventTypeToolApprovalRejected ToolApprovalTimedOut = observation.EventTypeToolApprovalTimedOut ToolApprovalCanceled = observation.EventTypeToolApprovalCanceled HostedToolCall = observation.EventTypeHostedToolCall HostedToolResult = observation.EventTypeHostedToolResult MCPServerConnecting = observation.EventTypeMCPServerConnecting MCPServerReady = observation.EventTypeMCPServerReady MCPServerFailed = observation.EventTypeMCPServerFailed MCPToolsListed = observation.EventTypeMCPToolsListed MCPToolCall = observation.EventTypeMCPToolCall MCPToolResult = observation.EventTypeMCPToolResult SkillDetected = observation.EventTypeSkillDetected SkillLoaded = observation.EventTypeSkillLoaded SkillBlocked = observation.EventTypeSkillBlocked SkillInstallRequired = observation.EventTypeSkillInstallRequired SkillDisclosureApplied = observation.EventTypeSkillDisclosureApplied ContextCompact = observation.EventTypeContextCompact ContextCompactDebug = observation.EventTypeContextCompactDebug ContextContinue = observation.EventTypeContextContinue ThreadEntryCommitted = observation.EventTypeThreadEntryCommitted ThreadTitlePending = observation.EventTypeThreadTitlePending ThreadTitleUpdated = observation.EventTypeThreadTitleUpdated ThreadTitleFailed = observation.EventTypeThreadTitleFailed ControlSignal = observation.EventTypeControlSignal BudgetExceeded = observation.EventTypeBudgetExceeded StepEnd = observation.EventTypeStepEnd RunEnd = observation.EventTypeRunEnd )
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"`
// CanonicalEntryID links an effect result event to the journal entry that
// the effect authority already committed. It is internal projection state.
CanonicalEntryID string `json:"-"`
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"`
Activity *observation.ActivityPresentation `json:"activity,omitempty"`
Artifacts []Artifact `json:"artifacts,omitempty"`
Sources []SourceRef `json:"sources,omitempty"`
Payload any `json:"-"`
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 = observation.EventType
Click to show internal directories.
Click to hide internal directories.