/** * The schedule model half of `peaks cron` (Part 14) — moved VERBATIM out of * `cron-commands.ts` (job strict-remediation-abc, slice c1-eslint-family-sweep, * leaf c3w1-cron-commands) so that file clears the 300-line cap and the * `complexity` finding on `readSchedule` falls. * * NOTHING was restructured: same branch order, same predicates, same throw * points, same message text, same on-disk bytes. `readSchedule` was split into * `assertScheduleRoot` + `toScheduleEntry` + `isStringArray` only to shed the * complexity finding; every check still runs in the original order with the * original short-circuits. * * `runTask` (and its exec-timeout + record-truncation constants) deliberately * stays in `cron-commands.ts`: that file carries the baseline `no-magic-numbers` * warning on the timeout constant, and a new sibling must be clean outright. */ export declare const SCHEDULE_VERSION: 1; /** * PRD-002b slice 2 — extract cron-orchestration magic numbers (24h * default interval, 5-minute exec timeout, stderr-message truncation * lengths in the renderer). The exec-timeout constant itself stayed in * `cron-commands.ts` with `runTask`. */ export declare const MS_PER_SECOND = 1000; export declare const MINUTES_PER_HOUR = 60; export declare const SECONDS_PER_MINUTE = 60; export type ScheduleEntry = { readonly id: string; readonly name: string; readonly command: string; readonly args: ReadonlyArray; readonly intervalMs: number; readonly lastRunAt: number | null; readonly enabled: boolean; readonly createdAt: number; }; export type ScheduleFile = { readonly version: typeof SCHEDULE_VERSION; readonly entries: ReadonlyArray; }; export type RunRecord = { readonly id: string; readonly taskId: string; readonly startedAt: number; readonly finishedAt: number; readonly exitCode: number; readonly stderr: string; /** * Present (and `true`) ONLY when the task was killed for exceeding its exec * timeout — i.e. when there is no child exit status behind `exitCode` and the * so a killed run cannot be read as a clean `exitCode 1` failure. * * OPTIONAL on purpose: `appendHistory` is the only writer of * `history.jsonl` and nothing in this repo reads it back, so the smallest * representation that consumers can carry is "the key is absent unless the * task was killed" — every pre-existing row shape is unchanged. */ readonly killed?: true; }; export declare function schedulePath(projectRoot: string): string; export declare function readSchedule(projectRoot: string): ScheduleFile; /** * The one "can this raw JSON entry be represented?" predicate. Exported because * a writer that must NOT lose an entry needs to know which ones the reader * `persistLastRunAt` in `cron-scheduler-persist.ts`). */ export declare function toScheduleEntry(e: unknown): ScheduleEntry | null; /** * The write half's input shape: a version plus the entries to store. * * `entries` is `ReadonlyArray`, not `ReadonlyArray`, for one * caller: `persistLastRunAt` re-writes the raw JSON of entries `toScheduleEntry` * refused, so that a daemon write cannot delete an operator's hand-edited entry * passes a `ScheduleFile`, which satisfies this shape. */ export type ScheduleWrite = { readonly version: typeof SCHEDULE_VERSION; readonly entries: ReadonlyArray; }; export declare function writeSchedule(projectRoot: string, file: ScheduleWrite): void; export declare function appendHistory(projectRoot: string, record: RunRecord): void; export declare function ensureLeaseGcEntry(file: ScheduleFile): ScheduleFile; export declare function listDueTasks(projectRoot: string, now?: number): ReadonlyArray;