@sethdouglasford/claude-flow
Version:
Claude Code Flow - Advanced AI-powered development workflows with SPARC methodology
47 lines • 1.81 kB
TypeScript
/**
* Task scheduler implementation
*/
import { Task, CoordinationConfig } from "../utils/types.js";
import { IEventBus } from "../core/event-bus.js";
import { ILogger } from "../core/logger.js";
export interface ScheduledTask {
task: Task;
agentId: string;
attempts: number;
lastAttempt?: Date;
timeout?: NodeJS.Timeout;
}
/**
* Task scheduler for managing task assignment and execution
*/
export declare class TaskScheduler {
protected config: CoordinationConfig;
protected eventBus: IEventBus;
protected logger: ILogger;
protected tasks: Map<string, ScheduledTask>;
protected agentTasks: Map<string, Set<string>>;
protected taskDependencies: Map<string, Set<string>>;
protected completedTasks: Set<string>;
constructor(config: CoordinationConfig, eventBus: IEventBus, logger: ILogger);
initialize(): Promise<void>;
shutdown(): Promise<void>;
assignTask(task: Task, agentId: string): Promise<void>;
completeTask(taskId: string, result: Record<string, unknown>): Promise<void>;
failTask(taskId: string, error: Error): Promise<void>;
cancelTask(taskId: string, reason: string): Promise<void>;
cancelAgentTasks(agentId: string): Promise<void>;
rescheduleAgentTasks(agentId: string): Promise<void>;
getAgentTaskCount(agentId: string): number;
getHealthStatus(): Promise<{
healthy: boolean;
error?: string;
metrics?: Record<string, number>;
}>;
getAgentTasks(agentId: string): Promise<Task[]>;
performMaintenance(): Promise<void>;
protected startTask(taskId: string): void;
protected canStartTask(task: Task): boolean;
protected cancelDependentTasks(taskId: string, reason: string): Promise<void>;
protected cleanup(): void;
}
//# sourceMappingURL=scheduler.d.ts.map