events

package
v0.11.0-beta.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: Apache-2.0, MIT Imports: 7 Imported by: 0

Documentation

Overview

Package events provides the completion-event pipeline (§8.7.2). A CompletionEvent is emitted once per agent session when the ReAct loop exits. Sinks receive events concurrently; the Emitter returns nil if at least one sink succeeds.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artefact

type Artefact struct {
	Kind string `json:"kind"` // "file" | "pr" | "commit" | "message"
	Ref  string `json:"ref"`  // path, URL, SHA, etc.
}

Artefact records one tangible output produced during the session.

type CompletionEvent

type CompletionEvent struct {
	SessionID  string            `json:"session_id"`
	Intent     string            `json:"intent"`    // first user message of the session
	Outcome    string            `json:"outcome"`   // "success" | "failure" | "cancelled"
	Artefacts  []Artefact        `json:"artefacts"` // files written, PRs opened, etc.
	DurationMs int64             `json:"duration_ms"`
	CostUSD    float64           `json:"cost_usd"`
	Errors     []string          `json:"errors,omitempty"`
	EmittedAt  time.Time         `json:"emitted_at"`
	Meta       map[string]string `json:"meta,omitempty"` // channel, profile, etc.
}

CompletionEvent is the structured record emitted when a session ends.

type Emitter

type Emitter struct {
	// contains filtered or unexported fields
}

Emitter fans CompletionEvents out to a set of Sinks concurrently.

func NewEmitter

func NewEmitter(sinks ...Sink) *Emitter

NewEmitter returns an Emitter backed by the given sinks. At least one sink is required; the caller must ensure the slice is non-nil.

func (*Emitter) Emit

func (e *Emitter) Emit(ctx context.Context, evt CompletionEvent) error

Emit delivers evt to every sink in parallel with a 10-second per-sink timeout. It returns nil when at least one sink succeeds, and a combined error only when every sink fails.

type Sink

type Sink interface {
	Name() string
	Send(ctx context.Context, evt CompletionEvent) error
}

Sink is anything that can receive a CompletionEvent.

type SinkPanicError

type SinkPanicError struct {
	Sink  string
	Value any
}

SinkPanicError identifies a failed sink dispatch without treating recovery as successful delivery. An error-valued panic remains available to errors.Is.

func (*SinkPanicError) Error

func (err *SinkPanicError) Error() string

func (*SinkPanicError) Unwrap

func (err *SinkPanicError) Unwrap() error

Directories

Path Synopsis
Package sinks provides built-in Sink implementations for CompletionEvents.
Package sinks provides built-in Sink implementations for CompletionEvents.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL