/** * Task Decomposition Service * Single Responsibility: Delegate query decomposition to Claude for intelligent task splitting * * This service enables the "Task Split" capability where complex multi-part requests * are broken down into smaller, focused tasks. Each sub-task gets its own tailored * context from the semantic search and graph analysis. * * All decomposition logic is now delegated to ClaudeIntentAnalyzer, which uses * actual Claude AI to analyze and decompose queries instead of hardcoded patterns. * * Benefits: * - Better Focus: Claude concentrates on one thing at a time * - Optimized Context: Each sub-task gets precisely relevant files * - Reduced Token Usage: No wasted tokens on irrelevant context * - Improved Accuracy: AI-powered decomposition understands domain concepts */ import { QueryAnalysis } from './natural-language-processor'; import { SemanticResult } from './semantic-search-orchestrator'; import { GraphContext } from './graph-analysis-service'; export interface SubTask { id: number; type: SubTaskType; description: string; searchTerms: string[]; priority: number; dependencies: number[]; contextFilter?: ContextFilter; estimatedComplexity: 'low' | 'medium' | 'high'; } export type SubTaskType = 'analyze' | 'create' | 'modify' | 'refactor' | 'test' | 'fix' | 'document' | 'configure' | 'general'; export interface ContextFilter { filePatterns?: string[]; fileTypes?: string[]; relationshipTypes?: string[]; maxFiles?: number; } export interface DecompositionResult { isComplex: boolean; originalQuery: string; subTasks: SubTask[]; executionPlan: ExecutionPlan; reasoning?: string; } export interface ExecutionPlan { phases: ExecutionPhase[]; totalEstimatedSteps: number; } export interface ExecutionPhase { phaseNumber: number; taskIds: number[]; description: string; } export interface SubTaskContext { subTask: SubTask; semanticResults: SemanticResult[]; graphContext: GraphContext; enhancedPrompt: string; } export declare class TaskDecompositionService { private claudeAnalyzer; constructor(); /** * Analyze a query and decompose it into sub-tasks using Claude * This is the async version that uses AI for intelligent decomposition */ decomposeQueryAsync(query: string, queryAnalysis: QueryAnalysis): Promise; /** * Synchronous version for backward compatibility * Returns single task - callers should migrate to decomposeQueryAsync */ decomposeQuery(query: string, queryAnalysis: QueryAnalysis): DecompositionResult; /** * Convert Claude's DecomposedTask format to our SubTask format */ private convertToSubTasks; /** * Create a single task result for simple queries */ private createSingleTaskResult; /** * Map intent to task type */ private mapIntentToTaskType; /** * Create context filter based on task type */ private createContextFilter; /** * Create execution plan from sub-tasks */ private createExecutionPlan; /** * Generate human-readable phase description */ private describePhase; /** * Filter semantic results for a specific sub-task */ filterContextForSubTask(subTask: SubTask, allSemanticResults: SemanticResult[], allGraphContext: GraphContext): SubTaskContext; /** * Build an enhanced prompt for a specific sub-task */ private buildSubTaskPrompt; /** * Get specific instructions based on task type */ private getTaskTypeInstructions; /** * Format decomposition result for display */ formatDecompositionSummary(result: DecompositionResult): string; } //# sourceMappingURL=task-decomposition-service.d.ts.map