/** * AR: اسم المهمة. **ثابت واحد لأن التسجيل والحذف والاستعلام تكتبه ثلاثتها** — واسمٌ يختلف حرفًا بين * التثبيت والإزالة يترك مهمةً يتيمة تحاول تشغيل مجلد محذوف عند كل إقلاع، إلى الأبد. * EN: The task's name. **One constant because registration, removal and the query all write it** — * and a name differing by a character between install and uninstall leaves an orphan task trying * to launch a deleted folder on every boot, forever. */ export declare const BOOT_TASK_NAME = "Fantastic Supervisor"; export interface BootTaskChange { changed: boolean; detail: string; } /** * AR: ما يشغّله ويندوز عند الإقلاع: شيمة ‎bin\‎، بلا وسائط. * * كانت ‎"...\fantastic.cmd" watch‎ حتى ٠٢٦، حين كانت الشيمة تصل إلى الواجهة الكاملة فتحتاج أن * تُسمّى لها الأمر. وقد خرجت الواجهة من الحزمة، وصارت الشيمة تصل إلى **المُشرِف وحده** — وهو * لا يفعل شيئًا آخر ولا يقرأ وسائط. فكلمةٌ باقيةٌ هنا تُمرَّر إلى ملفٍّ يتجاهلها. * * **ولا تنادي المهمّةُ الواجهةَ العالمية بحال.** ‎npm i -g‎ على ويندوز يكتب في * ‎%AppData%\Roaming\npm‎ الخاصّ بمن نفّذ التثبيت، وهذه المهمّة تعمل بحسابٍ آخر (‎SYSTEM‎ * غالبًا) وقد لا ترى ذلك المجلد أصلًا — بعد انقطاع كهرباء، بلا أحدٍ يقرأ رسالة الفشل. * EN: What Windows runs at boot: the `bin\` shim, with no arguments. * * It was `"...\fantastic.cmd" watch` until 026, when the shim reached the full CLI and therefore * had to be told which command to run. The CLI has left the bundle, and the shim now reaches * **the supervisor alone** — which does nothing else and reads no arguments. A leftover word * here would be forwarded to a file that ignores it. * * **And the task never calls the global CLI.** `npm i -g` on Windows writes into * `%AppData%\Roaming\npm` belonging to whoever ran the install, while this task runs as another * account (usually `SYSTEM`) that may not see that folder at all — after a power cut, with * nobody there to read the failure. */ export declare function bootTaskCommand(root: string): string; /** * AR: هل المهمة مسجَّلة **ومُفعَّلة**؟ الشرطان معًا: مهمة موجودة ومعطَّلة تجتاز ‎/Query‎ ولا تعمل * أبدًا — وهي أسوأ من الغياب، لأنها تُعلن استعدادًا كاذبًا فتُتيح إطفاء الآلة. * EN: Is the task registered **and enabled**? Both conditions: a present-but-disabled task passes * `/Query` and never runs — which is worse than absence, because it announces a false readiness * and so unlocks switching the machine off. */ export declare function isBootTaskInstalled(): Promise; /** * AR: يسجّل المهمة (أو يستبدلها بـ‎/F‎ فيكون التثبيت فوق تثبيت آمن التكرار). الفشل **لا يُفشل * التثبيت**: النظام يعمل تمامًا، وما فات هو العودة التلقائية بعد انقطاع كهرباء — يُعلَن سطرًا * ويُعرَض في ‎doctor‎، ولا يُمحى تثبيت سليم من أجله. * EN: Registers the task (or replaces it with `/F`, so reinstalling over an install is idempotent). * A failure **does not fail the install**: the system runs perfectly, and what was lost is the * automatic return after a power cut — announced in a line and surfaced by `doctor`, not a * reason to erase a sound installation. */ export declare function registerBootTask(root: string): Promise; /** يزيل المهمة. ما يكتبه التثبيت تُزيله الإزالة، وإلّا بقيت مهمة تحاول تشغيل مجلد محذوف. */ export declare function removeBootTask(): Promise; /** اسم الوحدة. ثابتٌ واحد للسبب نفسه الذي وحّد اسم المهمّة على ويندوز. */ export declare const BOOT_UNIT_NAME = "fantastic-supervisor.service"; /** * AR: نصّ الوحدة. **‎Restart=always‎ لا ‎on-failure‎**: المُشرِف يخرج بصفر حين يُطلَب منه التوقّف * أثناء تحديث، ووحدةٌ تستسلم عند خروجٍ نظيف كانت ستترك الجهاز صامتًا بعد كل تحديث. * و‎After=network.target‎ لأن النواة تربط على ‎0.0.0.0‎. * EN: The unit text. **`Restart=always`, not `on-failure`**: the supervisor exits zero when asked to * stop during an update, and a unit that gives up on a clean exit would leave the appliance * silent after every update. `After=network.target` because the core binds `0.0.0.0`. */ export declare function bootUnitContent(root: string): string; /** * AR: **يُسكِت الإقلاع التلقائيّ أثناء تبديل الشجرة، ويعيده بعده.** * * التحديث يوقف الخدمات ثم يعيد تسمية كل مجلد أعلى المستوى — ‎runtime‎ و‎core‎ و‎supervisor‎ * نفسه — ويضع الجديد مكانه. ومُشرِفٌ حيٌّ أثناء ذلك يرى خدماته توقّفت فيعيد تشغيلها، من * شجرةٍ نصفها القديم ونصفها الجديد. * * **وهذا الخطر ليس واحدًا على المنصّتين.** مهمّة ويندوز ‎ONSTART‎: إن خرج المُشرِف لم * يُعِده شيء حتى الإقلاع التالي. أمّا ‎Restart=always‎ في وحدة systemd — وهي الصواب على * جهازٍ لا إنسان عنده — فتعيده بعد خمس ثوانٍ **كلّما** خرج، ومنه خروجٌ سبّبه التحديث حين * أُعيدت تسمية الشجرة تحته. فيقلع مُشرِفٌ جديد في منتصف التبديل. * * فتُوقَف الوحدة قبل التبديل وتُستأنف بعده. وعلى ويندوز لا شيء يُفعَل: المهمّة لا تعيد * الإطلاق أصلًا، فلا شيء تُسكِته. * * **والاستئناف يقع في ‎finally‎ عند المُنادي**، فتحديثٌ فشل لا يترك الجهاز بلا إقلاعٍ * تلقائيّ — وهو أسوأ ما يمكن أن يخلّفه تحديث: جهازٌ يعمل الآن ولا يعود بعد انقطاع الكهرباء * القادم، بلا أن يلاحظ أحد. * EN: **Silences automatic boot supervision while the tree is swapped, and restores it after.** * * An update stops the services, then renames every top-level directory aside — `runtime`, * `core`, and `supervisor` itself — and moves the new one into place. A supervisor alive through * that sees its services stop and starts them again, from a tree half old and half new. * * **And the hazard is not the same on both platforms.** The Windows task is `ONSTART`: if the * supervisor exits, nothing brings it back until the next boot. But `Restart=always` in a * systemd unit — which is right for an appliance with nobody present — brings it back five * seconds after **any** exit, including one the update caused by renaming the tree beneath it. * So a fresh supervisor starts in the middle of the swap. * * The unit is therefore stopped before the swap and resumed after it. On Windows nothing is * done: the task never relaunches, so there is nothing to silence. * * **And the resume belongs in the caller's `finally`**, so a failed update does not leave the * appliance with no automatic boot — the worst thing an update could leave behind: a machine * that works now and does not come back after the next power cut, with nobody noticing. */ export declare function pauseBootSupervision(): Promise; /** * AR: **هل هذه العمليّة داخل مجموعة ‎fantastic-supervisor.service‎؟** (2026-10-18) * * زرّ التحديث في اللوحة: النواة تُطلق المُحدِّث بـ‎setsid‎، و‎setsid‎ لا يُخرج عمليّةً من مجموعة * ‎cgroup‎ الوحدة. فإيقاف الوحدة (‎pauseBootSupervision‎) يرسل ‎SIGTERM‎ إلى كل ما فيها — والمُحدِّث * منها — فيموت بين التحقّق والإيقاف بلا تراجع، ويبقى الجهاز مطفأً. فمُحدِّثٌ داخل المجموعة يُعامَل * كتحديث المُشرِف نفسه: لا تُوقَف الوحدة، والمراقب لا يُحيي شيئًا والشجرة مشغولة. * EN: **Is this process inside the `fantastic-supervisor.service` cgroup?** (2026-10-18) * * The dashboard's update button: the core launches the updater with `setsid`, and `setsid` does not * take a process out of the unit's cgroup. Stopping the unit (`pauseBootSupervision`) then sends * `SIGTERM` to everything in it — the updater included — which dies between verifying and stopping, * with no rollback, and the appliance stays down. So an updater inside the cgroup is treated like the * supervisor's own update: the unit is not stopped, and the monitor revives nothing while the tree is busy. */ export declare function runsInsideBootUnit(cgroup?: string): boolean; /** يستأنف ما أوقفه ‎pauseBootSupervision‎. يُنادى في ‎finally‎، ونجاحُه يُعاد ليُعلَن. */ export declare function resumeBootSupervision(): Promise; //# sourceMappingURL=boot-task.d.ts.map