From 6941c372d8e28f9b5861dcb04e2095de72955d7d Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Wed, 29 Jul 2026 10:50:26 +0200 Subject: [PATCH] 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. --- pkg/tools/execute/server.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkg/tools/execute/server.go b/pkg/tools/execute/server.go index 596db24..5b745aa 100644 --- a/pkg/tools/execute/server.go +++ b/pkg/tools/execute/server.go @@ -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 {