spb/poche Public
Agent personnel 100 % on-device — SwiftUI + Apple Foundation Models + EventKit + SwiftData. Aucune API, aucun serveur.
Swift 100%
1//2// PocheIntents.swift3// Poche4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7//89import AppIntents10import SwiftData1112// App Intents let Raccourcis and Siri reach Poche (CLAUDE.md §4). These13// writes are user-initiated — the person explicitly runs the shortcut, which14// IS the confirmation. The Confirm layer guards the *model's* proposals; no15// model is involved here, and no EventKit bridge is exposed this way.1617struct SaveNoteIntent: AppIntent {18 static let title: LocalizedStringResource = "Ajouter une note à Poche"19 static let description = IntentDescription("Enregistre une note dans Poche, entièrement en local.")2021 @Parameter(title: "Titre")22 var noteTitle: String2324 @Parameter(title: "Contenu")25 var content: String2627 @MainActor28 func perform() async throws -> some IntentResult & ProvidesDialog {29 let store = PocheStore(container: PocheContainer.shared)30 store.addNote(title: String(noteTitle.prefix(80)), content: String(content.prefix(2000)))31 return .result(dialog: "Note « \(noteTitle) » enregistrée dans Poche.")32 }33}3435struct CreateTaskIntent: AppIntent {36 static let title: LocalizedStringResource = "Ajouter une tâche à Poche"37 static let description = IntentDescription("Crée une tâche dans Poche, entièrement en local.")3839 @Parameter(title: "Titre")40 var taskTitle: String4142 @MainActor43 func perform() async throws -> some IntentResult & ProvidesDialog {44 let store = PocheStore(container: PocheContainer.shared)45 store.addTask(title: String(taskTitle.prefix(80)), details: nil, due: nil)46 return .result(dialog: "Tâche « \(taskTitle) » créée dans Poche.")47 }48}4950struct PocheShortcuts: AppShortcutsProvider {51 static var appShortcuts: [AppShortcut] {52 AppShortcut(53 intent: SaveNoteIntent(),54 phrases: ["Ajoute une note dans \(.applicationName)"],55 shortTitle: "Nouvelle note",56 systemImageName: "note.text"57 )58 AppShortcut(59 intent: CreateTaskIntent(),60 phrases: ["Ajoute une tâche dans \(.applicationName)"],61 shortTitle: "Nouvelle tâche",62 systemImageName: "checklist"63 )64 }65}66