/**
 * Schedule state + persistence helpers for CLI.2.
 *
 * Split out of `schedule.ts` (file-size budget). Five concerns:
 *
 *   1. `readUserSchedules` / `writeUserSchedules` — load + atomically rewrite
 *      `~/.opensquid/schedules.yaml`. Holds USER-ADDED schedules only.
 *      Pack-declared schedules live in pack manifests and are read via
 *      `enumeratePacks` (from CLI.1). The CLI's view is the merged union.
 *   2. `readPausedSet` / `writePausedSet` — `~/.opensquid/schedule_paused.yaml`.
 *      Pause/resume applies to user-added schedules ONLY (pack-declared
 *      schedules are managed via the pack manifest, never the CLI).
 *   3. `appendHistory` / `readHistory` — `~/.opensquid/schedule_history.jsonl`
 *      for force-fire records. Combined with per-session SCHED.4 outcome logs
 *      to produce the `history` view.
 *   4. `readStatusAcrossSessions` — walks `~/.opensquid/sessions/<id>/
 *      scheduling/<scheduleId>.status.json` and returns the most-recent
 *      status sentinel. Defaults to 'probationary' when nothing on disk.
 *   5. `computeNextFire` — minute-by-minute walker over a small pure
 *      5-field POSIX cron matcher. Bounded horizon (30 d) so we never spin
 *      on a pathological expression. node-cron has no public `getNext` —
 *      we ship our own matcher rather than reach into node-cron internals.
 *
 * Schedule id format (user-added): `user:<name>` — `name` is the
 * `<pack>.<skill>.<n>` suffix the CLI generates so two `add` calls with the
 * same (pack, skill) produce distinct ids. Pack-declared schedule ids come
 * from `ScheduleRegistry` (`<pack>::<skill>::<index>`) — we surface them
 * unchanged so audit logs match.
 *
 * Imports from: node:fs/promises, yaml, ../../runtime/paths,
 *   ../../runtime/wedge/schedule_outcome.
 * Imported by: src/setup/cli/schedule.ts + src/setup/cli/schedule_actions.ts.
 */
import { type ScheduleOutcome } from '../../runtime/wedge/schedule_outcome.js';
/** One user-added schedule. Matches pack-declared `schedule` triggers in
 *  shape so the CLI can render them through one row type. */
export interface UserSchedule {
    id: string;
    cron: string;
    pack: string;
    skill: string;
    costTier?: 'cheap' | 'balanced' | 'premium';
    timezone?: string;
    /** ISO 8601 — when the user ran `schedule add`. */
    addedAt: string;
    /** Optional original NL input (audit only — not used by dispatch). */
    nlInput?: string;
}
export type ScheduleStatus = 'probationary' | 'permanent' | 'retired';
export type ScheduleSource = 'pack' | 'user';
export interface ScheduleRow {
    id: string;
    source: ScheduleSource;
    cron: string;
    pack: string;
    skill: string;
    timezone: string;
    costTier?: 'cheap' | 'balanced' | 'premium';
    paused: boolean;
    status: ScheduleStatus;
    nextFireAt: string | null;
}
export interface HistoryEntry {
    scheduleId: string;
    firedAt: string;
    source: 'cron' | 'cli.run' | 'cli.fire';
    resultKind?: 'pass' | 'block' | 'warn' | 'surface' | 'error';
    durationMs?: number;
}
export declare const defaultUserSchedulesPath: () => string;
export declare const defaultPausedPath: () => string;
export declare const defaultHistoryPath: () => string;
export declare const defaultSessionsDir: () => string;
export declare function readUserSchedules(path: string): Promise<UserSchedule[]>;
export declare function writeUserSchedules(path: string, schedules: UserSchedule[]): Promise<void>;
export declare function readPausedSet(path: string): Promise<Set<string>>;
export declare function writePausedSet(path: string, paused: Set<string>): Promise<void>;
export declare function appendHistory(path: string, entry: HistoryEntry): Promise<void>;
/**
 * Read schedule history JSONL entries. T-SIC L11 NOTE: the previous
 * impl used `.map(JSON.parse)` which throws on a malformed line; the
 * shared helper instead skips silently — matches the lenient posture
 * used by `permissions_state.readAuditEntries` and prevents one bad
 * row from breaking `schedule history`.
 */
export declare function readHistory(path: string): Promise<HistoryEntry[]>;
export declare function readStatusAcrossSessions(sessionsDir: string, scheduleId: string): Promise<ScheduleStatus>;
/** Walk all sessions and return SCHED.4 outcome JSONL entries for one
 *  schedule. Used by `schedule history`. */
export declare function readOutcomesAcrossSessions(sessionsDir: string, scheduleId: string): Promise<ScheduleOutcome[]>;
export declare function computeNextFire(cronExpr: string, fromDate: Date, timezone?: string): Date | null;
//# sourceMappingURL=schedule_state.d.ts.map