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
lint and formatting
altic-dev9384f1dfb271
diff --git a/Sources/Fluid/AppDelegate.swift b/Sources/Fluid/AppDelegate.swiftindex 3f5a088d..af2dd027 100644--- a/Sources/Fluid/AppDelegate.swift+++ b/Sources/Fluid/AppDelegate.swift@@ -1,3 +1,10 @@+//+// AppDelegate.swift+// Fluid+//+// Created by Barathwaj Anandan on 9/22/25.+//+import AppKitimport AppUpdaterimport PromiseKit@@ -108,10 +115,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {}} catch {// Silently log the error, don't bother the user with failed automatic checks- DebugLogger.shared.debug(- "Automatic update check failed: \(error.localizedDescription)",- source: "AppDelegate"- )+ DebugLogger.shared.debug("Automatic update check failed: \(error.localizedDescription)", source: "AppDelegate")// Still update last check date to avoid hammering the API on failureawait MainActor.run {diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swiftindex 927878c8..99ffb97b 100644--- a/Sources/Fluid/ContentView.swift+++ b/Sources/Fluid/ContentView.swift@@ -1,3 +1,10 @@+//+// ContentView.swift+// fluid+//+// Created by Barathwaj Anandan on 7/30/25.+//+import AppKitimport AVFoundationimport Combine@@ -116,12 +123,14 @@ struct ContentView: View {@State private var selectedProviderID: String = SettingsStore.shared.selectedProviderIDvar body: some View {- let splitView = AnyView(NavigationSplitView {- self.sidebarView- .navigationSplitViewColumnWidth(min: 220, ideal: 250, max: 300)- } detail: {- self.detailView- })+ let splitView = AnyView(+ NavigationSplitView {+ self.sidebarView+ .navigationSplitViewColumnWidth(min: 220, ideal: 250, max: 300)+ } detail: {+ self.detailView+ }+ )let tracked = splitView.withMouseTracking(self.mouseTracker)let env = tracked.environmentObject(self.mouseTracker)@@ -170,10 +179,8 @@ struct ContentView: View {self.refreshDevices()// Set default selection if empty- if self.selectedInputUID.isEmpty,- let defIn = AudioDevice.getDefaultInputDevice()?.uid { self.selectedInputUID = defIn }- if self.selectedOutputUID.isEmpty,- let defOut = AudioDevice.getDefaultOutputDevice()?.uid { self.selectedOutputUID = defOut }+ if self.selectedInputUID.isEmpty, let defIn = AudioDevice.getDefaultInputDevice()?.uid { self.selectedInputUID = defIn }+ if self.selectedOutputUID.isEmpty, let defOut = AudioDevice.getDefaultOutputDevice()?.uid { self.selectedOutputUID = defOut }// Load saved preferences for UI display (but don't force system defaults)// FluidVoice should NOT control system-wide audio routing@@ -299,17 +306,13 @@ struct ContentView: View {NSEvent.addLocalMonitorForEvents(matching: [.keyDown, .flagsChanged]) { event inlet eventModifiers = event.modifierFlags.intersection([.function, .command, .option, .control, .shift])- let shortcutModifiers = hotkeyShortcut.modifierFlags.intersection([.function, .command, .option, .control, .shift])-- let isRecordingAnyShortcut = isRecordingShortcut || isRecordingCommandModeShortcut || isRecordingRewriteShortcut+ let shortcutModifiers = self.hotkeyShortcut.modifierFlags.intersection([.function, .command, .option, .control, .shift])++ let isRecordingAnyShortcut = self.isRecordingShortcut || self.isRecordingCommandModeShortcut || self.isRecordingRewriteShortcutif event.type == .keyDown {if event.keyCode == self.hotkeyShortcut.keyCode && eventModifiers == shortcutModifiers {- DebugLogger.shared- .debug(- "NSEvent monitor: Global hotkey matched on keyDown, passing event through (GlobalHotkeyManager handles)",- source: "ContentView"- )+ DebugLogger.shared.debug("NSEvent monitor: Global hotkey matched on keyDown, passing event through (GlobalHotkeyManager handles)", source: "ContentView")return event}@@ -330,20 +333,14 @@ struct ContentView: View {}if self.asr.isRunning {- DebugLogger.shared.debug(- "NSEvent monitor: Escape pressed, cancelling ASR recording",- source: "ContentView"- )+ DebugLogger.shared.debug("NSEvent monitor: Escape pressed, cancelling ASR recording", source: "ContentView")self.asr.stopWithoutTranscription()handled = true}// Close mode views if activeif self.selectedSidebarItem == .commandMode || self.selectedSidebarItem == .rewriteMode {- DebugLogger.shared.debug(- "NSEvent monitor: Escape pressed, closing mode view",- source: "ContentView"- )+ DebugLogger.shared.debug("NSEvent monitor: Escape pressed, closing mode view", source: "ContentView")self.selectedSidebarItem = .welcomehandled = true}@@ -358,10 +355,7 @@ struct ContentView: View {let keyCode = event.keyCodeif keyCode == 53 {- DebugLogger.shared.debug(- "NSEvent monitor: Escape pressed, cancelling shortcut recording",- source: "ContentView"- )+ DebugLogger.shared.debug("NSEvent monitor: Escape pressed, cancelling shortcut recording", source: "ContentView")self.isRecordingShortcut = falseself.isRecordingCommandModeShortcut = falseself.isRecordingRewriteShortcut = false@@ -371,10 +365,7 @@ struct ContentView: View {let combinedModifiers = self.pendingModifierFlags.union(eventModifiers)let newShortcut = HotkeyShortcut(keyCode: keyCode, modifierFlags: combinedModifiers)- DebugLogger.shared.debug(- "NSEvent monitor: Recording new shortcut: \(newShortcut.displayString)",- source: "ContentView"- )+ DebugLogger.shared.debug("NSEvent monitor: Recording new shortcut: \(newShortcut.displayString)", source: "ContentView")if self.isRecordingRewriteShortcut {self.rewriteModeHotkeyShortcut = newShortcut@@ -399,11 +390,7 @@ struct ContentView: View {if self.hotkeyShortcut.modifierFlags.isEmpty {let isModifierKeyPressed = eventModifiers.isEmpty == falseif event.keyCode == self.hotkeyShortcut.keyCode && isModifierKeyPressed {- DebugLogger.shared- .debug(- "NSEvent monitor: Global hotkey matched on flagsChanged, passing event through (GlobalHotkeyManager handles)",- source: "ContentView"- )+ DebugLogger.shared.debug("NSEvent monitor: Global hotkey matched on flagsChanged, passing event through (GlobalHotkeyManager handles)", source: "ContentView")return event}}@@ -416,11 +403,7 @@ struct ContentView: View {if eventModifiers.isEmpty {if self.pendingModifierOnly, let modifierKeyCode = pendingModifierKeyCode {let newShortcut = HotkeyShortcut(keyCode: modifierKeyCode, modifierFlags: [])- DebugLogger.shared- .debug(- "NSEvent monitor: Recording modifier-only shortcut: \(newShortcut.displayString)",- source: "ContentView"- )+ DebugLogger.shared.debug("NSEvent monitor: Recording modifier-only shortcut: \(newShortcut.displayString)", source: "ContentView")if self.isRecordingRewriteShortcut {self.rewriteModeHotkeyShortcut = newShortcut@@ -439,19 +422,12 @@ struct ContentView: View {self.isRecordingShortcut = false}self.resetPendingShortcutState()- DebugLogger.shared.debug(- "NSEvent monitor: Finished recording modifier shortcut",- source: "ContentView"- )+ DebugLogger.shared.debug("NSEvent monitor: Finished recording modifier shortcut", source: "ContentView")return nil}self.resetPendingShortcutState()- DebugLogger.shared- .debug(- "NSEvent monitor: Modifiers released without recording, continuing to wait",- source: "ContentView"- )+ DebugLogger.shared.debug("NSEvent monitor: Modifiers released without recording, continuing to wait", source: "ContentView")return nil}@@ -472,11 +448,7 @@ struct ContentView: View {self.pendingModifierFlags = eventModifiersself.pendingModifierKeyCode = actualKeyCodeself.pendingModifierOnly = true- DebugLogger.shared- .debug(- "NSEvent monitor: Modifier key pressed during recording, pending modifiers: \(self.pendingModifierFlags)",- source: "ContentView"- )+ DebugLogger.shared.debug("NSEvent monitor: Modifier key pressed during recording, pending modifiers: \(self.pendingModifierFlags)", source: "ContentView")return nil}@@ -589,10 +561,7 @@ struct ContentView: View {/// Centralized handler for sidebar mode transitions to ensure proper cleanup and state managementprivate func handleModeTransition(from oldValue: SidebarItem?, to newValue: SidebarItem?) {- DebugLogger.shared.debug(- "Mode transition: \(String(describing: oldValue)) → \(String(describing: newValue))",- source: "ContentView"- )+ DebugLogger.shared.debug("Mode transition: \(String(describing: oldValue)) → \(String(describing: newValue))", source: "ContentView")// Clean up state from the previous modeif let old = oldValue {@@ -786,8 +755,7 @@ struct ContentView: View {VStack(alignment: .leading, spacing: 4) {Text(self.labelFor(status: self.asr.micStatus)).fontWeight(.medium)- .foregroundStyle(self.asr.micStatus == .authorized ? self.theme.palette.primaryText : self.theme- .palette.warning)+ .foregroundStyle(self.asr.micStatus == .authorized ? self.theme.palette.primaryText : self.theme.palette.warning)if self.asr.micStatus != .authorized {Text("Microphone access is required for voice recording")@@ -1201,7 +1169,7 @@ struct ContentView: View {return false}-+// NOTE: Thinking token filtering is now handled by LLMClient.stripThinkingTags()// MARK: - Modular AI Processing@@ -1238,11 +1206,7 @@ struct ContentView: View {derivedSelectedModel = storedSelectedModelByProvider[currentSelectedProviderID] ?? ""}- DebugLogger.shared- .debug(- "processTextWithAI using provider=\(derivedCurrentProvider), model=\(derivedSelectedModel)",- source: "ContentView"- )+ DebugLogger.shared.debug("processTextWithAI using provider=\(derivedCurrentProvider), model=\(derivedSelectedModel)", source: "ContentView")// Route to Apple Intelligence if selectedif currentSelectedProviderID == "apple-intelligence" {@@ -1257,31 +1221,31 @@ struct ContentView: View {#endifreturn inputText // Fallback if not available}-+// Skip API key validation for local endpoints- let isLocal = isLocalEndpoint(derivedBaseURL)+ let isLocal = self.isLocalEndpoint(derivedBaseURL)let apiKey = storedProviderAPIKeys[derivedCurrentProvider] ?? ""-+if !isLocal {guard !apiKey.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines).isEmpty else {return "Error: API Key not set for \(derivedCurrentProvider)"}}-+// Get app context captured at start of recording if available- let appInfo = recordingAppInfo ?? getCurrentAppInfo()- let systemPrompt = buildSystemPrompt(appInfo: appInfo)+ let appInfo = self.recordingAppInfo ?? self.getCurrentAppInfo()+ let systemPrompt = self.buildSystemPrompt(appInfo: appInfo)DebugLogger.shared.debug("Using app context for AI: app=\(appInfo.name), bundleId=\(appInfo.bundleId), title=\(appInfo.windowTitle)", source: "ContentView")-+// Check if this is a reasoning model that doesn't support temperature parameterlet modelLower = derivedSelectedModel.lowercased()let isReasoningModel = modelLower.hasPrefix("o1") || modelLower.hasPrefix("o3") || modelLower.hasPrefix("gpt-5")-+// Get reasoning config for this model (uses per-model settings or auto-detection)// This handles custom parameters like reasoning_effort, enable_thinking, etc.let providerKey = self.providerKey(for: currentSelectedProviderID)let reasoningConfig = SettingsStore.shared.getReasoningConfig(forModel: derivedSelectedModel, provider: providerKey)-+// Build extra parameters from reasoning configvar extraParams: [String: Any]? = nilif let config = reasoningConfig, config.isEnabled {@@ -1297,18 +1261,18 @@ struct ContentView: View {source: "ContentView")}-+// Build messages arraylet messages: [[String: Any]] = [["role": "system", "content": systemPrompt],- ["role": "user", "content": inputText]+ ["role": "user", "content": inputText],]-+// NOTE: Transcription doesn't need streaming - the full result appears at once// Streaming is only useful for Command/Rewrite modes where real-time display helps// Using non-streaming is simpler and more reliable for transcription cleanup- let enableStreaming = false // Hardcoded off for transcription-+ let enableStreaming = false // Hardcoded off for transcription+// Build LLMClient configuration// Note: No onContentChunk callback needed since we don't display real-time// Thinking tokens are extracted but not displayed (no onThinkingChunk)@@ -1322,27 +1286,28 @@ struct ContentView: View {temperature: isReasoningModel ? nil : 0.2,extraParameters: extraParams)-+DebugLogger.shared.info("Using LLMClient for transcription (streaming=\(enableStreaming))", source: "ContentView")-+do {let response = try await LLMClient.shared.call(config)-+// Log thinking if present (for debugging)if let thinking = response.thinking {DebugLogger.shared.debug("LLM thinking tokens extracted (\(thinking.count) chars)", source: "ContentView")}-+return response.content.isEmpty ? "<no content>" : response.content} catch {DebugLogger.shared.error("AI API error: \(error.localizedDescription)", source: "ContentView")return "Error: \(error.localizedDescription)"}}-+// MARK: - Streaming Response Handler (DEPRECATED - Now handled by LLMClient)+// This method is no longer used - LLMClient.call() handles streaming internally-+// MARK: - Stop and Process Transcriptionprivate func stopAndProcessTranscription() async {@@ -1399,8 +1364,7 @@ struct ContentView: View {}let trimmedBaseURL = baseURL.trimmingCharacters(in: .whitespacesAndNewlines)let isLocal = self.isLocalEndpoint(trimmedBaseURL)- let apiKey = (SettingsStore.shared.getAPIKey(for: currentProviderID) ?? "")- .trimmingCharacters(in: .whitespacesAndNewlines)+ let apiKey = (SettingsStore.shared.getAPIKey(for: currentProviderID) ?? "").trimmingCharacters(in: .whitespacesAndNewlines)let shouldUseAI = SettingsStore.shared.enableAIProcessing && (isLocal || !apiKey.isEmpty)if shouldUseAI {@@ -1439,11 +1403,10 @@ struct ContentView: View {let isFluidFrontmost = frontmostApp?.bundleIdentifier?.contains("fluid") == truelet shouldTypeExternally = !isFluidFrontmost || self.isTranscriptionFocused == false- DebugLogger.shared- .debug(- "Typing decision → frontmost: \(frontmostName), fluidFrontmost: \(isFluidFrontmost), editorFocused: \(self.isTranscriptionFocused), willTypeExternally: \(shouldTypeExternally)",- source: "ContentView"- )+ DebugLogger.shared.debug(+ "Typing decision → frontmost: \(frontmostName), fluidFrontmost: \(isFluidFrontmost), editorFocused: \(self.isTranscriptionFocused), willTypeExternally: \(shouldTypeExternally)",+ source: "ContentView"+ )if shouldTypeExternally {self.asr.typeTextToActiveField(finalText)@@ -1455,11 +1418,7 @@ struct ContentView: View {private func processRewriteWithVoiceInstruction(_ instruction: String) async {let hasOriginalText = !self.rewriteModeService.originalText.isEmpty- DebugLogger.shared- .info(- "Processing \(hasOriginalText ? "rewrite" : "write/improve") - instruction: '\(instruction)', originalText length: \(self.rewriteModeService.originalText.count)",- source: "ContentView"- )+ DebugLogger.shared.info("Processing \(hasOriginalText ? "rewrite" : "write/improve") - instruction: '\(instruction)', originalText length: \(self.rewriteModeService.originalText.count)", source: "ContentView")// Show processing animationself.menuBarManager.setProcessing(true)@@ -1474,11 +1433,7 @@ struct ContentView: View {// If rewrite was successful, type the resultif !self.rewriteModeService.rewrittenText.isEmpty {- DebugLogger.shared- .info(- "Rewrite successful, typing result (chars: \(self.rewriteModeService.rewrittenText.count))",- source: "ContentView"- )+ DebugLogger.shared.info("Rewrite successful, typing result (chars: \(self.rewriteModeService.rewrittenText.count))", source: "ContentView")// Copy to clipboard as backupif SettingsStore.shared.copyTranscriptionToClipboard {@@ -1522,11 +1477,7 @@ struct ContentView: View {let info = self.getCurrentAppInfo()self.recordingAppInfo = info- DebugLogger.shared- .debug(- "Captured recording app context: app=\(info.name), bundleId=\(info.bundleId), title=\(info.windowTitle)",- source: "ContentView"- )+ DebugLogger.shared.debug("Captured recording app context: app=\(info.name), bundleId=\(info.bundleId), title=\(info.windowTitle)", source: "ContentView")self.asr.start()// Pre-load model in background while recording (avoids 10s freeze on stop)@@ -1696,10 +1647,7 @@ struct ContentView: View {let nowTrusted = AXIsProcessTrusted()if nowTrusted && !self.accessibilityEnabled {await MainActor.run {- DebugLogger.shared.info(- "Accessibility permission granted! Auto-restarting app...",- source: "ContentView"- )+ DebugLogger.shared.info("Accessibility permission granted! Auto-restarting app...", source: "ContentView")// Mark that we've auto-restarted to prevent loopsUserDefaults.standard.set(true, forKey: self.hasAutoRestartedForAccessibilityKey)@@ -1741,13 +1689,9 @@ struct ContentView: View {await self.stopAndProcessTranscription()},commandModeCallback: {- DebugLogger.shared.info(- "Command mode triggered",- source: "ContentView"- )+ DebugLogger.shared.info("Command mode triggered", source: "ContentView")- // Set flag so stopAndProcessTranscription knows to process as- // command+ // Set flag so stopAndProcessTranscription knows to process as commandself.isRecordingForCommand = true// Set overlay mode to command@@ -1763,11 +1707,7 @@ struct ContentView: View {rewriteModeCallback: {// Try to capture text first while still in the other applet captured = self.rewriteModeService.captureSelectedText()- DebugLogger.shared- .info(- "Rewrite mode triggered, text captured: \(captured)",- source: "ContentView"- )+ DebugLogger.shared.info("Rewrite mode triggered, text captured: \(captured)", source: "ContentView")if !captured {// No text selected - start in "write mode" where user speaks@@ -1785,17 +1725,11 @@ struct ContentView: View {self.menuBarManager.setOverlayMode(.rewrite)}- // Set flag so stopAndProcessTranscription knows to process as- // rewrite+ // Set flag so stopAndProcessTranscription knows to process as rewriteself.isRecordingForRewrite = true- // Start recording immediately for the rewrite instruction (or text- // to improve)- DebugLogger.shared- .info(- "Starting voice recording for rewrite/write mode",- source: "ContentView"- )+ // Start recording immediately for the rewrite instruction (or text to improve)+ DebugLogger.shared.info("Starting voice recording for rewrite/write mode", source: "ContentView")self.asr.start()})@@ -1947,9 +1881,6 @@ struct CardAppearAnimation: ViewModifier {content.scaleEffect(self.appear ? 1.0 : 0.96).opacity(self.appear ? 1.0 : 0)- .animation(- .spring(response: 0.8, dampingFraction: 0.75, blendDuration: 0.2).delay(self.delay),- value: self.appear- )+ .animation(.spring(response: 0.8, dampingFraction: 0.75, blendDuration: 0.2).delay(self.delay), value: self.appear)}}diff --git a/Sources/Fluid/CustomAnimations.swift b/Sources/Fluid/CustomAnimations.swiftindex d99b2123..63903322 100644--- a/Sources/Fluid/CustomAnimations.swift+++ b/Sources/Fluid/CustomAnimations.swift@@ -40,12 +40,13 @@ struct PulseAudioVisualizationView: View {.frame(width: 40 + CGFloat(index) * 20, height: 40 + CGFloat(index) * 20).scaleEffect(self.data.audioLevel > self.config.noiseThreshold ?- 1.0 + (self.data.audioLevel - self.config.noiseThreshold) * self.config- .maxAnimationScale : 1.0,+ 1.0 + (self.data.audioLevel - self.config.noiseThreshold) * self.config.maxAnimationScale : 1.0,anchor: .center)- .opacity(self.data.audioLevel > self.config.noiseThreshold ?- 1.0 - (self.data.audioLevel - self.config.noiseThreshold) : 0.3)+ .opacity(+ self.data.audioLevel > self.config.noiseThreshold ?+ 1.0 - (self.data.audioLevel - self.config.noiseThreshold) : 0.3+ ).animation(self.config.animationSpring.delay(Double(index) * 0.1), value: self.animationId)}@@ -82,8 +83,7 @@ struct WaveAudioVisualizationView: View {.frame(width: 4, height: 20).scaleEffect(y: self.data.audioLevel > self.config.noiseThreshold ?- 1.0 + (self.data.audioLevel - self.config.noiseThreshold) * self.config- .maxAnimationScale * (1.0 - Double(index) * 0.1) : 0.2,+ 1.0 + (self.data.audioLevel - self.config.noiseThreshold) * self.config.maxAnimationScale * (1.0 - Double(index) * 0.1) : 0.2,anchor: .bottom).animation(self.config.animationSpring.delay(Double(index) * 0.05), value: self.animationId)diff --git a/Sources/Fluid/Networking/AIProvider.swift b/Sources/Fluid/Networking/AIProvider.swiftindex 2503851e..abc594a2 100644--- a/Sources/Fluid/Networking/AIProvider.swift+++ b/Sources/Fluid/Networking/AIProvider.swift@@ -1,14 +1,7 @@import Foundationprotocol AIProvider {- func process(- systemPrompt: String,- userText: String,- model: String,- apiKey: String,- baseURL: String,- stream: Bool- ) async -> String+ func process(systemPrompt: String, userText: String, model: String, apiKey: String, baseURL: String, stream: Bool) async -> String}final class OpenAICompatibleProvider: AIProvider {@@ -75,16 +68,8 @@ final class OpenAICompatibleProvider: AIProvider {return modelLower.contains("gpt-oss") || modelLower.hasPrefix("openai/")}- func process(- systemPrompt: String,- userText: String,- model: String,- apiKey: String,- baseURL: String,- stream: Bool = false- ) async -> String {- let endpoint = baseURL.trimmingCharacters(in: .whitespacesAndNewlines)- .isEmpty ? "https://api.openai.com/v1" : baseURL.trimmingCharacters(in: .whitespacesAndNewlines)+ func process(systemPrompt: String, userText: String, model: String, apiKey: String, baseURL: String, stream: Bool = false) async -> String {+ let endpoint = baseURL.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty ? "https://api.openai.com/v1" : baseURL.trimmingCharacters(in: .whitespacesAndNewlines)// Build the full URL - only append /chat/completions if not already presentlet fullEndpoint: Stringdiff --git a/Sources/Fluid/Networking/FunctionCallingProvider.swift b/Sources/Fluid/Networking/FunctionCallingProvider.swiftindex dd25a175..31f460f0 100644--- a/Sources/Fluid/Networking/FunctionCallingProvider.swift+++ b/Sources/Fluid/Networking/FunctionCallingProvider.swift@@ -20,21 +20,7 @@ final class FunctionCallingProvider {let tool_call_id: String?let name: String?- enum CodingKeys: String, CodingKey {- case role- case content- case tool_calls- case tool_call_id- case name- }-- init(- role: String,- content: String?,- tool_calls: [ToolCall] = [],- tool_call_id: String? = nil,- name: String? = nil- ) {+ init(role: String, content: String?, tool_calls: [ToolCall]? = nil, tool_call_id: String? = nil, name: String? = nil) {self.role = roleself.content = contentself.tool_calls = tool_calls@@ -231,10 +217,7 @@ final class FunctionCallingProvider {tool_choice: tools.isEmpty ? nil : "auto")- DebugLogger.shared.info(- "📤 Sending to LLM: \(tools.count) tools, model: \(model)",- source: "FunctionCallingProvider"- )+ DebugLogger.shared.info("📤 Sending to LLM: \(tools.count) tools, model: \(model)", source: "FunctionCallingProvider")if !tools.isEmpty {DebugLogger.shared.info(diff --git a/Sources/Fluid/Networking/ModelDownloader.swift b/Sources/Fluid/Networking/ModelDownloader.swiftindex 9870566c..673f83e7 100644--- a/Sources/Fluid/Networking/ModelDownloader.swift+++ b/Sources/Fluid/Networking/ModelDownloader.swift@@ -32,23 +32,17 @@ final class HuggingFaceModelDownloader {self.owner = "FluidInference"self.repo = "parakeet-tdt-0.6b-v3-coreml"self.revision = "main"- guard var apiBase = URL(string: "https://huggingface.co/api/models/") else {- preconditionFailure("Invalid base Hugging Face API URL")- }- apiBase.appendPathComponent(self.owner)- apiBase.appendPathComponent(self.repo)- apiBase.appendPathComponent("tree")- apiBase.appendPathComponent(self.revision)- self.baseApiURL = apiBase-- guard var resolveBase = URL(string: "https://huggingface.co/") else {- preconditionFailure("Invalid base Hugging Face resolve URL")- }- resolveBase.appendPathComponent(self.owner)- resolveBase.appendPathComponent(self.repo)- resolveBase.appendPathComponent("resolve")- resolveBase.appendPathComponent(self.revision)- self.baseResolveURL = resolveBase+ self.baseApiURL = URL(string: "https://huggingface.co/api/models/")!+ .appendingPathComponent(self.owner)+ .appendingPathComponent(self.repo)+ .appendingPathComponent("tree")+ .appendingPathComponent(self.revision)++ self.baseResolveURL = URL(string: "https://huggingface.co/")!+ .appendingPathComponent(self.owner)+ .appendingPathComponent(self.repo)+ .appendingPathComponent("resolve")+ .appendingPathComponent(self.revision)}/// Initialize with custom model repository settings@@ -142,10 +136,7 @@ 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- ))+ print(String(format: "[ModelDL] Overall progress: %.1f%% (\(Self.formatBytes(downloadedBytes))/\(Self.formatBytes(totalBytes)))", pct * 100.0))} else if fallbackTotal > 0 {fallbackCompleted += 1onProgress?(Double(fallbackCompleted) / Double(fallbackTotal), rel)@@ -171,19 +162,12 @@ final class HuggingFaceModelDownloader {let files = try await listFilesRecursively(relativePath: relativePath)for rel in files {let dest = destination.deletingLastPathComponent().appendingPathComponent(rel)- try FileManager.default.createDirectory(- at: dest.deletingLastPathComponent(),- withIntermediateDirectories: true- )+ try FileManager.default.createDirectory(at: dest.deletingLastPathComponent(), withIntermediateDirectories: true)try await self.downloadFile(relativePath: rel, to: dest)}}- private func downloadFile(- relativePath: String,- to destination: URL,- perFileProgress: ((Double) -> Void)? = nil- ) async throws {+ private func downloadFile(relativePath: String, to destination: URL, perFileProgress: ((Double) -> Void)? = nil) async throws {let fileURL = self.baseResolveURL.appendingPathComponent(relativePath)let delegate = DownloadProgressDelegate(onProgress: perFileProgress)@@ -197,10 +181,7 @@ final class HuggingFaceModelDownloader {continuation.resume(throwing: NSError(domain: "HF", code: http.statusCode))return}- try FileManager.default.createDirectory(- at: destination.deletingLastPathComponent(),- withIntermediateDirectories: true- )+ try FileManager.default.createDirectory(at: destination.deletingLastPathComponent(), withIntermediateDirectories: true)if FileManager.default.fileExists(atPath: destination.path) {try FileManager.default.removeItem(at: destination)}@@ -226,11 +207,7 @@ final class HuggingFaceModelDownloader {self.onProgress = onProgress}- func urlSession(- _ session: URLSession,- downloadTask: URLSessionDownloadTask,- didFinishDownloadingTo location: URL- ) {+ func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL) {guard let response = downloadTask.response else { return }self.onFinish?(location, response)}@@ -239,13 +216,7 @@ final class HuggingFaceModelDownloader {if let error = error { self.onError?(error) }}- func urlSession(- _ session: URLSession,- downloadTask: URLSessionDownloadTask,- didWriteData bytesWritten: Int64,- totalBytesWritten: Int64,- totalBytesExpectedToWrite: Int64- ) {+ func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didWriteData bytesWritten: Int64, totalBytesWritten: Int64, totalBytesExpectedToWrite: Int64) {guard totalBytesExpectedToWrite > 0 else { return }let pct = Double(totalBytesWritten) / Double(totalBytesExpectedToWrite)self.onProgress?(pct)diff --git a/Sources/Fluid/Persistence/ChatHistoryStore.swift b/Sources/Fluid/Persistence/ChatHistoryStore.swiftindex aef02a87..fd73c9cf 100644--- a/Sources/Fluid/Persistence/ChatHistoryStore.swift+++ b/Sources/Fluid/Persistence/ChatHistoryStore.swift@@ -1,3 +1,10 @@+//+// ChatHistoryStore.swift+// Fluid+//+// Persistence manager for Command Mode chat history+//+import Combineimport Foundation@@ -34,14 +41,7 @@ struct ChatMessage: Codable, Identifiable, Equatable {let purpose: String?}- init(- id: UUID = UUID(),- role: Role,- content: String,- toolCall: ToolCall? = nil,- stepType: StepType = .normal,- timestamp: Date = Date()- ) {+ init(id: UUID = UUID(), role: Role, content: String, toolCall: ToolCall? = nil, stepType: StepType = .normal, timestamp: Date = Date()) {self.id = idself.role = roleself.content = content@@ -60,13 +60,7 @@ struct ChatSession: Codable, Identifiable, Equatable {var updatedAt: Datevar messages: [ChatMessage]- init(- id: String = UUID().uuidString,- title: String = "New Chat",- createdAt: Date = Date(),- updatedAt: Date = Date(),- messages: [ChatMessage] = []- ) {+ init(id: String = UUID().uuidString, title: String = "New Chat", createdAt: Date = Date(), updatedAt: Date = Date(), messages: [ChatMessage] = []) {self.id = idself.title = titleself.createdAt = createdAtdiff --git a/Sources/Fluid/Persistence/KeychainService.swift b/Sources/Fluid/Persistence/KeychainService.swiftindex 3b028552..49d0e1cf 100644--- a/Sources/Fluid/Persistence/KeychainService.swift+++ b/Sources/Fluid/Persistence/KeychainService.swift@@ -101,10 +101,10 @@ final class KeychainService {func removeLegacyEntries(providerIDs: [String] = []) throws {let targets: [String]- if providerIDs.isEmpty {- targets = try Array(self.legacyProviderEntries().keys)- } else {+ if let providerIDs {targets = providerIDs+ } else {+ targets = try Array((self.legacyProviderEntries()).keys)}for providerID in targets {diff --git a/Sources/Fluid/Persistence/SettingsStore.swift b/Sources/Fluid/Persistence/SettingsStore.swiftindex ae25b076..46bcc796 100644--- a/Sources/Fluid/Persistence/SettingsStore.swift+++ b/Sources/Fluid/Persistence/SettingsStore.swift@@ -58,7 +58,7 @@ final class SettingsStore: ObservableObject {static let modelReasoningConfigs = "ModelReasoningConfigs"static let rewriteModeShortcutEnabled = "RewriteModeShortcutEnabled"static let showThinkingTokens = "ShowThinkingTokens"-+// Stats Keysstatic let userTypingWPM = "UserTypingWPM"@@ -396,11 +396,7 @@ final class SettingsStore: ObservableObject {}var commandModeLinkedToGlobal: Bool {- get {- self.defaults- .bool(forKey: Keys.commandModeLinkedToGlobal)- } // Default to false (let user opt-in, or true if- // preferred)+ get { self.defaults.bool(forKey: Keys.commandModeLinkedToGlobal) } // Default to false (let user opt-in, or true if preferred)set {objectWillChange.send()self.defaults.set(newValue, forKey: Keys.commandModeLinkedToGlobal)@@ -587,30 +583,28 @@ final class SettingsStore: ObservableObject {/// Global check if a model is a reasoning model (requires special params/max_completion_tokens)func isReasoningModel(_ model: String) -> Bool {let modelLower = model.lowercased()- return modelLower.hasPrefix("gpt-5") ||- modelLower.contains("gpt-5.") ||- modelLower.hasPrefix("o1") ||- modelLower.hasPrefix("o3") ||- modelLower.contains("gpt-oss") ||- modelLower.hasPrefix("openai/") ||- (modelLower.contains("deepseek") && modelLower.contains("reasoner"))+ return modelLower.hasPrefix("gpt-5") ||+ modelLower.contains("gpt-5.") ||+ modelLower.hasPrefix("o1") ||+ modelLower.hasPrefix("o3") ||+ modelLower.contains("gpt-oss") ||+ modelLower.hasPrefix("openai/") ||+ (modelLower.contains("deepseek") && modelLower.contains("reasoner"))}--+/// Whether to display thinking tokens in the UI (Command Mode, Rewrite Mode)/// If false, thinking tokens are extracted but not shown to user- var showThinkingTokens: Bool- {+ var showThinkingTokens: Bool {get {- let value = defaults.object(forKey: Keys.showThinkingTokens)- return value as? Bool ?? true // Default to true (show thinking)+ let value = self.defaults.object(forKey: Keys.showThinkingTokens)+ return value as? Bool ?? true // Default to true (show thinking)}set {objectWillChange.send()- defaults.set(newValue, forKey: Keys.showThinkingTokens)+ self.defaults.set(newValue, forKey: Keys.showThinkingTokens)}}-+// MARK: - Stats Settings/// User's typing speed in words per minute (for time saved calculation)@@ -1092,11 +1086,7 @@ final class SettingsStore: ObservableObject {// Persist the migrated valueself.defaults.set(newModel.rawValue, forKey: Keys.selectedSpeechModel)- DebugLogger.shared- .info(- "Migrated speech model settings: \(oldProvider)/\(oldWhisperSize) -> \(newModel.rawValue)",- source: "SettingsStore"- )+ DebugLogger.shared.info("Migrated speech model settings: \(oldProvider)/\(oldWhisperSize) -> \(newModel.rawValue)", source: "SettingsStore")return newModel}diff --git a/Sources/Fluid/Persistence/TranscriptionHistoryStore.swift b/Sources/Fluid/Persistence/TranscriptionHistoryStore.swiftindex 8553bf04..505c0001 100644--- a/Sources/Fluid/Persistence/TranscriptionHistoryStore.swift+++ b/Sources/Fluid/Persistence/TranscriptionHistoryStore.swift@@ -1,3 +1,10 @@+//+// TranscriptionHistoryStore.swift+// Fluid+//+// Persistence manager for Transcription Mode history+//+import Combineimport Foundation@@ -108,10 +115,7 @@ final class TranscriptionHistoryStore: ObservableObject {self.trimOldEntries()self.saveEntries()- DebugLogger.shared.debug(- "Added transcription to history (total: \(self.entries.count))",- source: "TranscriptionHistoryStore"- )+ DebugLogger.shared.debug("Added transcription to history (total: \(self.entries.count))", source: "TranscriptionHistoryStore")}/// Delete a specific entrydiff --git a/Sources/Fluid/Services/ASRService.swift b/Sources/Fluid/Services/ASRService.swiftindex 0bef1693..472c5f63 100644--- a/Sources/Fluid/Services/ASRService.swift+++ b/Sources/Fluid/Services/ASRService.swift@@ -190,8 +190,7 @@ final class ASRService: ObservableObject {// Streaming transcription state (no VAD)private var streamingTask: Task<Void, Never>?private var lastProcessedSampleCount: Int = 0- private let chunkDurationSeconds: Double =- 0.6 // Fast interval - TranscriptionExecutor actor handles CoreML serialization+ private let chunkDurationSeconds: Double = 0.6 // Fast interval - TranscriptionExecutor actor handles CoreML serializationprivate var isProcessingChunk: Bool = falseprivate var skipNextChunk: Bool = falseprivate var previousFullTranscription: String = ""@@ -371,16 +370,8 @@ final class ASRService: ObservableObject {return ""}- DebugLogger.shared- .debug(- "Starting transcription with \(pcm.count) samples (\(Float(pcm.count) / 16_000.0) seconds)",- source: "ASRService"- )- DebugLogger.shared- .debug(- "stop(): starting full transcription (samples: \(pcm.count)) using \(self.transcriptionProvider.name)",- source: "ASRService"- )+ DebugLogger.shared.debug("Starting transcription with \(pcm.count) samples (\(Float(pcm.count) / 16_000.0) seconds)", source: "ASRService")+ DebugLogger.shared.debug("stop(): starting full transcription (samples: \(pcm.count)) using \(self.transcriptionProvider.name)", source: "ASRService")let result = try await transcriptionExecutor.run { [provider = self.transcriptionProvider] intry await provider.transcribe(pcm)}@@ -486,11 +477,7 @@ final class ASRService: ObservableObject {mScope: kAudioObjectPropertyScopeGlobal,mElement: kAudioObjectPropertyElementMain)- let status = AudioObjectAddPropertyListenerBlock(- AudioObjectID(kAudioObjectSystemObject),- &address,- DispatchQueue.main- ) { [weak self] _, _ in+ let status = AudioObjectAddPropertyListenerBlock(AudioObjectID(kAudioObjectSystemObject), &address, DispatchQueue.main) { [weak self] _, _ inself?.handleDefaultInputChanged()}if status == noErr { self.defaultInputListenerInstalled = true }@@ -652,10 +639,7 @@ final class ASRService: ObservableObject {private func performEnsureAsrReady(provider: TranscriptionProvider) async throws {// Check if already readyif self.isAsrReady, provider.isReady {- DebugLogger.shared.debug(- "ASR already ready with loaded models, skipping initialization",- source: "ASRService"- )+ DebugLogger.shared.debug("ASR already ready with loaded models, skipping initialization", source: "ASRService")return}@@ -714,11 +698,7 @@ final class ASRService: ObservableObject {DebugLogger.shared.info("Calling transcriptionProvider.prepare()...", source: "ASRService")try await provider.prepare(progressHandler: nil)let downloadDuration = Date().timeIntervalSince(downloadStartTime)- DebugLogger.shared- .info(- "✓ Provider preparation completed in \(String(format: "%.1f", downloadDuration)) seconds",- source: "ASRService"- )+ DebugLogger.shared.info("✓ Provider preparation completed in \(String(format: "%.1f", downloadDuration)) seconds", source: "ASRService")DispatchQueue.main.async {self.isDownloadingModel = false@@ -728,10 +708,7 @@ final class ASRService: ObservableObject {let totalDuration = Date().timeIntervalSince(totalStartTime)DebugLogger.shared.info("=== ASR INITIALIZATION COMPLETE ===", source: "ASRService")- DebugLogger.shared.info(- "Total initialization time: \(String(format: "%.1f", totalDuration)) seconds",- source: "ASRService"- )+ DebugLogger.shared.info("Total initialization time: \(String(format: "%.1f", totalDuration)) seconds", source: "ASRService")self.isAsrReady = true} catch {@@ -788,10 +765,7 @@ final class ASRService: ObservableObject {self.streamingTask?.cancel()guard self.isAsrReady else { return }- DebugLogger.shared.debug(- "Starting streaming transcription task (interval: \(self.chunkDurationSeconds)s)",- source: "ASRService"- )+ DebugLogger.shared.debug("Starting streaming transcription task (interval: \(self.chunkDurationSeconds)s)", source: "ASRService")self.streamingTask = Task { [weak self] inawait self?.runStreamingLoop()@@ -827,10 +801,7 @@ final class ASRService: ObservableObject {// Skip if already processing to prevent queue buildupguard !self.isProcessingChunk else {- DebugLogger.shared.debug(- "⚠️ Skipping chunk - previous transcription still in progress",- source: "ASRService"- )+ DebugLogger.shared.debug("⚠️ Skipping chunk - previous transcription still in progress", source: "ASRService")self.skipNextChunk = truereturn}@@ -857,11 +828,7 @@ final class ASRService: ObservableObject {let startTime = Date()do {- DebugLogger.shared- .debug(- "Streaming chunk starting transcription (samples: \(chunk.count)) using \(self.transcriptionProvider.name)",- source: "ASRService"- )+ DebugLogger.shared.debug("Streaming chunk starting transcription (samples: \(chunk.count)) using \(self.transcriptionProvider.name)", source: "ASRService")let result = try await transcriptionExecutor.run { [provider = self.transcriptionProvider] intry await provider.transcribe(chunk)}@@ -880,20 +847,13 @@ final class ASRService: ObservableObject {self.partialTranscription = updatedTextself.previousFullTranscription = newText- DebugLogger.shared.debug(- "✅ Streaming: '\(updatedText)' (\(String(format: "%.2f", duration))s)",- source: "ASRService"- )+ DebugLogger.shared.debug("✅ Streaming: '\(updatedText)' (\(String(format: "%.2f", duration))s)", source: "ASRService")}// If transcription takes longer than the interval, skip next to prevent queue buildup// This allows slower machines to still work without overwhelming the systemif duration > self.chunkDurationSeconds {- DebugLogger.shared- .debug(- "⚠️ Transcription slow (\(String(format: "%.2f", duration))s > \(self.chunkDurationSeconds)s), skipping next chunk",- source: "ASRService"- )+ DebugLogger.shared.debug("⚠️ Transcription slow (\(String(format: "%.2f", duration))s > \(self.chunkDurationSeconds)s), skipping next chunk", source: "ASRService")self.skipNextChunk = true}} catch {diff --git a/Sources/Fluid/Services/AppServices.swift b/Sources/Fluid/Services/AppServices.swiftindex 18d41409..2dbdabf8 100644--- a/Sources/Fluid/Services/AppServices.swift+++ b/Sources/Fluid/Services/AppServices.swift@@ -1,3 +1,13 @@+//+// AppServices.swift+// Fluid+//+// Centralized service container to reduce SwiftUI view type complexity.+// By holding heavy services here (outside ContentView's @StateObject declarations),+// we reduce the generic type signature of ContentView, which helps avoid+// Swift runtime type metadata crashes at app launch.+//+import Combineimport Foundationdiff --git a/Sources/Fluid/Services/AudioDeviceService.swift b/Sources/Fluid/Services/AudioDeviceService.swiftindex 21c706e1..23c81b34 100644--- a/Sources/Fluid/Services/AudioDeviceService.swift+++ b/Sources/Fluid/Services/AudioDeviceService.swift@@ -1,3 +1,10 @@+//+// AudioDeviceService.swift+// fluid+//+// CoreAudio device management and monitoring+//+import Combineimport CoreAudioimport Foundation@@ -50,16 +57,8 @@ enum AudioDevice {devices.reserveCapacity(deviceIDs.count)for devId in deviceIDs {- let name = self.getStringProperty(- devId,- selector: kAudioObjectPropertyName,- scope: kAudioObjectPropertyScopeGlobal- ) ?? "Unknown"- let uid = self.getStringProperty(- devId,- selector: kAudioDevicePropertyDeviceUID,- scope: kAudioObjectPropertyScopeGlobal- ) ?? ""+ let name = self.getStringProperty(devId, selector: kAudioObjectPropertyName, scope: kAudioObjectPropertyScopeGlobal) ?? "Unknown"+ let uid = self.getStringProperty(devId, selector: kAudioDevicePropertyDeviceUID, scope: kAudioObjectPropertyScopeGlobal) ?? ""let hasIn = self.hasChannels(devId, scope: kAudioObjectPropertyScopeInput)let hasOut = self.hasChannels(devId, scope: kAudioObjectPropertyScopeOutput)devices.append(Device(id: devId, uid: uid, name: name, hasInput: hasIn, hasOutput: hasOut))@@ -77,14 +76,12 @@ enum AudioDevice {}static func getDefaultInputDevice() -> Device? {- guard let devId: AudioObjectID = getDefaultDeviceId(selector: kAudioHardwarePropertyDefaultInputDevice)- else { return nil }+ guard let devId: AudioObjectID = getDefaultDeviceId(selector: kAudioHardwarePropertyDefaultInputDevice) else { return nil }return self.listAllDevices().first { $0.id == devId }}static func getDefaultOutputDevice() -> Device? {- guard let devId: AudioObjectID = getDefaultDeviceId(selector: kAudioHardwarePropertyDefaultOutputDevice)- else { return nil }+ guard let devId: AudioObjectID = getDefaultDeviceId(selector: kAudioHardwarePropertyDefaultOutputDevice) else { return nil }return self.listAllDevices().first { $0.id == devId }}diff --git a/Sources/Fluid/Services/CommandModeService.swift b/Sources/Fluid/Services/CommandModeService.swiftindex 3fdf5495..932a8fd7 100644--- a/Sources/Fluid/Services/CommandModeService.swift+++ b/Sources/Fluid/Services/CommandModeService.swift@@ -7,8 +7,8 @@ final class CommandModeService: ObservableObject {@Published var isProcessing = false@Published var pendingCommand: PendingCommand? = nil@Published var currentStep: AgentStep? = nil- @Published var streamingText: String = "" // Real-time streaming text for UI- @Published var streamingThinkingText: String = "" // Real-time thinking tokens for UI+ @Published var streamingText: String = "" // Real-time streaming text for UI+ @Published var streamingThinkingText: String = "" // Real-time thinking tokens for UI@Published private(set) var currentChatID: String?private let terminalService = TerminalService()@@ -22,9 +22,9 @@ final class CommandModeService: ObservableObject {// Streaming UI update throttling - adaptive rate based on content lengthprivate var lastUIUpdate: CFAbsoluteTime = 0private var lastThinkingUIUpdate: CFAbsoluteTime = 0- private var streamingBuffer: [String] = [] // Buffer tokens instead of string concat- private var thinkingBuffer: [String] = [] // Buffer thinking tokens-+ private var streamingBuffer: [String] = [] // Buffer tokens instead of string concat+ private var thinkingBuffer: [String] = [] // Buffer thinking tokens+// MARK: - Initializationinit() {@@ -61,7 +61,7 @@ final class CommandModeService: ObservableObject {let id = UUID()let role: Rolelet content: String- let thinking: String? // Display-only: AI reasoning tokens (NOT sent to API)+ let thinking: String? // Display-only: AI reasoning tokens (NOT sent to API)let toolCall: ToolCall?let stepType: StepTypelet timestamp: Date@@ -88,7 +88,7 @@ final class CommandModeService: ObservableObject {let workingDirectory: String?let purpose: String? // Why this command is being run}-+init(role: Role, content: String, thinking: String? = nil, toolCall: ToolCall? = nil, stepType: StepType = .normal) {self.role = roleself.content = content@@ -390,14 +390,14 @@ final class CommandModeService: ObservableObject {if let tc = response.toolCall {// Determine step type based on command purpose- let stepType = determineStepType(for: tc.command, purpose: tc.purpose)- currentStep = stepType == .checking ? .checking(tc.command) : .executing(tc.command)-+ let stepType = self.determineStepType(for: tc.command, purpose: tc.purpose)+ self.currentStep = stepType == .checking ? .checking(tc.command) : .executing(tc.command)+// AI wants to run a command - include thinking for display- conversationHistory.append(Message(+ self.conversationHistory.append(Message(role: .assistant,- content: response.content.isEmpty ? stepDescription(for: stepType) : response.content,- thinking: response.thinking, // Display-only+ content: response.content.isEmpty ? self.stepDescription(for: stepType) : response.content,+ thinking: response.thinking, // Display-onlytoolCall: Message.ToolCall(id: tc.id,command: tc.command,@@ -427,22 +427,14 @@ final class CommandModeService: ObservableObject {// Push confirmation needed to notchif self.enableNotchOutput {- NotchContentState.shared.addCommandMessage(- role: .status,- content: "⚠️ Confirmation needed in Command Mode window"- )+ NotchContentState.shared.addCommandMessage(role: .status, content: "⚠️ Confirmation needed in Command Mode window")NotchContentState.shared.setCommandProcessing(false)}return}// Auto-execute- await self.executeCommand(- tc.command,- workingDirectory: tc.workingDirectory,- callId: tc.id,- purpose: tc.purpose- )+ await self.executeCommand(tc.command, workingDirectory: tc.workingDirectory, callId: tc.id, purpose: tc.purpose)} else {// Just a text response - check if it's a final summary@@ -454,7 +446,7 @@ final class CommandModeService: ObservableObject {self.conversationHistory.append(Message(role: .assistant,content: response.content,- thinking: response.thinking, // Display-only+ thinking: response.thinking, // Display-onlystepType: isFinal ? .success : .normal))self.isProcessing = false@@ -577,12 +569,7 @@ final class CommandModeService: ObservableObject {return false}- private func executeCommand(- _ command: String,- workingDirectory: String?,- callId: String,- purpose: String? = nil- ) async {+ private func executeCommand(_ command: String, workingDirectory: String?, callId: String, purpose: String? = nil) async {self.currentStep = .executing(command)let result = await terminalService.execute(@@ -651,7 +638,7 @@ final class CommandModeService: ObservableObject {private struct LLMResponse {let content: String- let thinking: String? // Display-only, NOT sent back to API+ let thinking: String? // Display-only, NOT sent back to APIlet toolCall: ToolCallData?struct ToolCallData {@@ -808,13 +795,13 @@ final class CommandModeService: ObservableObject {])}}-+// Check streaming settinglet enableStreaming = SettingsStore.shared.enableAIStreaming-+// Reasoning models (o1, o3, gpt-5) don't support temperature parameter at alllet isReasoningModel = settings.isReasoningModel(model)-+// Get reasoning config for this model (e.g., reasoning_effort, enable_thinking)let reasoningConfig = SettingsStore.shared.getReasoningConfig(forModel: model, provider: providerID)var extraParams: [String: Any]? = nil@@ -826,15 +813,15 @@ final class CommandModeService: ObservableObject {}DebugLogger.shared.debug("Added reasoning param: \(rConfig.parameterName)=\(rConfig.parameterValue)", source: "CommandModeService")}-+// Reset streaming state- streamingText = ""- streamingThinkingText = ""- streamingBuffer = []- thinkingBuffer = []- lastUIUpdate = CFAbsoluteTimeGetCurrent()- lastThinkingUIUpdate = CFAbsoluteTimeGetCurrent()-+ self.streamingText = ""+ self.streamingThinkingText = ""+ self.streamingBuffer = []+ self.thinkingBuffer = []+ self.lastUIUpdate = CFAbsoluteTimeGetCurrent()+ self.lastThinkingUIUpdate = CFAbsoluteTimeGetCurrent()+// Build LLMClient configurationvar config = LLMClient.Config(messages: messages,@@ -846,11 +833,11 @@ final class CommandModeService: ObservableObject {temperature: isReasoningModel ? nil : 0.1,extraParameters: extraParams)-+// Keep retry logic (exponential backoff)config.maxRetries = 3config.retryDelayMs = 200-+// Add real-time streaming callbacks for UI updates (60fps throttled)if enableStreaming {// Thinking tokens callback@@ -858,7 +845,7 @@ final class CommandModeService: ObservableObject {guard let self = self else { return }Task { @MainActor inself.thinkingBuffer.append(chunk)-+// 60fps UI update throttle for thinkinglet now = CFAbsoluteTimeGetCurrent()if now - self.lastThinkingUIUpdate >= 0.016 {@@ -867,20 +854,20 @@ final class CommandModeService: ObservableObject {}}}-+// Content callbackconfig.onContentChunk = { [weak self] (chunk: String) inguard let self = self else { return }Task { @MainActor inself.streamingBuffer.append(chunk)-+// 60fps UI update throttlelet now = CFAbsoluteTimeGetCurrent()if now - self.lastUIUpdate >= 0.016 {self.lastUIUpdate = nowlet fullContent = self.streamingBuffer.joined()self.streamingText = fullContent-+// Push to notch for real-time displayif self.enableNotchOutput {NotchContentState.shared.updateCommandStreamingText(fullContent)@@ -889,13 +876,13 @@ final class CommandModeService: ObservableObject {}}}-- DebugLogger.shared.info("Using LLMClient for Command Mode (streaming=\(enableStreaming), messages=\(messages.count), history=\(conversationHistory.count))", source: "CommandModeService")-++ DebugLogger.shared.info("Using LLMClient for Command Mode (streaming=\(enableStreaming), messages=\(messages.count), history=\(self.conversationHistory.count))", source: "CommandModeService")+let response = try await LLMClient.shared.call(config)-+// Final UI update - ensure all content is displayed- let fullContent = streamingBuffer.joined()+ let fullContent = self.streamingBuffer.joined()if !fullContent.isEmpty {self.streamingText = fullContentif self.enableNotchOutput {@@ -904,38 +891,39 @@ final class CommandModeService: ObservableObject {}// Small delay to let the final content render, then clear- try? await Task.sleep(nanoseconds: 50_000_000) // 50ms-+ try? await Task.sleep(nanoseconds: 50_000_000) // 50ms+// Capture final thinking before clearing (for message storage)- let finalThinking = response.thinking ?? (thinkingBuffer.isEmpty ? nil : thinkingBuffer.joined())-- streamingText = "" // Clear streaming text when done- streamingThinkingText = "" // Clear thinking text when done- streamingBuffer = [] // Clear buffer- thinkingBuffer = [] // Clear thinking buffer-+ let finalThinking = response.thinking ?? (self.thinkingBuffer.isEmpty ? nil : self.thinkingBuffer.joined())++ self.streamingText = "" // Clear streaming text when done+ self.streamingThinkingText = "" // Clear thinking text when done+ self.streamingBuffer = [] // Clear buffer+ self.thinkingBuffer = [] // Clear thinking buffer+// Clear notch streaming text as wellif self.enableNotchOutput {NotchContentState.shared.updateCommandStreamingText("")}-+// Log thinking if present (for debugging)if let thinking = finalThinking {DebugLogger.shared.debug("LLM thinking tokens extracted (\(thinking.count) chars)", source: "CommandModeService")}-+// Convert LLMClient.Response to our internal LLMResponse// Check for tool callsif let toolCalls = response.toolCalls,let tc = toolCalls.first,- tc.name == "execute_terminal_command" {+ tc.name == "execute_terminal_command"+ {let command = tc.getString("command") ?? ""let workDir = tc.getOptionalString("workingDirectory")let purpose = tc.getString("purpose")-+return LLMResponse(content: response.content,- thinking: finalThinking, // Display-only+ thinking: finalThinking, // Display-onlytoolCall: LLMResponse.ToolCallData(id: tc.id,command: command,@@ -948,11 +936,8 @@ final class CommandModeService: ObservableObject {// Text response onlyreturn LLMResponse(content: response.content.isEmpty ? "I couldn't understand that." : response.content,- thinking: finalThinking, // Display-only+ thinking: finalThinking, // Display-onlytoolCall: nil)}}---diff --git a/Sources/Fluid/Services/DebugLogger.swift b/Sources/Fluid/Services/DebugLogger.swiftindex 9079cae3..831aa4db 100644--- a/Sources/Fluid/Services/DebugLogger.swift+++ b/Sources/Fluid/Services/DebugLogger.swift@@ -126,12 +126,7 @@ class DebugLogger: ObservableObject {}private func formatLogEntry(_ entry: LogEntry) -> String {- self.formatLogLine(- timestamp: entry.formattedTimestamp,- level: entry.level,- source: entry.source,- message: entry.message- )+ self.formatLogLine(timestamp: entry.formattedTimestamp, level: entry.level, source: entry.source, message: entry.message)}private func formatLogLine(timestamp: String, level: LogLevel, source: String, message: String) -> String {diff --git a/Sources/Fluid/Services/FileLogger.swift b/Sources/Fluid/Services/FileLogger.swiftindex 4dff7728..e4b298a5 100644--- a/Sources/Fluid/Services/FileLogger.swift+++ b/Sources/Fluid/Services/FileLogger.swift@@ -13,8 +13,7 @@ final class FileLogger {private let maxLogFileAge: TimeInterval = 72 * 60 * 60 // Rotate every 72 hoursprivate init() {- let baseDirectory = self.fileManager.urls(for: .libraryDirectory, in: .userDomainMask)- .first ?? URL(fileURLWithPath: NSTemporaryDirectory())+ let baseDirectory = self.fileManager.urls(for: .libraryDirectory, in: .userDomainMask).first ?? URL(fileURLWithPath: NSTemporaryDirectory())self.logDirectory = baseDirectory.appendingPathComponent("Logs/Fluid", isDirectory: true)self.logFileURL = self.logDirectory.appendingPathComponent("fluid.log", isDirectory: false)self.backupLogURL = self.logDirectory.appendingPathComponent("fluid.log.1", isDirectory: false)diff --git a/Sources/Fluid/Services/GlobalHotkeyManager.swift b/Sources/Fluid/Services/GlobalHotkeyManager.swiftindex 68dbf6dc..3422eb7a 100644--- a/Sources/Fluid/Services/GlobalHotkeyManager.swift+++ b/Sources/Fluid/Services/GlobalHotkeyManager.swift@@ -135,10 +135,7 @@ final class GlobalHotkeyManager: NSObject {}if attempt < self.maxRetryAttempts {- DebugLogger.shared.warning(- "Attempt \(attempt) failed, retrying in \(self.retryDelay) seconds...",- source: "GlobalHotkeyManager"- )+ DebugLogger.shared.warning("Attempt \(attempt) failed, retrying in \(self.retryDelay) seconds...", source: "GlobalHotkeyManager")Task { [weak self] intry? await Task.sleep(nanoseconds: UInt64((self?.retryDelay ?? 0.5) * 1_000_000_000))await MainActor.run { [weak self] in@@ -149,10 +146,7 @@ final class GlobalHotkeyManager: NSObject {}}- DebugLogger.shared.error(- "Failed to initialize after \(self.maxRetryAttempts) attempts",- source: "GlobalHotkeyManager"- )+ DebugLogger.shared.error("Failed to initialize after \(self.maxRetryAttempts) attempts", source: "GlobalHotkeyManager")}@discardableResult@@ -274,25 +268,16 @@ final class GlobalHotkeyManager: NSObject {// Press and hold: start on keyDown, stop on keyUpif !self.isCommandModeKeyPressed {self.isCommandModeKeyPressed = true- DebugLogger.shared.info(- "Command mode shortcut pressed (hold mode) - starting",- source: "GlobalHotkeyManager"- )+ DebugLogger.shared.info("Command mode shortcut pressed (hold mode) - starting", source: "GlobalHotkeyManager")self.triggerCommandMode()}} else {// Toggle mode: press to start, press again to stopif self.asrService.isRunning {- DebugLogger.shared.info(- "Command mode shortcut pressed while recording - stopping",- source: "GlobalHotkeyManager"- )+ DebugLogger.shared.info("Command mode shortcut pressed while recording - stopping", source: "GlobalHotkeyManager")self.stopRecordingIfNeeded()} else {- DebugLogger.shared.info(- "Command mode shortcut triggered - starting",- source: "GlobalHotkeyManager"- )+ DebugLogger.shared.info("Command mode shortcut triggered - starting", source: "GlobalHotkeyManager")self.triggerCommandMode()}}@@ -308,25 +293,16 @@ final class GlobalHotkeyManager: NSObject {// Press and hold: start on keyDown, stop on keyUpif !self.isRewriteKeyPressed {self.isRewriteKeyPressed = true- DebugLogger.shared.info(- "Rewrite mode shortcut pressed (hold mode) - starting",- source: "GlobalHotkeyManager"- )+ DebugLogger.shared.info("Rewrite mode shortcut pressed (hold mode) - starting", source: "GlobalHotkeyManager")self.triggerRewriteMode()}} else {// Toggle mode: press to start, press again to stopif self.asrService.isRunning {- DebugLogger.shared.info(- "Rewrite mode shortcut pressed while recording - stopping",- source: "GlobalHotkeyManager"- )+ DebugLogger.shared.info("Rewrite mode shortcut pressed while recording - stopping", source: "GlobalHotkeyManager")self.stopRecordingIfNeeded()} else {- DebugLogger.shared.info(- "Rewrite mode shortcut triggered - starting",- source: "GlobalHotkeyManager"- )+ DebugLogger.shared.info("Rewrite mode shortcut triggered - starting", source: "GlobalHotkeyManager")self.triggerRewriteMode()}}@@ -354,11 +330,8 @@ final class GlobalHotkeyManager: NSObject {modifiers: eventModifiers){- self.isCommandModeKeyPressed = false- DebugLogger.shared.info(- "Command mode shortcut released (hold mode) - stopping",- source: "GlobalHotkeyManager"- )+ isCommandModeKeyPressed = false+ DebugLogger.shared.info("Command mode shortcut released (hold mode) - stopping", source: "GlobalHotkeyManager")self.stopRecordingIfNeeded()return nil}@@ -370,20 +343,14 @@ final class GlobalHotkeyManager: NSObject {modifiers: eventModifiers){- self.isRewriteKeyPressed = false- DebugLogger.shared.info(- "Rewrite mode shortcut released (hold mode) - stopping",- source: "GlobalHotkeyManager"- )+ isRewriteKeyPressed = false+ DebugLogger.shared.info("Rewrite mode shortcut released (hold mode) - stopping", source: "GlobalHotkeyManager")self.stopRecordingIfNeeded()return nil}// Transcription key up- if self.pressAndHoldMode, self.isKeyPressed, self.matchesShortcut(- keyCode: keyCode,- modifiers: eventModifiers- ) {+ if self.pressAndHoldMode, self.isKeyPressed, self.matchesShortcut(keyCode: keyCode, modifiers: eventModifiers) {self.isKeyPressed = falseself.stopRecordingIfNeeded()return nil@@ -401,38 +368,26 @@ final class GlobalHotkeyManager: NSObject {keyCode == self.commandModeShortcut.keyCode{if isModifierPressed {- if self.pressAndHoldMode {- if !self.isCommandModeKeyPressed {- self.isCommandModeKeyPressed = true- DebugLogger.shared.info(- "Command mode modifier pressed (hold mode) - starting",- source: "GlobalHotkeyManager"- )+ if pressAndHoldMode {+ if !isCommandModeKeyPressed {+ isCommandModeKeyPressed = true+ DebugLogger.shared.info("Command mode modifier pressed (hold mode) - starting", source: "GlobalHotkeyManager")self.triggerCommandMode()}} else {// Toggle modeif self.asrService.isRunning {- DebugLogger.shared.info(- "Command mode modifier pressed while recording - stopping",- source: "GlobalHotkeyManager"- )+ DebugLogger.shared.info("Command mode modifier pressed while recording - stopping", source: "GlobalHotkeyManager")self.stopRecordingIfNeeded()} else {- DebugLogger.shared.info(- "Command mode modifier pressed - starting",- source: "GlobalHotkeyManager"- )+ DebugLogger.shared.info("Command mode modifier pressed - starting", source: "GlobalHotkeyManager")self.triggerCommandMode()}}} else if self.pressAndHoldMode, self.isCommandModeKeyPressed {// Key released in press-and-hold modeself.isCommandModeKeyPressed = false- DebugLogger.shared.info(- "Command mode modifier released (hold mode) - stopping",- source: "GlobalHotkeyManager"- )+ DebugLogger.shared.info("Command mode modifier released (hold mode) - stopping", source: "GlobalHotkeyManager")self.stopRecordingIfNeeded()}return nil@@ -443,38 +398,26 @@ final class GlobalHotkeyManager: NSObject {keyCode == self.rewriteModeShortcut.keyCode{if isModifierPressed {- if self.pressAndHoldMode {- if !self.isRewriteKeyPressed {- self.isRewriteKeyPressed = true- DebugLogger.shared.info(- "Rewrite mode modifier pressed (hold mode) - starting",- source: "GlobalHotkeyManager"- )+ if pressAndHoldMode {+ if !isRewriteKeyPressed {+ isRewriteKeyPressed = true+ DebugLogger.shared.info("Rewrite mode modifier pressed (hold mode) - starting", source: "GlobalHotkeyManager")self.triggerRewriteMode()}} else {// Toggle modeif self.asrService.isRunning {- DebugLogger.shared.info(- "Rewrite mode modifier pressed while recording - stopping",- source: "GlobalHotkeyManager"- )+ DebugLogger.shared.info("Rewrite mode modifier pressed while recording - stopping", source: "GlobalHotkeyManager")self.stopRecordingIfNeeded()} else {- DebugLogger.shared.info(- "Rewrite mode modifier pressed - starting",- source: "GlobalHotkeyManager"- )+ DebugLogger.shared.info("Rewrite mode modifier pressed - starting", source: "GlobalHotkeyManager")self.triggerRewriteMode()}}} else if self.pressAndHoldMode, self.isRewriteKeyPressed {// Key released in press-and-hold modeself.isRewriteKeyPressed = false- DebugLogger.shared.info(- "Rewrite mode modifier released (hold mode) - stopping",- source: "GlobalHotkeyManager"- )+ DebugLogger.shared.info("Rewrite mode modifier released (hold mode) - stopping", source: "GlobalHotkeyManager")self.stopRecordingIfNeeded()}return nil@@ -624,56 +567,20 @@ final class GlobalHotkeyManager: NSObject {}private func matchesShortcut(keyCode: UInt16, modifiers: NSEvent.ModifierFlags) -> Bool {- let relevantModifiers: NSEvent.ModifierFlags = modifiers.intersection([- .function,- .command,- .option,- .control,- .shift,- ])- let shortcutModifiers = self.shortcut.modifierFlags.intersection([- .function,- .command,- .option,- .control,- .shift,- ])+ let relevantModifiers: NSEvent.ModifierFlags = modifiers.intersection([.function, .command, .option, .control, .shift])+ let shortcutModifiers = self.shortcut.modifierFlags.intersection([.function, .command, .option, .control, .shift])return keyCode == self.shortcut.keyCode && relevantModifiers == shortcutModifiers}private func matchesCommandModeShortcut(keyCode: UInt16, modifiers: NSEvent.ModifierFlags) -> Bool {- let relevantModifiers: NSEvent.ModifierFlags = modifiers.intersection([- .function,- .command,- .option,- .control,- .shift,- ])- let shortcutModifiers = self.commandModeShortcut.modifierFlags.intersection([- .function,- .command,- .option,- .control,- .shift,- ])+ let relevantModifiers: NSEvent.ModifierFlags = modifiers.intersection([.function, .command, .option, .control, .shift])+ let shortcutModifiers = self.commandModeShortcut.modifierFlags.intersection([.function, .command, .option, .control, .shift])return keyCode == self.commandModeShortcut.keyCode && relevantModifiers == shortcutModifiers}private func matchesRewriteModeShortcut(keyCode: UInt16, modifiers: NSEvent.ModifierFlags) -> Bool {- let relevantModifiers: NSEvent.ModifierFlags = modifiers.intersection([- .function,- .command,- .option,- .control,- .shift,- ])- let shortcutModifiers = self.rewriteModeShortcut.modifierFlags.intersection([- .function,- .command,- .option,- .control,- .shift,- ])+ let relevantModifiers: NSEvent.ModifierFlags = modifiers.intersection([.function, .command, .option, .control, .shift])+ let shortcutModifiers = self.rewriteModeShortcut.modifierFlags.intersection([.function, .command, .option, .control, .shift])return keyCode == self.rewriteModeShortcut.keyCode && relevantModifiers == shortcutModifiers}diff --git a/Sources/Fluid/Services/LLMClient.swift b/Sources/Fluid/Services/LLMClient.swiftindex 31cbeacc..d92ce031 100644--- a/Sources/Fluid/Services/LLMClient.swift+++ b/Sources/Fluid/Services/LLMClient.swift@@ -8,16 +8,16 @@ enum LLMError: Error, LocalizedError {case httpError(Int, String)case networkError(Error)case encodingError-+var errorDescription: String? {switch self {case .invalidURL:return "Invalid URL"case .invalidResponse:return "Invalid response from LLM"- case .httpError(let code, let message):+ case let .httpError(code, message):return "HTTP \(code): \(message)"- case .networkError(let error):+ case let .networkError(error):return "Network error: \(error.localizedDescription)"case .encodingError:return "Failed to encode request"@@ -31,13 +31,12 @@ enum LLMError: Error, LocalizedError {/// Handles HTTP requests, SSE streaming, thinking token extraction, and tool call parsing.@MainActorfinal class LLMClient {-static let shared = LLMClient()-+private init() {}-+// MARK: - Response Types-+struct Response {/// Extracted <think>...</think> content (nil if none)let thinking: String?@@ -46,26 +45,26 @@ final class LLMClient {/// Parsed tool calls for agentic modes (nil if none)let toolCalls: [ToolCall]?}-+struct ToolCall {let id: Stringlet name: Stringlet arguments: [String: Any]-+/// Get a string argument by keyfunc getString(_ key: String) -> String? {- return arguments[key] as? String+ return self.arguments[key] as? String}-+/// Get an optional string argument, returning nil if emptyfunc getOptionalString(_ key: String) -> String? {guard let value = arguments[key] as? String, !value.isEmpty else { return nil }return value}}-+// MARK: - Configuration-+struct Config {let messages: [[String: Any]]let model: String@@ -74,25 +73,25 @@ final class LLMClient {let streaming: Boollet tools: [[String: Any]]?let temperature: Double?-+/// Optional token limit (max_tokens or max_completion_tokens depending on model)var maxTokens: Int?-+/// Extra parameters to add to the request body (e.g., reasoning_effort, enable_thinking)/// These are model-specific and come from user settingsvar extraParameters: [String: Any]?-+// Retry configurationvar maxRetries: Int = 3var retryDelayMs: Int = 200-+// Optional real-time callbacks (for streaming UI updates)var onThinkingStart: (() -> Void)?var onThinkingChunk: ((String) -> Void)?var onThinkingEnd: (() -> Void)?var onContentChunk: ((String) -> Void)?var onToolCallStart: ((String) -> Void)?-+init(messages: [[String: Any]],model: String,@@ -115,25 +114,25 @@ final class LLMClient {self.extraParameters = extraParameters}}-+// MARK: - Main Entry Point-+/// Make an LLM API call with the given configuration./// Supports both streaming and non-streaming modes./// Handles thinking token extraction, tool call parsing, and retries.func call(_ config: Config) async throws -> Response {let request = try buildRequest(config)-+// Retry logic for transient network errorsvar lastError: Error?for attempt in 1...config.maxRetries {do {if config.streaming {- return try await processStreaming(request: request, config: config)+ return try await self.processStreaming(request: request, config: config)} else {- return try await processNonStreaming(request: request)+ return try await self.processNonStreaming(request: request)}- } catch let error as URLError where isRetryableError(error) {+ } catch let error as URLError where self.isRetryableError(error) {lastError = errorif attempt < config.maxRetries {// Exponential backoff@@ -142,76 +141,77 @@ final class LLMClient {continue}} catch {- throw error // Non-retryable error+ throw error // Non-retryable error}}-+throw lastError ?? LLMError.networkError(NSError(domain: "LLMClient", code: -1, userInfo: [NSLocalizedDescriptionKey: "Request failed after retries"]))}-+// MARK: - Request Building-+private func buildRequest(_ config: Config) throws -> URLRequest {// Build endpoint URLlet baseURL = config.baseURL.trimmingCharacters(in: .whitespacesAndNewlines)let endpoint: String- if baseURL.contains("/chat/completions") ||- baseURL.contains("/api/chat") ||- baseURL.contains("/api/generate") {+ if baseURL.contains("/chat/completions") ||+ baseURL.contains("/api/chat") ||+ baseURL.contains("/api/generate")+ {endpoint = baseURL} else {endpoint = baseURL.isEmpty ? "https://api.openai.com/v1/chat/completions" : "\(baseURL)/chat/completions"}-+guard let url = URL(string: endpoint) else {throw LLMError.invalidURL}-+// Detect if this is a local endpoint (skip auth for local)- let isLocal = isLocalEndpoint(baseURL)-+ let isLocal = self.isLocalEndpoint(baseURL)+// Build request bodyvar body: [String: Any] = ["model": config.model,- "messages": config.messages+ "messages": config.messages,]-+// Add temperature if provided (reasoning models like o1/o3/gpt-5 don't support it)if let temp = config.temperature {body["temperature"] = temp}-+// Add tools if providedif let tools = config.tools, !tools.isEmpty {body["tools"] = toolsbody["tool_choice"] = "auto"}-+// Add streaming flagif config.streaming {body["stream"] = true}-+// Add extra parameters in layers:// 1. Model-specific parameters (from ThinkingParserFactory)// 2. User-provided parameters (can override model defaults)-+// Layer 1: Model-specific parameters (e.g., enable_thinking for Nemotron)if let modelExtras = ThinkingParserFactory.getExtraParameters(for: config.model) {for (key, value) in modelExtras {body[key] = value}}-+// Layer 2: User-provided extra parameters (e.g., reasoning_effort from settings)if let extras = config.extraParameters {for (key, value) in extras {body[key] = value}}-+// Final Layer: Common parameters with model-specific keysif let tokens = config.maxTokens {if SettingsStore.shared.isReasoningModel(config.model) {@@ -220,66 +220,65 @@ final class LLMClient {body["max_tokens"] = tokens}}--+// Serialize to JSONguard let jsonData = try? JSONSerialization.data(withJSONObject: body, options: []) else {throw LLMError.encodingError}-+// Log the request for debugginglet messageCount = config.messages.countif let bodyStr = String(data: jsonData, encoding: .utf8) {let truncated = bodyStr.count > 500 ? String(bodyStr.prefix(500)) + "..." : bodyStrDebugLogger.shared.debug("LLMClient: Request (\(messageCount) messages, model=\(config.model), streaming=\(config.streaming)): \(truncated)", source: "LLMClient")}-+// Build URLRequestvar request = URLRequest(url: url)request.httpMethod = "POST"request.addValue("application/json", forHTTPHeaderField: "Content-Type")-+// Only add Authorization header for non-local endpointsif !isLocal && !config.apiKey.isEmpty {request.addValue("Bearer \(config.apiKey)", forHTTPHeaderField: "Authorization")}-+request.httpBody = jsonData-+return request}-+// MARK: - Non-Streaming Response-+private func processNonStreaming(request: URLRequest) async throws -> Response {DebugLogger.shared.debug("LLMClient: Making non-streaming request to \(request.url?.absoluteString ?? "unknown")", source: "LLMClient")-+let (data, response) = try await URLSession.shared.data(for: request)-+if let http = response as? HTTPURLResponse, http.statusCode >= 400 {let errText = String(data: data, encoding: .utf8) ?? "Unknown error"DebugLogger.shared.error("LLMClient: HTTP error \(http.statusCode): \(errText.prefix(200))", source: "LLMClient")throw LLMError.httpError(http.statusCode, errText)}-+DebugLogger.shared.debug("LLMClient: Non-streaming response received (\(data.count) bytes)", source: "LLMClient")-+guard let json = try JSONSerialization.jsonObject(with: data) as? [String: Any],let choices = json["choices"] as? [[String: Any]],let choice = choices.first,- let message = choice["message"] as? [String: Any] else {+ let message = choice["message"] as? [String: Any]+ else {throw LLMError.invalidResponse}-- return parseMessageResponse(message)++ return self.parseMessageResponse(message)}--+private func processStreaming(request: URLRequest, config: Config) async throws -> Response {DebugLogger.shared.debug("LLMClient: Starting streaming request to \(request.url?.absoluteString ?? "unknown")", source: "LLMClient")-+let (bytes, response) = try await URLSession.shared.bytes(for: request)-+// Check for HTTP errorsif let http = response as? HTTPURLResponse, http.statusCode >= 400 {var errorData = Data()@@ -289,42 +288,43 @@ final class LLMClient {let errText = String(data: errorData, encoding: .utf8) ?? "Unknown error"throw LLMError.httpError(http.statusCode, errText)}-+// Create the appropriate parser for this modelvar parser = ThinkingParserFactory.createParser(for: config.model)-+// Streaming statevar state = ThinkingParserState.initialvar thinkingBuffer: [String] = []var contentBuffer: [String] = []var tagDetectionBuffer = ""-+// Tool call accumulationvar toolCallId: String?var toolCallName: String?var toolCallArguments = ""-+// Process SSE linesfor try await rawLine in bytes.lines {let line = rawLine.trimmingCharacters(in: .whitespaces)guard line.hasPrefix("data:") else { continue }-+var jsonString = String(line.dropFirst(5))if jsonString.hasPrefix(" ") {jsonString = String(jsonString.dropFirst(1))}-+if jsonString.trimmingCharacters(in: .whitespaces) == "[DONE]" {continue}-+guard let jsonData = jsonString.data(using: .utf8),let json = try? JSONSerialization.jsonObject(with: jsonData) as? [String: Any],let choices = json["choices"] as? [[String: Any]],- let delta = choices.first?["delta"] as? [String: Any] else {+ let delta = choices.first?["delta"] as? [String: Any]+ else {continue}-+// Handle reasoning_content field (DeepSeek style - separate from text content)if let reasoning = delta["reasoning_content"] as? String {if state == .initial {@@ -334,7 +334,7 @@ final class LLMClient {thinkingBuffer.append(reasoning)config.onThinkingChunk?(reasoning)}-+// Handle content with potential <think> tagsif let content = delta["content"] as? String {// Debug: Log first few chunks and any chunk containing think tags@@ -344,14 +344,14 @@ final class LLMClient {let marker = containsThinkTag ? " [HAS THINK TAG!]" : ""DebugLogger.shared.debug("LLMClient: Chunk '\(escaped)'\(marker)", source: "LLMClient")}-+let previousState = statelet (newState, thinkChunk, contentChunk) = parser.processChunk(content,currentState: state,tagBuffer: &tagDetectionBuffer)-+// Handle state transitions for callbacksif previousState != .inThinking && newState == .inThinking {DebugLogger.shared.debug("LLMClient: State transition → inThinking", source: "LLMClient")@@ -362,7 +362,7 @@ final class LLMClient {config.onThinkingEnd?()}state = newState-+// Accumulate and callbackif !thinkChunk.isEmpty {thinkingBuffer.append(thinkChunk)@@ -373,10 +373,11 @@ final class LLMClient {config.onContentChunk?(contentChunk)}}-+// Handle tool calls (streamed in parts)if let toolCalls = delta["tool_calls"] as? [[String: Any]],- let tc = toolCalls.first {+ let tc = toolCalls.first+ {if let id = tc["id"] as? String {toolCallId = id}@@ -391,7 +392,7 @@ final class LLMClient {}}}-+// Finalize - flush any remaining content in tagDetectionBufferif !tagDetectionBuffer.isEmpty {// Anything left in the buffer should go to the appropriate place@@ -405,29 +406,30 @@ final class LLMClient {DebugLogger.shared.debug("LLMClient: Flushing remaining tagBuffer to content (\(tagDetectionBuffer.count) chars)", source: "LLMClient")}}-+// Use parser's finalize to get final clean thinking and contentlet (thinkingText, contentText) = parser.finalize(thinkingBuffer: thinkingBuffer, contentBuffer: contentBuffer, finalState: state)-+DebugLogger.shared.debug("LLMClient: Streaming complete. Thinking: \(thinkingText.count) chars, Content: \(contentText.count) chars", source: "LLMClient")-+// Build tool calls arrayvar parsedToolCalls: [ToolCall]? = nilif let name = toolCallName,let argsData = toolCallArguments.data(using: .utf8),- let args = try? JSONSerialization.jsonObject(with: argsData) as? [String: Any] {+ let args = try? JSONSerialization.jsonObject(with: argsData) as? [String: Any]+ {parsedToolCalls = [ToolCall(id: toolCallId ?? "call_\(UUID().uuidString.prefix(8))",name: name,arguments: args- )+ ),]DebugLogger.shared.debug("LLMClient: Parsed tool call: \(name)", source: "LLMClient")}-+DebugLogger.shared.debug("LLMClient: Returning response. Content length: \(contentText.count), Has thinking: \(thinkingText.isEmpty ? "No" : "Yes (\(thinkingText.count) chars)")", source: "LLMClient")-+return Response(thinking: thinkingText.isEmpty ? nil : thinkingText,content: contentText,@@ -435,13 +437,12 @@ final class LLMClient {)}-// MARK: - Parse Non-Streaming Message-+private func parseMessageResponse(_ message: [String: Any]) -> Response {// Extract contentlet rawContent = message["content"] as? String ?? ""-+// Check for tool callsvar parsedToolCalls: [ToolCall]? = nilif let toolCalls = message["tool_calls"] as? [[String: Any]] {@@ -450,7 +451,8 @@ final class LLMClient {let name = function["name"] as? String,let argsString = function["arguments"] as? String,let argsData = argsString.data(using: .utf8),- let args = try? JSONSerialization.jsonObject(with: argsData) as? [String: Any] else {+ let args = try? JSONSerialization.jsonObject(with: argsData) as? [String: Any]+ else {return nil}let id = tc["id"] as? String ?? "call_\(UUID().uuidString.prefix(8))"@@ -460,76 +462,76 @@ final class LLMClient {parsedToolCalls = nil}}-+// Strip thinking tags and extract thinking content- let (thinking, cleanedContent) = stripThinkingTags(rawContent)-+ let (thinking, cleanedContent) = self.stripThinkingTags(rawContent)+// Also check for reasoning_content field (DeepSeek style)let reasoningContent = message["reasoning_content"] as? Stringlet finalThinking = [thinking, reasoningContent].compactMap { $0 }.filter { !$0.isEmpty }.joined(separator: "\n")-+return Response(thinking: finalThinking.isEmpty ? nil : finalThinking,content: cleanedContent.isEmpty ? rawContent : cleanedContent,toolCalls: parsedToolCalls)}-+// MARK: - Thinking Token Extraction-+/// Pattern matches both <think>...</think> and <thinking>...</thinking> including multilineprivate static let thinkingTagPattern = #"<think(?:ing)?>([\s\S]*?)</think(?:ing)?>"#-+/// Pattern for orphan closing tags with content before them (no opening tag)private static let orphanThinkingPattern = #"^([\s\S]*?)</think(?:ing)?>"#-+/// Strips thinking tags from text and returns (thinking, cleanedContent)func stripThinkingTags(_ text: String) -> (thinking: String, content: String) {var workingText = textvar thinking = ""-+// First, handle proper <think>...</think> pairsif let regex = try? NSRegularExpression(pattern: Self.thinkingTagPattern, options: []) {let range = NSRange(workingText.startIndex..., in: workingText)let matches = regex.matches(in: workingText, options: [], range: range)-+for match in matches {if let thinkRange = Range(match.range(at: 1), in: workingText) {thinking += String(workingText[thinkRange])}}-+workingText = regex.stringByReplacingMatches(in: workingText, options: [], range: range, withTemplate: "")}-+// Second, handle orphan closing tags (content before </think> without opening tag)// This handles cases like "We have a request...</think>Hello!"if let orphanRegex = try? NSRegularExpression(pattern: Self.orphanThinkingPattern, options: []) {let range = NSRange(workingText.startIndex..., in: workingText)let matches = orphanRegex.matches(in: workingText, options: [], range: range)-+for match in matches {if let thinkRange = Range(match.range(at: 1), in: workingText) {thinking += String(workingText[thinkRange])}}-+workingText = orphanRegex.stringByReplacingMatches(in: workingText, options: [], range: range, withTemplate: "")}-+// Also remove any stray </think> or </thinking> tags that might remainworkingText = workingText.replacingOccurrences(of: "</think>", with: "")workingText = workingText.replacingOccurrences(of: "</thinking>", with: "")workingText = workingText.replacingOccurrences(of: "<think>", with: "")workingText = workingText.replacingOccurrences(of: "<thinking>", with: "")-+let cleaned = workingText.trimmingCharacters(in: .whitespacesAndNewlines)-+return (thinking, cleaned)}-+// MARK: - Helper Methods-+/// Check if an error is retryable (transient network issues)private func isRetryableError(_ error: URLError) -> Bool {switch error.code {@@ -544,44 +546,45 @@ final class LLMClient {return false}}-+/// Check if a URL is a local/private endpointprivate func isLocalEndpoint(_ urlString: String) -> Bool {guard let url = URL(string: urlString),let host = url.host else { return false }-+let hostLower = host.lowercased()-+// Localhostif hostLower == "localhost" || hostLower == "127.0.0.1" {return true}-+// 127.x.x.xif hostLower.hasPrefix("127.") {return true}-+// 10.x.x.x (Private Class A)if hostLower.hasPrefix("10.") {return true}-+// 192.168.x.x (Private Class C)if hostLower.hasPrefix("192.168.") {return true}-+// 172.16.x.x - 172.31.x.x (Private Class B)if hostLower.hasPrefix("172.") {let components = hostLower.split(separator: ".")if components.count >= 2,let secondOctet = Int(components[1]),- secondOctet >= 16 && secondOctet <= 31 {+ secondOctet >= 16 && secondOctet <= 31+ {return true}}-+return false}}diff --git a/Sources/Fluid/Services/MenuBarManager.swift b/Sources/Fluid/Services/MenuBarManager.swiftindex fb500a2f..66617c07 100644--- a/Sources/Fluid/Services/MenuBarManager.swift+++ b/Sources/Fluid/Services/MenuBarManager.swift@@ -269,11 +269,7 @@ final class MenuBarManager: ObservableObject {statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength)guard let statusItem = statusItem else {- throw NSError(- domain: "MenuBarManager",- code: 1,- userInfo: [NSLocalizedDescriptionKey: "Failed to create status item"]- )+ throw NSError(domain: "MenuBarManager", code: 1, userInfo: [NSLocalizedDescriptionKey: "Failed to create status item"])}// Set initial icon@@ -345,18 +341,16 @@ final class MenuBarManager: ObservableObject {menu.removeAllItems()// Status indicator with hotkey info- let statusItem = NSMenuItem(title: "", action: nil, keyEquivalent: "")- statusItem.isEnabled = false- self.statusMenuItem = statusItem- menu.addItem(statusItem)+ self.statusMenuItem = NSMenuItem(title: "", action: nil, keyEquivalent: "")+ self.statusMenuItem?.isEnabled = false+ menu.addItem(self.statusMenuItem!)menu.addItem(.separator())// AI Processing Toggle- let aiItem = NSMenuItem(title: "", action: #selector(toggleAIProcessing), keyEquivalent: "")- aiItem.target = self- self.aiMenuItem = aiItem- menu.addItem(aiItem)+ self.aiMenuItem = NSMenuItem(title: "", action: #selector(self.toggleAIProcessing), keyEquivalent: "")+ self.aiMenuItem?.target = self+ menu.addItem(self.aiMenuItem!)menu.addItem(.separator())diff --git a/Sources/Fluid/Services/NotchOverlayManager.swift b/Sources/Fluid/Services/NotchOverlayManager.swiftindex 86a66dc1..22878df1 100644--- a/Sources/Fluid/Services/NotchOverlayManager.swift+++ b/Sources/Fluid/Services/NotchOverlayManager.swift@@ -1,3 +1,10 @@+//+// NotchOverlayManager.swift+// Fluid+//+// Created by Assistant+//+import AppKitimport Combineimport DynamicNotchKit@@ -293,8 +300,7 @@ final class NotchOverlayManager {let publisher = self.lastAudioPublisher ?? Empty<CGFloat, Never>().eraseToAnyPublisher()let newNotch = DynamicNotch(- hoverBehavior: [], // No keepVisible - allows closing with X/Escape even when cursor- // is on notch+ hoverBehavior: [], // No keepVisible - allows closing with X/Escape even when cursor is on notchstyle: .notch(topCornerRadius: 12, bottomCornerRadius: 16)) {NotchCommandOutputExpandedView(diff --git a/Sources/Fluid/Services/RewriteModeService.swift b/Sources/Fluid/Services/RewriteModeService.swiftindex 1a0ce263..154160ae 100644--- a/Sources/Fluid/Services/RewriteModeService.swift+++ b/Sources/Fluid/Services/RewriteModeService.swift@@ -6,15 +6,15 @@ import Foundationfinal class RewriteModeService: ObservableObject {@Published var originalText: String = ""@Published var rewrittenText: String = ""- @Published var streamingThinkingText: String = "" // Real-time thinking tokens for UI+ @Published var streamingThinkingText: String = "" // Real-time thinking tokens for UI@Published var isProcessing = false@Published var conversationHistory: [Message] = []@Published var isWriteMode: Bool = false // true = no text selected (write/improve), false = text selected (rewrite)private let textSelectionService = TextSelectionService.sharedprivate let typingService = TypingService()- private var thinkingBuffer: [String] = [] // Buffer thinking tokens-+ private var thinkingBuffer: [String] = [] // Buffer thinking tokens+struct Message: Identifiable, Equatable {let id = UUID()let role: Role@@ -77,10 +77,7 @@ final class RewriteModeService: ObservableObject {self.conversationHistory.append(Message(role: .user, content: rewritePrompt))} else {// Follow-up request- self.conversationHistory.append(Message(- role: .user,- content: "Follow-up instruction: \(prompt)\n\nApply this to the previous result. Output ONLY the updated text."- ))+ self.conversationHistory.append(Message(role: .user, content: "Follow-up instruction: \(prompt)\n\nApply this to the previous result. Output ONLY the updated text."))}}@@ -106,12 +103,12 @@ final class RewriteModeService: ObservableObject {}func clearState() {- originalText = ""- rewrittenText = ""- streamingThinkingText = ""- conversationHistory = []- isWriteMode = false- thinkingBuffer = []+ self.originalText = ""+ self.rewrittenText = ""+ self.streamingThinkingText = ""+ self.conversationHistory = []+ self.isWriteMode = false+ self.thinkingBuffer = []}// MARK: - LLM Integration@@ -180,7 +177,7 @@ final class RewriteModeService: ObservableObject {Output ONLY the rewritten text. No explanations, no quotes around the text, no preamble."""}-+// Build messages array for LLMClientvar apiMessages: [[String: Any]] = [["role": "system", "content": systemPrompt],@@ -195,7 +192,7 @@ final class RewriteModeService: ObservableObject {// Reasoning models (o1, o3, gpt-5) don't support temperature parameter at alllet isReasoningModel = settings.isReasoningModel(model)-+// Get reasoning config for this model (e.g., reasoning_effort, enable_thinking)let reasoningConfig = settings.getReasoningConfig(forModel: model, provider: providerID)var extraParams: [String: Any]? = nil@@ -207,7 +204,7 @@ final class RewriteModeService: ObservableObject {}DebugLogger.shared.debug("Added reasoning param: \(rConfig.parameterName)=\(rConfig.parameterValue)", source: "RewriteModeService")}-+// Build LLMClient configurationvar config = LLMClient.Config(messages: apiMessages,@@ -219,7 +216,7 @@ final class RewriteModeService: ObservableObject {temperature: isReasoningModel ? nil : 0.7,extraParameters: extraParams)-+// Add real-time streaming callbacks for UI updatesif enableStreaming {// Thinking tokens callback@@ -229,7 +226,7 @@ final class RewriteModeService: ObservableObject {self?.streamingThinkingText = self?.thinkingBuffer.joined() ?? ""}}-+// Content callbackconfig.onContentChunk = { [weak self] chunk inTask { @MainActor in@@ -237,29 +234,29 @@ final class RewriteModeService: ObservableObject {}}}-+DebugLogger.shared.info("Using LLMClient for Write/Rewrite (streaming=\(enableStreaming))", source: "RewriteModeService")-+// Clear streaming buffers before startingif enableStreaming {- rewrittenText = ""- streamingThinkingText = ""- thinkingBuffer = []+ self.rewrittenText = ""+ self.streamingThinkingText = ""+ self.thinkingBuffer = []}-+let response = try await LLMClient.shared.call(config)-+// Clear thinking display after response complete- streamingThinkingText = ""- thinkingBuffer = []-+ self.streamingThinkingText = ""+ self.thinkingBuffer = []+// Log thinking if present (for debugging)if let thinking = response.thinking {DebugLogger.shared.debug("LLM thinking tokens extracted (\(thinking.count) chars)", source: "RewriteModeService")}-+DebugLogger.shared.debug("Response complete. Content length: \(response.content.count)", source: "RewriteModeService")-+// For non-streaming, we return the content directly// For streaming, rewrittenText is already updated via callback,// but we return the final content for consistencydiff --git a/Sources/Fluid/Services/SimpleUpdater.swift b/Sources/Fluid/Services/SimpleUpdater.swiftindex 4b76aaac..99ce96db 100644--- a/Sources/Fluid/Services/SimpleUpdater.swift+++ b/Sources/Fluid/Services/SimpleUpdater.swift@@ -218,12 +218,7 @@ final class SimpleUpdater {let curTeam = teamID(from: curID)let newTeam = teamID(from: newID)let sameTeam = (curTeam != nil && curTeam == newTeam)- let bothAllowed: Bool- if let curTeam, let newTeam {- bothAllowed = self.allowedTeamIDs.contains(curTeam) && self.allowedTeamIDs.contains(newTeam)- } else {- bothAllowed = false- }+ let bothAllowed = (curTeam != nil && newTeam != nil && self.allowedTeamIDs.contains(curTeam!) && self.allowedTeamIDs.contains(newTeam!))guard sameIdentity || sameTeam || bothAllowed else {print("SimpleUpdater: Code-sign mismatch. Current=\(curID) New=\(newID)")diff --git a/Sources/Fluid/Services/TextSelectionService.swift b/Sources/Fluid/Services/TextSelectionService.swiftindex eededbd1..8d6fa174 100644--- a/Sources/Fluid/Services/TextSelectionService.swift+++ b/Sources/Fluid/Services/TextSelectionService.swift@@ -41,11 +41,7 @@ final class TextSelectionService {let systemWideElement = AXUIElementCreateSystemWide()var focusedElement: CFTypeRef?- let result = AXUIElementCopyAttributeValue(- systemWideElement,- kAXFocusedUIElementAttribute as CFString,- &focusedElement- )+ let result = AXUIElementCopyAttributeValue(systemWideElement, kAXFocusedUIElementAttribute as CFString, &focusedElement)if result == .success, let focusedElement {guard CFGetTypeID(focusedElement) == AXUIElementGetTypeID() else { return nil }@@ -57,11 +53,7 @@ final class TextSelectionService {private func getFocusedElement(from appElement: AXUIElement) -> AXUIElement? {var focusedElement: CFTypeRef?- let result = AXUIElementCopyAttributeValue(- appElement,- kAXFocusedUIElementAttribute as CFString,- &focusedElement- )+ let result = AXUIElementCopyAttributeValue(appElement, kAXFocusedUIElementAttribute as CFString, &focusedElement)if result == .success, let focusedElement {guard CFGetTypeID(focusedElement) == AXUIElementGetTypeID() else { return nil }diff --git a/Sources/Fluid/Services/ThinkingParsers.swift b/Sources/Fluid/Services/ThinkingParsers.swiftindex 5d601e08..cb911b7c 100644--- a/Sources/Fluid/Services/ThinkingParsers.swift+++ b/Sources/Fluid/Services/ThinkingParsers.swift@@ -16,7 +16,7 @@ protocol ThinkingParser {currentState: ThinkingParserState,tagBuffer: inout String) -> (ThinkingParserState, String, String)-+/// Post-process the final buffers after streaming completes./// Some parsers may need to do final cleanup./// - Parameters:@@ -30,92 +30,88 @@ protocol ThinkingParser {// MARK: - Parser Stateenum ThinkingParserState {- case initial // Haven't determined if we're in thinking or content yet- case inThinking // Currently inside thinking section- case inContent // Currently in main content+ case initial // Haven't determined if we're in thinking or content yet+ case inThinking // Currently inside thinking section+ case inContent // Currently in main content}// MARK: - Parser Factory/// Factory to create the appropriate parser and extra parameters based on model nameenum ThinkingParserFactory {-/// Create a parser appropriate for the given modelstatic func createParser(for model: String) -> ThinkingParser {let modelLower = model.lowercased()-+// Nemotron/Nemo models: no opening <think>, just </think> as separatorif modelLower.contains("nemotron") || modelLower.contains("nemo") {DebugLogger.shared.debug("ThinkingParser: Using NemoParser for model '\(model)'", source: "LLMClient")return NemoThinkingParser()}-+// Qwen models with thinking: use standard <think>...</think> patternif modelLower.contains("qwen") && (modelLower.contains("think") || modelLower.contains("qwq")) {DebugLogger.shared.debug("ThinkingParser: Using StandardParser for Qwen model '\(model)'", source: "LLMClient")return StandardThinkingParser()}-+// DeepSeek models: use standard pattern (they also have reasoning_content field handled separately)if modelLower.contains("deepseek") {DebugLogger.shared.debug("ThinkingParser: Using StandardParser for DeepSeek model '\(model)'", source: "LLMClient")return StandardThinkingParser()}-+// Default: Standard parser with <think>...</think> patternDebugLogger.shared.debug("ThinkingParser: Using StandardParser (default) for model '\(model)'", source: "LLMClient")return StandardThinkingParser()}-+/// Get model-specific extra parameters for the API request./// These are parameters beyond the standard model/messages/temperature.static func getExtraParameters(for model: String) -> [String: Any]? {let modelLower = model.lowercased()-+// Nemotron/Nemo models: require enable_thinking flagif modelLower.contains("nemotron") || modelLower.contains("nemo") {DebugLogger.shared.debug("ThinkingParser: Adding enable_thinking=true for Nemotron model '\(model)'", source: "LLMClient")return [- "enable_thinking": true+ "enable_thinking": true,// "truncate_history_thinking": false // Optional: could expose this in settings]}-+// DeepSeek R1 models: may need reasoning parameters- if modelLower.contains("deepseek") && modelLower.contains("r1") {+ if modelLower.contains("deepseek"), modelLower.contains("r1") {DebugLogger.shared.debug("ThinkingParser: Adding reasoning params for DeepSeek R1 model '\(model)'", source: "LLMClient")return [- "enable_reasoning": true+ "enable_reasoning": true,]}-+// Claude with thinking: requires thinking parameters (handled via Anthropic API differently)// OpenAI o1/o3 with reasoning: uses reasoning_effort parameter-+return nil}}-// MARK: - Standard Thinking Parser/// Standard parser for models that use `<think>...</think>` or `<thinking>...</thinking>` tags./// Used by: DeepSeek, Qwen, Claude (when thinking enabled), most open modelsstruct StandardThinkingParser: ThinkingParser {-mutating func processChunk(_ chunk: String,currentState: ThinkingParserState,tagBuffer: inout String) -> (ThinkingParserState, String, String) {-// Add chunk to buffer for tag detectiontagBuffer += chunk-+var thinkingChunk = ""var contentChunk = ""var newState = currentState-+// Check for opening tagif newState != .inThinking {if let openRange = tagBuffer.range(of: "<think>") ?? tagBuffer.range(of: "<thinking>") {@@ -129,7 +125,7 @@ struct StandardThinkingParser: ThinkingParser {newState = .inThinking}}-+// Check for closing tagif newState == .inThinking {if let closeRange = tagBuffer.range(of: "</think>") ?? tagBuffer.range(of: "</thinking>") {@@ -141,7 +137,7 @@ struct StandardThinkingParser: ThinkingParser {// Content after closing tag goes to contenttagBuffer = String(tagBuffer[closeRange.upperBound...])newState = .inContent-+// Any remaining buffer is contentif !tagBuffer.isEmpty {contentChunk += tagBuffer@@ -166,21 +162,21 @@ struct StandardThinkingParser: ThinkingParser {tagBuffer = String(tagBuffer[safeIndex...])}}-+return (newState, thinkingChunk, contentChunk)}-+func finalize(thinkingBuffer: [String], contentBuffer: [String], finalState: ThinkingParserState) -> (thinking: String, content: String) {let thinking = thinkingBuffer.joined()var content = contentBuffer.joined()-+// Strip any remaining stray tagscontent = content.replacingOccurrences(of: "</think>", with: "")content = content.replacingOccurrences(of: "</thinking>", with: "")content = content.replacingOccurrences(of: "<think>", with: "")content = content.replacingOccurrences(of: "<thinking>", with: "")content = content.trimmingCharacters(in: .whitespacesAndNewlines)-+return (thinking, content)}}@@ -191,26 +187,24 @@ struct StandardThinkingParser: ThinkingParser {/// Pattern: `thinking content</think>actual response`/// Everything before `</think>` is thinking, everything after is content.struct NemoThinkingParser: ThinkingParser {-mutating func processChunk(_ chunk: String,currentState: ThinkingParserState,tagBuffer: inout String) -> (ThinkingParserState, String, String) {-// Add chunk to buffertagBuffer += chunk-+var thinkingChunk = ""var contentChunk = ""var newState = currentState-+// For Nemo: we're in thinking mode until we see </think>// Initial state = thinking (no opening tag needed)if newState == .initial {newState = .inThinking}-+if newState == .inThinking {// Look for closing tagif let closeRange = tagBuffer.range(of: "</think>") ?? tagBuffer.range(of: "</thinking>") {@@ -219,17 +213,17 @@ struct NemoThinkingParser: ThinkingParser {if !beforeClose.isEmpty {thinkingChunk = beforeClose}-+// Everything after is contenttagBuffer = String(tagBuffer[closeRange.upperBound...])newState = .inContent-+// Emit remaining buffer as contentif !tagBuffer.isEmpty {contentChunk = tagBuffertagBuffer = ""}-+DebugLogger.shared.debug("NemoParser: Found </think>. Thinking: \(thinkingChunk.count) chars, Content: \(contentChunk.count) chars", source: "LLMClient")} else {// Still waiting for </think>, emit thinking (minus potential partial tag)@@ -245,14 +239,14 @@ struct NemoThinkingParser: ThinkingParser {contentChunk = tagBuffertagBuffer = ""}-+return (newState, thinkingChunk, contentChunk)}-+func finalize(thinkingBuffer: [String], contentBuffer: [String], finalState: ThinkingParserState) -> (thinking: String, content: String) {var thinking = thinkingBuffer.joined()var content = contentBuffer.joined()-+// IMPORTANT: If we're still in .inThinking state at the end, it means// we NEVER saw a </think> tag. This indicates thinking mode was OFF// (server didn't use thinking). All "thinking" is actually content!@@ -262,12 +256,12 @@ struct NemoThinkingParser: ThinkingParser {thinking = ""DebugLogger.shared.debug("NemoParser finalize: No </think> found - treating all as content (\(content.count) chars)", source: "LLMClient")}-+// Clean up any stray tagscontent = content.replacingOccurrences(of: "</think>", with: "")content = content.replacingOccurrences(of: "</thinking>", with: "")content = content.trimmingCharacters(in: .whitespacesAndNewlines)-+return (thinking, content)}}@@ -277,7 +271,6 @@ struct NemoThinkingParser: ThinkingParser {/// Parser for models that don't use thinking tokens at all./// Everything is content.struct NoThinkingParser: ThinkingParser {-mutating func processChunk(_ chunk: String,currentState: ThinkingParserState,@@ -286,7 +279,7 @@ struct NoThinkingParser: ThinkingParser {// Everything is contentreturn (.inContent, "", chunk)}-+func finalize(thinkingBuffer: [String], contentBuffer: [String], finalState: ThinkingParserState) -> (thinking: String, content: String) {return ("", contentBuffer.joined())}diff --git a/Sources/Fluid/Services/TypingService.swift b/Sources/Fluid/Services/TypingService.swiftindex 8d2445c8..f37ed5e0 100644--- a/Sources/Fluid/Services/TypingService.swift+++ b/Sources/Fluid/Services/TypingService.swift@@ -150,11 +150,7 @@ final class TypingService {let systemWideElement = AXUIElementCreateSystemWide()var focusedElement: CFTypeRef?- let result = AXUIElementCopyAttributeValue(- systemWideElement,- kAXFocusedUIElementAttribute as CFString,- &focusedElement- )+ let result = AXUIElementCopyAttributeValue(systemWideElement, kAXFocusedUIElementAttribute as CFString, &focusedElement)if result == .success, let focusedElement {guard CFGetTypeID(focusedElement) == AXUIElementGetTypeID() else { return nil }@@ -213,11 +209,7 @@ final class TypingService {let appElement = AXUIElementCreateApplication(frontmostApp.processIdentifier)var focusedElement: CFTypeRef?- let result = AXUIElementCopyAttributeValue(- appElement,- kAXFocusedUIElementAttribute as CFString,- &focusedElement- )+ let result = AXUIElementCopyAttributeValue(appElement, kAXFocusedUIElementAttribute as CFString, &focusedElement)if result == .success, let focusedElement {guard CFGetTypeID(focusedElement) == AXUIElementGetTypeID() else { return nil }@@ -285,11 +277,7 @@ final class TypingService {private func setTextViaSelection(_ element: AXUIElement, _ text: String) -> Bool {// First, select all existing text- let selectAllResult = AXUIElementSetAttributeValue(- element,- kAXSelectedTextAttribute as CFString,- "" as CFString- )+ let selectAllResult = AXUIElementSetAttributeValue(element, kAXSelectedTextAttribute as CFString, "" as CFString)self.log("[TypingService] Select all result: \(selectAllResult.rawValue)")// Then replace the selection with our text@@ -308,11 +296,7 @@ final class TypingService {private func insertTextAtInsertionPoint(_ element: AXUIElement, _ text: String) -> Bool {// Try to get the insertion pointvar insertionPoint: CFTypeRef?- let getResult = AXUIElementCopyAttributeValue(- element,- kAXInsertionPointLineNumberAttribute as CFString,- &insertionPoint- )+ let getResult = AXUIElementCopyAttributeValue(element, kAXInsertionPointLineNumberAttribute as CFString, &insertionPoint)self.log("[TypingService] Get insertion point result: \(getResult.rawValue)")// Try to insert text using parameterized attribute@@ -340,8 +324,7 @@ final class TypingService {let targetPID = frontApp.processIdentifierself.log("[TypingService] Targeting PID \(targetPID) for bulk insertion")- // Try word-by-word insertion instead of entire text at once (faster than char-by-char but more reliable than- // bulk)+ // Try word-by-word insertion instead of entire text at once (faster than char-by-char but more reliable than bulk)let words = text.components(separatedBy: " ")self.log("[TypingService] Splitting text into \(words.count) words for bulk insertion")diff --git a/Sources/Fluid/Services/WhisperProvider.swift b/Sources/Fluid/Services/WhisperProvider.swiftindex 3e1d2a07..6ea7488b 100644--- a/Sources/Fluid/Services/WhisperProvider.swift+++ b/Sources/Fluid/Services/WhisperProvider.swift@@ -23,8 +23,7 @@ final class WhisperProvider: TranscriptionProvider {}private var modelURL: URL {- let cacheDir = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first- ?? FileManager.default.temporaryDirectory+ let cacheDir = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first!return cacheDir.appendingPathComponent("WhisperModels").appendingPathComponent(self.modelName)}@@ -36,11 +35,7 @@ final class WhisperProvider: TranscriptionProvider {// Detect model change: if a different model is now selected, force reloadlet currentModelName = self.modelNameif self.isReady, self.loadedModelName != currentModelName {- DebugLogger.shared- .info(- "WhisperProvider: Model changed from \(self.loadedModelName ?? "nil") to \(currentModelName), forcing reload",- source: "WhisperProvider"- )+ DebugLogger.shared.info("WhisperProvider: Model changed from \(self.loadedModelName ?? "nil") to \(currentModelName), forcing reload", source: "WhisperProvider")self.isReady = falseself.whisper = nilself.loadedModelName = nil@@ -81,8 +76,7 @@ final class WhisperProvider: TranscriptionProvider {let segments = try await whisper.transcribe(audioFrames: samples)// Combine all segments into one string- let fullText = segments.map { $0.text }.joined(separator: " ")- .trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)+ let fullText = segments.map { $0.text }.joined(separator: " ").trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)// SwiftWhisper doesn't provide confidence, so we use 1.0return ASRTranscriptionResult(text: fullText, confidence: 1.0)@@ -132,9 +126,7 @@ final class WhisperProvider: TranscriptionProvider {throw NSError(domain: "WhisperProvider",code: httpResponse.statusCode,- userInfo: [- NSLocalizedDescriptionKey: "Failed to download model (HTTP \(httpResponse.statusCode))",- ]+ userInfo: [NSLocalizedDescriptionKey: "Failed to download model (HTTP \(httpResponse.statusCode))"])}diff --git a/Sources/Fluid/TalkingAnimations.swift b/Sources/Fluid/TalkingAnimations.swiftindex 3885bb30..1cb87a18 100644--- a/Sources/Fluid/TalkingAnimations.swift+++ b/Sources/Fluid/TalkingAnimations.swift@@ -1,3 +1,10 @@+//+// TalkingAnimations.swift+// fluid+//+// Created by Assistant+//+import AppKitimport Combineimport CoreGraphics@@ -122,8 +129,7 @@ struct SpokenlyWaveform: View {@State private var lastUpdateTime: TimeInterval = 0@State private var isViewVisible: Bool = true- private let animationTimer = Timer.publish(every: 0.033, on: .main, in: .common)- .autoconnect() // 30 FPS base timer - safer for CoreML concurrency+ private let animationTimer = Timer.publish(every: 0.033, on: .main, in: .common).autoconnect() // 30 FPS base timer - safer for CoreML concurrencyvar body: some View {HStack(spacing: self.config.barSpacing) {@@ -168,8 +174,7 @@ struct SpokenlyWaveform: View {self.lastUpdateTime = currentTime// Safety check- guard self.barHeights.count == self.config.barCount,- self.barOpacities.count == self.config.barCount else { return }+ guard self.barHeights.count == self.config.barCount, self.barOpacities.count == self.config.barCount else { return }// Direct real-time animation based on current audio levelif self.audioLevel <= self.config.noiseThreshold { // USE THE USER-CONTROLLABLE THRESHOLD!@@ -243,8 +248,7 @@ struct EnhancedTalkingAudioVisualizationView: View {)}}- .frame(width: CGFloat(self.config.particleCount) * (self.config.maxParticleSize + self.config.particleSpacing) -- self.config.particleSpacing)+ .frame(width: CGFloat(self.config.particleCount) * (self.config.maxParticleSize + self.config.particleSpacing) - self.config.particleSpacing).onReceive(NotificationCenter.default.publisher(for: UserDefaults.didChangeNotification)) { _ in// Update threshold when UserDefaults changeslet newThreshold = CGFloat(SettingsStore.shared.visualizerNoiseThreshold)@@ -295,50 +299,58 @@ struct PremiumTalkingParticle: View {ZStack {// Outer glow ringCircle()- .fill(RadialGradient(- gradient: Gradient(colors: [- Color.clear,- Color.purple.opacity(0.2),- Color.indigo.opacity(0.08),- Color.clear,- ]),- center: .center,- startRadius: self.particleSize * 0.3,- endRadius: self.particleSize * 1.8- ))+ .fill(+ RadialGradient(+ gradient: Gradient(colors: [+ Color.clear,+ Color.purple.opacity(0.2),+ Color.indigo.opacity(0.08),+ Color.clear,+ ]),+ center: .center,+ startRadius: self.particleSize * 0.3,+ endRadius: self.particleSize * 1.8+ )+ ).frame(width: self.particleSize * 2.5, height: self.particleSize * 2.5).opacity(self.isActive ? 0.6 : 0.1).blur(radius: 2)// Main particleCircle()- .fill(AngularGradient(- gradient: Gradient(stops: [- .init(color: Color.gray.opacity(0.6), location: 0.0),- .init(color: Color.purple.opacity(0.7), location: 0.25),- .init(color: Color.indigo.opacity(0.8), location: 0.5),- .init(color: Color.black.opacity(0.9), location: 0.75),- .init(color: Color.gray.opacity(0.6), location: 1.0),- ]),- center: .center,- startAngle: .degrees(self.rotationAngle),- endAngle: .degrees(self.rotationAngle + 360)- ))+ .fill(+ AngularGradient(+ gradient: Gradient(stops: [+ .init(color: Color.gray.opacity(0.6), location: 0.0),+ .init(color: Color.purple.opacity(0.7), location: 0.25),+ .init(color: Color.indigo.opacity(0.8), location: 0.5),+ .init(color: Color.black.opacity(0.9), location: 0.75),+ .init(color: Color.gray.opacity(0.6), location: 1.0),+ ]),+ center: .center,+ startAngle: .degrees(self.rotationAngle),+ endAngle: .degrees(self.rotationAngle + 360)+ )+ ).frame(width: self.particleSize, height: self.particleSize).opacity(self.particleOpacity).scaleEffect(self.pulseScale)- .overlay(Circle()- .fill(RadialGradient(- gradient: Gradient(colors: [- Color.white.opacity(0.3),- Color.white.opacity(0.1),- Color.clear,- ]),- center: UnitPoint(x: 0.3, y: 0.3),- startRadius: 0,- endRadius: self.particleSize * 0.6- ))- .frame(width: self.particleSize, height: self.particleSize))+ .overlay(+ Circle()+ .fill(+ RadialGradient(+ gradient: Gradient(colors: [+ Color.white.opacity(0.3),+ Color.white.opacity(0.1),+ Color.clear,+ ]),+ center: UnitPoint(x: 0.3, y: 0.3),+ startRadius: 0,+ endRadius: self.particleSize * 0.6+ )+ )+ .frame(width: self.particleSize, height: self.particleSize)+ ).shadow(color: Color.purple.opacity(0.4), radius: 4, x: 0, y: 2).shadow(color: Color.indigo.opacity(0.3), radius: 8, x: 0, y: 0)}diff --git a/Sources/Fluid/Theme/Components/SetupComponents.swift b/Sources/Fluid/Theme/Components/SetupComponents.swiftindex ec3b0341..1b98050c 100644--- a/Sources/Fluid/Theme/Components/SetupComponents.swift+++ b/Sources/Fluid/Theme/Components/SetupComponents.swift@@ -1,3 +1,10 @@+//+// SetupComponents.swift+// fluid+//+// Helper components for setup and onboarding UI+//+import AppKitimport SwiftUI@@ -29,8 +36,10 @@ struct SetupStepView: View {Circle().fill(self.statusColor.opacity(0.12)).frame(width: 28, height: 28)- .overlay(Circle()- .stroke(self.statusColor.opacity(0.25), lineWidth: 1))+ .overlay(+ Circle()+ .stroke(self.statusColor.opacity(0.25), lineWidth: 1)+ )if self.status == .completed {Image(systemName: "checkmark.circle.fill")@@ -82,17 +91,21 @@ struct SetupStepView: View {}}.padding(10)- .background(RoundedRectangle(cornerRadius: 8, style: .continuous)- .fill(self.status == .completed- ? Color.green.opacity(0.06)- : self.theme.palette.cardBackground.opacity(0.5))- .overlay(RoundedRectangle(cornerRadius: 8, style: .continuous)- .stroke(- self.status == .completed- ? Color.green.opacity(0.25)- : self.theme.palette.cardBorder.opacity(0.2),- lineWidth: 1- )))+ .background(+ RoundedRectangle(cornerRadius: 8, style: .continuous)+ .fill(self.status == .completed+ ? Color.green.opacity(0.06)+ : self.theme.palette.cardBackground.opacity(0.5))+ .overlay(+ RoundedRectangle(cornerRadius: 8, style: .continuous)+ .stroke(+ self.status == .completed+ ? Color.green.opacity(0.25)+ : self.theme.palette.cardBorder.opacity(0.2),+ lineWidth: 1+ )+ )+ )}.buttonStyle(.plain).disabled(self.status == .completed || !self.showActionButton)diff --git a/Sources/Fluid/Theme/Components/ThemedCard.swift b/Sources/Fluid/Theme/Components/ThemedCard.swiftindex 0a15fdc6..fa33cacb 100644--- a/Sources/Fluid/Theme/Components/ThemedCard.swift+++ b/Sources/Fluid/Theme/Components/ThemedCard.swift@@ -34,24 +34,26 @@ struct ThemedCard<Content: View>: View {self.content.padding(self.padding ?? 14).background(configuration.material, in: shape)- .background(shape- .fill(configuration.background)- .overlay(shape- .stroke(- configuration.border- .opacity(self.isHovered && self.hoverEffect ? configuration.hoverBorderOpacity : configuration- .borderOpacity),- lineWidth: configuration.borderWidth- ))- .shadow(- color: configuration.shadow.color.opacity(self.isHovered && self.hoverEffect ? min(- configuration.shadow.opacity + configuration.hoverShadowBoost,- 1.0- ) : configuration.shadow.opacity),- radius: configuration.shadow.radius,- x: configuration.shadow.x,- y: self.isHovered && self.hoverEffect ? configuration.shadow.y + 1 : configuration.shadow.y- ))+ .background(+ shape+ .fill(configuration.background)+ .overlay(+ shape.stroke(+ configuration.border.opacity(+ self.isHovered && self.hoverEffect ? configuration.hoverBorderOpacity : configuration.borderOpacity+ ),+ lineWidth: configuration.borderWidth+ )+ )+ .shadow(+ color: configuration.shadow.color.opacity(+ self.isHovered && self.hoverEffect ? min(configuration.shadow.opacity + configuration.hoverShadowBoost, 1.0) : configuration.shadow.opacity+ ),+ radius: configuration.shadow.radius,+ x: configuration.shadow.x,+ y: self.isHovered && self.hoverEffect ? configuration.shadow.y + 1 : configuration.shadow.y+ )+ ).scaleEffect(self.isHovered && self.hoverEffect ? 1.01 : 1.0).onHover { hovering inguard self.hoverEffect else { return }diff --git a/Sources/Fluid/Theme/NativeButtonStyles.swift b/Sources/Fluid/Theme/NativeButtonStyles.swiftindex f356af2b..e0e6e515 100644--- a/Sources/Fluid/Theme/NativeButtonStyles.swift+++ b/Sources/Fluid/Theme/NativeButtonStyles.swift@@ -24,22 +24,24 @@ struct GlassButtonStyle: ButtonStyle {.frame(minHeight: 36).foregroundStyle(self.theme.palette.primaryText).background(self.theme.materials.card, in: self.shape)- .background(self.shape- .fill(self.theme.palette.cardBackground)- .overlay(self.shape.stroke(- self.theme.palette.cardBorder.opacity(self.isHovered ? 0.45 : 0.25),- lineWidth: 1- )))- .overlay(self.shape- .stroke(self.theme.palette.accent.opacity(self.isHovered ? 0.25 : 0.1), lineWidth: 1)- .blendMode(.plusLighter))+ .background(+ self.shape+ .fill(self.theme.palette.cardBackground)+ .overlay(+ self.shape.stroke(+ self.theme.palette.cardBorder.opacity(self.isHovered ? 0.45 : 0.25),+ lineWidth: 1+ )+ )+ )+ .overlay(+ self.shape+ .stroke(self.theme.palette.accent.opacity(self.isHovered ? 0.25 : 0.1), lineWidth: 1)+ .blendMode(.plusLighter)+ ).shadow(color: self.theme.palette.cardBorder.opacity(self.isHovered ? 0.45 : 0.22),- radius: self.isHovered ? self.theme.metrics.cardShadow- .radius : max(- self.theme.metrics.cardShadow.radius - 3,- 2- ),+ radius: self.isHovered ? self.theme.metrics.cardShadow.radius : max(self.theme.metrics.cardShadow.radius - 3, 2),x: 0,y: self.isHovered ? self.theme.metrics.cardShadow.y : self.theme.metrics.cardShadow.y - 2)@@ -100,20 +102,20 @@ struct PremiumButtonStyle: ButtonStyle {.frame(maxWidth: .infinity).frame(height: self.height).foregroundStyle(self.isRecording ? Color.white : self.theme.palette.primaryText)- .background(self.shape- .fill(self.baseGradient)- .overlay(self.shape.stroke(- Color.white.opacity(self.isHovered ? 0.35 : 0.2),- lineWidth: 1- )))+ .background(+ self.shape+ .fill(self.baseGradient)+ .overlay(+ self.shape.stroke(+ Color.white.opacity(self.isHovered ? 0.35 : 0.2),+ lineWidth: 1+ )+ )+ ).shadow(color: (self.isRecording ? Color(nsColor: .systemRed) : self.theme.palette.accent).opacity(self.isHovered ? 0.45 : 0.25),- radius: self.isHovered ? self.theme.metrics.elevatedCardShadow- .radius : max(- self.theme.metrics.cardShadow.radius - 2,- 2- ),+ radius: self.isHovered ? self.theme.metrics.elevatedCardShadow.radius : max(self.theme.metrics.cardShadow.radius - 2, 2),x: 0,y: self.isHovered ? self.theme.metrics.elevatedCardShadow.y : self.theme.metrics.cardShadow.y)@@ -148,19 +150,19 @@ struct SecondaryButtonStyle: ButtonStyle {.frame(height: 42).foregroundStyle(self.theme.palette.primaryText).background(self.theme.materials.card, in: self.shape)- .background(self.shape- .fill(self.theme.palette.cardBackground)- .overlay(self.shape.stroke(- self.theme.palette.cardBorder.opacity(self.isHovered ? 0.45 : 0.25),- lineWidth: 1- )))+ .background(+ self.shape+ .fill(self.theme.palette.cardBackground)+ .overlay(+ self.shape.stroke(+ self.theme.palette.cardBorder.opacity(self.isHovered ? 0.45 : 0.25),+ lineWidth: 1+ )+ )+ ).shadow(color: self.theme.palette.cardBorder.opacity(self.isHovered ? 0.35 : 0.15),- radius: self.isHovered ? self.theme.metrics.cardShadow- .radius : max(- self.theme.metrics.cardShadow.radius - 4,- 1- ),+ radius: self.isHovered ? self.theme.metrics.cardShadow.radius : max(self.theme.metrics.cardShadow.radius - 4, 1),x: 0,y: self.isHovered ? self.theme.metrics.cardShadow.y : self.theme.metrics.cardShadow.y - 2)@@ -198,14 +200,17 @@ struct CompactButtonStyle: ButtonStyle {.frame(height: 34).foregroundStyle(self.theme.palette.primaryText).background(self.theme.materials.card, in: self.shape)- .background(self.shape- .fill(self.theme.palette.cardBackground)- .overlay(self.shape- .stroke(- (self.isReady ? self.theme.palette.accent : self.theme.palette.cardBorder)- .opacity(self.isHovered ? 0.45 : 0.25),- lineWidth: 1- )))+ .background(+ self.shape+ .fill(self.theme.palette.cardBackground)+ .overlay(+ self.shape.stroke(+ (self.isReady ? self.theme.palette.accent : self.theme.palette.cardBorder)+ .opacity(self.isHovered ? 0.45 : 0.25),+ lineWidth: 1+ )+ )+ ).shadow(color: (self.isReady ? self.theme.palette.accent : self.theme.palette.cardBorder).opacity(self.isHovered ? 0.3 : 0.12),@@ -244,8 +249,10 @@ struct InlineButtonStyle: ButtonStyle {.padding(.horizontal, self.theme.metrics.spacing.md).padding(.vertical, self.theme.metrics.spacing.xs).foregroundStyle(Color.white)- .background(self.shape- .fill(self.theme.palette.accent.opacity(self.isHovered ? 0.9 : 0.8)))+ .background(+ self.shape+ .fill(self.theme.palette.accent.opacity(self.isHovered ? 0.9 : 0.8))+ ).shadow(color: self.theme.palette.accent.opacity(self.isHovered ? 0.45 : 0.25),radius: self.isHovered ? 6 : 3,diff --git a/Sources/Fluid/UI/AISettingsView.swift b/Sources/Fluid/UI/AISettingsView.swiftindex c7910dc4..10dd7f4b 100644--- a/Sources/Fluid/UI/AISettingsView.swift+++ b/Sources/Fluid/UI/AISettingsView.swift@@ -116,13 +116,13 @@ struct AISettingsView: View {// MARK: - Load Settingsprivate func loadSettings() {- selectedProviderID = SettingsStore.shared.selectedProviderID-- enableAIProcessing = SettingsStore.shared.enableAIProcessing- availableModelsByProvider = SettingsStore.shared.availableModelsByProvider- selectedModelByProvider = SettingsStore.shared.selectedModelByProvider- providerAPIKeys = SettingsStore.shared.providerAPIKeys- savedProviders = SettingsStore.shared.savedProviders+ self.selectedProviderID = SettingsStore.shared.selectedProviderID++ self.enableAIProcessing = SettingsStore.shared.enableAIProcessing+ self.availableModelsByProvider = SettingsStore.shared.availableModelsByProvider+ self.selectedModelByProvider = SettingsStore.shared.selectedModelByProvider+ self.providerAPIKeys = SettingsStore.shared.providerAPIKeys+ self.savedProviders = SettingsStore.shared.savedProviders// Normalize provider keysvar normalized: [String: [String]] = [:]@@ -150,32 +150,32 @@ struct AISettingsView: View {}self.selectedModelByProvider = normalizedSelSettingsStore.shared.selectedModelByProvider = normalizedSel-+// Determine initial model list AND set baseURL BEFORE calling updateCurrentProviderif let saved = savedProviders.first(where: { $0.id == selectedProviderID }) {- availableModels = saved.models- openAIBaseURL = saved.baseURL // Set this FIRST- } else if selectedProviderID == "openai" {- openAIBaseURL = "https://api.openai.com/v1"- availableModels = availableModelsByProvider["openai"] ?? defaultModels(for: "openai")- } else if selectedProviderID == "groq" {- openAIBaseURL = "https://api.groq.com/openai/v1"- availableModels = availableModelsByProvider["groq"] ?? defaultModels(for: "groq")+ self.availableModels = saved.models+ self.openAIBaseURL = saved.baseURL // Set this FIRST+ } else if self.selectedProviderID == "openai" {+ self.openAIBaseURL = "https://api.openai.com/v1"+ self.availableModels = self.availableModelsByProvider["openai"] ?? self.defaultModels(for: "openai")+ } else if self.selectedProviderID == "groq" {+ self.openAIBaseURL = "https://api.groq.com/openai/v1"+ self.availableModels = self.availableModelsByProvider["groq"] ?? self.defaultModels(for: "groq")} else {self.availableModels = self.defaultModels(for: self.providerKey(for: self.selectedProviderID))}-+// NOW update currentProvider after openAIBaseURL is set correctly- updateCurrentProvider()-+ self.updateCurrentProvider()+// Restore selected model using the correct currentProviderif let sel = selectedModelByProvider[currentProvider], availableModels.contains(sel) {self.selectedModel = sel} else if let first = availableModels.first {self.selectedModel = first}-- DebugLogger.shared.debug("loadSettings complete: provider=\(selectedProviderID), currentProvider=\(currentProvider), model=\(selectedModel), baseURL=\(openAIBaseURL)", source: "AISettingsView")++ DebugLogger.shared.debug("loadSettings complete: provider=\(self.selectedProviderID), currentProvider=\(self.currentProvider), model=\(self.selectedModel), baseURL=\(self.openAIBaseURL)", source: "AISettingsView")}// MARK: - Speech Recognition Card@@ -237,8 +237,7 @@ struct AISettingsView: View {.font(.caption).padding(.horizontal, 8).padding(.vertical, 4)- .background(RoundedRectangle(cornerRadius: 5, style: .continuous)- .fill(self.theme.palette.accent.opacity(0.2)))+ .background(RoundedRectangle(cornerRadius: 5, style: .continuous).fill(self.theme.palette.accent.opacity(0.2)))}}@@ -252,8 +251,7 @@ struct AISettingsView: View {.font(.caption)Text(SettingsStore.shared.selectedSpeechModel.isWhisperModel? "Whisper models support 99 languages and work on any Mac."- :- "Parakeet TDT uses CoreML and Neural Engine for fastest transcription (25 languages) on Apple Silicon.")+ : "Parakeet TDT uses CoreML and Neural Engine for fastest transcription (25 languages) on Apple Silicon.").font(.caption).foregroundStyle(.secondary)}@@ -429,7 +427,7 @@ struct AISettingsView: View {return config.isEnabled}}- return SettingsStore.shared.isReasoningModel(selectedModel)+ return SettingsStore.shared.isReasoningModel(self.selectedModel)}private func addNewModel() {@@ -602,10 +600,10 @@ struct AISettingsView: View {} else {fullURL = endpoint + "/chat/completions"}-+// Debug logging to diagnose test failures- DebugLogger.shared.debug("testAPIConnection: provider=\(selectedProviderID), model=\(selectedModel), baseURL=\(endpoint), fullURL=\(fullURL)", source: "AISettingsView")-+ DebugLogger.shared.debug("testAPIConnection: provider=\(self.selectedProviderID), model=\(self.selectedModel), baseURL=\(endpoint), fullURL=\(fullURL)", source: "AISettingsView")+guard let url = URL(string: fullURL) else {await MainActor.run {self.connectionStatus = .failed@@ -614,11 +612,11 @@ struct AISettingsView: View {return}- let provKey = providerKey(for: selectedProviderID)- let reasoningConfig = SettingsStore.shared.getReasoningConfig(forModel: selectedModel, provider: provKey)-- let usesMaxCompletionTokens = SettingsStore.shared.isReasoningModel(selectedModel)-+ let provKey = self.providerKey(for: self.selectedProviderID)+ let reasoningConfig = SettingsStore.shared.getReasoningConfig(forModel: self.selectedModel, provider: provKey)++ let usesMaxCompletionTokens = SettingsStore.shared.isReasoningModel(self.selectedModel)+var requestDict: [String: Any] = ["model": selectedModel,"messages": [["role": "user", "content": "test"]],@@ -739,16 +737,15 @@ struct AISettingsView: View {self.aiEnhancementToggle// Streaming Toggle- if enableAIProcessing && selectedProviderID != "apple-intelligence" {- streamingToggle- showThinkingTokensToggle+ if self.enableAIProcessing && self.selectedProviderID != "apple-intelligence" {+ self.streamingToggle+ self.showThinkingTokensToggle}// API Key Warningif self.enableAIProcessing && self.selectedProviderID != "apple-intelligence" &&!self.isLocalEndpoint(self.openAIBaseURL.trimmingCharacters(in: .whitespacesAndNewlines)) &&- (self.providerAPIKeys[self.currentProvider] ?? "")- .trimmingCharacters(in: .whitespacesAndNewlines).isEmpty+ (self.providerAPIKeys[self.currentProvider] ?? "").trimmingCharacters(in: .whitespacesAndNewlines).isEmpty{self.apiKeyWarningView}@@ -811,7 +808,7 @@ struct AISettingsView: View {.padding(.horizontal, 4)}}-+private var showThinkingTokensToggle: some View {Group {Divider().padding(.vertical, 3)@@ -819,10 +816,10 @@ struct AISettingsView: View {VStack(alignment: .leading, spacing: 4) {Text("Show Thinking Tokens").font(.system(size: 15, weight: .semibold))- .foregroundStyle(theme.palette.primaryText)+ .foregroundStyle(self.theme.palette.primaryText)Text("Display AI reasoning in Command and Rewrite modes (when available)").font(.system(size: 13))- .foregroundStyle(theme.palette.secondaryText)+ .foregroundStyle(self.theme.palette.secondaryText)}Spacer()Toggle("", isOn: Binding(@@ -835,7 +832,7 @@ struct AISettingsView: View {.padding(.horizontal, 4)}}-+private var apiKeyWarningView: some View {HStack(spacing: 10) {Image(systemName: "exclamationmark.triangle.fill")@@ -947,14 +944,7 @@ struct AISettingsView: View {}.frame(width: 90, alignment: .leading).padding(.horizontal, 10).padding(.vertical, 4)- .background(LinearGradient(- colors: [- self.theme.palette.accent.opacity(0.15),- self.theme.palette.accent.opacity(0.05),- ],- startPoint: .leading,- endPoint: .trailing- ))+ .background(LinearGradient(colors: [self.theme.palette.accent.opacity(0.15), self.theme.palette.accent.opacity(0.05)], startPoint: .leading, endPoint: .trailing)).cornerRadius(6)Picker("", selection: self.$selectedProviderID) {@@ -983,16 +973,14 @@ struct AISettingsView: View {.buttonStyle(CompactButtonStyle())Button(action: { self.deleteCurrentProvider() }) {- HStack(spacing: 4) { Image(systemName: "trash"); Text("Delete") }.font(.caption)- .foregroundStyle(.red)+ HStack(spacing: 4) { Image(systemName: "trash"); Text("Delete") }.font(.caption).foregroundStyle(.red)}.buttonStyle(CompactButtonStyle())}Button("+ Add Provider") {self.showingSaveProvider = true- self.newProviderName = ""; self.newProviderBaseURL = ""; self.newProviderApiKey = ""; self- .newProviderModels = ""+ self.newProviderName = ""; self.newProviderBaseURL = ""; self.newProviderApiKey = ""; self.newProviderModels = ""}.buttonStyle(CompactButtonStyle())}@@ -1022,8 +1010,7 @@ struct AISettingsView: View {self.openAIBaseURL = provider.baseURLself.updateCurrentProvider()let key = self.providerKey(for: newValue)- self.availableModels = provider.models.isEmpty ? (self.availableModelsByProvider[key] ?? []) : provider- .models+ self.availableModels = provider.models.isEmpty ? (self.availableModelsByProvider[key] ?? []) : provider.modelsself.selectedModel = self.selectedModelByProvider[key] ?? self.availableModels.first ?? self.selectedModel}}@@ -1060,26 +1047,17 @@ struct AISettingsView: View {HStack(spacing: 8) {VStack(alignment: .leading, spacing: 4) {Text("Name").font(.caption).foregroundStyle(.secondary)- TextField("Provider name", text: self.$editProviderName).textFieldStyle(.roundedBorder)- .frame(width: 200)+ TextField("Provider name", text: self.$editProviderName).textFieldStyle(.roundedBorder).frame(width: 200)}VStack(alignment: .leading, spacing: 4) {Text("Base URL").font(.caption).foregroundStyle(.secondary)- TextField("e.g., http://localhost:11434/v1", text: self.$editProviderBaseURL)- .textFieldStyle(.roundedBorder).font(.system(- .body,- design: .monospaced- ))+ TextField("e.g., http://localhost:11434/v1", text: self.$editProviderBaseURL).textFieldStyle(.roundedBorder).font(.system(.body, design: .monospaced))}}HStack(spacing: 8) {Button("Save") { self.saveEditedProvider() }.buttonStyle(GlassButtonStyle())- .disabled(self.editProviderName.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty || self- .editProviderBaseURL.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)- Button("Cancel") {- self.showingEditProvider = false; self.editProviderName = ""; self.editProviderBaseURL = ""- }- .buttonStyle(GlassButtonStyle())+ .disabled(self.editProviderName.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty || self.editProviderBaseURL.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)+ Button("Cancel") { self.showingEditProvider = false; self.editProviderName = ""; self.editProviderBaseURL = "" }.buttonStyle(GlassButtonStyle())}}.padding(12)@@ -1097,12 +1075,7 @@ struct AISettingsView: View {if let providerIndex = savedProviders.firstIndex(where: { $0.id == selectedProviderID }) {let oldProvider = self.savedProviders[providerIndex]- let updatedProvider = SettingsStore.SavedProvider(- id: oldProvider.id,- name: name,- baseURL: base,- models: oldProvider.models- )+ let updatedProvider = SettingsStore.SavedProvider(id: oldProvider.id, name: name, baseURL: base, models: oldProvider.models)self.savedProviders[providerIndex] = updatedProviderself.saveSavedProviders()self.openAIBaseURL = base@@ -1134,14 +1107,7 @@ struct AISettingsView: View {HStack { Text("Model:").fontWeight(.medium) }.frame(width: 90, alignment: .leading).padding(.horizontal, 10).padding(.vertical, 4)- .background(LinearGradient(- colors: [- self.theme.palette.accent.opacity(0.15),- self.theme.palette.accent.opacity(0.05),- ],- startPoint: .leading,- endPoint: .trailing- ))+ .background(LinearGradient(colors: [self.theme.palette.accent.opacity(0.15), self.theme.palette.accent.opacity(0.05)], startPoint: .leading, endPoint: .trailing)).cornerRadius(6)Text("System Language Model").foregroundStyle(.secondary).font(.system(.body))Spacer()@@ -1153,14 +1119,7 @@ struct AISettingsView: View {HStack { Text("Model:").fontWeight(.medium) }.frame(width: 90, alignment: .leading).padding(.horizontal, 10).padding(.vertical, 4)- .background(LinearGradient(- colors: [- self.theme.palette.accent.opacity(0.15),- self.theme.palette.accent.opacity(0.05),- ],- startPoint: .leading,- endPoint: .trailing- ))+ .background(LinearGradient(colors: [self.theme.palette.accent.opacity(0.15), self.theme.palette.accent.opacity(0.05)], startPoint: .leading, endPoint: .trailing)).cornerRadius(6)Picker("", selection: self.$selectedModel) {@@ -1170,15 +1129,13 @@ struct AISettingsView: View {if !["openai", "groq"].contains(self.selectedProviderID) {Button(action: { self.deleteSelectedModel() }) {- HStack(spacing: 4) { Image(systemName: "trash"); Text("Delete") }.font(.caption)- .foregroundStyle(.red)+ HStack(spacing: 4) { Image(systemName: "trash"); Text("Delete") }.font(.caption).foregroundStyle(.red)}.buttonStyle(CompactButtonStyle())}if !self.showingAddModel {- Button("+ Add Model") { self.showingAddModel = true; self.newModelName = "" }- .buttonStyle(CompactButtonStyle())+ Button("+ Add Model") { self.showingAddModel = true; self.newModelName = "" }.buttonStyle(CompactButtonStyle())}Button(action: { self.openReasoningConfig() }) {@@ -1202,12 +1159,7 @@ struct AISettingsView: View {SettingsStore.shared.availableModelsByProvider = self.availableModelsByProviderif let providerIndex = savedProviders.firstIndex(where: { $0.id == selectedProviderID }) {- let updatedProvider = SettingsStore.SavedProvider(- id: self.savedProviders[providerIndex].id,- name: self.savedProviders[providerIndex].name,- baseURL: self.savedProviders[providerIndex].baseURL,- models: list- )+ let updatedProvider = SettingsStore.SavedProvider(id: self.savedProviders[providerIndex].id, name: self.savedProviders[providerIndex].name, baseURL: self.savedProviders[providerIndex].baseURL, models: list)self.savedProviders[providerIndex] = updatedProviderself.saveSavedProviders()}@@ -1226,9 +1178,7 @@ struct AISettingsView: View {self.editingReasoningEnabled = config.isEnabled} else {let modelLower = self.selectedModel.lowercased()- if modelLower.hasPrefix("gpt-5") || modelLower.hasPrefix("o1") || modelLower.hasPrefix("o3") || modelLower- .contains("gpt-oss")- {+ if modelLower.hasPrefix("gpt-5") || modelLower.hasPrefix("o1") || modelLower.hasPrefix("o3") || modelLower.contains("gpt-oss") {self.editingReasoningParamName = "reasoning_effort"; self.editingReasoningParamValue = "low"; self.editingReasoningEnabled = true} else if modelLower.contains("deepseek"), modelLower.contains("reasoner") {self.editingReasoningParamName = "enable_thinking"; self.editingReasoningParamValue = "true"; self.editingReasoningEnabled = true@@ -1243,10 +1193,7 @@ struct AISettingsView: View {HStack(spacing: 8) {TextField("Enter model name", text: self.$newModelName).textFieldStyle(.roundedBorder)- .onSubmit {- if !self.newModelName.trimmingCharacters(in: .whitespacesAndNewlines)- .isEmpty { self.addNewModel() }- }+ .onSubmit { if !self.newModelName.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { self.addNewModel() } }Button("Add") { self.addNewModel() }.buttonStyle(CompactButtonStyle()).disabled(self.newModelName.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)Button("Cancel") { self.showingAddModel = false; self.newModelName = "" }.buttonStyle(CompactButtonStyle())@@ -1262,8 +1209,7 @@ struct AISettingsView: View {Spacer()}- Toggle("Enable reasoning parameter", isOn: self.$editingReasoningEnabled).toggleStyle(.switch)- .font(.caption)+ Toggle("Enable reasoning parameter", isOn: self.$editingReasoningEnabled).toggleStyle(.switch).font(.caption)if self.editingReasoningEnabled {HStack(spacing: 12) {@@ -1272,18 +1218,18 @@ struct AISettingsView: View {Picker("", selection: Binding(get: {// Map current value to picker options- if editingReasoningParamName == "reasoning_effort" { return "reasoning_effort" }- else if editingReasoningParamName == "enable_thinking" { return "enable_thinking" }+ if self.editingReasoningParamName == "reasoning_effort" { return "reasoning_effort" }+ else if self.editingReasoningParamName == "enable_thinking" { return "enable_thinking" }else { return "custom" }},set: { newValue inif newValue == "custom" {// Keep the current value for custom editing- if editingReasoningParamName == "reasoning_effort" || editingReasoningParamName == "enable_thinking" {- editingReasoningParamName = ""+ if self.editingReasoningParamName == "reasoning_effort" || self.editingReasoningParamName == "enable_thinking" {+ self.editingReasoningParamName = ""}} else {- editingReasoningParamName = newValue+ self.editingReasoningParamName = newValue}})) {@@ -1293,32 +1239,32 @@ struct AISettingsView: View {}.pickerStyle(.menu).labelsHidden().frame(width: 150)}-+// Show TextField for custom parameter name- if editingReasoningParamName != "reasoning_effort" && editingReasoningParamName != "enable_thinking" {+ if self.editingReasoningParamName != "reasoning_effort" && self.editingReasoningParamName != "enable_thinking" {VStack(alignment: .leading, spacing: 4) {Text("Custom Name").font(.caption2).foregroundStyle(.secondary)- TextField("e.g., thinking_budget", text: $editingReasoningParamName)+ TextField("e.g., thinking_budget", text: self.$editingReasoningParamName).textFieldStyle(.roundedBorder).frame(width: 150)}}-+VStack(alignment: .leading, spacing: 4) {Text("Value").font(.caption2).foregroundStyle(.secondary)- if editingReasoningParamName == "reasoning_effort" {- Picker("", selection: $editingReasoningParamValue) {+ if self.editingReasoningParamName == "reasoning_effort" {+ Picker("", selection: self.$editingReasoningParamValue) {Text("none").tag("none"); Text("minimal").tag("minimal"); Text("low").tag("low"); Text("medium").tag("medium"); Text("high").tag("high")}.pickerStyle(.menu).labelsHidden().frame(width: 100)- } else if editingReasoningParamName == "enable_thinking" {- Picker("", selection: $editingReasoningParamValue) {+ } else if self.editingReasoningParamName == "enable_thinking" {+ Picker("", selection: self.$editingReasoningParamValue) {Text("true").tag("true"); Text("false").tag("false")}.pickerStyle(.menu).labelsHidden().frame(width: 100)} else {// Free-form value for custom parameters- TextField("value", text: $editingReasoningParamValue)+ TextField("value", text: self.$editingReasoningParamValue).textFieldStyle(.roundedBorder).frame(width: 100)}@@ -1332,11 +1278,7 @@ struct AISettingsView: View {}}.padding(12)- .background(RoundedRectangle(cornerRadius: 8).fill(self.theme.palette.accent.opacity(0.08))- .overlay(RoundedRectangle(cornerRadius: 8).stroke(- self.theme.palette.accent.opacity(0.2),- lineWidth: 1- )))+ .background(RoundedRectangle(cornerRadius: 8).fill(self.theme.palette.accent.opacity(0.08)).overlay(RoundedRectangle(cornerRadius: 8).stroke(self.theme.palette.accent.opacity(0.2), lineWidth: 1))).padding(.leading, 122).transition(.opacity)}@@ -1344,11 +1286,7 @@ struct AISettingsView: View {private func saveReasoningConfig() {let pKey = self.providerKey(for: self.selectedProviderID)if self.editingReasoningEnabled {- let config = SettingsStore.ModelReasoningConfig(- parameterName: self.editingReasoningParamName,- parameterValue: self.editingReasoningParamValue,- isEnabled: true- )+ let config = SettingsStore.ModelReasoningConfig(parameterName: self.editingReasoningParamName, parameterValue: self.editingReasoningParamValue, isEnabled: true)SettingsStore.shared.setReasoningConfig(config, forModel: self.selectedModel, provider: pKey)} else {let config = SettingsStore.ModelReasoningConfig(parameterName: "", parameterValue: "", isEnabled: false)@@ -1361,15 +1299,10 @@ struct AISettingsView: View {VStack(alignment: .leading, spacing: 8) {HStack(spacing: 12) {Button(action: { Task { await self.testAPIConnection() } }) {- Text(self.isTestingConnection ? "Verifying..." : "Verify Connection").font(.caption)- .fontWeight(.semibold)+ Text(self.isTestingConnection ? "Verifying..." : "Verify Connection").font(.caption).fontWeight(.semibold)}.buttonStyle(GlassButtonStyle())- .disabled(self- .isTestingConnection ||- (!self- .isLocalEndpoint(self.openAIBaseURL.trimmingCharacters(in: .whitespacesAndNewlines)) &&- (self.providerAPIKeys[self.currentProvider] ?? "").isEmpty))+ .disabled(self.isTestingConnection || (!self.isLocalEndpoint(self.openAIBaseURL.trimmingCharacters(in: .whitespacesAndNewlines)) && (self.providerAPIKeys[self.currentProvider] ?? "").isEmpty))}// Connection Status Display@@ -1384,8 +1317,7 @@ struct AISettingsView: View {VStack(alignment: .leading, spacing: 2) {Text("Connection failed").font(.caption).foregroundStyle(.red)if !self.connectionErrorMessage.isEmpty {- Text(self.connectionErrorMessage).font(.caption2).foregroundStyle(.red.opacity(0.8))- .lineLimit(1)+ Text(self.connectionErrorMessage).font(.caption2).foregroundStyle(.red.opacity(0.8)).lineLimit(1)}}}@@ -1415,15 +1347,11 @@ struct AISettingsView: View {let trimmedKey = self.newProviderApiKey.trimmingCharacters(in: .whitespacesAndNewlines)self.providerAPIKeys[self.currentProvider] = trimmedKeyself.saveProviderAPIKeys()- if self- .connectionStatus !=- .unknown { self.connectionStatus = .unknown; self.connectionErrorMessage = "" }+ if self.connectionStatus != .unknown { self.connectionStatus = .unknown; self.connectionErrorMessage = "" }self.showAPIKeyEditor = false}.buttonStyle(.borderedProminent)- .disabled(!self- .isLocalEndpoint(self.openAIBaseURL.trimmingCharacters(in: .whitespacesAndNewlines)) && self- .newProviderApiKey.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)+ .disabled(!self.isLocalEndpoint(self.openAIBaseURL.trimmingCharacters(in: .whitespacesAndNewlines)) && self.newProviderApiKey.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)}}.padding()@@ -1437,13 +1365,14 @@ struct AISettingsView: View {TextField("Base URL", text: self.$newProviderBaseURL).textFieldStyle(.roundedBorder).frame(width: 250)}HStack(spacing: 8) {- SecureField("API Key (optional for local)", text: self.$newProviderApiKey)- .textFieldStyle(.roundedBorder).frame(width: 200)- TextField("Models (comma-separated)", text: self.$newProviderModels).textFieldStyle(.roundedBorder)- .frame(width: 250)+ SecureField("API Key (optional for local)", text: self.$newProviderApiKey).textFieldStyle(.roundedBorder).frame(width: 200)+ TextField("Models (comma-separated)", text: self.$newProviderModels).textFieldStyle(.roundedBorder).frame(width: 250)}HStack(spacing: 8) {Button("Save Provider") { self.saveNewProvider() }+ .buttonStyle(GlassButtonStyle())+ .disabled(self.newProviderName.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty || self.newProviderBaseURL.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)+ Button("Cancel") { self.showingSaveProvider = false; self.newProviderName = ""; self.newProviderBaseURL = ""; self.newProviderApiKey = ""; self.newProviderModels = "" }.buttonStyle(GlassButtonStyle()).disabled(self.newProviderName.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty || self.newProviderBaseURL.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)@@ -1463,8 +1392,7 @@ struct AISettingsView: View {let api = self.newProviderApiKey.trimmingCharacters(in: .whitespacesAndNewlines)guard !name.isEmpty, !base.isEmpty else { return }- let modelsList = self.newProviderModels.split(separator: ",")- .map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }.filter { !$0.isEmpty }+ let modelsList = self.newProviderModels.split(separator: ",").map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }.filter { !$0.isEmpty }let models = modelsList.isEmpty ? self.defaultModels(for: "openai") : modelsListlet newProvider = SettingsStore.SavedProvider(name: name, baseURL: base, models: models)@@ -1498,8 +1426,7 @@ struct AISettingsView: View {Image(systemName: "key.fill").font(.title3).foregroundStyle(.purple)Text("Get API Keys").font(.headline).fontWeight(.semibold).foregroundStyle(.primary)Spacer()- Image(systemName: self.showAPIKeysGuide ? "chevron.up" : "chevron.down").font(.caption)- .foregroundStyle(.secondary)+ Image(systemName: self.showAPIKeysGuide ? "chevron.up" : "chevron.down").font(.caption).foregroundStyle(.secondary)}.contentShape(Rectangle())}@@ -1507,30 +1434,14 @@ struct AISettingsView: View {if self.showAPIKeysGuide {VStack(alignment: .leading, spacing: 12) {- ProviderGuide(- name: "OpenAI",- url: "https://platform.openai.com/api-keys",- baseURL: "https://api.openai.com/v1",- keyPrefix: "sk-"- )- ProviderGuide(- name: "Groq",- url: "https://console.groq.com/keys",- baseURL: "https://api.groq.com/openai/v1",- keyPrefix: "gsk_"- )- ProviderGuide(- name: "OpenRouter",- url: "https://openrouter.ai/keys",- baseURL: "https://openrouter.ai/api/v1",- keyPrefix: "sk-or-"- )+ ProviderGuide(name: "OpenAI", url: "https://platform.openai.com/api-keys", baseURL: "https://api.openai.com/v1", keyPrefix: "sk-")+ ProviderGuide(name: "Groq", url: "https://console.groq.com/keys", baseURL: "https://api.groq.com/openai/v1", keyPrefix: "gsk_")+ ProviderGuide(name: "OpenRouter", url: "https://openrouter.ai/keys", baseURL: "https://openrouter.ai/api/v1", keyPrefix: "sk-or-")Divider()HStack(spacing: 8) {- Image(systemName: "info.circle.fill").font(.caption)- .foregroundStyle(self.theme.palette.accent)+ Image(systemName: "info.circle.fill").font(.caption).foregroundStyle(self.theme.palette.accent)VStack(alignment: .leading, spacing: 4) {Text("Any OpenAI compatible API endpoint is supported").font(.caption).fontWeight(.semibold)diff --git a/Sources/Fluid/UI/FeedbackView.swift b/Sources/Fluid/UI/FeedbackView.swiftindex 25be4a0e..f4e4424f 100644--- a/Sources/Fluid/UI/FeedbackView.swift+++ b/Sources/Fluid/UI/FeedbackView.swift@@ -82,7 +82,7 @@ struct FeedbackView: View {}Spacer()-+if let githubURL = URL(string: "https://github.com/altic-dev/Fluid-oss") {Link(destination: githubURL) {HStack(spacing: 8) {@@ -137,11 +137,13 @@ struct FeedbackView: View {.overlay(RoundedRectangle(cornerRadius: 8).strokeBorder(Color(nsColor: NSColor.separatorColor), lineWidth: 1.5))).scrollContentBackground(.hidden)- .overlay(VStack {- if self.feedbackText.isEmpty {- Text("Share your thoughts, report bugs, or suggest features...")- .font(.subheadline)- .foregroundStyle(.secondary)+ .overlay(+ VStack {+ if self.feedbackText.isEmpty {+ Text("Share your thoughts, report bugs, or suggest features...")+ .font(.subheadline)+ .foregroundStyle(.secondary)+ }}}.allowsHitTesting(false))diff --git a/Sources/Fluid/UI/GlossyEffects.swift b/Sources/Fluid/UI/GlossyEffects.swiftindex 6977141e..c620becb 100644--- a/Sources/Fluid/UI/GlossyEffects.swift+++ b/Sources/Fluid/UI/GlossyEffects.swift@@ -23,14 +23,15 @@ struct HoverableGlossyCard<Content: View>: View {.background {shape.fill(self.theme.palette.cardBackground)- .overlay(shape- .stroke(- self.theme.palette.cardBorder.opacity(self.isHovered ? 0.5 : 0.25),- lineWidth: self.isHovered ? 1.2 : 1- ))+ .overlay(+ shape+ .stroke(+ self.theme.palette.cardBorder.opacity(self.isHovered ? 0.5 : 0.25),+ lineWidth: self.isHovered ? 1.2 : 1+ )+ ).shadow(- color: cardShadow.color- .opacity(self.isHovered ? min(cardShadow.opacity + 0.1, 1.0) : cardShadow.opacity),+ color: cardShadow.color.opacity(self.isHovered ? min(cardShadow.opacity + 0.1, 1.0) : cardShadow.opacity),radius: self.isHovered ? cardShadow.radius + 2 : cardShadow.radius,x: cardShadow.x,y: self.isHovered ? cardShadow.y + 1 : cardShadow.ydiff --git a/Sources/Fluid/UI/MeetingTranscriptionView.swift b/Sources/Fluid/UI/MeetingTranscriptionView.swiftindex 3779b06b..042bd71c 100644--- a/Sources/Fluid/UI/MeetingTranscriptionView.swift+++ b/Sources/Fluid/UI/MeetingTranscriptionView.swift@@ -168,13 +168,14 @@ struct MeetingTranscriptionView: View {}.fileImporter(isPresented: self.$showingFilePicker,- allowedContentTypes: {- var types: [UTType] = [.audio, .movie, .mpeg4Movie]- ["wav", "mp3", "m4a"]- .compactMap { UTType(filenameExtension: $0) }- .forEach { types.append($0) }- return types- }(),+ allowedContentTypes: [+ .audio,+ .movie,+ .mpeg4Movie,+ UTType(filenameExtension: "wav")!,+ UTType(filenameExtension: "mp3")!,+ UTType(filenameExtension: "m4a")!,+ ],allowsMultipleSelection: false) { result inswitch result {diff --git a/Sources/Fluid/UI/MouseTracker.swift b/Sources/Fluid/UI/MouseTracker.swiftindex 8c283651..cbda3f92 100644--- a/Sources/Fluid/UI/MouseTracker.swift+++ b/Sources/Fluid/UI/MouseTracker.swift@@ -68,19 +68,21 @@ struct MouseTrackingModifier: ViewModifier {break}}- .background(GeometryReader { geometry in- Color.clear- .onAppear {- let globalFrame = geometry.frame(in: .global)- self.tracker.updateWindowFrame(globalFrame)- }- .onChange(of: geometry.frame(in: .global)) { _, newFrame in- // Skip updates when view is scrolled off-screen (prevents invalid geometry)- guard newFrame.minY < NSScreen.main?.frame.height ?? 1000 else { return }- guard newFrame.maxY > 0 else { return }- self.tracker.updateWindowFrame(newFrame)- }- })+ .background(+ GeometryReader { geometry in+ Color.clear+ .onAppear {+ let globalFrame = geometry.frame(in: .global)+ self.tracker.updateWindowFrame(globalFrame)+ }+ .onChange(of: geometry.frame(in: .global)) { _, newFrame in+ // Skip updates when view is scrolled off-screen (prevents invalid geometry)+ guard newFrame.minY < NSScreen.main?.frame.height ?? 1000 else { return }+ guard newFrame.maxY > 0 else { return }+ self.tracker.updateWindowFrame(newFrame)+ }+ }+ )}}diff --git a/Sources/Fluid/UI/RecordingView.swift b/Sources/Fluid/UI/RecordingView.swiftindex 48bdb9dc..0fb13330 100644--- a/Sources/Fluid/UI/RecordingView.swift+++ b/Sources/Fluid/UI/RecordingView.swift@@ -1,3 +1,10 @@+//+// RecordingView.swift+// fluid+//+// Recording controls and configuration view+//+import AVFoundationimport SwiftUI@@ -41,11 +48,9 @@ struct RecordingView: View {.fill(self.asr.isRunning ? .red : self.asr.isAsrReady ? .green : .secondary).frame(width: 8, height: 8)- Text(self.asr.isRunning ? "Recording..." : self.asr- .isAsrReady ? "Ready to record" : "Model not ready")+ Text(self.asr.isRunning ? "Recording..." : self.asr.isAsrReady ? "Ready to record" : "Model not ready").font(.subheadline)- .foregroundStyle(self.asr.isRunning ? .red : self.asr- .isAsrReady ? .green : .secondary)+ .foregroundStyle(self.asr.isRunning ? .red : self.asr.isAsrReady ? .green : .secondary)}// Recording Control (Single Toggle Button)diff --git a/Sources/Fluid/UI/SettingsView.swift b/Sources/Fluid/UI/SettingsView.swiftindex 1ff5f30e..9837e5fb 100644--- a/Sources/Fluid/UI/SettingsView.swift+++ b/Sources/Fluid/UI/SettingsView.swift@@ -1,3 +1,10 @@+//+// SettingsView.swift+// fluid+//+// App preferences and audio device settings+//+import AVFoundationimport PromiseKitimport SwiftUI@@ -165,8 +172,7 @@ struct SettingsView: View {VStack(alignment: .leading, spacing: 12) {HStack(spacing: 10) {Circle()- .fill(self.asr.micStatus == .authorized ? self.theme.palette.success : self.theme- .palette.warning)+ .fill(self.asr.micStatus == .authorized ? self.theme.palette.success : self.theme.palette.warning).frame(width: 8, height: 8)VStack(alignment: .leading, spacing: 2) {@@ -174,8 +180,7 @@ struct SettingsView: View {self.asr.micStatus == .denied ? "Microphone access denied" :"Microphone access not determined").font(.body)- .foregroundStyle(self.asr.micStatus == .authorized ? .primary : self.theme- .palette.warning)+ .foregroundStyle(self.asr.micStatus == .authorized ? .primary : self.theme.palette.warning)if self.asr.micStatus != .authorized {Text("Microphone access is required for voice recording")@@ -209,15 +214,8 @@ struct SettingsView: View {self.instructionsBox(title: "How to enable microphone access:",steps: self.asr.micStatus == .notDetermined- ? [- "Click **Grant Access** above",- "Choose **Allow** in the system dialog",- ]- : [- "Click **Open Settings** above",- "Find **FluidVoice** in the microphone list",- "Toggle **FluidVoice ON** to allow access",- ]+ ? ["Click **Grant Access** above", "Choose **Allow** in the system dialog"]+ : ["Click **Open Settings** above", "Find **FluidVoice** in the microphone list", "Toggle **FluidVoice ON** to allow access"])}}@@ -236,9 +234,7 @@ struct SettingsView: View {VStack(alignment: .leading, spacing: 12) {// Status indicatorHStack(spacing: 8) {- if self.isRecordingShortcut || self.isRecordingCommandModeShortcut || self- .isRecordingRewriteShortcut- {+ if self.isRecordingShortcut || self.isRecordingCommandModeShortcut || self.isRecordingRewriteShortcut {Image(systemName: "hand.point.up.left.fill").foregroundStyle(.orange)Text("Press your new hotkey combination now...")@@ -266,10 +262,14 @@ struct SettingsView: View {}.padding(10).frame(maxWidth: .infinity, alignment: .leading)- .background(RoundedRectangle(cornerRadius: 8, style: .continuous)- .fill(.ultraThinMaterial.opacity(0.5))- .overlay(RoundedRectangle(cornerRadius: 8, style: .continuous)- .stroke(.white.opacity(0.1), lineWidth: 1)))+ .background(+ RoundedRectangle(cornerRadius: 8, style: .continuous)+ .fill(.ultraThinMaterial.opacity(0.5))+ .overlay(+ RoundedRectangle(cornerRadius: 8, style: .continuous)+ .stroke(.white.opacity(0.1), lineWidth: 1)+ )+ )// MARK: - Shortcuts Section@@ -286,11 +286,7 @@ struct SettingsView: View {shortcut: self.hotkeyShortcut,isRecording: self.isRecordingShortcut,onChangePressed: {- DebugLogger.shared- .debug(- "Starting to record new transcribe shortcut",- source: "SettingsView"- )+ DebugLogger.shared.debug("Starting to record new transcribe shortcut", source: "SettingsView")self.isRecordingShortcut = true})@@ -306,11 +302,7 @@ struct SettingsView: View {isRecording: self.isRecordingCommandModeShortcut,isEnabled: self.$commandModeShortcutEnabled,onChangePressed: {- DebugLogger.shared- .debug(- "Starting to record new command mode shortcut",- source: "SettingsView"- )+ DebugLogger.shared.debug("Starting to record new command mode shortcut", source: "SettingsView")self.isRecordingCommandModeShortcut = true})@@ -326,20 +318,20 @@ struct SettingsView: View {isRecording: self.isRecordingRewriteShortcut,isEnabled: self.$rewriteShortcutEnabled,onChangePressed: {- DebugLogger.shared- .debug(- "Starting to record new write mode shortcut",- source: "SettingsView"- )+ DebugLogger.shared.debug("Starting to record new write mode shortcut", source: "SettingsView")self.isRecordingRewriteShortcut = true})}.padding(12)- .background(RoundedRectangle(cornerRadius: 8, style: .continuous)- .fill(.ultraThinMaterial.opacity(0.5))- .overlay(RoundedRectangle(cornerRadius: 8, style: .continuous)- .stroke(.white.opacity(0.08), lineWidth: 1)))+ .background(+ RoundedRectangle(cornerRadius: 8, style: .continuous)+ .fill(.ultraThinMaterial.opacity(0.5))+ .overlay(+ RoundedRectangle(cornerRadius: 8, style: .continuous)+ .stroke(.white.opacity(0.08), lineWidth: 1)+ )+ )// MARK: - Options Section@@ -707,8 +699,10 @@ struct SettingsView: View {}}.padding(12)- .background(RoundedRectangle(cornerRadius: 8, style: .continuous)- .fill((warningStyle ? self.theme.palette.warning : self.theme.palette.accent).opacity(0.12)))+ .background(+ RoundedRectangle(cornerRadius: 8, style: .continuous)+ .fill((warningStyle ? self.theme.palette.warning : self.theme.palette.accent).opacity(0.12))+ )}@ViewBuilderdiff --git a/Sources/Fluid/UI/StatsView.swift b/Sources/Fluid/UI/StatsView.swiftindex d1467cf7..fd825123 100644--- a/Sources/Fluid/UI/StatsView.swift+++ b/Sources/Fluid/UI/StatsView.swift@@ -320,8 +320,10 @@ struct StatsView: View {}.padding(.horizontal, 6).padding(.vertical, 3)- .background(RoundedRectangle(cornerRadius: 4)- .fill(milestone.achieved ? self.theme.palette.success.opacity(0.1) : Color.clear))+ .background(+ RoundedRectangle(cornerRadius: 4)+ .fill(milestone.achieved ? self.theme.palette.success.opacity(0.1) : Color.clear)+ )}Spacer()@@ -449,8 +451,10 @@ struct StatsView: View {}.frame(maxWidth: .infinity, alignment: .leading).padding(10)- .background(RoundedRectangle(cornerRadius: 8)- .fill(self.theme.palette.accent.opacity(0.08)))+ .background(+ RoundedRectangle(cornerRadius: 8)+ .fill(self.theme.palette.accent.opacity(0.08))+ )}// MARK: - Reset Sectiondiff --git a/Sources/Fluid/UI/TranscriptionHistoryView.swift b/Sources/Fluid/UI/TranscriptionHistoryView.swiftindex acb88ca4..ee8c24ef 100644--- a/Sources/Fluid/UI/TranscriptionHistoryView.swift+++ b/Sources/Fluid/UI/TranscriptionHistoryView.swift@@ -137,8 +137,10 @@ struct TranscriptionHistoryView: View {.foregroundStyle(isSelected ? .white.opacity(0.8) : self.theme.palette.accent).padding(.horizontal, 4).padding(.vertical, 1)- .background(RoundedRectangle(cornerRadius: 3)- .fill(isSelected ? .white.opacity(0.2) : self.theme.palette.accent.opacity(0.15)))+ .background(+ RoundedRectangle(cornerRadius: 3)+ .fill(isSelected ? .white.opacity(0.2) : self.theme.palette.accent.opacity(0.15))+ )}Spacer()@@ -158,8 +160,10 @@ struct TranscriptionHistoryView: View {.padding(.horizontal, 10).padding(.vertical, 8).frame(maxWidth: .infinity, alignment: .leading)- .background(RoundedRectangle(cornerRadius: 8)- .fill(isSelected ? self.theme.palette.accent : Color.clear))+ .background(+ RoundedRectangle(cornerRadius: 8)+ .fill(isSelected ? self.theme.palette.accent : Color.clear)+ ).contentShape(Rectangle())}.buttonStyle(.plain)@@ -358,8 +362,10 @@ struct TranscriptionHistoryView: View {.foregroundStyle(self.theme.palette.accent).padding(.horizontal, 6).padding(.vertical, 2)- .background(RoundedRectangle(cornerRadius: 4)- .fill(self.theme.palette.accent.opacity(0.15)))+ .background(+ RoundedRectangle(cornerRadius: 4)+ .fill(self.theme.palette.accent.opacity(0.15))+ )}}@@ -388,16 +394,8 @@ struct TranscriptionHistoryView: View {GridItem(.flexible(), spacing: 16),GridItem(.flexible(), spacing: 16),], spacing: 12) {- self.metadataItem(- icon: "app.fill",- label: "Application",- value: entry.appName.isEmpty ? "Unknown" : entry.appName- )- self.metadataItem(- icon: "macwindow",- label: "Window",- value: entry.windowTitle.isEmpty ? "Unknown" : entry.windowTitle- )+ self.metadataItem(icon: "app.fill", label: "Application", value: entry.appName.isEmpty ? "Unknown" : entry.appName)+ self.metadataItem(icon: "macwindow", label: "Window", value: entry.windowTitle.isEmpty ? "Unknown" : entry.windowTitle)self.metadataItem(icon: "character.cursor.ibeam", label: "Characters", value: "\(entry.characterCount)")self.metadataItem(icon: "sparkles", label: "AI Processed", value: entry.wasAIProcessed ? "Yes" : "No")}diff --git a/Sources/Fluid/UI/WelcomeView.swift b/Sources/Fluid/UI/WelcomeView.swiftindex 5f2ee92b..9cccbee5 100644--- a/Sources/Fluid/UI/WelcomeView.swift+++ b/Sources/Fluid/UI/WelcomeView.swift@@ -1,3 +1,10 @@+//+// WelcomeView.swift+// fluid+//+// Welcome and setup guide view+//+import AppKitimport AVFoundationimport SwiftUI@@ -55,16 +62,13 @@ struct WelcomeView: View {SetupStepView(step: 1,// Consider model step complete if ready OR downloaded (even if not loaded)- title: (self.asr.isAsrReady || self.asr.modelsExistOnDisk) ?- "Voice Model Ready" :- "Download Voice Model",+ title: (self.asr.isAsrReady || self.asr.modelsExistOnDisk) ? "Voice Model Ready" : "Download Voice Model",description: self.asr.isAsrReady? "Speech recognition model is loaded and ready": (self.asr.modelsExistOnDisk? "Model downloaded, will load when needed": "Download the AI model for offline voice transcription (~500MB)"),- status: (self.asr.isAsrReady || self.asr.modelsExistOnDisk) ? .completed :- .pending,+ status: (self.asr.isAsrReady || self.asr.modelsExistOnDisk) ? .completed : .pending,action: {self.selectedSidebarItem = .aiSettings},@@ -74,9 +78,7 @@ struct WelcomeView: View {SetupStepView(step: 2,- title: self.asr- .micStatus == .authorized ? "Microphone Permission Granted" :- "Grant Microphone Permission",+ title: self.asr.micStatus == .authorized ? "Microphone Permission Granted" : "Grant Microphone Permission",description: self.asr.micStatus == .authorized? "FluidVoice has access to your microphone": "Allow FluidVoice to access your microphone for voice input",@@ -88,15 +90,13 @@ struct WelcomeView: View {self.asr.openSystemSettingsForMic()}},- actionButtonTitle: self.asr- .micStatus == .notDetermined ? "Grant Access" : "Open Settings",+ actionButtonTitle: self.asr.micStatus == .notDetermined ? "Grant Access" : "Open Settings",showActionButton: self.asr.micStatus != .authorized)SetupStepView(step: 3,- title: self- .accessibilityEnabled ? "Accessibility Enabled" : "Enable Accessibility",+ title: self.accessibilityEnabled ? "Accessibility Enabled" : "Enable Accessibility",description: self.accessibilityEnabled? "Accessibility permission granted for typing into apps": "Grant accessibility permission to type text into other apps",@@ -111,21 +111,15 @@ struct WelcomeView: View {SetupStepView(step: 4,title: {- let hasApiKey = self.providerAPIKeys[self.currentProvider]?- .isEmpty == false- let isLocal = self- .isLocalEndpoint(self.openAIBaseURL- .trimmingCharacters(in: .whitespacesAndNewlines))+ let hasApiKey = self.providerAPIKeys[self.currentProvider]?.isEmpty == false+ let isLocal = self.isLocalEndpoint(self.openAIBaseURL.trimmingCharacters(in: .whitespacesAndNewlines))let hasModel = self.availableModels.contains(self.selectedModel)let isConfigured = (isLocal || hasApiKey) && hasModelreturn isConfigured ? "AI Enhancement Configured" : "Set Up AI Enhancement (Optional)"}(),description: {- let hasApiKey = self.providerAPIKeys[self.currentProvider]?- .isEmpty == false- let isLocal = self- .isLocalEndpoint(self.openAIBaseURL- .trimmingCharacters(in: .whitespacesAndNewlines))+ let hasApiKey = self.providerAPIKeys[self.currentProvider]?.isEmpty == false+ let isLocal = self.isLocalEndpoint(self.openAIBaseURL.trimmingCharacters(in: .whitespacesAndNewlines))let hasModel = self.availableModels.contains(self.selectedModel)let isConfigured = (isLocal || hasApiKey) && hasModelreturn isConfigured@@ -133,11 +127,8 @@ struct WelcomeView: View {: "Configure API keys for AI-powered text enhancement"}(),status: {- let hasApiKey = self.providerAPIKeys[self.currentProvider]?- .isEmpty == false- let isLocal = self- .isLocalEndpoint(self.openAIBaseURL- .trimmingCharacters(in: .whitespacesAndNewlines))+ let hasApiKey = self.providerAPIKeys[self.currentProvider]?.isEmpty == false+ let isLocal = self.isLocalEndpoint(self.openAIBaseURL.trimmingCharacters(in: .whitespacesAndNewlines))let hasModel = self.availableModels.contains(self.selectedModel)return ((isLocal || hasApiKey) && hasModel) ? .completed : .pending}(),@@ -177,21 +168,9 @@ struct WelcomeView: View {.foregroundStyle(.green)VStack(alignment: .leading, spacing: 10) {- self.howToStep(- number: 1,- title: "Start Recording",- description: "Press your hotkey (default: Right Option/Alt) or click the button"- )- self.howToStep(- number: 2,- title: "Speak Clearly",- description: "Speak naturally - works best in quiet environments"- )- self.howToStep(- number: 3,- title: "Auto-Type Result",- description: "Transcription is automatically typed into your focused app"- )+ self.howToStep(number: 1, title: "Start Recording", description: "Press your hotkey (default: Right Option/Alt) or click the button")+ self.howToStep(number: 2, title: "Speak Clearly", description: "Speak naturally - works best in quiet environments")+ self.howToStep(number: 3, title: "Auto-Type Result", description: "Transcription is automatically typed into your focused app")}}.frame(maxWidth: .infinity, alignment: .leading)@@ -242,10 +221,7 @@ struct WelcomeView: View {.font(.subheadline.weight(.medium)).foregroundStyle(.orange)self.commandModeExample(icon: "folder", text: "\"List files in my Downloads folder\"")- self.commandModeExample(- icon: "plus.rectangle.on.folder",- text: "\"Create a folder called Projects on Desktop\""- )+ self.commandModeExample(icon: "plus.rectangle.on.folder", text: "\"Create a folder called Projects on Desktop\"")self.commandModeExample(icon: "network", text: "\"What's my IP address?\"")self.commandModeExample(icon: "safari", text: "\"Open Safari\"")}@@ -418,39 +394,45 @@ struct WelcomeView: View {.focused(self.isTranscriptionFocused).frame(height: 140).padding(10)- .background(RoundedRectangle(cornerRadius: 8, style: .continuous)- .fill(self.asr.isRunning ? self.theme.palette.accent- .opacity(0.06) : Color(nsColor: NSColor.textBackgroundColor))- .overlay(RoundedRectangle(cornerRadius: 8, style: .continuous)- .strokeBorder(- self.asr.isRunning ? self.theme.palette.accent- .opacity(0.4) : Color(nsColor: NSColor.separatorColor),- lineWidth: self.asr.isRunning ? 2 : 1- )))+ .background(+ RoundedRectangle(cornerRadius: 8, style: .continuous)+ .fill(+ self.asr.isRunning ? self.theme.palette.accent.opacity(0.06) : Color(nsColor: NSColor.textBackgroundColor)+ )+ .overlay(+ RoundedRectangle(cornerRadius: 8, style: .continuous)+ .strokeBorder(+ self.asr.isRunning ? self.theme.palette.accent.opacity(0.4) : Color(nsColor: NSColor.separatorColor),+ lineWidth: self.asr.isRunning ? 2 : 1+ )+ )+ ).scrollContentBackground(.hidden)- .overlay(VStack(spacing: 8) {- if self.asr.isRunning {- Image(systemName: "waveform")- .font(.title2)- .foregroundStyle(self.theme.palette.accent)- Text("Listening... Speak now!")- .font(.subheadline.weight(.medium))- .foregroundStyle(self.theme.palette.accent)- Text("Transcription will appear when you stop recording")- .font(.caption)- .foregroundStyle(self.theme.palette.accent.opacity(0.7))- } else if self.asr.finalText.isEmpty {- Image(systemName: "text.bubble")- .font(.title2)- .foregroundStyle(.secondary.opacity(0.5))- Text("Ready to test!")- .font(.subheadline.weight(.medium))- Text("Click 'Start Recording' or press your hotkey")- .font(.caption)- .foregroundStyle(.secondary)+ .overlay(+ VStack(spacing: 8) {+ if self.asr.isRunning {+ Image(systemName: "waveform")+ .font(.title2)+ .foregroundStyle(self.theme.palette.accent)+ Text("Listening... Speak now!")+ .font(.subheadline.weight(.medium))+ .foregroundStyle(self.theme.palette.accent)+ Text("Transcription will appear when you stop recording")+ .font(.caption)+ .foregroundStyle(self.theme.palette.accent.opacity(0.7))+ } else if self.asr.finalText.isEmpty {+ Image(systemName: "text.bubble")+ .font(.title2)+ .foregroundStyle(.secondary.opacity(0.5))+ Text("Ready to test!")+ .font(.subheadline.weight(.medium))+ Text("Click 'Start Recording' or press your hotkey")+ .font(.caption)+ .foregroundStyle(.secondary)+ }}- }- .allowsHitTesting(false))+ .allowsHitTesting(false)+ )if !self.asr.finalText.isEmpty {HStack(spacing: 8) {diff --git a/Sources/Fluid/Views/CommandModeView.swift b/Sources/Fluid/Views/CommandModeView.swiftindex 2afe4583..aec6cb9d 100644--- a/Sources/Fluid/Views/CommandModeView.swift+++ b/Sources/Fluid/Views/CommandModeView.swift@@ -270,9 +270,9 @@ struct CommandModeView: View {}// MARK: - Chat Area-+@State private var isThinkingExpanded = false-+private var chatArea: some View {ScrollViewReader { proxy inScrollView {@@ -284,14 +284,14 @@ struct CommandModeView: View {if self.service.isProcessing {VStack(alignment: .leading, spacing: 8) {- processingIndicator-+ self.processingIndicator+// Show thinking tokens in collapsible section (real-time)// Only show if setting is enabled AND there are thinking tokens- if settings.showThinkingTokens && !service.streamingThinkingText.isEmpty {- thinkingView+ if self.settings.showThinkingTokens && !self.service.streamingThinkingText.isEmpty {+ self.thinkingView}-+// Show streaming text in real-timeif !self.service.streamingText.isEmpty {self.streamingTextView@@ -310,8 +310,8 @@ struct CommandModeView: View {.onChange(of: self.service.isProcessing) { _, isProcessing in// Scroll when processing starts, not on every streaming updateif isProcessing {- scrollToBottom(proxy)- isThinkingExpanded = false // Collapse thinking for new request+ self.scrollToBottom(proxy)+ self.isThinkingExpanded = false // Collapse thinking for new request}}.onChange(of: self.service.currentStep) { _, _ in@@ -320,19 +320,19 @@ struct CommandModeView: View {// Removed: .onChange(of: service.streamingText) - causes scroll on every token, too expensive}}-+// MARK: - Thinking View (Cursor-style shimmer)-+private var thinkingView: some View {VStack(alignment: .leading, spacing: 0) {// Header with shimmer effect - tap to expand/collapse- Button(action: { withAnimation(.easeInOut(duration: 0.2)) { isThinkingExpanded.toggle() } }) {+ Button(action: { withAnimation(.easeInOut(duration: 0.2)) { self.isThinkingExpanded.toggle() } }) {HStack(spacing: 8) {ThinkingShimmerLabel()-+Spacer()-- Image(systemName: isThinkingExpanded ? "chevron.up" : "chevron.down")++ Image(systemName: self.isThinkingExpanded ? "chevron.up" : "chevron.down").font(.caption2).foregroundStyle(.secondary.opacity(0.6))}@@ -340,11 +340,11 @@ struct CommandModeView: View {.padding(.vertical, 8)}.buttonStyle(.plain)-+// Expanded content- if isThinkingExpanded {+ if self.isThinkingExpanded {ScrollView(.vertical, showsIndicators: true) {- Text(service.streamingThinkingText)+ Text(self.service.streamingThinkingText).font(.system(size: 11)).foregroundStyle(.secondary).textSelection(.enabled)@@ -355,8 +355,8 @@ struct CommandModeView: View {.frame(maxHeight: 200)} else {// Preview - first 150 chars- if service.streamingThinkingText.count > 0 {- Text(String(service.streamingThinkingText.prefix(150)) + (service.streamingThinkingText.count > 150 ? "..." : ""))+ if self.service.streamingThinkingText.count > 0 {+ Text(String(self.service.streamingThinkingText.prefix(150)) + (self.service.streamingThinkingText.count > 150 ? "..." : "")).font(.system(size: 11)).foregroundStyle(.secondary.opacity(0.7)).lineLimit(2)@@ -369,7 +369,7 @@ struct CommandModeView: View {.cornerRadius(8).frame(maxWidth: 520, alignment: .leading)}-+// MARK: - Processing Indicator (Minimal with Shimmer)private var processingIndicator: some View {@@ -467,8 +467,10 @@ struct CommandModeView: View {}.background(Color(nsColor: .textBackgroundColor)).cornerRadius(8)- .overlay(RoundedRectangle(cornerRadius: 8)- .stroke(Color.orange.opacity(0.5), lineWidth: 1))+ .overlay(+ RoundedRectangle(cornerRadius: 8)+ .stroke(Color.orange.opacity(0.5), lineWidth: 1)+ )HStack(spacing: 12) {Button(action: { self.service.cancelPendingCommand() }) {@@ -518,15 +520,10 @@ struct CommandModeView: View {}// Model Selector (compact)- Picker(- "",- selection: Binding(- get: {- self.settings.commandModeSelectedModel ?? self.availableModels.first ?? "gpt-4o"- },- set: { self.settings.commandModeSelectedModel = $0 }- )- ) {+ Picker("", selection: Binding(+ get: { self.settings.commandModeSelectedModel ?? self.availableModels.first ?? "gpt-4o" },+ set: { self.settings.commandModeSelectedModel = $0 }+ )) {ForEach(self.availableModels, id: \.self) { model inText(model).tag(model)}@@ -646,17 +643,19 @@ struct CommandShimmerText: View {var body: some View {Text(self.text).font(.system(size: 11, weight: .medium))- .foregroundStyle(LinearGradient(- colors: [- Color.primary.opacity(0.4),- Color.primary.opacity(0.4),- Color.primary.opacity(0.8),- Color.primary.opacity(0.4),- Color.primary.opacity(0.4),- ],- startPoint: UnitPoint(x: self.shimmerPhase - 0.3, y: 0.5),- endPoint: UnitPoint(x: self.shimmerPhase + 0.3, y: 0.5)- ))+ .foregroundStyle(+ LinearGradient(+ colors: [+ Color.primary.opacity(0.4),+ Color.primary.opacity(0.4),+ Color.primary.opacity(0.8),+ Color.primary.opacity(0.4),+ Color.primary.opacity(0.4),+ ],+ startPoint: UnitPoint(x: self.shimmerPhase - 0.3, y: 0.5),+ endPoint: UnitPoint(x: self.shimmerPhase + 0.3, y: 0.5)+ )+ ).onAppear {withAnimation(.linear(duration: 1.2).repeatForever(autoreverses: false)) {self.shimmerPhase = 1.3@@ -670,18 +669,18 @@ struct CommandShimmerText: View {struct ThinkingShimmerLabel: View {@State private var shimmerPhase: CGFloat = -0.5@State private var sparkleOpacity: [Double] = [0.3, 0.5, 0.7, 0.4, 0.6]-+var body: some View {HStack(spacing: 6) {// Sparkle dots with staggered animationHStack(spacing: 2) {ForEach(0..<3, id: \.self) { index inCircle()- .fill(Color.primary.opacity(sparkleOpacity[index]))+ .fill(Color.primary.opacity(self.sparkleOpacity[index])).frame(width: 4, height: 4)}}-+// Shimmering "Think" textText("Think").font(.system(size: 12, weight: .medium))@@ -689,10 +688,10 @@ struct ThinkingShimmerLabel: View {LinearGradient(stops: [.init(color: Color.primary.opacity(0.35), location: 0),- .init(color: Color.primary.opacity(0.35), location: max(0, shimmerPhase - 0.15)),- .init(color: Color.primary.opacity(0.85), location: shimmerPhase),- .init(color: Color.primary.opacity(0.35), location: min(1, shimmerPhase + 0.15)),- .init(color: Color.primary.opacity(0.35), location: 1)+ .init(color: Color.primary.opacity(0.35), location: max(0, self.shimmerPhase - 0.15)),+ .init(color: Color.primary.opacity(0.85), location: self.shimmerPhase),+ .init(color: Color.primary.opacity(0.35), location: min(1, self.shimmerPhase + 0.15)),+ .init(color: Color.primary.opacity(0.35), location: 1),],startPoint: .leading,endPoint: .trailing@@ -702,34 +701,33 @@ struct ThinkingShimmerLabel: View {.onAppear {// Shimmer animation - smooth left to rightwithAnimation(.linear(duration: 1.5).repeatForever(autoreverses: false)) {- shimmerPhase = 1.5+ self.shimmerPhase = 1.5}-+// Sparkle animation - staggered twinkling- animateSparkles()+ self.animateSparkles()}}-+private func animateSparkles() {// Create twinkling effect with staggered delaysfor i in 0..<3 {let delay = Double(i) * 0.15DispatchQueue.main.asyncAfter(deadline: .now() + delay) {withAnimation(.easeInOut(duration: 0.4).repeatForever(autoreverses: true)) {- sparkleOpacity[i] = sparkleOpacity[i] > 0.5 ? 0.2 : 0.8+ self.sparkleOpacity[i] = self.sparkleOpacity[i] > 0.5 ? 0.2 : 0.8}}}}}-// MARK: - Message Bubble (Minimal Design)struct MessageBubble: View {let message: CommandModeService.Message@State private var isThinkingExpanded: Bool = false-+var body: some View {HStack(alignment: .top) {if self.message.role == .user {@@ -760,9 +758,9 @@ struct MessageBubble: View {VStack(alignment: .leading, spacing: 6) {// Thinking section (collapsible) - only if setting is enabledif let thinking = message.thinking, !thinking.isEmpty, SettingsStore.shared.showThinkingTokens {- thinkingSection(thinking)+ self.thinkingSection(thinking)}-+// Purpose label (minimal, gray)if let tc = message.toolCall, let purpose = tc.purpose {Text(purpose)@@ -781,13 +779,13 @@ struct MessageBubble: View {}.frame(maxWidth: 520, alignment: .leading)}-+// MARK: - Thinking Section (Persisted, Collapsible)-+private func thinkingSection(_ thinking: String) -> some View {VStack(alignment: .leading, spacing: 0) {// Header - tap to expand/collapse- Button(action: { withAnimation(.easeInOut(duration: 0.2)) { isThinkingExpanded.toggle() } }) {+ Button(action: { withAnimation(.easeInOut(duration: 0.2)) { self.isThinkingExpanded.toggle() } }) {HStack(spacing: 6) {HStack(spacing: 2) {ForEach(0..<3, id: \.self) { _ in@@ -799,14 +797,14 @@ struct MessageBubble: View {Text("Think").font(.system(size: 11, weight: .medium)).foregroundStyle(.secondary)-+Spacer()-+Text("\(thinking.count) chars").font(.system(size: 9)).foregroundStyle(.tertiary)-- Image(systemName: isThinkingExpanded ? "chevron.up" : "chevron.down")++ Image(systemName: self.isThinkingExpanded ? "chevron.up" : "chevron.down").font(.system(size: 9)).foregroundStyle(.tertiary)}@@ -814,9 +812,9 @@ struct MessageBubble: View {.padding(.vertical, 6)}.buttonStyle(.plain)-+// Expanded content- if isThinkingExpanded {+ if self.isThinkingExpanded {ScrollView(.vertical, showsIndicators: true) {Text(thinking).font(.system(size: 10))@@ -840,7 +838,7 @@ struct MessageBubble: View {.background(Color(nsColor: .controlBackgroundColor).opacity(0.4)).cornerRadius(6)}-+// MARK: - Command Call View (Minimal)private func commandCallView(_ tc: CommandModeService.Message.ToolCall) -> some View {diff --git a/Sources/Fluid/Views/NotchContentViews.swift b/Sources/Fluid/Views/NotchContentViews.swiftindex a2a350e6..418e55ec 100644--- a/Sources/Fluid/Views/NotchContentViews.swift+++ b/Sources/Fluid/Views/NotchContentViews.swift@@ -1,3 +1,10 @@+//+// NotchContentViews.swift+// Fluid+//+// Created by Assistant+//+import Combineimport SwiftUI@@ -189,17 +196,19 @@ struct ShimmerText: View {var body: some View {Text(self.text).font(.system(size: 9, weight: .medium))- .foregroundStyle(LinearGradient(- colors: [- self.color.opacity(0.4),- self.color.opacity(0.4),- self.color.opacity(1.0),- self.color.opacity(0.4),- self.color.opacity(0.4),- ],- startPoint: UnitPoint(x: self.shimmerPhase - 0.3, y: 0.5),- endPoint: UnitPoint(x: self.shimmerPhase + 0.3, y: 0.5)- ))+ .foregroundStyle(+ LinearGradient(+ colors: [+ self.color.opacity(0.4),+ self.color.opacity(0.4),+ self.color.opacity(1.0),+ self.color.opacity(0.4),+ self.color.opacity(0.4),+ ],+ startPoint: UnitPoint(x: self.shimmerPhase - 0.3, y: 0.5),+ endPoint: UnitPoint(x: self.shimmerPhase + 0.3, y: 0.5)+ )+ ).onAppear {withAnimation(.linear(duration: 1.2).repeatForever(autoreverses: false)) {self.shimmerPhase = 1.3@@ -337,18 +346,8 @@ struct NotchWaveformView: View {RoundedRectangle(cornerRadius: self.barWidth / 2).fill(self.color).frame(width: self.barWidth, height: self.barHeights[index])- .shadow(- color: self.color.opacity(self.currentGlowIntensity),- radius: self.currentGlowRadius,- x: 0,- y: 0- )- .shadow(- color: self.color.opacity(self.currentGlowIntensity * 0.5),- radius: self.currentOuterGlowRadius,- x: 0,- y: 0- )+ .shadow(color: self.color.opacity(self.currentGlowIntensity), radius: self.currentGlowRadius, x: 0, y: 0)+ .shadow(color: self.color.opacity(self.currentGlowIntensity * 0.5), radius: self.currentOuterGlowRadius, x: 0, y: 0)}}.onChange(of: self.data.audioLevel) { _, level in@@ -429,8 +428,7 @@ struct NotchWaveformView: View {// Scale audio level relative to threshold for smoother responselet adjustedLevel = (normalizedLevel - self.noiseThreshold) / (1.0 - self.noiseThreshold)let randomVariation = CGFloat.random(in: 0.7...1.0)- self.barHeights[i] = self- .minHeight + (self.maxHeight - self.minHeight) * adjustedLevel * centerFactor * randomVariation+ self.barHeights[i] = self.minHeight + (self.maxHeight - self.minHeight) * adjustedLevel * centerFactor * randomVariation} else {// Complete stillness when below thresholdself.barHeights[i] = self.minHeight@@ -540,10 +538,7 @@ struct NotchCommandOutputExpandedView: View {.frame(width: 380, height: self.dynamicHeight).background(Color.black).clipShape(RoundedRectangle(cornerRadius: 16))- .animation(- .spring(response: 0.3, dampingFraction: 0.8),- value: self.contentState.commandConversationHistory.count- )+ .animation(.spring(response: 0.3, dampingFraction: 0.8), value: self.contentState.commandConversationHistory.count)// No animation on streamingText - it updates too frequently, animations add overhead.animation(.spring(response: 0.25, dampingFraction: 0.8), value: self.contentState.isRecordingInExpandedMode)}@@ -592,13 +587,11 @@ struct NotchCommandOutputExpandedView: View {Button(action: self.onNewChat) {ZStack {Circle()- .fill(self.isHoveringNewChat ? self.commandRed.opacity(0.25) : self.commandRed- .opacity(0.12))+ .fill(self.isHoveringNewChat ? self.commandRed.opacity(0.25) : self.commandRed.opacity(0.12)).frame(width: 22, height: 22)Image(systemName: "plus").font(.system(size: 10, weight: .semibold))- .foregroundStyle(self.contentState.isCommandProcessing ? .white.opacity(0.3) : self- .commandRed.opacity(0.85))+ .foregroundStyle(self.contentState.isCommandProcessing ? .white.opacity(0.3) : self.commandRed.opacity(0.85))}}.buttonStyle(.plain)@@ -662,8 +655,7 @@ struct NotchCommandOutputExpandedView: View {.frame(width: 22, height: 22)Image(systemName: "trash").font(.system(size: 9, weight: .semibold))- .foregroundStyle(self.contentState.isCommandProcessing ? .white.opacity(0.3) : self- .commandRed.opacity(0.85))+ .foregroundStyle(self.contentState.isCommandProcessing ? .white.opacity(0.3) : self.commandRed.opacity(0.85))}}.buttonStyle(.plain)@@ -682,8 +674,7 @@ struct NotchCommandOutputExpandedView: View {Button(action: self.onDismiss) {ZStack {Circle()- .fill(self.isHoveringDismiss ? self.commandRed.opacity(0.25) : self.commandRed- .opacity(0.12))+ .fill(self.isHoveringDismiss ? self.commandRed.opacity(0.25) : self.commandRed.opacity(0.12)).frame(width: 22, height: 22)Image(systemName: "xmark").font(.system(size: 9, weight: .bold))@@ -954,8 +945,7 @@ struct ExpandedModeWaveformView: View {if isActive {let adjustedLevel = (normalizedLevel - self.noiseThreshold) / (1.0 - self.noiseThreshold)let randomVariation = CGFloat.random(in: 0.75...1.0)- self.barHeights[i] = self- .minHeight + (self.maxHeight - self.minHeight) * adjustedLevel * centerFactor * randomVariation+ self.barHeights[i] = self.minHeight + (self.maxHeight - self.minHeight) * adjustedLevel * centerFactor * randomVariation} else {self.barHeights[i] = self.minHeight}diff --git a/Sources/Fluid/Views/RewriteModeView.swift b/Sources/Fluid/Views/RewriteModeView.swiftindex f13e5551..58d55647 100644--- a/Sources/Fluid/Views/RewriteModeView.swift+++ b/Sources/Fluid/Views/RewriteModeView.swift@@ -13,7 +13,7 @@ struct RewriteModeView: View {@State private var showHowTo: Bool = false@State private var isHoveringHowTo: Bool = false@State private var isThinkingExpanded: Bool = false-+// Local state for available models (derived from shared AI Settings pool)@State private var availableModels: [String] = []@@ -177,16 +177,10 @@ struct RewriteModeView: View {// Model Selector (hidden for Apple Intelligence)if self.settings.rewriteModeSelectedProviderID != "apple-intelligence" {- Picker(- "",- selection: Binding(- get: {- self.settings.rewriteModeSelectedModel ?? self.availableModels- .first ?? "gpt-4o"- },- set: { self.settings.rewriteModeSelectedModel = $0 }- )- ) {+ Picker("", selection: Binding(+ get: { self.settings.rewriteModeSelectedModel ?? self.availableModels.first ?? "gpt-4o" },+ set: { self.settings.rewriteModeSelectedModel = $0 }+ )) {ForEach(self.availableModels, id: \.self) { model inText(model).tag(model)}@@ -226,10 +220,10 @@ struct RewriteModeView: View {}.padding().background(Color(nsColor: .windowBackgroundColor))-+// Thinking view (real-time, during processing)- if service.isProcessing && settings.showThinkingTokens && !service.streamingThinkingText.isEmpty {- thinkingView+ if self.service.isProcessing && self.settings.showThinkingTokens && !self.service.streamingThinkingText.isEmpty {+ self.thinkingView.padding(.horizontal).padding(.bottom, 8)}@@ -430,19 +424,19 @@ struct RewriteModeView: View {.foregroundStyle(.primary.opacity(0.8))}}-+// MARK: - Thinking View (Cursor-style shimmer)-+private var thinkingView: some View {VStack(alignment: .leading, spacing: 0) {// Header with shimmer effect - tap to expand/collapse- Button(action: { withAnimation(.easeInOut(duration: 0.2)) { isThinkingExpanded.toggle() } }) {+ Button(action: { withAnimation(.easeInOut(duration: 0.2)) { self.isThinkingExpanded.toggle() } }) {HStack(spacing: 8) {ThinkingShimmerLabel()-+Spacer()-- Image(systemName: isThinkingExpanded ? "chevron.up" : "chevron.down")++ Image(systemName: self.isThinkingExpanded ? "chevron.up" : "chevron.down").font(.caption2).foregroundStyle(.secondary.opacity(0.6))}@@ -450,11 +444,11 @@ struct RewriteModeView: View {.padding(.vertical, 8)}.buttonStyle(.plain)-+// Expanded content- if isThinkingExpanded {+ if self.isThinkingExpanded {ScrollView(.vertical, showsIndicators: true) {- Text(service.streamingThinkingText)+ Text(self.service.streamingThinkingText).font(.system(size: 11)).foregroundStyle(.secondary).textSelection(.enabled)@@ -465,8 +459,8 @@ struct RewriteModeView: View {.frame(maxHeight: 150)} else {// Preview - first 100 chars- if service.streamingThinkingText.count > 0 {- Text(String(service.streamingThinkingText.prefix(100)) + (service.streamingThinkingText.count > 100 ? "..." : ""))+ if self.service.streamingThinkingText.count > 0 {+ Text(String(self.service.streamingThinkingText.prefix(100)) + (self.service.streamingThinkingText.count > 100 ? "..." : "")).font(.system(size: 11)).foregroundStyle(.secondary.opacity(0.7)).lineLimit(2)diff --git a/Sources/Fluid/fluidApp.swift b/Sources/Fluid/fluidApp.swiftindex 5396bb90..e512d8f4 100644--- a/Sources/Fluid/fluidApp.swift+++ b/Sources/Fluid/fluidApp.swift@@ -1,3 +1,10 @@+//+// fluidApp.swift+// fluid+//+// Created by Barathwaj Anandan on 7/30/25.+//+import AppKitimport ApplicationServicesimport SwiftUI