router

package
v0.9.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateConfig added in v0.6.0

func ValidateConfig(cfg *Config) error

ValidateConfig checks that a config is within safe bounds and uses valid values.

Types

type Config

type Config struct {
	Routes   []Route        `yaml:"routes"`
	Settings SettingsConfig `yaml:"settings"`
}

Config represents the top-level .webex-agents.yml file.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a config with sensible defaults and no routes.

func LoadConfig

func LoadConfig(path string) (*Config, error)

LoadConfig reads and parses a .webex-agents.yml file.

type InboundMessage

type InboundMessage struct {
	RoomTitle string
	RoomType  string // "group" or "direct"
	Text      string
}

InboundMessage contains the fields needed for route matching.

type MatchCondition

type MatchCondition struct {
	Space    string   `yaml:"space,omitempty"`
	Keywords []string `yaml:"keywords,omitempty"`
	Direct   bool     `yaml:"direct,omitempty"`
}

MatchCondition defines how an inbound message is matched to a route.

type Route

type Route struct {
	Match    MatchCondition `yaml:"match"`
	Agent    string         `yaml:"agent"`
	Priority string         `yaml:"priority"`
}

Route maps a match condition to an agent with priority.

type Router

type Router struct {
	// contains filtered or unexported fields
}

Router evaluates inbound messages against the route config.

func NewRouter

func NewRouter(cfg *Config, configPath string) *Router

NewRouter creates a router from a loaded config.

func (*Router) Reload

func (r *Router) Reload() error

Reload re-reads the YAML config from disk.

func (*Router) Route

func (r *Router) Route(msg InboundMessage) *RoutingResult

Route evaluates the message against routes top-to-bottom. First match wins. Returns nil if no route matches.

func (*Router) Routes

func (r *Router) Routes() []Route

Routes returns a copy of the current route config for display.

type RoutingResult

type RoutingResult struct {
	Agent    string
	Priority string
}

RoutingResult holds the outcome of routing a message.

type SettingsConfig

type SettingsConfig struct {
	BufferSize     int      `yaml:"buffer_size"`
	CheckInterval  string   `yaml:"check_interval"`
	PriorityLevels []string `yaml:"priority_levels"`
}

SettingsConfig holds global routing settings.

Jump to

Keyboard shortcuts

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