/** * Solution Pattern Extractor - Identifies reusable solution patterns from conversations. * * This extractor analyzes conversation history to identify successful solutions * that can be reused for similar problems. It captures: * - Problem type/category * - Solution approach * - Code pattern or technique used * - Prerequisites/dependencies * - When to apply this solution * - When NOT to apply this solution * * @example * ```typescript * const extractor = new SolutionPatternExtractor(); * const patterns = extractor.extractPatterns(messages, toolUses, toolResults); * patterns.forEach(p => { * console.log(`Problem: ${p.problem_category}`); * console.log(`Solution: ${p.solution_summary}`); * console.log(`Applies when: ${p.applies_when}`); * }); * ``` */ import type { Message, ToolUse, ToolResult } from "./ConversationParser.js"; /** * Represents a reusable solution pattern extracted from conversation history. */ export interface SolutionPattern { /** Unique pattern identifier */ id: string; /** Conversation where this pattern was identified */ conversation_id: string; /** Message where solution was applied */ message_id: string; /** Category of problem this solves */ problem_category: string; /** Brief description of the problem */ problem_description: string; /** Summary of the solution */ solution_summary: string; /** Detailed solution steps */ solution_steps: string[]; /** Code snippet or technique */ code_pattern?: string; /** Technology/framework involved */ technology: string[]; /** Prerequisites for this solution */ prerequisites: string[]; /** When to apply this solution */ applies_when: string; /** When NOT to apply this solution */ avoid_when?: string; /** Files where this pattern was applied */ applied_to_files: string[]; /** How well did this work */ effectiveness: "excellent" | "good" | "moderate" | "poor"; /** When the pattern was identified */ timestamp: number; } /** * Extracts reusable solution patterns from conversation history. */ export declare class SolutionPatternExtractor { private readonly NOISE_PATTERNS; private readonly CATEGORY_PATTERNS; private readonly SOLUTION_PATTERNS; private readonly APPLIES_WHEN_PATTERNS; private readonly AVOID_WHEN_PATTERNS; private readonly TECH_PATTERNS; private readonly EFFECTIVENESS_PATTERNS; /** * Extract solution patterns from conversation history. * * @param messages - Array of conversation messages * @param toolUses - Array of tool uses * @param toolResults - Array of tool results * @returns Array of extracted SolutionPattern objects */ extractPatterns(messages: Message[], toolUses: ToolUse[], toolResults: ToolResult[]): SolutionPattern[]; /** * Check if content is noise. */ private isNoiseContent; /** * Find message segments that contain problem + solution pairs. */ private findSolutionSegments; /** * Extract a solution pattern from a message segment. */ private extractPatternFromSegment; /** * Extract problem description from user message. */ private extractProblemDescription; /** * Find the message containing the solution. */ private findSolutionMessage; /** * Identify problem category. */ private identifyCategory; /** * Extract solution summary. */ private extractSolutionSummary; /** * Extract solution steps from messages. */ private extractSolutionSteps; /** * Extract code pattern if present. */ private extractCodePattern; /** * Extract technology mentions. */ private extractTechnology; /** * Extract prerequisites. */ private extractPrerequisites; /** * Extract when the solution applies. */ private extractAppliesWhen; /** * Extract when to avoid this solution. */ private extractAvoidWhen; /** * Extract files where solution was applied. */ private extractAppliedFiles; /** * Determine effectiveness of the solution. */ private determineEffectiveness; /** * Deduplicate similar patterns. */ private deduplicatePatterns; } //# sourceMappingURL=SolutionPatternExtractor.d.ts.map