events

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 6 Imported by: 0 modules, 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 the daemon's live event stream: numbered events fanned out to subscribers in publish order, with a short history to resume from.

Index

Constants

This section is empty.

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 in publish order. A subscriber that falls a full buffer behind is closed rather than skipped, so its client reconnects and reloads instead of missing events silently.

func NewBus

func NewBus() *Bus

func (*Bus) LastID

func (b *Bus) LastID() uint64

LastID is the ID of the newest published event, 0 before the first.

func (*Bus) Publish

func (b *Bus) Publish(event Event)

Publish numbers the event and hands it to every subscriber under one lock, so each sees events in ID order.

func (*Bus) Subscribe

func (b *Bus) Subscribe(ctx context.Context, sessionID string, afterID uint64) <-chan Event

Subscribe streams the session's events (every session's for an empty sessionID), first those after afterID still in the history; afterID 0 replays none. The channel closes when ctx ends or the subscriber falls behind.

type Event

type Event struct {
	ID        uint64    `json:"id,omitempty"`
	Type      Type      `json:"type"`
	SessionID string    `json:"session_id"`
	RunID     string    `json:"run_id,omitempty"`
	Payload   any       `json:"payload,omitempty"`
	At        time.Time `json:"at"`
}

Event is the daemon-owned envelope for live fan-out.

type Type

type Type string

Type names what an event reports, such as "run.updated".

Jump to

Keyboard shortcuts

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