vibe-coder-mcp
Version:
Production-ready MCP server with complete agent integration, multi-transport support, and comprehensive development automation tools for AI-assisted workflows.
169 lines • 6.22 kB
TypeScript
import { EventEmitter } from 'events';
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 IdResolutionResult {
readonly workflowId: WorkflowId | null;
readonly sessionId: SessionId | null;
readonly taskId: TaskId | null;
readonly source: 'workflowId' | 'sessionId' | 'taskId' | 'none';
}
export interface IdResolvable {
readonly taskId?: string;
readonly metadata?: Record<string, unknown>;
readonly [key: string]: unknown;
}
export declare function resolveWorkflowId(data: IdResolvable): Result<WorkflowId, string>;
export declare function mapSubtaskToParentWorkflowId(taskId: string): string;
export declare function resolveWorkflowIdWithMapping(data: IdResolvable): Result<WorkflowId, string>;
export declare enum WorkflowPhase {
INITIALIZATION = "initialization",
DECOMPOSITION = "decomposition",
ORCHESTRATION = "orchestration",
EXECUTION = "execution",
COMPLETED = "completed",
FAILED = "failed",
CANCELLED = "cancelled"
}
export declare enum WorkflowState {
PENDING = "pending",
IN_PROGRESS = "in_progress",
COMPLETED = "completed",
FAILED = "failed",
CANCELLED = "cancelled",
BLOCKED = "blocked",
RETRYING = "retrying"
}
export interface WorkflowTransition {
fromPhase: WorkflowPhase;
fromState: WorkflowState;
toPhase: WorkflowPhase;
toState: WorkflowState;
timestamp: Date;
reason?: string;
metadata?: Record<string, unknown>;
triggeredBy?: string;
}
export interface PhaseExecution {
phase: WorkflowPhase;
state: WorkflowState;
startTime: Date;
endTime?: Date;
duration?: number;
progress: number;
error?: string;
metadata: Record<string, unknown>;
retryCount: number;
maxRetries: number;
subPhases?: Map<string, SubPhaseExecution>;
}
export interface SubPhaseExecution {
subPhase: string;
parentPhase: WorkflowPhase;
state: WorkflowState;
startTime: Date;
endTime?: Date;
duration?: number;
progress: number;
weight: number;
order: number;
metadata: Record<string, unknown>;
error?: string;
}
export declare const SUB_PHASES: Record<WorkflowPhase, Array<{
name: string;
weight: number;
order: number;
}>>;
export interface WorkflowStateSnapshot {
workflowId: string;
sessionId: string;
projectId: string;
currentPhase: WorkflowPhase;
currentState: WorkflowState;
overallProgress: number;
startTime: Date;
endTime?: Date;
totalDuration?: number;
phases: Map<WorkflowPhase, PhaseExecution>;
transitions: WorkflowTransition[];
metadata: {
taskCount?: number;
epicCount?: number;
agentCount?: number;
dependencyCount?: number;
[key: string]: unknown;
};
persistedAt: Date;
version: string;
}
export interface WorkflowStateChangeEvent {
workflowId: string;
sessionId: string;
projectId: string;
transition: WorkflowTransition;
snapshot: WorkflowStateSnapshot;
}
export declare class WorkflowStateManager extends EventEmitter {
private static instance;
private workflows;
private persistenceEnabled;
private persistenceDirectory;
private readonly version;
constructor(persistenceDirectory?: string);
static getInstance(persistenceDirectory?: string): WorkflowStateManager;
initializeWorkflow(workflowId: string, sessionId: string, projectId: string, metadata?: Record<string, unknown>): Promise<WorkflowStateSnapshot>;
transitionWorkflow(workflowId: string, toPhase: WorkflowPhase, toState: WorkflowState, options?: {
reason?: string;
metadata?: Record<string, unknown>;
triggeredBy?: string;
progress?: number;
}): Promise<WorkflowStateSnapshot>;
updatePhaseProgress(workflowId: string, phase: WorkflowPhase, progress: number, metadata?: Record<string, unknown>): Promise<void>;
initializeSubPhases(workflowId: string, phase: WorkflowPhase): void;
updateSubPhaseProgress(workflowId: string, phase: WorkflowPhase, subPhase: string, progress: number, state?: WorkflowState, metadata?: Record<string, unknown>): Promise<Result<void, string>>;
private calculatePhaseProgressFromSubPhases;
getSubPhaseStatus(workflowId: string, phase: WorkflowPhase): Map<string, SubPhaseExecution> | null;
startSubPhase(workflowId: string, phase: WorkflowPhase, subPhase: string, metadata?: Record<string, unknown>): Promise<void>;
completeSubPhase(workflowId: string, phase: WorkflowPhase, subPhase: string, metadata?: Record<string, unknown>): Promise<void>;
getWorkflow(workflowId: string): WorkflowStateSnapshot | undefined;
getProjectWorkflows(projectId: string): WorkflowStateSnapshot[];
getSessionWorkflows(sessionId: string): WorkflowStateSnapshot[];
hasWorkflow(workflowId: string): boolean;
hasPhase(workflowId: string, phase: WorkflowPhase): boolean;
private validateTransition;
private calculateOverallProgress;
private persistWorkflow;
loadWorkflow(workflowId: string): Promise<WorkflowStateSnapshot | null>;
cleanupOldWorkflows(olderThanDays?: number): Promise<number>;
getWorkflowStats(): {
total: number;
byPhase: Record<WorkflowPhase, number>;
byState: Record<WorkflowState, number>;
averageDuration: number;
completionRate: number;
};
}
//# sourceMappingURL=workflow-state-manager.d.ts.map