Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Find ¶
func Find(resolved []roomsdomain.Room, name string) (roomsdomain.Room, bool)
Find returns the room whose name matches, false when no room does.
func Resolve ¶
func Resolve(cfg config.RoomsConfig, agents AgentCatalog) []roomsdomain.Room
Resolve expands the configured rooms into the rooms that exist: "*" becomes every non-built-in agent the room's project can run as, a room without a project runs in the default project dir (the working directory of the process that reads it), and the agents resolve each time the rooms are read.
Types ¶
type AgentCatalog ¶
type AgentCatalog func(projectDir string) []agentdomain.SubagentInfo
AgentCatalog lists the agents a thread in projectDir can run as, with the descriptions the router reads.
type Host ¶
type Host struct {
// contains filtered or unexported fields
}
Host is the daemon's rooms. It routes and logs the posts clients write, delivers each routed post to its member as the member's next turn on the thread registry, logs the member's answer, and streams every room to its followers. settings reads rooms.yaml as it is now, so an edit reaches the next post. One lock orders the log's appends with the follows.
func NewHost ¶
func NewHost(ctx context.Context, settings func() config.RoomsConfig, threads sessionsdomain.ThreadRouter, log roomsdomain.Log, decider decisiondomain.Decider, agents AgentCatalog) *Host
NewHost returns the rooms that settings reads each time they are used. It delivers to members through threads, logs to log, and asks decider about the posts that ping nobody.
func (*Host) Close ¶
func (h *Host) Close()
Close stops every member from following its thread when the daemon stops.
func (*Host) Detach ¶
func (h *Host) Detach(c sessionsdomain.Client)
Detach drops a client that disconnected from every room it followed.
func (*Host) Handle ¶
func (h *Host) Handle(c sessionsdomain.Client, frame []byte) bool
Handle claims the rooms frames of one client and reports false for any other. Listing, posting, clearing, deciding and welcomes run off the binding's read loop, while follow, join and leave stay on it so a quick leave never overtakes its follow.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router decides which members of a room get a post. A post that pings agents asks no model: the pinged members get it, an @all every member, and a pinged outsider a notice. A post that pings nobody asks the decision model one predicate per member and goes to one member, the room's pickup deciding how, and rooms.router.fallback handles a post nobody passed.
func NewRouter ¶
func NewRouter(decider decisiondomain.Decider, cfg config.RoomsConfig) *Router
NewRouter returns the router for the rooms config, asking decider about posts that mention no member.
func (*Router) Route ¶
func (r *Router) Route(ctx context.Context, room roomsdomain.Room, agents []agentdomain.SubagentInfo, history []roomsdomain.Post, post roomsdomain.Post) (Routing, error)
Route routes post in room. agents are the agents the CLI knows, with the descriptions the decision model reads, and history the room's earlier posts.
func (*Router) RouteHandover ¶
func (r *Router) RouteHandover(room roomsdomain.Room, agents []agentdomain.SubagentInfo, post roomsdomain.Post) Routing
RouteHandover routes a member's post to the members it pings, so members hand work to each other like teammates. It asks no model, and @all stays the user's: a member's @all reaches nobody.
type Routing ¶
type Routing struct {
Mentions []string
Routes []roomsdomain.Route
Notices []string
Tokens int
}
Routing is where one post goes: the agents it mentions, the members it is routed to with the router's probability, and notices for its author. Tokens are the input tokens the decision model spent on it.