/** * Configuration types for the chat indexer */ /** * Base source configuration shared by all source types */ export interface BaseSourceConfig { /** Custom category mappings (path/URL pattern -> category) */ categories?: Record; } /** * Markdown preprocessing configuration */ export interface MarkdownPreprocessingConfig { /** Remove import statements (default: true) */ removeImports?: boolean; /** Remove JSX/MDX components, keeping inner text content (default: true) */ removeJsxComponents?: boolean; /** Remove code blocks entirely (default: false - code can be useful context) */ removeCodeBlocks?: boolean; /** Remove inline code markers (default: false) */ removeInlineCode?: boolean; /** Convert Docusaurus admonitions (:::note, etc.) to plain text (default: true) */ convertAdmonitions?: boolean; /** Remove HTML comments (default: true) */ removeHtmlComments?: boolean; /** Remove link/image reference definitions (default: true) */ removeReferenceDefinitions?: boolean; /** Normalize Unicode characters (default: true) */ normalizeUnicode?: boolean; /** Normalize whitespace (default: true) */ normalizeWhitespace?: boolean; /** Custom regex patterns to remove */ customRemovePatterns?: string[]; } /** * Markdown source configuration (local files) */ export interface MarkdownSourceConfig extends BaseSourceConfig { /** Source type (default for backwards compatibility) */ type?: 'markdown'; /** Path to content directory */ path: string; /** Guide name for this source (e.g., "warranty") */ guide?: string; /** File patterns to include (default: **\/*.md) */ include?: string[]; /** File patterns to exclude */ exclude?: string[]; /** Also include .mdx files (default: true) */ includeMdx?: boolean; /** Markdown preprocessing options */ preprocessing?: MarkdownPreprocessingConfig; } /** * Content preprocessing configuration */ export interface PreprocessingConfig { /** Remove common CTA phrases like "Learn More", "Get Started" (default: true) */ removeCTAs?: boolean; /** Remove phone numbers (default: false) */ removePhoneNumbers?: boolean; /** Normalize Unicode characters - curly quotes, dashes, etc. (default: true) */ normalizeUnicode?: boolean; /** Clean orphaned markdown formatting (default: true) */ cleanMarkdown?: boolean; /** Custom regex patterns to remove */ customPatterns?: string[]; /** Minimum word count for a line to be kept (default: 0 = keep all) */ minLineWords?: number; } /** * Web source configuration (scraped content) */ export interface WebSourceConfig extends BaseSourceConfig { /** Source type */ type: 'web'; /** Sitemap index URL */ sitemapUrl: string; /** Only process these child sitemaps (optional filter by filename) */ includeSitemaps?: string[]; /** URL patterns to include (supports * wildcards). If specified, only matching URLs are processed. */ includePatterns?: string[]; /** URL patterns to exclude (supports * wildcards) */ excludePatterns?: string[]; /** CSS selectors for main content areas */ contentSelectors?: string[]; /** CSS selectors for elements to remove before extraction */ excludeSelectors?: string[]; /** Requests per second (default: 2) */ rateLimit?: number; /** Content preprocessing options */ preprocessing?: PreprocessingConfig; /** Remove elements hidden via inline styles (default: true) */ removeHiddenElements?: boolean; /** Deduplicate repeated content blocks (default: true) */ deduplicate?: boolean; } /** * GitHub markdown preprocessing configuration */ export interface GitHubPreprocessingConfig { /** Remove import statements (default: true) */ removeImports?: boolean; /** Remove JSX/MDX components (default: true) */ removeJsxComponents?: boolean; /** Remove code blocks (default: false) */ removeCodeBlocks?: boolean; /** Convert Docusaurus admonitions to plain text (default: true) */ convertAdmonitions?: boolean; /** Remove HTML comments (default: true) */ removeHtmlComments?: boolean; /** Normalize whitespace (default: true) */ normalizeWhitespace?: boolean; } /** * Docusaurus versioning configuration for GitHub source */ export interface DocusaurusVersioningConfig { /** Strategy identifier */ strategy: 'docusaurus'; /** Path to versions.json relative to repo root */ versionsFile: string; /** Path pattern for versioned docs (use {version} placeholder) */ versionedDocsPath: string; /** Which version is "current" (gets clean URLs) */ currentVersion: string; /** Only index these versions (optional) */ includeVersions?: string[]; /** Skip these versions (optional) */ excludeVersions?: string[]; } /** * GitHub source configuration (content from GitHub repositories) */ export interface GitHubSourceConfig extends BaseSourceConfig { /** Source type */ type: 'github'; /** Repository in "owner/repo" format */ repository: string; /** Default branch (default: "main") */ defaultRef?: string; /** Path to docs directory (default: "docs") */ docsPath?: string; /** Guide identifier */ guide: string; /** URL route base path (e.g., "warranty") */ routeBasePath: string; /** Docusaurus versioning configuration */ versioning?: DocusaurusVersioningConfig; /** File patterns to exclude */ exclude?: string[]; /** Markdown preprocessing options */ preprocessing?: GitHubPreprocessingConfig; } /** * Union type for all source configurations */ export type SourceConfig = MarkdownSourceConfig | WebSourceConfig | GitHubSourceConfig; /** * Type guard to check if source is a web source */ export declare function isWebSource(source: SourceConfig): source is WebSourceConfig; /** * Type guard to check if source is a markdown source */ export declare function isMarkdownSource(source: SourceConfig): source is MarkdownSourceConfig; /** * Type guard to check if source is a GitHub source */ export declare function isGitHubSource(source: SourceConfig): source is GitHubSourceConfig; /** * Versioning configuration (for Docusaurus-style versioned docs) */ export interface VersioningConfig { /** Path to versions.json file */ versionsFile?: string; /** Path to versioned_docs directory */ versionedDocsPath?: string; /** Explicit list of versions to index */ versions?: string[]; } /** * URL generation configuration */ export interface UrlConfig { /** URL pattern template. Variables: {site}, {guide}, {version}, {path} */ pattern?: string; /** Version to treat as "latest" (omit from URL) */ latestVersion?: string; } /** * Chunking configuration */ export interface ChunkingConfig { /** Chunking strategy */ strategy?: 'heading' | 'paragraph' | 'fixed'; /** Heading level to split on (for 'heading' strategy) */ headingLevel?: number; /** Minimum chunk size in characters */ minSize?: number; /** Maximum chunk size in characters */ maxSize?: number; } /** * Embedding configuration * * Supported models: * - @cf/baai/bge-m3 (recommended): 1024 dims, 8192+ tokens, $0.012/M * - @cf/baai/bge-large-en-v1.5: 1024 dims, 512 tokens, $0.20/M * - @cf/baai/bge-base-en-v1.5: 768 dims, 512 tokens, $0.067/M * - @cf/baai/bge-small-en-v1.5: 384 dims, 512 tokens */ export interface EmbeddingConfig { /** Embedding model name (default: @cf/baai/bge-m3) */ model?: string; /** Expected embedding dimensions for validation (default: auto-detected from model) */ dimensions?: number; /** Batch size for embedding requests (default: 50) */ batchSize?: number; /** Whether to truncate inputs that exceed model's max length (default: true) */ truncateInputs?: boolean; } /** * Vectorize configuration */ export interface VectorizeConfig { /** Vectorize index name */ indexName: string; /** Batch size for upsert requests */ batchSize?: number; } /** * Auto-init configuration for Vectorize index creation */ export interface AutoInitConfig { /** Whether to auto-initialize the index (default: true) */ enabled?: boolean; /** Embedding dimensions (default: 1024 from embedding config) */ dimensions?: number; /** Distance metric (default: cosine) */ metric?: 'cosine' | 'euclidean' | 'dot-product'; /** Metadata indexes to create for filtering */ metadataIndexes?: Array<{ propertyName: string; type: 'string' | 'number' | 'boolean'; }>; } /** * Extended Vectorize configuration with auto-init support */ export interface ExtendedVectorizeConfig extends VectorizeConfig { /** Auto-initialization settings for index creation */ autoInit?: AutoInitConfig; } /** * Full indexer configuration */ export interface IndexerConfig { /** Site identifier (e.g., "docs", "marketing") */ site: string; /** Site base URL */ siteUrl: string; /** Guide identifier (e.g., "warranty", "homeowner") */ guide?: string; /** Content version (e.g., "2026.07.01", "next") */ version?: string; /** Whether this is the latest/current version */ isLatest?: boolean; /** Content sources to index */ sources: SourceConfig[]; /** Versioning configuration */ versioning?: VersioningConfig; /** URL generation configuration */ url?: UrlConfig; /** Chunking configuration */ chunking?: ChunkingConfig; /** Embedding configuration */ embedding?: EmbeddingConfig; /** Vectorize configuration */ vectorize: ExtendedVectorizeConfig; } //# sourceMappingURL=types.d.ts.map