import type { RestartScheduleFile } from "../contracts/core.js"; import type { Profile } from "../profiles/types.js"; export declare const DEFAULT_UPDATE_AT_HOUR = 4; export declare const DEFAULT_UPDATE_WINDOW_HOURS = 3; /** بين محاولتين لفحصٍ فائت تعذّر فيه الوصول إلى خادم التحديث. */ export declare const CATCH_UP_RETRY_MS: number; export interface WindowSettings { atHour: number; hours: number; } /** الإعداد من مرآة الجدول، بافتراضاتٍ لملفٍّ أقدم بلا الحقلين أو بلا ملفّ أصلًا. */ export declare function windowSettings(schedule: RestartScheduleFile | null): WindowSettings; /** * AR: حدود النافذة التي تحتوي ‎now‎ بالتوقيت المحلّي، أو ‎null‎ خارجها. **دالّة خالصة**. نافذةٌ تعبر * منتصف الليل (23:00 لثلاث ساعات) تُحسب من أمس. * EN: The bounds of the window containing `now` in local time, or `null` outside it. **A pure * function.** A window crossing midnight (23:00 for three hours) is counted from yesterday. */ export declare function windowAt(now: number, settings: WindowSettings): { start: number; end: number; } | null; export interface UpdateWindowOptions { /** سببُ التأجيل (مشاهد، بثّ مباشر، تنزيل) أو ‎null‎. */ deferIf: () => Promise; /** الفحص والتثبيت — ‎updateBeforeBoot(profile, "window")‎ في المشرِف. ‎"unreachable"‎ يُبقي الفحص فائتاً. */ run: () => Promise<{ outcome: string; } | void>; onEvent?: (message: string) => void; /** يُحقَن في الاختبار. الافتراض: مرآة الجدول من مجلد الحالة. */ readSchedule?: () => RestartScheduleFile | null; } export type WindowRound = "outside" | "done" | "waiting" | "deferred" | "ran"; /** * AR: يقرّر في كل جولة: أنحن في النافذة؟ أفُحص فيها؟ أنؤجّل؟ لا مؤقّت ولا ساعة داخله — الزمن يُمرَّر. * EN: Decides on each round: are we in the window? was it already checked? do we defer? No timer and no * clock inside — time is passed in. */ export declare class UpdateWindow { private readonly profile; private readonly options; /** بداية آخر نافذةٍ فُحص فيها — فحصٌ واحد لكل نافذة. */ private handledWindow; private nextAttemptAt; private deferredInWindow; /** فحصٌ فائت ينتظر الاستدراك، وموعد محاولته التالية. */ private missed; private catchUpAt; private deferredCatchUp; constructor(profile: Profile, options: UpdateWindowOptions); /** * يُعلَّم فحص النافذة الجارية منجزًا — المشرِف أقلع داخلها وفحص عند الإقلاع للتوّ، فلا فحص ثانٍ. */ markChecked(now?: number): void; /** فحصٌ فات (تعذّر الوصول عند الإقلاع أو في النافذة) ← يُستدرَك بعد ‎delayMs‎. */ markMissed(now?: number, delayMs?: number): void; round(now?: number): Promise; /** استدراك الفحص الفائت: نفس الفحص ونفس التأجيل، في أيّ ساعة. */ private catchUp; private check; private readSchedule; } //# sourceMappingURL=update-window.d.ts.map