// // PageVisit.swift // Prisme // // Author: Simon-Pierre Boucher // import Foundation import SwiftData /// One remembered page. The semantic history (CLAUDE.md ยง5, P0) is where /// the free local model beats any cloud solution: the volume would be /// unpayable through an API, and sending browsing history off-device is /// unacceptable anyway. Visits from sensitive containers are never /// recorded โ€” not stored-and-filtered, simply never written. @Model final class PageVisit { @Attribute(.unique) var urlString: String var host: String var title: String /// Deterministic one-sentence essence (first sentence of the first /// paragraph) โ€” searchable text, tier `none`. var gist: String var containerID: UUID var visitedAt: Date var visitCount: Int /// Hash of the extracted content at last visit โ€” feeds the future /// temporal diff (P2). var contentHash: String /// BCP-47 code of the page's dominant language, so query vectors are /// only compared with vectors from the same embedding space. var languageCode: String? /// On-device sentence embedding of title + gist. var embedding: [Float]? init( urlString: String, host: String, title: String, gist: String, containerID: UUID, visitedAt: Date, contentHash: String, languageCode: String?, embedding: [Float]? ) { self.urlString = urlString self.host = host self.title = title self.gist = gist self.containerID = containerID self.visitedAt = visitedAt self.visitCount = 1 self.contentHash = contentHash self.languageCode = languageCode self.embedding = embedding } }