execute: add WithToolRegistry/WithSkillsRegistry Options

Ensures every Server created by the dispatcher factory has registries
wired at construction time, fixing intermittent 'no session registry'
errors from tool_load/skill_load.
This commit is contained in:
Levi Neely 2026-07-29 10:50:26 +02:00
parent fb21228ca1
commit 6941c372d8
1 changed files with 14 additions and 0 deletions

View File

@ -122,6 +122,20 @@ func (e *Server) AllowTools() []string {
return out
}
// WithToolRegistry attaches a tool registry and session ID to the Server.
func WithToolRegistry(r *Registry, sessionID string) Option {
return func(s *Server) {
s.toolRegistry = r
s.sessionID = sessionID
}
}
// WithSkillsRegistry attaches a skills registry to the Server.
func WithSkillsRegistry(r *skills.Registry) Option {
return func(s *Server) { s.skillsRegistry = r }
}
// Decl returns a factory for an execute Server with the given working directory.
func Decl(cwd string, opts ...Option) func() tools.Server {
return func() tools.Server {