eventpub

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package eventpub provides the NATS-backed EventSink implementation that maps agent.Event to messaging.RunEvent and publishes to the appropriate JetStream lane.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventSinkFactory

type EventSinkFactory interface {
	NewEventSink(ctx RunEventContext) agent.EventSink
}

EventSinkFactory creates EventSinks bound to a specific run context.

type NATSEventSink

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

NATSEventSink publishes agent.Event as messaging.RunEvent via JetStream, routing high-frequency deltas to the run.stream lane and low-frequency state events to the run.state lane.

func NewNATSEventSink

func NewNATSEventSink(bus eventbus.Publisher, eventContext RunEventContext) *NATSEventSink

NewNATSEventSink creates a new NATS-backed event sink.

func (*NATSEventSink) Emit

func (s *NATSEventSink) Emit(ctx context.Context, event *agent.Event) error

Emit publishes an agent event to the appropriate NATS lane. Returns an error when the event cannot be delivered (subject build failure or NATS publish failure). Terminal events use a without-cancel + timeout context.

type RunEventContext

type RunEventContext struct {
	OrgID             uint
	WorkerID          uint
	SessionID         string
	TraceID           string
	RequestID         string
	TaskID            string
	RunID             string
	ParentID          string
	ReplyToMessageIDs []string
}

RunEventContext carries the routing/tracing context for a single run's events.

Jump to

Keyboard shortcuts

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