channels

package
v0.183.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApprovalChannel

type ApprovalChannel interface {
	SendApproval(ctx context.Context, recipientID string, req *ipc.ApprovalRequest) error
}

ApprovalChannel is an optional interface that channels can implement to provide rich approval UIs (e.g., inline keyboard buttons) instead of text-based prompts.

type Channel

type Channel interface {
	// Name returns the channel identifier (e.g., "whatsapp", "telegram")
	Name() string
	// Start begins listening for inbound messages. Blocks until ctx is cancelled.
	Start(ctx context.Context, inbox chan<- InboundMessage) error
	// Send delivers an outbound message through this channel
	Send(ctx context.Context, msg OutboundMessage) error
	// Stop gracefully shuts down the channel
	Stop() error
}

Channel represents a pluggable messaging transport (WhatsApp, Telegram, etc.)

type ChannelCommand

type ChannelCommand struct {
	Name        string
	Description string
}

ChannelCommand describes a slash command a channel may advertise natively (e.g., Telegram's bot command menu).

type HistoryCleaner

type HistoryCleaner interface {
	ClearHistory(ctx context.Context, recipientID string) error
}

HistoryCleaner is an optional interface that channels can implement to delete the chat's message history on the remote platform (used by /new).

type InboundMessage

type InboundMessage struct {
	ChannelName string                        `json:"channel_name"`
	SenderID    string                        `json:"sender_id"`
	Content     string                        `json:"content"`
	Images      []agentdomain.ImageAttachment `json:"images,omitempty"`
	Timestamp   time.Time                     `json:"timestamp"`
	Metadata    map[string]string             `json:"metadata,omitempty"`
}

InboundMessage represents a message received from an external channel

type MessageButton

type MessageButton struct {
	Text string `json:"text"`
	Data string `json:"data"`
}

MessageButton is a tappable button attached to an outbound message. Data is delivered back as inbound message content when tapped (channels that have no button UI ignore buttons entirely).

type OutboundMessage

type OutboundMessage struct {
	ChannelName string            `json:"channel_name"`
	RecipientID string            `json:"recipient_id"`
	Content     string            `json:"content"`
	Buttons     []MessageButton   `json:"buttons,omitempty"`
	Timestamp   time.Time         `json:"timestamp"`
	Metadata    map[string]string `json:"metadata,omitempty"`
}

OutboundMessage represents a response to send back through a channel

Jump to

Keyboard shortcuts

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