/** * File Organizer MCP Server v3.4.2 * Auto-Organize Scheduler Service * * Smart scheduling with cron-based per-directory configuration. * Supports min_file_age filtering and batch limits. * Includes smart catchup for missed schedules. */ import { FileScannerService } from "./file-scanner.service.js"; import { OrganizerService } from "./organizer.service.js"; import { type UserConfig } from "../config.js"; import { SchedulerStateService } from "./scheduler-state.service.js"; export type ConfigLoader = () => UserConfig; /** * Auto-Organize Scheduler Service * Manages cron-based scheduled tasks for multiple directories */ export declare class AutoOrganizeService { private scanner; private organizer; private configLoader; private tasks; private runningDirectories; private stateService; private missedSchedulesLock; constructor(scanner?: FileScannerService, organizer?: OrganizerService, configLoader?: () => UserConfig, stateService?: SchedulerStateService); /** * Initialize the scheduler state service * Must be called before using smart catchup features */ initialize(): Promise; /** * Start the auto-organize scheduler * Loads watch list from config and creates cron tasks * @returns Result object with success status, task count, and any errors */ start(): Promise<{ success: boolean; taskCount: number; errors: string[]; }>; /** * Stop all scheduled tasks */ stop(): void; /** * Reload tasks from config (useful when config changes) * @returns Result object with task count and any errors encountered */ reloadTasks(): { taskCount: number; errors: string[]; }; /** * Check if scheduler is currently running */ isActive(): boolean; /** * Get the number of active tasks */ getTaskCount(): number; /** * Get list of watched directories */ getWatchedDirectories(): string[]; /** * Run organization for a specific watch config * Manages runningDirectories Set to prevent concurrent execution for same directory * @param watch - Watch configuration containing directory and rules * @see startAutoOrganizeScheduler() - For starting all scheduled tasks * @see triggerNow() - For manually triggering a single directory * @see getStatus() - For checking runningDirectories state * @returns Promise */ private runOrganization; /** * Filter files by minimum age */ private filterByAge; /** * Convert legacy schedule ('hourly' | 'daily' | 'weekly') to cron expression */ private legacyScheduleToCron; /** * Get scheduler status for monitoring */ getStatus(): { active: boolean; taskCount: number; watchedDirectories: string[]; runningDirectories: string[]; }; /** * Manually trigger organization for a directory */ triggerNow(directory: string): Promise; /** * Check if a watch should be included in catchup checks * Returns true if the watch has auto_organize enabled */ private shouldIncludeInCatchupCheck; /** * Determine if a directory should run on startup based on catchup_mode and smart logic * @param watch - The watch configuration * @param lastRunTime - The last successful run time (null if never ran) * @returns true if catchup should run */ private shouldRunOnStartup; /** * Run missed schedules for all configured watches on startup * Uses smart catchup logic based on catchup_mode setting * Does not block server startup - runs in background with concurrency control */ runMissedSchedules(): Promise; private _runMissedSchedulesInternal; } /** * Initialize and start the global auto-organize scheduler * @returns Result object with success status, task count, and any errors */ export declare function startAutoOrganizeScheduler(): Promise<{ success: boolean; taskCount: number; errors: string[]; }>; /** * Stop the global auto-organize scheduler */ export declare function stopAutoOrganizeScheduler(): void; /** * Reload the global scheduler tasks */ export declare function reloadAutoOrganizeScheduler(): void; /** * Get the global scheduler instance */ export declare function getAutoOrganizeScheduler(): AutoOrganizeService | null; //# sourceMappingURL=auto-organize.service.d.ts.map