SPB Git

spb/prisme Public MIT

Navigateur iOS intelligent — chaque page comprise localement avant d'être affichée. SwiftUI · WebKit · Foundation Models, 100% on-device.

Swift 96.7% JavaScript 3.3%
2.3 KB · 85 lines swift
Raw Blame History
1//2//  LibraryModels.swift3//  Prisme4//5//  Author: Simon-Pierre Boucher <contact@spboucher.ai>6//78import Foundation9import SwiftData1011/// A saved passage — most of the time you don't want the page, you want12/// the paragraph (CLAUDE.md §5, "L'extrait", P0). Stored with its source,13/// date and section context; the DOM path anchors it back in the page.14@Model15final class Excerpt {16    var text: String17    var sourceURLString: String18    var sourceTitle: String19    var sourceHost: String20    var sectionTitle: String?21    var domPath: String?22    var containerID: UUID23    var savedAt: Date2425    init(26        text: String,27        sourceURLString: String,28        sourceTitle: String,29        sourceHost: String,30        sectionTitle: String?,31        domPath: String?,32        containerID: UUID33    ) {34        self.text = text35        self.sourceURLString = sourceURLString36        self.sourceTitle = sourceTitle37        self.sourceHost = sourceHost38        self.sectionTitle = sectionTitle39        self.domPath = domPath40        self.containerID = containerID41        self.savedAt = Date()42    }43}4445/// A page saved as native data, freed from its layout ("Le favori46/// structuré", P0). Enriched by the digest when the model delivered one;47/// deterministic (title, lead sentence, headings) otherwise. Not a rotting48/// URL pointer: the structure is the favourite.49@Model50final class StructuredFavorite {51    @Attribute(.unique) var urlString: String52    var host: String53    var title: String54    var gist: String55    /// PageKind raw value when a digest classified the page.56    var kindRaw: String?57    var outlineTitles: [String]58    /// True when gist/outline came from the local model — drives the59    /// distinct "generated" treatment (§7).60    var isGenerated: Bool61    var containerID: UUID62    var savedAt: Date6364    init(65        urlString: String,66        host: String,67        title: String,68        gist: String,69        kindRaw: String?,70        outlineTitles: [String],71        isGenerated: Bool,72        containerID: UUID73    ) {74        self.urlString = urlString75        self.host = host76        self.title = title77        self.gist = gist78        self.kindRaw = kindRaw79        self.outlineTitles = outlineTitles80        self.isGenerated = isGenerated81        self.containerID = containerID82        self.savedAt = Date()83    }84}85