bus

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package bus decouples channels from the agent loop with bounded queues.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func External added in v0.11.0

func External(channel string) bool

External reports whether a channel is a conversation that outlives this process, and so is somewhere Factor can reach the user on its own initiative. The CLI is one process's stdin, system is Factor talking to itself, and cron is a schedule rather than an inbox: none of them is an address a heartbeat, a job result or a restart notice can be sent to.

Types

type InboundMessage

type InboundMessage struct {
	Channel  string
	SenderID string
	ChatID   string
	Content  string
	Time     time.Time
}

func (InboundMessage) SessionKey

func (m InboundMessage) SessionKey() string

SessionKey identifies the conversation a message belongs to.

type MessageBus

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

func New

func New() *MessageBus

func (*MessageBus) Inbound

func (b *MessageBus) Inbound() <-chan InboundMessage

func (*MessageBus) Outbound

func (b *MessageBus) Outbound() <-chan OutboundMessage

func (*MessageBus) PendingOutbound added in v0.7.0

func (b *MessageBus) PendingOutbound() int

PendingOutbound counts replies waiting for a connector to deliver them. The gateway waits for zero before restarting: a queued message dies with the process that holds it.

func (*MessageBus) PublishInbound

func (b *MessageBus) PublishInbound(msg InboundMessage) bool

PublishInbound enqueues without blocking; a full queue drops the message loudly rather than wedging a connector.

func (*MessageBus) PublishOutbound

func (b *MessageBus) PublishOutbound(msg OutboundMessage) bool

type OutboundMessage

type OutboundMessage struct {
	Channel string
	ChatID  string
	Content string
	// Interim marks a note sent while a turn is still running — what the
	// agent is about to do, not its answer. Connectors whose delivery is
	// expensive or interruptive (a phone call) drop these.
	Interim bool
}

Jump to

Keyboard shortcuts

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