import type { IntentClassification, AgentConfig } from './types.js'; import type { OfflineVectorExport, SiteMapConfig, CategoryDefinition, AgenticSiteMapEntry } from '../types.js'; import { SiteMapDiscovery } from './SiteMapDiscovery.js'; /** * Intent classifier for agentic actions * * Classifies user messages to determine if they should trigger * a local DOM action or be sent to the backend RAG. */ export declare class CyberneticIntentClassifier { private config; private siteMapIndex; private formIndex; private modalIndex; private categories; private topicKeywords; /** Multi-source sitemap discovery instance */ private siteMapDiscovery; /** * Create a new intent classifier * * @param config - Agent configuration * @param apiUrl - Backend API URL (for multi-source sitemap) * @param apiKey - API key for authentication */ constructor(config: AgentConfig, apiUrl?: string, apiKey?: string); /** * Build search indexes from configuration */ private buildIndexes; /** * Classify user message intent * * @param message - User's message to classify * @returns Classification result with action and confidence */ classify(message: string): IntentClassification; /** * Build action from pattern match */ private buildAction; /** * Extract target from regex match */ private extractTarget; /** * Strip common articles and filler words for better matching */ private stripArticles; /** * Find site map match for target string */ private findSiteMapMatch; /** * Fuzzy match against site map for unstructured queries */ private fuzzyMatchSiteMap; /** * Match custom action keywords */ private matchCustomAction; /** * Parse form fill intent */ private parseFormIntent; /** * Find button selector by name */ private findButtonSelector; /** * Find modal config by name */ private findModalConfig; /** * Find scroll target selector */ private findScrollTarget; /** * Find element by description */ private findElementByDescription; /** * Generate unique selector for an element */ private generateUniqueSelector; /** * Calculate string similarity (Jaccard index) */ private calculateSimilarity; /** * Get configuration */ getConfig(): AgentConfig; /** * Train classifier from exported documents * Extracts topics and keywords for better intent classification * * @param exportData - The offline vector export data */ trainFromExport(exportData: OfflineVectorExport): Promise; /** * Load sitemap from configuration * * @param config - Sitemap configuration with URL or inline data */ loadSitemap(config: SiteMapConfig): Promise; /** * Load sitemap entries into the index */ private loadSitemapEntries; /** * Extract topics and keywords from document content */ private extractTopicsFromDocuments; /** * Check if word is a stop word */ private isStopWord; /** * Get loaded categories */ getCategories(): CategoryDefinition[]; /** * Get topic keywords */ getTopicKeywords(): Map; /** * Check if classifier has been trained */ isTrained(): boolean; /** * Initialize multi-source sitemap discovery * Call this after construction to load all sitemap sources * * @returns Promise that resolves when discovery is complete */ initializeDiscovery(): Promise; /** * Rebuild sitemap indexes from discovery results * Merges discovered entries with existing static config */ private rebuildIndexesFromDiscovery; /** * Check if sitemap discovery is ready * * @returns true if discovery is complete and entries are loaded */ isSiteMapReady(): boolean; /** * Ensure sitemap is ready before classification * Initializes discovery if not already done * * @returns Promise that resolves when sitemap is ready */ ensureSiteMapReady(): Promise; /** * Refresh sitemap from all sources * Forces reload of backend and re-discovery * * @returns Promise that resolves when refresh is complete */ refreshSiteMap(): Promise; /** * Get the SiteMapDiscovery instance for advanced use cases * * @returns The SiteMapDiscovery instance or null if not configured */ getSiteMapDiscovery(): SiteMapDiscovery | null; /** * Get current sitemap entries (merged from all sources) * * @returns Array of sitemap entries */ getSiteMapEntries(): AgenticSiteMapEntry[]; } //# sourceMappingURL=CyberneticIntentClassifier.d.ts.map