events

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateAgentID

func GenerateAgentID(parentID string) string

GenerateAgentID generates a hierarchical agent ID based on the parent ID. Returns "root" for empty parent, or "parent.N" for children.

func ResetCounters

func ResetCounters()

ResetCounters resets the child counters (useful for testing)

func SetGlobal

func SetGlobal(store *EventStore)

SetGlobal sets the global event store

Types

type Event

type Event struct {
	ID        string      `json:"id"`        // UUID
	AgentID   string      `json:"agent_id"`  // Hierarchical (root, root.1, root.1.2)
	ParentID  string      `json:"parent_id"` // Parent agent ID
	Type      EventType   `json:"type"`      // Event type
	Timestamp time.Time   `json:"timestamp"` // When the event occurred
	Data      interface{} `json:"data"`      // Event-specific data
}

Event represents a single event in the system

type EventStore

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

EventStore manages event storage and retrieval

func Global

func Global() *EventStore

Global returns the global event store

func NewEventStore

func NewEventStore(filepath string) (*EventStore, error)

NewEventStore creates a new event store that writes to the specified file

func (*EventStore) Close

func (s *EventStore) Close() error

Close closes the event store file

func (*EventStore) GetEvents

func (s *EventStore) GetEvents(agentID string) []Event

GetEvents retrieves all events for the specified agent and its descendants

func (*EventStore) LoadExisting

func (s *EventStore) LoadExisting() error

LoadExisting loads existing events from the file into memory

func (*EventStore) Record

func (s *EventStore) Record(event Event) error

Record appends an event to the store and persists it to disk

type EventType

type EventType string

EventType represents the type of event that occurred

const (
	EventAgentStarted       EventType = "agent_started"
	EventAgentStopped       EventType = "agent_stopped"
	EventStreamStarted      EventType = "stream_started"
	EventStreamChunk        EventType = "stream_chunk"
	EventToolCallRequested  EventType = "tool_call_requested"
	EventToolCallApproved   EventType = "tool_call_approved"
	EventToolCallDenied     EventType = "tool_call_denied"
	EventToolExecutionStart EventType = "tool_execution_start"
	EventToolExecutionEnd   EventType = "tool_execution_end"
	EventStateTransition    EventType = "state_transition"
	EventError              EventType = "error"
)

Jump to

Keyboard shortcuts

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