import { EventEmitter } from 'events'; import { TaskStatus } from '../types/task.js'; import { EnhancedError } from '../utils/enhanced-errors.js'; export type WorkflowId = string & { readonly __brand: 'WorkflowId'; }; export type SessionId = string & { readonly __brand: 'SessionId'; }; export type TaskId = string & { readonly __brand: 'TaskId'; }; export type ProjectId = string & { readonly __brand: 'ProjectId'; }; export declare function createWorkflowId(id: string): WorkflowId; export declare function createSessionId(id: string): SessionId; export declare function createTaskId(id: string): TaskId; export declare function createProjectId(id: string): ProjectId; export type Result = { readonly success: true; readonly data: T; } | { readonly success: false; readonly error: E; }; export declare function createSuccess(data: T): Result; export declare function createFailure(error: E): Result; export interface TaskTransition { taskId: string; fromStatus: TaskStatus; toStatus: TaskStatus; timestamp: Date; reason?: string; triggeredBy?: string; metadata?: Record; isAutomated: boolean; } export interface ServiceInstance { name: string; instance: unknown; isStarted: boolean; isDisposed: boolean; startMethod?: string; stopMethod?: string; disposeMethod?: string; resetStaticMethod?: string; } export interface ServiceDependency { service: string; dependsOn: string[]; } export interface WorkflowState { workflowId: WorkflowId; sessionId: SessionId; status: 'initializing' | 'running' | 'paused' | 'completed' | 'failed' | 'cancelled'; phase: 'decomposition' | 'orchestration' | 'execution' | 'monitoring' | 'cleanup'; startTime: Date; endTime?: Date; metadata: Record; tasks: TaskId[]; dependencies: Record; } export type ExecutionStatus = 'queued' | 'running' | 'completed' | 'failed' | 'cancelled' | 'timeout'; export interface TaskExecution { taskId: TaskId; workflowId: WorkflowId; status: ExecutionStatus; startTime: Date; endTime?: Date; actualDuration?: number; result?: { success: boolean; output?: string; error?: string; exitCode?: number; }; metadata: { retryCount: number; timeoutCount: number; lastRetryAt?: Date; executionId: string; }; } export interface UnifiedLifecycleConfig { enableTaskAutomation: boolean; taskTransitionTimeout: number; maxTaskRetries: number; enableStateHistory: boolean; enableDependencyTracking: boolean; serviceStartupTimeout: number; serviceShutdownTimeout: number; enableServiceHealthChecks: boolean; enableWorkflowPersistence: boolean; workflowStateBackupInterval: number; maxWorkflowHistory: number; maxConcurrentExecutions: number; executionTimeout: number; enableExecutionMetrics: boolean; } export declare class UnifiedLifecycleManager extends EventEmitter { private static instance; private config; private taskTransitions; private taskAutomationInterval?; private services; private serviceDependencies; private startupInProgress; private shutdownInProgress; private workflows; private workflowBackupInterval?; private executions; private executionQueue; private runningExecutions; private constructor(); static getInstance(config?: Partial): UnifiedLifecycleManager; static resetInstance(): void; transitionTask(taskId: string, toStatus: TaskStatus, options?: { reason?: string; triggeredBy?: string; metadata?: Record; isAutomated?: boolean; }): Promise>; getTaskTransitions(taskId: string): TaskTransition[]; registerService(config: Omit): void; registerServiceDependency(service: string, dependsOn: string[]): void; startAllServices(): Promise>; private startService; private calculateStartupOrder; createWorkflow(workflowId: WorkflowId, sessionId: SessionId, metadata?: Record): Promise>; updateWorkflowState(workflowId: WorkflowId, updates: Partial>): Promise>; getWorkflowState(workflowId: WorkflowId): WorkflowState | null; private persistWorkflowState; queueTaskExecution(taskId: TaskId, workflowId: WorkflowId, _metadata?: Record): Promise>; private processExecutionQueue; private executeTask; private setupAutomation; private processTaskAutomation; private backupWorkflowStates; dispose(): void; } export declare function getUnifiedLifecycleManager(config?: Partial): UnifiedLifecycleManager; //# sourceMappingURL=unified-lifecycle-manager.d.ts.map