channel

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package channel defines the interface that every messaging adapter must implement, along with a registry for managing active channels.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel interface {
	// Name returns the unique identifier of this channel (e.g. "telegram").
	Name() string

	// Manifest describes the capabilities supported by this channel.
	Manifest() Manifest

	// Send delivers an outbound Envelope through the channel.
	Send(ctx context.Context, env *envelope.Envelope) error

	// Receive returns a read-only channel that emits inbound Envelopes.
	// The caller must respect context cancellation.
	Receive(ctx context.Context) (<-chan *envelope.Envelope, error)
}

Channel is the contract for a messaging adapter. Each adapter converts between its native protocol and the canonical Envelope type.

type Manifest

type Manifest struct {
	Text    bool `json:"text"`
	Image   bool `json:"image"`
	Audio   bool `json:"audio"`
	Video   bool `json:"video"`
	Buttons bool `json:"buttons"`
}

Manifest declares which content types a channel supports.

type Registry

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

Registry manages a set of active channels, allowing registration, lookup, removal, and listing. It is safe for concurrent use.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates an empty channel registry.

func (*Registry) Get

func (r *Registry) Get(name string) (Channel, bool)

Get returns the channel with the given name and true, or nil and false if not found.

func (*Registry) List

func (r *Registry) List() []string

List returns the names of all registered channels.

func (*Registry) Register

func (r *Registry) Register(ch Channel)

Register adds or replaces a channel in the registry.

func (*Registry) Unregister

func (r *Registry) Unregister(name string)

Unregister removes a channel from the registry by name.

Directories

Path Synopsis
Package console is the internal direct-chat channel (operator-console spec FR-CONS-1): a first-class channel.Channel with NO network — the operator talks to the brains from the app itself.
Package console is the internal direct-chat channel (operator-console spec FR-CONS-1): a first-class channel.Channel with NO network — the operator talks to the brains from the app itself.
Package discord is the Discord channel adapter (Piece 4, ADR-0033).
Package discord is the Discord channel adapter (Piece 4, ADR-0033).
Package telegram is the Korvun channel adapter for Telegram Bot updates.
Package telegram is the Korvun channel adapter for Telegram Bot updates.
Package webhook implements a generic webhook channel adapter that converts arbitrary JSON payloads into Envelopes using a configurable field mapping.
Package webhook implements a generic webhook channel adapter that converts arbitrary JSON payloads into Envelopes using a configurable field mapping.

Jump to

Keyboard shortcuts

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