/** * Schedule persistence store using SQLite * * Stores cron job definitions and execution logs in SQLite database. * Supports server restart recovery and execution history tracking. */ import type { SQLiteDatabase } from '../sqlite.js'; /** * Persisted schedule (cron job) definition */ export interface Schedule { id: string; name: string; cron_expr: string; prompt: string; enabled: boolean; last_run: number | null; next_run: number | null; created_at: number; } /** * Schedule execution log entry */ export interface ScheduleLog { id: string; schedule_id: string; started_at: number; finished_at: number | null; status: 'running' | 'success' | 'failed'; output: string | null; error: string | null; } /** * Input for creating a new schedule */ export type CreateScheduleInput = Omit; /** * Input for updating a schedule */ export type UpdateScheduleInput = Partial>; /** * SQLite-backed store for schedules and execution logs */ export declare class ScheduleStore { private db; constructor(db: SQLiteDatabase); /** * Run database migration to create tables */ private runMigration; /** * Create a new schedule */ createJob(input: CreateScheduleInput): string; /** * Get a schedule by ID */ getJob(id: string): Schedule | null; /** * List all schedules */ listJobs(): Schedule[]; /** * List only enabled schedules */ listEnabledJobs(): Schedule[]; /** * Update a schedule */ updateJob(id: string, updates: UpdateScheduleInput): boolean; /** * Delete a schedule (cascade deletes logs) */ deleteJob(id: string): boolean; /** * Log the start of a schedule execution */ logStart(scheduleId: string): string; /** * Log the finish of a schedule execution */ logFinish(logId: string, status: 'success' | 'failed', output?: string, error?: string): boolean; /** * Get execution logs for a schedule */ getLogs(scheduleId: string, limit?: number, offset?: number): ScheduleLog[]; /** * Get the last execution for a schedule */ getLastExecution(scheduleId: string): ScheduleLog | null; /** * Get the last execution across all schedules (for heartbeat status) */ getLastExecutionGlobal(): ScheduleLog | null; /** * Get a specific log entry by ID */ getLog(logId: string): ScheduleLog | null; /** * Convert database row to Schedule object */ private rowToSchedule; /** * Convert database row to ScheduleLog object */ private rowToLog; /** * Close the database connection */ close(): void; } //# sourceMappingURL=schedule-store.d.ts.map