diff --git a/src/AppDelegate.swift b/src/AppDelegate.swift index ff54476..6bba85b 100644 --- a/src/AppDelegate.swift +++ b/src/AppDelegate.swift @@ -81,8 +81,8 @@ public final class AppDelegate: NSObject, NSApplicationDelegate { } } self.pendingStopWorkItem = workItem - // Trailing grace period: 0.5s (500ms) buffer so trailing words/syllables are never clipped - DispatchQueue.main.asyncAfter(deadline: .now() + 0.50, execute: workItem) + // Trailing grace period: 1.0s (1000ms) buffer so trailing words/syllables right up to key release are never clipped + DispatchQueue.main.asyncAfter(deadline: .now() + 1.00, execute: workItem) } } } @@ -338,7 +338,7 @@ public final class AppDelegate: NSObject, NSApplicationDelegate { // Dynamic safety timeout watchdog: scale with audio length & network transit let durationSec = Double(pcmData.count) / 32000.0 - let finalizeTimeout = max(4.0, min(16.0, durationSec * 0.25 + 3.5)) + let finalizeTimeout = InputBoxManager.shared.hasStreamedText ? 0.8 : max(1.2, min(4.0, durationSec * 0.15 + 1.2)) let watchdog = DispatchWorkItem { [weak self] in guard let self = self, self.isBusyFinalizing else { return } diff --git a/src/HUDOverlay.swift b/src/HUDOverlay.swift index 22e66d3..25e4633 100644 --- a/src/HUDOverlay.swift +++ b/src/HUDOverlay.swift @@ -99,7 +99,7 @@ public final class HUDOverlayController { case .success: orb.showSuccessState() - DispatchQueue.main.asyncAfter(deadline: .now() + 0.45) { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.20) { self.hide() } diff --git a/src/SonioxClient.swift b/src/SonioxClient.swift index 624f7a0..2f87216 100644 --- a/src/SonioxClient.swift +++ b/src/SonioxClient.swift @@ -191,14 +191,14 @@ public final class SonioxLiveSession { } } - // Safety timeout fallback: finalize must complete within 3.5s - DispatchQueue.global().asyncAfter(deadline: .now() + 3.5) { [weak self] in + // Fast safety timeout fallback: finalize must complete within 1.0s + DispatchQueue.global().asyncAfter(deadline: .now() + 1.0) { [weak self] in guard let self = self else { return } self.lock.lock() let stillOpen = !self.isClosed self.lock.unlock() if stillOpen { - print("SonioxLiveSession: Finalize timeout reached — completing.") + print("SonioxLiveSession: Finalize timeout (1.0s) reached — completing.") self.completeWithCurrentText() } }