/** * Advanced Task Dependency Inference System * * This system uses a combination of techniques to automatically infer dependencies * between tasks in a plan, including: * * 1. Natural language processing to detect dependency phrases * 2. Knowledge flow analysis to understand input/output relationships * 3. Task type hierarchy analysis to understand logical task ordering * 4. Content similarity analysis to detect related tasks */ import { PlanTask } from './planner-interface'; /** * Graph representation of task dependencies */ export interface DependencyGraph { tasks: PlanTask[]; edges: Array<{ from: string; to: string; weight: number; }>; criticalPath: string[]; } /** * Information flow between tasks */ export interface TaskInfoFlow { taskId: string; inputs: string[]; outputs: string[]; } /** * Configuration for dependency inference */ export interface DependencyInferenceConfig { enableContentSimilarity?: boolean; enableTypeHierarchy?: boolean; enableInformationFlow?: boolean; minDependencyCertainty?: number; maxDependenciesPerTask?: number; } /** * A class that provides advanced dependency inference capabilities */ export declare class DependencyInference { private logger; private config; private taskTypeHierarchy; private dependencyPhrases; /** * Creates a new dependency inference system * * @param config - Configuration options */ constructor(config?: DependencyInferenceConfig); /** * Infer dependencies between tasks in a plan * * @param tasks - The tasks to analyze * @param contextText - Optional natural language context that describes the plan * @returns The tasks with inferred dependencies */ inferDependencies(tasks: PlanTask[], contextText?: string): PlanTask[]; /** * Infer dependencies from natural language text * * @param tasks - The tasks to update with dependencies * @param contextText - The text to analyze */ private inferDependenciesFromText; /** * Infer dependencies based on task type hierarchy * * @param tasks - The tasks to update with dependencies */ private inferDependenciesFromTaskTypes; /** * Infer dependencies from information flow between tasks * * @param tasks - The tasks to update with dependencies */ private inferDependenciesFromInformationFlow; /** * Infer dependencies based on content similarity between tasks * * @param tasks - The tasks to update with dependencies */ private inferDependenciesFromContentSimilarity; /** * Builds a dependency graph from tasks * * @param tasks - The tasks to build a graph from * @returns The dependency graph */ private buildDependencyGraph; /** * Calculates the critical path through the dependency graph * * @param tasks - The tasks in the graph * @param edges - The edges in the graph * @returns The critical path (sequence of task IDs) */ private calculateCriticalPath; /** * Removes cycles in the dependency graph to ensure the plan can execute * * @param tasks - The tasks to update * @param graph - The dependency graph */ private removeDependencyCycles; /** * Limit the number of dependencies per task to avoid over-constraining * * @param tasks - The tasks to update */ private limitDependenciesPerTask; /** * Extract keywords from a task description * * @param text - The text to extract keywords from * @returns Array of keywords */ private extractKeywords; /** * Check if a word is a common stop word * * @param word - The word to check * @returns True if the word is a stop word */ private isStopWord; /** * Estimate a task's natural position in a sequence based on keywords * * @param description - The task description * @returns A numeric sequence position */ private estimateSequencePosition; /** * Visualize the dependency graph (returns a simple text representation) * * @param tasks - The tasks in the graph * @returns Text visualization of the graph */ visualizeDependencyGraph(tasks: PlanTask[]): string; }