import type { SessionJanitor } from "../orchestrator/janitor.js"; import { type CronServiceDeps } from "./service/state.js"; import type { CronJob, CronJobCreate, CronJobPatch } from "./types.js"; export { JANITOR_JOB_ID, createJanitorCronJob, executeJanitorJob } from "./janitor-job.js"; export type { CronEvent, CronServiceDeps } from "./service/state.js"; export declare class CronService { private readonly state; constructor(deps: CronServiceDeps); start(): Promise; stop(): void; status(): Promise<{ enabled: boolean; storePath: string; jobs: number; nextWakeAtMs: number | null; }>; list(opts?: { includeDisabled?: boolean; }): Promise; add(input: CronJobCreate): Promise; update(id: string, patch: CronJobPatch): Promise; remove(id: string): Promise<{ readonly ok: false; readonly removed: false; } | { readonly ok: true; readonly removed: boolean; }>; run(id: string, mode?: "due" | "force"): Promise<{ ok: boolean; ran: boolean; reason: "already-running"; readonly jobId?: undefined; readonly startedAt?: undefined; readonly executionJob?: undefined; } | { ok: boolean; ran: boolean; reason: "not-due"; readonly jobId?: undefined; readonly startedAt?: undefined; readonly executionJob?: undefined; } | { readonly ok: false; readonly ran?: undefined; } | { readonly ok: true; readonly ran: true; }>; getJob(id: string): CronJob | undefined; wake(opts: { mode: "now" | "next-heartbeat"; text: string; }): { readonly ok: false; } | { readonly ok: true; }; /** * Register the janitor job for nightly session context resets. * Creates the job if it doesn't exist, or updates if schedule changed. */ registerJanitorJob(janitor: SessionJanitor, options?: { schedule?: CronJobCreate["schedule"]; enabled?: boolean; }): Promise<{ registered: boolean; updated: boolean; jobId: string; }>; }