import { type EvoPaths } from "./paths.ts"; export interface QuietHours { start: string; end: string; } export interface ScheduledImproveConfig { quietHours: QuietHours | null; inactivityMinutes: number; dailyRunLimit: number; everyDays: number; lockStaleMs: number; } export interface ScheduledImproveConfigInput { quietHours?: Partial | null; inactivityMinutes?: number; dailyRunLimit?: number; everyDays?: number; lockStaleMs?: number; } export declare const DEFAULT_SCHEDULED_IMPROVE_CONFIG: Readonly; export type EvoScheduleMode = "auto" | "manual"; export interface EvoScheduleConfig { schemaVersion: 1; mode: EvoScheduleMode; everyDays: number; quietHours: QuietHours | null; inactivityMinutes: number; dailyRunLimit: number; trialDueAfterDays: number; trialDueAfterSessions: number; } export interface EvoScheduleConfigInput { mode?: EvoScheduleMode; everyDays?: number; quietHours?: QuietHours | null; inactivityMinutes?: number; dailyRunLimit?: number; trialDueAfterDays?: number; trialDueAfterSessions?: number; } export declare const DEFAULT_EVO_SCHEDULE_CONFIG: Readonly; export interface ImproveRunStartedEvent { schemaVersion: 1; type: "started"; runId: string; timestamp: string; localDay: string; } export interface ImproveRunCompletedEvent { schemaVersion: 1; type: "completed"; runId: string; timestamp: string; localDay: string; } export interface ImproveRunFailedEvent { schemaVersion: 1; type: "failed"; runId: string; timestamp: string; localDay: string; error: string; } export type ImproveRunEvent = ImproveRunStartedEvent | ImproveRunCompletedEvent | ImproveRunFailedEvent; export type ScheduledImproveSkipReason = "already-running" | "paused" | "manual-mode" | "outside-quiet-hours" | "interval-not-elapsed" | "recent-session-activity" | "daily-limit-reached"; export type ScheduledImproveResult = { status: "completed"; runId: string; value: T; } | { status: "skipped"; reason: ScheduledImproveSkipReason; lastActivityAt?: string; nextEligibleDay?: string; }; export interface RunScheduledImproveOptions { paths: EvoPaths; improve: (signal: AbortSignal) => Promise; config?: ScheduledImproveConfigInput; now?: () => Date; excludeSessionIds?: readonly string[]; createOwnerToken?: () => string; afterLockPrepared?: () => void | Promise; } export declare function isWithinQuietHours(date: Date, quietHours: QuietHours): boolean; export declare function localDay(date: Date): string; export declare function addLocalDays(day: string, days: number): string; export declare function latestCompletedImproveDay(events: readonly ImproveRunEvent[]): string | undefined; export declare function getImproveRunsPath(paths: EvoPaths): string; export declare function getImproveLockPath(paths: EvoPaths): string; export declare function readImproveRunEvents(paths: EvoPaths): Promise; export declare function runScheduledImprove(options: RunScheduledImproveOptions): Promise>; export declare function getScheduleConfigPath(paths: EvoPaths): string; export declare function readScheduleConfig(paths: EvoPaths): Promise; export declare function writeScheduleConfig(paths: EvoPaths, input: EvoScheduleConfigInput): Promise; export declare function parseScheduleCadence(value: string): EvoScheduleConfigInput | undefined; export interface RunConfiguredImproveOptions { paths: EvoPaths; improve: (signal: AbortSignal) => Promise; now?: () => Date; excludeSessionIds?: readonly string[]; createOwnerToken?: () => string; } export declare function runConfiguredImprove(options: RunConfiguredImproveOptions): Promise>; export interface EvoScheduleStatus { config: EvoScheduleConfig; lastCompletedAt?: string; lastCompletedDay?: string; nextEligibleDay?: string; runsToday: number; } export declare function getScheduleStatus(paths: EvoPaths, now?: () => Date): Promise; //# sourceMappingURL=scheduler.d.ts.map