/**
 * CI/CD Workflow Monitor
 *
 * Monitors GitHub Actions workflows for failures by polling the GitHub API
 * every 60 seconds. Uses conditional requests and rate limit handling for
 * efficient API usage.
 */
import { StateManager } from './state-manager.js';
import { Logger } from '../../utils/logger.js';
/**
 * Monitor configuration
 */
export interface MonitorConfig {
    /** GitHub API token */
    token: string;
    /** Repository owner */
    owner: string;
    /** Repository name */
    repo: string;
    /** Poll interval (milliseconds, default: 60000 = 60s) */
    pollInterval?: number;
    /** Enable debug logging */
    debug?: boolean;
    /** Logger instance (defaults to consoleLogger) */
    logger?: Logger;
}
/**
 * Poll result
 */
export interface PollResult {
    /** Total runs checked */
    totalRuns: number;
    /** New failures detected */
    newFailures: number;
    /** Failures already tracked */
    duplicates: number;
    /** HTTP status code */
    statusCode: number;
    /** Rate limit remaining */
    rateLimitRemaining: number;
}
/**
 * WorkflowMonitor - Polls GitHub Actions for workflow failures
 *
 * Features:
 * - Polls every 60 seconds (configurable)
 * - Detects failed workflow runs within 2 minutes
 * - Uses conditional requests (If-Modified-Since) to reduce API calls
 * - Handles rate limiting with exponential backoff
 * - Deduplicates failures via StateManager
 * - Extracts comprehensive workflow metadata
 */
export declare class WorkflowMonitor {
    private octokit;
    private stateManager;
    private config;
    private logger;
    private pollingTimer;
    private lastModified;
    private isPolling;
    /**
     * Create workflow monitor
     *
     * @param config - Monitor configuration
     * @param stateManager - State manager instance (optional, creates new if not provided)
     */
    constructor(config: MonitorConfig, stateManager?: StateManager);
    /**
     * Start monitoring (begins polling)
     */
    start(): void;
    /**
     * Stop monitoring (stops polling)
     */
    stop(): void;
    /**
     * Check if monitor is running
     */
    isRunning(): boolean;
    /**
     * Poll GitHub Actions API for workflow runs
     *
     * @returns Poll result with statistics
     */
    poll(): Promise<PollResult>;
    /**
     * Extract failure record from GitHub workflow run
     *
     * @param run - GitHub workflow run data
     * @returns Failure record for state storage
     */
    private extractFailureRecord;
    /**
     * Sleep for specified milliseconds
     */
    private sleep;
    /**
     * Debug logging
     */
    private log;
}
//# sourceMappingURL=workflow-monitor.d.ts.map