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
removed what's new pop up for direct url link to releases ; command mode expandable notch ; smarter mode transitions - bug fixes includes ; Faster streaming with SSE for cmd mode ; better oerlay management
altic-dev84795dd1a71e
diff --git a/.gitignore b/.gitignoreindex a173bb56..4aab982c 100644--- a/.gitignore+++ b/.gitignore@@ -188,6 +188,7 @@ SettingsStore.xcuserstatebuild_dev.shbuild_and_notarize.shrelease.sh+check_downloads.shRELEASE_NOTES_*diff --git a/Info.plist b/Info.plistindex 38a21be0..8ea0745b 100644--- a/Info.plist+++ b/Info.plist@@ -11,7 +11,7 @@<key>CFBundleVersion</key><string>1</string><key>CFBundleShortVersionString</key>- <string>1.4.2</string>+ <string>1.5.0</string><key>LSMinimumSystemVersion</key><string>$(MACOSX_DEPLOYMENT_TARGET)</string><key>LSApplicationCategoryType</key>diff --git a/Sources/Fluid/ContentView.swift b/Sources/Fluid/ContentView.swiftindex 6b8258ce..d3ce530a 100644--- a/Sources/Fluid/ContentView.swift+++ b/Sources/Fluid/ContentView.swift@@ -62,6 +62,7 @@ struct ContentView: View {@FocusState private var isTranscriptionFocused: Bool@State private var selectedSidebarItem: SidebarItem? = .welcome+ @State private var previousSidebarItem: SidebarItem? = nil // Track previous for mode transitions@State private var playgroundUsed: Bool = SettingsStore.shared.playgroundUsed@State private var recordingAppInfo: (name: String, bundleId: String, windowTitle: String)? = nil@@ -84,8 +85,6 @@ struct ContentView: View {// MARK: - AI Enhancement checkbox state@State private var enableAIProcessing: Bool = false- // What's New Sheet- @State private var showWhatsNewSheet: Bool = false@State private var enableDebugLogs: Bool = SettingsStore.shared.enableDebugLogs@State private var pressAndHoldModeEnabled: Bool = SettingsStore.shared.pressAndHoldMode@State private var enableStreamingPreview: Bool = SettingsStore.shared.enableStreamingPreview@@ -151,10 +150,6 @@ struct ContentView: View {}.withMouseTracking(mouseTracker).environmentObject(mouseTracker)- .sheet(isPresented: $showWhatsNewSheet) {- WhatsNewView()- .appTheme(theme)- }.onAppear {appear = trueaccessibilityEnabled = checkAccessibilityPermissions()@@ -177,6 +172,14 @@ struct ContentView: View {// Configure menu bar manager with ASR servicemenuBarManager.configure(asrService: asr)+ // Set up notch click callback for expanding command conversation+ NotchOverlayManager.shared.onNotchClicked = { [weak commandModeService] in+ // When notch is clicked in command mode, show expanded conversation+ if !NotchContentState.shared.commandConversationHistory.isEmpty {+ NotchOverlayManager.shared.showExpandedCommandOutput()+ }+ }+// Start polling for accessibility permission if not grantedstartAccessibilityPolling()@@ -289,6 +292,13 @@ struct ContentView: View {// Escape pressed - handle cancellationvar handled = false+ // Close expanded command notch if visible (highest priority)+ if NotchOverlayManager.shared.isCommandOutputExpanded {+ DebugLogger.shared.debug("NSEvent monitor: Escape pressed, closing expanded command notch", source: "ContentView")+ NotchOverlayManager.shared.hideExpandedCommandOutput()+ handled = true+ }+if asr.isRunning {DebugLogger.shared.debug("NSEvent monitor: Escape pressed, cancelling ASR recording", source: "ContentView")asr.stopWithoutTranscription()@@ -490,6 +500,59 @@ struct ContentView: View {DebugLogger.shared.debug("Hotkey manager initialized: \(self.hotkeyManagerInitialized)", source: "ContentView")}}+ .onChange(of: selectedSidebarItem) { newValue in+ handleModeTransition(from: previousSidebarItem, to: newValue)+ previousSidebarItem = newValue+ }+ }++ // MARK: - Mode Transition Handler+ /// Centralized handler for sidebar mode transitions to ensure proper cleanup and state management+ private func handleModeTransition(from oldValue: SidebarItem?, to newValue: SidebarItem?) {+ DebugLogger.shared.debug("Mode transition: \(String(describing: oldValue)) → \(String(describing: newValue))", source: "ContentView")++ // Clean up state from the previous mode+ if let old = oldValue {+ switch old {+ case .commandMode:+ // Close expanded command output notch if visible+ if NotchOverlayManager.shared.isCommandOutputExpanded {+ DebugLogger.shared.debug("Closing expanded command notch on mode transition", source: "ContentView")+ NotchOverlayManager.shared.hideExpandedCommandOutput()+ }+ // Note: We don't clear command history here - user may want to return to it++ case .rewriteMode:+ // Clear rewrite state when leaving+ rewriteModeService.clearState()++ default:+ break+ }+ }++ // Set up state for the new mode+ if let new = newValue {+ switch new {+ case .commandMode:+ menuBarManager.setOverlayMode(.command)++ case .rewriteMode:+ // Check if in write mode (no original text) vs rewrite mode+ if rewriteModeService.isWriteMode || rewriteModeService.originalText.isEmpty {+ menuBarManager.setOverlayMode(.write)+ } else {+ menuBarManager.setOverlayMode(.rewrite)+ }++ default:+ // For all other views, set to dictation mode+ menuBarManager.setOverlayMode(.dictation)+ }+ } else {+ // If newValue is nil, default to dictation+ menuBarManager.setOverlayMode(.dictation)+ }}private func resetPendingShortcutState()@@ -585,6 +648,7 @@ struct ContentView: View {}.transition(.opacity)}+ .toolbar(.hidden, for: .automatic)}// MARK: - Welcome Guide@@ -716,7 +780,6 @@ struct ContentView: View {SettingsView(asr: asr,appear: $appear,- showWhatsNewSheet: $showWhatsNewSheet,visualizerNoiseThreshold: $visualizerNoiseThreshold,selectedInputUID: $selectedInputUID,selectedOutputUID: $selectedOutputUID,@@ -968,7 +1031,7 @@ struct ContentView: View {.font(.system(size: 15, weight: .semibold)).foregroundStyle(theme.palette.primaryText)- Text("Stream responses from OpenAI-compatible APIs for faster initial output")+ Text("Currently only Command Mode shows real-time streaming").font(.system(size: 13)).foregroundStyle(theme.palette.secondaryText)}@@ -2411,53 +2474,43 @@ struct ContentView: View {}var fullContent = ""- var currentLine = ""- // Parse SSE line by line- for try await byte in bytes {- let char = Character(UnicodeScalar(byte))+ // Use efficient line-based iteration instead of byte-by-byte+ for try await rawLine in bytes.lines {+ let line = rawLine.trimmingCharacters(in: .whitespaces)- if char == "\n" {- // Process the completed line- let line = currentLine.trimmingCharacters(in: .whitespaces)-- if line.hasPrefix("data:") {- // Handle both "data: " and "data:" formats- var jsonString = String(line.dropFirst(5))- if jsonString.hasPrefix(" ") {- jsonString = String(jsonString.dropFirst(1))- }-- // Skip [DONE] marker- if jsonString.trimmingCharacters(in: .whitespaces) == "[DONE]" {- DebugLogger.shared.debug("Received [DONE] marker", source: "Streaming")- currentLine = ""- continue- }-- // Parse the JSON chunk- if let jsonData = jsonString.data(using: .utf8) {- do {- let chunk = try JSONDecoder().decode(StreamingChunk.self, from: jsonData)- if let delta = chunk.choices.first?.delta,- let content = delta.content {- fullContent += content- }- } catch {- // Try alternative parsing for different response formats- if let json = try? JSONSerialization.jsonObject(with: jsonData) as? [String: Any],- let choices = json["choices"] as? [[String: Any]],- let firstChoice = choices.first,- let delta = firstChoice["delta"] as? [String: Any],- let content = delta["content"] as? String {- fullContent += content- }- }- }+ guard line.hasPrefix("data:") else { continue }++ // Handle both "data: " and "data:" formats+ var jsonString = String(line.dropFirst(5))+ if jsonString.hasPrefix(" ") {+ jsonString = String(jsonString.dropFirst(1))+ }++ // Skip [DONE] marker+ if jsonString.trimmingCharacters(in: .whitespaces) == "[DONE]" {+ DebugLogger.shared.debug("Received [DONE] marker", source: "Streaming")+ continue+ }++ // Parse the JSON chunk+ guard let jsonData = jsonString.data(using: .utf8) else { continue }++ do {+ let chunk = try JSONDecoder().decode(StreamingChunk.self, from: jsonData)+ if let delta = chunk.choices.first?.delta,+ let content = delta.content {+ fullContent += content+ }+ } catch {+ // Try alternative parsing for different response formats+ if let json = try? JSONSerialization.jsonObject(with: jsonData) as? [String: Any],+ let choices = json["choices"] as? [[String: Any]],+ let firstChoice = choices.first,+ let delta = firstChoice["delta"] as? [String: Any],+ let content = delta["content"] as? String {+ fullContent += content}- currentLine = ""- } else if char != "\r" {- currentLine.append(char)}}@@ -3155,6 +3208,13 @@ struct ContentView: View {hotkeyManager?.setCancelCallback {var handled = false+ // Close expanded command notch if visible (highest priority)+ if NotchOverlayManager.shared.isCommandOutputExpanded {+ DebugLogger.shared.debug("Cancel callback: closing expanded command notch", source: "ContentView")+ NotchOverlayManager.shared.hideExpandedCommandOutput()+ handled = true+ }+// Reset recording mode flagsif self.isRecordingForCommand {self.isRecordingForCommand = falsediff --git a/Sources/Fluid/Persistence/SettingsStore.swift b/Sources/Fluid/Persistence/SettingsStore.swiftindex a40e678f..617a87b5 100644--- a/Sources/Fluid/Persistence/SettingsStore.swift+++ b/Sources/Fluid/Persistence/SettingsStore.swift@@ -35,7 +35,6 @@ final class SettingsStore: ObservableObjectstatic let copyTranscriptionToClipboard = "CopyTranscriptionToClipboard"static let autoUpdateCheckEnabled = "AutoUpdateCheckEnabled"static let lastUpdateCheckDate = "LastUpdateCheckDate"- static let lastSeenVersion = "LastSeenVersion"static let playgroundUsed = "PlaygroundUsed"// Command Mode Keys@@ -316,13 +315,6 @@ final class SettingsStore: ObservableObjectlastUpdateCheckDate = Date()}- // MARK: - What's New Tracking-- var lastSeenVersion: String? {- get { defaults.string(forKey: Keys.lastSeenVersion) }- set { defaults.set(newValue, forKey: Keys.lastSeenVersion) }- }-var playgroundUsed: Bool {get { defaults.bool(forKey: Keys.playgroundUsed) }set { defaults.set(newValue, forKey: Keys.playgroundUsed) }@@ -447,23 +439,6 @@ final class SettingsStore: ObservableObject}}- func shouldShowWhatsNew() -> Bool {- let currentVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "1.0.0"-- guard let lastSeen = lastSeenVersion else {- // First launch, don't show what's new- lastSeenVersion = currentVersion- return false- }-- // Show if versions are different- return lastSeen != currentVersion- }-- func markWhatsNewAsSeen() {- lastSeenVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String- }-// MARK: - Private Methodsprivate func updateLaunchAtStartup(_ enabled: Bool) {diff --git a/Sources/Fluid/Services/ASRService.swift b/Sources/Fluid/Services/ASRService.swiftindex d4a8f40b..7ba71449 100644--- a/Sources/Fluid/Services/ASRService.swift+++ b/Sources/Fluid/Services/ASRService.swift@@ -91,7 +91,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 = 2.0 // Safer interval to prevent ANE/CoreML conflicts+ private let chunkDurationSeconds: Double = 0.6 // Fast interval - TranscriptionExecutor actor handles CoreML serializationprivate var isProcessingChunk: Bool = falseprivate var skipNextChunk: Bool = falseprivate var previousFullTranscription: String = ""@@ -767,7 +767,7 @@ final class ASRService: ObservableObjectguard isAsrReady, let manager = asrManager else { return }let currentSampleCount = recordedPCM.count- let minSamples = 16000 // 1 second minimum+ let minSamples = 8000 // 0.5 second minimum for faster initial feedbackguard currentSampleCount >= minSamples else { return }// Copy the audio data to prevent mutation during processing@@ -800,9 +800,10 @@ final class ASRService: ObservableObjectDebugLogger.shared.debug("✅ Streaming: '\(updatedText)' (\(String(format: "%.2f", duration))s)", source: "ASRService")}- // If transcription takes >80% of interval, skip next to prevent queue buildup- if duration > chunkDurationSeconds * 0.8 {- DebugLogger.shared.debug("⚠️ Transcription slow (\(String(format: "%.2f", duration))s), skipping next chunk", 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 system+ if duration > chunkDurationSeconds {+ DebugLogger.shared.debug("⚠️ Transcription slow (\(String(format: "%.2f", duration))s > \(chunkDurationSeconds)s), skipping next chunk", source: "ASRService")skipNextChunk = true}} catch {diff --git a/Sources/Fluid/Services/CommandModeService.swift b/Sources/Fluid/Services/CommandModeService.swiftindex a81ad0bb..feb5623e 100644--- a/Sources/Fluid/Services/CommandModeService.swift+++ b/Sources/Fluid/Services/CommandModeService.swift@@ -7,11 +7,19 @@ 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 UIprivate let terminalService = TerminalService()private var currentTurnCount = 0private let maxTurns = 20+ // Flag to enable notch output display+ var enableNotchOutput: Bool = true++ // Streaming UI update throttling - adaptive rate based on content length+ private var lastUIUpdate: CFAbsoluteTime = 0+ private var streamingBuffer: [String] = [] // Buffer tokens instead of string concat+// MARK: - Agent Step Trackingenum AgentStep: Equatable {@@ -77,6 +85,9 @@ final class CommandModeService: ObservableObject {conversationHistory.removeAll()pendingCommand = nilcurrentTurnCount = 0++ // Also clear notch state+ NotchContentState.shared.clearCommandOutput()}/// Process user voice/text command@@ -87,6 +98,26 @@ final class CommandModeService: ObservableObject {currentTurnCount = 0conversationHistory.append(Message(role: .user, content: text))+ // Push to notch+ if enableNotchOutput {+ NotchContentState.shared.addCommandMessage(role: .user, content: text)+ NotchContentState.shared.setCommandProcessing(true)+ }++ await processNextTurn()+ }++ /// Process follow-up command from notch input+ func processFollowUpCommand(_ text: String) async {+ guard !text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { return }++ // Add to both histories+ conversationHistory.append(Message(role: .user, content: text))+ NotchContentState.shared.addCommandMessage(role: .user, content: text)++ isProcessing = true+ NotchContentState.shared.setCommandProcessing(true)+await processNextTurn()}@@ -115,19 +146,32 @@ final class CommandModeService: ObservableObject {private func processNextTurn() async {if currentTurnCount >= maxTurns {+ let errorMsg = "Reached maximum steps limit. Please review the progress and continue if needed."conversationHistory.append(Message(role: .assistant,- content: "Reached maximum steps limit. Please review the progress and continue if needed.",+ content: errorMsg,stepType: .failure))isProcessing = falsecurrentStep = .completed(false)++ // Push to notch+ if enableNotchOutput {+ NotchContentState.shared.addCommandMessage(role: .assistant, content: errorMsg)+ NotchContentState.shared.setCommandProcessing(false)+ showExpandedNotchIfNeeded()+ }return}currentTurnCount += 1currentStep = .thinking("Analyzing...")+ // Push status to notch+ if enableNotchOutput {+ NotchContentState.shared.addCommandMessage(role: .status, content: "Thinking...")+ }+do {let response = try await callLLM()@@ -149,6 +193,12 @@ final class CommandModeService: ObservableObject {stepType: stepType))+ // Push step to notch+ if enableNotchOutput {+ let statusText = tc.purpose ?? stepDescription(for: stepType)+ NotchContentState.shared.addCommandMessage(role: .status, content: statusText)+ }+// Check if we need confirmation for destructive commandsif SettingsStore.shared.commandModeConfirmBeforeExecute && isDestructiveCommand(tc.command) {pendingCommand = PendingCommand(@@ -159,6 +209,12 @@ final class CommandModeService: ObservableObject {)isProcessing = falsecurrentStep = nil++ // Push confirmation needed to notch+ if enableNotchOutput {+ NotchContentState.shared.addCommandMessage(role: .status, content: "⚠️ Confirmation needed in Command Mode window")+ NotchContentState.shared.setCommandProcessing(false)+ }return}@@ -179,19 +235,44 @@ final class CommandModeService: ObservableObject {))isProcessing = falsecurrentStep = .completed(isFinal)++ // Push final response to notch and show expanded view+ if enableNotchOutput {+ NotchContentState.shared.updateCommandStreamingText("") // Clear streaming+ NotchContentState.shared.addCommandMessage(role: .assistant, content: response.content)+ NotchContentState.shared.setCommandProcessing(false)+ showExpandedNotchIfNeeded()+ }}} catch {+ let errorMsg = "Error: \(error.localizedDescription)"conversationHistory.append(Message(role: .assistant,- content: "Error: \(error.localizedDescription)",+ content: errorMsg,stepType: .failure))isProcessing = falsecurrentStep = .completed(false)++ // Push error to notch+ if enableNotchOutput {+ NotchContentState.shared.addCommandMessage(role: .assistant, content: errorMsg)+ NotchContentState.shared.setCommandProcessing(false)+ showExpandedNotchIfNeeded()+ }}}+ /// Show expanded notch output if there's content to display+ private func showExpandedNotchIfNeeded() {+ guard enableNotchOutput else { return }+ guard !NotchContentState.shared.commandConversationHistory.isEmpty else { return }++ // Show the expanded notch+ NotchOverlayManager.shared.showExpandedCommandOutput()+ }+private func determineStepType(for command: String, purpose: String?) -> Message.StepType {let cmd = command.lowercased()let purposeLower = purpose?.lowercased() ?? ""@@ -224,9 +305,45 @@ final class CommandModeService: ObservableObject {}private func isDestructiveCommand(_ command: String) -> Bool {- let destructive = ["rm ", "rm\t", "rmdir", "mv ", "mv\t", "> ", ">> ",- "chmod ", "chown ", "kill ", "pkill ", "sudo "]- return destructive.contains { command.lowercased().hasPrefix($0) || command.contains(" \($0)") }+ let cmd = command.lowercased()++ // Commands that start with these are destructive+ let destructivePrefixes = [+ "rm ", "rm\t", "rmdir ", "rm -", // delete+ "mv ", "mv\t", // move/rename+ "sudo ", // elevated privileges+ "kill ", "pkill ", "killall ", // terminate processes+ "chmod ", "chown ", "chgrp ", // change permissions/ownership+ "dd ", // disk operations+ "mkfs", "format", // filesystem formatting+ "> ", // overwrite file+ "truncate ", // truncate file+ "shred ", // secure delete+ ]++ // Check if command starts with any destructive prefix+ if destructivePrefixes.contains(where: { cmd.hasPrefix($0) }) {+ return true+ }++ // Check for destructive patterns anywhere in piped commands+ let destructivePatterns = [+ "| rm ", "| sudo ", "| dd ",+ "; rm ", "; sudo ",+ "&& rm ", "&& sudo ",+ "xargs rm", "xargs -I",+ ]++ if destructivePatterns.contains(where: { cmd.contains($0) }) {+ return true+ }++ // rm with flags like -rf, -r, -f anywhere+ if cmd.contains("rm -") {+ return true+ }++ return false}private func executeCommand(_ command: String, workingDirectory: String?, callId: String, purpose: String? = nil) async {@@ -428,8 +545,11 @@ final class CommandModeService: ObservableObject {// We assume conversationHistory contains the user's latest message already+ // Check streaming setting+ let enableStreaming = SettingsStore.shared.enableAIStreaming+// Build request- let body: [String: Any] = [+ var body: [String: Any] = ["model": model,"messages": messages,"tools": [TerminalService.toolDefinition],@@ -437,6 +557,10 @@ final class CommandModeService: ObservableObject {"temperature": 0.1]+ if enableStreaming {+ body["stream"] = true+ }+let endpoint = baseURL.hasSuffix("/chat/completions") ? baseURL : "\(baseURL)/chat/completions"guard let url = URL(string: endpoint) else {throw NSError(domain: "CommandMode", code: -1, userInfo: [NSLocalizedDescriptionKey: "Invalid URL"])@@ -448,6 +572,35 @@ final class CommandModeService: ObservableObject {request.addValue("Bearer \(apiKey)", forHTTPHeaderField: "Authorization")request.httpBody = try JSONSerialization.data(withJSONObject: body)+ // Retry logic for transient network errors (DNS resolution, connection cold start)+ var lastError: Error?+ for attempt in 1...3 {+ do {+ if enableStreaming {+ return try await processStreamingLLMResponse(request: request)+ } else {+ return try await processNonStreamingLLMResponse(request: request)+ }+ } catch let error as URLError where error.code == .notConnectedToInternet ||+ error.code == .timedOut ||+ error.code == .networkConnectionLost ||+ error.code == .cannotFindHost ||+ error.code == .cannotConnectToHost {+ lastError = error+ if attempt < 3 {+ // Wait before retry (exponential backoff: 200ms, 400ms)+ try? await Task.sleep(nanoseconds: UInt64(200_000_000 * attempt))+ continue+ }+ } catch {+ throw error // Non-retryable error+ }+ }+ throw lastError ?? NSError(domain: "CommandMode", code: -1, userInfo: [NSLocalizedDescriptionKey: "Network request failed after retries"])+ }++ // MARK: - Non-Streaming Response+ private func processNonStreamingLLMResponse(request: URLRequest) async throws -> LLMResponse {let (data, response) = try await URLSession.shared.data(for: request)if let http = response as? HTTPURLResponse, http.statusCode >= 400 {@@ -462,6 +615,150 @@ final class CommandModeService: ObservableObject {throw NSError(domain: "CommandMode", code: -1, userInfo: [NSLocalizedDescriptionKey: "Invalid response"])}+ return parseMessageResponse(message)+ }++ // MARK: - Streaming Response with Real-time UI Updates+ private func processStreamingLLMResponse(request: URLRequest) async throws -> LLMResponse {+ streamingText = ""+ streamingBuffer = []+ lastUIUpdate = CFAbsoluteTimeGetCurrent()++ let (bytes, response) = try await URLSession.shared.bytes(for: request)++ if let http = response as? HTTPURLResponse, http.statusCode >= 400 {+ var errorData = Data()+ for try await byte in bytes {+ errorData.append(byte)+ }+ let errText = String(data: errorData, encoding: .utf8) ?? "Unknown error"+ throw NSError(domain: "CommandMode", code: http.statusCode, userInfo: [NSLocalizedDescriptionKey: errText])+ }++ var toolCallId: String?+ var toolCallName: String?+ var toolCallArguments = ""++ // Use efficient line-based iteration instead of byte-by-byte+ for 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 firstChoice = choices.first,+ let delta = firstChoice["delta"] as? [String: Any] else {+ continue+ }++ // Handle text content - use buffer to avoid O(n²) string concat+ if let content = delta["content"] as? String {+ streamingBuffer.append(content)++ // Adaptive throttle: slower updates as content grows (reduces SwiftUI layout overhead)+ let bufferLength = streamingBuffer.count+ let updateInterval: CFAbsoluteTime+ if bufferLength < 50 {+ updateInterval = 0.016 // 60fps for first ~50 tokens+ } else if bufferLength < 200 {+ updateInterval = 0.033 // 30fps for medium content+ } else {+ updateInterval = 0.066 // 15fps for long content+ }++ let now = CFAbsoluteTimeGetCurrent()+ if now - lastUIUpdate >= updateInterval {+ lastUIUpdate = now+ let fullContent = streamingBuffer.joined()+ streamingText = fullContent++ // Push to notch for real-time display+ if enableNotchOutput {+ NotchContentState.shared.updateCommandStreamingText(fullContent)+ }+ }+ }++ // Handle tool calls (streamed in parts)+ if let toolCalls = delta["tool_calls"] as? [[String: Any]],+ let toolCall = toolCalls.first {++ if let id = toolCall["id"] as? String {+ toolCallId = id+ }++ if let function = toolCall["function"] as? [String: Any] {+ if let name = function["name"] as? String {+ toolCallName = name+ }+ if let args = function["arguments"] as? String {+ toolCallArguments += args+ }+ }+ }+ }++ // Final update - join buffer once at the end+ let fullContent = streamingBuffer.joined()+ if !fullContent.isEmpty {+ streamingText = fullContent+ if enableNotchOutput {+ NotchContentState.shared.updateCommandStreamingText(fullContent)+ }+ }++ // Small delay to let the final content render, then clear+ try? await Task.sleep(nanoseconds: 50_000_000) // 50ms++ streamingText = "" // Clear streaming text when done+ streamingBuffer = [] // Clear buffer++ // Clear notch streaming text as well+ if enableNotchOutput {+ NotchContentState.shared.updateCommandStreamingText("")+ }++ // If we got a tool call, parse it+ if let name = toolCallName, name == "execute_terminal_command",+ let argsData = toolCallArguments.data(using: .utf8),+ let args = try? JSONSerialization.jsonObject(with: argsData) as? [String: Any] {++ let command = args["command"] as? String ?? ""+ let workDir = args["workingDirectory"] as? String+ let purpose = args["purpose"] as? String+ let callId = toolCallId ?? "call_\(UUID().uuidString.prefix(8))"++ return LLMResponse(+ content: fullContent,+ toolCall: LLMResponse.ToolCallData(+ id: callId,+ command: command,+ workingDirectory: workDir?.isEmpty == true ? nil : workDir,+ purpose: purpose+ )+ )+ }++ // Text response only+ return LLMResponse(+ content: fullContent.isEmpty ? "I couldn't understand that." : fullContent,+ toolCall: nil+ )+ }++ // MARK: - Parse Message Helper+ private func parseMessageResponse(_ message: [String: Any]) -> LLMResponse {// Check for tool callsif let toolCalls = message["tool_calls"] as? [[String: Any]],let toolCall = toolCalls.first,diff --git a/Sources/Fluid/Services/MenuBarManager.swift b/Sources/Fluid/Services/MenuBarManager.swiftindex c250d55d..c0900d95 100644--- a/Sources/Fluid/Services/MenuBarManager.swift+++ b/Sources/Fluid/Services/MenuBarManager.swift@@ -30,6 +30,9 @@ final class MenuBarManager: ObservableObject {private var pendingShowOperation: DispatchWorkItem?private var pendingHideOperation: DispatchWorkItem?+ // Subscription for forwarding audio levels to expanded command notch+ private var expandedModeAudioSubscription: AnyCancellable?+init() {// Don't setup menu bar immediately - defer until app is ready// Initialize from persisted setting@@ -97,9 +100,39 @@ final class MenuBarManager: ObservableObject {overlayVisible = true+ // If expanded command output is showing, check if we should keep it or close it+ if NotchOverlayManager.shared.isCommandOutputExpanded {+ // Only keep expanded notch if this is a command mode recording (follow-up)+ // For other modes (dictation, rewrite), close it and show regular notch+ if currentOverlayMode == .command {+ // Enable recording visualization in the expanded notch+ NotchContentState.shared.setRecordingInExpandedMode(true)++ // Subscribe to audio levels and forward to expanded notch+ expandedModeAudioSubscription = asrService.audioLevelPublisher+ .receive(on: DispatchQueue.main)+ .sink { level in+ NotchContentState.shared.updateExpandedModeAudioLevel(level)+ }++ pendingShowOperation = nil+ return+ } else {+ // Close expanded command notch to transition to regular notch+ NotchOverlayManager.shared.hideExpandedCommandOutput()+ }+ }+let showItem = DispatchWorkItem { [weak self] inguard let self = self, self.overlayVisible else { return }+ // Double-check expanded notch isn't showing (could have changed during delay)+ // But only block if we're in command mode+ if NotchOverlayManager.shared.isCommandOutputExpanded && self.currentOverlayMode == .command {+ self.pendingShowOperation = nil+ return+ }+// Show notch overlayNotchOverlayManager.shared.show(audioLevelPublisher: asrService.audioLevelPublisher,@@ -117,9 +150,26 @@ final class MenuBarManager: ObservableObject {overlayVisible = false+ // If expanded command output is showing, don't hide it - let it stay visible+ if NotchOverlayManager.shared.isCommandOutputExpanded {+ // Stop recording visualization in expanded notch+ NotchContentState.shared.setRecordingInExpandedMode(false)+ expandedModeAudioSubscription?.cancel()+ expandedModeAudioSubscription = nil++ pendingHideOperation = nil+ return+ }+let hideItem = DispatchWorkItem { [weak self] inguard let self = self, !self.overlayVisible else { return }+ // Don't hide if expanded command output is now showing+ if NotchOverlayManager.shared.isCommandOutputExpanded {+ self.pendingHideOperation = nil+ return+ }+// Hide notch overlayNotchOverlayManager.shared.hide()@@ -147,10 +197,25 @@ final class MenuBarManager: ObservableObject {pendingHideOperation = niloverlayVisible = true} else {- // When processing ends, schedule the hide+ // When processing ends, schedule the hide (unless expanded output is showing)overlayVisible = false++ // If expanded command output is showing, don't hide it+ if NotchOverlayManager.shared.isCommandOutputExpanded {+ pendingHideOperation = nil+ NotchOverlayManager.shared.setProcessing(processing)+ return+ }+let hideItem = DispatchWorkItem { [weak self] inguard let self = self, !self.overlayVisible else { return }++ // Don't hide if expanded command output is now showing+ if NotchOverlayManager.shared.isCommandOutputExpanded {+ self.pendingHideOperation = nil+ return+ }+NotchOverlayManager.shared.hide()self.pendingHideOperation = nil}@@ -280,13 +345,6 @@ final class MenuBarManager: ObservableObject {openItem.target = selfmenu.addItem(openItem)- // Show What's New (for testing)- #if DEBUG- let whatsNewItem = NSMenuItem(title: "Show What's New", action: #selector(showWhatsNew), keyEquivalent: "")- whatsNewItem.target = self- menu.addItem(whatsNewItem)- #endif-// Check for Updateslet updateItem = NSMenuItem(title: "Check for Updates...", action: #selector(checkForUpdates(_:)), keyEquivalent: "")updateItem.target = self@@ -368,11 +426,6 @@ final class MenuBarManager: ObservableObject {}}- @objc private func showWhatsNew() {- // Post notification to show What's New view- NotificationCenter.default.post(name: NSNotification.Name("ShowWhatsNew"), object: nil)- }-@objc private func openMainWindow() {// First, unhide the app if it's hiddenif NSApp.isHidden {diff --git a/Sources/Fluid/Services/NotchOverlayManager.swift b/Sources/Fluid/Services/NotchOverlayManager.swiftindex 8c91d1e9..b552d4de 100644--- a/Sources/Fluid/Services/NotchOverlayManager.swift+++ b/Sources/Fluid/Services/NotchOverlayManager.swift@@ -23,11 +23,15 @@ final class NotchOverlayManager {static let shared = NotchOverlayManager()private var notch: DynamicNotch<NotchExpandedView, NotchCompactLeadingView, NotchCompactTrailingView>?+ private var commandOutputNotch: DynamicNotch<NotchCommandOutputExpandedView, NotchCompactLeadingView, NotchCompactTrailingView>?private var currentMode: OverlayMode = .dictation// Store last audio publisher for re-showing during processingprivate var lastAudioPublisher: AnyPublisher<CGFloat, Never>?+ // Current audio publisher (can be updated for expanded notch recording)+ @Published private(set) var currentAudioPublisher: AnyPublisher<CGFloat, Never>?+// State machine to prevent race conditionsprivate enum State {case idle@@ -36,17 +40,79 @@ final class NotchOverlayManager {case hiding}private var state: State = .idle+ private var commandOutputState: State = .idle++ // Track if expanded command output is showing+ private(set) var isCommandOutputExpanded: Bool = false++ // Callbacks for command output interaction+ var onCommandOutputDismiss: (() -> Void)?+ var onCommandFollowUp: ((String) async -> Void)?+ var onNotchClicked: (() -> Void)? // Called when regular notch is clicked in command mode// Generation counter to track show/hide cycles and prevent race conditions// Uses UInt64 to avoid overflow concerns in long-running sessionsprivate var generation: UInt64 = 0+ private var commandOutputGeneration: UInt64 = 0// Track pending retry task for cancellationprivate var pendingRetryTask: Task<Void, Never>?- private init() {}+ // Escape key monitors for dismissing notch+ private var globalEscapeMonitor: Any?+ private var localEscapeMonitor: Any?++ private init() {+ setupEscapeKeyMonitors()+ }++ deinit {+ if let monitor = globalEscapeMonitor {+ NSEvent.removeMonitor(monitor)+ }+ if let monitor = localEscapeMonitor {+ NSEvent.removeMonitor(monitor)+ }+ }++ /// Setup escape key monitors - both global (other apps) and local (our app)+ private func setupEscapeKeyMonitors() {+ let escapeHandler: (NSEvent) -> NSEvent? = { [weak self] event in+ guard event.keyCode == 53 else { return event } // Escape key++ Task { @MainActor in+ guard let self = self else { return }++ // If expanded command output is showing, hide it+ if self.isCommandOutputExpanded {+ self.hideExpandedCommandOutput()+ self.onCommandOutputDismiss?()+ }+ // Also hide regular notch if visible+ else if self.state == .visible {+ self.hide()+ }+ }+ return nil // Consume the event+ }++ // Global monitor - catches escape when OTHER apps have focus+ globalEscapeMonitor = NSEvent.addGlobalMonitorForEvents(matching: .keyDown) { event in+ _ = escapeHandler(event)+ }++ // Local monitor - catches escape when OUR app/notch has focus+ localEscapeMonitor = NSEvent.addLocalMonitorForEvents(matching: .keyDown, handler: escapeHandler)+ }func show(audioLevelPublisher: AnyPublisher<CGFloat, Never>, mode: OverlayMode) {+ // Don't show regular notch if expanded command output is visible+ if isCommandOutputExpanded {+ // Just store the publisher for later use+ lastAudioPublisher = audioLevelPublisher+ return+ }+// Cancel any pending retry operationspendingRetryTask?.cancel()pendingRetryTask = nil@@ -176,6 +242,11 @@ final class NotchOverlayManager {func setProcessing(_ processing: Bool) {NotchContentState.shared.setProcessing(processing)+ // If expanded command output is showing, don't mess with regular notch+ if isCommandOutputExpanded {+ return+ }+if processing {// If notch isn't visible, re-show it for processing stateif state == .idle || state == .hiding {@@ -185,5 +256,116 @@ final class NotchOverlayManager {}}}++ // MARK: - Expanded Command Output++ /// Show expanded command output notch+ func showExpandedCommandOutput() {+ // Hide regular notch first if visible+ if notch != nil {+ hide()+ }++ // Wait a bit for cleanup+ Task {+ try? await Task.sleep(nanoseconds: 100_000_000) // 100ms+ await showExpandedCommandOutputInternal()+ }+ }++ private func showExpandedCommandOutputInternal() async {+ guard commandOutputState == .idle else { return }++ commandOutputGeneration &+= 1+ let currentGeneration = commandOutputGeneration++ commandOutputState = .showing+ isCommandOutputExpanded = true++ // Update content state+ NotchContentState.shared.mode = .command+ NotchContentState.shared.isExpandedForCommandOutput = true++ let publisher = lastAudioPublisher ?? Empty<CGFloat, Never>().eraseToAnyPublisher()++ let newNotch = DynamicNotch(+ hoverBehavior: [], // No keepVisible - allows closing with X/Escape even when cursor is on notch+ style: .notch(topCornerRadius: 12, bottomCornerRadius: 16)+ ) {+ NotchCommandOutputExpandedView(+ audioPublisher: publisher,+ onDismiss: { [weak self] in+ Task { @MainActor in+ self?.hideExpandedCommandOutput()+ self?.onCommandOutputDismiss?()+ }+ },+ onSubmit: { [weak self] text in+ await self?.onCommandFollowUp?(text)+ }+ )+ } compactLeading: {+ NotchCompactLeadingView()+ } compactTrailing: {+ NotchCompactTrailingView()+ }++ self.commandOutputNotch = newNotch++ await newNotch.expand()++ guard self.commandOutputGeneration == currentGeneration else { return }+ self.commandOutputState = .visible+ }++ /// Hide expanded command output notch - force close regardless of hover state+ func hideExpandedCommandOutput() {+ commandOutputGeneration &+= 1+ let currentGeneration = commandOutputGeneration++ // Force cleanup state immediately+ isCommandOutputExpanded = false+ NotchContentState.shared.collapseCommandOutput()++ guard commandOutputState == .visible || commandOutputState == .showing,+ let currentNotch = commandOutputNotch else {+ commandOutputState = .idle+ return+ }++ commandOutputState = .hiding++ // Store reference and nil out immediately to prevent hover from keeping it alive+ let notchToHide = currentNotch+ self.commandOutputNotch = nil++ Task {+ // Try to hide gracefully, but we've already removed our reference+ await notchToHide.hide()+ guard self.commandOutputGeneration == currentGeneration else { return }+ self.commandOutputState = .idle+ }+ }++ /// Toggle expanded command output (for hotkey handling)+ func toggleExpandedCommandOutput() {+ if isCommandOutputExpanded {+ hideExpandedCommandOutput()+ } else if NotchContentState.shared.commandConversationHistory.isEmpty == false {+ // Only show if there's history to show+ showExpandedCommandOutput()+ }+ }++ /// Check if any notch (regular or expanded) is visible+ var isAnyNotchVisible: Bool {+ return state == .visible || state == .showing || isCommandOutputExpanded+ }++ /// Update audio publisher for expanded notch (when recording starts within it)+ func updateAudioPublisher(_ publisher: AnyPublisher<CGFloat, Never>) {+ lastAudioPublisher = publisher+ currentAudioPublisher = publisher+ }}diff --git a/Sources/Fluid/Services/RewriteModeService.swift b/Sources/Fluid/Services/RewriteModeService.swiftindex 38756e6f..1d739eb2 100644--- a/Sources/Fluid/Services/RewriteModeService.swift+++ b/Sources/Fluid/Services/RewriteModeService.swift@@ -187,6 +187,7 @@ final class RewriteModeService: ObservableObject {]if enableStreaming {+ // TODO: Streamed text is still buffered; add incremental UI updates so write mode visibly streams.body["stream"] = true}@@ -238,37 +239,31 @@ final class RewriteModeService: ObservableObject {}var fullContent = ""- var currentLine = ""- for try await byte in bytes {- let char = Character(UnicodeScalar(byte))+ // Use efficient line-based iteration instead of byte-by-byte+ for try await rawLine in bytes.lines {+ let line = rawLine.trimmingCharacters(in: .whitespaces)- if char == "\n" {- let line = currentLine.trimmingCharacters(in: .whitespaces)-- if line.hasPrefix("data:") {- var jsonString = String(line.dropFirst(5))- if jsonString.hasPrefix(" ") {- jsonString = String(jsonString.dropFirst(1))- }-- if jsonString.trimmingCharacters(in: .whitespaces) == "[DONE]" {- currentLine = ""- continue- }-- if let jsonData = jsonString.data(using: .utf8),- let json = try? JSONSerialization.jsonObject(with: jsonData) as? [String: Any],- let choices = json["choices"] as? [[String: Any]],- let firstChoice = choices.first,- let delta = firstChoice["delta"] as? [String: Any],- let content = delta["content"] as? String {- fullContent += content- }- }- currentLine = ""- } else if char != "\r" {- currentLine.append(char)+ 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+ }++ if let jsonData = jsonString.data(using: .utf8),+ let json = try? JSONSerialization.jsonObject(with: jsonData) as? [String: Any],+ let choices = json["choices"] as? [[String: Any]],+ let firstChoice = choices.first,+ let delta = firstChoice["delta"] as? [String: Any],+ let content = delta["content"] as? String {+ fullContent += content+ // Update UI in real-time for streaming feedback+ rewrittenText = fullContent}}diff --git a/Sources/Fluid/UI/SettingsView.swift b/Sources/Fluid/UI/SettingsView.swiftindex 98b11e8e..f49fe02e 100644--- a/Sources/Fluid/UI/SettingsView.swift+++ b/Sources/Fluid/UI/SettingsView.swift@@ -13,7 +13,6 @@ struct SettingsView: View {@ObservedObject var asr: ASRService@Environment(\.theme) private var theme@Binding var appear: Bool- @Binding var showWhatsNewSheet: Bool@Binding var visualizerNoiseThreshold: Double@Binding var selectedInputUID: String@Binding var selectedOutputUID: String@@ -176,8 +175,10 @@ struct SettingsView: View {.buttonStyle(PremiumButtonStyle(height: 40)).buttonHoverEffect()- Button("What's New") {- showWhatsNewSheet = true+ Button("Release Notes") {+ if let url = URL(string: "https://github.com/altic-dev/Fluid-oss/releases") {+ NSWorkspace.shared.open(url)+ }}.buttonStyle(PremiumButtonStyle(height: 40)).buttonHoverEffect()diff --git a/Sources/Fluid/UI/WelcomeView.swift b/Sources/Fluid/UI/WelcomeView.swiftindex 2f1b8518..f962994f 100644--- a/Sources/Fluid/UI/WelcomeView.swift+++ b/Sources/Fluid/UI/WelcomeView.swift@@ -11,6 +11,7 @@ import AVFoundationstruct WelcomeView: View {@ObservedObject var asr: ASRService+ @ObservedObject private var settings = SettingsStore.shared@Binding var selectedSidebarItem: SidebarItem?@Binding var playgroundUsed: Boolvar isTranscriptionFocused: FocusState<Bool>.Binding@@ -28,6 +29,14 @@ struct WelcomeView: View {let isLocalEndpoint: (String) -> Boollet openAccessibilitySettings: () -> Void+ private var commandModeShortcutDisplay: String {+ settings.commandModeHotkeyShortcut.displayString+ }++ private var writeModeShortcutDisplay: String {+ settings.rewriteModeHotkeyShortcut.displayString+ }+var body: some View {ScrollView {VStack(alignment: .leading, spacing: 14) {@@ -162,21 +171,21 @@ struct WelcomeView: View {.font(.system(size: 15, weight: .semibold))}- VStack(alignment: .leading, spacing: 8) {+ VStack(alignment: .leading, spacing: 12) {HStack(alignment: .top, spacing: 10) {ZStack {Circle().fill(theme.palette.accent.opacity(0.15))- .frame(width: 28, height: 28)+ .frame(width: 32, height: 32)Text("1")- .font(.system(size: 13, weight: .bold))+ .font(.system(size: 14, weight: .bold)).foregroundStyle(theme.palette.accent)}- VStack(alignment: .leading, spacing: 2) {+ VStack(alignment: .leading, spacing: 4) {Text("Start Recording")- .font(.system(size: 14, weight: .semibold))+ .font(.system(size: 15, weight: .semibold))Text("Press your hotkey (default: Right Option/Alt) or click the button")- .font(.system(size: 12))+ .font(.system(size: 13)).foregroundStyle(.secondary)}}@@ -185,16 +194,16 @@ struct WelcomeView: View {ZStack {Circle().fill(theme.palette.accent.opacity(0.15))- .frame(width: 28, height: 28)+ .frame(width: 32, height: 32)Text("2")- .font(.system(size: 13, weight: .bold))+ .font(.system(size: 14, weight: .bold)).foregroundStyle(theme.palette.accent)}- VStack(alignment: .leading, spacing: 2) {+ VStack(alignment: .leading, spacing: 4) {Text("Speak Clearly")- .font(.system(size: 14, weight: .semibold))+ .font(.system(size: 15, weight: .semibold))Text("Speak naturally - works best in quiet environments")- .font(.system(size: 12))+ .font(.system(size: 13)).foregroundStyle(.secondary)}}@@ -203,23 +212,199 @@ struct WelcomeView: View {ZStack {Circle().fill(theme.palette.accent.opacity(0.15))- .frame(width: 28, height: 28)+ .frame(width: 32, height: 32)Text("3")- .font(.system(size: 13, weight: .bold))+ .font(.system(size: 14, weight: .bold)).foregroundStyle(theme.palette.accent)}- VStack(alignment: .leading, spacing: 2) {+ VStack(alignment: .leading, spacing: 4) {Text("Auto-Type Result")- .font(.system(size: 14, weight: .semibold))+ .font(.system(size: 15, weight: .semibold))Text("Transcription is automatically typed into your focused app")- .font(.system(size: 12))+ .font(.system(size: 13)).foregroundStyle(.secondary)}}}+ .padding(.vertical, 8)+ }+ .padding(14)+ }+ .frame(maxWidth: .infinity)++ // Command Mode+ ThemedCard(style: .standard) {+ VStack(alignment: .leading, spacing: 10) {+ HStack {+ Image(systemName: "terminal.fill")+ .font(.system(size: 16))+ .foregroundStyle(Color(red: 1.0, green: 0.35, blue: 0.35)) // Command mode red+ Text("Command Mode")+ .font(.system(size: 15, weight: .semibold))++ Text("New")+ .font(.system(size: 10, weight: .semibold))+ .foregroundStyle(.white)+ .padding(.horizontal, 6)+ .padding(.vertical, 2)+ .background(Color(red: 1.0, green: 0.35, blue: 0.35)) // Command mode red+ .cornerRadius(4)++ Text("Alpha")+ .font(.system(size: 10, weight: .semibold))+ .foregroundStyle(.white)+ .padding(.horizontal, 6)+ .padding(.vertical, 2)+ .background(Color(red: 1.0, green: 0.35, blue: 0.35).opacity(0.7)) // Command mode red+ .cornerRadius(4)++ Spacer()++ Button(action: { selectedSidebarItem = .commandMode }) {+ Text("Open")+ .font(.system(size: 12, weight: .medium))+ }+ .buttonStyle(.bordered)+ .controlSize(.small)+ }++ Text("Control your Mac with voice commands. Execute terminal commands, open apps, and more.")+ .font(.system(size: 13))+ .foregroundStyle(.secondary)++ // How to use+ VStack(alignment: .leading, spacing: 6) {+ Text("Getting Started")+ .font(.system(size: 12, weight: .semibold))+ .foregroundStyle(.orange)++ HStack(spacing: 4) {+ Text("Press")+ .font(.system(size: 12))+ Text(commandModeShortcutDisplay)+ .font(.system(size: 12, weight: .medium))+ .padding(.horizontal, 6)+ .padding(.vertical, 2)+ .background(Color.primary.opacity(0.1))+ .cornerRadius(4)+ Text("to open, speak your command, then press again to send.")+ .font(.system(size: 12))+ }+ .foregroundStyle(.primary.opacity(0.8))+ }+ .padding(.vertical, 4)++ VStack(alignment: .leading, spacing: 8) {+ Text("Examples")+ .font(.system(size: 12, weight: .semibold))+ .foregroundStyle(.orange)+ commandModeExample(icon: "folder", text: "\"List files in my Downloads folder\"")+ commandModeExample(icon: "plus.rectangle.on.folder", text: "\"Create a folder called Projects on Desktop\"")+ commandModeExample(icon: "network", text: "\"What's my IP address?\"")+ commandModeExample(icon: "safari", text: "\"Open Safari\"")+ }++ HStack(spacing: 4) {+ Image(systemName: "exclamationmark.triangle.fill")+ .font(.system(size: 11))+ .foregroundStyle(.orange)+ Text("AI can make mistakes. Avoid destructive commands.")+ .font(.system(size: 11))+ .foregroundStyle(.secondary)+ }+ .padding(.top, 4)}.padding(14)}+ .frame(maxWidth: .infinity)++ // Write Mode+ ThemedCard(style: .standard) {+ VStack(alignment: .leading, spacing: 10) {+ HStack {+ Image(systemName: "pencil.and.outline")+ .font(.system(size: 16))+ .foregroundStyle(.blue)+ Text("Write Mode")+ .font(.system(size: 15, weight: .semibold))++ Text("New")+ .font(.system(size: 10, weight: .semibold))+ .foregroundStyle(.white)+ .padding(.horizontal, 6)+ .padding(.vertical, 2)+ .background(Color.blue)+ .cornerRadius(4)++ Spacer()++ Button(action: { selectedSidebarItem = .rewriteMode }) {+ Text("Open")+ .font(.system(size: 12, weight: .medium))+ }+ .buttonStyle(.bordered)+ .controlSize(.small)+ }++ Text("AI-powered writing assistant. Write fresh content or rewrite selected text with voice.")+ .font(.system(size: 13))+ .foregroundStyle(.secondary)++ VStack(alignment: .leading, spacing: 12) {+ // Write Fresh section+ VStack(alignment: .leading, spacing: 6) {+ Text("To Write Fresh")+ .font(.system(size: 12, weight: .semibold))+ .foregroundStyle(.blue)++ HStack(spacing: 4) {+ Text("Press")+ .font(.system(size: 12))+ Text(writeModeShortcutDisplay)+ .font(.system(size: 12, weight: .medium))+ .padding(.horizontal, 6)+ .padding(.vertical, 2)+ .background(Color.primary.opacity(0.1))+ .cornerRadius(4)+ Text("and speak what you want to write.")+ .font(.system(size: 12))+ }+ .foregroundStyle(.primary.opacity(0.8))++ writeModeExample(text: "\"Write an email asking for time off\"")+ writeModeExample(text: "\"Draft a thank you note\"")+ }++ // Rewrite/Edit section+ VStack(alignment: .leading, spacing: 6) {+ Text("To Rewrite/Edit")+ .font(.system(size: 12, weight: .semibold))+ .foregroundStyle(.blue)++ HStack(spacing: 4) {+ Text("Select text first, then press")+ .font(.system(size: 12))+ Text(writeModeShortcutDisplay)+ .font(.system(size: 12, weight: .medium))+ .padding(.horizontal, 6)+ .padding(.vertical, 2)+ .background(Color.primary.opacity(0.1))+ .cornerRadius(4)+ Text("and speak your instruction.")+ .font(.system(size: 12))+ }+ .foregroundStyle(.primary.opacity(0.8))++ writeModeExample(text: "\"Make this more formal\"")+ writeModeExample(text: "\"Fix grammar and spelling\"")+ writeModeExample(text: "\"Summarize this\"")+ }+ }+ .padding(.vertical, 4)+ }+ .padding(14)+ }+ .frame(maxWidth: .infinity)// Test Playground - At the endThemedCard(hoverEffect: false) {@@ -427,5 +612,29 @@ struct WelcomeView: View {.padding(16)}}++ // MARK: - Helper Views++ private func commandModeExample(icon: String, text: String) -> some View {+ HStack(spacing: 8) {+ Image(systemName: icon)+ .font(.system(size: 11))+ .foregroundStyle(.orange.opacity(0.8))+ .frame(width: 16)+ Text(text)+ .font(.system(size: 12))+ .foregroundStyle(.primary.opacity(0.8))+ }+ }++ private func writeModeExample(text: String) -> some View {+ HStack(spacing: 6) {+ Text("•")+ .foregroundStyle(.blue.opacity(0.6))+ Text(text)+ .font(.system(size: 12))+ .foregroundStyle(.primary.opacity(0.8))+ }+ }}diff --git a/Sources/Fluid/UI/WhatsNewView.swift b/Sources/Fluid/UI/WhatsNewView.swiftdeleted file mode 100644index 8929fb48..00000000--- a/Sources/Fluid/UI/WhatsNewView.swift+++ /dev/null@@ -1,337 +0,0 @@-import SwiftUI--struct WhatsNewView: View {- @Environment(\.dismiss) private var dismiss- @Environment(\.theme) private var theme- @State private var showContent = false- @State private var features: [WhatsNewFeature] = []- @State private var isLoading = true- @State private var version: String = ""-- init() {- // Set default version- _version = State(initialValue: Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "1.0.0")-- // Set fallback features (used if GitHub fetch fails)- // Update these to match your current version's features- _features = State(initialValue: [- WhatsNewFeature(- icon: "network",- title: "Release Notes Unavailable",- description: "Unable to fetch latest release notes. Please check your internet connection."- )- ])- }-- var body: some View {- ZStack {- theme.palette.windowBackground- .ignoresSafeArea()-- Rectangle()- .fill(theme.materials.window)- .ignoresSafeArea()-- ThemedCard(style: .prominent, padding: 0, hoverEffect: false) {- VStack(spacing: 0) {- // Header- VStack(spacing: theme.metrics.spacing.md) {- // App Icon or Logo- Image(nsImage: NSApp.applicationIconImage)- .resizable()- .frame(width: 80, height: 80)- .clipShape(RoundedRectangle(cornerRadius: theme.metrics.corners.lg))- .shadow(color: theme.palette.accent.opacity(0.3), radius: 18, x: 0, y: 8)- .scaleEffect(showContent ? 1 : 0.5)- .opacity(showContent ? 1 : 0)-- Text("What's New in v\(version)")- .font(.system(size: 28, weight: .bold, design: .rounded))- .foregroundStyle(theme.palette.primaryText)- .opacity(showContent ? 1 : 0)- .offset(y: showContent ? 0 : -20)-- Text("FluidVoice keeps getting better")- .font(.system(size: 14, weight: .medium))- .foregroundStyle(theme.palette.secondaryText)- .opacity(showContent ? 1 : 0)- .offset(y: showContent ? 0 : -20)- }- .padding(.top, theme.metrics.spacing.xl)- .padding(.bottom, theme.metrics.spacing.lg)-- // Features List- ScrollView {- VStack(spacing: theme.metrics.spacing.lg) {- ForEach(Array(features.enumerated()), id: \.offset) { index, feature in- FeatureRow(feature: feature)- .opacity(showContent ? 1 : 0)- .offset(y: showContent ? 0 : 24)- .animation(- .spring(response: 0.6, dampingFraction: 0.8)- .delay(Double(index) * 0.1),- value: showContent- )- }- }- .padding(.horizontal, theme.metrics.spacing.xl)- .padding(.vertical, theme.metrics.spacing.md)- }-- // Continue Button- Button("Continue") {- withAnimation(.spring(response: 0.3, dampingFraction: 0.7)) {- SettingsStore.shared.markWhatsNewAsSeen()- dismiss()- }- }- .buttonStyle(PremiumButtonStyle(height: 48))- .buttonHoverEffect()- .padding(.horizontal, theme.metrics.spacing.xl)- .padding(.vertical, theme.metrics.spacing.lg)- .opacity(showContent ? 1 : 0)- }- }- .frame(width: 520, height: 620)- }- .onAppear {- withAnimation(.spring(response: 0.6, dampingFraction: 0.8).delay(0.1)) {- showContent = true- }-- // Fetch release notes from GitHub- Task {- await fetchReleaseNotes()- }- }- }-- // MARK: - GitHub Release Notes Fetching-- private func fetchReleaseNotes() async {- do {- let (fetchedVersion, notes) = try await SimpleUpdater.shared.fetchLatestReleaseNotes(- owner: "altic-dev",- repo: "Fluid-oss"- )-- // Parse release notes into features- let parsedFeatures = parseReleaseNotes(notes)-- await MainActor.run {- if !parsedFeatures.isEmpty {- self.features = parsedFeatures- }- // Update version to match GitHub release- if fetchedVersion.hasPrefix("v") {- self.version = String(fetchedVersion.dropFirst())- } else {- self.version = fetchedVersion- }- self.isLoading = false- }- } catch {- // If GitHub fetch fails, keep the fallback features- print("Failed to fetch release notes: \(error)")- await MainActor.run {- self.isLoading = false- }- }- }-- private func parseReleaseNotes(_ notes: String) -> [WhatsNewFeature] {- var features: [WhatsNewFeature] = []-- print("📝 Parsing release notes:")- print(notes)- print("---")-- // Parse markdown format:- // Expected structure:- // ## What's New in vX.X.X- // ### Section (e.g., "New", "Improvements")- // - Feature item- // - Another feature-- let lines = notes.components(separatedBy: .newlines)- var currentTitle: String?- var currentDescription = ""- var currentSection = "" // Track section headers like "New", "Improvements"-- for line in lines {- let trimmed = line.trimmingCharacters(in: .whitespaces)-- // Skip empty lines- if trimmed.isEmpty {- // Empty line might signal end of current feature- if let title = currentTitle, !title.isEmpty {- let desc = currentDescription.isEmpty ? "New feature or improvement" : currentDescription- features.append(createFeature(title: title, description: desc))- print("✅ Added feature: \(title)")- currentTitle = nil- currentDescription = ""- }- continue- }-- // Skip main heading (## What's New...)- if trimmed.hasPrefix("##") && !trimmed.hasPrefix("###") {- // This is the main title, skip it- continue- }-- // Section headers (### New, ### Improvements, etc.)- if trimmed.hasPrefix("###") {- // Save previous feature if exists- if let title = currentTitle, !title.isEmpty {- let desc = currentDescription.isEmpty ? "New feature or improvement" : currentDescription- features.append(createFeature(title: title, description: desc))- print("✅ Added feature: \(title)")- currentTitle = nil- currentDescription = ""- }-- // This is a section header, not a feature- currentSection = String(trimmed.dropFirst(3)).trimmingCharacters(in: .whitespaces)- print("📂 Section: \(currentSection)")- continue- }-- // Check for bullet points or list items (supporting nested with spaces/tabs)- let bulletPrefixes = ["- ", "* ", "+ ", " - ", " * ", " + ", "\t- ", "\t* ", "\t+ "]- var isBullet = false- var bulletContent = ""-- for prefix in bulletPrefixes {- if trimmed.hasPrefix(prefix) {- isBullet = true- bulletContent = String(trimmed.dropFirst(prefix.count)).trimmingCharacters(in: .whitespaces)- break- }- }-- if isBullet {- // Save previous feature if exists- if let title = currentTitle, !title.isEmpty {- let desc = currentDescription.isEmpty ? "New feature or improvement" : currentDescription- features.append(createFeature(title: title, description: desc))- print("✅ Added feature: \(title)")- }-- // Check if it has a colon (title: description format)- if let colonIndex = bulletContent.firstIndex(of: ":") {- currentTitle = String(bulletContent[..<colonIndex]).trimmingCharacters(in: .whitespaces)- currentDescription = String(bulletContent[bulletContent.index(after: colonIndex)...]).trimmingCharacters(in: .whitespaces)- } else {- // Entire content is the title, use section as context for description- currentTitle = bulletContent- // If we have a section context and no description, use it- if !currentSection.isEmpty {- currentDescription = currentSection- } else {- currentDescription = ""- }- }- }- // Continuation of description (only if we have a current item and not starting a new section)- else if let title = currentTitle, !title.isEmpty, !trimmed.hasPrefix("#") {- // Add to description if it's a continuation- if currentDescription == currentSection {- // Replace section placeholder with actual description- currentDescription = trimmed- } else {- if !currentDescription.isEmpty && currentDescription != currentSection {- currentDescription += " "- }- currentDescription += trimmed- }- }- }-- // Add last feature if exists- if let title = currentTitle, !title.isEmpty {- let desc = currentDescription.isEmpty || currentDescription == currentSection ? "New feature or improvement" : currentDescription- features.append(createFeature(title: title, description: desc))- print("✅ Added feature: \(title)")- }-- print("📊 Total features parsed: \(features.count)")-- return features- }-- private func createFeature(title: String, description: String) -> WhatsNewFeature {- // Determine icon based on keywords in title- let lowerTitle = title.lowercased()- let icon: String-- if lowerTitle.contains("fix") || lowerTitle.contains("bug") {- icon = "checkmark.circle"- } else if lowerTitle.contains("performance") || lowerTitle.contains("faster") || lowerTitle.contains("speed") {- icon = "bolt.fill"- } else if lowerTitle.contains("new") || lowerTitle.contains("add") || lowerTitle.contains("feature") {- icon = "sparkles"- } else if lowerTitle.contains("audio") || lowerTitle.contains("sound") || lowerTitle.contains("microphone") {- icon = "waveform"- } else if lowerTitle.contains("ui") || lowerTitle.contains("design") || lowerTitle.contains("interface") {- icon = "paintbrush.fill"- } else if lowerTitle.contains("setting") || lowerTitle.contains("option") || lowerTitle.contains("config") {- icon = "gearshape.2"- } else if lowerTitle.contains("update") || lowerTitle.contains("improve") {- icon = "arrow.up.circle"- } else {- icon = "star.fill"- }-- return WhatsNewFeature(icon: icon, title: title, description: description.isEmpty ? title : description)- }-}--struct FeatureRow: View {- let feature: WhatsNewFeature- @Environment(\.theme) private var theme-- var body: some View {- ThemedCard(style: .subtle, hoverEffect: false) {- HStack(alignment: .top, spacing: theme.metrics.spacing.md) {- ZStack {- Circle()- .fill(theme.palette.accent.opacity(0.12))- .frame(width: 46, height: 46)- .overlay(- Circle()- .stroke(theme.palette.accent.opacity(0.2), lineWidth: 1)- )-- Image(systemName: feature.icon)- .font(.system(size: 21, weight: .medium))- .foregroundStyle(theme.palette.accent)- }-- VStack(alignment: .leading, spacing: theme.metrics.spacing.xs) {- Text(feature.title)- .font(.system(size: 16, weight: .semibold))- .foregroundStyle(theme.palette.primaryText)-- Text(feature.description)- .font(.system(size: 14, weight: .regular))- .foregroundStyle(theme.palette.secondaryText)- .fixedSize(horizontal: false, vertical: true)- }-- Spacer()- }- }- }-}--struct WhatsNewFeature {- let icon: String- let title: String- let description: String-}--#Preview {- WhatsNewView()-}-diff --git a/Sources/Fluid/Views/CommandModeView.swift b/Sources/Fluid/Views/CommandModeView.swiftindex cbe68949..5782ed5b 100644--- a/Sources/Fluid/Views/CommandModeView.swift+++ b/Sources/Fluid/Views/CommandModeView.swift@@ -13,6 +13,8 @@ struct CommandModeView: View {// UI State@State private var showingClearConfirmation = false+ @State private var showHowTo = false+ @State private var isHoveringHowTo = false@Environment(\.theme) private var theme@@ -21,6 +23,9 @@ struct CommandModeView: View {// HeaderheaderView+ // How To (collapsible)+ howToSection+Divider()// Chat Area@@ -38,13 +43,9 @@ struct CommandModeView: View {}.onAppear {updateAvailableModels()- // Set overlay mode to command when this view appears- menuBarManager.setOverlayMode(.command)- }- .onDisappear {- // Reset overlay mode to dictation when leaving- menuBarManager.setOverlayMode(.dictation)+ // Note: Overlay mode is now set centrally by ContentView.handleModeTransition()}+ // Note: onDisappear overlay mode handling removed - now handled centrally by ContentView.onChange(of: asr.finalText) { newText inif !newText.isEmpty {inputText = newText@@ -62,9 +63,20 @@ struct CommandModeView: View {private var headerView: some View {HStack {- Text("Command Mode")- .font(.title2)- .fontWeight(.bold)+ HStack(spacing: 8) {+ Text("Command Mode")+ .font(.title2)+ .fontWeight(.bold)++ Text("Alpha")+ .font(.caption2)+ .fontWeight(.semibold)+ .foregroundStyle(.white)+ .padding(.horizontal, 6)+ .padding(.vertical, 2)+ .background(Color(red: 1.0, green: 0.35, blue: 0.35)) // Command mode red+ .cornerRadius(4)+ }Spacer()@@ -135,6 +147,109 @@ struct CommandModeView: View {}}+ // MARK: - How To Section++ private var shortcutDisplay: String {+ settings.commandModeHotkeyShortcut.displayString+ }++ private var howToSection: some View {+ VStack(spacing: 0) {+ // Toggle button with hover effect+ Button(action: { withAnimation(.easeInOut(duration: 0.2)) { showHowTo.toggle() } }) {+ HStack {+ Image(systemName: "questionmark.circle")+ .font(.caption)+ Text("How to use")+ .font(.caption)+ Spacer()+ Image(systemName: showHowTo ? "chevron.up" : "chevron.down")+ .font(.caption2)+ }+ .foregroundStyle(isHoveringHowTo ? .primary : .secondary)+ .padding(.horizontal, 16)+ .padding(.vertical, 8)+ .background(isHoveringHowTo ? Color.primary.opacity(0.05) : Color.clear)+ .cornerRadius(4)+ }+ .buttonStyle(.plain)+ .onHover { hovering in+ withAnimation(.easeInOut(duration: 0.15)) { isHoveringHowTo = hovering }+ }++ if showHowTo {+ VStack(alignment: .leading, spacing: 12) {+ // Start section+ VStack(alignment: .leading, spacing: 4) {+ Text("Getting Started")+ .font(.caption)+ .fontWeight(.semibold)+ .foregroundStyle(.secondary)++ HStack(spacing: 4) {+ Text("Press")+ .font(.caption)+ Text(shortcutDisplay)+ .font(.caption)+ .fontWeight(.medium)+ .padding(.horizontal, 6)+ .padding(.vertical, 2)+ .background(Color.primary.opacity(0.1))+ .cornerRadius(4)+ Text("to open Command Mode, speak your command, then press again to send.")+ .font(.caption)+ }+ .foregroundStyle(.primary.opacity(0.8))+ }++ // Examples+ VStack(alignment: .leading, spacing: 4) {+ Text("Examples")+ .font(.caption)+ .fontWeight(.semibold)+ .foregroundStyle(.secondary)++ VStack(alignment: .leading, spacing: 4) {+ howToItem("\"List files in my Downloads folder\"")+ howToItem("\"Create a folder called Projects on Desktop\"")+ howToItem("\"What's my IP address?\"")+ howToItem("\"Open Safari\"")+ }+ }++ // Caution note+ VStack(alignment: .leading, spacing: 4) {+ HStack(spacing: 4) {+ Image(systemName: "exclamationmark.triangle.fill")+ .foregroundStyle(.orange)+ Text("Caution")+ .fontWeight(.semibold)+ }+ .font(.caption)++ Text("AI can make mistakes. Avoid dangerous commands like deleting important files. Destructive actions will ask for confirmation.")+ .font(.caption)+ .foregroundStyle(.secondary)+ }+ }+ .padding(.horizontal, 16)+ .padding(.bottom, 12)+ .transition(.opacity.combined(with: .move(edge: .top)))+ }+ }+ .background(Color(nsColor: .windowBackgroundColor).opacity(0.5))+ }++ private func howToItem(_ text: String) -> some View {+ HStack(spacing: 6) {+ Text("•")+ .foregroundStyle(.secondary)+ Text(text)+ .font(.caption)+ .foregroundStyle(.primary.opacity(0.8))+ }+ }+// MARK: - Chat Areaprivate var chatArea: some View {@@ -147,8 +262,15 @@ struct CommandModeView: View {}if service.isProcessing {- processingIndicator- .id("processing")+ VStack(alignment: .leading, spacing: 8) {+ processingIndicator++ // Show streaming text in real-time+ if !service.streamingText.isEmpty {+ streamingTextView+ }+ }+ .id("processing")}Color.clear.frame(height: 1).id("bottom")@@ -158,12 +280,16 @@ struct CommandModeView: View {.onChange(of: service.conversationHistory.count) { _ inscrollToBottom(proxy)}- .onChange(of: service.isProcessing) { _ in- scrollToBottom(proxy)+ .onChange(of: service.isProcessing) { isProcessing in+ // Scroll when processing starts, not on every streaming update+ if isProcessing {+ scrollToBottom(proxy)+ }}.onChange(of: service.currentStep) { _ inscrollToBottom(proxy)}+ // Removed: .onChange(of: service.streamingText) - causes scroll on every token, too expensive}}@@ -177,6 +303,22 @@ struct CommandModeView: View {.cornerRadius(6)}+ // MARK: - Streaming Text View (Real-time AI response)++ private var streamingTextView: some View {+ // Use fixedSize to prevent expensive re-layout on every update+ Text(service.streamingText)+ .font(.system(size: 13))+ .foregroundStyle(.primary.opacity(0.9))+ .padding(.horizontal, 12)+ .padding(.vertical, 10)+ .frame(maxWidth: 520, alignment: .leading)+ .background(Color(nsColor: .textBackgroundColor).opacity(0.5))+ .cornerRadius(8)+ .drawingGroup() // Flatten to bitmap for faster updates+ // textSelection disabled during streaming - re-enabled in final message+ }+private var currentStepLabel: String {guard let step = service.currentStep else { return "Working..." }switch step {diff --git a/Sources/Fluid/Views/NotchContentViews.swift b/Sources/Fluid/Views/NotchContentViews.swiftindex 66775d89..5b5280a0 100644--- a/Sources/Fluid/Views/NotchContentViews.swift+++ b/Sources/Fluid/Views/NotchContentViews.swift@@ -22,6 +22,31 @@ class NotchContentState: ObservableObject {@Published private(set) var cachedLine1: String = ""@Published private(set) var cachedLine2: String = ""+ // MARK: - Expanded Command Output State+ @Published var isExpandedForCommandOutput: Bool = false+ @Published var commandOutput: String = "" // Final or streaming output+ @Published var commandStreamingText: String = "" // Real-time streaming text+ @Published var commandInputText: String = "" // User's follow-up input+ @Published var commandConversationHistory: [CommandOutputMessage] = []+ @Published var isCommandProcessing: Bool = false++ // Command output message model+ struct CommandOutputMessage: Identifiable, Equatable {+ let id = UUID()+ let role: Role+ let content: String+ let timestamp: Date = Date()++ enum Role: Equatable {+ case user+ case assistant+ case status // For "Running...", "Checking...", etc.+ }+ }++ // Callback for submitting follow-up commands from the notch+ var onSubmitFollowUp: ((String) async -> Void)?+private init() {}/// Set AI processing state@@ -64,6 +89,65 @@ class NotchContentState: ObservableObject {cachedLine2 = words[midPoint...].joined(separator: " ")}}++ // MARK: - Recording State for Expanded View+ @Published var isRecordingInExpandedMode: Bool = false+ @Published var expandedModeAudioLevel: CGFloat = 0 // Audio level for waveform in expanded mode++ /// Set recording state (for waveform visibility in expanded view)+ func setRecordingInExpandedMode(_ recording: Bool) {+ isRecordingInExpandedMode = recording+ if !recording {+ expandedModeAudioLevel = 0+ }+ }++ /// Update audio level for expanded mode waveform+ func updateExpandedModeAudioLevel(_ level: CGFloat) {+ guard isRecordingInExpandedMode else { return }+ expandedModeAudioLevel = level+ }++ // MARK: - Command Output Methods++ /// Show expanded output view with content+ func showExpandedCommandOutput(output: String) {+ commandOutput = output+ commandStreamingText = ""+ isExpandedForCommandOutput = true+ isRecordingInExpandedMode = false // Not recording when first showing output+ }++ /// Update streaming text in real-time+ func updateCommandStreamingText(_ text: String) {+ commandStreamingText = text+ }++ /// Add a message to the conversation history+ func addCommandMessage(role: CommandOutputMessage.Role, content: String) {+ let message = CommandOutputMessage(role: role, content: content)+ commandConversationHistory.append(message)+ }++ /// Set command processing state+ func setCommandProcessing(_ processing: Bool) {+ isCommandProcessing = processing+ }++ /// Clear command output and hide expanded view+ func clearCommandOutput() {+ isExpandedForCommandOutput = false+ commandOutput = ""+ commandStreamingText = ""+ commandInputText = ""+ commandConversationHistory.removeAll()+ isCommandProcessing = false+ }++ /// Hide expanded view but keep history+ func collapseCommandOutput() {+ isExpandedForCommandOutput = false+ }}// MARK: - Shared Mode Color Helper@@ -129,7 +213,7 @@ struct NotchExpandedView: View {private var modeLabel: String {switch contentState.mode {case .dictation: return "Dictate"- case .rewrite: return "Write"+ case .rewrite: return "Rewrite"case .write: return "Write"case .command: return "Command"}@@ -148,6 +232,11 @@ struct NotchExpandedView: View {!contentState.transcriptionText.isEmpty}+ // Check if there's command history that can be expanded+ private var canExpandCommandHistory: Bool {+ contentState.mode == .command && !contentState.commandConversationHistory.isEmpty+ }+var body: some View {VStack(spacing: 4) {// Visualization + Mode label row@@ -183,6 +272,13 @@ struct NotchExpandedView: View {.padding(.horizontal, 8).padding(.vertical, 6).background(Color.black)+ .contentShape(Rectangle()) // Make entire area tappable+ .onTapGesture {+ // If in command mode with history, clicking expands the conversation+ if canExpandCommandHistory {+ NotchOverlayManager.shared.onNotchClicked?()+ }+ }.animation(.spring(response: 0.25, dampingFraction: 0.8), value: hasTranscription).animation(.easeInOut(duration: 0.2), value: contentState.mode).animation(.easeInOut(duration: 0.25), value: contentState.isProcessing)@@ -357,3 +453,387 @@ struct NotchCompactTrailingView: View {.onDisappear { isPulsing = false }}}++// MARK: - Expanded Command Output View (Interactive Notch)++struct NotchCommandOutputExpandedView: View {+ let audioPublisher: AnyPublisher<CGFloat, Never>+ let onDismiss: () -> Void+ let onSubmit: (String) async -> Void++ @ObservedObject private var contentState = NotchContentState.shared+ @State private var inputText: String = ""+ @FocusState private var isInputFocused: Bool+ @State private var scrollProxy: ScrollViewProxy?++ private let commandRed = Color(red: 1.0, green: 0.35, blue: 0.35)++ // Dynamic height based on content (max half screen)+ private var dynamicHeight: CGFloat {+ let baseHeight: CGFloat = 120 // Minimum height+ let contentHeight = estimateContentHeight()+ let maxHeight = (NSScreen.main?.frame.height ?? 800) * 0.45 // 45% of screen+ return min(max(baseHeight, contentHeight), maxHeight)+ }++ private func estimateContentHeight() -> CGFloat {+ var height: CGFloat = 80 // Header + input area++ // Estimate based on conversation history+ for message in contentState.commandConversationHistory {+ let lineCount = max(1, message.content.count / 60) // ~60 chars per line+ height += CGFloat(lineCount) * 18 + 16 // Line height + padding+ }++ // Add streaming text height+ if !contentState.commandStreamingText.isEmpty {+ let lineCount = max(1, contentState.commandStreamingText.count / 60)+ height += CGFloat(lineCount) * 18 + 16+ }++ return height+ }++ var body: some View {+ VStack(spacing: 0) {+ // Header with waveform and dismiss+ headerView++ // Transcription preview (shown while recording)+ transcriptionPreview++ Divider()+ .background(commandRed.opacity(0.3))++ // Scrollable conversation area+ conversationArea++ // Input area for follow-up commands+ inputArea+ }+ .frame(width: 380, height: dynamicHeight)+ .background(Color.black)+ .clipShape(RoundedRectangle(cornerRadius: 16))+ .animation(.spring(response: 0.3, dampingFraction: 0.8), value: contentState.commandConversationHistory.count)+ // No animation on streamingText - it updates too frequently, animations add overhead+ .animation(.spring(response: 0.25, dampingFraction: 0.8), value: contentState.isRecordingInExpandedMode)+ }++ // MARK: - Header++ private var headerView: some View {+ ZStack {+ // Centered content: Waveform + Mode label+ HStack(spacing: 6) {+ // Waveform - only show when recording, otherwise show static indicator+ if contentState.isRecordingInExpandedMode {+ ExpandedModeWaveformView(color: commandRed)+ .frame(width: 50, height: 18)+ } else {+ // Static indicator when not recording+ HStack(spacing: 3) {+ ForEach(0..<5, id: \.self) { _ in+ RoundedRectangle(cornerRadius: 1.5)+ .fill(commandRed.opacity(0.4))+ .frame(width: 3, height: 6)+ }+ }+ .frame(width: 50, height: 18)+ }++ // Mode label+ if contentState.isRecordingInExpandedMode {+ Text("Listening...")+ .font(.system(size: 11, weight: .medium))+ .foregroundStyle(commandRed)+ } else if contentState.isCommandProcessing {+ ShimmerText(text: "Working...", color: commandRed)+ } else {+ Text("Command")+ .font(.system(size: 11, weight: .medium))+ .foregroundStyle(commandRed.opacity(0.7))+ }+ }++ // Right-aligned dismiss button - styled red with hover effect+ HStack {+ Spacer()+ Button(action: onDismiss) {+ ZStack {+ Circle()+ .fill(commandRed.opacity(0.15))+ .frame(width: 24, height: 24)+ Image(systemName: "xmark")+ .font(.system(size: 10, weight: .bold))+ .foregroundStyle(commandRed.opacity(0.8))+ }+ }+ .buttonStyle(.plain)+ .contentShape(Circle())+ .frame(width: 32, height: 32) // Larger hit area+ .help("Close (Escape)")+ }+ }+ .padding(.horizontal, 12)+ .padding(.vertical, 8)+ }++ // MARK: - Transcription Preview (shown while recording)++ private var transcriptionPreview: some View {+ Group {+ if contentState.isRecordingInExpandedMode && !contentState.transcriptionText.isEmpty {+ VStack(spacing: 2) {+ if !contentState.cachedLine1.isEmpty {+ Text(contentState.cachedLine1)+ .font(.system(size: 10, weight: .regular))+ .foregroundStyle(.white.opacity(0.5))+ .lineLimit(1)+ }+ Text(contentState.cachedLine2)+ .font(.system(size: 11, weight: .medium))+ .foregroundStyle(.white.opacity(0.75))+ .lineLimit(1)+ }+ .frame(maxWidth: .infinity)+ .padding(.horizontal, 12)+ .padding(.vertical, 6)+ .background(commandRed.opacity(0.1))+ .transition(.opacity.combined(with: .scale(scale: 0.98)))+ }+ }+ .animation(.easeInOut(duration: 0.2), value: contentState.isRecordingInExpandedMode)+ .animation(.easeInOut(duration: 0.15), value: contentState.transcriptionText)+ }++ // MARK: - Conversation Area++ private var conversationArea: some View {+ ScrollViewReader { proxy in+ ScrollView(.vertical, showsIndicators: true) {+ LazyVStack(alignment: .leading, spacing: 8) {+ ForEach(contentState.commandConversationHistory) { message in+ messageView(for: message)+ .id(message.id)+ }++ // Streaming text (real-time)+ if !contentState.commandStreamingText.isEmpty {+ streamingMessageView+ .id("streaming")+ }++ // Processing indicator+ if contentState.isCommandProcessing && contentState.commandStreamingText.isEmpty {+ processingIndicator+ .id("processing")+ }++ Color.clear.frame(height: 1).id("bottom")+ }+ .padding(.horizontal, 12)+ .padding(.vertical, 8)+ }+ .onAppear {+ scrollProxy = proxy+ // Always scroll to bottom when view appears+ scrollToBottom(proxy, animated: false)+ }+ .onChange(of: contentState.commandConversationHistory.count) { _ in+ scrollToBottom(proxy, animated: true)+ }+ .onChange(of: contentState.commandStreamingText) { _ in+ scrollToBottom(proxy, animated: true)+ }+ .onChange(of: contentState.isCommandProcessing) { _ in+ // Scroll when processing state changes+ scrollToBottom(proxy, animated: true)+ }+ }+ }++ private func scrollToBottom(_ proxy: ScrollViewProxy, animated: Bool = true) {+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {+ if animated {+ withAnimation(.easeOut(duration: 0.15)) {+ proxy.scrollTo("bottom", anchor: .bottom)+ }+ } else {+ proxy.scrollTo("bottom", anchor: .bottom)+ }+ }+ }++ // MARK: - Message Views++ private func messageView(for message: NotchContentState.CommandOutputMessage) -> some View {+ HStack(alignment: .top, spacing: 6) {+ switch message.role {+ case .user:+ Spacer()+ Text(message.content)+ .font(.system(size: 11))+ .foregroundStyle(.white.opacity(0.9))+ .padding(.horizontal, 10)+ .padding(.vertical, 6)+ .background(commandRed.opacity(0.25))+ .cornerRadius(8)+ .frame(maxWidth: 280, alignment: .trailing)+ .textSelection(.enabled)++ case .assistant:+ Text(message.content)+ .font(.system(size: 11))+ .foregroundStyle(.white.opacity(0.85))+ .padding(.horizontal, 10)+ .padding(.vertical, 6)+ .background(Color.white.opacity(0.08))+ .cornerRadius(8)+ .frame(maxWidth: 320, alignment: .leading)+ .textSelection(.enabled)+ Spacer()++ case .status:+ HStack(spacing: 4) {+ Circle()+ .fill(commandRed.opacity(0.6))+ .frame(width: 4, height: 4)+ Text(message.content)+ .font(.system(size: 10, weight: .medium))+ .foregroundStyle(.white.opacity(0.5))+ }+ .padding(.vertical, 2)+ Spacer()+ }+ }+ }++ private var streamingMessageView: some View {+ HStack(alignment: .top) {+ Text(contentState.commandStreamingText)+ .font(.system(size: 11))+ .foregroundStyle(.white.opacity(0.85))+ .padding(.horizontal, 10)+ .padding(.vertical, 6)+ .background(Color.white.opacity(0.08))+ .cornerRadius(8)+ .frame(maxWidth: 320, alignment: .leading)+ .drawingGroup() // Flatten to bitmap for faster streaming updates+ // textSelection disabled during streaming for performance+ Spacer()+ }+ }++ private var processingIndicator: some View {+ HStack(spacing: 6) {+ ForEach(0..<3, id: \.self) { index in+ Circle()+ .fill(commandRed.opacity(0.6))+ .frame(width: 4, height: 4)+ .offset(y: processingOffset(for: index))+ }+ }+ .padding(.vertical, 4)+ }++ @State private var processingAnimation = false++ private func processingOffset(for index: Int) -> CGFloat {+ // Offset varies by index for staggered animation effect+ _ = Double(index) * 0.15 // Reserved for future animation timing+ return processingAnimation ? -3 : 3+ }++ // MARK: - Input Area++ private var inputArea: some View {+ HStack(spacing: 8) {+ TextField("Ask follow-up...", text: $inputText)+ .textFieldStyle(.plain)+ .font(.system(size: 11))+ .foregroundStyle(.white)+ .padding(.horizontal, 10)+ .padding(.vertical, 6)+ .background(Color.white.opacity(0.08))+ .cornerRadius(8)+ .focused($isInputFocused)+ .onSubmit {+ submitFollowUp()+ }++ Button(action: submitFollowUp) {+ Image(systemName: "arrow.up.circle.fill")+ .font(.system(size: 16))+ .foregroundStyle(inputText.isEmpty ? .white.opacity(0.3) : commandRed)+ }+ .buttonStyle(.plain)+ .disabled(inputText.isEmpty || contentState.isCommandProcessing)+ }+ .padding(.horizontal, 12)+ .padding(.vertical, 8)+ .background(Color.white.opacity(0.03))+ }++ private func submitFollowUp() {+ guard !inputText.isEmpty else { return }+ let text = inputText+ inputText = ""++ Task {+ await onSubmit(text)+ }+ }+}++// MARK: - Expanded Mode Waveform (Reads from NotchContentState)++struct ExpandedModeWaveformView: View {+ let color: Color++ @ObservedObject private var contentState = NotchContentState.shared+ @State private var barHeights: [CGFloat] = Array(repeating: 3, count: 5)++ private let barCount = 5+ private let barWidth: CGFloat = 3+ private let barSpacing: CGFloat = 3+ private let minHeight: CGFloat = 4+ private let maxHeight: CGFloat = 16+ private let noiseThreshold: CGFloat = 0.05++ var body: some View {+ HStack(spacing: barSpacing) {+ ForEach(0..<barCount, id: \.self) { index in+ RoundedRectangle(cornerRadius: barWidth / 2)+ .fill(color)+ .frame(width: barWidth, height: barHeights[index])+ .shadow(color: color.opacity(0.4), radius: 2, x: 0, y: 0)+ }+ }+ .onChange(of: contentState.expandedModeAudioLevel) { level in+ updateBars(level: level)+ }+ .onAppear {+ updateBars(level: contentState.expandedModeAudioLevel)+ }+ }++ private func updateBars(level: CGFloat) {+ let normalizedLevel = min(max(level, 0), 1)+ let isActive = normalizedLevel > noiseThreshold++ withAnimation(.spring(response: 0.12, dampingFraction: 0.6)) {+ for i in 0..<barCount {+ let centerDistance = abs(CGFloat(i) - CGFloat(barCount - 1) / 2)+ let centerFactor = 1.0 - (centerDistance / CGFloat(barCount / 2)) * 0.35++ if isActive {+ let adjustedLevel = (normalizedLevel - noiseThreshold) / (1.0 - noiseThreshold)+ let randomVariation = CGFloat.random(in: 0.75...1.0)+ barHeights[i] = minHeight + (maxHeight - minHeight) * adjustedLevel * centerFactor * randomVariation+ } else {+ barHeights[i] = minHeight+ }+ }+ }+ }+}diff --git a/Sources/Fluid/Views/RewriteModeView.swift b/Sources/Fluid/Views/RewriteModeView.swiftindex a1a258d3..2c231ade 100644--- a/Sources/Fluid/Views/RewriteModeView.swift+++ b/Sources/Fluid/Views/RewriteModeView.swift@@ -9,6 +9,8 @@ struct RewriteModeView: View {@State private var inputText: String = ""@State private var showOriginal: Bool = true+ @State private var showHowTo: Bool = false+ @State private var isHoveringHowTo: Bool = false// Local state for available models (derived from shared AI Settings pool)@State private var availableModels: [String] = []@@ -79,6 +81,9 @@ struct RewriteModeView: View {.padding().background(Color(nsColor: .windowBackgroundColor))+ // How To (collapsible)+ howToSection+Divider()ScrollView {@@ -222,14 +227,10 @@ struct RewriteModeView: View {onClose?()}.onAppear {- // Set overlay mode to rewrite when this view appears- menuBarManager.setOverlayMode(.rewrite)+ // Note: Overlay mode is now set centrally by ContentView.handleModeTransition()updateAvailableModels()}- .onDisappear {- // Reset overlay mode to dictation when leaving- menuBarManager.setOverlayMode(.dictation)- }+ // Note: onDisappear overlay mode handling removed - now handled centrally by ContentView}private func toggleRecording() {@@ -310,4 +311,107 @@ struct RewriteModeView: View {default: return ["gpt-4o"]}}++ // MARK: - How To Section++ private var shortcutDisplay: String {+ settings.rewriteModeHotkeyShortcut.displayString+ }++ private var howToSection: some View {+ VStack(spacing: 0) {+ // Toggle button with hover effect+ Button(action: { withAnimation(.easeInOut(duration: 0.2)) { showHowTo.toggle() } }) {+ HStack {+ Image(systemName: "questionmark.circle")+ .font(.caption)+ Text("How to use")+ .font(.caption)+ Spacer()+ Image(systemName: showHowTo ? "chevron.up" : "chevron.down")+ .font(.caption2)+ }+ .foregroundStyle(isHoveringHowTo ? .primary : .secondary)+ .padding(.horizontal, 16)+ .padding(.vertical, 8)+ .background(isHoveringHowTo ? Color.primary.opacity(0.05) : Color.clear)+ .cornerRadius(4)+ }+ .buttonStyle(.plain)+ .onHover { hovering in+ withAnimation(.easeInOut(duration: 0.15)) { isHoveringHowTo = hovering }+ }++ if showHowTo {+ VStack(alignment: .leading, spacing: 12) {+ // Write fresh+ VStack(alignment: .leading, spacing: 4) {+ Text("To Write Fresh")+ .font(.caption)+ .fontWeight(.semibold)+ .foregroundStyle(.secondary)++ HStack(spacing: 4) {+ Text("Press")+ .font(.caption)+ Text(shortcutDisplay)+ .font(.caption)+ .fontWeight(.medium)+ .padding(.horizontal, 6)+ .padding(.vertical, 2)+ .background(Color.primary.opacity(0.1))+ .cornerRadius(4)+ Text("and speak what you want to write.")+ .font(.caption)+ }+ .foregroundStyle(.primary.opacity(0.8))++ howToItem("\"Write an email asking for time off\"")+ howToItem("\"Draft a thank you note\"")+ }++ // Rewrite+ VStack(alignment: .leading, spacing: 4) {+ Text("To Rewrite/Edit")+ .font(.caption)+ .fontWeight(.semibold)+ .foregroundStyle(.secondary)++ HStack(spacing: 4) {+ Text("Select text first, then press")+ .font(.caption)+ Text(shortcutDisplay)+ .font(.caption)+ .fontWeight(.medium)+ .padding(.horizontal, 6)+ .padding(.vertical, 2)+ .background(Color.primary.opacity(0.1))+ .cornerRadius(4)+ Text("and speak your instruction.")+ .font(.caption)+ }+ .foregroundStyle(.primary.opacity(0.8))++ howToItem("\"Make this more formal\"")+ howToItem("\"Fix grammar and spelling\"")+ howToItem("\"Summarize this\"")+ }+ }+ .padding(.horizontal, 16)+ .padding(.bottom, 12)+ .transition(.opacity.combined(with: .move(edge: .top)))+ }+ }+ .background(Color(nsColor: .windowBackgroundColor).opacity(0.5))+ }++ private func howToItem(_ text: String) -> some View {+ HStack(spacing: 6) {+ Text("•")+ .foregroundStyle(.secondary)+ Text(text)+ .font(.caption)+ .foregroundStyle(.primary.opacity(0.8))+ }+ }}diff --git a/Sources/Fluid/fluidApp.swift b/Sources/Fluid/fluidApp.swiftindex 297e39b2..67ddd8a5 100644--- a/Sources/Fluid/fluidApp.swift+++ b/Sources/Fluid/fluidApp.swift@@ -13,7 +13,6 @@ import ApplicationServicesstruct fluidApp: App {@StateObject private var menuBarManager = MenuBarManager()@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate- @State private var showWhatsNew = false@State private var theme = AppTheme.darkvar body: some Scene {@@ -22,19 +21,6 @@ struct fluidApp: App {.environmentObject(menuBarManager).appTheme(theme).preferredColorScheme(.dark)- .sheet(isPresented: $showWhatsNew) {- WhatsNewView()- .appTheme(theme)- }- .onAppear {- // Check if we should show what's new after a short delay- DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {- showWhatsNew = SettingsStore.shared.shouldShowWhatsNew()- }- }- .onReceive(NotificationCenter.default.publisher(for: NSNotification.Name("ShowWhatsNew"))) { _ in- showWhatsNew = true- }}.defaultSize(width: 1000, height: 700).windowResizability(.contentSize)