Documentation
¶
Index ¶
- Constants
- func BuildAgentMainSessionKey(agentID string) string
- func BuildAgentPeerSessionKey(params SessionKeyParams) string
- func IsSubagentSessionKey(sessionKey string) bool
- func NormalizeAccountID(id string) string
- func NormalizeAgentID(id string) string
- type DMScope
- type ParsedSessionKey
- type ResolvedRoute
- type RouteInput
- type RoutePeer
- type RouteResolver
- type SessionKeyParams
Constants ¶
const ( DefaultAgentID = "main" DefaultMainKey = "main" DefaultAccountID = "default" MaxAgentIDLength = 64 )
Variables ¶
This section is empty.
Functions ¶
func BuildAgentMainSessionKey ¶
BuildAgentMainSessionKey returns "agent:<agentId>:main".
func BuildAgentPeerSessionKey ¶
func BuildAgentPeerSessionKey(params SessionKeyParams) string
BuildAgentPeerSessionKey constructs a session key based on agent, channel, peer, and DM scope.
func IsSubagentSessionKey ¶
IsSubagentSessionKey returns true if the session key represents a subagent.
func NormalizeAccountID ¶
NormalizeAccountID sanitizes an account ID. Empty returns DefaultAccountID.
func NormalizeAgentID ¶
NormalizeAgentID sanitizes an agent ID to [a-z0-9][a-z0-9_-]{0,63}. Invalid characters are collapsed to "-". Leading/trailing dashes stripped. Empty input returns DefaultAgentID ("main").
Types ¶
type ParsedSessionKey ¶
ParsedSessionKey is the result of parsing an agent-scoped session key.
func ParseAgentSessionKey ¶
func ParseAgentSessionKey(sessionKey string) *ParsedSessionKey
ParseAgentSessionKey extracts agentId and rest from "agent:<agentId>:<rest>".
type ResolvedRoute ¶
type ResolvedRoute struct {
AgentID string
Channel string
AccountID string
SessionKey string
MainSessionKey string
MatchedBy string // "binding.peer", "binding.peer.parent", "binding.guild", "binding.team", "binding.account", "binding.channel", "default"
}
ResolvedRoute is the result of agent routing.
type RouteInput ¶
type RouteInput struct {
Channel string
AccountID string
Peer *RoutePeer
ParentPeer *RoutePeer
GuildID string
TeamID string
}
RouteInput contains the routing context from an inbound message.
type RouteResolver ¶
type RouteResolver struct {
// contains filtered or unexported fields
}
RouteResolver determines which agent handles a message based on config bindings.
func NewRouteResolver ¶
func NewRouteResolver(cfg *config.Config) *RouteResolver
NewRouteResolver creates a new route resolver.
func (*RouteResolver) ResolveRoute ¶
func (r *RouteResolver) ResolveRoute(input RouteInput) ResolvedRoute
ResolveRoute determines which agent handles the message and constructs session keys. Implements the 7-level priority cascade: peer > parent_peer > guild > team > account > channel_wildcard > default