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
Flow dictation with Parakeet: FluidAudio, models downloaded on click
Claude63219ea9a8af
diff --git a/NotchBuddy/NotchBuddy.xcodeproj/project.pbxproj b/NotchBuddy/NotchBuddy.xcodeproj/project.pbxprojindex 481d8d47..07870deb 100644--- a/NotchBuddy/NotchBuddy.xcodeproj/project.pbxproj+++ b/NotchBuddy/NotchBuddy.xcodeproj/project.pbxproj@@ -47,6 +47,7 @@1C2BB61FA83015C42B321E0E /* PillColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37564F5F041B38C976DF3DEF /* PillColors.swift */; };1D23613B270FE8B11C5E27A7 /* IslandDisplayChoice.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A09E73F1E58019EF6EA2A62 /* IslandDisplayChoice.swift */; };1D4CE0CCD2B5A0FFE50C7F06 /* TerminalTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87AF6F7A027AB1D46309DD49 /* TerminalTarget.swift */; };+ 43346F544B8BF45F651C87B4 /* ParakeetEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9007267453D60200C2CB8F4 /* ParakeetEngine.swift */; };8090516AA01E97B3F0D16261 /* FlowHubNotes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B2FE56D7F32FCF7453CFB1B /* FlowHubNotes.swift */; };7FBFCF6C9075D9EFD351961B /* FlowHubSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19503827102C75174006BF9E /* FlowHubSettings.swift */; };88376FD9D48E9A77EF57C0FD /* FlowHubWords.swift in Sources */ = {isa = PBXBuildFile; fileRef = C27F4F64C08DD3F72AF4C2FB /* FlowHubWords.swift */; };@@ -142,6 +143,7 @@65CB53E20B2289CA3AC3E8FE /* TurnSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A1C4152EBDBD7C24CABFFD7 /* TurnSnapshot.swift */; };6613EB914852E6EEB1FF37BF /* IntentParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = F39753CFF90B494D449CCD95 /* IntentParser.swift */; };6726F74966EDE7F82BFE89B2 /* TerminalTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87AF6F7A027AB1D46309DD49 /* TerminalTarget.swift */; };+ B63AC65188449D52DB5DDC29 /* ParakeetEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9007267453D60200C2CB8F4 /* ParakeetEngine.swift */; };C500511EDFF4761BDA4488CE /* FlowHubNotes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B2FE56D7F32FCF7453CFB1B /* FlowHubNotes.swift */; };A5260F0D566968C8A2FE43BD /* FlowHubSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19503827102C75174006BF9E /* FlowHubSettings.swift */; };4176623B12ACEAFC98ED5821 /* FlowHubWords.swift in Sources */ = {isa = PBXBuildFile; fileRef = C27F4F64C08DD3F72AF4C2FB /* FlowHubWords.swift */; };@@ -370,6 +372,7 @@FBBC4CDE82B5886A83A27D7A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 506824380E9C80B9BC6DCE72 /* Assets.xcassets */; };FDF87CF7C5F703EDD9A7CC14 /* CloudProbe.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28323DC20034A281F6829884 /* CloudProbe.swift */; };FEFEF1EBAB0E6CA74A33C10B /* SafeWebURL.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2FDED98F7F6C755A72C97A3 /* SafeWebURL.swift */; };+ 8896DCFCB54BA53FE1EE49AC /* FluidAudio in Frameworks */ = {isa = PBXBuildFile; productRef = FAFFA455BB88CDC7BB499851 /* FluidAudio */; };/* End PBXBuildFile section *//* Begin PBXContainerItemProxy section */@@ -490,6 +493,7 @@871CA2BADC67D97C97C7009D /* error.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = error.wav; sourceTree = "<group>"; };8790ACE9F73BD74640A0F20C /* LocalChat.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalChat.swift; sourceTree = "<group>"; };87AF6F7A027AB1D46309DD49 /* TerminalTarget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TerminalTarget.swift; sourceTree = "<group>"; };+ C9007267453D60200C2CB8F4 /* ParakeetEngine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParakeetEngine.swift; sourceTree = "<group>"; };3B2FE56D7F32FCF7453CFB1B /* FlowHubNotes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlowHubNotes.swift; sourceTree = "<group>"; };19503827102C75174006BF9E /* FlowHubSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlowHubSettings.swift; sourceTree = "<group>"; };C27F4F64C08DD3F72AF4C2FB /* FlowHubWords.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlowHubWords.swift; sourceTree = "<group>"; };@@ -587,6 +591,17 @@FADC1FE5696B1075932D0B7C /* InstructionRunner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstructionRunner.swift; sourceTree = "<group>"; };/* End PBXFileReference section */+/* Begin PBXFrameworksBuildPhase section */+ DDB8BA12A0DFFF47015C999A /* Frameworks */ = {+ isa = PBXFrameworksBuildPhase;+ buildActionMask = 2147483647;+ files = (+ 8896DCFCB54BA53FE1EE49AC /* FluidAudio in Frameworks */,+ );+ runOnlyForDeploymentPostprocessing = 0;+ };+/* End PBXFrameworksBuildPhase section */+/* Begin PBXGroup section */061D81F5DBAB8DB3ADFD0CB8 /* sounds */ = {isa = PBXGroup;@@ -660,6 +675,7 @@914A792788D403F836BEB570 /* SpotifyViews.swift */,2EF78999D68D56ADE4CEFBE2 /* StripePoller.swift */,87AF6F7A027AB1D46309DD49 /* TerminalTarget.swift */,+ C9007267453D60200C2CB8F4 /* ParakeetEngine.swift */,3B2FE56D7F32FCF7453CFB1B /* FlowHubNotes.swift */,19503827102C75174006BF9E /* FlowHubSettings.swift */,C27F4F64C08DD3F72AF4C2FB /* FlowHubWords.swift */,@@ -889,6 +905,7 @@002591692F471861383A29CD /* Sources */,A0E1A749D68BF03D3FDE4473 /* Resources */,FDEB6FD7AAB82BAA78A891E1 /* Write Git Hash to Info.plist */,+ DDB8BA12A0DFFF47015C999A /* Frameworks */,);buildRules = ();@@ -896,6 +913,7 @@);name = NotchBuddy;packageProductDependencies = (+ FAFFA455BB88CDC7BB499851 /* FluidAudio */,);productName = NotchBuddy;productReference = A14A61070D293AB4BBA303F7 /* NotchBuddy.app */;@@ -993,6 +1011,9 @@);mainGroup = C8A9AE71DB5C532D78C7784B;minimizedProjectReferenceProxies = 1;+ packageReferences = (+ 1DFD1CFF91133E3B9FCD52E3 /* XCRemoteSwiftPackageReference "FluidAudio" */,+ );preferredProjectObjectVersion = 77;productRefGroup = 6CF11AAA7898712CF6DB364A /* Products */;projectDirPath = "";@@ -1158,6 +1179,7 @@1558BB00C530B721172F6E65 /* StripePoller.swift in Sources */,9EA178EA395B116336C1FA10 /* TerminalTarget+AppKit.swift in Sources */,1D4CE0CCD2B5A0FFE50C7F06 /* TerminalTarget.swift in Sources */,+ 43346F544B8BF45F651C87B4 /* ParakeetEngine.swift in Sources */,8090516AA01E97B3F0D16261 /* FlowHubNotes.swift in Sources */,7FBFCF6C9075D9EFD351961B /* FlowHubSettings.swift in Sources */,88376FD9D48E9A77EF57C0FD /* FlowHubWords.swift in Sources */,@@ -1374,6 +1396,7 @@E4B9986674F4D425826F15A8 /* StripePoller.swift in Sources */,11F14DB97C93CF84DF9D5C43 /* TerminalTarget+AppKit.swift in Sources */,6726F74966EDE7F82BFE89B2 /* TerminalTarget.swift in Sources */,+ B63AC65188449D52DB5DDC29 /* ParakeetEngine.swift in Sources */,C500511EDFF4761BDA4488CE /* FlowHubNotes.swift in Sources */,A5260F0D566968C8A2FE43BD /* FlowHubSettings.swift in Sources */,4176623B12ACEAFC98ED5821 /* FlowHubWords.swift in Sources */,@@ -2318,6 +2341,25 @@defaultConfigurationName = Debug;};/* End XCConfigurationList section */++/* Begin XCRemoteSwiftPackageReference section */+ 1DFD1CFF91133E3B9FCD52E3 /* XCRemoteSwiftPackageReference "FluidAudio" */ = {+ isa = XCRemoteSwiftPackageReference;+ repositoryURL = "https://github.com/FluidInference/FluidAudio";+ requirement = {+ kind = exactVersion;+ version = 0.17.7;+ };+ };+/* End XCRemoteSwiftPackageReference section */++/* Begin XCSwiftPackageProductDependency section */+ FAFFA455BB88CDC7BB499851 /* FluidAudio */ = {+ isa = XCSwiftPackageProductDependency;+ package = 1DFD1CFF91133E3B9FCD52E3 /* XCRemoteSwiftPackageReference "FluidAudio" */;+ productName = FluidAudio;+ };+/* End XCSwiftPackageProductDependency section */};rootObject = ACF315E0C1F7FECADF1B4FBC /* Project object */;}diff --git a/NotchBuddy/Resources/Localizable.xcstrings b/NotchBuddy/Resources/Localizable.xcstringsindex 49701a5a..592adf0f 100644--- a/NotchBuddy/Resources/Localizable.xcstrings+++ b/NotchBuddy/Resources/Localizable.xcstrings@@ -1635,6 +1635,526 @@}}},+ "hub.engine.download" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "تنزيل"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ডাউনলোড"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Download"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Descargar"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Télécharger"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "डाउनलोड करें"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Unduh"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Baixar"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Скачать"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "下载"+ }+ }+ }+ },+ "hub.engine.fallback" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "إلى أن يُنزَّل Parakeet، يستخدم Coucou التعرّف على الكلام في Mac."+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Parakeet ডাউনলোড না হওয়া পর্যন্ত Coucou Mac-এর স্পিচ রিকগনিশন ব্যবহার করে।"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Until Parakeet is downloaded, Coucou uses your Mac's speech recognition."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Hasta que Parakeet esté descargado, Coucou usa el reconocimiento de voz del Mac."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Tant que Parakeet n'est pas téléchargé, Coucou utilise la reconnaissance vocale du Mac."+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "जब तक Parakeet डाउनलोड नहीं होता, Coucou Mac की वाक् पहचान इस्तेमाल करता है।"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Sampai Parakeet diunduh, Coucou memakai pengenalan suara Mac."+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Até o Parakeet ser baixado, o Coucou usa o reconhecimento de fala do Mac."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Пока Parakeet не скачан, Coucou использует распознавание речи Mac."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "在下载 Parakeet 之前,Coucou 使用 Mac 的语音识别。"+ }+ }+ }+ },+ "hub.engine.installed" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "مثبّت"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ইনস্টল করা"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Installed"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Instalado"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Installé"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "इंस्टॉल है"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Terpasang"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Instalado"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Установлен"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "已安装"+ }+ }+ }+ },+ "hub.engine.parakeet" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Parakeet على جهاز Mac"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Parakeet, আপনার Mac-এ"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Parakeet, on your Mac"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Parakeet, en tu Mac"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Parakeet, sur ton Mac"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Parakeet, आपके Mac पर"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Parakeet, di Mac-mu"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Parakeet, no seu Mac"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Parakeet на вашем Mac"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Parakeet,在你的 Mac 上"+ }+ }+ }+ },+ "hub.engine.parakeet-detail" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "الأدق، بلا إنترنت، 25 لغة. يُنزَّل مرة واحدة (نحو 650 ميغابايت)."+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "সবচেয়ে নির্ভুল, অফলাইন, ২৫টি ভাষা। একবার ডাউনলোড (প্রায় ৬৫০ MB)।"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "The most accurate, offline, 25 languages. Downloaded once (about 650 MB)."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "El más preciso, sin conexión, 25 idiomas. Se descarga una vez (unos 650 MB)."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Le plus précis, hors ligne, 25 langues. Téléchargé une fois (environ 650 Mo)."+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "सबसे सटीक, ऑफ़लाइन, 25 भाषाएँ। एक बार डाउनलोड (लगभग 650 MB)।"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Paling akurat, luring, 25 bahasa. Diunduh sekali (sekitar 650 MB)."+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O mais preciso, offline, 25 idiomas. Baixado uma vez (cerca de 650 MB)."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Самый точный, без сети, 25 языков. Скачивается один раз (около 650 МБ)."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "最准确,离线可用,支持 25 种语言。只需下载一次(约 650 MB)。"+ }+ }+ }+ },+ "hub.engine.remove" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "إزالة النماذج"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "মডেল মুছুন"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Remove the models"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Eliminar los modelos"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Supprimer les modèles"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "मॉडल हटाएँ"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Hapus model"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Remover os modelos"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Удалить модели"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "移除模型"+ }+ }+ }+ },+ "hub.engine.retry" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "إعادة المحاولة"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "আবার চেষ্টা করুন"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Retry"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Reintentar"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Réessayer"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "फिर कोशिश करें"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Coba lagi"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Tentar de novo"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Повторить"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "重试"+ }+ }+ }+ },+ "hub.engine.unsupported" : {+ "extractionState" : "manual",+ "localizations" : {+ "ar" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "يتطلب Apple silicon"+ }+ },+ "bn" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Apple silicon দরকার"+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Needs Apple silicon"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Requiere Apple silicon"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nécessite un Mac Apple silicon"+ }+ },+ "hi" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Apple silicon चाहिए"+ }+ },+ "id" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Perlu Apple silicon"+ }+ },+ "pt-BR" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Requer Apple silicon"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Нужен Mac с Apple silicon"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "需要 Apple 芯片"+ }+ }+ }+ },"hub.heard-placeholder" : {"extractionState" : "manual","localizations" : {diff --git a/NotchBuddy/Sources/App/FlowDictation.swift b/NotchBuddy/Sources/App/FlowDictation.swiftindex 3c934fad..0a60c0c5 100644--- a/NotchBuddy/Sources/App/FlowDictation.swift+++ b/NotchBuddy/Sources/App/FlowDictation.swift@@ -97,7 +97,10 @@ final class FlowDictation: ObservableObject {}/// At launch: listens for the key if Flow dictation is on.- func start() { refresh() }+ func start() {+ refresh()+ if isEnabled, FlowStore.shared.engine == .parakeet { Parakeet.shared.preload() }+ }func refresh() {removeMonitors()@@ -227,28 +230,58 @@ final class FlowDictation: ObservableObject {/// One listen, from the key press to the paste. Cancelling it drops its words.@MainActor private final class Listen {- let dictation = MacDictation()+ /// The Mac's recognizer, or Parakeet when it is chosen and downloaded.+ let apple: MacDictation?+ let parakeet: ParakeetDictation?var cancelled = false/// The app the words go to, seen when the key went down.let app = NSWorkspace.shared.frontmostApplicationlet startedAt = Date()var stoppedAt: Date?++ init(useParakeet: Bool) {+ apple = useParakeet ? nil : MacDictation()+ parakeet = useParakeet ? ParakeetDictation() : nil+ }++ var isRecording: Bool { apple?.isRecording ?? parakeet?.isRecording ?? false }++ func start(bands: FlowAudioBands) async {+ if let apple {+ apple.bands = bands+ await apple.start(from: "")+ } else if let parakeet {+ parakeet.bands = bands+ await parakeet.start()+ }+ }++ func finish() async -> String {+ if let apple { return await apple.finish() }+ if let parakeet { return await parakeet.finish() }+ return ""+ }++ func stop() {+ apple?.stop()+ parakeet?.stop()+ }}private func begin() {// After this key event is handled: a permission granted meanwhile reinstalls the monitors.Task { @MainActor [weak self] in self?.recheckTrust() }- let listen = Listen()+ let listen = Listen(useParakeet: FlowStore.shared.engine == .parakeet && Parakeet.shared.isReady)current = listenbands.reset()- listen.dictation.bands = bandspill.listen()SoundEngine.shared.play("blip")+ let bands = self.bandsstartTask = Task { @MainActor [weak self] in- await listen.dictation.start(from: "")+ await listen.start(bands: bands)guard let self else { return }- if listen.cancelled { listen.dictation.stop(); return } // cancelled while the mic opened- if !listen.dictation.isRecording, self.current === listen {+ if listen.cancelled { listen.stop(); return } // cancelled while the mic opened+ if !listen.isRecording, self.current === listen {// No permission, no recognizer for these languages, or no microphone.self.logic.reset()self.current = nil@@ -268,7 +301,7 @@ final class FlowDictation: ObservableObject {// moment so it makes it in.try? await Task.sleep(for: .milliseconds(Self.tailMilliseconds))guard !listen.cancelled else { return }- let heard = await listen.dictation.finish().trimmingCharacters(in: .whitespacesAndNewlines)+ let heard = await listen.finish().trimmingCharacters(in: .whitespacesAndNewlines)guard let self, !listen.cancelled else { return }// Replacements and the dictionary, then Claude's clean-up when it is on, then the snippets.let store = FlowStore.shared@@ -305,7 +338,7 @@ final class FlowDictation: ObservableObject {tickTask?.cancel()if let listen = current {listen.cancelled = true- listen.dictation.stop()+ listen.stop()}current = nilpill.rest()diff --git a/NotchBuddy/Sources/App/FlowHubSettings.swift b/NotchBuddy/Sources/App/FlowHubSettings.swiftindex 41d6f82c..5b967150 100644--- a/NotchBuddy/Sources/App/FlowHubSettings.swift+++ b/NotchBuddy/Sources/App/FlowHubSettings.swift@@ -109,25 +109,113 @@ struct HubKeyCap: View {}}-/// How the voice becomes text: the Mac's recognizer and its language.+/// How the voice becomes text: Parakeet on the Mac (once downloaded) or the Mac's recognizer.struct HubRecognitionSettings: View {@Binding var language: String+ @ObservedObject private var store = FlowStore.shared+ @ObservedObject private var parakeet = Parakeet.sharedvar body: some View {- HubRow(title: String(localized: "hub.settings.engine-apple"),- detail: String(localized: "hub.settings.engine-apple-detail")) {- EmptyView()+ HubEngineRow(selected: store.engine == .parakeet,+ title: String(localized: "hub.engine.parakeet"),+ detail: String(localized: "hub.engine.parakeet-detail")) {+ store.engine = .parakeet+ } trailing: {+ parakeetStatus}HubDivider()- HubRow(title: String(localized: "Dictation language")) {- Picker("", selection: $language) {- Text("Automatic").tag(MacDictation.automatic)- ForEach(MacDictation.allLanguages, id: \.self) { id in- Text(MacDictation.name(of: id)).tag(id)+ HubEngineRow(selected: store.engine == .apple,+ title: String(localized: "hub.settings.engine-apple"),+ detail: String(localized: "hub.settings.engine-apple-detail")) {+ store.engine = .apple+ } trailing: {+ EmptyView()+ }+ if store.engine == .apple {+ HubDivider()+ HubRow(title: String(localized: "Dictation language")) {+ Picker("", selection: $language) {+ Text("Automatic").tag(MacDictation.automatic)+ ForEach(MacDictation.allLanguages, id: \.self) { id in+ Text(MacDictation.name(of: id)).tag(id)+ }+ }+ .labelsHidden()+ .frame(width: 220)+ }+ } else if !parakeet.isReady {+ Text("hub.engine.fallback")+ .font(.system(size: 12))+ .foregroundColor(HubTheme.secondary)+ .fixedSize(horizontal: false, vertical: true)+ }+ }++ @ViewBuilder private var parakeetStatus: some View {+ switch parakeet.state {+ case .unsupported:+ Text("hub.engine.unsupported")+ .font(.system(size: 12))+ .foregroundColor(HubTheme.secondary)+ case .missing:+ Button(String(localized: "hub.engine.download")) { parakeet.download() }+ .buttonStyle(HubButtonStyle(primary: true))+ case .downloading(let fraction):+ HStack(spacing: 8) {+ ProgressView(value: fraction)+ .progressViewStyle(.linear)+ .frame(width: 110)+ Text(fraction.formatted(.percent.precision(.fractionLength(0))))+ .font(.system(size: 12))+ .foregroundColor(HubTheme.secondary)+ .monospacedDigit()+ }+ case .ready:+ Menu {+ Button(String(localized: "hub.engine.remove"), role: .destructive) { parakeet.remove() }+ } label: {+ Label(String(localized: "hub.engine.installed"), systemImage: "checkmark.circle.fill")+ .foregroundColor(HubTheme.green)+ }+ .menuStyle(.borderlessButton)+ .fixedSize()+ case .failed:+ Button(String(localized: "hub.engine.retry")) { parakeet.download() }+ .buttonStyle(HubButtonStyle())+ }+ }+}++/// A recognizer to choose: a round mark, its name and what it does, and its status on the right.+private struct HubEngineRow<Trailing: View>: View {+ let selected: Bool+ let title: String+ let detail: String+ let choose: () -> Void+ @ViewBuilder var trailing: () -> Trailing++ var body: some View {+ HStack(spacing: 12) {+ Button(action: choose) {+ HStack(spacing: 12) {+ ZStack {+ Circle().strokeBorder(selected ? HubTheme.accent : Color(hex: "#5A5F68"),+ lineWidth: selected ? 5 : 1.5)+ }+ .frame(width: 17, height: 17)+ VStack(alignment: .leading, spacing: 3) {+ Text(title).font(.system(size: 13.5, weight: .semibold))+ Text(detail)+ .font(.system(size: 12))+ .foregroundColor(HubTheme.secondary)+ .fixedSize(horizontal: false, vertical: true)+ }+ Spacer(minLength: 8)}+ .contentShape(Rectangle())}- .labelsHidden()- .frame(width: 220)+ .buttonStyle(.plain)+ trailing()}}}diff --git a/NotchBuddy/Sources/App/FlowStore.swift b/NotchBuddy/Sources/App/FlowStore.swiftindex 8236c694..3e8ae6ff 100644--- a/NotchBuddy/Sources/App/FlowStore.swift+++ b/NotchBuddy/Sources/App/FlowStore.swift@@ -94,6 +94,15 @@ final class FlowStore: ObservableObject {didSet { UserDefaults.standard.set(defaultStyle.rawValue, forKey: Self.defaultStyleKey) }}+ /// Parakeet (once downloaded) or the Mac's recognizer.+ @Published var engine: FlowEngine = FlowEngine(rawValue: UserDefaults.standard.string(forKey: FlowStore.engineKey) ?? "") ?? .parakeet {+ didSet {+ UserDefaults.standard.set(engine.rawValue, forKey: Self.engineKey)+ if engine == .parakeet { Parakeet.shared.preload() }+ }+ }++ static let engineKey = "flowEngine"static let keepDaysKey = "flowKeepDays"static let cleanupKey = "flowCleanup"static let defaultStyleKey = "flowDefaultStyle"diff --git a/NotchBuddy/Sources/App/ParakeetEngine.swift b/NotchBuddy/Sources/App/ParakeetEngine.swiftnew file mode 100644index 00000000..9dc47e53--- /dev/null+++ b/NotchBuddy/Sources/App/ParakeetEngine.swift@@ -0,0 +1,261 @@+#if !APPSTORE+import AVFoundation+@preconcurrency import FluidAudio+import os++/// How Flow dictation turns the voice into text.+enum FlowEngine: String, CaseIterable, Identifiable {+ /// NVIDIA's Parakeet, run on the Mac's Neural Engine by FluidAudio: the most accurate, offline.+ case parakeet+ /// The Mac's own speech recognition (MacDictation).+ case apple++ var id: String { rawValue }+}++/// Parakeet (speech to text) and the speaker diarizer of the Notetaker: their models, downloaded+/// once from Hugging Face when the user clicks Download in Coucou Flow → Settings (≈ 650 MB),+/// kept in Application Support/NotchBuddy/Models, then everything runs on this Mac.+@MainActor+final class Parakeet: ObservableObject {+ static let shared = Parakeet()++ /// Parakeet Ultra: v3's 25 languages, more accurate than v3, same speed.+ nonisolated static let version: AsrModelVersion = .ultra++ enum State: Equatable {+ /// Intel Mac: the models need the Neural Engine of Apple silicon.+ case unsupported+ case missing+ case downloading(Double)+ case ready+ case failed(String)+ }++ @Published private(set) var state: State = .missing++ private var loading: Task<AsrManager, Error>?++ private init() { refresh() }++ nonisolated static var isSupported: Bool {+ #if arch(arm64)+ return true+ #else+ return false+ #endif+ }++ /// Coucou's own copy of the models (not FluidAudio's shared folder, so removing them never+ /// touches another app's).+ nonisolated static var modelsRoot: URL {+ HookServer.supportDir.appendingPathComponent("Models", isDirectory: true)+ }++ nonisolated static var asrDirectory: URL {+ modelsRoot.appendingPathComponent(AsrModels.defaultCacheDirectory(for: version).lastPathComponent, isDirectory: true)+ }++ nonisolated static var installed: Bool {+ AsrModels.modelsExist(at: asrDirectory, version: version)+ }++ var isReady: Bool { state == .ready }++ func refresh() {+ if !Self.isSupported { state = .unsupported; return }+ if case .downloading = state { return }+ state = Self.installed ? .ready : .missing+ }++ /// Downloads Parakeet and the diarizer, then loads Parakeet so the first dictation is quick.+ func download() {+ guard Self.isSupported else { return }+ if case .downloading = state { return }+ state = .downloading(0)+ Task { @MainActor in+ do {+ try await Self.fetchModels { fraction in+ Task { @MainActor in+ if case .downloading(let shown) = Parakeet.shared.state, fraction > shown {+ Parakeet.shared.state = .downloading(fraction)+ }+ }+ }+ state = .ready+ appendAppLog("nb.log", "[Parakeet] models downloaded")+ _ = try? await manager()+ } catch {+ appendAppLog("nb.log", "[Parakeet] download failed: \(error.localizedDescription)")+ state = .failed(error.localizedDescription)+ }+ }+ }++ nonisolated private static func fetchModels(progress: @escaping @Sendable (Double) -> Void) async throws {+ try FileManager.default.createDirectory(at: modelsRoot, withIntermediateDirectories: true)+ _ = try await AsrModels.download(to: asrDirectory, version: version, progressHandler: { update in+ progress(min(0.92, update.fractionCompleted * 0.92))+ })+ try await prepareDiarizer()+ progress(1)+ }++ /// Downloads (once) and loads the Notetaker's speaker diarizer.+ nonisolated static func prepareDiarizer() async throws {+ let diarizer = OfflineDiarizerManager()+ try await diarizer.prepareModels(directory: modelsRoot)+ }++ /// Removes the models from this Mac (Settings → Remove).+ func remove() {+ loading?.cancel()+ loading = nil+ try? FileManager.default.removeItem(at: Self.modelsRoot)+ refresh()+ }++ /// Loads Parakeet once; later calls get the same instance.+ func manager() async throws -> AsrManager {+ if let loading { return try await loading.value }+ let task = Task<AsrManager, Error> {+ let models = try await AsrModels.load(from: Self.asrDirectory, version: Self.version)+ let asr = AsrManager(config: .default)+ try await asr.loadModels(models)+ return asr+ }+ loading = task+ do {+ return try await task.value+ } catch {+ loading = nil+ throw error+ }+ }++ /// Loads the model in the background when dictation will use it, so the first one is quick.+ func preload() {+ guard state == .ready, loading == nil else { return }+ Task { @MainActor in _ = try? await manager() }+ }++ /// 16 kHz mono samples → text.+ func transcribe(_ samples: [Float]) async throws -> String {+ try await transcribeWithTimings(samples).text+ }++ func transcribeWithTimings(_ samples: [Float]) async throws -> ASRResult {+ var audio = samples+ // Parakeet wants at least a second, and a little silence at the end keeps the last word.+ audio.append(contentsOf: [Float](repeating: 0, count: max(4_800, 16_000 - audio.count)))+ let asr = try await manager()+ var decoder = TdtDecoderState.make(decoderLayers: await asr.decoderLayerCount)+ return try await asr.transcribe(audio, decoderState: &decoder)+ }+}++// MARK: - 16 kHz mono++/// Turns the microphone's or the Mac's audio, in whatever format it comes, into the 16 kHz mono+/// Float32 samples Parakeet and the diarizer take. Fed from one audio thread at a time.+final class Resampler16k: @unchecked Sendable {+ nonisolated(unsafe) static let format = AVAudioFormat(commonFormat: .pcmFormatFloat32, sampleRate: 16_000,+ channels: 1, interleaved: false)!+ private let converter: AVAudioConverter+ private let ratio: Double++ init?(from input: AVAudioFormat) {+ guard input.sampleRate > 0, let converter = AVAudioConverter(from: input, to: Self.format) else { return nil }+ converter.downmix = true+ self.converter = converter+ ratio = 16_000 / input.sampleRate+ }++ func convert(_ buffer: AVAudioPCMBuffer) -> [Float] {+ let capacity = AVAudioFrameCount(Double(buffer.frameLength) * ratio) + 64+ guard buffer.frameLength > 0,+ let out = AVAudioPCMBuffer(pcmFormat: Self.format, frameCapacity: capacity) else { return [] }+ nonisolated(unsafe) var fed = false+ nonisolated(unsafe) let source = buffer+ var error: NSError?+ let status = converter.convert(to: out, error: &error) { _, inputStatus in+ if fed {+ inputStatus.pointee = .noDataNow+ return nil+ }+ fed = true+ inputStatus.pointee = .haveData+ return source+ }+ guard status != .error, let data = out.floatChannelData, out.frameLength > 0 else { return [] }+ return Array(UnsafeBufferPointer(start: data[0], count: Int(out.frameLength)))+ }+}++// MARK: - Dictation with Parakeet++/// Flow dictation with Parakeet: the microphone is recorded while the key is held, then Parakeet+/// writes it all at once (a few hundred milliseconds for a minute of speech). Only the microphone+/// permission is needed; nothing leaves the Mac.+final class ParakeetDictation: @unchecked Sendable {+ @MainActor private(set) var isRecording = false+ /// Flow dictation's pill: the microphone's levels by frequency.+ var bands: FlowAudioBands?++ private let engine = AVAudioEngine()+ private let samples = OSAllocatedUnfairLock(initialState: [Float]())++ @MainActor func start() async {+ guard !isRecording, await AVAudioApplication.requestRecordPermission() else { return }+ samples.withLock { $0.removeAll(keepingCapacity: true) }+ guard Self.startEngine(engine, into: samples, bands: bands) else { return }+ isRecording = true+ NotificationCenter.default.post(name: .dictationDidStart, object: nil)+ }++ /// Stops the microphone and returns the words.+ @MainActor func finish() async -> String {+ guard isRecording else { return "" }+ stopEngine()+ let audio = samples.withLock { $0 }+ do {+ return try await Parakeet.shared.transcribe(audio)+ } catch {+ appendAppLog("nb.log", "[Parakeet] dictation failed: \(error.localizedDescription)")+ return ""+ }+ }++ /// Stops without words (Esc, another key).+ @MainActor func stop() {+ guard isRecording else { return }+ stopEngine()+ samples.withLock { $0.removeAll() }+ }++ @MainActor private func stopEngine() {+ engine.inputNode.removeTap(onBus: 0)+ engine.stop()+ isRecording = false+ NotificationCenter.default.post(name: .dictationDidEnd, object: nil)+ }++ nonisolated private static func startEngine(_ engine: AVAudioEngine, into samples: OSAllocatedUnfairLock<[Float]>,+ bands: FlowAudioBands?) -> Bool {+ let input = engine.inputNode+ let format = input.outputFormat(forBus: 0)+ guard let resampler = Resampler16k(from: format) else { return false }+ input.installTap(onBus: 0, bufferSize: 1024, format: format) { buffer, _ in+ bands?.consume(buffer)+ let out = resampler.convert(buffer)+ if !out.isEmpty { samples.withLock { $0.append(contentsOf: out) } }+ }+ engine.prepare()+ do { try engine.start() } catch {+ input.removeTap(onBus: 0)+ return false+ }+ return true+ }+}+#endifdiff --git a/NotchBuddy/project.yml b/NotchBuddy/project.ymlindex 1d716a2f..c36114d6 100644--- a/NotchBuddy/project.yml+++ b/NotchBuddy/project.yml@@ -13,6 +13,14 @@ options:# Production CloudKit environment, so the iPhone joins it with the# CoucouPhoneProduction scheme. Release also compiles PHONE_LINK (the sync# stays off until turned on in Settings); Debug stays unsigned without it.+# FluidAudio (Apache-2.0): Parakeet speech-to-text and speaker diarization on the Mac's+# Neural Engine, for Flow dictation and the Notetaker (GitHub build only). Its models are+# downloaded from Hugging Face only when the user clicks Download in Coucou Flow → Settings.+packages:+ FluidAudio:+ url: https://github.com/FluidInference/FluidAudio+ exactVersion: 0.17.7+configs:Debug: debugDebugCloud: debug@@ -178,6 +186,8 @@ targets:CODE_SIGN_ENTITLEMENTS: Resources/CoucouReleaseCloud.entitlementsSWIFT_ACTIVE_COMPILATION_CONDITIONS: PHONE_LINKPROVISIONING_PROFILE_SPECIFIER: "Coucou Developer ID"+ dependencies:+ - package: FluidAudiopostBuildScripts:- name: "Write Git Hash to Info.plist"script: |