/** * Cron Scheduler for MAMA Standalone * * Schedules and executes jobs based on cron expressions. * Uses node-cron for scheduling and cron-parser for next run calculation. */ import type { CronJob, JobConfig, JobResult, JobEventHandler, SchedulerOptions } from './types.js'; export declare class CronScheduler { private readonly jobs; private readonly lock; private readonly options; private readonly eventHandlers; private executeCallback?; constructor(options?: SchedulerOptions); /** * Set the execution callback (typically AgentLoop.run) * * @param callback - Function to execute for each job */ setExecuteCallback(callback: (prompt: string, job: CronJob) => Promise): void; /** * Add a job to the scheduler * * @param config - Job configuration * @returns Job ID * @throws SchedulerError if cron expression is invalid or job already exists */ addJob(config: JobConfig): string; /** * Remove a job from the scheduler * * @param jobId - Job identifier * @throws SchedulerError if job not found */ removeJob(jobId: string): void; /** * Enable a job * * @param jobId - Job identifier * @throws SchedulerError if job not found */ enableJob(jobId: string): void; /** * Disable a job * * @param jobId - Job identifier * @throws SchedulerError if job not found */ disableJob(jobId: string): void; /** * Execute a job immediately * * @param jobId - Job identifier * @throws SchedulerError if job not found */ runNow(jobId: string): Promise; /** * Get a job by ID * * @param jobId - Job identifier * @returns Job info (without internal task object) */ getJob(jobId: string): CronJob | null; /** * List all jobs * * @returns Array of job info (without internal task objects) */ listJobs(): CronJob[]; /** * Check if a job is currently running * * @param jobId - Job identifier */ isJobRunning(jobId: string): boolean; /** * Add an event handler * * @param handler - Event handler function */ onEvent(handler: JobEventHandler): void; /** * Calculate next run time for a cron expression * * @param cronExpr - Cron expression * @returns Next run date */ calculateNextRun(cronExpr: string): Date; /** * Stop all jobs and clean up */ shutdown(): void; /** * Execute a job * * @param jobId - Job identifier */ private executeJob; /** * Convert internal job to public job (without task) */ private toPublicJob; /** * Emit an event to all handlers */ private emitEvent; /** * Validate a cron expression * * @param cronExpr - Cron expression to validate * @returns true if valid */ static validate(cronExpr: string): boolean; } //# sourceMappingURL=cron-scheduler.d.ts.map