Documentation
¶
Overview ¶
Package handler glues slackproto + router + acpclient: it turns inbound Slack events into ACP prompts and streams the agent's session updates back into a Slack thread message.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Router *router.Router
API *slack.Client
AllowedUserIDs map[string]struct{}
AllowedChannelIDs map[string]struct{}
// PromptTimeout caps the wall-clock for a single prompt. Default 10m.
PromptTimeout time.Duration
// Ambient enables forwarding of non-DM thread replies to threads
// the bot is already part of. When false, only @-mentions and DMs
// trigger responses.
Ambient bool
// Backfill enables catching up on missed messages via
// conversations.replies when a gap is detected.
Backfill bool
// BackfillMaxMessages caps how many historical messages to fetch
// when backfilling.
BackfillMaxMessages int
// SilentSentinel is the exact output string that signals the agent
// has chosen not to reply.
SilentSentinel string
}
Config configures the handler.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler implements slackproto.Handler.
func (*Handler) Handle ¶
func (h *Handler) Handle(ctx context.Context, ev slackproto.Event)
Handle is called by slackproto.Client for each inbound event.
func (*Handler) SetAPI ¶
SetAPI installs the Slack API client (used for posting/updating messages). Called by main after the slackproto.Client has been constructed.
func (*Handler) WaitIdle ¶
WaitIdle blocks until the handler has no in-flight prompts or ctx is done. Used by tests to synchronise on the inflight-empty transition without wall-clock polling; also useful for graceful shutdown paths.
Implementation note: sync.Cond.Wait can't accept a context, so a helper goroutine bridges ctx → Broadcast. The helper exits as soon as WaitIdle returns (either because the map drained or ctx fired) — see the deferred close(stop) below — so there's no goroutine leak even on long-lived ctx.