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:
parent
fb21228ca1
commit
6941c372d8
|
|
@ -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 {
|
||||
|
|
|
|||
Reference in New Issue