SPB Git

spb/zyquo-agent Public MIT

The autonomous agent that actually operates your Mac — plans, runs real commands, verifies its own work.

Swift 94.7% Shell 4.1% Python 0.7% Makefile 0.5%
1.3 KB · 52 lines swift
Raw Blame History
1//2//  PersonaStore.swift3//  Zyquo Agent4//5//  Author: Simon-Pierre Boucher6//  Mail: contact@spboucher.ai7//8//  Personas (Phase 6): system-prompt addition + preferred agent model +9//  default safety mode, persisted to personas.json. A task adopting a10//  persona gets its addendum appended to the agent system prompt on every11//  run (AgentConfiguration.personaAddendum).12//1314import Combine15import Foundation1617@MainActor18final class PersonaStore: ObservableObject {19    static let fileName = "personas.json"2021    @Published private(set) var personas: [Persona] {22        didSet { persistence.save(personas, to: Self.fileName) }23    }2425    private let persistence: PersistenceService2627    init(persistence: PersistenceService = .shared) {28        self.persistence = persistence29        self.personas = persistence.load([Persona].self, from: Self.fileName) ?? []30    }3132    func persona(id: UUID?) -> Persona? {33        guard let id else { return nil }34        return personas.first { $0.id == id }35    }3637    // MARK: - CRUD3839    func add(_ persona: Persona) {40        personas.append(persona)41    }4243    func update(_ persona: Persona) {44        guard let index = personas.firstIndex(where: { $0.id == persona.id }) else { return }45        personas[index] = persona46    }4748    func delete(_ id: Persona.ID) {49        personas.removeAll { $0.id == id }50    }51}52