@karmaniverous/jeeves-watcher
    Preparing search index...

    Interface JeevesWatcherFactories

    Component factories for JeevesWatcher. Override in tests to inject mocks.

    interface JeevesWatcherFactories {
        compileRules: (
            rules: {
                description: string;
                map?: JsonMapMap;
                match: Record<string, unknown>;
                name: string;
                render?: {
                    body: {
                        contentPath?: string;
                        each?: boolean;
                        format?: string;
                        formatArgs?: unknown[];
                        heading: number;
                        headingTemplate?: string;
                        label?: string;
                        path: string;
                        sort?: string;
                    }[];
                    frontmatter: string[];
                };
                schema?: (
                    | string
                    | {
                        properties?: Record<string, Record<string, unknown>>;
                        type?: "object";
                    }
                )[];
                template?: string;
            }[],
        ) => CompiledRule[];
        createApiServer: (options: ApiServerOptions) => FastifyInstance;
        createDocumentProcessor: (
            deps: DocumentProcessorDeps,
        ) => DocumentProcessorInterface;
        createEmbeddingProvider: (
            config: {
                apiKey?: string;
                chunkOverlap?: number;
                chunkSize?: number;
                concurrency?: number;
                dimensions?: number;
                model: string;
                provider: string;
                rateLimitPerMinute?: number;
            },
            logger?: Logger<never, boolean>,
            additionalProviders?: Map<string, ProviderFactory>,
        ) => EmbeddingProvider;
        createEventQueue: (options: EventQueueOptions) => EventQueue;
        createFileSystemWatcher: (
            config: {
                debounceMs?: number;
                ignored?: string[];
                paths: string[];
                pollIntervalMs?: number;
                respectGitignore?: boolean;
                stabilityThresholdMs?: number;
                usePolling?: boolean;
            },
            queue: EventQueue,
            processor: DocumentProcessorInterface,
            logger: Logger,
            options?: FileSystemWatcherOptions,
        ) => FileSystemWatcher;
        createLogger: (config?: { file?: string; level?: string }) => Logger;
        createVectorStoreClient: (
            config: { apiKey?: string; collectionName: string; url: string },
            dimensions: number,
            logger: Logger,
        ) => VectorStoreClient;
        loadConfig: (configPath?: string) => Promise<JeevesWatcherConfig>;
    }
    Index

    Properties

    compileRules: (
        rules: {
            description: string;
            map?: JsonMapMap;
            match: Record<string, unknown>;
            name: string;
            render?: {
                body: {
                    contentPath?: string;
                    each?: boolean;
                    format?: string;
                    formatArgs?: unknown[];
                    heading: number;
                    headingTemplate?: string;
                    label?: string;
                    path: string;
                    sort?: string;
                }[];
                frontmatter: string[];
            };
            schema?: (
                | string
                | {
                    properties?: Record<string, Record<string, unknown>>;
                    type?: "object";
                }
            )[];
            template?: string;
        }[],
    ) => CompiledRule[]

    Compile inference rules from config.

    Type Declaration

      • (
            rules: {
                description: string;
                map?: JsonMapMap;
                match: Record<string, unknown>;
                name: string;
                render?: {
                    body: {
                        contentPath?: string;
                        each?: boolean;
                        format?: string;
                        formatArgs?: unknown[];
                        heading: number;
                        headingTemplate?: string;
                        label?: string;
                        path: string;
                        sort?: string;
                    }[];
                    frontmatter: string[];
                };
                schema?: (
                    | string
                    | {
                        properties?: Record<string, Record<string, unknown>>;
                        type?: "object";
                    }
                )[];
                template?: string;
            }[],
        ): CompiledRule[]
      • Compile an array of inference rules into executable validators. Validates rule name uniqueness before compilation.

        Parameters

        • rules: {
              description: string;
              map?: JsonMapMap;
              match: Record<string, unknown>;
              name: string;
              render?: {
                  body: {
                      contentPath?: string;
                      each?: boolean;
                      format?: string;
                      formatArgs?: unknown[];
                      heading: number;
                      headingTemplate?: string;
                      label?: string;
                      path: string;
                      sort?: string;
                  }[];
                  frontmatter: string[];
              };
              schema?: (
                  | string
                  | {
                      properties?: Record<string, Record<string, unknown>>;
                      type?: "object";
                  }
              )[];
              template?: string;
          }[]

          The inference rule definitions.

          • description: string

            Human-readable description of what this rule does.

          • Optionalmap?: JsonMapMap

            JsonMap transformation (inline or reference to named map).

          • match: Record<string, unknown>

            JSON Schema object to match against document metadata.

          • name: string

            Unique name for this inference rule.

          • Optionalrender?: {
                body: {
                    contentPath?: string;
                    each?: boolean;
                    format?: string;
                    formatArgs?: unknown[];
                    heading: number;
                    headingTemplate?: string;
                    label?: string;
                    path: string;
                    sort?: string;
                }[];
                frontmatter: string[];
            }

            Declarative structured renderer configuration (mutually exclusive with template).

            • body: {
                  contentPath?: string;
                  each?: boolean;
                  format?: string;
                  formatArgs?: unknown[];
                  heading: number;
                  headingTemplate?: string;
                  label?: string;
                  path: string;
                  sort?: string;
              }[]

              Ordered markdown body sections.

            • frontmatter: string[]

              Keys to extract from context and include as YAML frontmatter.

          • Optionalschema?: (
                | string
                | { properties?: Record<string, Record<string, unknown>>; type?: "object" }
            )[]

            Array of schema references to merge (named refs and/or inline objects).

          • Optionaltemplate?: string

            Handlebars template (inline string, named ref, or .hbs/.handlebars file path).

        Returns CompiledRule[]

        An array of compiled rules.

    createApiServer: (options: ApiServerOptions) => FastifyInstance

    Create the HTTP API server.

    Type Declaration

      • (options: ApiServerOptions): FastifyInstance
      • Create the Fastify API server with all routes registered.

        The returned instance is not yet listening — call server.listen() to start.

        Parameters

        Returns FastifyInstance

        A configured Fastify instance.

    createDocumentProcessor: (
        deps: DocumentProcessorDeps,
    ) => DocumentProcessorInterface

    Create a document processor for file ingestion.

    createEmbeddingProvider: (
        config: {
            apiKey?: string;
            chunkOverlap?: number;
            chunkSize?: number;
            concurrency?: number;
            dimensions?: number;
            model: string;
            provider: string;
            rateLimitPerMinute?: number;
        },
        logger?: Logger<never, boolean>,
        additionalProviders?: Map<string, ProviderFactory>,
    ) => EmbeddingProvider

    Create an embedding provider from config.

    Type Declaration

      • (
            config: {
                apiKey?: string;
                chunkOverlap?: number;
                chunkSize?: number;
                concurrency?: number;
                dimensions?: number;
                model: string;
                provider: string;
                rateLimitPerMinute?: number;
            },
            logger?: Logger<never, boolean>,
            additionalProviders?: Map<string, ProviderFactory>,
        ): EmbeddingProvider
      • Create an embedding provider based on the given configuration.

        Each provider is responsible for its own default dimensions.

        Parameters

        • config: {
              apiKey?: string;
              chunkOverlap?: number;
              chunkSize?: number;
              concurrency?: number;
              dimensions?: number;
              model: string;
              provider: string;
              rateLimitPerMinute?: number;
          }

          The embedding configuration.

          • OptionalapiKey?: string

            API key for the embedding provider.

          • OptionalchunkOverlap?: number

            Overlap between chunks in tokens.

          • OptionalchunkSize?: number

            Maximum tokens per chunk for splitting.

          • Optionalconcurrency?: number

            Maximum concurrent embedding requests.

          • Optionaldimensions?: number

            Embedding vector dimensions.

          • model: string

            The embedding model name.

          • provider: string

            The embedding model provider.

          • OptionalrateLimitPerMinute?: number

            Maximum embedding requests per minute.

        • Optionallogger: Logger<never, boolean>

          Optional pino logger for retry warnings.

        • OptionaladditionalProviders: Map<string, ProviderFactory>

          Optional map of additional provider factories to register.

        Returns EmbeddingProvider

        An EmbeddingProvider instance.

        If the configured provider is not supported.

    createEventQueue: (options: EventQueueOptions) => EventQueue

    Create an event queue for batching file-system events.

    createFileSystemWatcher: (
        config: {
            debounceMs?: number;
            ignored?: string[];
            paths: string[];
            pollIntervalMs?: number;
            respectGitignore?: boolean;
            stabilityThresholdMs?: number;
            usePolling?: boolean;
        },
        queue: EventQueue,
        processor: DocumentProcessorInterface,
        logger: Logger,
        options?: FileSystemWatcherOptions,
    ) => FileSystemWatcher

    Create a file-system watcher for the configured watch paths.

    createLogger: (config?: { file?: string; level?: string }) => Logger

    Create a pino logger instance.

    Type Declaration

      • (config?: { file?: string; level?: string }): Logger
      • Create a pino logger instance.

        Parameters

        • Optionalconfig: { file?: string; level?: string }

          Optional logging configuration.

          • Optionalfile?: string

            Log file path.

          • Optionallevel?: string

            Log level.

        Returns Logger

        A configured pino logger.

    createVectorStoreClient: (
        config: { apiKey?: string; collectionName: string; url: string },
        dimensions: number,
        logger: Logger,
    ) => VectorStoreClient

    Create a vector-store client for similarity search and upsert.

    loadConfig: (configPath?: string) => Promise<JeevesWatcherConfig>

    Load and validate a JeevesWatcherConfig from disk.