vibe-coder-mcp
Version:
Production-ready MCP server with complete agent integration, multi-transport support, and comprehensive development automation tools for AI-assisted workflows.
143 lines • 5.14 kB
TypeScript
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<T, E = Error> = {
readonly success: true;
readonly data: T;
} | {
readonly success: false;
readonly error: E;
};
export declare function createSuccess<T, E = Error>(data: T): Result<T, E>;
export declare function createFailure<E>(error: E): Result<never, E>;
export interface TaskTransition {
taskId: string;
fromStatus: TaskStatus;
toStatus: TaskStatus;
timestamp: Date;
reason?: string;
triggeredBy?: string;
metadata?: Record<string, unknown>;
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<string, unknown>;
tasks: TaskId[];
dependencies: Record<string, string[]>;
}
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<UnifiedLifecycleConfig>): UnifiedLifecycleManager;
static resetInstance(): void;
transitionTask(taskId: string, toStatus: TaskStatus, options?: {
reason?: string;
triggeredBy?: string;
metadata?: Record<string, unknown>;
isAutomated?: boolean;
}): Promise<Result<TaskTransition, EnhancedError>>;
getTaskTransitions(taskId: string): TaskTransition[];
registerService(config: Omit<ServiceInstance, 'isStarted' | 'isDisposed'>): void;
registerServiceDependency(service: string, dependsOn: string[]): void;
startAllServices(): Promise<Result<void, EnhancedError>>;
private startService;
private calculateStartupOrder;
createWorkflow(workflowId: WorkflowId, sessionId: SessionId, metadata?: Record<string, unknown>): Promise<Result<WorkflowState, EnhancedError>>;
updateWorkflowState(workflowId: WorkflowId, updates: Partial<Omit<WorkflowState, 'workflowId'>>): Promise<Result<WorkflowState, EnhancedError>>;
getWorkflowState(workflowId: WorkflowId): WorkflowState | null;
private persistWorkflowState;
queueTaskExecution(taskId: TaskId, workflowId: WorkflowId, _metadata?: Record<string, unknown>): Promise<Result<TaskExecution, EnhancedError>>;
private processExecutionQueue;
private executeTask;
private setupAutomation;
private processTaskAutomation;
private backupWorkflowStates;
dispose(): void;
}
export declare function getUnifiedLifecycleManager(config?: Partial<UnifiedLifecycleConfig>): UnifiedLifecycleManager;
//# sourceMappingURL=unified-lifecycle-manager.d.ts.map