Documentation
¶
Overview ¶
Package router provides the actor-style event router for agent communication.
Index ¶
- type AgentActor
- type Router
- func (r *Router) AgentStatuses() map[string]string
- func (r *Router) Agents() []string
- func (r *Router) Dispatch(agentID string, evt *ent.Event) error
- func (r *Router) DispatchByChannel(channelID string, evt *ent.Event) error
- func (r *Router) HasAgent(agentID string) bool
- func (r *Router) RegisterAgent(ctx context.Context, agentID string, adapter bridge.Adapter) error
- func (r *Router) Stop(ctx context.Context)
- func (r *Router) UnregisterAgent(ctx context.Context, agentID string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentActor ¶
type AgentActor struct {
// contains filtered or unexported fields
}
AgentActor handles events for a single agent. Each actor runs in its own goroutine and processes events sequentially.
func NewAgentActor ¶
func NewAgentActor(id string, adapter bridge.Adapter, client *ent.Client, logger *slog.Logger) *AgentActor
NewAgentActor creates a new agent actor.
func (*AgentActor) Send ¶
func (a *AgentActor) Send(evt *ent.Event)
Send sends an event to the actor's inbox.
func (*AgentActor) Start ¶
func (a *AgentActor) Start(ctx context.Context)
Start starts the actor's event processing loop.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router dispatches events to agent actors.
func (*Router) AgentStatuses ¶
AgentStatuses returns the status of all registered agents. Returns a map of agent ID to status ("online" or "offline").
func (*Router) DispatchByChannel ¶
DispatchByChannel finds the agent for a channel and dispatches the event.
func (*Router) RegisterAgent ¶
RegisterAgent registers an agent with its adapter.
Click to show internal directories.
Click to hide internal directories.