/**
 * @fileoverview Task queue for managing Claude prompts and operations
 *
 * Provides a priority queue for tasks with:
 * - Priority-based ordering (higher priority first)
 * - Dependency tracking between tasks
 * - State persistence via StateStore
 * - Session assignment for task execution
 *
 * @module task-queue
 */
import { EventEmitter } from 'node:events';
import { Task, CreateTaskOptions } from './task.js';
/**
 * Events emitted by TaskQueue
 */
/**
 * Priority queue for managing tasks with dependency support.
 *
 * @description
 * Tasks are ordered by priority (descending) then creation time (ascending).
 * Dependencies can be specified to ensure tasks run in correct order.
 *
 * @extends EventEmitter
 */
export declare class TaskQueue extends EventEmitter {
    private tasks;
    private store;
    /** Creates a new TaskQueue and loads persisted tasks. */
    constructor();
    private loadFromStore;
    /**
     * Adds a new task to the queue.
     * @throws Error if the task's dependencies would create a circular dependency
     */
    addTask(options: CreateTaskOptions): Task;
    /** Gets a task by ID. */
    getTask(id: string): Task | undefined;
    /** Removes a task by ID. Returns true if removed. */
    removeTask(id: string): boolean;
    /** Updates a task and persists the change. */
    updateTask(task: Task): void;
    /** Gets all tasks in the queue. */
    getAllTasks(): Task[];
    /** Gets pending tasks sorted by priority then creation time. */
    getPendingTasks(): Task[];
    /** Gets tasks currently being executed. */
    getRunningTasks(): Task[];
    /** Gets successfully completed tasks. */
    getCompletedTasks(): Task[];
    /** Gets tasks that failed execution. */
    getFailedTasks(): Task[];
    /** Returns true if there's a task ready for execution. */
    hasNext(): boolean;
    /** Gets the next task ready for execution (with satisfied dependencies). */
    getNextAvailable(): Task | null;
    /** Alias for getNextAvailable(). */
    next(): Task | null;
    private areDependenciesSatisfied;
    /**
     * Detect if adding a dependency would create a cycle.
     * Uses DFS to check if there's a path from depId back to taskId.
     *
     * @param taskId - The task that would have the new dependency
     * @param depId - The dependency being added
     * @param visited - Set of already visited nodes (for DFS)
     * @returns true if adding this dependency would create a cycle
     */
    private wouldCreateCycle;
    /**
     * Validates that a set of dependencies won't create cycles for a given task.
     * Throws an error if a circular dependency is detected.
     *
     * @param taskId - The task ID that will have these dependencies
     * @param dependencies - Array of dependency task IDs to validate
     * @throws Error if a circular dependency would be created
     */
    private validateDependencies;
    /** Gets all tasks assigned to a specific session. */
    getTasksBySession(sessionId: string): Task[];
    /** Gets the currently running task for a session, if any. */
    getRunningTaskForSession(sessionId: string): Task | null;
    /** Gets counts of tasks by status (single-pass). */
    getCount(): {
        total: number;
        pending: number;
        running: number;
        completed: number;
        failed: number;
    };
    /** Removes all completed tasks. Returns count removed. */
    clearCompleted(): number;
    /** Removes all failed tasks. Returns count removed. */
    clearFailed(): number;
    /** Removes all tasks from the queue. Returns count removed. */
    clearAll(): number;
}
/** Gets or creates the singleton TaskQueue instance. */
export declare function getTaskQueue(): TaskQueue;
//# sourceMappingURL=task-queue.d.ts.map