events

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventBus

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

EventBus 三通道事件总线

func NewEventBus

func NewEventBus() *EventBus

NewEventBus 创建新的事件总线

func (*EventBus) Clear

func (eb *EventBus) Clear()

Clear 清空事件总线(用于测试)

func (*EventBus) EmitControl

func (eb *EventBus) EmitControl(event interface{}) types.AgentEventEnvelope

EmitControl 发送Control事件

func (*EventBus) EmitMonitor

func (eb *EventBus) EmitMonitor(event interface{}) types.AgentEventEnvelope

EmitMonitor 发送Monitor事件

func (*EventBus) EmitProgress

func (eb *EventBus) EmitProgress(event interface{}) types.AgentEventEnvelope

EmitProgress 发送Progress事件

func (*EventBus) GetCursor

func (eb *EventBus) GetCursor() int64

GetCursor 获取当前cursor

func (*EventBus) GetLastBookmark

func (eb *EventBus) GetLastBookmark() *types.Bookmark

GetLastBookmark 获取最后一个bookmark

func (*EventBus) GetTimeline

func (eb *EventBus) GetTimeline() []types.AgentEventEnvelope

GetTimeline 获取完整时间线

func (*EventBus) OnControl

func (eb *EventBus) OnControl(eventType string, handler EventHandler) func()

OnControl 注册Control事件处理器

func (*EventBus) OnMonitor

func (eb *EventBus) OnMonitor(eventType string, handler EventHandler) func()

OnMonitor 注册Monitor事件处理器

func (*EventBus) Subscribe

func (eb *EventBus) Subscribe(channels []types.AgentChannel, opts *types.SubscribeOptions) <-chan types.AgentEventEnvelope

Subscribe 订阅指定通道的事件(返回channel)

func (*EventBus) Unsubscribe

func (eb *EventBus) Unsubscribe(ch <-chan types.AgentEventEnvelope)

Unsubscribe 取消订阅

type EventHandler

type EventHandler func(event interface{})

EventHandler 事件处理器函数

Jump to

Keyboard shortcuts

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