/**
 * TaskManager — Main orchestrator for scheduled and self-running tasks.
 *
 * Manages the full task lifecycle: create, schedule, execute, pause, resume, delete.
 * Auto-selects TaskStore and TaskBackend based on config.
 *
 * Usage:
 *   const neurolink = new NeuroLink({ tasks: { backend: "bullmq" } });
 *   await neurolink.tasks.create({ name: "monitor", prompt: "...", schedule: { type: "interval", every: 60000 } });
 */
import { type NeuroLinkExecutable, type Task, type TaskDefinition, type TaskManagerConfig, type TaskRunResult, type TaskStatus } from "../types/index.js";
export declare class TaskManager {
    private neurolink;
    private config;
    private store;
    private backend;
    private executor;
    private initialized;
    private initPromise;
    /** In-memory callback registry (not serializable to store) */
    private callbacks;
    /** Emitter reference — set by NeuroLink on integration */
    private emitter?;
    constructor(neurolink: NeuroLinkExecutable, config?: TaskManagerConfig);
    /** Set the event emitter (called by NeuroLink during integration) */
    setEmitter(emitter: {
        emit(event: string, ...args: unknown[]): boolean;
    }): void;
    private ensureInitialized;
    private doInitialize;
    private getStore;
    private getBackend;
    private getExecutor;
    create(definition: TaskDefinition): Promise<Task>;
    get(taskId: string): Promise<Task | null>;
    list(filter?: {
        status?: TaskStatus;
    }): Promise<Task[]>;
    update(taskId: string, updates: Partial<TaskDefinition>): Promise<Task>;
    /** Run a task immediately (outside of its schedule) */
    run(taskId: string): Promise<TaskRunResult>;
    pause(taskId: string): Promise<Task>;
    resume(taskId: string): Promise<Task>;
    delete(taskId: string): Promise<void>;
    runs(taskId: string, options?: {
        limit?: number;
        status?: string;
    }): Promise<TaskRunResult[]>;
    shutdown(): Promise<void>;
    /** Check if the backend is healthy */
    isHealthy(): Promise<boolean>;
    private restoreScheduledTask;
    private rollbackTaskUpdate;
    /**
     * Called by the backend on each scheduled tick.
     * Executes the task, updates state, fires callbacks/events.
     */
    private onTaskTick;
    /**
     * Re-schedule all active tasks from store.
     * Called on initialization to handle process restarts.
     */
    private rescheduleActiveTasks;
    private emit;
}
