integrations

package
v0.1.60 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 34 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 integrations connects external messaging transports to the existing bot runtime. It owns delivery receipts and routing, never a second agent or transcript.

Index

Constants

View Source
const Version = 4

Variables

This section is empty.

Functions

This section is empty.

Types

type BotRuntime

type BotRuntime interface {
	Delegate(registry.Bot, string, bots.TaskRequest) (bots.Task, error)
	Task(registry.Bot, string, string) (bots.Task, error)
	CancelTask(registry.Bot, string, string) (bots.Task, error)
}

type CommandDefinition added in v0.1.60

type CommandDefinition struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Argument    string `json:"argument,omitempty"`
}

CommandDefinition describes discoverable commands; it never grants execution access. The host supplies its catalog and receives the same normalized text for every transport.

type Connection

type Connection struct {
	ID       string `json:"id"`
	Revision int64  `json:"revision"`
	Spec
	HasCredentials bool            `json:"hasCredentials"`
	WebhookPath    string          `json:"webhookPath"`
	Receiver       *ReceiverStatus `json:"receiver,omitempty"`
}

type Credentials

type Credentials struct {
	BotToken      string `json:"botToken,omitempty"`
	AppToken      string `json:"appToken,omitempty"` // Slack Socket Mode, connections:write
	SigningSecret string `json:"signingSecret,omitempty"`
	WebhookSecret string `json:"webhookSecret,omitempty"`
	PublicKey     string `json:"publicKey,omitempty"`
	ClientSecret  string `json:"clientSecret,omitempty"`
}

type HostEvent added in v0.1.60

type HostEvent struct {
	ID            string `json:"id"`
	IntegrationID string `json:"integrationId"`
	WorkspaceID   string `json:"workspaceId"`
	ChannelID     string `json:"channelId"`
	UserID        string `json:"userId"`
	ThreadID      string `json:"threadId,omitempty"`
	Text          string `json:"text"`
	Command       bool   `json:"command"`
	Lease         string `json:"lease"`
	Revision      int64  `json:"revision"`
}

HostEvent contains only verified sender context. Provider credentials and reply tokens stay private.

type Options

type Options struct{ HTTPClient *http.Client }

Options allows a host to supply its existing HTTP transport.

type Receipt

type Receipt struct {
	ID            string `json:"id"`
	IntegrationID string `json:"integrationId"`
	ChannelID     string `json:"channelId"`
	UserID        string `json:"userId"`
	State         string `json:"state"`
	ChatID        string `json:"chatId,omitempty"`
	RunID         string `json:"runId,omitempty"`
	Error         string `json:"error,omitempty"`
	CreatedAt     string `json:"createdAt"`
}

type ReceiverStatus added in v0.1.60

type ReceiverStatus struct {
	State string `json:"state"`
	Error string `json:"error,omitempty"`
}

type Service

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

func New

func New(db *registry.Store, runtime BotRuntime, hub *stream.Hub, options ...Options) *Service

func (*Service) Channels

func (s *Service) Channels() []shortcuts.Channel

func (*Service) Claim added in v0.1.60

func (s *Service) Claim(id string) (*HostEvent, error)

Claim hands one verified event to an authenticated host. Expired leases may be reclaimed; hosts must use ID as their own operation idempotency key before performing side effects.

func (*Service) Close

func (s *Service) Close()

func (*Service) Complete added in v0.1.60

func (s *Service) Complete(id, eventID, lease, text string) (Receipt, error)

Complete persists the result before delivery. Repeating the same completion never executes work again. Configuration changes or expired claims cannot publish a stale/private response.

func (*Service) Delete

func (s *Service) Delete(id string) error

func (*Service) Events

func (s *Service) Events(id string) ([]Receipt, error)

func (*Service) Get

func (s *Service) Get(id string) (Connection, error)

func (*Service) List

func (s *Service) List() ([]Connection, error)

func (*Service) Notify

func (s *Service) Notify(ctx context.Context, n agent.Notification) error

Notify routes bot lifecycle notifications using the same transport and credentials as chat replies. App notifications select integration:<id> explicitly instead.

func (*Service) Retry

func (s *Service) Retry(id, eventID string) (Receipt, error)

func (*Service) Save

func (s *Service) Save(id string, spec Spec) (Connection, error)

func (*Service) Send

func (s *Service) Send(ctx context.Context, id, text string) error

func (*Service) Start

func (s *Service) Start()

func (*Service) SyncCommands added in v0.1.60

func (s *Service) SyncCommands(ctx context.Context, id string, revision int64) error

SyncCommands uses only provider-owned endpoints and the saved bot credentials. It is explicit (never called by polling), so reconnects do not spam provider APIs. Discord updates one named guild command; Telegram updates this dedicated bot's menu.

func (*Service) Webhook

func (s *Service) Webhook(w http.ResponseWriter, r *http.Request)

Webhook is deliberately outside daemon bearer authentication. Each provider's signature is checked against the raw body before any event is acknowledged.

type Spec

type Spec struct {
	Name      string `json:"name"`
	Provider  string `json:"provider"`
	Transport string `json:"transport,omitempty"` // empty/webhook or outbound
	BotID     string `json:"botId"`
	// Host dispatch lets an embedding application handle verified messages without an agent.
	Dispatch         string              `json:"dispatch,omitempty"` // empty/bot or host
	Mode             string              `json:"mode"`
	Enabled          bool                `json:"enabled"`
	ChannelIDs       []string            `json:"channelIds"`
	UserIDs          []string            `json:"userIds,omitempty"`
	WorkspaceID      string              `json:"workspaceId,omitempty"` // Slack team, Discord guild, Teams tenant
	ApplicationID    string              `json:"applicationId,omitempty"`
	Command          string              `json:"command,omitempty"`
	Commands         []CommandDefinition `json:"commands,omitempty"`
	Notify           bool                `json:"notify"`
	Conditions       []agent.Condition   `json:"conditions,omitempty"`
	Destination      string              `json:"destination,omitempty"`
	ServiceURL       string              `json:"serviceUrl,omitempty"` // Teams connector, owner-configured
	ExpectedRevision int64               `json:"expectedRevision,omitempty"`
	Credentials      *Credentials        `json:"credentials,omitempty"`
}

Spec is a complete configuration. Credentials are write-only; omitted fields preserve existing credentials on update. Revision prevents concurrent overwrites.

Jump to

Keyboard shortcuts

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