/** * Terminal Orchestration Types */ import { TaskAssignment } from '../balancer/types'; /** * Workflow definition */ export interface Workflow { id: string; name: string; description: string; projectId: string; stages: WorkflowStage[]; variables: Map; triggers: WorkflowTrigger[]; status: WorkflowStatus; createdAt: Date; startedAt?: Date; completedAt?: Date; metadata?: WorkflowMetadata; } /** * Workflow stage */ export interface WorkflowStage { id: string; name: string; type: StageType; tasks: WorkflowTask[]; dependencies: string[]; parallel: boolean; condition?: StageCondition; retryPolicy?: RetryPolicy; timeout?: number; status: StageStatus; } /** * Stage types */ export declare enum StageType { SEQUENTIAL = "sequential", PARALLEL = "parallel", CONDITIONAL = "conditional", LOOP = "loop", MAP = "map", REDUCE = "reduce", FORK = "fork", JOIN = "join" } /** * Stage status */ export declare enum StageStatus { PENDING = "pending", READY = "ready", RUNNING = "running", COMPLETED = "completed", FAILED = "failed", SKIPPED = "skipped", CANCELLED = "cancelled" } /** * Workflow task */ export interface WorkflowTask { id: string; name: string; description: string; type: TaskType; terminalSelector?: TerminalSelector; input?: TaskInput; output?: TaskOutput; dependencies: string[]; requiredCapabilities: string[]; estimatedDuration: number; timeout?: number; retryPolicy?: RetryPolicy; status: TaskStatus; } /** * Task types */ export declare enum TaskType { EXECUTE = "execute",// Execute a command or script QUERY = "query",// Query context or data UPDATE = "update",// Update context WAIT = "wait",// Wait for condition NOTIFY = "notify",// Send notification APPROVE = "approve",// Wait for approval TRANSFORM = "transform",// Transform data AGGREGATE = "aggregate",// Aggregate results VALIDATE = "validate" } /** * Task status */ export declare enum TaskStatus { PENDING = "pending", ASSIGNED = "assigned", RUNNING = "running", COMPLETED = "completed", FAILED = "failed", TIMEOUT = "timeout", CANCELLED = "cancelled" } /** * Workflow status */ export declare enum WorkflowStatus { DRAFT = "draft", READY = "ready", RUNNING = "running", PAUSED = "paused", COMPLETED = "completed", FAILED = "failed", CANCELLED = "cancelled" } /** * Terminal selector */ export interface TerminalSelector { strategy: SelectionStrategy; capabilities?: string[]; terminalIds?: string[]; tags?: string[]; minPerformance?: number; preferredTerminal?: string; } /** * Selection strategy */ export declare enum SelectionStrategy { ANY = "any",// Any available terminal SPECIFIC = "specific",// Specific terminal(s) CAPABILITY = "capability",// By capability match PERFORMANCE = "performance",// Best performing LOAD_BALANCED = "load_balanced",// Load balanced STICKY = "sticky" } /** * Task input */ export interface TaskInput { type: InputType; source: InputSource; value?: any; key?: string; transform?: string; } /** * Input types */ export declare enum InputType { STATIC = "static", VARIABLE = "variable", CONTEXT = "context", PREVIOUS = "previous", AGGREGATE = "aggregate" } /** * Input source */ export interface InputSource { type: 'task' | 'stage' | 'workflow' | 'context'; id?: string; path?: string; } /** * Task output */ export interface TaskOutput { type: OutputType; destination: OutputDestination; key?: string; transform?: string; } /** * Output types */ export declare enum OutputType { VARIABLE = "variable", CONTEXT = "context", FILE = "file", STREAM = "stream", EVENT = "event" } /** * Output destination */ export interface OutputDestination { type: 'variable' | 'context' | 'file' | 'stream'; name?: string; path?: string; scope?: string; } /** * Stage condition */ export interface StageCondition { type: ConditionType; expression: string; variables?: string[]; } /** * Condition types */ export declare enum ConditionType { EXPRESSION = "expression", ALL_SUCCESS = "all_success", ANY_SUCCESS = "any_success", ALL_COMPLETE = "all_complete", CUSTOM = "custom" } /** * Retry policy */ export interface RetryPolicy { maxAttempts: number; delay: number; backoffMultiplier: number; maxDelay: number; retryableErrors?: string[]; } /** * Workflow trigger */ export interface WorkflowTrigger { id: string; type: TriggerType; enabled: boolean; condition?: string; schedule?: string; event?: string; webhook?: string; } /** * Trigger types */ export declare enum TriggerType { MANUAL = "manual", SCHEDULE = "schedule", EVENT = "event", WEBHOOK = "webhook", COMPLETION = "completion" } /** * Workflow metadata */ export interface WorkflowMetadata { author: string; version: string; tags: string[]; category: string; priority: number; estimatedDuration: number; maxParallelTasks: number; requiresApproval: boolean; } /** * Orchestration session */ export interface OrchestrationSession { id: string; workflowId: string; projectId: string; status: SessionStatus; currentStage?: string; executionPlan: ExecutionPlan; assignments: Map; results: Map; context: Map; startedAt: Date; updatedAt: Date; completedAt?: Date; error?: Error; logs: LogEntry[]; metrics: SessionMetrics; } /** * Session status */ export declare enum SessionStatus { INITIALIZING = "initializing", PLANNING = "planning", EXECUTING = "executing", MONITORING = "monitoring", COMPLETING = "completing", COMPLETED = "completed", FAILED = "failed", CANCELLED = "cancelled" } /** * Execution plan */ export interface ExecutionPlan { stages: PlannedStage[]; estimatedDuration: number; requiredTerminals: number; requiredCapabilities: string[]; parallelismLevel: number; criticalPath: string[]; } /** * Planned stage */ export interface PlannedStage { stageId: string; order: number; tasks: PlannedTask[]; dependencies: string[]; canRunInParallel: boolean; estimatedDuration: number; } /** * Planned task */ export interface PlannedTask { taskId: string; stageId: string; terminalRequirements: TerminalSelector; dependencies: string[]; estimatedDuration: number; priority: number; } /** * Task result */ export interface TaskResult { taskId: string; stageId: string; terminalId: string; status: TaskStatus; output?: any; error?: Error; duration: number; attempts: number; startedAt: Date; completedAt?: Date; logs: string[]; } /** * Log entry */ export interface LogEntry { timestamp: Date; level: LogLevel; source: string; message: string; data?: any; } /** * Log levels */ export declare enum LogLevel { DEBUG = "debug", INFO = "info", WARN = "warn", ERROR = "error" } /** * Session metrics */ export interface SessionMetrics { totalTasks: number; completedTasks: number; failedTasks: number; averageTaskDuration: number; totalDuration: number; terminalUtilization: Map; stageMetrics: Map; resourceUsage: ResourceUsage; } /** * Stage metrics */ export interface StageMetrics { duration: number; taskCount: number; successRate: number; retryCount: number; parallelism: number; } /** * Resource usage */ export interface ResourceUsage { totalTokens: number; totalMemory: number; peakMemory: number; networkBandwidth: number; storageUsed: number; } /** * Orchestration event */ export interface OrchestrationEvent { type: EventType; sessionId: string; timestamp: Date; source: string; data: any; } /** * Event types */ export declare enum EventType { SESSION_STARTED = "session_started", SESSION_COMPLETED = "session_completed", SESSION_FAILED = "session_failed", STAGE_STARTED = "stage_started", STAGE_COMPLETED = "stage_completed", STAGE_FAILED = "stage_failed", TASK_ASSIGNED = "task_assigned", TASK_STARTED = "task_started", TASK_COMPLETED = "task_completed", TASK_FAILED = "task_failed", TASK_RETRYING = "task_retrying", TERMINAL_ASSIGNED = "terminal_assigned", TERMINAL_RELEASED = "terminal_released", CHECKPOINT_CREATED = "checkpoint_created", ROLLBACK_INITIATED = "rollback_initiated" } /** * Orchestrator configuration */ export interface OrchestratorConfig { maxConcurrentWorkflows: number; maxConcurrentSessions: number; defaultTimeout: number; checkpointInterval: number; enableAutoRecovery: boolean; enableMetrics: boolean; enableLogging: boolean; logLevel: LogLevel; retryPolicy: RetryPolicy; } //# sourceMappingURL=types.d.ts.map