/** * Intent Executor for NCP * Enables single-call discovery + execution via embedding-based parameter matching * * Flow: * 1. User provides intent + context params * 2. Find best matching tool via semantic search * 3. Match user params to tool schema params via embedding similarity * 4. Execute tool with mapped parameters */ export interface ParamMapping { userParam: string; schemaParam: string; confidence: number; userValue: any; } export interface UnmappedParam { userParam: string; userValue: any; bestMatch?: string; bestScore?: number; suggestion?: string; } export interface IntentResult { success: boolean; tool?: string; toolDescription?: string; mappedParams?: Record; paramMappings?: ParamMapping[]; unmappedParams?: UnmappedParam[]; missingRequired?: string[]; schema?: { properties: Record; required: string[]; }; result?: any; error?: string; hint?: string; } export interface SchemaProperty { name: string; type: string; description?: string; required: boolean; } export declare class IntentExecutor { private toolFinder; private toolExecutor; private model; private isInitialized; private useEmbeddings; private paramEmbeddingCache; constructor(toolFinder: (query: string, limit: number) => Promise, toolExecutor: (toolName: string, params: any) => Promise); /** * Initialize with the embedding model from RAG engine * If model is null, falls back to string-based matching */ initialize(model: any): Promise; /** * Execute intent with automatic tool discovery and parameter mapping */ execute(intent: string, context: Record): Promise; /** * Extract properties from JSON schema */ private extractSchemaProperties; /** * Map user-provided params to schema params via embedding or string similarity * Returns both successful mappings and unmapped params with suggestions */ private mapParameters; /** * String-based similarity for param matching (fallback when no embedding model) * Uses multiple heuristics: exact match, substring, common synonyms, Levenshtein */ private stringSimilarity; /** * Calculate Levenshtein edit distance between two strings */ private levenshteinDistance; /** * Get embedding for a parameter name/description (with caching) */ private getParamEmbedding; /** * Calculate cosine similarity between two embeddings */ private cosineSimilarity; /** * Coerce value to expected type */ private coerceType; /** * Clear param embedding cache */ clearCache(): void; } //# sourceMappingURL=intent-executor.d.ts.map