import type { Reminder, ReminderProvenance, ReminderStatus } from '../../shared/reminder.js'; import { ReminderStore } from '../storage/schema/reminder.store.js'; import type { ReminderPreflightLastResult } from '../../shared/reminder.js'; import { type ReminderActivityRecorder } from './reminder.activity.js'; /** Snapshot fields re-checked inside the JsonStore update critical section. */ export interface ReminderExpectedVersion { nextDueAt?: string; preflight?: Reminder['preflight']; status: ReminderStatus; updatedAt: string; } export interface ReminderTransitionResult { applied: boolean; reminder: Reminder; } export declare function matchesExpectedVersion(live: Reminder, expected: ReminderExpectedVersion): boolean; export interface ScheduleReminderInput { delaySeconds?: number; fireAt?: string; instructions: string; now?: Date; /** Optional shell gate; product label "Run only when". CWD is always Agent Home. */ preflight?: { command: string; timeoutMs?: number; }; provenance?: ReminderProvenance; repeat?: string; timezone?: string; title: string; /** Local weekday+time window; only valid with every:* intervals. */ window?: string; } export declare class ReminderService { private readonly agentId; private readonly store; private readonly activity; constructor(agentId: string, store?: ReminderStore, activity?: ReminderActivityRecorder); scheduleReminder(input: ScheduleReminderInput): Promise; cancelReminder(input: { id: string; now?: Date; }): Promise; snoozeReminder(input: { by: string; id: string; now?: Date; }): Promise; /** * Count a real agent wake and advance schedule. Call only after a wake is * durably enqueued (or for legacy non-preflight after enqueue). * * When `expected` is set, status/updatedAt/nextDueAt/preflight are checked * inside the same JsonStore update critical section (CAS). Stale → no-op. */ completeReminderFire(input: { id: string; now?: Date; preflightResult?: ReminderPreflightLastResult; clearPreflightError?: boolean; /** Snapshot version that must still match at commit time. */ expected?: ReminderExpectedVersion; }): Promise; /** * Persist a preflight check that did **not** wake the agent: advance schedule * and last-result without incrementing firedCount / lastFiredAt. * * When `expected` is set, CAS runs inside the same store update as the write. */ recordPreflightCheck(input: { id: string; now?: Date; preflightResult: ReminderPreflightLastResult; clearPreflightError?: boolean; setPreflightError?: { attentionKey: string; since: string; lastNotifiedAt?: string; }; expected?: ReminderExpectedVersion; }): Promise; private recordPreflightActivity; private advanceSchedule; recordReminderFire(input: { firedAt?: Date; reminder: Reminder; }): Promise; listReminders(input?: { statuses?: ReminderStatus[]; }): Promise; listAllReminders(): Promise; findReminder(reminderId: string): Promise; dueReminders(input?: { now?: Date; }): Promise; private pruneOldSettled; } export declare function reminderServiceForAgent(agentId: string): ReminderService; //# sourceMappingURL=reminder.service.d.ts.map