import type { Intent, ID, IntentStatus } from '../common/types.js';
/**
 * Queue item with processing metadata
 */
export interface QueueItem {
    intent: Intent;
    priority: number;
    addedAt: number;
    attempts: number;
    lastAttemptAt?: number;
    error?: string;
}
/**
 * Queue processing result
 */
export interface ProcessResult {
    intentId: ID;
    success: boolean;
    status: IntentStatus;
    error?: string;
    processingTimeMs: number;
}
/**
 * Queue configuration
 */
export interface QueueConfig {
    maxConcurrent: number;
    maxRetries: number;
    retryDelayMs: number;
    processingTimeoutMs: number;
}
/**
 * Intent processor function type
 */
export type IntentProcessor = (intent: Intent) => Promise<{
    status: IntentStatus;
    error?: string;
}>;
/**
 * Intent Queue - Singleton
 *
 * Ensures only one queue instance processes intents.
 * Prevents race conditions and duplicate processing.
 */
export declare class IntentQueue {
    private static instance;
    private static initializingPromise;
    private config;
    private queue;
    private processing;
    private processor;
    private isRunning;
    private processLoopPromise;
    private stats;
    private constructor();
    /**
     * Get the singleton instance
     */
    static getInstance(config?: Partial<QueueConfig>): IntentQueue;
    /**
     * Initialize the singleton instance asynchronously
     * Ensures thread-safe initialization
     */
    static initialize(config?: Partial<QueueConfig>): Promise<IntentQueue>;
    /**
     * Reset the singleton (for testing)
     */
    static reset(): void;
    /**
     * Set the intent processor
     */
    setProcessor(processor: IntentProcessor): void;
    /**
     * Enqueue an intent for processing
     */
    enqueue(intent: Intent, priority?: number): Promise<void>;
    /**
     * Start the queue processing loop
     */
    start(): void;
    /**
     * Stop the queue processing
     */
    stop(): void;
    /**
     * Main processing loop
     */
    private processLoop;
    /**
     * Get next items to process sorted by priority
     */
    private getNextItems;
    /**
     * Process a single queue item
     */
    private processItem;
    /**
     * Execute with timeout
     */
    private withTimeout;
    /**
     * Sleep helper
     */
    private sleep;
    /**
     * Get queue statistics
     */
    getStats(): {
        queueSize: number;
        processingCount: number;
        enqueued: number;
        processed: number;
        succeeded: number;
        failed: number;
        retried: number;
    };
    /**
     * Check if an intent is in the queue or processing
     */
    isQueued(intentId: ID): boolean;
    /**
     * Get queue item status
     */
    getItemStatus(intentId: ID): 'queued' | 'processing' | 'not_found';
    /**
     * Remove an intent from the queue (if not processing)
     */
    remove(intentId: ID): boolean;
    /**
     * Clear all queued items (not processing)
     */
    clear(): number;
}
/**
 * Get the singleton queue instance
 */
export declare function getIntentQueue(config?: Partial<QueueConfig>): IntentQueue;
/**
 * Initialize the queue singleton
 */
export declare function initializeIntentQueue(config?: Partial<QueueConfig>): Promise<IntentQueue>;
//# sourceMappingURL=queue.d.ts.map