import { Agent } from '../core/agent'; import { RunOptions, RunResult } from '../core/types'; /** * A task in a plan */ export interface PlanTask { id: string; description: string; dependencies: string[]; status: 'pending' | 'in_progress' | 'completed' | 'failed'; result?: string; error?: string; subtasks?: PlanTask[]; estimatedDuration?: number; priority?: number; assignedTo?: string; resourceRequirements?: string[]; } /** * A plan for executing a complex task */ export interface Plan { id: string; originalTask: string; tasks: PlanTask[]; created: number; updated: number; status: 'created' | 'in_progress' | 'completed' | 'failed' | 'replanning'; estimatedCompletionTime?: number; progress?: number; metadata?: Record; } /** * Planning strategy enum */ export declare enum PlanningStrategy { SEQUENTIAL = "sequential",// Tasks are executed in sequence PARALLEL = "parallel",// Independent tasks can run in parallel HIERARCHICAL = "hierarchical",// Tasks can have subtasks ADAPTIVE = "adaptive" } /** * Plan creation options */ export interface PlanOptions { strategy?: PlanningStrategy; maxParallelTasks?: number; maxRetries?: number; timeout?: number; agents?: Agent[]; resourceConstraints?: Record; _skipPlanning?: boolean; } /** * Interface for planners that can break down complex tasks */ export interface PlannerInterface { /** * Creates a plan to accomplish a complex task * * @param task - The complex task to plan for * @param agent - The agent creating the plan * @param options - Optional planning configuration * @returns Promise resolving to the created plan */ createPlan(task: string, agent: Agent, options?: PlanOptions): Promise; /** * Executes a plan using an agent * * @param plan - The plan to execute * @param agent - The agent executing the plan * @param options - The original run options * @returns Promise resolving to the execution result */ executePlan(plan: Plan, agent: Agent, options: RunOptions): Promise; /** * Updates a task's status and result * * @param plan - The plan containing the task * @param taskId - ID of the task to update * @param status - New status * @param result - Optional result from the task * @param error - Optional error message * @returns The updated plan */ updateTaskStatus(plan: Plan, taskId: string, status: PlanTask['status'], result?: string, error?: string): Plan; /** * Checks if a plan needs to be revised based on execution results * * @param plan - The current plan * @param agent - The agent executing the plan * @returns Promise resolving to a boolean indicating if replanning is needed */ shouldReplan(plan: Plan, agent: Agent): Promise; /** * Creates a revised plan based on execution results so far * * @param originalPlan - The original plan that needs revision * @param agent - The agent creating the revised plan * @returns Promise resolving to the revised plan */ replan(originalPlan: Plan, agent: Agent): Promise; }