Versions in this module Expand all Collapse all v0 v0.2.0 May 15, 2026 Changes in this version + const AgentResponse + const BudgetExceeded + const BudgetWarning + const CompactionEnd + const CompactionStart + const ErrorOccurred + const ErrorRecovered + const FileDelete + const FileEdit + const FileRead + const FileWrite + const ModelSwitch + const ProviderSwitch + const SessionEnd + const SessionStart + const ToolCallEnd + const ToolCallError + const ToolCallStart + const TurnEnd + const TurnStart + const UserInput + func FormatEvent(event Event) string + type Event struct + Data map[string]interface{} + Name string + Source string + Timestamp time.Time + type EventBus struct + History []Event + Hooks map[string][]*LifecycleHook + Listeners map[string][]chan Event + MaxHistory int + func NewEventBus() *EventBus + func (eb *EventBus) Emit(event Event) + func (eb *EventBus) GetHistory(eventType string, limit int) []Event + func (eb *EventBus) OnError(fn func(err error)) + func (eb *EventBus) OnFileWrite(fn func(path string)) + func (eb *EventBus) OnSessionEnd(fn func(duration time.Duration, tokens int)) + func (eb *EventBus) OnToolCall(fn func(tool string, duration time.Duration)) + func (eb *EventBus) Register(hook *LifecycleHook) + func (eb *EventBus) Stats() EventStats + func (eb *EventBus) Subscribe(eventType string) <-chan Event + func (eb *EventBus) Unregister(hookID string) + func (eb *EventBus) Unsubscribe(eventType string, ch <-chan Event) + type EventStats struct + AsyncHooks int + AvgHookTime time.Duration + ByType map[string]int + HookCount int + TotalEvents int + type LifecycleHook struct + Async bool + Enabled bool + Event string + Handler func(Event) error + ID string + Name string + Priority int v0.1.0 May 12, 2026 Changes in this version + func Execute(ctx context.Context, event EventType, data map[string]interface{}) error + func ExecuteAsync(ctx context.Context, event EventType, data map[string]interface{}) + func LoadHooksDir(dir string) error + func Register(h Hook) + func RegisterDecisionHook(fn DecisionHookFn) + func ResetDecisionHooks() + type DecisionHookFn func(event string, data map[string]interface{}) *HookDecision + type EventType string + const EventError + const EventFileChanged + const EventPermissionAsk + const EventPostCompact + const EventPostQuery + const EventPostTool + const EventPreCompact + const EventPreQuery + const EventPreTool + const EventSessionEnd + const EventSessionStart + type Hook struct + Event EventType + Fn func(ctx context.Context, data map[string]interface{}) error + Name string + Priority int + func BuiltinHooks() []Hook + type HookDecision struct + Action string + ModifiedInput json.RawMessage + Reason string + func ExecuteDecisionHooks(event string, data map[string]interface{}) *HookDecision + type Registry struct + func NewRegistry() *Registry + func (r *Registry) Execute(ctx context.Context, event EventType, data map[string]interface{}) error + func (r *Registry) ExecuteAsync(ctx context.Context, event EventType, data map[string]interface{}) + func (r *Registry) Register(h Hook)