import { EventEmitter } from 'events';
export type TaskStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
export type TaskPriority = 'low' | 'normal' | 'high';
export interface BackgroundTask {
    id: string;
    prompt: string;
    status: TaskStatus;
    priority: TaskPriority;
    createdAt: Date;
    startedAt?: Date;
    completedAt?: Date;
    result?: TaskResult;
    workingDirectory: string;
    model?: string;
    maxToolRounds?: number;
    tags?: string[];
    /** Events to notify on */
    notifyOn?: ('completed' | 'failed')[];
    /** Channel to notify (e.g., "telegram:chat-123") */
    notifyChannel?: string;
}
export interface TaskResult {
    success: boolean;
    output?: string;
    error?: string;
    filesModified?: string[];
    duration?: number;
}
export interface TaskListOptions {
    status?: TaskStatus;
    limit?: number;
    includeCompleted?: boolean;
}
/**
 * Background Tasks Manager - Inspired by Codex CLI Cloud
 * Allows running AI tasks in the background
 */
export declare class BackgroundTaskManager extends EventEmitter {
    private tasks;
    private runningProcesses;
    private tasksDir;
    private maxConcurrent;
    constructor(maxConcurrent?: number);
    /**
     * Send notification for task events via configured channel
     */
    private notifyTaskEvent;
    /**
     * Ensure tasks directory exists
     */
    private ensureTasksDir;
    /**
     * Load existing tasks from disk
     */
    private loadTasks;
    /**
     * Save task to disk
     */
    private saveTask;
    /**
     * Delete task from disk
     */
    private deleteTaskFile;
    /**
     * Generate unique task ID
     */
    private generateId;
    /**
     * Create a new background task
     */
    createTask(prompt: string, options?: {
        priority?: TaskPriority;
        workingDirectory?: string;
        model?: string;
        maxToolRounds?: number;
        tags?: string[];
        runImmediately?: boolean;
    }): BackgroundTask;
    /**
     * Run a task in background
     */
    runTask(taskId: string): Promise<void>;
    /**
     * Cancel a running task
     */
    cancelTask(taskId: string): boolean;
    /**
     * Get a task by ID
     */
    getTask(taskId: string): BackgroundTask | undefined;
    /**
     * Get all tasks
     */
    getTasks(options?: TaskListOptions): BackgroundTask[];
    /**
     * Delete a task
     */
    deleteTask(taskId: string): boolean;
    /**
     * Clear completed tasks
     */
    clearCompleted(): number;
    /**
     * Retry a failed task
     */
    retryTask(taskId: string): BackgroundTask | null;
    /**
     * Get task statistics
     */
    getStats(): {
        total: number;
        pending: number;
        running: number;
        completed: number;
        failed: number;
        cancelled: number;
    };
    /**
     * Format task for display
     */
    formatTask(task: BackgroundTask): string;
    /**
     * Format tasks list for display
     */
    formatTasksList(options?: TaskListOptions): string;
    /**
     * Clean up resources
     */
    dispose(): void;
}
export declare function getBackgroundTaskManager(maxConcurrent?: number): BackgroundTaskManager;
export declare function resetBackgroundTaskManager(): void;
