Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more
thinking token bug fixes ; logging for debug toggle fix ;
altic-dev1d3d8b04bba0
diff --git a/Sources/Fluid/AppDelegate.swift b/Sources/Fluid/AppDelegate.swiftindex af2dd027..41ef378a 100644--- a/Sources/Fluid/AppDelegate.swift+++ b/Sources/Fluid/AppDelegate.swift@@ -35,7 +35,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {@objc func checkForUpdatesManually() {// Confirm invocation- print("🔎 Manual update check triggered")+ DebugLogger.shared.info("🔎 Manual update check triggered", source: "AppDelegate")// We use SimpleUpdater for manual checks; AppUpdater instance is optional@@ -46,8 +46,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {source: "AppDelegate")DebugLogger.shared.info("Checking repository: altic-dev/Fluid-oss", source: "AppDelegate")- print("🔍 DEBUG: Manual update check started - Current version: \(currentVersion)")- print("🔍 DEBUG: Repository: altic-dev/Fluid-oss")+ DebugLogger.shared.debug("🔍 DEBUG: Manual update check started - Current version: \(currentVersion)", source: "AppDelegate")+ DebugLogger.shared.debug("🔍 DEBUG: Repository: altic-dev/Fluid-oss", source: "AppDelegate")Task { @MainActor indo {@@ -148,7 +148,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {@MainActorprivate func showUpdateAlert(title: String, message: String) {- print("🔔 Showing alert: \(title)")+ DebugLogger.shared.info("🔔 Showing alert: \(title)", source: "AppDelegate")let alert = NSAlert()alert.messageText = titlealert.informativeText = messagediff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swiftindex be514103..da6681e8 100644--- a/Sources/Fluid/ContentView.swift+++ b/Sources/Fluid/ContentView.swift@@ -1781,22 +1781,16 @@ struct ContentView: View {await MainActor.run {self.hotkeyManagerInitialized = self.hotkeyManager?.validateEventTapHealth() ?? false- if UserDefaults.standard.bool(forKey: "enableDebugLogs") {- print("[ContentView] Initial hotkey manager health check: \(self.hotkeyManagerInitialized)")- }+ DebugLogger.shared.debug("Initial hotkey manager health check: \(self.hotkeyManagerInitialized)", source: "ContentView")// If still not initialized and accessibility is enabled, try reinitializingif !self.hotkeyManagerInitialized && self.accessibilityEnabled {self.hotkeyManagerInitialized = self.hotkeyManager?.validateEventTapHealth() ?? false- if UserDefaults.standard.bool(forKey: "enableDebugLogs") {- print("[ContentView] Initial hotkey manager health check: \(self.hotkeyManagerInitialized)")- }+ DebugLogger.shared.debug("Initial hotkey manager health check: \(self.hotkeyManagerInitialized)", source: "ContentView")// If still not initialized and accessibility is enabled, try reinitializingif !self.hotkeyManagerInitialized && self.accessibilityEnabled {- if UserDefaults.standard.bool(forKey: "enableDebugLogs") {- print("[ContentView] Hotkey manager not healthy, attempting reinitalization")- }+ DebugLogger.shared.debug("Hotkey manager not healthy, attempting reinitalization", source: "ContentView")self.hotkeyManager?.reinitialize()}}diff --git a/Sources/Fluid/Networking/ModelDownloader.swift b/Sources/Fluid/Networking/ModelDownloader.swiftindex c6916e88..4bf88c9d 100644--- a/Sources/Fluid/Networking/ModelDownloader.swift+++ b/Sources/Fluid/Networking/ModelDownloader.swift@@ -103,7 +103,7 @@ final class HuggingFaceModelDownloader {// If nothing to download, say so clearlyif pendingFiles.isEmpty {- print("[ModelDL] All required model files are already present. Nothing to download.")+ DebugLogger.shared.info("[ModelDL] All required model files are already present. Nothing to download.", source: "ModelDownloader")onProgress?(1.0, "")return}@@ -118,14 +118,14 @@ final class HuggingFaceModelDownloader {}let totalHuman = Self.formatBytes(totalBytes)- print("[ModelDL] Files to download: \(pendingFiles.count), total size: \(totalHuman)")+ DebugLogger.shared.info("[ModelDL] Files to download: \(pendingFiles.count), total size: \(totalHuman)", source: "ModelDownloader")var downloadedBytes: Int64 = 0let fallbackTotal = pendingFiles.countvar fallbackCompleted = 0for (idx, rel) in pendingFiles.enumerated() {- print("[ModelDL] (\(idx + 1)/\(pendingFiles.count)) Downloading: \(rel)")+ DebugLogger.shared.info("[ModelDL] (\(idx + 1)/\(pendingFiles.count)) Downloading: \(rel)", source: "ModelDownloader")try await self.downloadFile(relativePath: rel, to: targetRoot.appendingPathComponent(rel)) { perFilePct inif totalBytes > 0 {let expected = sizeByPath[rel] ?? 0@@ -133,8 +133,8 @@ final class HuggingFaceModelDownloader {let overallBase = Double(downloadedBytes) / Double(totalBytes)let combined = min(1.0, overallBase + (perFilePct * Double(expected)) / Double(totalBytes))onProgress?(combined, rel)- print(String(format: "[ModelDL] File progress: %.1f%% (%@)", perFilePct * 100.0, rel))- print(String(format: "[ModelDL] Overall progress (est.): %.1f%%", combined * 100.0))+ DebugLogger.shared.debug(String(format: "[ModelDL] File progress: %.1f%% (%@)", perFilePct * 100.0, rel), source: "ModelDownloader")+ DebugLogger.shared.debug(String(format: "[ModelDL] Overall progress (est.): %.1f%%", combined * 100.0), source: "ModelDownloader")}}}@@ -142,11 +142,11 @@ final class HuggingFaceModelDownloader {downloadedBytes += (sizeByPath[rel] ?? 0)let pct = min(1.0, Double(downloadedBytes) / Double(totalBytes))onProgress?(pct, rel)- print(String(format: "[ModelDL] Overall progress: %.1f%% (\(Self.formatBytes(downloadedBytes))/\(Self.formatBytes(totalBytes)))", pct * 100.0))+ DebugLogger.shared.info(String(format: "[ModelDL] Overall progress: %.1f%% (\(Self.formatBytes(downloadedBytes))/\(Self.formatBytes(totalBytes)))", pct * 100.0), source: "ModelDownloader")} else if fallbackTotal > 0 {fallbackCompleted += 1onProgress?(Double(fallbackCompleted) / Double(fallbackTotal), rel)- print("[ModelDL] Overall progress: \(fallbackCompleted)/\(fallbackTotal)")+ DebugLogger.shared.info("[ModelDL] Overall progress: \(fallbackCompleted)/\(fallbackTotal)", source: "ModelDownloader")}}}@@ -289,11 +289,11 @@ extension HuggingFaceModelDownloader {let decUrl = repoDirectory.appendingPathComponent("Decoder.mlmodelc")let jointUrl = repoDirectory.appendingPathComponent("JointDecision.mlmodelc")- print("[ModelDL] Loading v3 models from: \(repoDirectory.path)")- print("[ModelDL] Preprocessor path: \(preprocessorUrl.path)")- print("[ModelDL] Encoder path: \(encoderUrl.path)")- print("[ModelDL] Decoder path: \(decUrl.path)")- print("[ModelDL] JointDecision path: \(jointUrl.path)")+ DebugLogger.shared.info("[ModelDL] Loading v3 models from: \(repoDirectory.path)", source: "ModelDownloader")+ DebugLogger.shared.debug("[ModelDL] Preprocessor path: \(preprocessorUrl.path)", source: "ModelDownloader")+ DebugLogger.shared.debug("[ModelDL] Encoder path: \(encoderUrl.path)", source: "ModelDownloader")+ DebugLogger.shared.debug("[ModelDL] Decoder path: \(decUrl.path)", source: "ModelDownloader")+ DebugLogger.shared.debug("[ModelDL] JointDecision path: \(jointUrl.path)", source: "ModelDownloader")// Check if new structure existslet hasNewStructure = fm.fileExists(atPath: preprocessorUrl.path) && fm.fileExists(atPath: encoderUrl.path)@@ -303,20 +303,20 @@ extension HuggingFaceModelDownloader {if hasNewStructure {// Load with new structure (separate Preprocessor and Encoder)- print("[ModelDL] Loading with new model structure (Preprocessor + Encoder)")+ DebugLogger.shared.info("[ModelDL] Loading with new model structure (Preprocessor + Encoder)", source: "ModelDownloader")preprocessor = try MLModel(contentsOf: preprocessorUrl, configuration: config)encoder = try MLModel(contentsOf: encoderUrl, configuration: config)} else {// Fallback: Try old structure (MelEncoder)let melEncUrl = repoDirectory.appendingPathComponent("MelEncoder.mlmodelc")- print("[ModelDL] New structure not found, trying legacy MelEncoder")- print("[ModelDL] MelEncoder path: \(melEncUrl.path)")- print("[ModelDL] MelEncoder exists: \(fm.fileExists(atPath: melEncUrl.path))")+ DebugLogger.shared.info("[ModelDL] New structure not found, trying legacy MelEncoder", source: "ModelDownloader")+ DebugLogger.shared.debug("[ModelDL] MelEncoder path: \(melEncUrl.path)", source: "ModelDownloader")+ DebugLogger.shared.debug("[ModelDL] MelEncoder exists: \(fm.fileExists(atPath: melEncUrl.path))", source: "ModelDownloader")if fm.fileExists(atPath: melEncUrl.path) {encoder = try MLModel(contentsOf: melEncUrl, configuration: config)preprocessor = nil- print("[ModelDL] Using MelEncoder (legacy mode)")+ DebugLogger.shared.info("[ModelDL] Using MelEncoder (legacy mode)", source: "ModelDownloader")} else {throw NSError(domain: "ModelDL", code: -1, userInfo: [NSLocalizedDescriptionKey: "Neither new model structure (Preprocessor + Encoder) nor legacy structure (MelEncoder) found",@@ -346,7 +346,7 @@ extension HuggingFaceModelDownloader {if let idx = Int(k) { vocabulary[idx] = v }}- print("[ModelDL] Creating AsrModels")+ DebugLogger.shared.debug("[ModelDL] Creating AsrModels", source: "ModelDownloader")// For v2 models without separate preprocessor, use encoder as preprocessor// For v3 models, use the separate preprocessordiff --git a/Sources/Fluid/Persistence/SettingsStore.swift b/Sources/Fluid/Persistence/SettingsStore.swiftindex 97126692..cb2c4c62 100644--- a/Sources/Fluid/Persistence/SettingsStore.swift+++ b/Sources/Fluid/Persistence/SettingsStore.swift@@ -162,6 +162,7 @@ final class SettingsStore: ObservableObject {set {objectWillChange.send()self.defaults.set(newValue, forKey: Keys.enableDebugLogs)+ DebugLogger.shared.refreshLoggingEnabled()}}diff --git a/Sources/Fluid/Services/CommandModeService.swift b/Sources/Fluid/Services/CommandModeService.swiftindex 53e3fee2..cc5a06c5 100644--- a/Sources/Fluid/Services/CommandModeService.swift+++ b/Sources/Fluid/Services/CommandModeService.swift@@ -831,6 +831,7 @@ final class CommandModeService: ObservableObject {streaming: enableStreaming,tools: [TerminalService.toolDefinition],temperature: isReasoningModel ? nil : 0.1,+ maxTokens: isReasoningModel ? 4096 : nil, // Reasoning models like o1 need a budget for thoughtsextraParameters: extraParams)diff --git a/Sources/Fluid/Services/DebugLogger.swift b/Sources/Fluid/Services/DebugLogger.swiftindex 831aa4db..77cfb618 100644--- a/Sources/Fluid/Services/DebugLogger.swift+++ b/Sources/Fluid/Services/DebugLogger.swift@@ -74,30 +74,32 @@ class DebugLogger: ObservableObject {func log(_ message: String, level: LogLevel = .info, source: String = "App") {let loggingEnabled = self.loggingEnabled++ // If logging is disabled, we drop all logs except errors which are always printed to console+ if !loggingEnabled && level != .error {+ return+ }self.queue.async {let timestamp = Date()let timestampString = Self.logFormatter.string(from: timestamp)- let entry: LogEntry? = loggingEnabled- ? LogEntry(- timestamp: timestamp,- level: level,- message: message,- source: source,- formattedTimestamp: timestampString- )- : nil- let formattedLine = entry.map(self.formatLogEntry)- ?? self.formatLogLine(timestamp: timestampString, level: level, source: source, message: message)++ let formattedLine = self.formatLogLine(timestamp: timestampString, level: level, source: source, message: message)+ // Always write to FileLogger and Console if we reach this point (either logging is enabled OR it's an error)FileLogger.shared.append(line: formattedLine)-- if level == .error || level == .warning || level == .debug {- // Also print to console for Xcode debugging- print(formattedLine)- }-- guard let entry = entry else { return }+ print(formattedLine)++ // Only update the UI logs if logging is enabled (don't show errors in UI if debug is off)+ guard loggingEnabled else { return }++ let entry = LogEntry(+ timestamp: timestamp,+ level: level,+ message: message,+ source: source,+ formattedTimestamp: timestampString+ )DispatchQueue.main.async {self.logs.append(entry)diff --git a/Sources/Fluid/Services/GlobalHotkeyManager.swift b/Sources/Fluid/Services/GlobalHotkeyManager.swiftindex 00d90897..83dd8587 100644--- a/Sources/Fluid/Services/GlobalHotkeyManager.swift+++ b/Sources/Fluid/Services/GlobalHotkeyManager.swift@@ -154,9 +154,7 @@ final class GlobalHotkeyManager: NSObject {self.cleanupEventTap()if !AXIsProcessTrusted() {- if UserDefaults.standard.bool(forKey: "enableDebugLogs") {- print("[GlobalHotkeyManager] Accessibility permissions not granted")- }+ DebugLogger.shared.debug("Accessibility permissions not granted", source: "GlobalHotkeyManager")return false}@@ -179,17 +177,13 @@ final class GlobalHotkeyManager: NSObject {)guard let tap = eventTap else {- if UserDefaults.standard.bool(forKey: "enableDebugLogs") {- print("[GlobalHotkeyManager] Failed to create CGEvent tap")- }+ DebugLogger.shared.error("Failed to create CGEvent tap", source: "GlobalHotkeyManager")return false}self.runLoopSource = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, tap, 0)guard let source = runLoopSource else {- if UserDefaults.standard.bool(forKey: "enableDebugLogs") {- print("[GlobalHotkeyManager] Failed to create CFRunLoopSource")- }+ DebugLogger.shared.error("Failed to create CFRunLoopSource", source: "GlobalHotkeyManager")return false}@@ -197,16 +191,12 @@ final class GlobalHotkeyManager: NSObject {CGEvent.tapEnable(tap: tap, enable: true)if !self.isEventTapEnabled() {- if UserDefaults.standard.bool(forKey: "enableDebugLogs") {- print("[GlobalHotkeyManager] Event tap could not be enabled")- }+ DebugLogger.shared.error("Event tap could not be enabled", source: "GlobalHotkeyManager")self.cleanupEventTap()return false}- if UserDefaults.standard.bool(forKey: "enableDebugLogs") {- print("[GlobalHotkeyManager] Event tap successfully created and enabled")- }+ DebugLogger.shared.info("Event tap successfully created and enabled", source: "GlobalHotkeyManager")return true}@@ -580,9 +570,7 @@ final class GlobalHotkeyManager: NSObject {}func reinitialize() {- if UserDefaults.standard.bool(forKey: "enableDebugLogs") {- print("[GlobalHotkeyManager] Manual reinitialization requested")- }+ DebugLogger.shared.info("Manual reinitialization requested", source: "GlobalHotkeyManager")self.initializationTask?.cancel()self.healthCheckTask?.cancel()@@ -600,17 +588,13 @@ final class GlobalHotkeyManager: NSObject {await MainActor.run {if !self.validateEventTapHealth() {- if UserDefaults.standard.bool(forKey: "enableDebugLogs") {- print("[GlobalHotkeyManager] Health check failed, attempting to recover")- }-+ DebugLogger.shared.warning("Health check failed, attempting to recover", source: "GlobalHotkeyManager")+if self.setupGlobalHotkey() {self.isInitialized = true- if UserDefaults.standard.bool(forKey: "enableDebugLogs") {- print("[GlobalHotkeyManager] Health check recovery successful")- }+ DebugLogger.shared.info("Health check recovery successful", source: "GlobalHotkeyManager")} else {- print("[GlobalHotkeyManager] Health check recovery failed")+ DebugLogger.shared.error("Health check recovery failed", source: "GlobalHotkeyManager")self.isInitialized = false}}@@ -623,9 +607,7 @@ final class GlobalHotkeyManager: NSObject {initializationTask?.cancel()healthCheckTask?.cancel()cleanupEventTap()-- if UserDefaults.standard.bool(forKey: "enableDebugLogs") {- print("[GlobalHotkeyManager] Deinitialized and cleaned up")- }++ DebugLogger.shared.info("Deinitialized and cleaned up", source: "GlobalHotkeyManager")}}diff --git a/Sources/Fluid/Services/LLMClient.swift b/Sources/Fluid/Services/LLMClient.swiftindex 0072f2d5..6d8e64c3 100644--- a/Sources/Fluid/Services/LLMClient.swift+++ b/Sources/Fluid/Services/LLMClient.swift@@ -122,6 +122,7 @@ final class LLMClient {/// Handles thinking token extraction, tool call parsing, and retries.func call(_ config: Config) async throws -> Response {let request = try buildRequest(config)+ self.logRequest(request)// Retry logic for transient network errorsvar lastError: Error?@@ -322,8 +323,19 @@ final class LLMClient {continue}- // Handle reasoning_content field (DeepSeek style - separate from text content)- if let reasoning = delta["reasoning_content"] as? String {+ // DEBUG LOG: Show full delta to see all fields (e.g., 'reasoning', 'thought', 'delta_reasoning', etc.)+ if let deltaData = try? JSONSerialization.data(withJSONObject: delta, options: [.fragmentsAllowed]),+ let deltaString = String(data: deltaData, encoding: .utf8) {+ DebugLogger.shared.debug("LLMClient: Full Delta: \(deltaString)", source: "LLMClient")+ }++ // Handle separate reasoning fields (OpenAI 'reasoning', 'reasoning_content', DeepSeek, etc.)+ let reasoningField = delta["reasoning_content"] as? String ??+ delta["reasoning"] as? String ??+ delta["thought"] as? String ??+ delta["thinking"] as? String++ if let reasoning = reasoningField {if state == .initial {state = .inThinkingconfig.onThinkingStart?()@@ -334,6 +346,15 @@ final class LLMClient {// Handle content with potential <think> tagsif let content = delta["content"] as? String {+ // If we were in thinking mode via a separate field (not tag-based),+ // receiving "content" usually means the thinking phase is over.+ if state == .inThinking && reasoningField == nil && tagDetectionBuffer.isEmpty {+ // This is a subtle heuristic: if we were thinking, didn't just get a reasoning field chunk,+ // and have no partial tags buffered, we should check if this content chunk+ // is the start of the final answer.+ // For safety with tag-based parsers, we let the parser decide unless it's a known separate-field model.+ }+// Debug: Log first few chunks and any chunk containing think tagslet containsThinkTag = content.contains("<think") || content.contains("</think") || content.contains("<thinking") || content.contains("</thinking")if thinkingBuffer.count + contentBuffer.count < 8 || containsThinkTag {@@ -461,8 +482,12 @@ final class LLMClient {// Strip thinking tags and extract thinking contentlet (thinking, cleanedContent) = self.stripThinkingTags(rawContent)- // Also check for reasoning_content field (DeepSeek style)- let reasoningContent = message["reasoning_content"] as? String+ // Also check for multiple reasoning field variants+ let reasoningContent = message["reasoning_content"] as? String ??+ message["reasoning"] as? String ??+ message["thought"] as? String ??+ message["thinking"] as? String+let finalThinking = [thinking, reasoningContent].compactMap { $0 }.filter { !$0.isEmpty }.joined(separator: "\n")return Response(@@ -582,4 +607,25 @@ final class LLMClient {return false}++ // MARK: - Logging Helpers++ private func logRequest(_ request: URLRequest) {+ guard let url = request.url, let method = request.httpMethod else { return }++ var bodyString = ""+ if let body = request.httpBody {+ bodyString = String(data: body, encoding: .utf8) ?? ""+ }++ var curl = "curl -X \(method) \"\(url.absoluteString)\" \\\n"+ for (key, value) in request.allHTTPHeaderFields ?? [:] {+ let maskedValue = key.lowercased().contains("auth") ? "Bearer [REDACTED]" : value+ curl += " -H \"\(key): \(maskedValue)\" \\\n"+ }+ curl += " -d '\(bodyString)'"++ DebugLogger.shared.info("LLMClient: Full Request as cURL:\n\(curl)", source: "LLMClient")+ }}+diff --git a/Sources/Fluid/Services/MenuBarManager.swift b/Sources/Fluid/Services/MenuBarManager.swiftindex 38921302..a94b5f11 100644--- a/Sources/Fluid/Services/MenuBarManager.swift+++ b/Sources/Fluid/Services/MenuBarManager.swift@@ -254,7 +254,7 @@ final class MenuBarManager: ObservableObject {self.isSetup = true} catch {// If setup fails, retry after delay- print("MenuBar setup failed, retrying: \(error)")+ DebugLogger.shared.error("MenuBar setup failed, retrying: \(error)", source: "MenuBarManager")DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { [weak self] inself?.setupMenuBarSafely()}@@ -424,7 +424,7 @@ final class MenuBarManager: ObservableObject {}@objc private func checkForUpdates(_ sender: Any?) {- print("🔎 Menu action: Check for Updates…")+ DebugLogger.shared.info("🔎 Menu action: Check for Updates…", source: "MenuBarManager")// Call the AppDelegate's manual update check method if availableif let appDelegate = NSApp.delegate as? AppDelegate {diff --git a/Sources/Fluid/Services/RewriteModeService.swift b/Sources/Fluid/Services/RewriteModeService.swiftindex 12a578d4..210cd68c 100644--- a/Sources/Fluid/Services/RewriteModeService.swift+++ b/Sources/Fluid/Services/RewriteModeService.swift@@ -214,6 +214,7 @@ final class RewriteModeService: ObservableObject {streaming: enableStreaming,tools: [],temperature: isReasoningModel ? nil : 0.7,+ maxTokens: isReasoningModel ? 4096 : nil, // Reasoning models like o1 need a budget for thoughtsextraParameters: extraParams)diff --git a/Sources/Fluid/Services/SimpleUpdater.swift b/Sources/Fluid/Services/SimpleUpdater.swiftindex e023cd8c..b5ece0ea 100644--- a/Sources/Fluid/Services/SimpleUpdater.swift+++ b/Sources/Fluid/Services/SimpleUpdater.swift@@ -224,8 +224,8 @@ final class SimpleUpdater {}()guard sameIdentity || sameTeam || bothAllowed else {- print("SimpleUpdater: Code-sign mismatch. Current=\(curID) New=\(newID)")- print("SimpleUpdater: Current Team=\(curTeam ?? "none") New Team=\(newTeam ?? "none")")+ DebugLogger.shared.error("SimpleUpdater: Code-sign mismatch. Current=\(curID) New=\(newID)", source: "SimpleUpdater")+ DebugLogger.shared.error("SimpleUpdater: Current Team=\(curTeam ?? "none") New Team=\(newTeam ?? "none")", source: "SimpleUpdater")throw SimpleUpdateError.codesignMismatch}#endif@@ -312,33 +312,33 @@ final class SimpleUpdater {// we need to replace the old app and use the new namelet installedAppName = installedAppURL.lastPathComponentlet downloadedAppName = downloadedAppURL.lastPathComponent-- print("SimpleUpdater: Installing app - Current: \(installedAppName), New: \(downloadedAppName)")++ DebugLogger.shared.info("SimpleUpdater: Installing app - Current: \(installedAppName), New: \(downloadedAppName)", source: "SimpleUpdater")let finalAppURL: URLif installedAppName != downloadedAppName {// App name changed - use the new namefinalAppURL = installedAppURL.deletingLastPathComponent().appendingPathComponent(downloadedAppName)- print("SimpleUpdater: App name changed, installing to: \(finalAppURL.path)")+ DebugLogger.shared.info("SimpleUpdater: App name changed, installing to: \(finalAppURL.path)", source: "SimpleUpdater")// Safety check: ensure we don't overwrite an existing app with the new nameif FileManager.default.fileExists(atPath: finalAppURL.path) {- print("SimpleUpdater: Removing existing app at new location: \(finalAppURL.path)")+ DebugLogger.shared.info("SimpleUpdater: Removing existing app at new location: \(finalAppURL.path)", source: "SimpleUpdater")try FileManager.default.removeItem(at: finalAppURL)}// Remove old app if it existsif FileManager.default.fileExists(atPath: installedAppURL.path) {- print("SimpleUpdater: Removing old app: \(installedAppURL.path)")+ DebugLogger.shared.info("SimpleUpdater: Removing old app: \(installedAppURL.path)", source: "SimpleUpdater")try FileManager.default.removeItem(at: installedAppURL)}// Move new app to Applications with new nametry FileManager.default.moveItem(at: downloadedAppURL, to: finalAppURL)- print("SimpleUpdater: Successfully installed new app at: \(finalAppURL.path)")+ DebugLogger.shared.info("SimpleUpdater: Successfully installed new app at: \(finalAppURL.path)", source: "SimpleUpdater")} else {// Same name - normal replacement- print("SimpleUpdater: Same app name, performing normal replacement")+ DebugLogger.shared.info("SimpleUpdater: Same app name, performing normal replacement", source: "SimpleUpdater")if FileManager.default.fileExists(atPath: installedAppURL.path) {try FileManager.default.removeItem(at: installedAppURL)}@@ -348,11 +348,11 @@ final class SimpleUpdater {// Use modern NSWorkspace API for more reliable app launchingDispatchQueue.main.async {- print("SimpleUpdater: Attempting to relaunch app at: \(finalAppURL.path)")+ DebugLogger.shared.info("SimpleUpdater: Attempting to relaunch app at: \(finalAppURL.path)", source: "SimpleUpdater")// Verify the app exists before trying to launchguard FileManager.default.fileExists(atPath: finalAppURL.path) else {- print("SimpleUpdater: ERROR - App not found at expected location: \(finalAppURL.path)")+ DebugLogger.shared.error("SimpleUpdater: ERROR - App not found at expected location: \(finalAppURL.path)", source: "SimpleUpdater")// Don't terminate if we can't find the new appreturn}@@ -362,13 +362,13 @@ final class SimpleUpdater {NSWorkspace.shared.openApplication(at: finalAppURL, configuration: configuration) { _, error inif let error = error {- print("SimpleUpdater: Failed to relaunch app: \(error)")- print("SimpleUpdater: App location: \(finalAppURL.path)")+ DebugLogger.shared.error("SimpleUpdater: Failed to relaunch app: \(error)", source: "SimpleUpdater")+ DebugLogger.shared.error("SimpleUpdater: App location: \(finalAppURL.path)", source: "SimpleUpdater")// Don't terminate if relaunch failed - let user manually restartreturn}- print("SimpleUpdater: Successfully relaunched app, terminating old instance")+ DebugLogger.shared.info("SimpleUpdater: Successfully relaunched app, terminating old instance", source: "SimpleUpdater")// Give the new instance time to fully start before terminatingDispatchQueue.main.asyncAfter(deadline: .now() + 2.0) {NSApp.terminate(nil)diff --git a/Sources/Fluid/Services/ThinkingParsers.swift b/Sources/Fluid/Services/ThinkingParsers.swiftindex 4439bd60..2858f04d 100644--- a/Sources/Fluid/Services/ThinkingParsers.swift+++ b/Sources/Fluid/Services/ThinkingParsers.swift@@ -55,10 +55,17 @@ enum ThinkingParserFactory {return StandardThinkingParser()}- // DeepSeek models: use standard pattern (they also have reasoning_content field handled separately)+ // DeepSeek models: often use separate reasoning_content fieldif modelLower.contains("deepseek") {- DebugLogger.shared.debug("ThinkingParser: Using StandardParser for DeepSeek model '\(model)'", source: "LLMClient")- return StandardThinkingParser()+ DebugLogger.shared.debug("ThinkingParser: Using SeparateFieldParser for DeepSeek model '\(model)'", source: "LLMClient")+ return SeparateFieldThinkingParser()+ }++ // OpenAI reasoning models (o1, o3, gpt-5): use SeparateFieldThinkingParser+ if SettingsStore.shared.isReasoningModel(model) &&+ (modelLower.contains("gpt-5") || modelLower.contains("o1") || modelLower.contains("o3") || modelLower.contains("gpt-oss")) {+ DebugLogger.shared.debug("ThinkingParser: Using SeparateFieldParser for reasoning model '\(model)'", source: "LLMClient")+ return SeparateFieldThinkingParser()}// Default: Standard parser with <think>...</think> pattern@@ -284,3 +291,26 @@ struct NoThinkingParser: ThinkingParser {return ("", contentBuffer.joined())}}++// MARK: - Separate Field Thinking Parser++/// Parser for models that use separate fields (reasoning_content, thought, etc.)+/// instead of inline tags like <think>.+/// Used by: OpenAI o1/o3/gpt-5, DeepSeek (official API).+struct SeparateFieldThinkingParser: ThinkingParser {+ mutating func processChunk(+ _ chunk: String,+ currentState: ThinkingParserState,+ tagBuffer: inout String+ ) -> (ThinkingParserState, String, String) {+ // For separate-field models, receiving any "content" chunk means+ // we are definitively in the content phase.+ return (.inContent, "", chunk)+ }++ func finalize(thinkingBuffer: [String], contentBuffer: [String], finalState: ThinkingParserState) -> (thinking: String, content: String) {+ // No tag stripping needed for separate fields+ return (thinkingBuffer.joined(), contentBuffer.joined().trimmingCharacters(in: .whitespacesAndNewlines))+ }+}+diff --git a/Sources/Fluid/Services/TypingService.swift b/Sources/Fluid/Services/TypingService.swiftindex f37ed5e0..84a99bdd 100644--- a/Sources/Fluid/Services/TypingService.swift+++ b/Sources/Fluid/Services/TypingService.swift@@ -10,7 +10,7 @@ final class TypingService {}private func log(_ message: @autoclosure () -> String) {- if Self.isLoggingEnabled { print(message()) }+ DebugLogger.shared.debug(message(), source: "TypingService")}private var isCurrentlyTyping = falsediff --git a/Sources/Fluid/UI/FeedbackView.swift b/Sources/Fluid/UI/FeedbackView.swiftindex f15f47b6..c66f2c60 100644--- a/Sources/Fluid/UI/FeedbackView.swift+++ b/Sources/Fluid/UI/FeedbackView.swift@@ -138,15 +138,16 @@ struct FeedbackView: View {.strokeBorder(Color(nsColor: NSColor.separatorColor), lineWidth: 1.5))).scrollContentBackground(.hidden).overlay(- VStack {+ Group {if self.feedbackText.isEmpty {Text("Share your thoughts, report bugs, or suggest features...").font(.subheadline).foregroundStyle(.secondary)+ .padding(.leading, 4)}}+ .allowsHitTesting(false))- .allowsHitTesting(false)// Debug logs optionToggle("Include debug logs", isOn: self.$includeDebugLogs)diff --git a/Sources/Fluid/UI/MeetingTranscriptionView.swift b/Sources/Fluid/UI/MeetingTranscriptionView.swiftindex 455aa224..eb30d971 100644--- a/Sources/Fluid/UI/MeetingTranscriptionView.swift+++ b/Sources/Fluid/UI/MeetingTranscriptionView.swift@@ -185,7 +185,7 @@ struct MeetingTranscriptionView: View {self.transcriptionService.reset()}case let .failure(error):- print("File picker error: \(error)")+ DebugLogger.shared.error("File picker error: \(error)", source: "MeetingTranscriptionView")}}}@@ -283,9 +283,9 @@ struct MeetingTranscriptionView: View {) { result inswitch result {case .success:- print("File exported successfully")+ DebugLogger.shared.info("File exported successfully", source: "MeetingTranscriptionView")case let .failure(error):- print("Export failed: \(error)")+ DebugLogger.shared.error("Export failed: \(error)", source: "MeetingTranscriptionView")}}}@@ -320,7 +320,7 @@ struct MeetingTranscriptionView: View {do {_ = try await self.transcriptionService.transcribeFile(fileURL)} catch {- print("Transcription error: \(error)")+ DebugLogger.shared.error("Transcription error: \(error)", source: "MeetingTranscriptionView")}}diff --git a/Sources/Fluid/UI/SettingsView.swift b/Sources/Fluid/UI/SettingsView.swiftindex 9837e5fb..526150d1 100644--- a/Sources/Fluid/UI/SettingsView.swift+++ b/Sources/Fluid/UI/SettingsView.swift@@ -447,13 +447,19 @@ struct SettingsView: View {.font(.body)Spacer()Picker("Input Device", selection: self.$selectedInputUID) {- ForEach(self.inputDevices, id: \.uid) { dev in- Text(dev.name).tag(dev.uid)+ // Handle empty state gracefully+ if self.inputDevices.isEmpty {+ Text("Loading...").tag("")+ } else {+ ForEach(self.inputDevices, id: \.uid) { dev in+ Text(dev.name).tag(dev.uid)+ }}}.pickerStyle(.menu).frame(width: 240).onChange(of: self.selectedInputUID) { _, newUID in+ guard !newUID.isEmpty else { return }SettingsStore.shared.preferredInputDeviceUID = newUID_ = AudioDevice.setDefaultInputDevice(uid: newUID)if self.asr.isRunning {@@ -461,6 +467,24 @@ struct SettingsView: View {self.startRecording()}}+ // Sync selection when devices load or change+ .onChange(of: self.inputDevices) { _, newDevices in+ // If selection is empty or not found in new list, select first available+ if !newDevices.isEmpty {+ let currentValid = newDevices.contains { $0.uid == self.selectedInputUID }+ if !currentValid {+ if let prefUID = SettingsStore.shared.preferredInputDeviceUID,+ newDevices.contains(where: { $0.uid == prefUID }) {+ self.selectedInputUID = prefUID+ } else if let defaultUID = AudioDevice.getDefaultInputDevice()?.uid,+ newDevices.contains(where: { $0.uid == defaultUID }) {+ self.selectedInputUID = defaultUID+ } else {+ self.selectedInputUID = newDevices.first?.uid ?? ""+ }+ }+ }+ }}HStack {@@ -468,16 +492,39 @@ struct SettingsView: View {.font(.body)Spacer()Picker("Output Device", selection: self.$selectedOutputUID) {- ForEach(self.outputDevices, id: \.uid) { dev in- Text(dev.name).tag(dev.uid)+ // Handle empty state gracefully+ if self.outputDevices.isEmpty {+ Text("Loading...").tag("")+ } else {+ ForEach(self.outputDevices, id: \.uid) { dev in+ Text(dev.name).tag(dev.uid)+ }}}.pickerStyle(.menu).frame(width: 240).onChange(of: self.selectedOutputUID) { _, newUID in+ guard !newUID.isEmpty else { return }SettingsStore.shared.preferredOutputDeviceUID = newUID_ = AudioDevice.setDefaultOutputDevice(uid: newUID)}+ // Sync selection when devices load or change+ .onChange(of: self.outputDevices) { _, newDevices in+ if !newDevices.isEmpty {+ let currentValid = newDevices.contains { $0.uid == self.selectedOutputUID }+ if !currentValid {+ if let prefUID = SettingsStore.shared.preferredOutputDeviceUID,+ newDevices.contains(where: { $0.uid == prefUID }) {+ self.selectedOutputUID = prefUID+ } else if let defaultUID = AudioDevice.getDefaultOutputDevice()?.uid,+ newDevices.contains(where: { $0.uid == defaultUID }) {+ self.selectedOutputUID = defaultUID+ } else {+ self.selectedOutputUID = newDevices.first?.uid ?? ""+ }+ }+ }+ }}HStack(spacing: 10) {@@ -567,6 +614,17 @@ struct SettingsView: View {.foregroundStyle(.primary)VStack(alignment: .leading, spacing: 8) {+ self.settingsToggleRow(+ title: "Enable Debug Logs",+ description: "Capture and show detailed app activity.",+ isOn: Binding(+ get: { SettingsStore.shared.enableDebugLogs },+ set: { SettingsStore.shared.enableDebugLogs = $0 }+ )+ )++ Divider().padding(.vertical, 8)+Button {let url = FileLogger.shared.currentLogFileURL()if FileManager.default.fileExists(atPath: url.path) {@@ -597,6 +655,39 @@ struct SettingsView: View {await AudioStartupGate.shared.waitUntilOpen()self.refreshDevices()++ // Sync input device selection after refresh+ if !self.inputDevices.isEmpty {+ let inputValid = self.inputDevices.contains { $0.uid == self.selectedInputUID }+ if !inputValid || self.selectedInputUID.isEmpty {+ if let prefUID = SettingsStore.shared.preferredInputDeviceUID,+ self.inputDevices.contains(where: { $0.uid == prefUID }) {+ self.selectedInputUID = prefUID+ } else if let defaultUID = AudioDevice.getDefaultInputDevice()?.uid,+ self.inputDevices.contains(where: { $0.uid == defaultUID }) {+ self.selectedInputUID = defaultUID+ } else {+ self.selectedInputUID = self.inputDevices.first?.uid ?? ""+ }+ }+ }++ // Sync output device selection after refresh+ if !self.outputDevices.isEmpty {+ let outputValid = self.outputDevices.contains { $0.uid == self.selectedOutputUID }+ if !outputValid || self.selectedOutputUID.isEmpty {+ if let prefUID = SettingsStore.shared.preferredOutputDeviceUID,+ self.outputDevices.contains(where: { $0.uid == prefUID }) {+ self.selectedOutputUID = prefUID+ } else if let defaultUID = AudioDevice.getDefaultOutputDevice()?.uid,+ self.outputDevices.contains(where: { $0.uid == defaultUID }) {+ self.selectedOutputUID = defaultUID+ } else {+ self.selectedOutputUID = self.outputDevices.first?.uid ?? ""+ }+ }+ }+// CRITICAL FIX: Populate cached default device names after onAppear, not during view body evaluation.// This avoids the CoreAudio/SwiftUI AttributeGraph race condition that causes EXC_BAD_ACCESS.self.cachedDefaultInputName = AudioDevice.getDefaultInputDevice()?.name ?? ""