SPB Git

spb/zyquo-atlas Public License

The AI-native macOS web browser — every surface, intelligent.

Swift 75.2% JavaScript 22% Shell 2% Makefile 0.9%
1.6 KB · 48 lines swift
Raw Blame History
1//2//  AppEnvironment.swift3//  Zyquo Atlas4//5//  Author: Simon-Pierre Boucher6//  Mail: contact@spboucher.ai7//8//  App-wide shared services injected into the view tree: the model catalog9//  (all Zyquo Cloud models) and the encrypted key vault. Held once at the app10//  root so every window/tab shares one catalog and one vault.11//1213import Foundation14import SwiftUI1516@MainActor17final class AppEnvironment: ObservableObject {18    let catalog = ModelCatalog()19    let vault = KeyVaultStore()20    let bookmarks = BookmarksService()21    let history = HistoryService()2223    /// The user's default browsing model (recommended-first from the catalog).24    var defaultModel: AIModel? { catalog.defaultModel }2526    /// Resolves the model for an action class, honoring per-action overrides.27    func model(for action: AIActionClass) -> AIModel? {28        if let id = actionModelIDs[action],29           let m = catalog.all.first(where: { $0.id == id }) { return m }30        switch action {31        case .fast:32            return catalog.builtIn.first { !$0.isLegacy && !$0.capabilities.reasoning } ?? defaultModel33        case .standard, .deep:34            return defaultModel35        }36    }3738    /// Per-action-class default model overrides (fast hovers vs deep chat).39    @Published var actionModelIDs: [AIActionClass: String] = [:]40}4142/// Model tiers for per-action default selection (docs/AI-BROWSER-RESEARCH.md §3).43enum AIActionClass: String, Codable, CaseIterable {44    case fast      // hover/auto summaries — cheap & quick45    case standard  // summarize, translate, selection actions46    case deep      // chat-with-page, multi-tab reasoning47}48