Start initializes the RAG manager (indexes documents) and starts a file watcher for incremental updates.
(ctx context.Context)
| 79 | // Start initializes the RAG manager (indexes documents) and starts a |
| 80 | // file watcher for incremental updates. |
| 81 | func (t *ToolSet) Start(ctx context.Context) error { |
| 82 | if t.manager == nil { |
| 83 | return nil |
| 84 | } |
| 85 | |
| 86 | // Forward RAG manager events if a callback is set. |
| 87 | if t.eventCallback != nil { |
| 88 | go t.forwardEvents(ctx) |
| 89 | } |
| 90 | |
| 91 | if err := t.manager.Initialize(ctx); err != nil { |
| 92 | return fmt.Errorf("failed to initialize RAG manager %q: %w", t.toolName, err) |
| 93 | } |
| 94 | |
| 95 | go func() { |
| 96 | if err := t.manager.StartFileWatcher(ctx); err != nil { |
| 97 | slog.ErrorContext(ctx, "Failed to start RAG file watcher", "tool", t.toolName, "error", err) |
| 98 | } |
| 99 | }() |
| 100 | return nil |
| 101 | } |
| 102 | |
| 103 | // Stop closes the RAG manager and releases resources. |
| 104 | func (t *ToolSet) Stop(_ context.Context) error { |
nothing calls this directly
no test coverage detected