setup

package
v0.14.21 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package setup composes channel implementations into a registry.

Lives in its own package to break the import cycle: channels root and each transport subpackage (slack, telegram, …) all need to be imported here, but they cannot import each other. Server calls one Setup* per channel and is done — no per-channel boilerplate left in api/server.go.

Adding a new channel: write the subpackage (e.g. channels/discord), then add a `Discord(...)` composer here. Server picks it up by adding one new line.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All(reg *agentchannels.Registry, store Store, sendFn SendFnFactory, restAuth agentrest.Authenticator)

All registers every built-in channel on reg in one call. Adding a new channel = write its subpackage + composer here + extend this function. Server.go never changes after this hook is in place.

func Rest added in v0.10.0

Rest constructs the OpenAI-compatible REST channel and registers it with a hot-reload ConfigSource. auth resolves the per-request Bearer (Personal Access Token) and is required — without it the channel refuses to serve.

func Slack

Slack constructs the Slack channel from the store, applies its setters, and registers it (with a hot-reload ConfigSource) on reg. Returns the channel for callers that need to retain a reference; safe to ignore.

Logs whether the channel is configured so operators see at boot why a transport may stay dormant.

func Telegram

Telegram mirrors Slack — see that comment.

Types

type RestStore added in v0.10.0

RestStore mirrors SlackStore for the OpenAI-compatible REST channel.

type SendFnFactory

type SendFnFactory func(channelName string) agentchannels.SendFunc

SendFnFactory builds a per-channel SendFunc. Setup composers call it with the channel's name so each transport gets a closure bound to its own workspace lookup. Server provides one factory; setup distributes per-channel closures to each composer.

type SlackStore

SlackStore is the full set of capabilities the Slack composer needs: load the config + ensure the agent_channels row exists. Composed from the smaller interfaces declared in the channels package so a test fake only has to satisfy these two methods.

type Store

type Store interface {
	SlackStore
	TelegramStore
	RestStore
}

Store is the union of every per-channel store interface used by All. DBStore satisfies it; tests can build a smaller fake by composing only the per-channel interfaces they need (e.g. just SlackStore).

type TelegramStore

TelegramStore mirrors SlackStore.

Jump to

Keyboard shortcuts

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