// // PersonaStore.swift // Zyquo Local // // Author: Simon-Pierre Boucher // Mail: contact@spboucher.ai // import Foundation import Observation /// User personas: system prompt + preferred model + params. @MainActor @Observable final class PersonaStore { var personas: [Persona] { didSet { PersistenceService.saveDocument(personas, named: "personas") } } init() { personas = PersistenceService.loadDocument([Persona].self, named: "personas") ?? Self.builtIns } func add(_ persona: Persona) { personas.append(persona) } func remove(id: UUID) { personas.removeAll { $0.id == id } } func update(_ persona: Persona) { if let i = personas.firstIndex(where: { $0.id == persona.id }) { personas[i] = persona } } private static let builtIns: [Persona] = [ Persona( name: "Helpful Assistant", systemPrompt: "You are a helpful, concise assistant. Answer directly; use short paragraphs and lists when they aid clarity." ), Persona( name: "Code Reviewer", systemPrompt: "You are a rigorous senior engineer. Review code for correctness, clarity, performance and idiomatic style. Point at concrete lines, propose fixes, and keep praise brief.", params: GenerationParams(temperature: 0.3) ), Persona( name: "Technical Writer", systemPrompt: "You are a precise technical writer. Produce clear, well-structured prose with correct terminology, no filler, and consistent formatting.", params: GenerationParams(temperature: 0.5) ), Persona( name: "Socratic Tutor", systemPrompt: "You are a patient tutor. Guide with questions before revealing answers, adapt to the learner's level, and verify understanding with small checks." ), ] }