/** * Agentic QE v3 - Base Worker Implementation * ADR-014: Background Workers for QE Monitoring * * Abstract base class for all QE background workers. * Provides common functionality for scheduling, retries, and health tracking. */ import { Worker, WorkerConfig, WorkerStatus, WorkerResult, WorkerContext, WorkerHealth, WorkerMetrics, WorkerFinding, WorkerRecommendation } from './interfaces'; /** * Abstract base class for QE background workers */ export declare abstract class BaseWorker implements Worker { readonly config: WorkerConfig; protected _status: WorkerStatus; protected _lastResult?: WorkerResult; protected _lastRunAt?: Date; protected _nextRunAt?: Date; protected _totalExecutions: number; protected _successfulExecutions: number; protected _failedExecutions: number; protected _executionDurations: number[]; protected _recentResults: Array<{ timestamp: Date; success: boolean; durationMs: number; }>; constructor(config: WorkerConfig); get status(): WorkerStatus; get lastResult(): WorkerResult | undefined; get lastRunAt(): Date | undefined; get nextRunAt(): Date | undefined; /** * Initialize the worker * Override in subclasses for custom initialization */ initialize(): Promise; /** * Execute the worker's main task with retry logic */ execute(context: WorkerContext): Promise; /** * Abstract method - implement in subclasses * Contains the actual worker logic */ protected abstract doExecute(context: WorkerContext): Promise; /** * Pause the worker */ pause(): void; /** * Resume the worker */ resume(): void; /** * Stop the worker */ stop(): Promise; /** * Get worker health status */ getHealth(): WorkerHealth; /** * Execute a function with timeout */ protected executeWithTimeout(fn: () => Promise, timeoutMs: number, signal: AbortSignal): Promise; /** * Create an error result */ protected createErrorResult(error: Error, durationMs: number): WorkerResult; /** * Create a successful result */ protected createResult(durationMs: number, metrics: WorkerMetrics, findings: WorkerFinding[], recommendations: WorkerRecommendation[]): WorkerResult; /** * Delay helper */ protected delay(ms: number): Promise; /** * Generate a unique ID */ protected generateId(): string; } //# sourceMappingURL=base-worker.d.ts.map