/** * Task Scheduler * Schedule tasks for future execution with notifications */ export interface ScheduledTask { id: string; task: string; schedule: ScheduleSpec; chatId: string; enabled: boolean; created: string; lastRun?: string; nextRun?: string; runCount: number; } export type ScheduleSpec = { type: 'once'; at: string; } | { type: 'delay'; ms: number; } | { type: 'cron'; pattern: string; } | { type: 'interval'; ms: number; }; export type NotifyCallback = (chatId: string, message: string) => Promise; export declare class TaskScheduler { private tasks; private activeTimers; private notifyCallback?; private taskExecutor?; private dataPath; constructor(dataPath?: string); /** * Set the notification callback for sending messages */ setNotifyCallback(callback: NotifyCallback): void; /** * Set the task executor callback */ setTaskExecutor(executor: (task: string, chatId: string) => Promise): void; /** * Parse natural language schedule */ parseSchedule(when: string): ScheduleSpec | null; /** * Schedule a task */ schedule(task: string, when: string | ScheduleSpec, chatId: string): string; /** * Calculate next run time */ private calculateNextRun; /** * Activate a task's timer */ private activateTask; /** * Deactivate a task's timer */ private deactivateTask; /** * Cancel a task */ cancel(taskId: string): boolean; /** * Pause a task */ pause(taskId: string): boolean; /** * Resume a task */ resume(taskId: string): boolean; /** * List all tasks */ list(): ScheduledTask[]; /** * Get a specific task */ get(taskId: string): ScheduledTask | undefined; /** * Format schedule for display */ formatSchedule(schedule: ScheduleSpec): string; /** * Save tasks to disk */ private saveTasks; /** * Load tasks from disk */ private loadTasks; /** * Stop all timers (for shutdown) */ shutdown(): void; }