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 ¶
- func All(reg *agentchannels.Registry, store Store, sendFn SendFnFactory, ...)
- func Rest(reg *agentchannels.Registry, store RestStore, sendFn agentchannels.SendFunc, ...) *agentrest.Channel
- func Slack(reg *agentchannels.Registry, store SlackStore, sendFn agentchannels.SendFunc) *agentslack.Channel
- func Telegram(reg *agentchannels.Registry, store TelegramStore, ...) *agenttelegram.Channel
- type RestStore
- type SendFnFactory
- type SlackStore
- type Store
- type TelegramStore
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
func Rest(reg *agentchannels.Registry, store RestStore, sendFn agentchannels.SendFunc, auth agentrest.Authenticator) *agentrest.Channel
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 ¶
func Slack(reg *agentchannels.Registry, store SlackStore, sendFn agentchannels.SendFunc) *agentslack.Channel
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 ¶
func Telegram(reg *agentchannels.Registry, store TelegramStore, sendFn agentchannels.SendFunc) *agenttelegram.Channel
Telegram mirrors Slack — see that comment.
Types ¶
type RestStore ¶ added in v0.10.0
type RestStore interface {
agentchannels.RestConfigStore
agentchannels.ChannelEnsurer
}
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 ¶
type SlackStore interface {
agentchannels.SlackConfigStore
agentchannels.ChannelEnsurer
}
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 ¶
type TelegramStore interface {
agentchannels.TelegramConfigStore
agentchannels.ChannelEnsurer
}
TelegramStore mirrors SlackStore.