/**
 * CronScheduler - Sandbox-safe cron job scheduling service.
 *
 * Provides a pure-JS cron expression parser and timer-free scheduling.
 * The host drives execution by calling tick(now) periodically;
 * the scheduler matches jobs against the current time and fires them.
 *
 * No setInterval, setTimeout, or other Node.js timers are used,
 * making this safe to run inside sandboxed environments.
 */
import type { SharedStateBus } from "./SharedStateBus.js";
export interface CronJob {
    id: string;
    cron: string;
    prompt: string;
    recurring: boolean;
    durable: boolean;
    createdAt: number;
    expiresAt: number;
    lastFiredAt?: number;
    fireCount: number;
}
/**
 * Check whether a Date matches a standard 5-field cron expression.
 *
 * Fields: minute  hour  day-of-month  month  day-of-week
 *
 * Day-of-week uses 0 = Sunday .. 6 = Saturday (7 is also Sunday for
 * compatibility with some cron implementations).
 */
export declare function matchesCron(expression: string, date: Date): boolean;
export declare class CronScheduler {
    private jobs;
    private bus;
    private maxJobs;
    private nextId;
    constructor(options?: {
        maxJobs?: number;
    });
    private generateId;
    /** Wire up the SharedStateBus for event publishing. */
    setBus(bus: SharedStateBus): void;
    /**
     * Create a new cron job.
     *
     * @throws if the expression is invalid or the job limit is reached.
     */
    createJob(opts: {
        cron: string;
        prompt: string;
        recurring?: boolean;
        durable?: boolean;
    }): CronJob;
    /** Delete a job by ID. Returns true if it existed. */
    deleteJob(id: string): boolean;
    /** List all active jobs. */
    listJobs(): CronJob[];
    /** Get a single job by ID. */
    getJob(id: string): CronJob | undefined;
    /**
     * Tick the scheduler forward to `now` (epoch ms).
     *
     * Checks every registered job against the provided timestamp.
     * Returns the list of jobs that fired during this tick.
     *
     * - One-shot jobs are auto-deleted after firing.
     * - Expired recurring jobs are auto-deleted.
     * - A job will not fire more than once per calendar minute
     *   (guards against rapid successive ticks).
     */
    tick(now: number): CronJob[];
    /** Serialize all jobs for persistence. */
    toJSON(): CronJob[];
    /** Restore jobs from a persisted snapshot. */
    loadFromJSON(jobs: CronJob[]): void;
    private publishChange;
    /** Release all resources and clear internal state. */
    dispose(): Promise<void>;
    private publishFired;
}
