/** * Task scheduler — cron-driven recurring/one-shot prompts. * * Backs the `/loop` command and the Cron* tools. Tasks are matched against a * standard 5-field cron expression (minute hour day-of-month month day-of-week) * in local time and fired by re-submitting their prompt as a user message. * Firing is idle-gated so a task never interrupts an in-flight turn; a task due * while the agent is busy is picked up on a later tick within the same minute. * * Recurring tasks persist; one-shot tasks delete themselves after firing. */ export interface ScheduledTask { id: string; /** 5-field cron expression in local time. */ cron: string; /** Prompt re-submitted on each fire. */ prompt: string; /** Recurring (fire on every match) vs one-shot (fire once, then delete). */ recurring: boolean; createdAt: number; /** Minute-bucket key of the last fire, to avoid double-firing within a minute. */ lastRunMinute?: number; } /** True when `date` matches the 5-field cron expression. Invalid expressions never match. */ export declare function matchesCron(expr: string, date: Date): boolean; export interface TaskSchedulerOptions { /** Path to the durable JSON store (written on every mutation). */ storePath: string; /** * Legacy store path read only when {@link storePath} does not yet exist, so * tasks scheduled under an older location migrate forward on first persist. */ legacyStorePath?: string; /** Submit a due task's prompt (e.g. via sendUserMessage). */ fire: (prompt: string) => void; /** Whether the agent is idle; tasks only fire when true. Defaults to always-idle. */ isIdle?: () => boolean; /** Tick interval in ms. Defaults to 30s. */ intervalMs?: number; } export declare class TaskScheduler { private tasks; private timer; private readonly opts; constructor(opts: TaskSchedulerOptions); /** Load persisted tasks from disk (best-effort). Falls back to the legacy * store path when the primary one does not exist yet. */ load(): void; private persist; /** Begin the tick loop. Safe to call once. */ start(): void; stop(): void; create(input: { cron: string; prompt: string; recurring?: boolean; }): ScheduledTask; list(): ScheduledTask[]; delete(id: string): boolean; clear(): void; /** Evaluate all tasks against `now` and fire those that are due (when idle). */ tick(now: Date): void; } //# sourceMappingURL=scheduler.d.ts.map