Documentation
¶
Overview ¶
Package eventbus provides an in-process pub/sub system for domain events. Events are emitted by the service layer after successful mutations and consumed by SSE streams, webhook dispatch, and MCP notifications.
Index ¶
Constants ¶
const ( EventTaskCreated = "task.created" EventTaskUpdated = "task.updated" EventTaskTransitioned = "task.transitioned" EventTaskDeleted = "task.deleted" EventTaskAssigned = "task.assigned" EventTaskCommented = "task.commented" EventCommentEdited = "comment.edited" EventDependencyAdded = "dependency.added" EventDependencyRemoved = "dependency.removed" EventAttachmentAdded = "attachment.added" EventAttachmentRemoved = "attachment.removed" )
Event type constants matching the PRD §7.1 webhook event types.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
Type string `json:"event"`
Timestamp time.Time `json:"timestamp"`
Actor ActorRef `json:"actor"`
Board BoardRef `json:"board"`
Before *TaskSnapshot `json:"before,omitempty"`
After *TaskSnapshot `json:"after,omitempty"`
Detail any `json:"detail,omitempty"`
}
Event represents a domain event emitted after a successful mutation.
For task events, Before and After carry snapshots of the task state before and after the mutation:
- Create: Before=nil, After=snapshot
- Update: Before=snap, After=snapshot
- Transition: Before=snap, After=snapshot
- Delete: Before=snap, After=nil
- Comment/Dep/Attachment: Before=nil, After=snapshot (current state)
type EventBus ¶
type EventBus struct {
// contains filtered or unexported fields
}
EventBus is an in-process pub/sub system. Mutations publish events; subscribers (SSE, webhooks, MCP) receive them on buffered channels. Publishing never blocks — if a subscriber's buffer is full, the oldest event is dropped.
func (*EventBus) Publish ¶
Publish sends an event to all subscribers. Non-blocking — if a subscriber's buffer is full, the oldest event is dropped to make room.
func (*EventBus) Subscribe ¶
func (b *EventBus) Subscribe() *Subscription
Subscribe creates a new subscription with a buffered channel.
type Subscription ¶
type Subscription struct {
C <-chan Event
// contains filtered or unexported fields
}
Subscription receives events on a buffered channel.
func (*Subscription) Cancel ¶
func (s *Subscription) Cancel()
Cancel removes the subscription from the bus and drains its channel.
type TaskSnapshot ¶
type TaskSnapshot struct {
Ref string `json:"ref"`
Num int `json:"num"`
Title string `json:"title"`
State string `json:"state"`
Priority string `json:"priority,omitempty"`
Assignee *string `json:"assignee,omitempty"`
}
TaskSnapshot is a point-in-time snapshot of a task's display-relevant fields.