remcode
Version:
Turn your AI assistant into a codebase expert. Intelligent code analysis, semantic search, and software engineering guidance through MCP integration.
113 lines (112 loc) • 3 kB
TypeScript
import { NotificationConfig } from '../notifications/service';
export interface OrchestrationConfig {
repository: {
owner: string;
repo: string;
};
monitoring: {
healthCheckInterval?: number;
enableAutoRetry?: boolean;
maxRetryAttempts?: number;
retryDelayMinutes?: number;
};
notifications?: NotificationConfig;
automation: {
enableAutoHealing?: boolean;
enablePerformanceOptimization?: boolean;
enableProactiveMonitoring?: boolean;
};
}
export interface OrchestrationStatus {
isActive: boolean;
lastHealthCheck?: string;
nextHealthCheck?: string;
totalWorkflowsMonitored: number;
healthStatus: 'healthy' | 'warning' | 'critical';
automationActions: Array<{
timestamp: string;
action: string;
reason: string;
success: boolean;
}>;
}
/**
* Orchestrates end-to-end workflow automation including monitoring,
* health checks, notifications, and auto-healing
*/
export declare class WorkflowOrchestrator {
private config;
private monitor;
private notifications?;
private stateManager;
private healthCheckTimer?;
private isActive;
private automationActions;
constructor(config: OrchestrationConfig, githubToken?: string);
/**
* Start the orchestration service
*/
start(): Promise<void>;
/**
* Stop the orchestration service
*/
stop(): Promise<void>;
/**
* Get current orchestration status
*/
getStatus(): OrchestrationStatus;
/**
* Perform comprehensive health check
*/
private performHealthCheck;
/**
* Handle unhealthy workflow scenarios
*/
private handleUnhealthyWorkflow;
/**
* Attempt automatic retry of failed workflows
*/
private attemptAutoRetry;
/**
* Attempt auto-healing actions
*/
private attemptAutoHealing;
/**
* Generate healing actions based on health issues
*/
private generateHealingActions;
/**
* Set up proactive monitoring
*/
private setupProactiveMonitoring;
/**
* Count consecutive failures from recent runs
*/
private countConsecutiveFailures;
/**
* Determine overall health status
*/
private determineOverallHealth;
/**
* Log automation action
*/
private logAutomationAction;
/**
* Handle workflow completion notification
*/
handleWorkflowCompletion(runId: number, status: 'success' | 'failure', duration: number, stats?: any): Promise<void>;
}
/**
* Factory function to create orchestrator with common configurations
*/
export declare function createWorkflowOrchestrator(repository: {
owner: string;
repo: string;
}, options?: {
githubToken?: string;
enableNotifications?: boolean;
slackWebhook?: string;
healthCheckMinutes?: number;
enableAutoRetry?: boolean;
enableAutoHealing?: boolean;
}): WorkflowOrchestrator;