// 任务编排引擎 - 类型定义
export interface TaskPlan {
  id: string;
  goal: string;
  steps: TaskStep[];
  dependencies: Map<string, string[]>;
  context: Map<string, any>;
  status: PlanStatus;
  progress: number;
}

export interface TaskStep {
  id: string;
  description: string;
  tool: string;
  params: any;
  dependencies: string[];
  status: StepStatus;
  result?: any;
  error?: string;
}

export type PlanStatus = 'planned' | 'executing' | 'completed' | 'failed' | 'paused';
export type StepStatus = 'pending' | 'running' | 'completed' | 'failed' | 'skipped';

export interface ExecutionResult {
  planId: string;
  status: PlanStatus;
  results: any[];
}

export interface Progress {
  planId: string;
  goal: string;
  total: number;
  completed: number;
  current: string;
  percentage: string;
  steps: Array<{
    description: string;
    status: StepStatus;
    result?: any;
  }>;
}

export interface TaskOrchestrationEngine {
  plan(goal: string, context: any): Promise<TaskPlan>;
  execute(plan: TaskPlan): Promise<ExecutionResult>;
  getProgress(planId: string): Promise<Progress>;
  pause(planId: string): Promise<void>;
  resume(planId: string): Promise<void>;
  cancel(planId: string): Promise<void>;
}
