A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.
Swift ai-agentsanthropicantigravityclaudeclaude-codecodexcursordynamic-islandgemini-cliiosiphonlinuxmacosmacos-appmenubar-appnotchopen-sourceswiftswiftuiwindows
voice: guided email, drop the attachment on the notch, web search, woman/man voice
Claude323d89e81971
diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex 96addfb1..a78b463b 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -62,6 +62,9 @@ jobs:- name: Voice conversation end-phrase testsrun: bash scripts/test-voice-conversation.sh+ - name: Voice gender tests+ run: bash scripts/test-voice-gender.sh+- name: Test terminal targetrun: bash scripts/test-terminal-target.shdiff --git a/NotchBuddy/NotchBuddy.xcodeproj/project.pbxproj b/NotchBuddy/NotchBuddy.xcodeproj/project.pbxprojindex 67891a6c..fd752551 100644--- a/NotchBuddy/NotchBuddy.xcodeproj/project.pbxproj+++ b/NotchBuddy/NotchBuddy.xcodeproj/project.pbxproj@@ -138,6 +138,7 @@6FC65C190ED614C664C9BC17 /* SafeWebURL.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2FDED98F7F6C755A72C97A3 /* SafeWebURL.swift */; };714B5BB7FFB0C8491AF67AD1 /* VoiceTranscriptHistory.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE925A6844FE3E3C09131CE0 /* VoiceTranscriptHistory.swift */; };718410ED630AE3AC5DF59A95 /* VoiceSpeaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD11C7925B0A7831BFC2199C /* VoiceSpeaker.swift */; };+ 9BAD96406059597681D89A92 /* VoiceGenderNames.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16BF6539981E9EEF2397D061 /* VoiceGenderNames.swift */; };71CBD1D39A6668BF454CA1C5 /* IslandTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0365DDE3C554F5E8570055F4 /* IslandTypes.swift */; };724E602A05FE5A6D58218E27 /* CoucouControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C406C508A86E215B3CBE3FC /* CoucouControl.swift */; };725365FA4E184D970E7BB8B4 /* MochiOutfitDrawing.swift in Sources */ = {isa = PBXBuildFile; fileRef = E84E5D91129352E8A1D32AA4 /* MochiOutfitDrawing.swift */; };@@ -309,6 +310,7 @@F6CA56F362902839EF9A3E2E /* PhoneAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 60401D1023D17C3FD30D7113 /* PhoneAssets.xcassets */; };F6D57EEBD7E937EFD2B715CF /* ClaudeHost.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F0D0F67E7C56B9E37E7648 /* ClaudeHost.swift */; };F7162101509D8CAE59711602 /* VoiceSpeaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD11C7925B0A7831BFC2199C /* VoiceSpeaker.swift */; };+ D166CDFE3CBAF1310E7EC1F7 /* VoiceGenderNames.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16BF6539981E9EEF2397D061 /* VoiceGenderNames.swift */; };F8F95EAD88F70E0A147D1662 /* MacDictation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6544ED02D945CF9F00647AD1 /* MacDictation.swift */; };F9445A71BBF9E4D20224238E /* QuestionPayload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C6993B34A0FFF8E3D454ADC /* QuestionPayload.swift */; };F9685A58729FE64B23FCCFC5 /* VoiceResultView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C432FE1286945E42D3E11D7 /* VoiceResultView.swift */; };@@ -473,6 +475,7 @@C563E55884A7750B40EC9A01 /* VoiceBrain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VoiceBrain.swift; sourceTree = "<group>"; };C581F7B1A9F14B281B60063E /* GreetingCanvasView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GreetingCanvasView.swift; sourceTree = "<group>"; };CD11C7925B0A7831BFC2199C /* VoiceSpeaker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VoiceSpeaker.swift; sourceTree = "<group>"; };+ 16BF6539981E9EEF2397D061 /* VoiceGenderNames.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VoiceGenderNames.swift; sourceTree = "<group>"; };D0F0D0F67E7C56B9E37E7648 /* ClaudeHost.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClaudeHost.swift; sourceTree = "<group>"; };D1A7C62058BB0C9D0DF58DCB /* VoiceIntent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VoiceIntent.swift; sourceTree = "<group>"; };D1D96E57E8DADE6B82628E3E /* OpenLeadMochiIntent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenLeadMochiIntent.swift; sourceTree = "<group>"; };@@ -749,6 +752,7 @@7C432FE1286945E42D3E11D7 /* VoiceResultView.swift */,D4543CB771E0B723783F529E /* VoiceSettings.swift */,CD11C7925B0A7831BFC2199C /* VoiceSpeaker.swift */,+ 16BF6539981E9EEF2397D061 /* VoiceGenderNames.swift */,DE925A6844FE3E3C09131CE0 /* VoiceTranscriptHistory.swift */,ABD7A2C29B15EFFAF67FF2DE /* VoiceWakeFilter.swift */,A12EC8F605BBC37F8223D7AA /* WakePhrase.swift */,@@ -1063,6 +1067,7 @@CE5ACDD856C76B717ABA295F /* VoiceResultView.swift in Sources */,502F2B0D607C511DD3B836B3 /* VoiceSettings.swift in Sources */,718410ED630AE3AC5DF59A95 /* VoiceSpeaker.swift in Sources */,+ 9BAD96406059597681D89A92 /* VoiceGenderNames.swift in Sources */,189811F4DB3C4F6030043643 /* VoiceTranscriptHistory.swift in Sources */,BBCA973A1AE1385BBE79A834 /* VoiceWakeFilter.swift in Sources */,C2212AA8BF5834B62308235B /* WakePhrase.swift in Sources */,@@ -1253,6 +1258,7 @@F9685A58729FE64B23FCCFC5 /* VoiceResultView.swift in Sources */,035F9A85BF71B21F9AA5E004 /* VoiceSettings.swift in Sources */,F7162101509D8CAE59711602 /* VoiceSpeaker.swift in Sources */,+ D166CDFE3CBAF1310E7EC1F7 /* VoiceGenderNames.swift in Sources */,714B5BB7FFB0C8491AF67AD1 /* VoiceTranscriptHistory.swift in Sources */,8DE75D1E260A1314D1C47885 /* VoiceWakeFilter.swift in Sources */,3451DB0668FAEEF09503D808 /* WakePhrase.swift in Sources */,diff --git a/NotchBuddy/Resources/Localizable.xcstrings b/NotchBuddy/Resources/Localizable.xcstringsindex b9bc16f3..8d1f0ca5 100644--- a/NotchBuddy/Resources/Localizable.xcstrings+++ b/NotchBuddy/Resources/Localizable.xcstrings@@ -25881,6 +25881,266 @@}}}+ },+ "voice.tts-pitch": {+ "extractionState": "manual",+ "localizations": {+ "ar": {+ "stringUnit": {+ "state": "translated",+ "value": "حدّة الصوت"+ }+ },+ "bn": {+ "stringUnit": {+ "state": "translated",+ "value": "কণ্ঠের তীক্ষ্ণতা"+ }+ },+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Pitch"+ }+ },+ "es": {+ "stringUnit": {+ "state": "translated",+ "value": "Tono"+ }+ },+ "fr": {+ "stringUnit": {+ "state": "translated",+ "value": "Hauteur"+ }+ },+ "hi": {+ "stringUnit": {+ "state": "translated",+ "value": "आवाज़ की पिच"+ }+ },+ "id": {+ "stringUnit": {+ "state": "translated",+ "value": "Nada suara"+ }+ },+ "pt-BR": {+ "stringUnit": {+ "state": "translated",+ "value": "Tom"+ }+ },+ "ru": {+ "stringUnit": {+ "state": "translated",+ "value": "Высота голоса"+ }+ },+ "zh-Hans": {+ "stringUnit": {+ "state": "translated",+ "value": "音调"+ }+ }+ }+ },+ "voice.setting-web": {+ "extractionState": "manual",+ "localizations": {+ "ar": {+ "stringUnit": {+ "state": "translated",+ "value": "الإجابة عن الأسئلة ببحث على الويب"+ }+ },+ "bn": {+ "stringUnit": {+ "state": "translated",+ "value": "ওয়েবে খুঁজে প্রশ্নের উত্তর দাও"+ }+ },+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Answer questions with a web search"+ }+ },+ "es": {+ "stringUnit": {+ "state": "translated",+ "value": "Responder preguntas buscando en la web"+ }+ },+ "fr": {+ "stringUnit": {+ "state": "translated",+ "value": "Répondre aux questions avec une recherche web"+ }+ },+ "hi": {+ "stringUnit": {+ "state": "translated",+ "value": "वेब खोज से सवालों के जवाब"+ }+ },+ "id": {+ "stringUnit": {+ "state": "translated",+ "value": "Jawab pertanyaan dengan pencarian web"+ }+ },+ "pt-BR": {+ "stringUnit": {+ "state": "translated",+ "value": "Responder perguntas com uma busca na web"+ }+ },+ "ru": {+ "stringUnit": {+ "state": "translated",+ "value": "Отвечать на вопросы с поиском в интернете"+ }+ },+ "zh-Hans": {+ "stringUnit": {+ "state": "translated",+ "value": "用网页搜索回答问题"+ }+ }+ }+ },+ "voice.setting-web-desc": {+ "extractionState": "manual",+ "localizations": {+ "ar": {+ "stringUnit": {+ "state": "translated",+ "value": "الأسئلة التي لا تجيب عنها حبوبك تُرسل إلى Claude مع بحث على الويب، بمفتاح Anthropic API الخاص بك. يُرسل السؤال فقط."+ }+ },+ "bn": {+ "stringUnit": {+ "state": "translated",+ "value": "যে প্রশ্নের উত্তর তোমার পিলগুলো দিতে পারে না, সেগুলো তোমার Anthropic API কী দিয়ে ওয়েব সার্চসহ Claude-এর কাছে যায়। শুধু প্রশ্নটাই পাঠানো হয়।"+ }+ },+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Questions your pills can't answer go to Claude with a web search, using your Anthropic API key. Only the question is sent."+ }+ },+ "es": {+ "stringUnit": {+ "state": "translated",+ "value": "Las preguntas que tus píldoras no responden van a Claude con una búsqueda web, con tu clave de API de Anthropic. Solo se envía la pregunta."+ }+ },+ "fr": {+ "stringUnit": {+ "state": "translated",+ "value": "Les questions auxquelles tes pilules ne répondent pas partent chez Claude avec une recherche web, avec ta clé API Anthropic. Seule la question est envoyée."+ }+ },+ "hi": {+ "stringUnit": {+ "state": "translated",+ "value": "जिन सवालों का जवाब तुम्हारी पिल्स नहीं दे सकतीं, वे तुम्हारी Anthropic API कुंजी से वेब खोज के साथ Claude को जाते हैं। सिर्फ़ सवाल भेजा जाता है।"+ }+ },+ "id": {+ "stringUnit": {+ "state": "translated",+ "value": "Pertanyaan yang tidak bisa dijawab pil-mu dikirim ke Claude dengan pencarian web, memakai kunci API Anthropic-mu. Hanya pertanyaannya yang dikirim."+ }+ },+ "pt-BR": {+ "stringUnit": {+ "state": "translated",+ "value": "Perguntas que suas pílulas não respondem vão para o Claude com uma busca na web, usando sua chave de API da Anthropic. Só a pergunta é enviada."+ }+ },+ "ru": {+ "stringUnit": {+ "state": "translated",+ "value": "Вопросы, на которые не отвечают твои пилюли, уходят в Claude с поиском в интернете, по твоему ключу Anthropic API. Отправляется только вопрос."+ }+ },+ "zh-Hans": {+ "stringUnit": {+ "state": "translated",+ "value": "药丸无法回答的问题会用你的 Anthropic API 密钥发送给 Claude 并进行网页搜索。只发送问题本身。"+ }+ }+ }+ },+ "voice.setting-web-nokey": {+ "extractionState": "manual",+ "localizations": {+ "ar": {+ "stringUnit": {+ "state": "translated",+ "value": "أضف أولًا مفتاح Anthropic API في الإعدادات ← الدردشة."+ }+ },+ "bn": {+ "stringUnit": {+ "state": "translated",+ "value": "আগে সেটিংস → চ্যাটে তোমার Anthropic API কী যোগ করো।"+ }+ },+ "en": {+ "stringUnit": {+ "state": "translated",+ "value": "Add your Anthropic API key in Settings → Chat first."+ }+ },+ "es": {+ "stringUnit": {+ "state": "translated",+ "value": "Primero añade tu clave de API de Anthropic en Ajustes → Chat."+ }+ },+ "fr": {+ "stringUnit": {+ "state": "translated",+ "value": "Ajoute d'abord ta clé API Anthropic dans Réglages → Chat."+ }+ },+ "hi": {+ "stringUnit": {+ "state": "translated",+ "value": "पहले सेटिंग्स → चैट में अपनी Anthropic API कुंजी जोड़ो।"+ }+ },+ "id": {+ "stringUnit": {+ "state": "translated",+ "value": "Tambahkan dulu kunci API Anthropic-mu di Pengaturan → Chat."+ }+ },+ "pt-BR": {+ "stringUnit": {+ "state": "translated",+ "value": "Primeiro adicione sua chave de API da Anthropic em Ajustes → Chat."+ }+ },+ "ru": {+ "stringUnit": {+ "state": "translated",+ "value": "Сначала добавь ключ Anthropic API в Настройки → Чат."+ }+ },+ "zh-Hans": {+ "stringUnit": {+ "state": "translated",+ "value": "请先在设置 → 聊天中添加你的 Anthropic API 密钥。"+ }+ }+ }}},"version": "1.0"diff --git a/NotchBuddy/Sources/App/AppState.swift b/NotchBuddy/Sources/App/AppState.swiftindex 47c1a075..c4d830fc 100644--- a/NotchBuddy/Sources/App/AppState.swift+++ b/NotchBuddy/Sources/App/AppState.swift@@ -261,6 +261,9 @@ final class AppState: ObservableObject {// Dropped file (set during upload flow)@Published var droppedFile: DroppedFile? = nil+ /// A mail prepared by voice: fills the mail card; sent through Apple Mail on the+ /// user's click. nil for the drop-a-file flow.+ @Published var voiceMailDraft: VoiceMailDraft? = nil// Short note message (shown in NoteView)@Published var noteMessage: String? = nil@@ -716,6 +719,12 @@ enum PromptContext {case file(name: String, fileURL: URL?)}+struct VoiceMailDraft: Equatable {+ var to: String+ var subject: String+ var body: String+}+struct DroppedFile {var url: URLvar name: Stringdiff --git a/NotchBuddy/Sources/App/ClaudeService.swift b/NotchBuddy/Sources/App/ClaudeService.swiftindex ebedc0f9..24c26ccd 100644--- a/NotchBuddy/Sources/App/ClaudeService.swift+++ b/NotchBuddy/Sources/App/ClaudeService.swift@@ -501,6 +501,68 @@ final class ClaudeService {}}+ #if !APPSTORE+ // MARK: - Voice answer (Coucou's voice, web search)++ /// Fast model for spoken answers; the chat model from Settings when it is unavailable.+ private static let voiceModel = "claude-haiku-4-5"++ /// A short answer Coucou can say aloud, with web search, in the answer language.+ /// `history` holds the previous exchanges of this voice conversation (memory only).+ /// nil on any failure: no key, network, quota.+ func voiceAnswer(_ question: String, history: [VoiceWebTurn], french: Bool) async -> String? {+ guard let key = apiKey, !key.isEmpty else { return nil }+ let today = Date().formatted(.dateTime.weekday(.wide).day().month(.wide).year()+ .locale(Locale(identifier: french ? "fr_FR" : "en_US")))+ let system = french+ ? """+ Tu es Coucou, un assistant vocal dans le notch du Mac. Nous sommes le \(today). \+ Ta réponse est lue à voix haute : 2 à 4 phrases courtes, en français, sans markdown, sans liste, \+ sans lien, sans citer tes sources. Cherche sur le web dès que la réponse peut avoir changé \+ (actualité, résultats, prix, horaires, météo, personnes). Donne directement les faits utiles. \+ S'il y a clairement plus à raconter, termine par une seule courte question pour proposer la suite.+ """+ : """+ You are Coucou, a voice assistant in the Mac's notch. Today is \(today). \+ Your answer is read aloud: 2 to 4 short sentences in English, no markdown, no lists, no links, \+ never cite sources. Search the web whenever the answer may have changed (news, scores, prices, \+ opening hours, weather, people). Give the useful facts straight away. \+ When there is clearly more worth telling, end with one short question offering to go on.+ """+ var messages: [[String: Any]] = []+ for turn in history {+ messages.append(["role": "user", "content": turn.question])+ messages.append(["role": "assistant", "content": turn.answer])+ }+ messages.append(["role": "user", "content": question])++ var search: [String: Any] = ["type": "web_search_20250305", "name": "web_search", "max_uses": 3]+ var location: [String: Any] = ["type": "approximate", "timezone": TimeZone.current.identifier]+ if let country = Locale.current.region?.identifier, country.count == 2 { location["country"] = country }+ search["user_location"] = location++ func body(_ model: String) -> [String: Any] {+ ["model": model, "max_tokens": 700, "system": system, "tools": [search], "messages": messages]+ }+ let data: Data+ do {+ data = try await callAPI(body: body(Self.voiceModel), key: key, beta: "web-search-2025-03-05")+ } catch {+ // The fast model is not available to this key: the Settings model instead.+ guard let retry = try? await callAPI(body: body(model), key: key, beta: "web-search-2025-03-05") else {+ appendAppLog("nb.log", "[Voice] web answer failed")+ return nil+ }+ data = retry+ }+ guard let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any],+ let content = json["content"] as? [[String: Any]],+ let text = claudeResponseText(fromContent: content) else { return nil }+ let spoken = VoiceQuery.spokenText(text)+ return spoken.isEmpty ? nil : spoken+ }+ #endif+// MARK: - API callprivate func callAPI(body: [String: Any], key: String, beta: String? = nil) async throws -> Data {diff --git a/NotchBuddy/Sources/App/IslandViewContent.swift b/NotchBuddy/Sources/App/IslandViewContent.swiftindex a6b39ca2..35de743a 100644--- a/NotchBuddy/Sources/App/IslandViewContent.swift+++ b/NotchBuddy/Sources/App/IslandViewContent.swift@@ -1046,25 +1046,50 @@ struct MailView: View {guard !isSending else { return }sendMail()}- SecondaryButton("Cancel") { state.view = .choose }+ SecondaryButton("Cancel") {+ if state.voiceMailDraft != nil {+ // Prepared by voice: nothing to go back to, close the card.+ state.voiceMailDraft = nil+ state.droppedFile = nil+ NotificationCenter.default.post(name: .islandCollapse, object: nil)+ } else {+ state.view = .choose+ }+ }}}.padding(.leading, 92).padding(.trailing, 18).padding(.vertical, 8)}- .onAppear { subject = state.droppedFile?.name ?? "" }+ .onAppear { fillFromVoiceDraft() }+ .onChange(of: state.voiceMailDraft) { _, _ in fillFromVoiceDraft() }+ }++ /// A mail prepared by voice arrives filled in; otherwise the dropped file's name.+ private func fillFromVoiceDraft() {+ if let d = state.voiceMailDraft {+ to = d.to+ subject = d.subject.isEmpty ? (state.droppedFile?.name ?? "") : d.subject+ bodyText = d.body+ statusMsg = ""+ } else if subject.isEmpty {+ subject = state.droppedFile?.name ?? ""+ }}private func sendMail() {guard !to.isEmpty else { statusMsg = String(localized: "Missing recipient."); return }let subj = subject.isEmpty ? (state.droppedFile?.name ?? "File") : subject- // Prefer Resend if API key + sender address are configured+ // Prefer Resend if API key + sender address are configured — except for a mail+ // prepared by voice, which goes through the user's own Apple Mail account.let apiKey = KeychainStore.shared.get("resend-api-key")let fromAddr = KeychainStore.shared.get("resend-from")- if let apiKey, let fromAddr {+ if state.voiceMailDraft != nil {+ sendViaAppleMail(to: to, subject: subj)+ } else if let apiKey, let fromAddr {isSending = truestatusMsg = ""let recipient = to@@ -1173,6 +1198,7 @@ struct MailView: View {}private func onSuccess(recipient: String) {+ state.voiceMailDraft = nilSoundEngine.shared.play("send")NotificationCenter.default.post(name: .triggerEmote, object: BotEmote.wink)state.noteMessage = "Email sent to \(recipient)."diff --git a/NotchBuddy/Sources/App/IslandWindowController.swift b/NotchBuddy/Sources/App/IslandWindowController.swiftindex 968e357b..8fd83837 100644--- a/NotchBuddy/Sources/App/IslandWindowController.swift+++ b/NotchBuddy/Sources/App/IslandWindowController.swift@@ -149,8 +149,16 @@ final class IslandWindowController: NSWindowController {UploadSequenceEngine.shared.exitZone()}}- dropView.onFilesDropped = { urls in+ dropView.onFilesDropped = { [weak self] urls inTask { @MainActor in+ #if !APPSTORE+ // During the voice email (above all after "any attachment?"), a file+ // dropped on the notch goes into that email.+ if VoiceActionRunner.shared.isMailInProgress, let url = urls.first {+ await self?.attachVoiceMailFile(url)+ return+ }+ #endifawait FileDropHandler.handle(urls: urls, state: AppState.shared)}}@@ -305,7 +313,8 @@ final class IslandWindowController: NSWindowController {self?.fsm.greetComplete()}- fsm.isHeldOpen = { AppState.shared.pendingApproval != nil }+ // An approval, or an email prepared by voice, stays open until I click.+ fsm.isHeldOpen = { AppState.shared.pendingApproval != nil || AppState.shared.voiceMailDraft != nil }// Voice: wake phrase detected → open listening island#if !APPSTORE@@ -333,7 +342,15 @@ final class IslandWindowController: NSWindowController {Task { @MainActor [weak self] inguard let self else { return }if transcript.isEmpty {- if VoiceActionRunner.shared.pendingQuestion != nil {+ if VoiceActionRunner.shared.isMailInProgress {+ // Silence during the voice email: "no attachment" → the card opens,+ // or the mail is cancelled. Say it, like any other answer.+ let result = await VoiceActionRunner.shared.handleAnswer(+ "", availablePills: PillCatalog.available)+ VoiceCaptionManager.shared.appendResponse(result.message)+ AppState.shared.voiceResult = result+ self.speakAndContinueConversation(result)+ } else if VoiceActionRunner.shared.pendingQuestion != nil {// Re-listen timed out with no answer → show cancellation messagelet result = await VoiceActionRunner.shared.handleAnswer("", availablePills: PillCatalog.available)@@ -798,6 +815,13 @@ final class IslandWindowController: NSWindowController {self.silentNextReveal = false}+ // Email prepared by voice: open the mail card, filled in, for me to check and send.+ NotificationCenter.default.addObserver(forName: .voiceShowMailCard, object: nil, queue: .main) { [weak self] _ in+ guard let self else { return }+ self.fsm.openedExternally()+ self.expand(to: .mail)+ }+// Collapse requests from views (OK button, etc.)NotificationCenter.default.addObserver(forName: .islandCollapse, object: nil, queue: .main) { [weak self] _ inself?.collapse()@@ -1364,7 +1388,9 @@ extension IslandWindowController {// ── Short noise / spurious activation guard (conversation mode only) ────────// A transcript shorter than 2 words that isn't a pill name or known command// is almost certainly a false activation. Silently re-listen without feedback.- if isInConversation {+ // A one-word reply to Coucou's own question ("Tana", "non", "yes" after "want the+ // details?") is expected, not noise.+ if isInConversation && runner.pendingQuestion == nil && !runner.hasWebThread {let normWords = normTranscript.split(separator: " ").map(String.init)if normWords.count < 2 {let isPillName = pills.contains { IntentParser.normalise($0.name) == normTranscript }@@ -1440,7 +1466,7 @@ extension IslandWindowController {}// ── Relative context resolution ────────────────────────────────────────────- let intent: VoiceIntent+ var intent: VoiceIntentlet transcriptOrigin: TranscriptOriginif conversationContext.lastIntent != nil,let resolved = conversationContext.resolveRelative(transcript, pills: pills) {@@ -1451,6 +1477,20 @@ extension IslandWindowController {transcriptOrigin = .parser}+ // Web search on (Settings → Voice): a question no pill or service answers goes to+ // Claude with web search, and so does the reply to its own follow-up question.+ if case .unknown = intent, runner.info.webSearchEnabled, runner.info.hasWebKey,+ VoiceQuery.looksLikeQuestion(transcript) || (isInConversation && runner.hasWebThread) {+ intent = .webSearch(query: transcript)+ }+ if case .webSearch(let q) = intent, !q.isEmpty,+ runner.info.webSearchEnabled, runner.info.hasWebKey, VoiceSettings.speakEnabled {+ // A web search takes a few seconds: say so instead of going quiet.+ VoiceSpeaker.shared.onDidFinish = nil+ let wait = VoiceSettings.language == "fr" ? "Je regarde." : "Let me check."+ VoiceSpeaker.shared.speak(wait, locale: VoiceSettings.answerLocale)+ }+// ── Single command ─────────────────────────────────────────────────────────let locale = VoiceSettings.answerLocalelet tParseEnd = Date()@@ -1604,7 +1644,7 @@ extension IslandWindowController {speaker.onDidFinish = { [weak self] inTask { @MainActor inguard self != nil else { return }- VoiceEngine.shared.startListeningDirectly(firstWordTimeout: 5.0)+ VoiceEngine.shared.startListeningDirectly(firstWordTimeout: Self.answerWait(5.0))}}} else {@@ -1612,7 +1652,7 @@ extension IslandWindowController {voiceResultWork = nilDispatchQueue.main.asyncAfter(deadline: .now() + 0.4) { [weak self] inguard self != nil else { return }- VoiceEngine.shared.startListeningDirectly(firstWordTimeout: 5.0)+ VoiceEngine.shared.startListeningDirectly(firstWordTimeout: Self.answerWait(5.0))}}} else {@@ -1706,12 +1746,36 @@ extension IslandWindowController {isInConversation = trueVoiceBrain.shared.beginConversation()if AppState.shared.soundEnabled { SoundEngine.shared.play("tick") }- VoiceEngine.shared.startConversationTurn()+ VoiceEngine.shared.startConversationTurn(firstWordTimeout: Self.answerWait(8.0))} else {closeVoiceTurn()}}+ /// Seconds to wait for the first word of a reply: longer while Coucou waits for a+ /// file, since finding it in Finder and dragging it takes a moment.+ @MainActor+ static func answerWait(_ normal: TimeInterval) -> TimeInterval {+ VoiceActionRunner.shared.isWaitingForAttachment ? 20.0 : normal+ }++ /// A file dropped on the notch while Coucou asked for an attachment: stop listening,+ /// a little gulp, then the filled-in mail card and Coucou says so.+ @MainActor+ func attachVoiceMailFile(_ url: URL) async {+ VoiceEngine.shared.cancelListening()+ let state = AppState.shared+ state.fileDragOver = false+ NotificationCenter.default.post(name: .botGulp, object: nil)+ NotificationCenter.default.post(name: .botMorphTo, object: CGFloat(0))+ NotificationCenter.default.post(name: .triggerEmote, object: BotEmote.happy)+ if state.soundEnabled { SoundEngine.shared.play("approve") }+ let result = await VoiceActionRunner.shared.attachDroppedFile(url)+ VoiceCaptionManager.shared.appendResponse(result.message)+ state.voiceResult = result+ speakAndContinueConversation(result)+ }+/// Stop listening and let the island settle. The context (last action, model session)/// stays 90 s so a new "OK Coucou, et Stripe aussi" still understands "aussi".@MainActor@@ -1726,6 +1790,7 @@ extension IslandWindowController {let expiry = DispatchWorkItem { [weak self] inTask { @MainActor inself?.conversationContext.reset()+ VoiceActionRunner.shared.resetWebThread()VoiceBrain.shared.endConversation()}}@@ -1747,6 +1812,12 @@ extension IslandWindowController {guard let self else { return }AppState.shared.voiceResult = nilAppState.shared.voiceActive = false+ if AppState.shared.voiceMailDraft != nil {+ // The voice email card stays open until I click Send or Cancel.+ self.fsm.openedExternally()+ self.expand(to: .mail)+ return+ }// Reset view before collapsing so shouldIgnoreWake never sees a stale .voiceResult.AppState.shared.view = self.defaultView()self.fsm.voiceFinished()@@ -1770,6 +1841,7 @@ extension Notification.Name {static let botMorphTo = Notification.Name("notchBuddy.botMorphTo")static let islandAction = Notification.Name("notchBuddy.islandAction")static let islandCollapse = Notification.Name("notchBuddy.islandCollapse")+ static let voiceShowMailCard = Notification.Name("notchBuddy.voiceShowMailCard")static let islandSendMessage = Notification.Name("notchBuddy.islandSendMessage")static let islandNewConversation = Notification.Name("notchBuddy.islandNewConversation")static let islandToggleDiff = Notification.Name("notchBuddy.islandToggleDiff")diff --git a/NotchBuddy/Sources/App/SettingsView.swift b/NotchBuddy/Sources/App/SettingsView.swiftindex ed4c4f93..dadb69cb 100644--- a/NotchBuddy/Sources/App/SettingsView.swift+++ b/NotchBuddy/Sources/App/SettingsView.swift@@ -1266,9 +1266,20 @@ struct SettingsView: View {@AppStorage("voiceListenLanguage") private var listenLanguage: String = "auto"@AppStorage("voiceTTSEngine") private var ttsEngine: String = "system"@AppStorage("voiceElevenGender") private var elevenGender: String = "female"+ @AppStorage("voicePitchFemale") private var pitchFemale: Double = VoiceSettings.defaultPitchFemale+ @AppStorage("voicePitchMale") private var pitchMale: Double = VoiceSettings.defaultPitchMale+ @AppStorage("voiceWebSearchEnabled") private var webSearchEnabled: Bool = false+ @State private var webKeySaved: Bool = !(KeychainStore.shared.get("anthropic-api-key") ?? "").isEmpty@State private var elevenKeyDraft: String = ""@State private var elevenKeySaved: Bool = KeychainStore.shared.get(ElevenLabsTTS.keyName) != nil+ private func speakVoiceSample() {+ let en = voiceLanguage != "fr"+ VoiceSpeaker.shared.speak(en ? "Hi, I'm Coucou. Say OK Coucou whenever you need me."+ : "Salut, c'est Coucou. Dis OK Coucou quand tu as besoin de moi.",+ locale: Locale(identifier: en ? "en-US" : "fr-FR"))+ }+@ViewBuilder private var voiceSection: some View {GroupBox(String(localized: "«\u{202F}OK Coucou\u{202F}» — voice wake word")) {VStack(alignment: .leading, spacing: 10) {@@ -1326,6 +1337,15 @@ struct SettingsView: View {.onChange(of: elevenGender) { _, _ in ElevenLabsTTS.shared.reset() }if ttsEngine == "system" {+ HStack(spacing: 8) {+ Text(String(localized: "voice.tts-pitch"))+ Slider(value: elevenGender == "male" ? $pitchMale : $pitchFemale,+ in: 0.8...1.6, step: 0.05) { editing in+ // Released: hear the new pitch right away.+ if !editing { speakVoiceSample() }+ }+ .frame(maxWidth: 180)+ }let current = VoiceSpeaker.macVoiceName(for: Locale(identifier: voiceLanguage == "fr" ? "fr-FR" : "en-US"),gender: elevenGender)Text(String(format: String(localized: "voice.mac-voice-current %@"), current))@@ -1342,16 +1362,20 @@ struct SettingsView: View {}}- Button(String(localized: "voice.tts-test")) {- let en = voiceLanguage != "fr"- VoiceSpeaker.shared.speak(en ? "Hi, I'm Coucou. Say OK Coucou whenever you need me."- : "Salut, c'est Coucou. Dis OK Coucou quand tu as besoin de moi.",- locale: Locale(identifier: en ? "en-US" : "fr-FR"))- }+ Button(String(localized: "voice.tts-test")) { speakVoiceSample() }}Toggle(String(localized: "voice.setting-captions"), isOn: $captionEnabled)+ Toggle(String(localized: "voice.setting-web"), isOn: $webSearchEnabled)+ .disabled(!webKeySaved && !webSearchEnabled)+ Text(webKeySaved ? String(localized: "voice.setting-web-desc")+ : String(localized: "voice.setting-web-nokey"))+ .font(.system(size: 11))+ .foregroundColor(.secondary)+ .fixedSize(horizontal: false, vertical: true)+ .onAppear { webKeySaved = !(KeychainStore.shared.get("anthropic-api-key") ?? "").isEmpty }+Toggle(String(localized: "voice.setting-weather"), isOn: $weatherEnabled)if weatherEnabled {TextField(String(localized: "voice.setting-weather-city"), text: $weatherCity)diff --git a/NotchBuddy/Sources/App/Voice/ElevenLabsTTS.swift b/NotchBuddy/Sources/App/Voice/ElevenLabsTTS.swiftindex 6f11467b..7f1c6db0 100644--- a/NotchBuddy/Sources/App/Voice/ElevenLabsTTS.swift+++ b/NotchBuddy/Sources/App/Voice/ElevenLabsTTS.swift@@ -70,7 +70,8 @@ final class ElevenLabsTTS {return v}- /// First English voice of the gender; else any voice of the gender; else the first one.+ /// First English voice of the gender (a young one first for a man); else any voice of+ /// the gender; else the first one.nonisolated static func pick(_ voices: [[String: Any]], gender: String) -> Voice? {func labels(_ v: [String: Any]) -> [String: String] { v["labels"] as? [String: String] ?? [:] }func isEnglish(_ v: [String: Any]) -> Bool {@@ -80,8 +81,12 @@ final class ElevenLabsTTS {return accent.isEmpty || ["american", "british", "australian", "irish", "english", "us", "uk"].contains { accent.contains($0) }}+ func isYoung(_ v: [String: Any]) -> Bool { (labels(v)["age"] ?? "").lowercased().contains("young") }let ofGender = voices.filter { labels($0)["gender"]?.lowercased() == gender }- let v = ofGender.first(where: isEnglish) ?? ofGender.first ?? voices.first+ let english = ofGender.filter(isEnglish)+ // Male: a young voice first, it sounds closer to Coucou than a deep narrator.+ let young = gender == "male" ? english.first(where: isYoung) : nil+ let v = young ?? english.first ?? ofGender.first ?? voices.firstguard let v, let id = v["voice_id"] as? String else { return nil }return Voice(id: id, name: v["name"] as? String ?? id)}diff --git a/NotchBuddy/Sources/App/Voice/IntentParser.swift b/NotchBuddy/Sources/App/Voice/IntentParser.swiftindex 6d72cb99..fa955dca 100644--- a/NotchBuddy/Sources/App/Voice/IntentParser.swift+++ b/NotchBuddy/Sources/App/Voice/IntentParser.swift@@ -17,6 +17,7 @@ enum IntentParser {// Email, questions about the services, opening an app (VoiceQuery).if let m = VoiceQuery.mail(of: raw) { return .mail(m) }+ if let q = VoiceQuery.webQuery(of: raw) { return .webSearch(query: q) }if let t = VoiceQuery.topic(of: raw) { return .query(t) }if let app = VoiceQuery.appToOpen(raw) { return .openApp(name: app) }diff --git a/NotchBuddy/Sources/App/Voice/VoiceActionRunner.swift b/NotchBuddy/Sources/App/Voice/VoiceActionRunner.swiftindex a6a9cb93..c88a273a 100644--- a/NotchBuddy/Sources/App/Voice/VoiceActionRunner.swift+++ b/NotchBuddy/Sources/App/Voice/VoiceActionRunner.swift@@ -35,18 +35,39 @@ protocol PillControlling {@MainActorprotocol VoiceInfoProviding {func answer(_ topic: VoiceTopic, locale: Locale?) async -> String- /// Opens a compose window (Mail) — never sends: I click Send myself.- func composeMail(_ request: VoiceQuery.MailRequest, locale: Locale?) async -> VoiceActionResultfunc openApp(_ name: String, locale: Locale?) -> VoiceActionResult+ // Guided email+ /// An address for a contact name or a spoken address, nil when not found.+ func resolveEmail(_ recipient: String) async -> String?+ func findFile(_ name: String, folder: VoiceQuery.MailRequest.Folder?) -> URL?+ /// The on-device model writes the text ("thank her for yesterday"); nil if unavailable.+ func draftBody(to recipient: String, about instruction: String) async -> String?+ /// Opens the island's mail card, filled in. Nothing is sent until I click Send.+ func showMailCard(to address: String, subject: String, body: String, file: URL?)+ // Web search (Settings → Voice, opt-in, the user's Anthropic API key)+ var webSearchEnabled: Bool { get }+ var hasWebKey: Bool { get }+ /// A short spoken answer from Claude with web search; nil on any failure.+ func webAnswer(_ question: String, history: [VoiceWebTurn], french: Bool) async -> String?+}++/// One earlier exchange of the web conversation, kept in memory only.+struct VoiceWebTurn: Equatable {+ let question: String+ let answer: String}@MainActorprivate final class NullInfo: VoiceInfoProviding {func answer(_ topic: VoiceTopic, locale: Locale?) async -> String { "" }- func composeMail(_ request: VoiceQuery.MailRequest, locale: Locale?) async -> VoiceActionResult {- .init(outcome: .failure, message: "")- }func openApp(_ name: String, locale: Locale?) -> VoiceActionResult { .init(outcome: .failure, message: "") }+ func resolveEmail(_ recipient: String) async -> String? { VoiceQuery.spokenEmail(recipient) }+ func findFile(_ name: String, folder: VoiceQuery.MailRequest.Folder?) -> URL? { nil }+ func draftBody(to recipient: String, about instruction: String) async -> String? { nil }+ func showMailCard(to address: String, subject: String, body: String, file: URL?) {}+ var webSearchEnabled: Bool { false }+ var hasWebKey: Bool { false }+ func webAnswer(_ question: String, history: [VoiceWebTurn], french: Bool) async -> String? { nil }}// MARK: - Null implementations (test-safe, no AppKit)@@ -285,11 +306,14 @@ final class VoiceActionRunner {return text.isEmpty ? fail("voice.unknown") : .init(outcome: .success, message: text)case .mail(let request):- return await info.composeMail(request, locale: commandLocale)+ return await startMail(request)case .openApp(let name):return info.openApp(name, locale: commandLocale)+ case .webSearch(let query):+ return await webSearch(query)+case .unknown:if rawTranscript.isEmpty { return fail("voice.unknown") }let fmt = Self.localizedString("voice.unknown-transcript", locale: commandLocale)@@ -305,6 +329,10 @@ final class VoiceActionRunner {guard let pending = pendingQuestion else { return fail("voice.unknown") }pendingQuestion = nil+ if case .mailStep(let field) = pending.kind {+ return await answerMail(field, transcript, pending: pending)+ }+guard !transcript.trimmingCharacters(in: .whitespaces).isEmpty else {return ok("voice.question-cancelled")}@@ -331,6 +359,11 @@ final class VoiceActionRunner {return fail("voice.unknown")}+ // "What should I look up?" → the answer is the question.+ if case .webQuery = pending.kind {+ return await webSearch(transcript)+ }+// A playlist name is free text, not a pill.if case .whichPlaylist = pending.kind {var name = transcript.trimmingCharacters(in: .whitespacesAndNewlines)@@ -356,7 +389,7 @@ final class VoiceActionRunner {}switch pending.kind {- case .whichPlaylist, .switchLanguage:+ case .whichPlaylist, .switchLanguage, .mailStep, .webQuery:return fail("voice.unknown") // handled abovecase .whichPill(let add):return await run(add ? .pillAdd(id: entity) : .pillRemove(id: entity),@@ -377,6 +410,191 @@ final class VoiceActionRunner {}}+ // MARK: - Web search+ //+ // Claude answers with a web search (opt-in, the user's key). The last exchanges stay+ // in memory so "and in Paris?" or "yes, tell me more" continue the same subject; the+ // island controller forgets them with the rest of the conversation context.++ private(set) var webHistory: [VoiceWebTurn] = []+ var hasWebThread: Bool { !webHistory.isEmpty }+ func resetWebThread() { webHistory = [] }++ func webSearch(_ query: String) async -> VoiceActionResult {+ guard info.webSearchEnabled, info.hasWebKey else {+ let msg = info.hasWebKey+ ? t("La recherche web est coupée. Active-la dans Réglages, Voix.",+ "Web search is off. Turn it on in Settings, Voice.")+ : t("Pour chercher sur internet, ajoute ta clé API Anthropic dans Réglages, puis active la recherche web dans Voix.",+ "To search the web, add your Anthropic API key in Settings, then turn on web search in Voice.")+ return .init(outcome: .failure, message: msg)+ }+ let q = query.trimmingCharacters(in: .whitespacesAndNewlines)+ if q.isEmpty {+ let text = t("Qu'est-ce que je cherche ?", "What should I look up?")+ pendingQuestion = PendingVoiceQuestion(kind: .webQuery, text: text)+ return .init(outcome: .question(text: text), message: text)+ }+ guard let answer = await info.webAnswer(q, history: webHistory, french: answersFrench),+ !answer.isEmpty else {+ return .init(outcome: .failure, message: t("Je n'arrive pas à chercher sur internet là, réessaie dans un instant.",+ "I can't reach the web right now, try again in a moment."))+ }+ webHistory.append(VoiceWebTurn(question: q, answer: answer))+ if webHistory.count > 6 { webHistory.removeFirst(webHistory.count - 6) }+ return .init(outcome: .success, message: answer)+ }++ // MARK: - Guided email+ //+ // "envoie un mail" → who? → subject? → text? (or "write it for me") → attachment?+ // (drop it on the notch, or say no) → the island's mail card opens, filled in, and I+ // click Send. Steps already given in the first sentence are skipped.++ private var mail: VoiceQuery.MailRequest?+ private var mailAddress: String?+ private var mailFile: URL?+ private var mailAttachmentAsked = false++ /// True while Coucou waits for a file to be dropped on the notch.+ var isWaitingForAttachment: Bool {+ if case .mailStep(.attachment)? = pendingQuestion?.kind { return true }+ return false+ }++ /// True while Coucou waits for any answer of the voice email (who, subject, text, file).+ var isMailInProgress: Bool {+ if case .mailStep? = pendingQuestion?.kind { return true }+ return false+ }++ private var answersFrench: Bool { commandLocale?.language.languageCode?.identifier == "fr" }+ private func t(_ fr: String, _ en: String) -> String { answersFrench ? fr : en }++ func startMail(_ request: VoiceQuery.MailRequest) async -> VoiceActionResult {+ mail = request+ mailAddress = nil+ mailFile = nil+ mailAttachmentAsked = false+ return await continueMail()+ }++ /// A file dropped on the notch while Coucou asked for an attachment.+ func attachDroppedFile(_ url: URL) async -> VoiceActionResult {+ pendingQuestion = nil+ mailFile = url+ mailAttachmentAsked = true+ return await continueMail()+ }++ private func askMail(_ field: PendingVoiceQuestion.MailField, _ text: String) -> VoiceActionResult {+ pendingQuestion = PendingVoiceQuestion(kind: .mailStep(field), text: text)+ return .init(outcome: .question(text: text), message: text)+ }++ private func continueMail() async -> VoiceActionResult {+ guard var m = mail else { return fail("voice.unknown") }++ if mailAddress == nil {+ let who = m.recipient.trimmingCharacters(in: .whitespaces)+ if who.isEmpty {+ return askMail(.recipient, t("À qui j'envoie le mail ? Dis son nom ou son adresse.",+ "Who should I send it to? Say a name or an email address."))+ }+ if let address = await info.resolveEmail(who) {+ mailAddress = address+ } else {+ m.recipient = ""; mail = m+ return askMail(.recipient, t("Je ne trouve pas \(who) dans tes contacts. Dis-moi son adresse mail.",+ "I can't find \(who) in your contacts. What's the email address?"))+ }+ }+ if let name = m.file, mailFile == nil {+ mailAttachmentAsked = true+ m.file = nil; mail = m+ if let url = info.findFile(name, folder: m.folder) {+ mailFile = url+ } else {+ return askMail(.attachment, t("Je ne trouve pas « \(name) ». Glisse-le sur le notch, ou dis non.",+ "I can't find “\(name)”. Drop it on the notch, or say no."))+ }+ }+ if m.subject == nil {+ return askMail(.subject, t("Quel est l'objet ?", "What's the subject?"))+ }+ if m.body == nil {+ if let what = m.instruction {+ m.body = await info.draftBody(to: m.recipient, about: what) ?? what+ mail = m+ } else {+ return askMail(.body, t("Qu'est-ce que je mets dans le message ? Je peux aussi l'écrire pour toi, dis-moi juste de quoi il parle.",+ "What should the message say? I can also write it for you, just tell me what it's about."))+ }+ }+ if !mailAttachmentAsked {+ mailAttachmentAsked = true+ return askMail(.attachment, t("Une pièce jointe ? Glisse-la sur le notch, ou dis non.",+ "Any attachment? Drop it on the notch, or say no."))+ }++ info.showMailCard(to: mailAddress ?? m.recipient, subject: m.subject ?? "", body: m.body ?? "", file: mailFile)+ mail = nil+ let with = mailFile.map { t(" avec \($0.lastPathComponent)", " with \($0.lastPathComponent)") } ?? ""+ return .init(outcome: .success,+ message: t("Voilà ton mail\(with). Relis-le et clique sur Envoyer.",+ "Here's your email\(with). Check it and click Send."))+ }++ private func answerMail(_ field: PendingVoiceQuestion.MailField, _ transcript: String,+ pending: PendingVoiceQuestion) async -> VoiceActionResult {+ guard var m = mail else { return fail("voice.unknown") }+ let said = transcript.trimmingCharacters(in: .whitespacesAndNewlines)++ if said.isEmpty {+ // Silence after "any attachment?" means none; anywhere else it cancels the mail.+ if field == .attachment { return await continueMail() }+ mail = nil+ return .init(outcome: .success, message: t("OK, j'annule le mail.", "Okay, I cancelled the email."))+ }+ if Self.cancelsMail(said) {+ mail = nil+ return .init(outcome: .success, message: t("OK, j'annule le mail.", "Okay, I cancelled the email."))+ }+ switch field {+ case .recipient:+ m.recipient = VoiceQuery.recipientAnswer(said)+ mailAddress = nil+ case .subject:+ m.subject = VoiceQuery.subjectAnswer(said)+ case .body:+ let a = VoiceQuery.bodyAnswer(said)+ m.body = a.body+ m.instruction = a.instruction+ case .attachment:+ if !Self.isNo(said), let name = VoiceQuery.attachmentAnswer(said) {+ if let url = info.findFile(name, folder: nil) {+ mailFile = url+ } else if !pending.askedAgain {+ var again = PendingVoiceQuestion(kind: .mailStep(.attachment),+ text: t("Je ne trouve pas « \(name) ». Glisse-le sur le notch, ou dis non.",+ "I can't find “\(name)”. Drop it on the notch, or say no."))+ again.askedAgain = true+ pendingQuestion = again+ return .init(outcome: .question(text: again.text), message: again.text)+ }+ }+ }+ mail = m+ return await continueMail()+ }++ /// "Annule", "laisse tomber", "cancel"… as the whole answer stops the voice email.+ static func cancelsMail(_ s: String) -> Bool {+ let t = IntentParser.normalise(s)+ return ["annule", "annuler", "annule le mail", "annule tout", "laisse tomber", "oublie",+ "stop", "cancel", "cancel it", "never mind", "forget it"].contains(t)+ }+/// Asked once, in the current answer language, when I speak another one.func offerLanguageSwitch(to lang: String) -> String {let current = commandLocale?.language.languageCode?.identifier ?? "en"diff --git a/NotchBuddy/Sources/App/Voice/VoiceBrain.swift b/NotchBuddy/Sources/App/Voice/VoiceBrain.swiftindex 0d19bceb..246d1d75 100644--- a/NotchBuddy/Sources/App/Voice/VoiceBrain.swift+++ b/NotchBuddy/Sources/App/Voice/VoiceBrain.swift@@ -117,7 +117,7 @@ final class VoiceBrain {Ne pose une question que si tu as vraiment besoin d'une précision pour agir : une seule, courte, qui finit par « ? ». Sinon, ne finis jamais par une question.Utilise les outils pour les pilules et la musique.Pour toute question sur Stripe, GitHub, Vercel, Resend, n8n, Notion, Cal.com, les agents (Claude Code, Codex…), le plan Claude ou Codex, la musique ou la météo, appelle d'abord l'outil service et réponds avec ses données, sans rien inventer.- Pour un mail, appelle l'outil mail : il prépare le mail dans Mail, c'est l'utilisateur qui clique sur Envoyer. Si on te demande de l'écrire, rédige toi-même le texte.+ Pour un mail, appelle l'outil mail : Coucou demande ce qui manque, puis ouvre le mail dans le notch et c'est l'utilisateur qui clique sur Envoyer. Si on te demande de l'écrire, rédige toi-même le texte.Pour les noms de pilules, utilise le nom exact fourni par l'utilisateur."""}@@ -127,7 +127,7 @@ final class VoiceBrain {Only ask a question when you truly need a detail to act: one short question ending with "?". Otherwise never end with a question.Use the tools for pills and music.For any question about Stripe, GitHub, Vercel, Resend, n8n, Notion, Cal.com, agents (Claude Code, Codex…), the Claude or Codex plan, music or the weather, call the service tool first and answer from its data, never invent.- For an email, call the mail tool: it prepares the email in Mail and the user clicks Send. When asked to write it, write the text yourself.+ For an email, call the mail tool: Coucou asks for what is missing, then opens the email in the notch and the user clicks Send. When asked to write it, write the text yourself.For pill names, use the exact name the user said."""}@@ -410,7 +410,7 @@ struct MusicTool: Tool, @unchecked Sendable {@available(macOS 26, *)struct MailTool: Tool, @unchecked Sendable {let name = "mail"- let description = "Prepare an email in Apple Mail (the user clicks Send). Recipient is a contact name or an email address; file is an optional file name to attach (searched in Downloads, Desktop, Documents, Pictures)."+ let description = "Prepare an email (Coucou asks for anything missing; the user clicks Send). Recipient is a contact name or an email address; file is an optional file name to attach (searched in Downloads, Desktop, Documents, Pictures)."@Generablestruct Arguments {diff --git a/NotchBuddy/Sources/App/Voice/VoiceDataSources.swift b/NotchBuddy/Sources/App/Voice/VoiceDataSources.swiftindex b8a87cf2..8a0ed490 100644--- a/NotchBuddy/Sources/App/Voice/VoiceDataSources.swift+++ b/NotchBuddy/Sources/App/Voice/VoiceDataSources.swift@@ -164,55 +164,35 @@ final class LiveVoiceInfo: VoiceInfoProviding {resetsIn: reset.map { duration($0.timeIntervalSinceNow, fr: fr, units: 2) })}- // MARK: Mail — prepare only, the user clicks Send+ // MARK: Guided email — the island's mail card, sent only on the user's click- func composeMail(_ request: VoiceQuery.MailRequest, locale: Locale?) async -> VoiceActionResult {- let fr = Self.isFrench(locale)- func t(_ f: String, _ e: String) -> String { fr ? f : e }+ func resolveEmail(_ recipient: String) async -> String? {+ if let e = VoiceQuery.spokenEmail(recipient) { return e }+ return await ContactLookup.email(for: recipient)+ }- guard let address = await ContactLookup.email(for: request.recipient) else {- return .init(outcome: .failure,- message: t("Je ne trouve pas l'adresse de \(request.recipient) dans tes contacts.",- "I can't find \(request.recipient)'s address in your contacts."))- }- var fileURL: URL? = nil- if let name = request.file {- fileURL = FileLookup.find(name, in: request.folder)- if fileURL == nil {- return .init(outcome: .failure,- message: t("Je ne trouve pas le fichier « \(name) ».", "I can't find the file “\(name)”."))- }- }+ func findFile(_ name: String, folder: VoiceQuery.MailRequest.Folder?) -> URL? {+ FileLookup.find(name, in: folder)+ }- // Body: dictated, or written by Coucou from what the mail should say.- var body = request.body- if body == nil, let what = request.instruction {- body = await VoiceBrain.draftMail(to: request.recipient, about: what) ?? what- }- let subject = request.subject ?? fileURL?.deletingPathExtension().lastPathComponent ?? ""-- var items: [Any] = []- if let body { items.append(body) }- if let fileURL { items.append(fileURL) }- if !items.isEmpty, let service = NSSharingService(named: .composeEmail) {- service.recipients = [address]- service.subject = subject- service.perform(withItems: items)- } else {- var comps = URLComponents()- comps.scheme = "mailto"- comps.path = address- comps.queryItems = [URLQueryItem(name: "subject", value: subject),- URLQueryItem(name: "body", value: body ?? "")]- guard let url = comps.url else {- return .init(outcome: .failure, message: t("Je n'arrive pas à ouvrir Mail.", "I can't open Mail."))- }- NSWorkspace.shared.open(url)- }- let what = fileURL.map { t(" avec \($0.lastPathComponent)", " with \($0.lastPathComponent)") } ?? ""- return .init(outcome: .success,- message: t("Le mail pour \(request.recipient)\(what) est prêt dans Mail. Relis-le et clique sur Envoyer.",- "The email to \(request.recipient)\(what) is ready in Mail. Check it and click Send."))+ func draftBody(to recipient: String, about instruction: String) async -> String? {+ await VoiceBrain.draftMail(to: recipient, about: instruction)+ }++ func showMailCard(to address: String, subject: String, body: String, file: URL?) {+ let app = AppState.shared+ app.voiceMailDraft = VoiceMailDraft(to: address, subject: subject, body: body)+ app.droppedFile = file.map { DroppedFile(url: $0, name: $0.lastPathComponent) }+ NotificationCenter.default.post(name: .voiceShowMailCard, object: nil)+ }++ // MARK: Web search (opt-in, the user's Anthropic key)++ var webSearchEnabled: Bool { VoiceSettings.webSearchEnabled }+ var hasWebKey: Bool { !(ClaudeService.shared.apiKey ?? "").isEmpty }++ func webAnswer(_ question: String, history: [VoiceWebTurn], french: Bool) async -> String? {+ await ClaudeService.shared.voiceAnswer(question, history: history, french: french)}// MARK: Appsdiff --git a/NotchBuddy/Sources/App/Voice/VoiceEngine.swift b/NotchBuddy/Sources/App/Voice/VoiceEngine.swiftindex 1813a9fd..058e3a81 100644--- a/NotchBuddy/Sources/App/Voice/VoiceEngine.swift+++ b/NotchBuddy/Sources/App/Voice/VoiceEngine.swift@@ -136,10 +136,10 @@ final class VoiceEngine: ObservableObject {/// Start the next conversation turn (re-listen for 8 s without wake phrase)./// Called by IslandWindowController after showing a command result.- func startConversationTurn() {+ func startConversationTurn(firstWordTimeout: TimeInterval = 8.0) {isInConversation = trueaudio?.resetVAD()- startListeningDirectly(firstWordTimeout: 8.0)+ startListeningDirectly(firstWordTimeout: firstWordTimeout)}/// End the conversation window and return to normal wake-phrase mode.@@ -189,7 +189,8 @@ final class VoiceEngine: ObservableObject {Task { @MainActor in self?.endCommand(postFinished: true) }}commandMaxWork = maxItem- DispatchQueue.main.asyncAfter(deadline: .now() + Self.directListenMaxTime, execute: maxItem)+ DispatchQueue.main.asyncAfter(deadline: .now() + max(Self.directListenMaxTime, firstWordTimeout + 10),+ execute: maxItem)}/// Locale used for the current recognition session — nil if pipeline is not running.diff --git a/NotchBuddy/Sources/App/Voice/VoiceGenderNames.swift b/NotchBuddy/Sources/App/Voice/VoiceGenderNames.swiftnew file mode 100644index 00000000..8dc64c42--- /dev/null+++ b/NotchBuddy/Sources/App/Voice/VoiceGenderNames.swift@@ -0,0 +1,41 @@+#if !APPSTORE+import Foundation++// MARK: - VoiceGenderNames+//+// macOS often reports no gender for Premium and Siri voices, so "female" in Settings+// could still give Jamie. The identifier ("…siri_female_en-US…") or the voice's first+// name tells it instead. Pure Foundation: compiled by scripts/test-voice-gender.sh.+enum VoiceGenderNames {+ static let female: Set<String> = [+ // English+ "ava", "allison", "samantha", "susan", "victoria", "zoe", "karen", "kate", "moira", "serena",+ "tessa", "fiona", "veena", "isha", "catherine", "nicky", "joelle", "noelle", "kathy", "vicki",+ "agnes", "shelley", "sandy", "flo", "grandma", "martha", "stephanie", "siobhan", "matilda",+ "lee-ann", "princess", "kyoko", "sara", "helena",+ // French+ "amelie", "audrey", "aurelie", "marie", "virginie", "chantal", "juliette", "julie", "celine",+ "charlotte", "louise",+ ]+ static let male: Set<String> = [+ // English+ "alex", "aaron", "arthur", "daniel", "evan", "fred", "gordon", "lee", "malcolm", "nathan",+ "oliver", "reed", "rishi", "ralph", "tom", "jamie", "junior", "rocko", "eddy", "albert",+ "bruce", "grandpa", "james", "noah",+ // French+ "thomas", "nicolas", "jacques", "henri", "felix", "antoine", "sebastien",+ ]++ /// "female", "male", or nil when nothing tells.+ static func gender(name: String, identifier: String) -> String? {+ let id = identifier.lowercased()+ if id.contains("female") { return "female" }+ if id.contains("_male") || id.contains(".male") || id.contains("-male") { return "male" }+ let first = name.split(whereSeparator: { $0 == " " || $0 == "(" }).first.map(String.init) ?? name+ let key = first.folding(options: [.diacriticInsensitive, .caseInsensitive], locale: nil)+ if female.contains(key) { return "female" }+ if male.contains(key) { return "male" }+ return nil+ }+}+#endifdiff --git a/NotchBuddy/Sources/App/Voice/VoiceIntent.swift b/NotchBuddy/Sources/App/Voice/VoiceIntent.swiftindex b2aa75d1..c6818fe2 100644--- a/NotchBuddy/Sources/App/Voice/VoiceIntent.swift+++ b/NotchBuddy/Sources/App/Voice/VoiceIntent.swift@@ -42,6 +42,7 @@ enum VoiceIntent: Equatable {case query(VoiceTopic) // "combien d'étoiles sur GitHub ?"case mail(VoiceQuery.MailRequest) // "envoie le fichier X à Tana" (Mail opens, I click Send)case openApp(name: String) // "ouvre Figma"+ case webSearch(query: String) // "cherche sur internet …" (Claude + web search, opt-in)// ── Unknown ───────────────────────────────────────────────────────────────@@ -70,7 +71,10 @@ struct PendingVoiceQuestion {case whichPill(add: Bool) // "ajoute…" with no pill named: which one?case whichPlaylist // "lance ma playlist": which playlist?case switchLanguage(to: String) // "You're speaking French. Want me to answer in French?"+ case mailStep(MailField) // guided email: who, subject, text, attachment+ case webQuery // "cherche sur internet" with nothing after: what?}+ enum MailField: Equatable { case recipient, subject, body, attachment }let kind: Kindlet text: String/// True once Coucou has asked the question a second time (it never asks a third time).diff --git a/NotchBuddy/Sources/App/Voice/VoiceQuery.swift b/NotchBuddy/Sources/App/Voice/VoiceQuery.swiftindex 268d4053..4420e646 100644--- a/NotchBuddy/Sources/App/Voice/VoiceQuery.swift+++ b/NotchBuddy/Sources/App/Voice/VoiceQuery.swift@@ -152,7 +152,11 @@ enum VoiceQuery {let isMail = n.contains(where: { mailWords.contains($0) }) || ["email", "mail"].contains(n[v])guard isMail || n.contains(where: { fileWords.contains($0) }) else { return nil }- guard let to = n.lastIndex(where: { $0 == "a" || $0 == "to" }), to > v, to + 1 < n.count else { return nil }+ // No "à / to": a guided mail — Coucou asks who, the subject, the text, an attachment.+ guard let to = n.lastIndex(where: { $0 == "a" || $0 == "to" }), to > v, to + 1 < n.count else {+ guard isMail else { return nil }+ return MailRequest(recipient: "", file: nil, folder: nil, subject: subject, body: bodyText)+ }let after = Array(r[(to + 1)...])var recipientWords: [String] = []var rest: [String] = []@@ -209,6 +213,73 @@ enum VoiceQuery {subject: subject, body: bodyText, instruction: instruction)}+ // MARK: Guided email answers++ /// "c'est Tana", "à tana arobase gmail point com", "send it to Paul" → "Tana" / "[email protected]" / "Paul".+ static func recipientAnswer(_ raw: String) -> String {+ var t = stripLead(raw, ["envoie le à", "envoie-le à", "envoie la à", "envoie-la à", "send it to", "it's for",+ "c'est pour", "c'est", "c est", "it's", "its", "to", "à", "a", "pour", "for", "the", "le", "la"])+ t = t.trimmingCharacters(in: CharacterSet(charactersIn: " .,;:!?"))+ return spokenEmail(t) ?? t+ }++ /// "l'objet c'est Voilà votre image" → "Voilà votre image"; "pas d'objet" / "no subject" → "".+ static func subjectAnswer(_ raw: String) -> String {+ let n = IntentParser.normalise(raw)+ if ["pas d objet", "aucun objet", "sans objet", "no subject", "none", "rien", "nothing", "pas d objet merci"].contains(n) { return "" }+ return stripLead(raw, ["l'objet c'est", "l'objet est", "l'objet", "objet", "en objet", "the subject is", "subject is",+ "subject", "c'est", "it's", "mets", "put", "write"])+ .trimmingCharacters(in: CharacterSet(charactersIn: " .,;:!?\"«»“”"))+ }++ /// The message text, or nil when it is a request to write it ("écris-lui que…", "write something nice").+ static func bodyAnswer(_ raw: String) -> (body: String?, instruction: String?) {+ let n = IntentParser.normalise(raw)+ let draftLeads = ["ecris lui", "ecris", "redige", "redige lui", "dis lui", "write", "tell her", "tell him",+ "tell them", "say that", "fais un message", "fais lui", "make it", "draft"]+ if draftLeads.contains(where: { n.hasPrefix($0 + " ") || n == $0 }) || n.contains("pour lui dire") {+ let what = stripLead(raw, ["écris-lui un message pour lui dire", "écris-lui pour lui dire", "écris-lui que", "écris-lui",+ "écris un message pour lui dire", "écris que", "écris", "ecris", "rédige-lui", "rédige",+ "dis-lui que", "dis-lui", "write her that", "write him that", "write that", "write",+ "tell her that", "tell him that", "tell her", "tell him", "say that", "draft"])+ return (nil, what.isEmpty ? raw : what)+ }+ return (stripLead(raw, ["le message c'est", "le message", "message", "c'est", "the message is", "it says", "body"])+ .trimmingCharacters(in: CharacterSet(charactersIn: " :;\"«»“”")), nil)+ }++ /// "oui, Goku.png" / "yes the file called invoice" → "Goku.png" / "invoice"; nil for "no".+ static func attachmentAnswer(_ raw: String) -> String? {+ var t = stripLead(raw, ["oui", "ouais", "yes", "yeah", "c'est", "it's", "le fichier qui s'appelle", "l'image qui s'appelle",+ "le fichier", "l'image", "la photo", "the file called", "the image called", "the file", "the image",+ "attach", "joins", "joint"])+ t = t.trimmingCharacters(in: CharacterSet(charactersIn: " ,;:!?"))+ if t.hasSuffix(".") && !t.dropLast().contains(".") { t.removeLast() }+ // "goku point png" → "goku.png"+ for ext in ["png", "jpg", "jpeg", "pdf", "heic", "gif", "mov", "mp4", "docx", "zip", "txt"] {+ t = t.replacingOccurrences(of: " point \(ext)", with: ".\(ext)", options: .caseInsensitive)+ .replacingOccurrences(of: " dot \(ext)", with: ".\(ext)", options: .caseInsensitive)+ }+ return t.isEmpty ? nil : t+ }++ /// Drops the first matching lead phrase (case/diacritic-insensitive, whole words), repeatedly.+ static func stripLead(_ raw: String, _ leads: [String]) -> String {+ var t = raw.trimmingCharacters(in: .whitespacesAndNewlines)+ var changed = true+ while changed {+ changed = false+ t = t.trimmingCharacters(in: CharacterSet(charactersIn: " ,:;-–—").union(.whitespaces))+ for l in leads.sorted(by: { $0.count > $1.count }) {+ guard let r = t.range(of: l, options: [.caseInsensitive, .diacriticInsensitive, .anchored]) else { continue }+ if r.upperBound == t.endIndex || !t[r.upperBound].isLetter {+ t = String(t[r.upperBound...]); changed = true; break+ }+ }+ }+ return t.trimmingCharacters(in: .whitespacesAndNewlines)+ }+/// "tana arobase gmail point com" / "tana at gmail dot com" / "[email protected]." → "[email protected]".static func spokenEmail(_ s: String) -> String? {var t = " " + s.lowercased() + " "@@ -264,6 +335,129 @@ enum VoiceQuery {return t.isEmpty ? nil : t}+ // MARK: Web search: "cherche sur internet qui a gagné hier", "search the web for…"++ /// The question in an explicit web search, "" when nothing follows ("cherche sur+ /// internet"), nil when the phrase is not a web search. Leading and trailing words+ /// ("cherche", "sur internet", "for me"…) are removed; the rest keeps its spelling.+ static func webQuery(of raw: String) -> String? {+ let toks = tokens(raw)+ let n = toks.map { $0.norm }+ guard !n.isEmpty else { return nil }+ let joined = " " + n.joined(separator: " ") + " "+ let webWords = [" internet ", " web ", " google ", " googler ", " en ligne ", " online ", " look up ", " look it up "]+ guard webWords.contains(where: { joined.contains($0) }) else { return nil }+ let verbs: Set<String> = ["cherche", "cherches", "chercher", "recherche", "recherches", "rechercher",+ "regarde", "regardes", "regarder", "trouve", "trouves", "trouver",+ "search", "look", "find", "check", "fais", "faire"]+ // "Google" is a verb only first ("Google the weather…"), not in "ouvre Google Chrome".+ guard n.contains(where: { verbs.contains($0) }) || ["google", "googler"].contains(n[0]) else { return nil }++ let heads: [[String]] = [+ ["est", "ce", "que", "tu", "pourrais"], ["est", "ce", "que", "tu", "peux"], ["je", "veux", "que", "tu"],+ ["i", "want", "you", "to"], ["tu", "pourrais"], ["pourrais", "tu"], ["tu", "peux"], ["peux", "tu"],+ ["can", "you"], ["could", "you"], ["would", "you"],+ ["ok"], ["okay"], ["coucou"], ["hey"], ["dis"], ["alors"], ["bon"], ["euh"], ["please"], ["stp"],+ ["fais", "moi", "une", "recherche"], ["fais", "une", "recherche"], ["faire", "une", "recherche"],+ ["fais", "des", "recherches"], ["do", "a", "web", "search"], ["do", "a", "search"],+ ["recherche", "internet"], ["recherche"], ["recherches"], ["rechercher"],+ ["cherche", "moi"], ["cherche"], ["cherches"], ["chercher"], ["regarde"], ["regardes"], ["regarder"],+ ["trouve", "moi"], ["trouve"], ["trouver"], ["search"], ["look", "it", "up"], ["look", "up"],+ ["google"], ["googler"], ["find", "out"], ["find"], ["check"],+ ["sur", "internet"], ["sur", "le", "web"], ["sur", "google"], ["en", "ligne"], ["internet"],+ ["on", "the", "internet"], ["on", "the", "web"], ["the", "internet"], ["the", "web"], ["online"],+ ["on", "google"], ["le", "web"],+ ["des", "informations", "sur"], ["des", "infos", "sur"], ["infos", "sur"], ["information", "about"],+ ["info", "about"], ["info", "on"], ["for", "me"], ["pour", "moi"], ["moi"], ["me"], ["for"],+ ["about"], ["sur"],+ ]+ let tails: [[String]] = [+ ["sur", "internet"], ["sur", "le", "web"], ["sur", "google"], ["en", "ligne"], ["on", "the", "internet"],+ ["on", "the", "web"], ["on", "internet"], ["on", "google"], ["online"], ["internet"],+ ["s", "il", "te", "plait"], ["s", "il", "vous", "plait"], ["stp"], ["please"], ["pour", "moi"],+ ["for", "me"], ["merci"], ["thanks"], ["thank", "you"],+ ]+ var h = 0, t = n.count+ var changed = true+ while changed && h < t {+ changed = false+ for seq in heads where h + seq.count <= t && Array(n[h..<(h + seq.count)]) == seq {+ h += seq.count; changed = true; break+ }+ for seq in tails where t - seq.count >= h && Array(n[(t - seq.count)..<t]) == seq {+ t -= seq.count; changed = true; break+ }+ }+ guard h < t else { return "" }+ return String(raw[toks[h].range.lowerBound..<toks[t - 1].range.upperBound])+ .trimmingCharacters(in: .whitespacesAndNewlines.union(.punctuationCharacters))+ }++ /// A question rather than a command: "qui a gagné hier ?", "what's the capital of…",+ /// "c'est quoi…". Requests ("tu peux…", "can you…") are not questions.+ static func looksLikeQuestion(_ raw: String) -> Bool {+ let trimmed = raw.trimmingCharacters(in: .whitespacesAndNewlines)+ var n = IntentParser.normalise(trimmed).split(separator: " ").map(String.init)+ while let f = n.first, n.count > 1,+ ["ok", "okay", "coucou", "hey", "alors", "bon", "euh", "et", "and", "so", "mais", "but"].contains(f) {+ n.removeFirst()+ }+ guard let first = n.first else { return false }+ let joined = n.joined(separator: " ")+ let requests = ["tu peux", "peux tu", "est ce que tu peux", "est ce que tu pourrais", "tu pourrais",+ "pourrais tu", "can you", "could you", "would you", "will you", "please"]+ if requests.contains(where: { joined == $0 || joined.hasPrefix($0 + " ") }) { return false }+ if trimmed.hasSuffix("?") || trimmed.hasSuffix("?") { return true }+ let starters: Set<String> = ["what", "who", "when", "where", "why", "how", "which", "whose",+ "is", "are", "was", "were", "does", "did",+ "qui", "quoi", "quand", "pourquoi", "comment", "combien",+ "quel", "quelle", "quels", "quelles", "explain", "explique", "raconte"]+ if starters.contains(first) { return true }+ let phrases = ["qu est ce", "c est quoi", "c est qui", "est ce que", "est ce qu", "tell me", "dis moi",+ "parle moi", "ou est", "ou sont", "ou se", "ou en est"]+ return phrases.contains(where: { joined == $0 || joined.hasPrefix($0 + " ") })+ }++ /// Text Coucou can say aloud: no markdown, links, URLs, citation marks or bullets.+ static func spokenText(_ s: String) -> String {+ var t = s+ func sub(_ pattern: String, _ with: String) {+ t = t.replacingOccurrences(of: pattern, with: with, options: .regularExpression)+ }+ sub(#"\[([^\]]+)\]\((?:[^)]*)\)"#, "$1") // [text](url) → text+ sub(#"https?://\S+"#, "") // bare URLs+ sub(#"\[\d+(?:,\s*\d+)*\]"#, "") // [1], [2, 3]+ sub(#"(?m)^\s{0,3}#{1,6}\s*"#, "") // headings+ sub(#"(?m)^\s*(?:[-*•]|\d+[.)])\s+"#, "") // bullets, numbered lists+ sub(#"\*\*|__|\*|`"#, "") // bold, italics, code+ sub(#"\s*\n+\s*"#, " ")+ sub(#"\s{2,}"#, " ")+ sub(#"\s+([.,;:!?])"#, "$1")+ return t.trimmingCharacters(in: .whitespacesAndNewlines)+ }++ /// Words of `raw` split like IntentParser.normalise, each with its normalised form and+ /// its range in `raw` (to cut the original text, apostrophes and accents kept).+ static func tokens(_ raw: String) -> [(norm: String, range: Range<String.Index>)] {+ var out: [(norm: String, range: Range<String.Index>)] = []+ var start: String.Index? = nil+ var i = raw.startIndex+ func close(_ end: String.Index) {+ guard let s = start else { return }+ let norm = IntentParser.normalise(String(raw[s..<end]))+ if !norm.isEmpty { out.append((norm, s..<end)) }+ start = nil+ }+ while i < raw.endIndex {+ let c = raw[i]+ if c == " " || c == "'" || c == "\u{2019}" || c == "-" || c.isNewline { close(i) }+ else if start == nil { start = i }+ i = raw.index(after: i)+ }+ close(raw.endIndex)+ return out+ }+// MARK: Open an app: "ouvre Figma", "open Safari"static func appToOpen(_ raw: String) -> String? {diff --git a/NotchBuddy/Sources/App/Voice/VoiceSettings.swift b/NotchBuddy/Sources/App/Voice/VoiceSettings.swiftindex a04969e3..fd09b344 100644--- a/NotchBuddy/Sources/App/Voice/VoiceSettings.swift+++ b/NotchBuddy/Sources/App/Voice/VoiceSettings.swift@@ -66,6 +66,24 @@ enum VoiceSettings {set { UserDefaults.standard.set(newValue, forKey: "voiceElevenGender") }}+ /// Mac voice pitch per voice type (Settings → Voice). The male default is higher than+ /// the voice's own, so it sounds younger. Range 0.8–1.6 (AVSpeech accepts 0.5–2).+ static let defaultPitchFemale = 1.1+ static let defaultPitchMale = 1.25+ static func pitchKey(for gender: String) -> String { gender == "male" ? "voicePitchMale" : "voicePitchFemale" }+ static func pitch(for gender: String) -> Double {+ let v = UserDefaults.standard.double(forKey: pitchKey(for: gender))+ let fallback = gender == "male" ? defaultPitchMale : defaultPitchFemale+ return v == 0 ? fallback : min(1.6, max(0.8, v))+ }++ /// Questions answered with a web search by Claude, with the user's own Anthropic API+ /// key. Off by default: the question leaves the Mac only once this is turned on.+ static var webSearchEnabled: Bool {+ get { UserDefaults.standard.bool(forKey: "voiceWebSearchEnabled") }+ set { UserDefaults.standard.set(newValue, forKey: "voiceWebSearchEnabled") }+ }+/// Weather by voice (Open-Meteo, no key). Off by default: network only when the user/// turned it on and set a city.static var weatherEnabled: Bool {diff --git a/NotchBuddy/Sources/App/Voice/VoiceSpeaker.swift b/NotchBuddy/Sources/App/Voice/VoiceSpeaker.swiftindex 8a484f9a..ebca40ee 100644--- a/NotchBuddy/Sources/App/Voice/VoiceSpeaker.swift+++ b/NotchBuddy/Sources/App/Voice/VoiceSpeaker.swift@@ -101,9 +101,11 @@ final class VoiceSpeaker: NSObject, AVSpeechSynthesizerDelegate, AVAudioPlayerDeprivate func speakSystem(_ text: String, locale: Locale?) {let utt = AVSpeechUtterance(string: text)- utt.pitchMultiplier = 1.15+ let gender = VoiceSettings.elevenGender+ // Pitch per voice type (Settings → Voice): the male voice a bit higher sounds younger.+ utt.pitchMultiplier = Float(VoiceSettings.pitch(for: gender))utt.rate = AVSpeechUtteranceDefaultSpeechRate * 1.1- utt.voice = Self.bestVoice(for: locale, gender: VoiceSettings.elevenGender)+ utt.voice = Self.bestVoice(for: locale, gender: gender)currentUtterance = uttsynth.speak(utt)}@@ -128,6 +130,7 @@ final class VoiceSpeaker: NSObject, AVSpeechSynthesizerDelegate, AVAudioPlayerDe/// quality first (.premium > .enhanced > default — Ava Premium beats a compact US voice),/// then same region. Novelty voices and the user's Personal Voice are never used./// Falls back to any gender when none of the chosen one is installed.+ /// Premium and Siri voices often report no gender: their name tells it instead.static func bestVoice(for locale: Locale?, gender: String) -> AVSpeechSynthesisVoice? {guard let loc = locale else { return nil }let lang = loc.language.languageCode?.identifier ?? ""@@ -141,7 +144,8 @@ final class VoiceSpeaker: NSObject, AVSpeechSynthesizerDelegate, AVAudioPlayerDe}guard !voices.isEmpty else { return AVSpeechSynthesisVoice(language: exact ?? lang) }let wanted: AVSpeechSynthesisVoiceGender = gender == "male" ? .male : .female- let pool = voices.contains { $0.gender == wanted } ? voices.filter { $0.gender == wanted } : voices+ let ofGender = voices.filter { gender(of: $0) == wanted }+ let pool = ofGender.isEmpty ? voices : ofGenderfunc rank(_ v: AVSpeechSynthesisVoice) -> (Int, Int) {(v.quality.rawValue, v.language == exact ? 1 : 0)@@ -149,6 +153,17 @@ final class VoiceSpeaker: NSObject, AVSpeechSynthesizerDelegate, AVAudioPlayerDereturn pool.max { rank($0) < rank($1) }}+ /// The voice's gender, from the system when it says, else from its identifier+ /// ("siri_female_…") or its first name (Ava, Zoe… / Jamie, Evan…).+ static func gender(of v: AVSpeechSynthesisVoice) -> AVSpeechSynthesisVoiceGender {+ if v.gender != .unspecified { return v.gender }+ switch VoiceGenderNames.gender(name: v.name, identifier: v.identifier) {+ case "female": return .female+ case "male": return .male+ default: return .unspecified+ }+ }+/// "Ava (Premium)" — shown in Settings so it is clear which voice Coucou uses.static func macVoiceName(for locale: Locale, gender: String) -> String {guard let v = bestVoice(for: locale, gender: gender) else { return "—" }diff --git a/docs/VOICE.md b/docs/VOICE.mdindex 6086f12e..d09e18e7 100644--- a/docs/VOICE.md+++ b/docs/VOICE.md@@ -66,6 +66,18 @@ avec ses tests comme les autres transitions.| 9 | **Minuteurs et rappels** | « rappelle-moi dans 20 minutes de sortir le linge », « minuteur 5 minutes » | Rappel local, Mochi l'annonce dans le notch (+ notification) | Non || 10 | **Questions** | « est-ce que la CI est verte ? », « combien j'ai vendu aujourd'hui ? », « il me reste combien sur mon plan Claude ? », « c'est quoi la commande pour annuler un commit ? » | État de Coucou et des services déjà lus (GitHub, Vercel, Stripe, Resend, n8n, usage Claude) ; questions générales par `VoiceBrain` sur l'appareil | Non. Réponse en texte dans l'île |+**E-mail guidé (fonction 4, version actuelle).** « Envoie un mail » → Coucou demande à qui (nom de contact ou+adresse épelée), l'objet, le texte (ou « écris-lui que… » : le modèle local rédige), puis « une pièce jointe ? » : on glisse+le fichier sur le notch (ou « non »). Les étapes déjà dites dans la première phrase sont sautées ; « annule » arrête tout.+La carte mail de l'île s'ouvre remplie et reste ouverte jusqu'au clic : Envoyer passe par Apple Mail (AppleScript),+Annuler ferme. Rien ne part sans ce clic.++**Recherche web (opt-in).** Réglages → Voix → « Répondre aux questions avec une recherche web », visible avec une clé+Anthropic. Une question que ni les pilules ni les services ne couvrent (« qui a gagné hier ? », « c'est quoi… ») ou une+demande explicite (« cherche sur internet… », « search the web for… ») part chez Claude (Haiku, outil `web_search`)+avec les derniers échanges de la conversation, en mémoire seulement, oubliés après 90 s. Réponse courte lue à voix haute ;+quand il y a plus à dire, elle finit par une question et Coucou réécoute : on peut continuer le sujet.+Bonus (après les 10) : Mochi et l'app à la voix (« mets-toi en pirate », « coupe les sons », « ne pas déranger »),routines (« mode focus » = playlist + ne pas déranger + pilules de travail).diff --git a/docs/privacy.html b/docs/privacy.htmlindex e52fe670..076b780c 100644--- a/docs/privacy.html+++ b/docs/privacy.html@@ -33,6 +33,7 @@<li><b>OpenAI</b> <i>(macOS)</i> — when you chat using OpenAI, the text you type and the current conversation are sent to the OpenAI API. If you attached a window, the app name, title and URL are also sent. If you attached a file, only its name is sent (file content is only sent to Anthropic or to a local model server you connected). The list of available models is fetched when you open the chat. <a href="https://openai.com/policies/privacy-policy">OpenAI privacy policy</a>.</li><li><b>Ollama / LM Studio</b> <i>(macOS)</i> — when you chat using a local model, the text you type, the current conversation, and the content of any attached text file (up to 24 000 characters) are sent to the server address you configured in Settings → Chat → Local models. By default that address is <code>127.0.0.1</code> on your Mac — nothing leaves your computer. If you point it at a remote server, that server receives the data. The server address is stored in your Mac's user preferences (not the Keychain). The list of available models is fetched each time you open the model picker.</li><li><b>Stripe, GitHub, Vercel, Resend, Notion, Cal.com, n8n</b> — Coucou reads data from your own accounts (payments, repositories, deployments, emails, pages, bookings, workflow runs) to display them. For GitHub specifically, Coucou also reads your open pull requests, reviews requested on you, CI status of your repositories' default branches, and your contribution calendar (the green squares on your profile); this data is kept in memory only and deleted when the app quits. Coucou only reads from them.</li>+<li><b>Voice: « OK Coucou »</b> <i>(macOS, GitHub build, off by default)</i> — what you say is recognized on your Mac and never recorded or saved. Only if you turn them on in Settings → Voice: with <b>ElevenLabs</b> as the voice, the text of Coucou’s answers is sent to ElevenLabs with your key to be spoken (<a href="https://elevenlabs.io/privacy-policy">ElevenLabs privacy policy</a>); with <b>Weather by voice</b>, the city you entered is sent to Open-Meteo when you ask; with <b>Answer questions with a web search</b>, a question your pills can’t answer, and the previous questions and answers of the same conversation, are sent to Anthropic with your key, and Anthropic searches the web for it. An email prepared by voice is sent from Apple Mail only when you click Send.</li></ul><p>We have no access to these requests or their responses.</p>diff --git a/scripts/test-voice-gender.sh b/scripts/test-voice-gender.shnew file mode 100755index 00000000..c5929a83--- /dev/null+++ b/scripts/test-voice-gender.sh@@ -0,0 +1,7 @@+#!/usr/bin/env bash+set -e+echo "Running VoiceGenderNames tests…"+swiftc -o /tmp/voice-gender-tests \+ NotchBuddy/Sources/App/Voice/VoiceGenderNames.swift \+ tests/VoiceGenderTests.swift+/tmp/voice-gender-testsdiff --git a/tests/VoiceActionRunnerTests.swift b/tests/VoiceActionRunnerTests.swiftindex 39873516..46c97312 100644--- a/tests/VoiceActionRunnerTests.swift+++ b/tests/VoiceActionRunnerTests.swift@@ -235,6 +235,84 @@ enum VoiceActionRunnerTests {runner.pendingQuestion = nilrunner.commandLocale = nil+ // ── Guided email: who → subject → text → attachment → card ────────────+ let info = TestInfo()+ runner.info = info+ runner.commandLocale = Locale(identifier: "en-US")+ var r = await runner.run(.mail(VoiceQuery.MailRequest(recipient: "", file: nil, folder: nil)), availablePills: pills)+ check("mail asks who", r.message.contains("Who should I send it to"), true)+ r = await runner.handleAnswer("it's Tana", availablePills: pills)+ check("mail asks subject", r.message.contains("subject"), true)+ r = await runner.handleAnswer("the subject is Here is your image", availablePills: pills)+ check("mail asks text", r.message.contains("What should the message say"), true)+ r = await runner.handleAnswer("write her that the image is in 1980 by 1080", availablePills: pills)+ check("mail asks attachment", r.message.contains("Any attachment"), true)+ check("waiting for a drop", runner.isWaitingForAttachment, true)+ r = await runner.attachDroppedFile(URL(fileURLWithPath: "/tmp/Goku.png"))+ check("mail card shown", info.card?.to, "[email protected]")+ check("mail card subject", info.card?.subject, "Here is your image")+ check("mail card drafted body", info.card?.body, "DRAFT: the image is in 1980 by 1080")+ check("mail card file", info.card?.file?.lastPathComponent, "Goku.png")+ check("mail done message", r.message.contains("Check it and click Send"), true)++ // Everything in one sentence → straight to the attachment question, "no" → card+ info.card = nil+ r = await runner.run(.mail(VoiceQuery.MailRequest(recipient: "[email protected]", file: nil, folder: nil,+ subject: "Hi", body: "Hello")), availablePills: pills)+ check("one sentence → attachment question", r.message.contains("Any attachment"), true)+ r = await runner.handleAnswer("no", availablePills: pills)+ check("no attachment → card", info.card?.to, "[email protected]")++ // Unknown contact → asks the address+ info.card = nil+ r = await runner.run(.mail(VoiceQuery.MailRequest(recipient: "Intel", file: nil, folder: nil)), availablePills: pills)+ check("unknown contact → asks address", r.message.contains("can't find Intel"), true)+ r = await runner.handleAnswer("tana at gmail dot com", availablePills: pills)+ check("spoken address accepted", r.message.contains("subject"), true)+ check("mail in progress", runner.isMailInProgress, true)+ check("not waiting for a file yet", runner.isWaitingForAttachment, false)+ // A file dropped while asked the subject → kept, the subject is asked again+ r = await runner.attachDroppedFile(URL(fileURLWithPath: "/tmp/Goku.png"))+ check("early drop → asks subject again", r.message.contains("subject"), true)+ r = await runner.handleAnswer("Hello", availablePills: pills)+ r = await runner.handleAnswer("just saying hi", availablePills: pills)+ check("early drop → no attachment question", info.card?.file?.lastPathComponent, "Goku.png")+ // "Cancel" stops the mail at any step+ info.card = nil+ _ = await runner.run(.mail(VoiceQuery.MailRequest(recipient: "", file: nil, folder: nil)), availablePills: pills)+ r = await runner.handleAnswer("cancel", availablePills: pills)+ check("cancel → cancelled", r.message.contains("cancelled"), true)+ check("cancel → no card", info.card == nil, true)+ check("cancel → no pending", runner.pendingQuestion == nil, true)+ check("cancelsMail laisse tomber", VoiceActionRunner.cancelsMail("Laisse tomber"), true)+ check("cancelsMail not a subject", VoiceActionRunner.cancelsMail("cancel the meeting"), false)+ runner.pendingQuestion = nil++ // ── Web search: answer, follow-up keeps the history, off / no key ─────+ runner.resetWebThread()+ r = await runner.run(.webSearch(query: "who won the Euro"), availablePills: pills)+ check("web answer", r.message, "Spain won. Want the details?")+ check("web thread started", runner.hasWebThread, true)+ r = await runner.run(.webSearch(query: "yes"), availablePills: pills)+ check("follow-up sends history", info.webCalls.last?.1, 1)+ r = await runner.run(.webSearch(query: ""), availablePills: pills)+ check("empty web query asks", r.message, "What should I look up?")+ r = await runner.handleAnswer("the Louvre opening hours", availablePills: pills)+ check("answer to 'what should I look up' searched", info.webCalls.last?.0, "the Louvre opening hours")+ info.webReply = nil+ r = await runner.run(.webSearch(query: "x"), availablePills: pills)+ check("web failure", r.outcome, .failure)+ info.webReply = "ok"+ info.webSearchEnabled = false+ r = await runner.run(.webSearch(query: "x"), availablePills: pills)+ check("web off → says how to turn on", r.message.contains("Turn it on in Settings"), true)+ info.hasWebKey = false+ r = await runner.run(.webSearch(query: "x"), availablePills: pills)+ check("no key → asks for key", r.message.contains("Anthropic API key"), true)+ runner.resetWebThread()+ check("web thread reset", runner.hasWebThread, false)+ runner.commandLocale = nil+// ── Pills: add multiple ───────────────────────────────────────────────pills_.active = ["integration_github"]pills_.calls = []@@ -311,3 +389,27 @@ enum VoiceActionRunnerTests {else { print("✗ \(label) — got \(got), want \(want)"); fail += 1 }}}++@MainActor+final class TestInfo: VoiceInfoProviding {+ var card: (to: String, subject: String, body: String, file: URL?)?+ func answer(_ topic: VoiceTopic, locale: Locale?) async -> String { "" }+ func openApp(_ name: String, locale: Locale?) -> VoiceActionResult { .init(outcome: .failure, message: "") }+ func resolveEmail(_ recipient: String) async -> String? {+ if let e = VoiceQuery.spokenEmail(recipient) { return e }+ return recipient == "Tana" ? "[email protected]" : nil+ }+ func findFile(_ name: String, folder: VoiceQuery.MailRequest.Folder?) -> URL? { nil }+ func draftBody(to recipient: String, about instruction: String) async -> String? { "DRAFT: " + instruction }+ func showMailCard(to address: String, subject: String, body: String, file: URL?) {+ card = (address, subject, body, file)+ }+ var webSearchEnabled = true+ var hasWebKey = true+ var webCalls: [(String, Int)] = []+ var webReply: String? = "Spain won. Want the details?"+ func webAnswer(_ question: String, history: [VoiceWebTurn], french: Bool) async -> String? {+ webCalls.append((question, history.count))+ return webReply+ }+}diff --git a/tests/VoiceGenderTests.swift b/tests/VoiceGenderTests.swiftnew file mode 100644index 00000000..04b180ae--- /dev/null+++ b/tests/VoiceGenderTests.swift@@ -0,0 +1,34 @@+import Foundation++// MARK: - VoiceGenderNames tests+//+// Pure test. Compiles with:+// swiftc -o /tmp/voice-gender-tests \+// NotchBuddy/Sources/App/Voice/VoiceGenderNames.swift \+// tests/VoiceGenderTests.swift++@main+enum VoiceGenderTests {+ static var pass = 0+ static var fail = 0++ static func main() {+ check("Ava Premium", VoiceGenderNames.gender(name: "Ava (Premium)", identifier: "com.apple.voice.premium.en-US.Ava"), "female")+ check("Zoe Enhanced", VoiceGenderNames.gender(name: "Zoe (Enhanced)", identifier: "com.apple.voice.enhanced.en-US.Zoe"), "female")+ check("Jamie Premium", VoiceGenderNames.gender(name: "Jamie (Premium)", identifier: "com.apple.voice.premium.en-GB.Jamie"), "male")+ check("Evan", VoiceGenderNames.gender(name: "Evan", identifier: "com.apple.voice.enhanced.en-US.Evan"), "male")+ check("Amélie accent", VoiceGenderNames.gender(name: "Amélie", identifier: "com.apple.voice.compact.fr-CA.Amelie"), "female")+ check("Thomas", VoiceGenderNames.gender(name: "Thomas", identifier: "com.apple.voice.compact.fr-FR.Thomas"), "male")+ check("Siri female id", VoiceGenderNames.gender(name: "Siri Voice 2", identifier: "com.apple.ttsbundle.siri_female_en-US_compact"), "female")+ check("Siri male id", VoiceGenderNames.gender(name: "Siri Voice 1", identifier: "com.apple.ttsbundle.siri_male_en-US_compact"), "male")+ check("unknown", VoiceGenderNames.gender(name: "Zarvox", identifier: "com.apple.speech.synthesis.voice.Zarvox"), nil)++ print("\n\(pass)/\(pass + fail) passed.")+ if fail > 0 { exit(1) }+ }++ static func check<T: Equatable>(_ name: String, _ got: T, _ want: T) {+ if got == want { pass += 1; print("✓ \(name)") }+ else { fail += 1; print("✗ \(name) — got \(got), want \(want)") }+ }+}diff --git a/tests/VoiceQueryTests.swift b/tests/VoiceQueryTests.swiftindex a2e05f2b..daae978c 100644--- a/tests/VoiceQueryTests.swift+++ b/tests/VoiceQueryTests.swift@@ -59,6 +59,17 @@ struct VoiceQueryTests {check("send an email to", VoiceQuery.mail(of: "send an email to Tana"),VoiceQuery.MailRequest(recipient: "Tana", file: nil, folder: nil))check("not a mail", VoiceQuery.mail(of: "envoie la musique"), nil)+ check("guided mail (no recipient)", VoiceQuery.mail(of: "envoie un mail"),+ VoiceQuery.MailRequest(recipient: "", file: nil, folder: nil))+ check("guided mail EN", VoiceQuery.mail(of: "send an email"),+ VoiceQuery.MailRequest(recipient: "", file: nil, folder: nil))+ check("recipient answer", VoiceQuery.recipientAnswer("c'est Tana"), "Tana")+ check("recipient spoken email", VoiceQuery.recipientAnswer("tana arobase gmail point com"), "[email protected]")+ check("subject answer", VoiceQuery.subjectAnswer("l'objet c'est Voilà votre image"), "Voilà votre image")+ check("no subject", VoiceQuery.subjectAnswer("pas d'objet"), "")+ check("body verbatim", VoiceQuery.bodyAnswer("Image en 1980 par 1080").body, "Image en 1980 par 1080")+ check("body draft", VoiceQuery.bodyAnswer("écris-lui que je serai en retard").instruction, "je serai en retard")+ check("attachment name", VoiceQuery.attachmentAnswer("oui, Goku point png"), "Goku.png")// Louis's example, as dictatedcheck("Goku mail", VoiceQuery.mail(of: "Il y a une image qui s'appelle Goku.png. J'aimerais que tu la prennes et que tu l'envoies par mail à [email protected]. En objet, tu écris : Voilà votre image. En description, tu écris : Image en 1980 × 1080."),VoiceQuery.MailRequest(recipient: "[email protected]", file: "Goku.png", folder: nil,@@ -86,6 +97,31 @@ struct VoiceQueryTests {check("open Safari", VoiceQuery.appToOpen("open Safari"), "Safari")check("parse open app", IntentParser.parse("ouvre Figma", pills: pills), .openApp(name: "Figma"))+ // Web search+ check("web fr lead", VoiceQuery.webQuery(of: "cherche sur internet qui a gagné l'Euro"), "qui a gagné l'Euro")+ check("web fr tail", VoiceQuery.webQuery(of: "Cherche les horaires du Louvre sur internet"), "les horaires du Louvre")+ check("web fr recherche", VoiceQuery.webQuery(of: "fais une recherche internet sur Tesla"), "Tesla")+ check("web fr peux-tu", VoiceQuery.webQuery(of: "Est-ce que tu peux chercher sur le web le prix de l'iPhone 17 ?"), "le prix de l'iPhone 17")+ check("web en", VoiceQuery.webQuery(of: "search the web for the latest Apple news"), "the latest Apple news")+ check("web en look up", VoiceQuery.webQuery(of: "can you look up who won the Champions League"), "who won the Champions League")+ check("web google", VoiceQuery.webQuery(of: "Google the weather in Tokyo"), "the weather in Tokyo")+ check("web nothing after", VoiceQuery.webQuery(of: "cherche sur internet"), "")+ check("web not: open Google Chrome", VoiceQuery.webQuery(of: "ouvre Google Chrome"), nil)+ check("web not: plain search", VoiceQuery.webQuery(of: "cherche Daft Punk"), nil)+ check("parse web", IntentParser.parse("cherche sur internet la météo à Tokyo", pills: pills),+ .webSearch(query: "la météo à Tokyo"))+ check("question fr qui", VoiceQuery.looksLikeQuestion("qui a gagné le match hier"), true)+ check("question fr c'est quoi", VoiceQuery.looksLikeQuestion("c'est quoi un trou noir"), true)+ check("question fr et", VoiceQuery.looksLikeQuestion("et à Paris ?"), true)+ check("question en", VoiceQuery.looksLikeQuestion("what's the capital of Australia"), true)+ check("question en how", VoiceQuery.looksLikeQuestion("how tall is the Eiffel Tower"), true)+ check("not a question: request", VoiceQuery.looksLikeQuestion("tu peux mettre de la musique ?"), false)+ check("not a question: can you", VoiceQuery.looksLikeQuestion("can you play something chill"), false)+ check("not a question: command", VoiceQuery.looksLikeQuestion("mets du Daft Punk"), false)+ check("spoken markdown", VoiceQuery.spokenText("**Spain** won [the Euro](https://uefa.com) [1].\n- Final: 2-1"),+ "Spain won the Euro. Final: 2-1")+ check("spoken url", VoiceQuery.spokenText("See https://example.com for more."), "See for more.")+// ── Answers ───────────────────────────────────────────────────────────var s = VoiceSnapshot()s.stripe = .init(balance: "1 240,00 €", today: "85,00 €", todayCount: 2, last: [])