import { type AvailableRelease } from "./latest.js"; import type { BundlePlatformId } from "../packaging/platform.js"; export interface DownloadProgress { /** ما نُزِّل حتى الآن، شاملًا ما كان موجودًا قبل هذه المحاولة. */ received: number; total: number; /** صحيح حين بدأت هذه المحاولة من ملفٍّ جزئيّ سابق. */ resumed: boolean; } export interface DownloadOptions { /** كود التفعيل لمسار ‎/setup/download‎. يُهمَل حين يُعطى ‎source‎. */ code?: string; /** * AR: مصدرٌ صريح (مواصفة 003): رابط تنزيل الحزمة بهويّة الجهاز كما أعاده المركز، برمزه. حين يُعطى لا * يُبنى رابط ‎/setup/download‎ ولا يُرسَل كود. * EN: An explicit source (spec 003): the device-identity bundle download URL the centre returned, * token included. When given, no `/setup/download` URL is built and no code is sent. */ source?: { url: string; headers?: Record; }; release: AvailableRelease; /** * AR: المنصّة المطلوبة. **غيابها يعني منصّة هذه الآلة** — وهو ما يريده كل نداءٍ في الشيفرة؛ * والنوع صار من الجدول فلا تعبر سلسلةٌ مخترَعة إلى عنوان المركز. * EN: The requested platform. **Its absence means this machine's own** — which is what every call * site wants; and the type now comes from the table, so no invented string reaches the * centre's URL. */ platform?: BundlePlatformId; onProgress?: (progress: DownloadProgress) => void; } export declare function partialPathFor(release: AvailableRelease): string; /** * AR: المسار النهائيّ بعد اكتمال التنزيل. **لاحقةٌ صادقة ليست تجميلًا**: ما بعد التنزيل يقرأ * نوعَ المصدر ليقرّر أيفكّه أم ينسخه، وأرشيفٌ اسمه ‎.part‎ يُقرأ مجلدًا فيفشل التثبيت * برسالةٍ تتّهم الحزمة. * EN: The final path once the download completes. **An honest suffix is not cosmetic**: what * follows reads the source's kind to decide between extracting and copying, and an archive * named `.part` reads as a directory, failing the install with a message that blames the bundle. */ export declare function finalPathFor(release: AvailableRelease): string; /** * AR: **وصلةٌ مفتوحة بلا بايتات** (2026-10-14). على شبكات الاستراحات يبقى الاتصال قائمًا والبيانات متوقّفة، وكان * التنزيل بلا مهلة: عند الإقلاع يعني ذلك صفحة صيانةٍ إلى أن يُطفئ أحدٌ الجهاز. **المهلة على الصمت لا على * المدّة**: تنزيلٌ بطيءٌ يتقدّم يكمل ولو طال ساعة، والذي يُقطع هو الاتصال الميت وحده. * EN: **A connection open with no bytes** (2026-10-14). On rest-house links the connection stays up while the * data stops, and the download had no timeout: at boot that meant a maintenance page until someone powered the * machine off. **The timeout is on silence, not duration**: a slow download that keeps moving finishes even if * it takes an hour, and only a dead connection is cut. */ export declare const STALL_TIMEOUT_MS = 60000; /** محاولاتٌ داخل المرّة الواحدة، كلٌّ تستأنف ممّا وصل قبلها. ما بعدها يكمل في المرّة القادمة. */ export declare const DOWNLOAD_ATTEMPTS = 3; export declare class DownloadStalled extends Error { constructor(); } /** * AR: ينزّل إلى ملفٍّ جزئيّ ويعيد مساره. **لا يتحقّق من البصمة**: ذلك عمل ‎updating/verify.ts‎ * القائم منذ P5.4، ونسخةٌ ثانية منه هنا تعني خوارزميتَي تحقّقٍ تتباعدان. * EN: Downloads into a partial file and returns its path. **It does not verify the digest**: that is * `updating/verify.ts`'s job, in place since P5.4, and a second copy here would mean two * verification paths drifting apart. * * AR: بمحاولاتٍ تستأنف. **رفضُ المركز لا يُعاد** (‎CentralRefused‎: رمزٌ منتهٍ، إصدارٌ سُحب، جهازٌ محظور) — * إعادته لا تغيّر جوابه. والانقطاع والصمت يُعادان بعد انتظارٍ قصير، والملفّ الجزئيّ يبقى بينهما. * EN: Downloads with resuming attempts. **A refusal from the centre is not retried** (`CentralRefused`: an * expired token, a withdrawn release, a blocked device) — retrying does not change its answer. A drop or a * silence is retried after a short wait, and the partial file stays between them. */ export declare function downloadBundle(options: DownloadOptions, timing?: { stallMs?: number; attempts?: number; pauseMs?: number; }): Promise; /** يُنادى بعد نجاح التركيب، أو بعد فشل بصمةٍ لا يُصلحه استئناف. */ export declare function discardPartial(release: AvailableRelease): void; //# sourceMappingURL=fetch.d.ts.map