events

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 1 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package events is a lossy in-process event bus for UI notifications. It is not a reliable delivery channel; plugin hooks read the database cursor instead.

Index

Constants

View Source
const (
	MessageReceived   = "message.received"
	MessagesChanged   = "messages.changed"
	SyncStarted       = "sync.started"
	SyncFinished      = "sync.finished"
	SyncFailed        = "sync.failed"
	OutboxChanged     = "outbox.changed"
	SettingsChanged   = "settings.changed"
	ApprovalsChanged  = "approvals.changed"
	RunsChanged       = "runs.changed" // a run of an ask conversation started or ended
	PluginsChanged    = "plugins.changed"
	MCPChanged        = "mcp.changed"
	LabelsChanged     = "labels.changed"
	SignaturesChanged = "signatures.changed"
	ModelsChanged     = "models.changed"    // a plugin model's files were downloaded or removed
	MCPSendsChanged   = "mcp_sends.changed" // godwit mcp's send requests waiting for the user changed
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus

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

Bus fans events out to subscribers. Publish never blocks.

func New

func New() *Bus

New returns an empty Bus.

func (*Bus) Publish

func (b *Bus) Publish(e Event)

Publish delivers e to every subscriber without blocking.

func (*Bus) Subscribe

func (b *Bus) Subscribe() (<-chan Event, func())

Subscribe returns a channel of events and a func that unsubscribes it. The unsubscribe func closes the channel and is safe to call more than once.

type Event

type Event struct {
	Type       string
	AccountID  int64
	FolderID   int64
	ThreadIDs  []int64
	MessageIDs []int64
	Error      string
	// Kind is a sync.failed's conn.FailureKind (dns, connect, timeout, tls,
	// auth, protocol), or empty when the connection was fine.
	Kind string
	// ConversationID is set on approvals.changed and runs.changed.
	ConversationID int64
}

Event describes something that happened. Only IDs are carried, never IMAP UIDs.

Jump to

Keyboard shortcuts

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