(opts ...EventEmitterOption)
| 122 | } |
| 123 | |
| 124 | func NewEventEmitter(opts ...EventEmitterOption) *EventEmitter { |
| 125 | e := &EventEmitter{ |
| 126 | messages: make([]st.ConversationMessage, 0), |
| 127 | status: AgentStatusRunning, |
| 128 | chans: make(map[int]chan Event), |
| 129 | subscriptionBufSize: defaultSubscriptionBufSize, |
| 130 | } |
| 131 | for _, opt := range opts { |
| 132 | opt(e) |
| 133 | } |
| 134 | if e.clock == nil { |
| 135 | e.clock = quartz.NewReal() |
| 136 | } |
| 137 | return e |
| 138 | } |
| 139 | |
| 140 | // Assumes the caller holds the lock. |
| 141 | func (e *EventEmitter) notifyChannels(eventType EventType, payload any) { |
no outgoing calls