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
Mail phase 2: the chat acts on the mail, after a click
Claude3772e6e2581f
diff --git a/NotchBuddy/Resources/Localizable.xcstrings b/NotchBuddy/Resources/Localizable.xcstringsindex b808b277..66f7b1aa 100644--- a/NotchBuddy/Resources/Localizable.xcstrings+++ b/NotchBuddy/Resources/Localizable.xcstrings@@ -3940,6 +3940,107 @@}}},+ "hub.mail.sent" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "أرسلها Coucou"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coucou পাঠিয়েছে"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Von Coucou gesendet"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Sent by Coucou"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Enviados por Coucou"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Envoyés par Coucou"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coucou द्वारा भेजे गए"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Dikirim oleh Coucou"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coucou が送信"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coucou가 보낸 메일"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Enviados pelo Coucou"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Отправлено Coucou"+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ส่งโดย Coucou"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coucou tarafından gönderildi"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coucou 已发送"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coucou 已寄出"+ }+ }+ }+ },"hub.mail.stat.important" : {"extractionState" : "manual","localizations" : {@@ -5152,6 +5253,208 @@}}},+ "mail.chat.toggle" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "البريد"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "মেল"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Mail"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Mail"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Correo"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Mail"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "मेल"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Email"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "メール"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "메일"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "E-mail"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Почта"+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "อีเมล"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Posta"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "邮件"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "郵件"+ }+ }+ }+ },+ "mail.chat.toggle-help" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "يتيح للذكاء الاصطناعي رؤية أحدث رسائلك وتحضير إجراءات عليها. لا يحدث شيء قبل نقرك على تشغيل."+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "AI-কে আপনার সাম্প্রতিক মেল দেখতে ও কাজ প্রস্তুত করতে দেয়। চালান-এ ক্লিক না করা পর্যন্ত কিছুই হয় না।"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Lässt die KI deine neuesten E-Mails sehen und Aktionen dafür vorbereiten. Nichts passiert, bevor du auf Ausführen klickst."+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Lets the AI see your latest messages and prepare actions on them. Nothing happens until you click Run."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Deja que la IA vea tus últimos correos y prepare acciones. No pasa nada hasta que pulses Ejecutar."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Laisse l’IA voir tes derniers mails et préparer des actions dessus. Rien ne se passe avant ton clic sur Lancer."+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "AI को आपके नए मेल देखने और उन पर कार्रवाइयाँ तैयार करने देता है। चलाएँ पर क्लिक करने तक कुछ नहीं होता।"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "AI bisa melihat email terbarumu dan menyiapkan tindakan. Tidak ada yang terjadi sebelum kamu klik Jalankan."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "AI が最新のメールを見て、操作を準備できるようにします。「実行」をクリックするまで何も起きません。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "AI가 최근 메일을 보고 작업을 준비할 수 있게 합니다. 실행을 누르기 전에는 아무 일도 일어나지 않습니다."+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Deixa a IA ver seus últimos e-mails e preparar ações. Nada acontece até você clicar em Executar."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ИИ видит ваши последние письма и готовит действия. Ничего не происходит, пока вы не нажмёте «Запустить»."+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ให้ AI เห็นอีเมลล่าสุดของคุณและเตรียมการกระทำ จะไม่มีอะไรเกิดขึ้นจนกว่าคุณจะคลิก เรียกใช้"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Yapay zekânın son e-postalarını görmesini ve işlemler hazırlamasını sağlar. Çalıştır’a tıklayana kadar hiçbir şey olmaz."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "让 AI 查看你最近的邮件并准备操作。点击“执行”之前不会发生任何事。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "讓 AI 查看你最近的郵件並準備動作。按下「執行」之前不會發生任何事。"+ }+ }+ }+ },"mail.filter.all" : {"extractionState" : "manual","localizations" : {@@ -6263,6 +6566,1925 @@}}},+ "mail.plan.bad-address" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "عنوان غير صالح"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "অবৈধ ঠিকানা"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ungültige Adresse"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "invalid address"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "dirección no válida"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "adresse invalide"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "अमान्य पता"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "alamat tidak valid"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "無効なアドレス"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "잘못된 주소"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "endereço inválido"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "неверный адрес"+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ที่อยู่ไม่ถูกต้อง"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "geçersiz adres"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "地址无效"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "地址無效"+ }+ }+ }+ },+ "mail.plan.cancel" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "إلغاء"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "বাতিল"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Abbrechen"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Cancel"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Cancelar"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Annuler"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "रद्द करें"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Batal"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "キャンセル"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "취소"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Cancelar"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Отмена"+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ยกเลิก"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "İptal"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "取消"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "取消"+ }+ }+ }+ },+ "mail.plan.cancelled" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "أُلغي"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "বাতিল হয়েছে"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Abgebrochen"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Cancelled"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Cancelado"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Annulé"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "रद्द हुआ"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Dibatalkan"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "キャンセルしました"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "취소됨"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Cancelado"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Отменено"+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ยกเลิกแล้ว"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "İptal edildi"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "已取消"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "已取消"+ }+ }+ }+ },+ "mail.plan.countdown %lld" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "يبدأ خلال %lld ث"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld সেকেন্ডে শুরু"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Start in %lld s"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Starting in %lld s"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Empieza en %lld s"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Lancement dans %lld s"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld सेकंड में शुरू"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Mulai dalam %lld dtk"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld 秒後に開始"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld초 후 시작"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Começa em %lld s"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Запуск через %lld с"+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "เริ่มใน %lld วิ"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld sn içinde başlıyor"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld 秒后开始"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld 秒後開始"+ }+ }+ }+ },+ "mail.plan.done %lld %lld" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "تم %1$lld · فشل %2$lld"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$lld সম্পন্ন · %2$lld ব্যর্থ"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$lld erledigt · %2$lld fehlgeschlagen"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$lld done · %2$lld failed"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$lld hechos · %2$lld fallidos"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$lld faits · %2$lld échecs"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$lld पूरे · %2$lld विफल"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$lld selesai · %2$lld gagal"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "完了 %1$lld · 失敗 %2$lld"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "완료 %1$lld · 실패 %2$lld"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$lld feitos · %2$lld falharam"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Готово: %1$lld · ошибок: %2$lld"+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "สำเร็จ %1$lld · ล้มเหลว %2$lld"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$lld tamam · %2$lld başarısız"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "完成 %1$lld · 失败 %2$lld"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "完成 %1$lld · 失敗 %2$lld"+ }+ }+ }+ },+ "mail.plan.error %@" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "تعذّر على Coucou قراءة الخطة: %@"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coucou পরিকল্পনা পড়তে পারেনি: %@"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coucou konnte den Plan nicht lesen: %@"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coucou could not read the plan: %@"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coucou no pudo leer el plan: %@"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coucou n’a pas pu lire le plan : %@"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coucou योजना नहीं पढ़ सका: %@"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coucou tidak bisa membaca rencananya: %@"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coucou はプランを読み取れませんでした:%@"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coucou가 계획을 읽지 못했습니다: %@"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O Coucou não conseguiu ler o plano: %@"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coucou не смог прочитать план: %@"+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coucou อ่านแผนไม่ได้: %@"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coucou planı okuyamadı: %@"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coucou 无法读取计划:%@"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coucou 無法讀取計畫:%@"+ }+ }+ }+ },+ "mail.plan.file-missing %@" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "الملف غير موجود: %@"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ফাইল পাওয়া যায়নি: %@"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Datei nicht gefunden: %@"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "File not found: %@"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Archivo no encontrado: %@"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Fichier introuvable : %@"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "फ़ाइल नहीं मिली: %@"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "File tidak ditemukan: %@"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ファイルが見つかりません:%@"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "파일을 찾을 수 없음: %@"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Arquivo não encontrado: %@"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Файл не найден: %@"+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ไม่พบไฟล์: %@"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Dosya bulunamadı: %@"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "找不到文件:%@"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "找不到檔案:%@"+ }+ }+ }+ },+ "mail.plan.mails %lld" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld رسالة للإرسال"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "পাঠানোর জন্য %lldটি মেল"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld E-Mails zu senden"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld mails to send"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld correos por enviar"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld mails à envoyer"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "भेजने के लिए %lld मेल"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld email untuk dikirim"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "送信するメール %lld 件"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "보낼 메일 %lld개"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld e-mails para enviar"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Писем к отправке: %lld"+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "อีเมลที่จะส่ง %lld ฉบับ"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Gönderilecek %lld e-posta"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "待发送 %lld 封"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "待寄出 %lld 封"+ }+ }+ }+ },+ "mail.plan.missing %lld" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "الرسالة %lld ليست في القائمة"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "মেল %lld তালিকায় নেই"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "E-Mail %lld ist nicht in der Liste"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Message %lld is not in the list"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "El correo %lld no está en la lista"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Le mail %lld n’est pas dans la liste"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "मेल %lld सूची में नहीं है"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Email %lld tidak ada di daftar"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "メール %lld は一覧にありません"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "메일 %lld이(가) 목록에 없습니다"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O e-mail %lld não está na lista"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Письма %lld нет в списке"+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "อีเมล %lld ไม่อยู่ในรายการ"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%lld numaralı e-posta listede yok"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "邮件 %lld 不在列表中"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "郵件 %lld 不在列表中"+ }+ }+ }+ },+ "mail.plan.no-page" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "لم يُعثر على صفحة"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "কোনো পৃষ্ঠা পাওয়া যায়নি"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "keine Seite gefunden"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "no page found"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ninguna página encontrada"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "aucune page trouvée"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "कोई पेज नहीं मिला"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "halaman tidak ditemukan"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ページが見つかりません"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "페이지 없음"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "nenhuma página encontrada"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "страница не найдена"+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ไม่พบหน้า"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "sayfa bulunamadı"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "找不到页面"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "找不到頁面"+ }+ }+ }+ },+ "mail.plan.no-pdf" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "لا يوجد PDF في تلك الرسالة"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ওই মেলে কোনো PDF নেই"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Keine PDF in dieser E-Mail gefunden"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "No PDF found in that message"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "No hay ningún PDF en ese correo"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Aucun PDF trouvé dans ce mail"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "उस मेल में कोई PDF नहीं मिला"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Tidak ada PDF di email itu"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "このメールに PDF がありません"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "이 메일에 PDF가 없습니다"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nenhum PDF nesse e-mail"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "В этом письме нет PDF"+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ไม่พบ PDF ในอีเมลนั้น"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Bu e-postada PDF yok"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "该邮件中没有 PDF"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "該郵件中沒有 PDF"+ }+ }+ }+ },+ "mail.plan.preparing" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "جارٍ التحضير…"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "প্রস্তুত হচ্ছে…"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Wird vorbereitet …"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Preparing…"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Preparando…"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Préparation…"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "तैयारी हो रही है…"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Menyiapkan…"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "準備中…"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "준비 중…"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Preparando…"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Подготовка…"+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "กำลังเตรียม…"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Hazırlanıyor…"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "正在准备…"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "正在準備…"+ }+ }+ }+ },+ "mail.plan.reply %@" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "مسودة رد على %@"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%@-কে উত্তরের খসড়া"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Antwortentwurf an %@"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Reply draft to %@"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Borrador de respuesta a %@"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Brouillon de réponse à %@"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%@ को जवाब का ड्राफ़्ट"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Draf balasan untuk %@"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%@ への返信の下書き"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%@에게 보낼 답장 초안"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Rascunho de resposta para %@"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Черновик ответа для %@"+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ร่างตอบกลับถึง %@"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%@ için yanıt taslağı"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "回复 %@ 的草稿"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "回覆 %@ 的草稿"+ }+ }+ }+ },+ "mail.plan.run %lld" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "تشغيل (%lld)"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "চালান (%lld)"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Ausführen (%lld)"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Run (%lld)"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Ejecutar (%lld)"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Lancer (%lld)"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "चलाएँ (%lld)"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Jalankan (%lld)"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "実行(%lld)"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "실행 (%lld)"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Executar (%lld)"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Запустить (%lld)"+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "เรียกใช้ (%lld)"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Çalıştır (%lld)"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "执行(%lld)"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "執行(%lld)"+ }+ }+ }+ },+ "mail.plan.save %@ %@" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "حفظ مرفقات %1$@ في %2$@"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$@-এর অ্যাটাচমেন্ট %2$@-এ সংরক্ষণ"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Anhänge von %1$@ in %2$@ sichern"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Save the attachments of %1$@ in %2$@"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Guardar los adjuntos de %1$@ en %2$@"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Enregistrer les PJ de %1$@ dans %2$@"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$@ के अटैचमेंट %2$@ में सहेजें"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Simpan lampiran %1$@ di %2$@"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$@ の添付ファイルを %2$@ に保存"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$@의 첨부 파일을 %2$@에 저장"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Salvar os anexos de %1$@ em %2$@"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Сохранить вложения от %1$@ в %2$@"+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "บันทึกไฟล์แนบของ %1$@ ใน %2$@"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$@ eklerini %2$@ içine kaydet"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "将 %1$@ 的附件保存到 %2$@"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "將 %1$@ 的附件儲存到 %2$@"+ }+ }+ }+ },+ "mail.plan.sort %@ %lld" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$@: %2$lld رسالة"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$@: %2$lldটি মেল"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$@: %2$lld E-Mails"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$@: %2$lld messages"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$@: %2$lld correos"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$@ : %2$lld mails"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$@: %2$lld मेल"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$@: %2$lld email"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$@:%2$lld 件"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$@: 메일 %2$lld개"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$@: %2$lld e-mails"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$@: писем — %2$lld"+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$@: %2$lld ฉบับ"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$@: %2$lld e-posta"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$@:%2$lld 封邮件"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%1$@:%2$lld 封郵件"+ }+ }+ }+ },+ "mail.plan.test" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "أرسل اختبارًا لي"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "আমাকে একটি টেস্ট পাঠান"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Test an mich senden"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Send me a test"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Enviarme una prueba"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "M’envoyer un test"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "मुझे टेस्ट भेजें"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Kirim tes ke saya"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "自分にテスト送信"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "나에게 테스트 보내기"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Enviar um teste para mim"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Отправить тест себе"+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ส่งทดสอบถึงฉัน"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Bana test gönder"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "给我发一封测试"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "寄一封測試給我"+ }+ }+ }+ },+ "mail.plan.test-sent %@" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "أُرسل الاختبار إلى %@"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%@-এ টেস্ট পাঠানো হয়েছে"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Test an %@ gesendet"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Test sent to %@"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Prueba enviada a %@"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Test envoyé à %@"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%@ पर टेस्ट भेजा"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Tes dikirim ke %@"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%@ にテスト送信しました"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%@(으)로 테스트를 보냈습니다"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Teste enviado para %@"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Тест отправлен на %@"+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ส่งทดสอบถึง %@ แล้ว"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Test %@ adresine gönderildi"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "测试已发送到 %@"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "測試已寄到 %@"+ }+ }+ }+ },+ "mail.plan.title" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "خطة البريد"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "মেল পরিকল্পনা"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Mail-Plan"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Mail plan"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Plan de correo"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Plan mail"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "मेल योजना"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Rencana email"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "メールのプラン"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "메일 계획"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Plano de e-mail"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "План для почты"+ }+ },+ "th" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "แผนอีเมล"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Posta planı"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "邮件计划"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "郵件計畫"+ }+ }+ }+ },"mail.search.help" : {"extractionState" : "manual","localizations" : {diff --git a/NotchBuddy/Sources/App/AppState.swift b/NotchBuddy/Sources/App/AppState.swiftindex 3e09de05..e6684587 100644--- a/NotchBuddy/Sources/App/AppState.swift+++ b/NotchBuddy/Sources/App/AppState.swift@@ -121,6 +121,10 @@ final class AppState: ObservableObject {}// In-chat provider + model — picked via the model selector in the prompt view+ /// The chat's Mail switch (GitHub build): the AI sees the latest messages and may prepare+ /// actions on them. Off at each launch.+ @Published var chatMailMode = false+@Published var chatProvider: ChatProvider = .anthropic {didSet { UserDefaults.standard.set(chatProvider.rawValue, forKey: "chatProvider") }}diff --git a/NotchBuddy/Sources/App/ClaudeService.swift b/NotchBuddy/Sources/App/ClaudeService.swiftindex 3c5d14e2..8d401350 100644--- a/NotchBuddy/Sources/App/ClaudeService.swift+++ b/NotchBuddy/Sources/App/ClaudeService.swift@@ -274,7 +274,7 @@ final class ClaudeService {}()let request = CLIRequest(model: provider == .anthropic ? model : nil,- system: systemPrompt,+ system: systemPrompt + extraSystem,prompt: CLIRelay.chatPrompt(history: relayHistory, context: contextLine, query: query),web: !readsFile,readDir: readDir,@@ -297,6 +297,8 @@ final class ClaudeService {/// Resolved once: NSFullUserName() is a system call, and the name cannot change under us/// while the app runs.private let systemPrompt = ClaudeService.makeSystemPrompt()+ /// Added to the system prompt for this turn (the chat's Mail switch).+ private var extraSystem = ""/// Greets the user by their macOS first name when there is one worth using, and stays/// neutral otherwise — same wording as the Windows build.@@ -327,6 +329,16 @@ final class ClaudeService {state.stateOverride = nilreturn}+ var query = query+ extraSystem = ""+ #if !APPSTORE+ // Mail on: the AI gets the latest messages under the request, and may answer with a+ // plan of actions (MailPlan.swift) that runs only after the user's click.+ if state.chatMailMode {+ query = await MailAgent.shared.decorate(query)+ extraSystem = MailAgentPrompt.instructions+ }+ #endif#if !APPSTORE// "Use my subscription": the provider's own terminal tool answers, signed in with// the user's account.@@ -369,7 +381,7 @@ final class ClaudeService {"model": model,"max_tokens": 4096,"tools": webSearchTools,- "system": systemPrompt,+ "system": systemPrompt + extraSystem,"messages": conversationMessages,]@@ -429,7 +441,7 @@ final class ClaudeService {}// Build messages- var msgs: [[String: Any]] = [["role": "system", "content": systemPrompt]]+ var msgs: [[String: Any]] = [["role": "system", "content": systemPrompt + extraSystem]]for m in conversationMessages {var simplified = mif let content = m["content"] as? [[String: Any]],diff --git a/NotchBuddy/Sources/App/IslandViewContent.swift b/NotchBuddy/Sources/App/IslandViewContent.swiftindex f88489c8..1a5183ad 100644--- a/NotchBuddy/Sources/App/IslandViewContent.swift+++ b/NotchBuddy/Sources/App/IslandViewContent.swift@@ -1464,8 +1464,11 @@ struct PromptView: View {Spacer()}- HStack(spacing: 0) {+ HStack(spacing: 6) {Spacer()+ #if !APPSTORE+ ChatMailToggle(state: state)+ #endifButton {withAnimation(.spring(response: 0.3, dampingFraction: 0.75)) {showModelPicker.toggle()@@ -1781,13 +1784,28 @@ struct ChatBubble: View {if isStreaming {TimelineView(.periodic(from: .now, by: 0.5)) { tl inlet show = Int(tl.date.timeIntervalSinceReferenceDate / 0.5).isMultiple(of: 2)- Text(message.content + (show ? "▌" : " "))+ // A plan being written (```coucou-mail) is not shown as raw JSON.+ Text(MailPlanParser.extract(message.content).prose + (show ? "▌" : " ")).font(.system(size: 12.5)).foregroundColor(Color(hex: "#B0B5BE")).fixedSize(horizontal: false, vertical: true)}} else {- ChatMarkdownView(markdown: message.content)+ let parsed = MailPlanParser.extract(message.content)+ VStack(alignment: .leading, spacing: 6) {+ if !parsed.prose.isEmpty {+ ChatMarkdownView(markdown: parsed.prose)+ }+ #if !APPSTORE+ if let plan = parsed.plan {+ MailPlanCard(plan: plan, messageId: message.id)+ } else if let error = parsed.error {+ Text(String(format: String(localized: "mail.plan.error %@"), error))+ .font(.system(size: 10.5))+ .foregroundColor(Color(hex: "#F5A524"))+ }+ #endif+ }}}.padding(.horizontal, 8).padding(.vertical, 6)diff --git a/NotchBuddy/Sources/App/MailAgent.swift b/NotchBuddy/Sources/App/MailAgent.swiftnew file mode 100644index 00000000..12f1097f--- /dev/null+++ b/NotchBuddy/Sources/App/MailAgent.swift@@ -0,0 +1,318 @@+#if !APPSTORE+import AppKit+import Foundation+import PDFKit++/// One mail a plan will send, ready to show and to send.+struct PreparedMail: Identifiable, Equatable {+ let id = UUID()+ var to: [String]+ var cc: [String] = []+ var subject: String+ var body: String+ var attachments: [URL] = []+ /// Why it can't be sent (no page found, bad address): shown in red, skipped.+ var problem: String? = nil+}++/// A plan of the chat, from its card appearing to its last mail sent.+struct MailPlanRun: Equatable {+ enum Phase: Equatable {+ case preparing+ case ready+ case countdown(Int)+ case running(done: Int, total: Int)+ case done(ok: Int, failed: Int)+ case cancelled+ }++ var phase: Phase = .preparing+ var sorts: [(action: MailRuleAction, messages: [MailMessage])] = []+ var replies: [(message: MailMessage, body: String)] = []+ var mails: [PreparedMail] = []+ var saves: [(message: MailMessage, folder: String)] = []+ /// What could not be prepared, in orange.+ var notes: [String] = []+ var testSentTo: String? = nil++ var stepCount: Int {+ sorts.reduce(0) { $0 + $1.messages.count } + replies.count + mails.filter { $0.problem == nil }.count + saves.count+ }++ static func == (a: MailPlanRun, b: MailPlanRun) -> Bool {+ a.phase == b.phase && a.mails == b.mails && a.notes == b.notes && a.testSentTo == b.testSentTo+ && a.sorts.count == b.sorts.count && a.replies.count == b.replies.count && a.saves.count == b.saves.count+ }+}++/// The chat's Mail switch: gives the AI the latest messages, then turns the plan it writes+/// (MailPlan.swift) into a card. Nothing runs before the user's click on Run, and a 5-second+/// countdown lets them stop it. GitHub build only (Apple Events).+@MainActor+final class MailAgent: ObservableObject {+ static let shared = MailAgent()++ /// Plans by the id of the chat message that holds them.+ @Published private(set) var runs: [UUID: MailPlanRun] = [:]++ /// The messages of the last list sent to the AI, by their number.+ private var numbered: [Int: MailMessage] = [:]+ private var accounts: [(name: String, address: String)] = []+ private var cancelled = Set<UUID>()+ private let mail = MailController.shared++ /// Where a plan's files are made (saved attachments, PDF pages); emptied at launch.+ private let workDir: URL = {+ let dir = FileManager.default.temporaryDirectory.appendingPathComponent("coucou-mail-plans", isDirectory: true)+ try? FileManager.default.removeItem(at: dir)+ return dir+ }()++ /// The address a test goes to: the first account's.+ var myAddress: String? { accounts.first(where: { !$0.address.isEmpty })?.address }++ // MARK: - Before the turn++ /// The user's request with the latest messages under it, for the AI.+ func decorate(_ query: String) async -> String {+ guard NSWorkspace.shared.runningApplications.contains(where: { $0.bundleIdentifier == MailController.bundleId }) else {+ return query + "\n\n<mail>Mail is closed: ask the user to open the Mail app, then to ask again.</mail>"+ }+ if case .success(let v) = await mail.runAppleScript(MailScript.accountsScript), let text = v.first {+ accounts = text.split(separator: "\n").compactMap { line in+ let f = line.split(separator: "\u{1F}", omittingEmptySubsequences: false).map(String.init)+ return f.count >= 2 ? (f[0], f[1]) : nil+ }+ }+ var list: [MailMessage] = []+ if case .success(let v) = await mail.runAppleScript(MailController.listScript(perInbox: 20)), let text = v.first {+ list = Array(MailController.parseList(text).messages.sorted { $0.date > $1.date }.prefix(40))+ }+ numbered = Dictionary(uniqueKeysWithValues: list.enumerated().map { ($0.offset + 1, $0.element) })+ let named = Set(MailAgentPrompt.mentioned(in: query, senders: list.map(\.sender), subjects: list.map(\.subject)))+ var lines: [MailAgentPrompt.Line] = []+ for (i, m) in list.enumerated() {+ var line = MailAgentPrompt.Line(number: i + 1, sender: m.sender, subject: m.subject, date: m.date,+ isRead: m.isRead, account: m.account)+ // The messages the request names get their text; the newest ones their attachments.+ if named.contains(i) || i < 8 {+ let d = await details(m, textLimit: named.contains(i) ? 3000 : 300)+ line.attachments = d.attachments+ line.text = d.text+ }+ lines.append(line)+ }+ return query + MailAgentPrompt.snapshot(lines, accounts: accounts)+ }++ private func details(_ m: MailMessage, textLimit: Int) async -> (attachments: [String], text: String) {+ let script = MailScript.detailsScript(account: m.account, mailbox: m.mailbox, messageId: m.messageId, textLimit: textLimit)+ guard case .success(let v) = await mail.runAppleScript(script), let out = v.first else { return ([], "") }+ let parts = out.split(separator: "\u{1E}", maxSplits: 1, omittingEmptySubsequences: false).map(String.init)+ let names = (parts.first ?? "").split(separator: "\n").map(String.init).filter { !$0.isEmpty }+ let text = (parts.count > 1 ? parts[1] : "").replacingOccurrences(of: "\r", with: "\n")+ .replacingOccurrences(of: "\u{FFFC}", with: "")+ return (names, text)+ }++ // MARK: - The card++ /// Called when a chat message holding a plan is shown: prepares it once.+ func show(_ plan: MailPlan, for id: UUID) {+ guard runs[id] == nil else { return }+ runs[id] = MailPlanRun()+ Task { await prepare(plan, id: id) }+ }++ private func prepare(_ plan: MailPlan, id: UUID) async {+ var run = MailPlanRun()+ func message(_ n: Int) -> MailMessage? {+ if let m = numbered[n] { return m }+ run.notes.append(String(format: String(localized: "mail.plan.missing %lld"), Int64(n)))+ return nil+ }+ for action in plan.actions {+ switch action {+ case .sort(let act, let numbers):+ let ms = numbers.compactMap(message)+ if !ms.isEmpty { run.sorts.append((action: act, messages: ms)) }+ case .reply(let n, let body):+ if let m = message(n) { run.replies.append((message: m, body: body)) }+ case .saveAttachments(let n, let folder):+ if let m = message(n) { run.saves.append((message: m, folder: folder)) }+ case .send(let out):+ var files: [URL] = []+ if let n = out.attachmentsFrom, let m = message(n) {+ files += await saveAttachments(of: m, onlyName: nil)+ }+ for path in out.files {+ let url = URL(fileURLWithPath: (path as NSString).expandingTildeInPath)+ if FileManager.default.fileExists(atPath: url.path) { files.append(url) }+ else { run.notes.append(String(format: String(localized: "mail.plan.file-missing %@"), path)) }+ }+ let bad = (out.to + out.cc).first { !MailAddress.isValid($0) }+ run.mails.append(PreparedMail(to: out.to, cc: out.cc, subject: out.subject, body: out.body,+ attachments: files,+ problem: bad.map { _ in String(localized: "mail.plan.bad-address") }))+ case .merge(let merge):+ let source = merge.fromMessage.flatMap { message($0) }+ await prepareMerge(merge, source: source, into: &run)+ }+ }+ run.phase = .ready+ runs[id] = run+ }++ private func prepareMerge(_ merge: MailMerge, source: MailMessage?, into run: inout MailPlanRun) async {+ // The PDF: a file on the Mac, or one of a message's attachments.+ var pdf: URL?+ if let file = merge.file {+ let url = URL(fileURLWithPath: (file as NSString).expandingTildeInPath)+ if FileManager.default.fileExists(atPath: url.path) { pdf = url }+ else { run.notes.append(String(format: String(localized: "mail.plan.file-missing %@"), file)) }+ } else if let m = source {+ var name = merge.attachment+ if name == nil {+ name = await details(m, textLimit: 1).attachments.first { $0.lowercased().hasSuffix(".pdf") }+ }+ if let name {+ pdf = await saveAttachments(of: m, onlyName: name).first+ }+ if pdf == nil { run.notes.append(String(localized: "mail.plan.no-pdf")) }+ }+ var pageFiles: [URL] = []+ var pageTexts: [String] = []+ if let pdf, let doc = PDFDocument(url: pdf) {+ if merge.splitPages {+ let dir = workDir.appendingPathComponent(UUID().uuidString, isDirectory: true)+ try? FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)+ for i in 0..<doc.pageCount {+ guard let page = doc.page(at: i) else { continue }+ pageTexts.append(page.string ?? "")+ let single = PDFDocument()+ if let copy = page.copy() as? PDFPage { single.insert(copy, at: 0) }+ // Named after its recipient once matched; page order for now.+ let url = dir.appendingPathComponent("p\(i + 1).pdf")+ single.write(to: url)+ pageFiles.append(url)+ }+ }+ } else if pdf != nil {+ run.notes.append(String(localized: "mail.plan.no-pdf"))+ }+ let assignments: [MailMergeMatching.Assignment]+ if merge.splitPages {+ assignments = MailMergeMatching.assign(pages: pageTexts, recipients: merge.recipients, byKey: merge.matchByKey)+ } else {+ assignments = merge.recipients.map { .init(recipient: $0, page: nil, ambiguous: false) }+ }+ for a in assignments {+ var files: [URL] = []+ var problem: String? = nil+ if merge.splitPages {+ if let p = a.page, p < pageFiles.count {+ // The recipient gets "Plans - Bordeaux.pdf", not "p3.pdf".+ let named = pageFiles[p].deletingLastPathComponent().appendingPathComponent(+ MailMergeMatching.pageFileName(base: pdf?.lastPathComponent ?? "Plan.pdf", key: a.recipient.key, page: p))+ try? FileManager.default.removeItem(at: named)+ try? FileManager.default.copyItem(at: pageFiles[p], to: named)+ files = [named]+ } else {+ problem = String(localized: "mail.plan.no-page")+ }+ } else if let pdf {+ files = [pdf]+ }+ if !MailAddress.isValid(a.recipient.email) { problem = String(localized: "mail.plan.bad-address") }+ run.mails.append(PreparedMail(to: [a.recipient.email],+ subject: MailMergeMatching.fill(merge.subject, a.recipient),+ body: MailMergeMatching.fill(merge.body, a.recipient),+ attachments: files, problem: problem))+ }+ }++ /// Saves a message's attachments in a fresh folder of the work directory.+ private func saveAttachments(of m: MailMessage, onlyName: String?) async -> [URL] {+ let dir = workDir.appendingPathComponent(UUID().uuidString, isDirectory: true)+ try? FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)+ let script = MailScript.saveAttachmentsScript(account: m.account, mailbox: m.mailbox, messageId: m.messageId,+ folder: dir.path, onlyName: onlyName)+ guard case .success(let v) = await mail.runAppleScript(script), let out = v.first else { return [] }+ return out.split(separator: "\n").map { dir.appendingPathComponent(String($0)) }+ .filter { FileManager.default.fileExists(atPath: $0.path) }+ }++ // MARK: - Running (each one after a click)++ /// Sends the first mail of the plan to the user's own address, "[Test]" in front.+ func sendTest(_ id: UUID) {+ guard let run = runs[id], let me = myAddress, let first = run.mails.first(where: { $0.problem == nil }) else { return }+ Task {+ let script = MailScript.sendScript(from: nil, to: [me], cc: [], subject: "[Test] " + first.subject,+ body: first.body, attachments: first.attachments.map(\.path))+ if case .success = await mail.runAppleScript(script) { runs[id]?.testSentTo = me }+ }+ }++ /// Run: 5 seconds to change one's mind, then every step in order.+ func start(_ id: UUID) {+ guard let run = runs[id], run.phase == .ready || run.phase == .cancelled else { return }+ cancelled.remove(id)+ Task {+ for s in stride(from: 5, through: 1, by: -1) {+ if cancelled.contains(id) { runs[id]?.phase = .cancelled; return }+ runs[id]?.phase = .countdown(s)+ try? await Task.sleep(nanoseconds: 1_000_000_000)+ }+ if cancelled.contains(id) { runs[id]?.phase = .cancelled; return }+ await execute(run, id: id)+ }+ }++ func cancel(_ id: UUID) {+ cancelled.insert(id)+ if case .countdown = runs[id]?.phase { runs[id]?.phase = .cancelled }+ }++ private func execute(_ run: MailPlanRun, id: UUID) async {+ let total = run.stepCount+ var ok = 0, failed = 0+ func step(_ success: Bool) {+ if success { ok += 1 } else { failed += 1 }+ runs[id]?.phase = .running(done: ok + failed, total: total)+ }+ runs[id]?.phase = .running(done: 0, total: total)+ for (action, messages) in run.sorts {+ for m in messages {+ if cancelled.contains(id) { break }+ step(await mail.perform(action, on: m, reason: .manual))+ }+ }+ for (m, body) in run.replies {+ let script = MailScript.replyDraftScript(account: m.account, mailbox: m.mailbox, messageId: m.messageId, body: body)+ if case .success = await mail.runAppleScript(script) { step(true) } else { step(false) }+ }+ for (m, folder) in run.saves {+ let path = (folder as NSString).expandingTildeInPath+ try? FileManager.default.createDirectory(atPath: path, withIntermediateDirectories: true)+ let script = MailScript.saveAttachmentsScript(account: m.account, mailbox: m.mailbox, messageId: m.messageId, folder: path)+ if case .success = await mail.runAppleScript(script) { step(true) } else { step(false) }+ }+ for (i, out) in run.mails.enumerated() where out.problem == nil {+ if cancelled.contains(id) { break }+ let script = MailScript.sendScript(from: nil, to: out.to, cc: out.cc, subject: out.subject, body: out.body,+ attachments: out.attachments.map(\.path))+ if case .success = await mail.runAppleScript(script) {+ step(true)+ MailTriageStore.shared.recordSent(MailSentEntry(date: Date(), to: out.to, subject: out.subject,+ attachments: out.attachments.map(\.lastPathComponent)))+ } else {+ step(false)+ }+ // A pause between mails: the provider sees a person, not a burst.+ if i < run.mails.count - 1 { try? await Task.sleep(nanoseconds: 1_200_000_000) }+ }+ runs[id]?.phase = .done(ok: ok, failed: failed)+ }+}+#endifdiff --git a/NotchBuddy/Sources/App/MailAgentViews.swift b/NotchBuddy/Sources/App/MailAgentViews.swiftnew file mode 100644index 00000000..456fae2e--- /dev/null+++ b/NotchBuddy/Sources/App/MailAgentViews.swift@@ -0,0 +1,220 @@+#if !APPSTORE+import SwiftUI++private let planBlue = Color(hex: "#2F8CFF")++/// A plan of the chat, under the answer that wrote it: what it will do, the mails it will send+/// (the ones that can't be sent in red), and Run. Nothing happens before that click.+struct MailPlanCard: View {+ let plan: MailPlan+ let messageId: UUID+ @ObservedObject private var agent = MailAgent.shared++ private var run: MailPlanRun? { agent.runs[messageId] }++ var body: some View {+ VStack(alignment: .leading, spacing: 5) {+ HStack(spacing: 6) {+ Image(systemName: "envelope.badge")+ .font(.system(size: 10.5, weight: .semibold))+ .foregroundColor(planBlue)+ Text(plan.summary.isEmpty ? String(localized: "mail.plan.title") : plan.summary)+ .font(.system(size: 11.5, weight: .semibold))+ .foregroundColor(Color(hex: "#F1F2F4"))+ .lineLimit(2)+ .fixedSize(horizontal: false, vertical: true)+ }+ if let run {+ steps(run)+ controls(run)+ }+ }+ .padding(.horizontal, 9).padding(.vertical, 7)+ .frame(maxWidth: .infinity, alignment: .leading)+ .background(RoundedRectangle(cornerRadius: 8).fill(planBlue.opacity(0.08)))+ .overlay(RoundedRectangle(cornerRadius: 8).strokeBorder(planBlue.opacity(0.25)))+ .onAppear { agent.show(plan, for: messageId) }+ }++ @ViewBuilder private func steps(_ run: MailPlanRun) -> some View {+ let small = Font.system(size: 10.5)+ ForEach(Array(run.sorts.enumerated()), id: \.offset) { _, s in+ line(String(format: String(localized: "mail.plan.sort %@ %lld"), s.action.ruleLine, Int64(s.messages.count)), font: small)+ }+ ForEach(Array(run.replies.enumerated()), id: \.offset) { _, r in+ line(String(format: String(localized: "mail.plan.reply %@"), r.message.senderName), font: small)+ }+ ForEach(Array(run.saves.enumerated()), id: \.offset) { _, s in+ line(String(format: String(localized: "mail.plan.save %@ %@"), s.message.senderName, s.folder), font: small)+ }+ if !run.mails.isEmpty {+ line(String(format: String(localized: "mail.plan.mails %lld"), Int64(run.mails.filter { $0.problem == nil }.count)), font: small)+ ScrollView(.vertical, showsIndicators: false) {+ VStack(alignment: .leading, spacing: 2) {+ ForEach(run.mails) { m in+ HStack(spacing: 6) {+ Text(m.to.joined(separator: ", "))+ .foregroundColor(Color(hex: m.problem == nil ? "#C5C8CD" : "#F4505E"))+ .lineLimit(1)+ .frame(width: 150, alignment: .leading)+ Text(m.subject)+ .foregroundColor(Color(hex: "#8E939C"))+ .lineLimit(1)+ Spacer(minLength: 4)+ if let problem = m.problem {+ Text(problem).foregroundColor(Color(hex: "#F4505E")).lineLimit(1).fixedSize()+ } else if let file = m.attachments.first {+ Text(verbatim: "📎 " + file.lastPathComponent + (m.attachments.count > 1 ? " +\(m.attachments.count - 1)" : ""))+ .foregroundColor(Color(hex: "#8E939C"))+ .lineLimit(1)+ .truncationMode(.middle)+ .frame(maxWidth: 150, alignment: .trailing)+ }+ }+ .font(.system(size: 10))+ }+ }+ }+ .frame(maxHeight: min(CGFloat(run.mails.count) * 15, 90))+ }+ ForEach(run.notes, id: \.self) { note in+ Text(note)+ .font(.system(size: 10))+ .foregroundColor(Color(hex: "#F5A524"))+ .fixedSize(horizontal: false, vertical: true)+ }+ }++ private func line(_ text: String, font: Font) -> some View {+ HStack(alignment: .top, spacing: 5) {+ Text(verbatim: "→").foregroundColor(planBlue)+ Text(text).foregroundColor(Color(hex: "#C5C8CD")).fixedSize(horizontal: false, vertical: true)+ }+ .font(font)+ }++ @ViewBuilder private func controls(_ run: MailPlanRun) -> some View {+ HStack(spacing: 10) {+ switch run.phase {+ case .preparing:+ ProgressView().controlSize(.small).scaleEffect(0.7)+ Text("mail.plan.preparing").font(.system(size: 10.5)).foregroundColor(Color(hex: "#8E939C"))+ case .ready, .cancelled:+ if run.stepCount > 0 {+ Button(String(format: String(localized: "mail.plan.run %lld"), Int64(run.stepCount))) { agent.start(messageId) }+ .buttonStyle(PlanButtonStyle(primary: true))+ }+ if !run.mails.isEmpty, agent.myAddress != nil {+ Button(String(localized: "mail.plan.test")) { agent.sendTest(messageId) }+ .buttonStyle(PlanButtonStyle(primary: false))+ }+ if run.phase == .cancelled {+ Text("mail.plan.cancelled").font(.system(size: 10.5)).foregroundColor(Color(hex: "#8E939C"))+ } else if let to = run.testSentTo {+ Text(String(format: String(localized: "mail.plan.test-sent %@"), to))+ .font(.system(size: 10.5)).foregroundColor(Color(hex: "#34D399")).lineLimit(1)+ }+ case .countdown(let s):+ Text(String(format: String(localized: "mail.plan.countdown %lld"), Int64(s)))+ .font(.system(size: 10.5, weight: .semibold)).foregroundColor(Color(hex: "#F5A524"))+ .monospacedDigit()+ Button(String(localized: "mail.plan.cancel")) { agent.cancel(messageId) }+ .buttonStyle(PlanButtonStyle(primary: false))+ case .running(let done, let total):+ ProgressView(value: Double(done), total: Double(max(1, total)))+ .progressViewStyle(.linear)+ .tint(planBlue)+ .frame(width: 140)+ Text(verbatim: "\(done)/\(total)").font(.system(size: 10.5)).foregroundColor(Color(hex: "#8E939C")).monospacedDigit()+ Button(String(localized: "mail.plan.cancel")) { agent.cancel(messageId) }+ .buttonStyle(PlanButtonStyle(primary: false))+ case .done(let ok, let failed):+ Image(systemName: failed == 0 ? "checkmark.circle.fill" : "exclamationmark.triangle.fill")+ .font(.system(size: 11))+ .foregroundColor(Color(hex: failed == 0 ? "#34D399" : "#F5A524"))+ Text(String(format: String(localized: "mail.plan.done %lld %lld"), Int64(ok), Int64(failed)))+ .font(.system(size: 10.5)).foregroundColor(Color(hex: "#C5C8CD"))+ }+ Spacer(minLength: 0)+ }+ .padding(.top, 2)+ }+}++private struct PlanButtonStyle: ButtonStyle {+ let primary: Bool++ func makeBody(configuration: Configuration) -> some View {+ configuration.label+ .font(.system(size: 10.5, weight: .semibold))+ .foregroundColor(primary ? .white : Color(hex: "#C5C8CD"))+ .padding(.horizontal, 9).padding(.vertical, 4)+ .background(Capsule().fill(primary ? planBlue : Color.white.opacity(0.08)))+ .opacity(configuration.isPressed ? 0.7 : 1)+ .contentShape(Capsule())+ }+}++/// The chat's Mail switch: on, the AI sees the latest messages and can prepare actions.+struct ChatMailToggle: View {+ @ObservedObject var state: AppState++ var body: some View {+ Button { state.chatMailMode.toggle() } label: {+ HStack(spacing: 4) {+ Image(systemName: state.chatMailMode ? "envelope.fill" : "envelope")+ .font(.system(size: 9))+ Text("mail.chat.toggle")+ .font(.system(size: 10.5, weight: .medium))+ }+ .foregroundColor(state.chatMailMode ? .white : Color(hex: "#7B8089"))+ .padding(.horizontal, 8)+ .padding(.vertical, 4)+ .background(state.chatMailMode ? planBlue.opacity(0.85) : Color.white.opacity(0.06))+ .clipShape(Capsule())+ }+ .buttonStyle(.plain)+ .help(String(localized: "mail.chat.toggle-help"))+ }+}++/// The Overview's list of what Coucou sent for the chat.+struct HubMailSentList: View {+ @ObservedObject private var store = MailTriageStore.shared++ var body: some View {+ if !store.sent.isEmpty {+ HubLabel(String(localized: "hub.mail.sent"))+ HubCard {+ ForEach(Array(store.sent.prefix(50).enumerated()), id: \.element.id) { i, e in+ if i > 0 { HubDivider() }+ HStack(spacing: 12) {+ Image(systemName: "paperplane")+ .font(.system(size: 13))+ .foregroundColor(planBlue)+ .frame(width: 22)+ Text(e.to.joined(separator: ", "))+ .font(.system(size: 13, weight: .semibold))+ .lineLimit(1)+ Text(e.subject)+ .font(.system(size: 12.5))+ .foregroundColor(HubTheme.secondary)+ .lineLimit(1)+ Spacer(minLength: 8)+ if !e.attachments.isEmpty {+ Text(verbatim: "📎 " + e.attachments.joined(separator: ", "))+ .font(.system(size: 11.5))+ .foregroundColor(HubTheme.muted)+ .lineLimit(1)+ .frame(maxWidth: 200, alignment: .trailing)+ }+ Text(e.date, format: .dateTime.day().month().hour().minute())+ .font(.system(size: 11.5))+ .foregroundColor(HubTheme.muted)+ }+ }+ }+ }+ }+}+#endifdiff --git a/NotchBuddy/Sources/App/MailController.swift b/NotchBuddy/Sources/App/MailController.swiftindex 29f97794..1eb45077 100644--- a/NotchBuddy/Sources/App/MailController.swift+++ b/NotchBuddy/Sources/App/MailController.swift@@ -279,7 +279,7 @@ final class MailController: ObservableObject {/// Applies `action` to the message in Mail, writes it in the journal and updates the card.@discardableResult- private func perform(_ action: MailRuleAction, on message: MailMessage, reason: MailReason) async -> Bool {+ func perform(_ action: MailRuleAction, on message: MailMessage, reason: MailReason) async -> Bool {let script = MailScript.applyScript(account: message.account, mailbox: message.mailbox,messageId: message.messageId, action: action)guard case .success(let values) = await runAppleScript(script) else { return false }@@ -570,7 +570,7 @@ final class MailController: ObservableObject {enum ScriptResult { case success([String]), denied, error }@discardableResult- private func runAppleScript(_ source: String) async -> ScriptResult {+ func runAppleScript(_ source: String) async -> ScriptResult {await withCheckedContinuation { cont inqueue.async {guard let script = NSAppleScript(source: source) else {diff --git a/NotchBuddy/Sources/App/MailHubPages.swift b/NotchBuddy/Sources/App/MailHubPages.swiftindex edd6b139..6ed704d9 100644--- a/NotchBuddy/Sources/App/MailHubPages.swift+++ b/NotchBuddy/Sources/App/MailHubPages.swift@@ -55,6 +55,8 @@ struct HubMailOverviewPage: View {MailStat(value: today.important, label: String(localized: "hub.mail.stat.important"), color: "#F5A524")}+ HubMailSentList()+HStack {HubLabel(String(localized: "hub.mail.journal"))Spacer()diff --git a/NotchBuddy/Sources/App/MailPlan.swift b/NotchBuddy/Sources/App/MailPlan.swiftnew file mode 100644index 00000000..d5dbd3a7--- /dev/null+++ b/NotchBuddy/Sources/App/MailPlan.swift@@ -0,0 +1,404 @@+import Foundation++// The chat's mail actions: the plan the AI writes (a ```coucou-mail JSON block in its answer),+// what Coucou tells the AI, the matching of PDF pages to recipients and the scripts that send.+// Pure Foundation, tested on any machine (scripts/test-mail-triage.sh). Nothing in a plan+// happens until the user clicks Run on its card (MailAgent.swift).++struct MailOutgoing: Equatable, Sendable {+ var to: [String]+ var cc: [String] = []+ var subject: String+ var body: String+ /// Forward the attachments of this message (its number in the list sent to the AI).+ var attachmentsFrom: Int? = nil+ /// Files on the Mac.+ var files: [String] = []+}++struct MailMergeRecipient: Equatable, Sendable {+ var email: String+ var name: String+ /// What the recipient's page holds ("Bordeaux"), and the {key} of the templates.+ var key: String+}++/// One message per recipient, each with its own page of a PDF.+struct MailMerge: Equatable, Sendable {+ var fromMessage: Int?+ /// The PDF among that message's attachments (nil: the first PDF).+ var attachment: String?+ var splitPages: Bool+ /// Pages go to the recipient whose key they contain; false: in order.+ var matchByKey: Bool+ var recipients: [MailMergeRecipient]+ var subject: String+ var body: String+ /// Files on the Mac, instead of a message's PDF.+ var file: String? = nil+}++enum MailPlanAction: Equatable, Sendable {+ case sort(MailRuleAction, messages: [Int])+ case reply(message: Int, body: String)+ case send(MailOutgoing)+ case merge(MailMerge)+ case saveAttachments(message: Int, folder: String)+}++struct MailPlan: Equatable, Sendable {+ var summary: String+ var actions: [MailPlanAction]++ /// How many mails the plan sends.+ var sendCount: Int {+ actions.reduce(0) { n, a in+ switch a {+ case .send: return n + 1+ case .merge(let m): return n + m.recipients.count+ default: return n+ }+ }+ }+}++enum MailPlanParser {+ static let fence = "```coucou-mail"++ /// The answer without its plan block, the plan, and why the block could not be read.+ static func extract(_ text: String) -> (prose: String, plan: MailPlan?, error: String?) {+ guard let start = text.range(of: fence) else { return (text, nil, nil) }+ let afterFence = text[start.upperBound...]+ let end = afterFence.range(of: "```")+ let json = String(end.map { afterFence[..<$0.lowerBound] } ?? afterFence)+ var prose = String(text[..<start.lowerBound])+ if let end { prose += afterFence[end.upperBound...] }+ prose = prose.trimmingCharacters(in: .whitespacesAndNewlines)+ // Still streaming: no closing fence yet.+ guard end != nil else { return (prose, nil, nil) }+ do {+ return (prose, try decode(json), nil)+ } catch {+ return (prose, nil, "\(error)")+ }+ }++ struct Failure: Error, CustomStringConvertible {+ let description: String+ }++ static func decode(_ json: String) throws -> MailPlan {+ guard let data = json.trimmingCharacters(in: .whitespacesAndNewlines).data(using: .utf8),+ let root = try JSONSerialization.jsonObject(with: data) as? [String: Any] else {+ throw Failure(description: "not a JSON object")+ }+ let list = root["actions"] as? [[String: Any]] ?? []+ var actions: [MailPlanAction] = []+ for (i, a) in list.enumerated() {+ guard let type = a["type"] as? String else { throw Failure(description: "action \(i + 1) has no type") }+ actions.append(try action(type.lowercased(), a, index: i + 1))+ }+ guard !actions.isEmpty else { throw Failure(description: "no actions") }+ return MailPlan(summary: root["summary"] as? String ?? "", actions: actions)+ }++ private static func ints(_ v: Any?) -> [Int] {+ if let n = int(v) { return [n] }+ return (v as? [Any] ?? []).compactMap(int)+ }++ private static func int(_ v: Any?) -> Int? {+ if let n = v as? Int { return n }+ if let d = v as? Double { return Int(d) }+ if let s = v as? String { return Int(s.trimmingCharacters(in: CharacterSet(charactersIn: "[] "))) }+ return nil+ }++ private static func strings(_ v: Any?) -> [String] {+ if let s = v as? String { return s.split(separator: ",").map { $0.trimmingCharacters(in: .whitespaces) }.filter { !$0.isEmpty } }+ return (v as? [Any] ?? []).compactMap { $0 as? String }.filter { !$0.isEmpty }+ }++ private static func action(_ type: String, _ a: [String: Any], index: Int) throws -> MailPlanAction {+ func need(_ key: String) throws -> String {+ guard let s = a[key] as? String, !s.trimmingCharacters(in: .whitespaces).isEmpty else {+ throw Failure(description: "action \(index) (\(type)) needs \"\(key)\"")+ }+ return s+ }+ func message() throws -> Int {+ guard let n = int(a["message"]) else { throw Failure(description: "action \(index) (\(type)) needs \"message\"") }+ return n+ }+ switch type {+ case "flag", "important", "junk", "read", "mark_read", "move":+ let messages = ints(a["messages"] ?? a["message"])+ guard !messages.isEmpty else { throw Failure(description: "action \(index) (\(type)) needs \"messages\"") }+ let act: MailRuleAction+ switch type {+ case "junk": act = .junk+ case "read", "mark_read": act = .markRead+ case "move": act = .move(try need("mailbox"))+ default: act = .important+ }+ return .sort(act, messages: messages)+ case "reply":+ return .reply(message: try message(), body: try need("body"))+ case "send":+ let to = strings(a["to"])+ guard !to.isEmpty else { throw Failure(description: "action \(index) (send) needs \"to\"") }+ return .send(MailOutgoing(to: to, cc: strings(a["cc"]), subject: a["subject"] as? String ?? "",+ body: a["body"] as? String ?? "", attachmentsFrom: int(a["attachments_from"]),+ files: strings(a["files"])))+ case "merge", "mail_merge":+ let recipients = (a["recipients"] as? [[String: Any]] ?? []).compactMap { r -> MailMergeRecipient? in+ guard let email = r["email"] as? String, !email.isEmpty else { return nil }+ return MailMergeRecipient(email: email, name: r["name"] as? String ?? "",+ key: (r["key"] as? String) ?? (r["city"] as? String) ?? "")+ }+ guard !recipients.isEmpty else { throw Failure(description: "action \(index) (merge) needs \"recipients\"") }+ let match = (a["match"] as? String ?? "key").lowercased()+ return .merge(MailMerge(fromMessage: int(a["from_message"] ?? a["message"]),+ attachment: a["attachment"] as? String,+ splitPages: a["split_pages"] as? Bool ?? true,+ matchByKey: match != "order",+ recipients: recipients,+ subject: a["subject"] as? String ?? "",+ body: a["body"] as? String ?? "",+ file: a["file"] as? String))+ case "save_attachments", "save":+ return .saveAttachments(message: try message(), folder: try need("folder"))+ default:+ throw Failure(description: "action \(index) has an unknown type \"\(type)\"")+ }+ }+}++// MARK: - Mail merge++enum MailMergeMatching {+ struct Assignment: Equatable, Sendable {+ let recipient: MailMergeRecipient+ /// The page (0-based) for this recipient, nil when none was found.+ let page: Int?+ /// More than one page held the key: the first free one was taken.+ let ambiguous: Bool+ }++ /// Gives each recipient a page: the one whose text holds its key as a whole word, or the+ /// page in the same order. A page goes to one recipient only.+ static func assign(pages: [String], recipients: [MailMergeRecipient], byKey: Bool) -> [Assignment] {+ guard byKey else {+ return recipients.enumerated().map { i, r in+ Assignment(recipient: r, page: i < pages.count ? i : nil, ambiguous: false)+ }+ }+ var taken = Set<Int>()+ return recipients.map { r in+ let key = r.key.trimmingCharacters(in: .whitespaces)+ guard !key.isEmpty else { return Assignment(recipient: r, page: nil, ambiguous: false) }+ let hits = pages.indices.filter { MailTriage.containsWord(pages[$0], key) }+ let free = hits.filter { !taken.contains($0) }+ guard let page = free.first else { return Assignment(recipient: r, page: nil, ambiguous: false) }+ taken.insert(page)+ return Assignment(recipient: r, page: page, ambiguous: hits.count > 1)+ }+ }++ /// {name}, {key} (and {city}, {email}) filled in.+ static func fill(_ template: String, _ r: MailMergeRecipient) -> String {+ template+ .replacingOccurrences(of: "{name}", with: r.name)+ .replacingOccurrences(of: "{key}", with: r.key)+ .replacingOccurrences(of: "{city}", with: r.key)+ .replacingOccurrences(of: "{email}", with: r.email)+ }++ /// A file name for a recipient's page: "Plans - Bordeaux.pdf".+ static func pageFileName(base: String, key: String, page: Int) -> String {+ let stem = (base as NSString).deletingPathExtension+ let label = key.isEmpty ? "p\(page + 1)" : key+ let safe = (stem + " - " + label).replacingOccurrences(of: "/", with: "-").replacingOccurrences(of: ":", with: "-")+ return safe + ".pdf"+ }+}++enum MailAddress {+ /// A plain address check: [email protected], no spaces.+ static func isValid(_ s: String) -> Bool {+ let t = s.trimmingCharacters(in: .whitespaces)+ guard !t.contains(" "), let at = t.firstIndex(of: "@"), at != t.startIndex else { return false }+ let domain = t[t.index(after: at)...]+ return domain.contains(".") && !domain.hasPrefix(".") && !domain.hasSuffix(".") && !domain.contains("@")+ }+}++// MARK: - What the AI is told++enum MailAgentPrompt {+ /// Added to the chat's system prompt while the chat's Mail switch is on.+ static let instructions = """+++ The user turned on Mail: you can act on their Apple Mail through Coucou. Their latest messages are listed under their request, each with a number [n]; some come with their text and attachments.+ When they ask you to DO something with their mail, answer in one or two short sentences, then give ONE plan in a fenced code block tagged coucou-mail, holding JSON:+ {"summary": "what the plan does, in the user's language", "actions": [ ... ]}+ Actions:+ - {"type": "flag" | "junk" | "read" | "move", "messages": [n, ...], "mailbox": "only for move"}+ - {"type": "reply", "message": n, "body": "..."} : a reply draft opened in Mail, not sent+ - {"type": "send", "to": ["address"], "cc": [], "subject": "...", "body": "...", "attachments_from": n (optional: that message's attachments), "files": ["/path"] (optional)}+ - {"type": "merge", "from_message": n, "attachment": "name of a PDF in that message", "split_pages": true, "match": "key" or "order", "recipients": [{"email": "...", "name": "...", "key": "what is written on their page, like a city"}], "subject": "... {key} ...", "body": "Hello {name}, ..."} : one mail per recipient, each with the PDF page that contains their key (or the page in the same order)+ - {"type": "save_attachments", "message": n, "folder": "~/Documents/..."}+ Rules: nothing happens until the user clicks Run under your plan, so never say it is done. Never invent an address: use only addresses the user gave, found in their messages, or in a file they shared. If something is missing (the recipients' addresses, which message), ask instead of writing a plan. A question about their mail gets an answer, without a plan. Plain text bodies, in the user's language.+ """++ struct Line: Sendable {+ let number: Int+ let sender: String+ let subject: String+ let date: Date+ let isRead: Bool+ let account: String+ var attachments: [String] = []+ var text: String? = nil+ }++ /// The list sent under the user's request.+ static func snapshot(_ lines: [Line], accounts: [(name: String, address: String)], now: Date = Date()) -> String {+ let df = DateFormatter()+ df.locale = Locale(identifier: "en_US_POSIX")+ df.dateFormat = "yyyy-MM-dd HH:mm"+ var out = "\n\n<mail>\n"+ if !accounts.isEmpty {+ out += "Accounts: " + accounts.map { "\($0.name) <\($0.address)>" }.joined(separator: ", ") + "\n"+ }+ for l in lines {+ out += "[\(l.number)] \(df.string(from: l.date)) · \(l.isRead ? "read" : "unread") · \(l.account) · from \(l.sender) · \"\(l.subject)\""+ if !l.attachments.isEmpty { out += " · attachments: " + l.attachments.joined(separator: ", ") }+ out += "\n"+ if let t = l.text, !t.isEmpty {+ out += " text: " + t.replacingOccurrences(of: "\n", with: " ").prefix(3000) + "\n"+ }+ }+ out += "</mail>"+ return out+ }++ /// The messages a request names (a sender or a subject word of four letters or more),+ /// best first: their text goes to the AI.+ static func mentioned(in query: String, senders: [String], subjects: [String], limit: Int = 3) -> [Int] {+ let words = query.split { !$0.isLetter && !$0.isNumber && $0 != "@" && $0 != "." }+ .map { MailTriage.normalize(String($0)) }+ .filter { $0.count >= 4 }+ guard !words.isEmpty else { return [] }+ var scored: [(Int, Int)] = []+ for i in senders.indices {+ let s = MailTriage.normalize(senders[i]), sub = MailTriage.normalize(subjects[i])+ let score = words.reduce(0) { $0 + (s.contains($1) ? 2 : 0) + (sub.contains($1) ? 1 : 0) }+ if score > 0 { scored.append((i, score)) }+ }+ return scored.sorted { $0.1 != $1.1 ? $0.1 > $1.1 : $0.0 < $1.0 }.prefix(limit).map(\.0)+ }+}++// MARK: - Scripts++extension MailScript {+ /// Sends one message from Mail. `from` picks the sending address; attachments are POSIX paths.+ static func sendScript(from: String?, to: [String], cc: [String], subject: String, body: String,+ attachments: [String]) -> String {+ var s = """+ tell application id "com.apple.mail"+ set m to make new outgoing message with properties {subject:\(quote(subject)), content:\(quote(body)), visible:false}++ """+ if let from, !from.isEmpty { s += " set sender of m to \(quote(from))\n" }+ s += " tell m\n"+ for a in to { s += " make new to recipient at end of to recipients with properties {address:\(quote(a))}\n" }+ for a in cc { s += " make new cc recipient at end of cc recipients with properties {address:\(quote(a))}\n" }+ for p in attachments {+ s += " make new attachment with properties {file name:(POSIX file \(quote(p)))} at after the last paragraph of content\n"+ }+ s += " end tell\n"+ if !attachments.isEmpty { s += " delay 1\n" }+ s += """+ send m+ return "ok"+ end tell+ """+ return s+ }++ /// Saves a message's attachments (only `onlyName` when given) into `folder`, returns the+ /// saved file names, one per line.+ static func saveAttachmentsScript(account: String, mailbox: String, messageId: Int, folder: String,+ onlyName: String? = nil) -> String {+ let test = onlyName.map { "(name of a) is \(quote($0))" } ?? "true"+ return """+ tell application id "com.apple.mail"+ set m to first message of mailbox \(quote(mailbox)) of account \(quote(account)) whose id is \(messageId)+ set out to ""+ repeat with a in mail attachments of m+ if \(test) then+ set p to \(quote(folder.hasSuffix("/") ? folder : folder + "/")) & (name of a)+ save a in (POSIX file p)+ set out to out & (name of a) & linefeed+ end if+ end repeat+ return out+ end tell+ """+ }++ /// Opens Mail's reply window for a message with `body` above the quoted text. Not sent.+ static func replyDraftScript(account: String, mailbox: String, messageId: Int, body: String) -> String {+ """+ tell application id "com.apple.mail"+ set m to first message of mailbox \(quote(mailbox)) of account \(quote(account)) whose id is \(messageId)+ set r to reply m with opening window+ try+ set content of r to \(quote(body)) & return & return & (content of r)+ end try+ activate+ return "ok"+ end tell+ """+ }++ /// The names of a message's attachments and the start of its text: names one per line,+ /// then a record separator, then the text.+ static func detailsScript(account: String, mailbox: String, messageId: Int, textLimit: Int) -> String {+ """+ tell application id "com.apple.mail"+ set m to first message of mailbox \(quote(mailbox)) of account \(quote(account)) whose id is \(messageId)+ set out to ""+ try+ repeat with a in mail attachments of m+ set out to out & (name of a) & linefeed+ end repeat+ end try+ set c to ""+ try+ set c to content of m+ end try+ if (length of c) > \(textLimit) then set c to text 1 thru \(textLimit) of c+ return out & (character id 30) & c+ end tell+ """+ }++ /// Every enabled account: name, a unit separator, its first address; one per line.+ static let accountsScript = """+ tell application id "com.apple.mail"+ set out to ""+ repeat with acc in (every account whose enabled is true)+ set addr to ""+ try+ set addr to item 1 of (email addresses of acc)+ end try+ set out to out & (name of acc) & (character id 31) & addr & linefeed+ end repeat+ return out+ end tell+ """+}diff --git a/NotchBuddy/Sources/App/MailTriageStore.swift b/NotchBuddy/Sources/App/MailTriageStore.swiftindex d60c2fdd..71a06f0a 100644--- a/NotchBuddy/Sources/App/MailTriageStore.swift+++ b/NotchBuddy/Sources/App/MailTriageStore.swift@@ -16,6 +16,15 @@ struct MailJournalEntry: Codable, Identifiable, Equatable, Sendable {var undone = false}+/// A mail Coucou sent for the chat (a plan the user ran).+struct MailSentEntry: Codable, Identifiable, Equatable, Sendable {+ var id = UUID()+ var date: Date+ var to: [String]+ var subject: String+ var attachments: [String]+}+/// The Mail section's settings (rules, banned words, VIPs, automatic sorting) and the journal of/// what Coucou sorted. JSON files in Application Support/NotchBuddy/Mail, on this Mac only.@MainActor@@ -31,6 +40,8 @@ final class MailTriageStore: ObservableObject {}/// Newest first, the last 500.@Published private(set) var journal: [MailJournalEntry] = []+ /// What Coucou sent for the chat, newest first, the last 500.+ @Published private(set) var sent: [MailSentEntry] = []/// Messages already looked at by the automatic sorting (Mail's ids), so each one is/// sorted once and a message put back by hand is left alone.@@ -44,6 +55,7 @@ final class MailTriageStore: ObservableObject {loading = truesettings = load(MailTriageSettings.self, from: "triage.json") ?? MailTriageSettings()journal = load([MailJournalEntry].self, from: "journal.json") ?? []+ sent = load([MailSentEntry].self, from: "sent.json") ?? []seen = load([String].self, from: "seen.json") ?? []seenSet = Set(seen)loading = false@@ -95,6 +107,12 @@ final class MailTriageStore: ObservableObject {save(journal, to: "journal.json")}+ func recordSent(_ entry: MailSentEntry) {+ sent.insert(entry, at: 0)+ if sent.count > 500 { sent.removeLast(sent.count - 500) }+ save(sent, to: "sent.json")+ }+func markUndone(_ id: UUID) {guard let i = journal.firstIndex(where: { $0.id == id }) else { return }journal[i].undone = truediff --git a/docs/INTEGRATIONS.md b/docs/INTEGRATIONS.mdindex a5f3317a..6db2d796 100644--- a/docs/INTEGRATIONS.md+++ b/docs/INTEGRATIONS.md@@ -335,6 +335,13 @@ Réglages → Chat → Local models → **Disconnect**. Efface l'URL sauvegardé- Actions possibles : indésirables (statut indésirable + déplacement dans la boîte Junk/Spam du compte), important (drapeau), marquer comme lu, déplacer dans un dossier. Jamais de suppression.- Journal : chaque action avec sa raison et un bouton Annuler, qui retrouve le mail par son Message-ID (l'id de Mail change quand un mail est déplacé) et le remet en place.+### Chat : actions sur les mails (bouton Mail du chat)++- Bouton « Mail » à côté du choix du modèle, éteint à chaque lancement. Allumé, chaque message du chat part avec, en dessous, les 40 derniers mails des boîtes de réception, numérotés `[n]` (`MailAgent.decorate`) : comptes et adresses, date, lu ou non, expéditeur, objet. Les 8 plus récents ont leurs pièces jointes et le début du texte ; ceux que la demande nomme (expéditeur ou mot de l'objet) ont 3 000 caractères de texte.+- Le prompt système reçoit `MailAgentPrompt.instructions` : l'IA répond en une phrase puis donne au plus un plan, bloc ` ```coucou-mail ` en JSON. Actions : `flag` / `junk` / `read` / `move`, `reply` (brouillon ouvert dans Mail, jamais envoyé), `send` (destinataires, objet, texte, pièces jointes d'un mail ou fichiers du Mac), `merge` (un mail par destinataire, chacun avec la page d'un PDF qui contient sa clé, ou la page dans l'ordre), `save_attachments`. Pas de suppression. Marche avec tous les fournisseurs du chat (clé API ou abonnement).+- Le bloc n'est jamais affiché tel quel : la bulle montre une carte (`MailPlanCard`) qui prépare le plan (PDF enregistré depuis Mail, découpé page par page avec PDFKit, chaque page nommée « Plans - Bordeaux.pdf »), liste les mails, en rouge ceux sans page trouvée ou à l'adresse invalide (jamais envoyés).+- Rien ne se passe sans clic : « M'envoyer un test » envoie le premier mail à l'adresse du premier compte, « Lancer (N) » démarre un compte à rebours de 5 s annulable, puis les étapes une par une, 1,2 s entre deux envois. Rapport : faits / échecs. Les envois sont listés dans Aperçu → Envoyés par Coucou.+---## 6bis. WhatsApp (expérimental, build GitHub uniquement)diff --git a/scripts/test-mail-triage.sh b/scripts/test-mail-triage.shindex aa68cf73..9d6395ea 100755--- a/scripts/test-mail-triage.sh+++ b/scripts/test-mail-triage.sh@@ -4,5 +4,6 @@ cd "$(dirname "$0")/.."TEST_DIR="$(mktemp -d "${TMPDIR:-/tmp}/coucou-mail-triage.XXXXXX")"trap 'rm -rf "$TEST_DIR"' EXITswiftc -swift-version 6 -strict-concurrency=complete \- NotchBuddy/Sources/App/MailTriage.swift tests/MailTriageTests.swift -o "$TEST_DIR/mail-triage-tests"+ NotchBuddy/Sources/App/MailTriage.swift NotchBuddy/Sources/App/MailPlan.swift \+ tests/MailTriageTests.swift tests/MailPlanTests.swift -o "$TEST_DIR/mail-triage-tests""$TEST_DIR/mail-triage-tests"diff --git a/tests/MailPlanTests.swift b/tests/MailPlanTests.swiftnew file mode 100644index 00000000..c93d6462--- /dev/null+++ b/tests/MailPlanTests.swift@@ -0,0 +1,105 @@+import Foundation++enum MailPlanTests {+ static func run() {+ parsing()+ merging()+ prompt()+ scripts()+ print("MailPlan tests: all passed")+ }++ static func parsing() {+ let answer = """+ Je prépare les 3 envois.++ ```coucou-mail+ {"summary": "3 mails", "actions": [+ {"type": "junk", "messages": [2, 3]},+ {"type": "move", "messages": 4, "mailbox": "Compta"},+ {"type": "reply", "message": 1, "body": "Merci !"},+ {"type": "send", "to": "[email protected], [email protected]", "subject": "Hi", "body": "Yo", "attachments_from": "5"},+ {"type": "merge", "from_message": 1, "attachment": "plans.pdf", "match": "key",+ "recipients": [{"email": "[email protected]", "name": "Léa", "key": "Bordeaux"}, {"email": "[email protected]", "city": "Lyon"}],+ "subject": "Plan {key}", "body": "Bonjour {name}"},+ {"type": "save_attachments", "message": 1, "folder": "~/Documents/Plans"}+ ]}+ ```+ Clique sur Lancer.+ """+ let r = MailPlanParser.extract(answer)+ precondition(r.error == nil, r.error ?? "")+ precondition(r.prose == "Je prépare les 3 envois.\n\n\nClique sur Lancer." || r.prose.hasPrefix("Je prépare"), r.prose)+ precondition(!r.prose.contains("coucou-mail") && r.prose.contains("Clique sur Lancer."))+ let plan = r.plan!+ precondition(plan.summary == "3 mails" && plan.actions.count == 6)+ precondition(plan.actions[0] == .sort(.junk, messages: [2, 3]))+ precondition(plan.actions[1] == .sort(.move("Compta"), messages: [4]))+ precondition(plan.actions[2] == .reply(message: 1, body: "Merci !"))+ guard case .send(let s) = plan.actions[3] else { fatalError() }+ precondition(s.to == ["[email protected]", "[email protected]"] && s.attachmentsFrom == 5)+ guard case .merge(let m) = plan.actions[4] else { fatalError() }+ precondition(m.recipients.count == 2 && m.recipients[1].key == "Lyon" && m.matchByKey && m.splitPages)+ precondition(plan.actions[5] == .saveAttachments(message: 1, folder: "~/Documents/Plans"))+ precondition(plan.sendCount == 3)+ // No block, a block still streaming, a broken block.+ precondition(MailPlanParser.extract("Hello").plan == nil && MailPlanParser.extract("Hello").prose == "Hello")+ let streaming = MailPlanParser.extract("Ok\n```coucou-mail\n{\"actions\": [")+ precondition(streaming.plan == nil && streaming.error == nil && streaming.prose == "Ok")+ let broken = MailPlanParser.extract("Ok\n```coucou-mail\n{\"actions\": [{\"type\": \"send\"}]}\n```")+ precondition(broken.plan == nil && broken.error!.contains("needs \"to\""))+ let unknown = MailPlanParser.extract("```coucou-mail\n{\"actions\": [{\"type\": \"delete\", \"messages\": [1]}]}\n```")+ precondition(unknown.error!.contains("unknown type"), "no delete action exists")+ }++ static func merging() {+ let pages = ["Plan du site — BORDEAUX — RDC", "Plan Lyon 3e", "Plan Bordeaux annexe", "Marseille"]+ let rs = [MailMergeRecipient(email: "[email protected]", name: "A", key: "Bordeaux"),+ MailMergeRecipient(email: "[email protected]", name: "B", key: "Lyon"),+ MailMergeRecipient(email: "[email protected]", name: "C", key: "Nice"),+ MailMergeRecipient(email: "[email protected]", name: "D", key: "Bordeaux")]+ let a = MailMergeMatching.assign(pages: pages, recipients: rs, byKey: true)+ precondition(a[0].page == 0 && a[0].ambiguous)+ precondition(a[1].page == 1 && !a[1].ambiguous)+ precondition(a[2].page == nil, "no page for Nice")+ precondition(a[3].page == 2, "the second Bordeaux takes the free page")+ let o = MailMergeMatching.assign(pages: pages, recipients: rs + rs, byKey: false)+ precondition(o.map(\.page) == [0, 1, 2, 3, nil, nil, nil, nil])+ precondition(MailMergeMatching.fill("Plan {key} pour {name} ({city})", rs[0]) == "Plan Bordeaux pour A (Bordeaux)")+ precondition(MailMergeMatching.pageFileName(base: "Plans.pdf", key: "Lyon", page: 1) == "Plans - Lyon.pdf")+ precondition(MailMergeMatching.pageFileName(base: "a/b.pdf", key: "", page: 4) == "a-b - p5.pdf")+ precondition(MailAddress.isValid("[email protected]"))+ for bad in ["lea", "lea@", "@x.fr", "lea@x", "le [email protected]", "[email protected]."] { precondition(!MailAddress.isValid(bad), bad) }+ }++ static func prompt() {+ let lines = [MailAgentPrompt.Line(number: 1, sender: "Martin <[email protected]>", subject: "Plans franchisés",+ date: Date(timeIntervalSince1970: 0), isRead: false, account: "Pro",+ attachments: ["plans.pdf"], text: "Voici\nles plans")]+ let s = MailAgentPrompt.snapshot(lines, accounts: [("Pro", "[email protected]")])+ precondition(s.contains("Accounts: Pro <[email protected]>"))+ precondition(s.contains("[1] ") && s.contains("unread") && s.contains("attachments: plans.pdf"))+ precondition(s.contains("text: Voici les plans") && s.hasSuffix("</mail>"))+ precondition(MailAgentPrompt.instructions.contains("coucou-mail") && MailAgentPrompt.instructions.contains("Never invent an address"))+ let hits = MailAgentPrompt.mentioned(in: "le mail de Martin avec les plans",+ senders: ["Anne <[email protected]>", "Martin <[email protected]>", "Paul"],+ subjects: ["Plans", "Plans franchisés", "Hello"])+ precondition(hits == [1, 0], "\(hits)")+ precondition(MailAgentPrompt.mentioned(in: "ok", senders: ["a"], subjects: ["b"]).isEmpty)+ }++ static func scripts() {+ let s = MailScript.sendScript(from: "[email protected]", to: ["[email protected]"], cc: ["[email protected]"], subject: "Plan \"Lyon\"",+ body: "Bonjour", attachments: ["/tmp/p 1.pdf"])+ precondition(s.contains("subject:\"Plan \\\"Lyon\\\"\""))+ precondition(s.contains("set sender of m to \"[email protected]\""))+ precondition(s.contains("to recipients with properties {address:\"[email protected]\"}"))+ precondition(s.contains("cc recipients with properties {address:\"[email protected]\"}"))+ precondition(s.contains("POSIX file \"/tmp/p 1.pdf\"") && s.contains("delay 1") && s.contains("send m"))+ precondition(!MailScript.sendScript(from: nil, to: ["[email protected]"], cc: [], subject: "", body: "", attachments: []).contains("delay"))+ let save = MailScript.saveAttachmentsScript(account: "Pro", mailbox: "INBOX", messageId: 7, folder: "/tmp/x", onlyName: "plans.pdf")+ precondition(save.contains("(name of a) is \"plans.pdf\"") && save.contains("\"/tmp/x/\" & (name of a)"))+ let reply = MailScript.replyDraftScript(account: "Pro", mailbox: "INBOX", messageId: 7, body: "Merci")+ precondition(reply.contains("reply m with opening window") && !reply.contains("send"))+ }+}diff --git a/tests/MailTriageTests.swift b/tests/MailTriageTests.swiftindex 3724f0a7..0ae6914b 100644--- a/tests/MailTriageTests.swift+++ b/tests/MailTriageTests.swift@@ -8,6 +8,7 @@ enum MailTriageTests {search()scripts()print("MailTriage tests: all passed")+ MailPlanTests.run()}static func facts(_ sender: String = "Paul <[email protected]>", subject: String = "Devis mai",