/** * Leaper Agent – Cron Job Manager * * Persistent cron job storage, schedule parsing, and next-run computation. * Translates Python cron/jobs.py. */ export type ScheduleKind = 'once' | 'interval' | 'cron'; export interface Schedule { kind: ScheduleKind; /** For 'once': ISO timestamp */ runAt?: string; /** For 'interval': minutes */ minutes?: number; /** For 'cron': cron expression */ expr?: string; } export interface CronJobConfig { name: string; task: string; schedule: string; skills?: string[]; enabled?: boolean; maxRuns?: number; metadata?: Record; } export interface CronJob { id: string; name: string; task: string; schedule: Schedule; skills: string[]; enabled: boolean; maxRuns: number; runCount: number; lastRun?: string; nextRun?: string; createdAt: string; updatedAt: string; metadata: Record; } /** * Parse a duration string like "30m", "2h", "1d" into minutes. * Throws if the string cannot be parsed. */ export declare function parseDuration(s: string): number; /** * Parse a schedule string into a typed Schedule object. * * Examples: * "every 30m" → {kind:'interval', minutes:30} * "every 2h" → {kind:'interval', minutes:120} * "0 9 * * *" → {kind:'cron', expr:'0 9 * * *'} * "2026-02-03T14:00" → {kind:'once', runAt:'2026-02-03T14:00:00.000Z'} * "30m" (no 'every') → {kind:'once', runAt: now+30min} */ export declare function parseSchedule(s: string): Schedule; /** * Compute the next run time for a schedule. * Returns null if the schedule has already passed (for 'once') or is unsupported. */ export declare function computeNextRun(schedule: Schedule, fromDate?: Date): Date | null; export declare class CronJobManager { private jobsFile; private jobs; constructor(jobsFile: string); /** Load jobs from disk. */ load(): Promise; /** Save jobs to disk. */ save(): Promise; /** Create a new job. */ createJob(config: CronJobConfig): Promise; /** Get a job by id. */ getJob(id: string): CronJob | undefined; /** List all jobs. */ listJobs(): CronJob[]; /** Update a job. */ updateJob(id: string, updates: Partial): Promise; /** Delete a job. */ deleteJob(id: string): Promise; /** Pause a job (set enabled=false). */ pauseJob(id: string): Promise; /** Resume a job (set enabled=true). */ resumeJob(id: string): Promise; /** Compute next run time from schedule (delegates to module-level function). */ computeNextRun(schedule: Schedule, fromDate?: Date): Date | null; /** Get jobs that are due to run now. */ getDueJobs(now?: Date): CronJob[]; /** Mark job as run: update lastRun, runCount, nextRun. */ markJobRun(id: string): Promise; } //# sourceMappingURL=jobs.d.ts.map