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
- type BotRuntime
- type CommandDefinition
- type Connection
- type Credentials
- type HostEvent
- type Options
- type Receipt
- type ReceiverStatus
- type Service
- func (s *Service) Channels() []shortcuts.Channel
- func (s *Service) Claim(id string) (*HostEvent, error)
- func (s *Service) Close()
- func (s *Service) Complete(id, eventID, lease, text string) (Receipt, error)
- func (s *Service) Delete(id string) error
- func (s *Service) Events(id string) ([]Receipt, error)
- func (s *Service) Get(id string) (Connection, error)
- func (s *Service) List() ([]Connection, error)
- func (s *Service) Notify(ctx context.Context, n agent.Notification) error
- func (s *Service) Retry(id, eventID string) (Receipt, error)
- func (s *Service) Save(id string, spec Spec) (Connection, error)
- func (s *Service) Send(ctx context.Context, id, text string) error
- func (s *Service) Start()
- func (s *Service) SyncCommands(ctx context.Context, id string, revision int64) error
- func (s *Service) Webhook(w http.ResponseWriter, r *http.Request)
- type Spec
Constants ¶
const Version = 4
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BotRuntime ¶
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 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 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 Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) Claim ¶ added in v0.1.60
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) Complete ¶ added in v0.1.60
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) List ¶
func (s *Service) List() ([]Connection, error)
func (*Service) Notify ¶
Notify routes bot lifecycle notifications using the same transport and credentials as chat replies. App notifications select integration:<id> explicitly instead.
func (*Service) SyncCommands ¶ added in v0.1.60
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.
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.