YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(app): silence macos SCK audio drop spam
Louis Beaumont99c5daf2c306
diff --git a/Cargo.lock b/Cargo.lockindex 0656b66ce..60e6d70f2 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -260,7 +260,7 @@ version = "1.1.5"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"dependencies = [- "windows-sys 0.60.2",+ "windows-sys 0.61.2",][[package]]@@ -271,7 +271,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"dependencies = ["anstyle","once_cell_polyfill",- "windows-sys 0.60.2",+ "windows-sys 0.61.2",][[package]]@@ -322,7 +322,7 @@ dependencies = ["objc2-foundation","parking_lot","percent-encoding",- "windows-sys 0.52.0",+ "windows-sys 0.59.0","x11rb",]@@ -1807,10 +1807,10 @@ dependencies = [[[package]]name = "cpal"version = "0.15.3"-source = "git+https://github.com/screenpipe/cpal.git?rev=99f7c0f175217b5e47e4e454acbc02089d1fdd29#99f7c0f175217b5e47e4e454acbc02089d1fdd29"+source = "git+https://github.com/screenpipe/cpal.git?rev=c7a610aee5c6037c9c69dc5bf7f2a850da8d8b12#c7a610aee5c6037c9c69dc5bf7f2a850da8d8b12"dependencies = ["alsa",- "cidre 0.15.1 (git+https://github.com/yury/cidre.git)",+ "cidre 0.15.1 (git+https://github.com/yury/cidre.git?rev=8481f3f0dc7dd39bb5be80d9424bfac0cad3801a)","core-foundation-sys","coreaudio-rs","dasp_sample",@@ -2449,7 +2449,7 @@ dependencies = ["libc","option-ext","redox_users 0.5.2",- "windows-sys 0.60.2",+ "windows-sys 0.59.0",][[package]]@@ -2830,7 +2830,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"dependencies = ["libc",- "windows-sys 0.52.0",+ "windows-sys 0.59.0",][[package]]@@ -4471,7 +4471,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46"dependencies = ["hermit-abi","libc",- "windows-sys 0.52.0",+ "windows-sys 0.59.0",][[package]]@@ -5538,7 +5538,7 @@ version = "0.50.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"dependencies = [- "windows-sys 0.60.2",+ "windows-sys 0.59.0",][[package]]@@ -6888,7 +6888,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d"dependencies = ["anyhow",- "itertools 0.10.5",+ "itertools 0.12.1","proc-macro2","quote","syn 2.0.117",@@ -7033,7 +7033,7 @@ dependencies = ["once_cell","socket2 0.5.10","tracing",- "windows-sys 0.52.0",+ "windows-sys 0.59.0",][[package]]@@ -7764,7 +7764,7 @@ dependencies = ["errno","libc","linux-raw-sys 0.4.15",- "windows-sys 0.52.0",+ "windows-sys 0.59.0",][[package]]@@ -7777,7 +7777,7 @@ dependencies = ["errno","libc","linux-raw-sys 0.12.1",- "windows-sys 0.52.0",+ "windows-sys 0.59.0",][[package]]@@ -7856,7 +7856,7 @@ dependencies = ["security-framework","security-framework-sys","webpki-root-certs",- "windows-sys 0.52.0",+ "windows-sys 0.59.0",][[package]]@@ -9139,7 +9139,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e"dependencies = ["libc",- "windows-sys 0.60.2",+ "windows-sys 0.61.2",][[package]]@@ -9886,7 +9886,7 @@ dependencies = ["getrandom 0.4.2","once_cell","rustix 1.1.4",- "windows-sys 0.52.0",+ "windows-sys 0.59.0",][[package]]@@ -10636,7 +10636,7 @@ checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e"dependencies = ["memoffset","tempfile",- "windows-sys 0.60.2",+ "windows-sys 0.61.2",][[package]]diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lockindex b7d706eac..2bdc49d8b 100644--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock@@ -424,7 +424,7 @@ version = "1.1.5"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"dependencies = [- "windows-sys 0.61.2",+ "windows-sys 0.60.2",][[package]]@@ -435,7 +435,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"dependencies = ["anstyle","once_cell_polyfill",- "windows-sys 0.61.2",+ "windows-sys 0.60.2",][[package]]@@ -495,7 +495,7 @@ dependencies = ["objc2-foundation 0.3.2","parking_lot","percent-encoding",- "windows-sys 0.60.2",+ "windows-sys 0.52.0","x11rb",]@@ -2190,7 +2190,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"dependencies = ["lazy_static",- "windows-sys 0.59.0",+ "windows-sys 0.48.0",][[package]]@@ -2518,10 +2518,10 @@ dependencies = [[[package]]name = "cpal"version = "0.15.3"-source = "git+https://github.com/screenpipe/cpal.git?rev=99f7c0f175217b5e47e4e454acbc02089d1fdd29#99f7c0f175217b5e47e4e454acbc02089d1fdd29"+source = "git+https://github.com/screenpipe/cpal.git?rev=c7a610aee5c6037c9c69dc5bf7f2a850da8d8b12#c7a610aee5c6037c9c69dc5bf7f2a850da8d8b12"dependencies = ["alsa",- "cidre 0.15.1 (git+https://github.com/yury/cidre.git)",+ "cidre 0.15.1 (git+https://github.com/yury/cidre.git?rev=8481f3f0dc7dd39bb5be80d9424bfac0cad3801a)","core-foundation-sys 0.8.7","coreaudio-rs","dasp_sample",@@ -3335,7 +3335,7 @@ dependencies = ["libc","option-ext","redox_users 0.5.2",- "windows-sys 0.61.2",+ "windows-sys 0.60.2",][[package]]@@ -3367,7 +3367,7 @@ version = "0.5.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a"dependencies = [- "libloading 0.8.9",+ "libloading 0.7.4",][[package]]@@ -3842,7 +3842,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"dependencies = ["libc",- "windows-sys 0.61.2",+ "windows-sys 0.52.0",][[package]]@@ -5007,7 +5007,7 @@ dependencies = ["gobject-sys 0.21.5","libc","system-deps 7.0.7",- "windows-sys 0.61.2",+ "windows-sys 0.52.0",][[package]]@@ -5689,7 +5689,7 @@ dependencies = ["libc","percent-encoding","pin-project-lite",- "socket2 0.6.3",+ "socket2 0.5.10","tokio","tower-service","tracing",@@ -6168,7 +6168,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46"dependencies = ["hermit-abi","libc",- "windows-sys 0.61.2",+ "windows-sys 0.52.0",][[package]]@@ -7677,7 +7677,7 @@ version = "0.50.3"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"dependencies = [- "windows-sys 0.61.2",+ "windows-sys 0.60.2",][[package]]@@ -7814,7 +7814,7 @@ version = "0.7.6"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8"dependencies = [- "proc-macro-crate 3.5.0",+ "proc-macro-crate 2.0.2","proc-macro2","quote","syn 2.0.117",@@ -8578,7 +8578,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967"dependencies = ["libc",- "windows-sys 0.61.2",+ "windows-sys 0.45.0",][[package]]@@ -9613,7 +9613,7 @@ dependencies = ["quinn-udp","rustc-hash 2.1.1","rustls 0.23.37",- "socket2 0.6.3",+ "socket2 0.5.10","thiserror 2.0.18","tokio","tracing",@@ -9651,9 +9651,9 @@ dependencies = ["cfg_aliases 0.2.1","libc","once_cell",- "socket2 0.6.3",+ "socket2 0.5.10","tracing",- "windows-sys 0.60.2",+ "windows-sys 0.52.0",][[package]]@@ -10536,7 +10536,7 @@ dependencies = ["errno","libc","linux-raw-sys 0.4.15",- "windows-sys 0.59.0",+ "windows-sys 0.52.0",][[package]]@@ -10549,7 +10549,7 @@ dependencies = ["errno","libc","linux-raw-sys 0.12.1",- "windows-sys 0.61.2",+ "windows-sys 0.52.0",][[package]]@@ -10637,7 +10637,7 @@ dependencies = ["security-framework","security-framework-sys","webpki-root-certs",- "windows-sys 0.61.2",+ "windows-sys 0.52.0",][[package]]@@ -11031,7 +11031,7 @@ dependencies = [[[package]]name = "screenpipe-audio"-version = "0.4.6"+version = "0.4.7"dependencies = ["anyhow","audiopipe",@@ -11106,7 +11106,7 @@ dependencies = [[[package]]name = "screenpipe-config"-version = "0.4.6"+version = "0.4.7"dependencies = ["dirs 6.0.0","serde",@@ -11118,7 +11118,7 @@ dependencies = [[[package]]name = "screenpipe-connect"-version = "0.4.6"+version = "0.4.7"dependencies = ["anyhow","async-trait",@@ -11154,7 +11154,7 @@ dependencies = [[[package]]name = "screenpipe-core"-version = "0.4.6"+version = "0.4.7"dependencies = ["accessibility","accessibility-sys",@@ -11205,7 +11205,7 @@ dependencies = [[[package]]name = "screenpipe-db"-version = "0.4.6"+version = "0.4.7"dependencies = ["anyhow","chrono",@@ -11230,7 +11230,7 @@ dependencies = [[[package]]name = "screenpipe-engine"-version = "0.4.6"+version = "0.4.7"dependencies = ["anyhow","arc-swap",@@ -11299,7 +11299,7 @@ dependencies = [[[package]]name = "screenpipe-events"-version = "0.4.6"+version = "0.4.7"dependencies = ["anyhow","chrono",@@ -11315,7 +11315,7 @@ dependencies = [[[package]]name = "screenpipe-redact"-version = "0.4.6"+version = "0.4.7"dependencies = ["anyhow","async-trait",@@ -11344,7 +11344,7 @@ dependencies = [[[package]]name = "screenpipe-rfdetr-mlx"-version = "0.4.6"+version = "0.4.7"dependencies = ["image 0.25.10","mlx-rs",@@ -11355,7 +11355,7 @@ dependencies = [[[package]]name = "screenpipe-screen"-version = "0.4.6"+version = "0.4.7"dependencies = ["accessibility-sys","anyhow",@@ -11408,7 +11408,7 @@ dependencies = [[[package]]name = "screenpipe-sync"-version = "0.4.6"+version = "0.4.7"dependencies = ["async-trait","base64 0.22.1",@@ -11428,7 +11428,7 @@ dependencies = [[[package]]name = "screenpipe-vault"-version = "0.4.6"+version = "0.4.7"dependencies = ["argon2","chacha20poly1305",@@ -12360,7 +12360,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e"dependencies = ["libc",- "windows-sys 0.61.2",+ "windows-sys 0.60.2",][[package]]@@ -12775,6 +12775,7 @@ dependencies = ["cfg-if 1.0.4","libc","psm",+ "windows-sys 0.52.0","windows-sys 0.59.0",]@@ -14020,7 +14021,7 @@ dependencies = ["getrandom 0.4.2","once_cell","rustix 1.1.4",- "windows-sys 0.61.2",+ "windows-sys 0.52.0",][[package]]@@ -14791,7 +14792,7 @@ dependencies = ["png 0.18.1","serde","thiserror 2.0.18",- "windows-sys 0.61.2",+ "windows-sys 0.60.2",][[package]]@@ -14863,7 +14864,7 @@ checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e"dependencies = ["memoffset","tempfile",- "windows-sys 0.61.2",+ "windows-sys 0.60.2",][[package]]@@ -15855,7 +15856,7 @@ version = "0.1.11"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"dependencies = [- "windows-sys 0.61.2",+ "windows-sys 0.48.0",][[package]]diff --git a/apps/screenpipe-app-tauri/src-tauri/src/capture_session.rs b/apps/screenpipe-app-tauri/src-tauri/src/capture_session.rsindex cfa69a8da..aec18be6a 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/capture_session.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/capture_session.rs@@ -40,6 +40,7 @@ use crate::server_core::ServerCore;/// callers don't need to reach into `ServerCore` to stop capture.pub struct CaptureSession {shutdown_tx: broadcast::Sender<()>,+ vision_task: Option<tokio::task::JoinHandle<()>>,ui_recorder_handle: Option<screenpipe_engine::UiRecorderHandle>,audio_manager: Arc<screenpipe_audio::audio_manager::AudioManager>,audio_disabled: bool,@@ -71,6 +72,7 @@ impl CaptureSession {None;// --- Frame-linker sender (set by VisionManager, consumed by UI recorder + capture loops) ---let mut linker_tx: Option<screenpipe_engine::frame_linker_actor::LinkerSender> = None;+ let mut vision_task = None;// --- Vision ---if !config.disable_vision {@@ -116,9 +118,10 @@ impl CaptureSession {}// Long-running parts (monitor watcher + shutdown handler) stay in the- // spawn — they're fire-and-forget by design.+ // spawn. Keep the handle so stop() can wait for SCK cleanup before+ // another capture session starts in this long-lived app process.let vm_spawn = vision_manager.clone();- tokio::spawn(async move {+ vision_task = Some(tokio::spawn(async move {let mut shutdown_rx = shutdown_rx;if let Err(e) = start_monitor_watcher(vm_spawn.clone(), audio_manager_for_drm).await@@ -134,7 +137,7 @@ impl CaptureSession {if let Err(e) = vm_spawn.shutdown().await {error!("Error shutting down VisionManager: {:?}", e);}- });+ }));}// --- Audio recording ---@@ -223,6 +226,7 @@ impl CaptureSession {Ok(Self {shutdown_tx,+ vision_task,ui_recorder_handle,audio_manager: server.audio_manager.clone(),audio_disabled: config.disable_audio,@@ -252,6 +256,25 @@ impl CaptureSession {}}+ // Wait until VisionManager releases its ScreenCaptureKit handles. The+ // desktop app keeps this process alive across stop/start cycles, unlike+ // the CLI, so returning before this finishes can leave stale SCStreams+ // producing OS-level "stream output NOT found" frame drops.+ if let Some(mut vision_task) = self.vision_task.take() {+ info!("Waiting for VisionManager shutdown...");+ match tokio::time::timeout(Duration::from_secs(10), &mut vision_task).await {+ Ok(Ok(())) => info!("VisionManager shutdown finished cleanly"),+ Ok(Err(e)) => warn!("VisionManager shutdown task failed: {}", e),+ Err(_) => {+ warn!("VisionManager shutdown did not finish within 10s; aborting task");+ vision_task.abort();+ let _ = vision_task.await;+ }+ }+ }++ invalidate_macos_screen_streams("capture session stop").await;+// Wait for UI recorder tasks to finishif let Some(ui_handle) = self.ui_recorder_handle.take() {info!("Waiting for UI recorder tasks to finish...");@@ -265,6 +288,29 @@ impl CaptureSession {}}+#[cfg(target_os = "macos")]+async fn invalidate_macos_screen_streams(reason: &str) {+ info!("Invalidating macOS ScreenCaptureKit screenshot streams ({reason})");+ let result = tokio::time::timeout(+ Duration::from_secs(5),+ tokio::task::spawn_blocking(|| {+ screenpipe_screen::stream_invalidation::invalidate_streams();+ }),+ )+ .await;++ match result {+ Ok(Ok(())) => info!("macOS ScreenCaptureKit screenshot streams invalidated"),+ Ok(Err(e)) => warn!("macOS ScreenCaptureKit invalidation task failed: {}", e),+ Err(_) => warn!("macOS ScreenCaptureKit stream invalidation timed out after 5s"),+ }++ tokio::time::sleep(Duration::from_millis(500)).await;+}++#[cfg(not(target_os = "macos"))]+async fn invalidate_macos_screen_streams(_reason: &str) {}+fn log_capture_transcription_config(config: &RecordingConfig, options: &AudioManagerOptions) {let deepgram_diag = match &config.deepgram_config {Some(c) if c.is_ready() => format!(diff --git a/crates/screenpipe-audio/Cargo.toml b/crates/screenpipe-audio/Cargo.tomlindex f3a474d8b..10310b0a7 100644--- a/crates/screenpipe-audio/Cargo.toml+++ b/crates/screenpipe-audio/Cargo.toml@@ -19,7 +19,7 @@ oasgen = { workspace = true }# Cross-platform audio capture. Tracks screenpipe/cpal main, which carries# the Windows WASAPI AEC and macOS VoiceProcessingIO patches.-cpal = { git = "https://github.com/screenpipe/cpal.git", rev = "99f7c0f175217b5e47e4e454acbc02089d1fdd29" }+cpal = { git = "https://github.com/screenpipe/cpal.git", rev = "c7a610aee5c6037c9c69dc5bf7f2a850da8d8b12" }# Wav encodinghound = "3.5"