/**
 * SchedulerTaskAdapter — bridges TaskScheduler scheduled job executions into
 * the unified RuntimeTask registry.
 *
 * Each time a scheduled task fires (i.e. TaskRunRecord is created), a
 * corresponding RuntimeTask of kind 'scheduler' is registered. The adapter
 * tracks runRecord agentId → task ID and handles completion via state sync.
 *
 * NOTE: This adapter writes directly to the Zustand store for performance,
 * bypassing TaskManager. Lifecycle validation is the caller's responsibility.
 * This is intentional — adapters are authoritative sources for their subsystem.
 */
import type { RuntimeStore } from '../../store/index.js';
import type { TaskScheduler, ScheduledTask, TaskRunRecord } from '../../../scheduler/scheduler.js';
/**
 * Bridges TaskScheduler job executions into the RuntimeTask registry.
 *
 * The scheduler runs jobs that spawn agent sessions. Each run is tracked as a
 * RuntimeTask of kind 'scheduler'. The run's agentId is used as the correlation
 * key between the scheduler's TaskRunRecord and the RuntimeTask.
 *
 * @example
 * ```ts
 * const adapter = new SchedulerTaskAdapter(store);
 * // When a scheduled task fires:
 * const taskId = adapter.wrapScheduledRun(record, scheduledTask);
 * // When the run completes:
 * adapter.handleRunComplete(record.agentId, 'completed');
 * ```
 */
export declare class SchedulerTaskAdapter {
    private readonly _store;
    /** Maps run agentId → task ID. */
    private readonly _runToTask;
    /** Maps task ID → run agentId. */
    private readonly _taskToRun;
    private readonly _dispatch;
    constructor(_store: RuntimeStore);
    /**
     * Wrap a scheduled task run as a RuntimeTask.
     *
     * @param record - The TaskRunRecord from the scheduler.
     * @param scheduledTask - The parent ScheduledTask definition.
     * @returns The new task ID.
     */
    wrapScheduledRun(record: TaskRunRecord, scheduledTask: ScheduledTask): string;
    /**
     * Handle a scheduled run completion or failure.
     *
     * @param runAgentId - The agentId from the TaskRunRecord.
     * @param status - Terminal status: 'completed' or 'failed'.
     * @param error - Optional error message if status is 'failed'.
     */
    handleRunComplete(runAgentId: string, status: 'completed' | 'failed', error?: string | undefined): void;
    /**
     * Cancel a scheduled run task by task ID.
     * Marks the task as cancelled. The caller is responsible for disabling the
     * scheduled task via TaskScheduler.setEnabled().
     *
     * @param taskId - The RuntimeTask ID to cancel.
     */
    cancelScheduled(taskId: string): void;
    /**
     * Reconcile adapter state with the current TaskScheduler snapshot.
     *
     * Scans all run history records from the scheduler:
     * - Wraps any un-tracked running jobs as new tasks.
     * - Marks completed/failed jobs that are still showing as running.
     *
     * @param scheduler - The TaskScheduler instance to sync from.
     */
    sync(scheduler: TaskScheduler): void;
    private _upsertTask;
    private _transitionTask;
}
//# sourceMappingURL=scheduler-adapter.d.ts.map