Documentation
¶
Overview ¶
Package binding describes which channel a scenario should use for a given event. Bindings live alongside bot settings (see internal/data/db.Settings.Scenarios) as a JSON-encoded list per bot.
The binding type is generic across scenarios — fields beyond Name / ChatID / Events are stored as a free-form Options map so new scenarios can add scenario-specific settings without changing the schema or the generic resolver.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Binding ¶
type Binding struct {
// Name matches the scenario plugin Name() and the :scenario URL
// segment of /tingly/:scenario/...
Name string `json:"name"`
// ChatID is the IM chat the bot routes to. Channels look this up
// when delivering Send / Prompt.
ChatID string `json:"chat_id"`
// Events optionally restricts which event names this binding
// handles. Empty list = all events.
Events []string `json:"events,omitempty"`
// Options carries scenario-specific configuration the resolver
// returns verbatim to the plugin (e.g. permission policy for the
// claude_code scenario).
Options map[string]any `json:"-"`
}
Binding declares how a single bot serves a named scenario.
type Resolved ¶
Resolved is what the resolver returns to the plugin: the binding itself plus the bot identity needed to look up a Channel.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver matches (scenario, event) to a single bot binding by scanning enabled bot settings. Read-only and safe for concurrent use.
func NewResolver ¶
NewResolver constructs a resolver backed by the given store.