SPB Git

spb/zyquo-local Public MIT

Native macOS AI chat that runs LLMs 100% locally on Apple Silicon with MLX — no cloud, no API keys.

Swift 97.2% Shell 1.8% Makefile 1%
1.3 KB · 50 lines swift
Raw Blame History
1//2//  DownloadTask.swift3//  Zyquo Local4//5//  Author: Simon-Pierre Boucher6//  Mail: contact@spboucher.ai7//89import Foundation1011/// State of one model download managed by `DownloadManager` (Phase 3).12struct DownloadTask: Identifiable, Codable, Hashable, Sendable {13    enum State: String, Codable, Sendable {14        case queued15        case downloading16        case paused17        case verifying18        case completed19        case failed20        case cancelled21    }2223    /// Progress of a single file inside the download.24    struct FileProgress: Codable, Hashable, Sendable {25        var path: String26        var totalBytes: Int6427        var receivedBytes: Int6428        /// LFS sha256 (from x-linked-etag) when available, for integrity checks.29        var sha256: String?30        var completed: Bool31    }3233    var repoID: String34    var state: State35    var files: [FileProgress]36    var errorDescription: String?37    var startedAt: Date3839    var id: String { repoID }4041    var totalBytes: Int64 { files.reduce(0) { $0 + $1.totalBytes } }42    var receivedBytes: Int64 { files.reduce(0) { $0 + $1.receivedBytes } }4344    var fractionCompleted: Double {45        let total = totalBytes46        guard total > 0 else { return 0 }47        return Double(receivedBytes) / Double(total)48    }49}50