@@ -138,13 +138,13 @@ func NewCommand(opts *internal.ToolboxOptions) *cobra.Command {
138138 return cmd
139139}
140140
141- func handleDynamicReload (ctx context.Context , toolsFile internal.ToolsFile , s * server.Server ) error {
141+ func handleDynamicReload (ctx context.Context , toolsFile internal.ToolsFile , s * server.Server , allowPartialSources bool ) error {
142142 logger , err := util .LoggerFromContext (ctx )
143143 if err != nil {
144144 panic (err )
145145 }
146146
147- sourcesMap , authServicesMap , embeddingModelsMap , toolsMap , toolsetsMap , promptsMap , promptsetsMap , err := validateReloadEdits (ctx , toolsFile )
147+ sourcesMap , authServicesMap , embeddingModelsMap , toolsMap , toolsetsMap , promptsMap , promptsetsMap , err := validateReloadEdits (ctx , toolsFile , allowPartialSources )
148148 if err != nil {
149149 errMsg := fmt .Errorf ("unable to validate reloaded edits: %w" , err )
150150 logger .WarnContext (ctx , errMsg .Error ())
@@ -158,7 +158,7 @@ func handleDynamicReload(ctx context.Context, toolsFile internal.ToolsFile, s *s
158158
159159// validateReloadEdits checks that the reloaded tools file configs can initialized without failing
160160func validateReloadEdits (
161- ctx context.Context , toolsFile internal.ToolsFile ,
161+ ctx context.Context , toolsFile internal.ToolsFile , allowPartialSources bool ,
162162) (map [string ]sources.Source , map [string ]auth.AuthService , map [string ]embeddingmodels.EmbeddingModel , map [string ]tools.Tool , map [string ]tools.Toolset , map [string ]prompts.Prompt , map [string ]prompts.Promptset , error ,
163163) {
164164 logger , err := util .LoggerFromContext (ctx )
@@ -184,6 +184,7 @@ func validateReloadEdits(
184184 ToolConfigs : toolsFile .Tools ,
185185 ToolsetConfigs : toolsFile .Toolsets ,
186186 PromptConfigs : toolsFile .Prompts ,
187+ AllowPartialSources : allowPartialSources ,
187188 }
188189
189190 sourcesMap , authServicesMap , embeddingModelsMap , toolsMap , toolsetsMap , promptsMap , promptsetsMap , err := server .InitializeConfigs (ctx , reloadedConfig )
@@ -239,7 +240,7 @@ func scanWatchedFiles(watchingFolder bool, folderToWatch string, watchedFiles ma
239240}
240241
241242// watchChanges checks for changes in the provided yaml tools file(s) or folder.
242- func watchChanges (ctx context.Context , watchDirs map [string ]bool , watchedFiles map [string ]bool , s * server.Server , pollTickerSecond int ) {
243+ func watchChanges (ctx context.Context , watchDirs map [string ]bool , watchedFiles map [string ]bool , s * server.Server , pollTickerSecond int , allowPartialSources bool ) {
243244 logger , err := util .LoggerFromContext (ctx )
244245 if err != nil {
245246 panic (err )
@@ -384,7 +385,7 @@ func watchChanges(ctx context.Context, watchDirs map[string]bool, watchedFiles m
384385 }
385386 }
386387
387- err = handleDynamicReload (ctx , reloadedToolsFile , s )
388+ err = handleDynamicReload (ctx , reloadedToolsFile , s , allowPartialSources )
388389 if err != nil {
389390 errMsg := fmt .Errorf ("unable to parse reloaded tools file at %q: %w" , reloadedToolsFile , err )
390391 logger .WarnContext (ctx , errMsg .Error ())
@@ -500,7 +501,7 @@ func run(cmd *cobra.Command, opts *internal.ToolboxOptions) error {
500501 if isCustomConfigured && ! opts .Cfg .DisableReload {
501502 watchDirs , watchedFiles := resolveWatcherInputs (opts .ToolsFile , opts .ToolsFiles , opts .ToolsFolder )
502503 // start watching the file(s) or folder for changes to trigger dynamic reloading
503- go watchChanges (ctx , watchDirs , watchedFiles , s , opts .Cfg .PollInterval )
504+ go watchChanges (ctx , watchDirs , watchedFiles , s , opts .Cfg .PollInterval , opts . Cfg . AllowPartialSources )
504505 }
505506
506507 // wait for either the server to error out or the command's context to be canceled
0 commit comments