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: Swift overlay meeting toggle + clippy cleanup + dead code removal
Louis Beaumonte5e955aa648e
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs b/apps/screenpipe-app-tauri/src-tauri/src/commands.rsindex dda2dac5b..b6dd53d16 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs@@ -92,6 +92,31 @@ extern "C" fn native_shortcut_action_callback(action_ptr: *const std::os::raw::cnative_shortcut_reminder::hide();}"toggle_meeting" => {+ // Directly call the meetings API instead of relying on JS+ // (the Main window may not be loaded when using the Swift overlay)+ let status: Option<bool> =+ reqwest::blocking::get("http://localhost:3030/meetings/status")+ .ok()+ .and_then(|r| r.json::<serde_json::Value>().ok())+ .and_then(|v| v["active"].as_bool());+ match status {+ Some(true) => {+ let _ = reqwest::blocking::Client::new()+ .post("http://localhost:3030/meetings/stop")+ .send();+ }+ Some(false) => {+ let _ = reqwest::blocking::Client::new()+ .post("http://localhost:3030/meetings/start")+ .header("Content-Type", "application/json")+ .body(r#"{"app":"manual"}"#)+ .send();+ }+ None => {+ warn!("failed to check meeting status");+ }+ }+ // Also emit to JS so the home page UI updates immediately if openlet _ = app_clone.emit("native-shortcut-toggle-meeting", "");}_ => {}@@ -1099,7 +1124,10 @@ pub async fn show_shortcut_reminder(// If window exists, resize, reposition to current screen, and showif let Some(window) = app_handle.get_webview_window(label) {info!("shortcut-reminder window exists, resizing/repositioning and showing");- let _ = window.set_size(tauri::Size::Logical(tauri::LogicalSize::new(window_width, window_height)));+ let _ = window.set_size(tauri::Size::Logical(tauri::LogicalSize::new(+ window_width,+ window_height,+ )));let _ = window.set_position(tauri::Position::Logical(tauri::LogicalPosition::new(x, y)));let _ = app_handle.emit_to(label, "shortcut-reminder-update", &shortcut);let _ = window.show();diff --git a/apps/screenpipe-app-tauri/src-tauri/src/health.rs b/apps/screenpipe-app-tauri/src-tauri/src/health.rsindex 1540dcf39..d4339a6f4 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/health.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/health.rs@@ -313,7 +313,6 @@ pub async fn start_health_check(app: tauri::AppHandle) -> Result<()> {let mut consecutive_failures: u32 = 0;let mut consecutive_unhealthy: u32 = 0;-// Capture stall detection statelet mut consecutive_audio_stall: u32 = 0;let mut consecutive_vision_stall: u32 = 0;diff --git a/apps/screenpipe-app-tauri/src-tauri/src/store.rs b/apps/screenpipe-app-tauri/src-tauri/src/store.rsindex 4f23b1c28..2d8e321ab 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/store.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/store.rs@@ -11,8 +11,7 @@ use tracing::error;/// Uses Mutex instead of OnceLock so the cache can be invalidated when the/// Tauri resource table drops the underlying store (e.g. after an in-place/// update restart on Windows where resource IDs become stale).-static STORE_CACHE: Mutex<Option<Arc<tauri_plugin_store::Store<tauri::Wry>>>> =- Mutex::new(None);+static STORE_CACHE: Mutex<Option<Arc<tauri_plugin_store::Store<tauri::Wry>>>> = Mutex::new(None);/// Build (or rebuild) the store, retrying on TOCTOU races and stale resource IDs.fn build_store(app: &AppHandle) -> anyhow::Result<Arc<tauri_plugin_store::Store<tauri::Wry>>> {diff --git a/apps/screenpipe-app-tauri/src-tauri/src/suggestions.rs b/apps/screenpipe-app-tauri/src-tauri/src/suggestions.rsindex 10dcd547b..88d094a84 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/suggestions.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/suggestions.rs@@ -160,8 +160,10 @@ pub async fn auto_start_scheduler(state: &SuggestionsState) {tokio::time::sleep(tokio::time::Duration::from_secs(15)).await;// Subscribe to meeting events for reactive refresh- let mut event_sub = screenpipe_events::subscribe_to_event::<serde_json::Value>("meeting_started");- let mut event_end_sub = screenpipe_events::subscribe_to_event::<serde_json::Value>("meeting_ended");+ let mut event_sub =+ screenpipe_events::subscribe_to_event::<serde_json::Value>("meeting_started");+ let mut event_end_sub =+ screenpipe_events::subscribe_to_event::<serde_json::Value>("meeting_ended");let mut timer = tokio::time::interval(tokio::time::Duration::from_secs(600));timer.tick().await; // consume immediate first tick@@ -176,7 +178,10 @@ pub async fn auto_start_scheduler(state: &SuggestionsState) {// Debounce event triggers — wait a few seconds for context to settleif trigger != "timer" {- info!("suggestions scheduler: triggered by {} event, debouncing 5s", trigger);+ info!(+ "suggestions scheduler: triggered by {} event, debouncing 5s",+ trigger+ );tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;}@@ -456,18 +461,34 @@ fn detect_mode(apps: &[AppActivity], windows: &[WindowActivity]) -> &'static str// ─── Template suggestions ───────────────────────────────────────────────────-fn coding_suggestions(top_apps: &[String], apps: &[AppActivity], windows: &[WindowActivity]) -> Vec<Suggestion> {+fn coding_suggestions(+ top_apps: &[String],+ apps: &[AppActivity],+ windows: &[WindowActivity],+) -> Vec<Suggestion> {let editor = top_apps.iter().find(|a| {[- "cursor", "code", "zed", "xcode", "intellij idea", "webstorm",- "pycharm", "neovim", "vim",+ "cursor",+ "code",+ "zed",+ "xcode",+ "intellij idea",+ "webstorm",+ "pycharm",+ "neovim",+ "vim",].iter().any(|c| *c == a.to_lowercase())});let terminal = top_apps.iter().find(|a| {[- "wezterm", "iterm2", "terminal", "alacritty", "kitty", "warp",+ "wezterm",+ "iterm2",+ "terminal",+ "alacritty",+ "kitty",+ "warp",].iter().any(|c| *c == a.to_lowercase())@@ -488,7 +509,10 @@ fn coding_suggestions(top_apps: &[String], apps: &[AppActivity], windows: &[Wind.take(3).map(|w| {// Extract filename from window title (often "filename — App")- let title = w.window_name.split(" — ").next()+ let title = w+ .window_name+ .split(" — ")+ .next().or_else(|| w.window_name.split(" - ").next()).unwrap_or(&w.window_name);if title.chars().count() > 30 {@@ -503,7 +527,12 @@ fn coding_suggestions(top_apps: &[String], apps: &[AppActivity], windows: &[Windlet editor_name = editor.map(|e| e.as_str()).unwrap_or("your editor");let editor_preview = if editor_mins > 0 && !editor_windows.is_empty() {- Some(format!("{}min in {} — {}", editor_mins, editor_name, editor_windows.join(", ")))+ Some(format!(+ "{}min in {} — {}",+ editor_mins,+ editor_name,+ editor_windows.join(", ")+ ))} else if editor_mins > 0 {Some(format!("{}min in {}", editor_mins, editor_name))} else {@@ -594,8 +623,15 @@ fn browsing_suggestions(apps: &[AppActivity], windows: &[WindowActivity]) -> Veclet mut suggestions = vec![Suggestion {text: "summarize the pages I browsed".into(),preview: if browser_total_mins > 0 {- Some(format!("{}min browsing — {}", browser_total_mins,- if top_pages.is_empty() { "various pages".into() } else { top_pages.join(", ") }))+ Some(format!(+ "{}min browsing — {}",+ browser_total_mins,+ if top_pages.is_empty() {+ "various pages".into()+ } else {+ top_pages.join(", ")+ }+ ))} else {None},@@ -617,7 +653,11 @@ fn browsing_suggestions(apps: &[AppActivity], windows: &[WindowActivity]) -> Vecsuggestions.push(Suggestion {text: "how much time did I spend browsing?".into(),- preview: if browser_total_mins > 0 { Some(format!("~{}min total", browser_total_mins)) } else { None },+ preview: if browser_total_mins > 0 {+ Some(format!("~{}min total", browser_total_mins))+ } else {+ None+ },priority: 3,});suggestions.push(Suggestion {@@ -631,23 +671,27 @@ fn browsing_suggestions(apps: &[AppActivity], windows: &[WindowActivity]) -> Vecfn meeting_suggestions(apps: &[AppActivity], windows: &[WindowActivity]) -> Vec<Suggestion> {// Find meeting app and duration- let meeting_app = apps.iter().find(|a| {- MEETING_APPS.iter().any(|m| *m == a.app_name.to_lowercase())- });+ let meeting_app = apps+ .iter()+ .find(|a| MEETING_APPS.iter().any(|m| *m == a.app_name.to_lowercase()));let meeting_mins = meeting_app.map(|a| a.cnt / 60).unwrap_or(0);- let meeting_name = meeting_app.map(|a| a.app_name.as_str()).unwrap_or("your call");+ let meeting_name = meeting_app+ .map(|a| a.app_name.as_str())+ .unwrap_or("your call");// Try to get meeting title from window- let meeting_title = windows.iter().find(|w| {- MEETING_APPS.iter().any(|m| *m == w.app_name.to_lowercase())- && w.window_name.len() > 3- }).map(|w| {- if w.window_name.chars().count() > 40 {- format!("{}...", w.window_name.chars().take(37).collect::<String>())- } else {- w.window_name.clone()- }- });+ let meeting_title = windows+ .iter()+ .find(|w| {+ MEETING_APPS.iter().any(|m| *m == w.app_name.to_lowercase()) && w.window_name.len() > 3+ })+ .map(|w| {+ if w.window_name.chars().count() > 40 {+ format!("{}...", w.window_name.chars().take(37).collect::<String>())+ } else {+ w.window_name.clone()+ }+ });let preview = if meeting_mins > 0 {if let Some(title) = &meeting_title {@@ -693,7 +737,11 @@ fn meeting_suggestions(apps: &[AppActivity], windows: &[WindowActivity]) -> Vec<]}-fn writing_suggestions(top_apps: &[String], apps: &[AppActivity], windows: &[WindowActivity]) -> Vec<Suggestion> {+fn writing_suggestions(+ top_apps: &[String],+ apps: &[AppActivity],+ windows: &[WindowActivity],+) -> Vec<Suggestion> {let app = top_apps.iter().find(|a| WRITING_APPS.iter().any(|w| *w == a.to_lowercase()));@@ -705,11 +753,15 @@ fn writing_suggestions(top_apps: &[String], apps: &[AppActivity], windows: &[Win// Get document titles from windowslet doc_titles: Vec<String> = app.map(|a| {- windows.iter()+ windows+ .iter().filter(|w| w.app_name.eq_ignore_ascii_case(a) && w.window_name.len() > 3).take(2).map(|w| {- let title = w.window_name.split(" — ").next()+ let title = w+ .window_name+ .split(" — ")+ .next().or_else(|| w.window_name.split(" - ").next()).unwrap_or(&w.window_name);if title.chars().count() > 30 {@@ -725,7 +777,12 @@ fn writing_suggestions(top_apps: &[String], apps: &[AppActivity], windows: &[Winlet preview = if app_mins > 0 {let app_name = app.map(|a| a.as_str()).unwrap_or("writing app");if !doc_titles.is_empty() {- Some(format!("{}min in {} — {}", app_mins, app_name, doc_titles.join(", ")))+ Some(format!(+ "{}min in {} — {}",+ app_mins,+ app_name,+ doc_titles.join(", ")+ ))} else {Some(format!("{}min in {}", app_mins, app_name))}@@ -741,7 +798,11 @@ fn writing_suggestions(top_apps: &[String], apps: &[AppActivity], windows: &[Winif let Some(app_name) = app {suggestions.push(Suggestion {text: format!("show my recent notes in {}", app_name),- preview: if !doc_titles.is_empty() { Some(doc_titles.join(", ")) } else { None },+ preview: if !doc_titles.is_empty() {+ Some(doc_titles.join(", "))+ } else {+ None+ },priority: 2,});}@@ -760,16 +821,29 @@ fn writing_suggestions(top_apps: &[String], apps: &[AppActivity], windows: &[Win}fn communication_suggestions(apps: &[AppActivity], windows: &[WindowActivity]) -> Vec<Suggestion> {- let comm_apps: Vec<_> = apps.iter().filter(|a| {- COMMUNICATION_APPS.iter().any(|c| *c == a.app_name.to_lowercase())- }).collect();+ let comm_apps: Vec<_> = apps+ .iter()+ .filter(|a| {+ COMMUNICATION_APPS+ .iter()+ .any(|c| *c == a.app_name.to_lowercase())+ })+ .collect();let total_comm_mins: i64 = comm_apps.iter().map(|a| a.cnt / 60).sum();- let comm_app_names: Vec<String> = comm_apps.iter().take(3).map(|a| a.app_name.clone()).collect();+ let comm_app_names: Vec<String> = comm_apps+ .iter()+ .take(3)+ .map(|a| a.app_name.clone())+ .collect();let mut suggestions = vec![Suggestion {text: "summarize my conversations".into(),preview: if total_comm_mins > 0 {- Some(format!("{}min across {}", total_comm_mins, comm_app_names.join(", ")))+ Some(format!(+ "{}min across {}",+ total_comm_mins,+ comm_app_names.join(", ")+ ))} else {None},@@ -828,28 +902,49 @@ fn communication_suggestions(apps: &[AppActivity], windows: &[WindowActivity]) -suggestions}-fn video_editing_suggestions(top_apps: &[String], apps: &[AppActivity], windows: &[WindowActivity]) -> Vec<Suggestion> {+fn video_editing_suggestions(+ top_apps: &[String],+ apps: &[AppActivity],+ windows: &[WindowActivity],+) -> Vec<Suggestion> {let app_entry = apps.iter().find(|a| {- VIDEO_EDITING_APPS.iter().any(|v| *v == a.app_name.to_lowercase())+ VIDEO_EDITING_APPS+ .iter()+ .any(|v| *v == a.app_name.to_lowercase())});- let app = app_entry.map(|a| a.app_name.as_str())- .or_else(|| top_apps.iter().find(|a| VIDEO_EDITING_APPS.iter().any(|v| *v == a.to_lowercase())).map(|s| s.as_str()))+ let app = app_entry+ .map(|a| a.app_name.as_str())+ .or_else(|| {+ top_apps+ .iter()+ .find(|a| VIDEO_EDITING_APPS.iter().any(|v| *v == a.to_lowercase()))+ .map(|s| s.as_str())+ }).unwrap_or("my editor");let app_mins = app_entry.map(|a| a.cnt / 60).unwrap_or(0);// Get project name from window title- let project_name = windows.iter().find(|w| {- VIDEO_EDITING_APPS.iter().any(|v| *v == w.app_name.to_lowercase()) && w.window_name.len() > 3- }).map(|w| {- let title = w.window_name.split(" — ").next()- .or_else(|| w.window_name.split(" - ").next())- .unwrap_or(&w.window_name);- if title.chars().count() > 35 {- format!("{}...", title.chars().take(32).collect::<String>())- } else {- title.to_string()- }- });+ let project_name = windows+ .iter()+ .find(|w| {+ VIDEO_EDITING_APPS+ .iter()+ .any(|v| *v == w.app_name.to_lowercase())+ && w.window_name.len() > 3+ })+ .map(|w| {+ let title = w+ .window_name+ .split(" — ")+ .next()+ .or_else(|| w.window_name.split(" - ").next())+ .unwrap_or(&w.window_name);+ if title.chars().count() > 35 {+ format!("{}...", title.chars().take(32).collect::<String>())+ } else {+ title.to_string()+ }+ });vec![Suggestion {@@ -879,7 +974,11 @@ fn video_editing_suggestions(top_apps: &[String], apps: &[AppActivity], windows:]}-fn idle_suggestions(top_apps: &[String], apps: &[AppActivity], windows: &[WindowActivity]) -> Vec<Suggestion> {+fn idle_suggestions(+ top_apps: &[String],+ apps: &[AppActivity],+ windows: &[WindowActivity],+) -> Vec<Suggestion> {let skip = ["finder","screenpipe",@@ -889,12 +988,15 @@ fn idle_suggestions(top_apps: &[String], apps: &[AppActivity], windows: &[Window];// Compute total active time- let total_mins: i64 = apps.iter()+ let total_mins: i64 = apps+ .iter().filter(|a| !skip.contains(&a.app_name.to_lowercase().as_str())).map(|a| a.cnt / 60).sum();- let top_app = top_apps.iter().find(|a| !skip.contains(&a.to_lowercase().as_str()));+ let top_app = top_apps+ .iter()+ .find(|a| !skip.contains(&a.to_lowercase().as_str()));let top_app_mins = top_app.and_then(|a| apps.iter().find(|act| act.app_name.eq_ignore_ascii_case(a))).map(|a| a.cnt / 60);@@ -902,7 +1004,10 @@ fn idle_suggestions(top_apps: &[String], apps: &[AppActivity], windows: &[Windowlet mut suggestions = vec![Suggestion {text: "what did I work on in the last hour?".into(),preview: if total_mins > 0 {- let app_count = apps.iter().filter(|a| !skip.contains(&a.app_name.to_lowercase().as_str())).count();+ let app_count = apps+ .iter()+ .filter(|a| !skip.contains(&a.app_name.to_lowercase().as_str()))+ .count();Some(format!("{}min across {} apps", total_mins, app_count))} else {None@@ -1366,7 +1471,11 @@ async fn generate_ai_suggestions(debug!("suggestions: AI prompt ~{} tokens, backend={}",context.len() / 4,- if use_cloud { "screenpipe-cloud" } else { "apple-intelligence" }+ if use_cloud {+ "screenpipe-cloud"+ } else {+ "apple-intelligence"+ });let client = reqwest::Client::new();@@ -1416,13 +1525,19 @@ async fn generate_ai_suggestions(parse_ai_response(content)}Ok(r) => {- warn!("suggestions: AI returned status {} (backend={})",- r.status(), if use_cloud { "cloud" } else { "apple" });+ warn!(+ "suggestions: AI returned status {} (backend={})",+ r.status(),+ if use_cloud { "cloud" } else { "apple" }+ );None}Err(e) => {- warn!("suggestions: AI request failed: {} (backend={})",- e, if use_cloud { "cloud" } else { "apple" });+ warn!(+ "suggestions: AI request failed: {} (backend={})",+ e,+ if use_cloud { "cloud" } else { "apple" }+ );None}}diff --git a/apps/screenpipe-app-tauri/src-tauri/src/window/show.rs b/apps/screenpipe-app-tauri/src-tauri/src/window/show.rsindex e4acc28a9..a087ea53f 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/window/show.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/window/show.rs@@ -709,7 +709,9 @@ impl ShowRewindWindow {tauri::webview::PageLoadEvent::Finished) {#[cfg(target_os = "windows")]- if let Err(e) = crate::windows_overlay::set_display_affinity(&win, capturable) {+ if let Err(e) = crate::windows_overlay::set_display_affinity(+ &win, capturable,+ ) {tracing::error!("Failed to set display affinity: {}", e);}win.show().ok();@@ -1016,7 +1018,9 @@ impl ShowRewindWindow {tracing::error!("Failed to setup Windows overlay: {}", e);}// Apply display affinity so OBS/screen recorders respect the setting- if let Err(e) = crate::windows_overlay::set_display_affinity(&win, capturable) {+ if let Err(e) =+ crate::windows_overlay::set_display_affinity(&win, capturable)+ {tracing::error!("Failed to set display affinity: {}", e);}// Activate so keyboard focus goes to the webviewdiff --git a/apps/screenpipe-app-tauri/src-tauri/src/windows_overlay.rs b/apps/screenpipe-app-tauri/src-tauri/src/windows_overlay.rsindex 1e36481a8..89b0f0df9 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/windows_overlay.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/windows_overlay.rs@@ -16,10 +16,10 @@ use windows::Win32::Graphics::Gdi::{GetMonitorInfoW, MonitorFromWindow, MONITORINFO, MONITOR_DEFAULTTONEAREST,};use windows::Win32::UI::WindowsAndMessaging::{- GetWindowLongW, SetForegroundWindow, SetWindowLongW, SetWindowPos, GWL_EXSTYLE, GWL_STYLE,- HWND_TOPMOST, SWP_FRAMECHANGED, SWP_NOACTIVATE, SWP_NOMOVE, SWP_NOSIZE, SWP_SHOWWINDOW,- WS_CAPTION, WS_EX_LAYERED, WS_EX_TOOLWINDOW, WS_EX_TRANSPARENT, WS_THICKFRAME,- SetWindowDisplayAffinity, WINDOW_DISPLAY_AFFINITY, WDA_EXCLUDEFROMCAPTURE, WDA_NONE,+ GetWindowLongW, SetForegroundWindow, SetWindowDisplayAffinity, SetWindowLongW, SetWindowPos,+ GWL_EXSTYLE, GWL_STYLE, HWND_TOPMOST, SWP_FRAMECHANGED, SWP_NOACTIVATE, SWP_NOMOVE, SWP_NOSIZE,+ SWP_SHOWWINDOW, WDA_EXCLUDEFROMCAPTURE, WDA_NONE, WINDOW_DISPLAY_AFFINITY, WS_CAPTION,+ WS_EX_LAYERED, WS_EX_TOOLWINDOW, WS_EX_TRANSPARENT, WS_THICKFRAME,};/// Extended window styles for overlay behavior@@ -341,15 +341,18 @@ pub fn bring_to_front_and_activate(window: &WebviewWindow) -> Result<(), String>/// When true, `WDA_NONE` restores normal capture visibility.pub fn set_display_affinity(window: &WebviewWindow, capturable: bool) -> Result<(), String> {let hwnd = get_hwnd(window).ok_or("Failed to get HWND")?;- let affinity: WINDOW_DISPLAY_AFFINITY = if capturable { WDA_NONE } else { WDA_EXCLUDEFROMCAPTURE };+ let affinity: WINDOW_DISPLAY_AFFINITY = if capturable {+ WDA_NONE+ } else {+ WDA_EXCLUDEFROMCAPTURE+ };unsafe {SetWindowDisplayAffinity(hwnd, affinity).map_err(|e| format!("SetWindowDisplayAffinity failed: {}", e))?;}info!("Window display affinity set: capturable={} (affinity=0x{:X})",- capturable,- affinity.0+ capturable, affinity.0);Ok(())}diff --git a/crates/screenpipe-a11y/src/tree/macos.rs b/crates/screenpipe-a11y/src/tree/macos.rsindex 99d747bd4..fa39513da 100644--- a/crates/screenpipe-a11y/src/tree/macos.rs+++ b/crates/screenpipe-a11y/src/tree/macos.rs@@ -502,7 +502,7 @@ fn walk_element(elem: &ax::UiElement, depth: usize, state: &mut WalkState) {// Yield every 100 elements to let macOS process pending HID/input events.// Without this, tight AX IPC loops can starve USB mouse/keyboard event delivery.- if state.node_count % 100 == 0 {+ if state.node_count.is_multiple_of(100) {std::thread::yield_now();}diff --git a/crates/screenpipe-audio/src/audio_manager/device_monitor.rs b/crates/screenpipe-audio/src/audio_manager/device_monitor.rsindex 0cded36aa..510e317cf 100644--- a/crates/screenpipe-audio/src/audio_manager/device_monitor.rs+++ b/crates/screenpipe-audio/src/audio_manager/device_monitor.rs@@ -622,7 +622,7 @@ pub async fn start_device_monitor(let is_permanent = is_permanent_output_error(&e);output_recovery_backoff.record_failure(is_permanent);if output_recovery_backoff.attempts <= 3- || output_recovery_backoff.attempts % 30 == 0+ || output_recovery_backoff.attempts.is_multiple_of(30){// Log first 3 attempts, then every 30th to avoid spamwarn!(diff --git a/crates/screenpipe-audio/src/audio_manager/manager.rs b/crates/screenpipe-audio/src/audio_manager/manager.rsindex d90fe9f1b..e1efa68f1 100644--- a/crates/screenpipe-audio/src/audio_manager/manager.rs+++ b/crates/screenpipe-audio/src/audio_manager/manager.rs@@ -204,27 +204,15 @@ impl AudioManager {if let Some(ref transcription_engine) = *engine_guard {let opts = options_ref.read().await;let audio_engine = opts.transcription_engine.clone();- let key = opts.deepgram_api_key.clone();- let openai_config = opts.openai_compatible_config.clone();- let langs = opts.languages.clone();- let vocab = opts.vocabulary.clone();let batch_max_dur = opts.batch_max_duration_secs;drop(opts);- // Get whisper context from transcription engine- let whisper_ctx = transcription_engine.whisper_context();-let data_dir = output_path_bg.as_deref();let count = super::reconciliation::reconcile_untranscribed(&db,transcription_engine,on_insert_bg.as_ref(),- whisper_ctx,audio_engine,- key,- openai_config,- langs,- &vocab,Some(seg_mgr.clone()),data_dir,batch_max_dur,@@ -628,18 +616,12 @@ impl AudioManager {"batch mode: audio session ended, transcribing accumulated audio");}- let whisper_ctx = engine.whisper_context();let data_dir = output_path.as_deref();let count = super::reconciliation::reconcile_untranscribed(&db,&engine,on_insert_session.as_ref(),- whisper_ctx,audio_transcription_engine.clone(),- deepgram_api_key.clone(),- openai_compatible_config.clone(),- languages.clone(),- &vocabulary,Some(segmentation_manager.clone()),data_dir,batch_max_duration_secs,@@ -665,10 +647,6 @@ impl AudioManager {embedding_manager.clone(),embedding_extractor.clone(),&output_path.clone().unwrap(),- audio_transcription_engine.clone(),- deepgram_api_key.clone(),- openai_compatible_config.clone(),- languages.clone(),&transcription_sender.clone(),&mut session,metrics.clone(),@@ -690,10 +668,6 @@ impl AudioManager {embedding_manager.clone(),embedding_extractor.clone(),&output_path.clone().unwrap(),- audio_transcription_engine.clone(),- deepgram_api_key.clone(),- openai_compatible_config.clone(),- languages.clone(),&transcription_sender.clone(),&mut session,metrics.clone(),@@ -715,10 +689,6 @@ impl AudioManager {embedding_manager.clone(),embedding_extractor.clone(),&output_path.clone().unwrap(),- audio_transcription_engine.clone(),- deepgram_api_key.clone(),- openai_compatible_config.clone(),- languages.clone(),&transcription_sender.clone(),&mut session,metrics.clone(),diff --git a/crates/screenpipe-audio/src/audio_manager/reconciliation.rs b/crates/screenpipe-audio/src/audio_manager/reconciliation.rsindex bd5686786..39c64499d 100644--- a/crates/screenpipe-audio/src/audio_manager/reconciliation.rs+++ b/crates/screenpipe-audio/src/audio_manager/reconciliation.rs@@ -28,11 +28,7 @@ use crate::transcription::engine::{TranscriptionEngine, TranscriptionSession};use crate::transcription::get_or_create_speaker_from_embedding;use crate::transcription::{AudioInsertCallback, AudioInsertInfo};-use crate::transcription::VocabularyEntry;use crate::utils::ffmpeg::read_audio_from_file;-use crate::OpenAICompatibleConfig;-use screenpipe_core::Language;-use whisper_rs::WhisperContext;/// A completed transcription result persisted to disk as a JSON file./// If the DB write fails (e.g. pool timeout), this file survives and is@@ -86,12 +82,7 @@ pub async fn reconcile_untranscribed(db: &DatabaseManager,transcription_engine: &TranscriptionEngine,on_insert: Option<&AudioInsertCallback>,- _whisper_context: Option<Arc<WhisperContext>>,audio_engine: Arc<AudioTranscriptionEngine>,- _deepgram_api_key: Option<String>,- _openai_compatible_config: Option<OpenAICompatibleConfig>,- _languages: Vec<Language>,- _vocabulary: &[VocabularyEntry],segmentation_manager: Option<Arc<SegmentationManager>>,data_dir: Option<&Path>,batch_max_duration_secs: Option<u64>,diff --git a/crates/screenpipe-audio/src/core/device.rs b/crates/screenpipe-audio/src/core/device.rsindex 917c26309..fda36d10e 100644--- a/crates/screenpipe-audio/src/core/device.rs+++ b/crates/screenpipe-audio/src/core/device.rs@@ -349,9 +349,7 @@ pub async fn get_cpal_device_and_config(}).ok_or_else(|| anyhow!("No supported output configurations found"))?;- best_config- .clone()- .with_sample_rate(best_config.max_sample_rate())+ (*best_config).with_sample_rate(best_config.max_sample_rate())} else {let configs: Vec<_> = cpal_audio_device.supported_input_configs()?.collect();let best_config = configs@@ -364,9 +362,7 @@ pub async fn get_cpal_device_and_config(}).ok_or_else(|| anyhow!("No supported input configurations found"))?;- best_config- .clone()- .with_sample_rate(best_config.max_sample_rate())+ (*best_config).with_sample_rate(best_config.max_sample_rate())};Ok((cpal_audio_device, config))diff --git a/crates/screenpipe-audio/src/segmentation/segmentation_manager.rs b/crates/screenpipe-audio/src/segmentation/segmentation_manager.rsindex 3eb54aecd..892a02d20 100644--- a/crates/screenpipe-audio/src/segmentation/segmentation_manager.rs+++ b/crates/screenpipe-audio/src/segmentation/segmentation_manager.rs@@ -93,23 +93,17 @@ impl SegmentationManager {let mut segmentation_model_path = self.segmentation_model_path.lock().await;let previous_segmentation_model = segmentation_model_path.clone();- match get_or_download_model(PyannoteModel::Segmentation).await {- Ok(path) => {- if previous_segmentation_model.as_ref() != Some(&path) {- *segmentation_model_path = Some(path);- readiness_changed = true;- }+ if let Ok(path) = get_or_download_model(PyannoteModel::Segmentation).await {+ if previous_segmentation_model.as_ref() != Some(&path) {+ *segmentation_model_path = Some(path);+ readiness_changed = true;}- Err(_) => {}}drop(segmentation_model_path);let mut embedding_model_path = self.embedding_model_path.lock().await;let previous_embedding_model = embedding_model_path.clone();- let embedding_model = match get_or_download_model(PyannoteModel::Embedding).await {- Ok(path) => Some(path),- Err(_) => None,- };+ let embedding_model = get_or_download_model(PyannoteModel::Embedding).await.ok();let mut embedding_extractor = self.embedding_extractor.lock().await;let had_embedding_extractor = embedding_extractor.is_some();diff --git a/crates/screenpipe-audio/src/transcription/stt.rs b/crates/screenpipe-audio/src/transcription/stt.rsindex 888a16c2f..6348e1c22 100644--- a/crates/screenpipe-audio/src/transcription/stt.rs+++ b/crates/screenpipe-audio/src/transcription/stt.rs@@ -267,10 +267,6 @@ pub async fn process_audio_input(embedding_manager: Arc<StdMutex<EmbeddingManager>>,embedding_extractor: Option<Arc<StdMutex<EmbeddingExtractor>>>,output_path: &PathBuf,- audio_transcription_engine: Arc<AudioTranscriptionEngine>,- deepgram_api_key: Option<String>,- openai_compatible_config: Option<OpenAICompatibleConfig>,- languages: Vec<Language>,output_sender: &crossbeam::channel::Sender<TranscriptionResult>,session: &mut TranscriptionSession,metrics: Arc<AudioPipelineMetrics>,@@ -337,18 +333,8 @@ pub async fn process_audio_input(while let Some(segment) = segments.recv().await {let path = file_path.clone();- let transcription_result = run_stt(- segment,- audio.device.clone(),- audio_transcription_engine.clone(),- deepgram_api_key.clone(),- openai_compatible_config.clone(),- languages.clone(),- path,- timestamp,- session,- )- .await?;+ let transcription_result =+ run_stt(segment, audio.device.clone(), path, timestamp, session).await?;if output_sender.send(transcription_result).is_err() {break;@@ -361,10 +347,6 @@ pub async fn process_audio_input(pub async fn run_stt(segment: SpeechSegment,device: Arc<AudioDevice>,- _audio_transcription_engine: Arc<AudioTranscriptionEngine>,- _deepgram_api_key: Option<String>,- _openai_compatible_config: Option<OpenAICompatibleConfig>,- _languages: Vec<Language>,path: String,timestamp: u64,session: &mut TranscriptionSession,diff --git a/crates/screenpipe-audio/src/vad/silero.rs b/crates/screenpipe-audio/src/vad/silero.rsindex 9ac8dbcc2..4b21102fd 100644--- a/crates/screenpipe-audio/src/vad/silero.rs+++ b/crates/screenpipe-audio/src/vad/silero.rs@@ -72,9 +72,9 @@ impl SileroVad {return Ok(path);}- if !DOWNLOADING+ if DOWNLOADING.compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst)- .is_ok()+ .is_err(){return Err(anyhow::anyhow!("silero vad model download already in progress"diff --git a/crates/screenpipe-connect/src/oauth.rs b/crates/screenpipe-connect/src/oauth.rsindex f2975adb8..8c62309e8 100644--- a/crates/screenpipe-connect/src/oauth.rs+++ b/crates/screenpipe-connect/src/oauth.rs@@ -157,7 +157,7 @@ pub fn delete_oauth_token_instance(integration_id: &str, instance: Option<&str>)/// Returns a vec of instance names (None = default/unnamed instance).pub fn list_oauth_instances(integration_id: &str) -> Vec<Option<String>> {let dir = screenpipe_core::paths::default_screenpipe_data_dir();- let prefix = format!("{}", integration_id);+ let prefix = integration_id.to_string();let suffix = "-oauth.json";let mut instances = Vec::new();diff --git a/crates/screenpipe-core/src/pipes/mod.rs b/crates/screenpipe-core/src/pipes/mod.rsindex 559399c94..0feceff94 100644--- a/crates/screenpipe-core/src/pipes/mod.rs+++ b/crates/screenpipe-core/src/pipes/mod.rs@@ -3009,8 +3009,9 @@ impl PipeManager {// Circular chain detection: if pipe X was triggered by// pipe_completed:Y within the cooldown, don't let// pipe_completed:X trigger Y back.- if event_name.starts_with("pipe_completed:") {- let source_pipe = &event_name["pipe_completed:".len()..];+ if let Some(source_pipe) =+ event_name.strip_prefix("pipe_completed:")+ {let reverse_key = format!("{}→{}", name, source_pipe);if recent_chain.contains_key(&reverse_key) {debug!(diff --git a/crates/screenpipe-db/src/write_queue.rs b/crates/screenpipe-db/src/write_queue.rsindex fe3fe0a4f..bfb7e85f7 100644--- a/crates/screenpipe-db/src/write_queue.rs+++ b/crates/screenpipe-db/src/write_queue.rs@@ -529,20 +529,18 @@ async fn execute_batch(*result = Err(sqlx::Error::WorkerCrashed);}}- } else {- if let Err(e) = sqlx::query("COMMIT").execute(&mut *conn).await {- warn!("write_queue: COMMIT failed: {}", e);- let msg = e.to_string().to_lowercase();- if !msg.contains("no transaction is active") {- warn!("write_queue: detaching connection due to commit failure");- let _raw = conn.detach();- }- // All results become the commit error- for pw in batch.drain(..) {- let _ = pw.respond.send(Err(sqlx::Error::WorkerCrashed));- }- return;+ } else if let Err(e) = sqlx::query("COMMIT").execute(&mut *conn).await {+ warn!("write_queue: COMMIT failed: {}", e);+ let msg = e.to_string().to_lowercase();+ if !msg.contains("no transaction is active") {+ warn!("write_queue: detaching connection due to commit failure");+ let _raw = conn.detach();+ }+ // All results become the commit error+ for pw in batch.drain(..) {+ let _ = pw.respond.send(Err(sqlx::Error::WorkerCrashed));}+ return;}// Send results to callersdiff --git a/crates/screenpipe-engine/src/cli/connection.rs b/crates/screenpipe-engine/src/cli/connection.rsindex 4d5dc1442..bb47a26f3 100644--- a/crates/screenpipe-engine/src/cli/connection.rs+++ b/crates/screenpipe-engine/src/cli/connection.rs@@ -150,13 +150,11 @@ pub async fn handle_connection_command(command: &ConnectionCommand) -> anyhow::R} else {println!("{}: connected (via OAuth)", id);}+ } else if *use_json {+ println!("{}", json!({ "id": id, "credentials": null }));} else {- if *use_json {- println!("{}", json!({ "id": id, "credentials": null }));- } else {- println!("{} is not connected", id);- println!("\nhint: screenpipe connection set {} key=value ...", id);- }+ println!("{} is not connected", id);+ println!("\nhint: screenpipe connection set {} key=value ...", id);}}diff --git a/crates/screenpipe-engine/src/cli/mod.rs b/crates/screenpipe-engine/src/cli/mod.rsindex c9f2bd666..63e486266 100644--- a/crates/screenpipe-engine/src/cli/mod.rs+++ b/crates/screenpipe-engine/src/cli/mod.rs@@ -711,8 +711,7 @@ mod tests {#[test]fn test_pause_on_drm_content_flag_sets_true() {- let cli =- Cli::try_parse_from(["screenpipe", "record", "--pause-on-drm-content"]).unwrap();+ let cli = Cli::try_parse_from(["screenpipe", "record", "--pause-on-drm-content"]).unwrap();match cli.command {Command::Record(args) => {assert!(args.pause_on_drm_content, "flag should set to true");@@ -723,8 +722,7 @@ mod tests {#[test]fn test_pause_on_drm_content_flows_to_recording_settings() {- let cli =- Cli::try_parse_from(["screenpipe", "record", "--pause-on-drm-content"]).unwrap();+ let cli = Cli::try_parse_from(["screenpipe", "record", "--pause-on-drm-content"]).unwrap();match cli.command {Command::Record(args) => {let settings = args.to_recording_settings();diff --git a/crates/screenpipe-engine/src/drm_detector.rs b/crates/screenpipe-engine/src/drm_detector.rsindex 39cfc2814..39072e7b8 100644--- a/crates/screenpipe-engine/src/drm_detector.rs+++ b/crates/screenpipe-engine/src/drm_detector.rs@@ -878,13 +878,9 @@ mod tests {#[test]fn test_check_and_update_drm_state_clears_flag_on_non_drm() {DRM_CONTENT_PAUSED.store(true, Ordering::SeqCst);- let result =- check_and_update_drm_state(true, Some("Finder"), Some("https://google.com"));+ let result = check_and_update_drm_state(true, Some("Finder"), Some("https://google.com"));assert!(!result, "should return false for non-DRM content");- assert!(- !drm_content_paused(),- "global flag should be cleared"- );+ assert!(!drm_content_paused(), "global flag should be cleared");DRM_CONTENT_PAUSED.store(false, Ordering::SeqCst);}@@ -918,12 +914,18 @@ mod tests {DRM_CONTENT_PAUSED.store(false, Ordering::SeqCst);let result = check_and_update_drm_state(true, None, None);// With flag=false and no DRM info, it returns false (current state)- assert!(!result, "should return false when flag was false and app unknown");+ assert!(+ !result,+ "should return false when flag was false and app unknown"+ );DRM_CONTENT_PAUSED.store(true, Ordering::SeqCst);let result = check_and_update_drm_state(true, None, None);// With flag=true and no DRM info, it preserves true (unknown = keep)- assert!(result, "should return true when flag was true and app unknown");+ assert!(+ result,+ "should return true when flag was true and app unknown"+ );DRM_CONTENT_PAUSED.store(false, Ordering::SeqCst);}}diff --git a/crates/screenpipe-engine/src/event_driven_capture.rs b/crates/screenpipe-engine/src/event_driven_capture.rsindex b60e54831..687707a89 100644--- a/crates/screenpipe-engine/src/event_driven_capture.rs+++ b/crates/screenpipe-engine/src/event_driven_capture.rs@@ -27,6 +27,22 @@ use std::time::{Duration, Instant};use tokio::sync::{broadcast, watch};use tracing::{debug, error, info, warn};+/// Stable configuration for a single capture invocation.+///+/// Groups parameters that don't change between captures on the same monitor,+/// keeping `do_capture`'s argument list manageable.+pub struct CaptureParams<'a> {+ pub db: &'a DatabaseManager,+ pub monitor: &'a SafeMonitor,+ pub monitor_id: u32,+ pub device_name: &'a str,+ pub snapshot_writer: &'a SnapshotWriter,+ pub tree_walker_config: &'a TreeWalkerConfig,+ pub use_pii_removal: bool,+ pub pause_on_drm_content: bool,+ pub languages: &'a [screenpipe_core::Language],+}+/// Types of events that trigger a capture.#[derive(Debug, Clone, PartialEq)]pub enum CaptureTrigger {@@ -259,6 +275,18 @@ pub async fn event_driven_capture_loop(// Sentry with 100k+ identical events.let mut consecutive_capture_errors: u32 = 0;+ let capture_params = CaptureParams {+ db: &db,+ monitor: &monitor,+ monitor_id,+ device_name: &device_name,+ snapshot_writer: &snapshot_writer,+ tree_walker_config: &tree_walker_config,+ use_pii_removal,+ pause_on_drm_content,+ languages: &languages,+ };+// Capture immediately on startup so the timeline has a frame right away.// Also seeds the frame comparer so subsequent visual-change checks work.// Skip if screen is locked — avoids storing black frames from sleep/lock.@@ -272,16 +300,8 @@ pub async fn event_driven_capture_loop(.checked_sub(Duration::from_millis(500)).unwrap_or(Instant::now()); // allow capturematch do_capture(- &db,- &monitor,- monitor_id,- &device_name,- &snapshot_writer,- &tree_walker_config,+ &capture_params,&CaptureTrigger::Manual,- use_pii_removal,- pause_on_drm_content,- &languages,None, // first capture — no previous hashlast_db_write,None, // first capture — no elements ref@@ -510,16 +530,8 @@ pub async fn event_driven_capture_loop(let capture_result = tokio::time::timeout(Duration::from_secs(15),do_capture(- &db,- &monitor,- monitor_id,- &device_name,- &snapshot_writer,- &tree_walker_config,+ &capture_params,&trigger,- use_pii_removal,- pause_on_drm_content,- &languages,last_content_hash,last_db_write,elements_ref,@@ -746,16 +758,8 @@ fn resolve_capture_metadata(/// `CaptureOutput.result` will be `None` in that case — the caller should still/// update the frame comparer with the image but skip DB/metrics work.async fn do_capture(- db: &DatabaseManager,- monitor: &SafeMonitor,- monitor_id: u32,- device_name: &str,- snapshot_writer: &SnapshotWriter,- tree_walker_config: &TreeWalkerConfig,+ params: &CaptureParams<'_>,trigger: &CaptureTrigger,- use_pii_removal: bool,- pause_on_drm_content: bool,- languages: &[screenpipe_core::Language],previous_content_hash: Option<i64>,last_db_write: Instant,elements_ref_frame_id: Option<i64>,@@ -764,16 +768,16 @@ async fn do_capture(let captured_at = Utc::now();// Take screenshot- let (image, capture_dur) = capture_monitor_image(monitor).await?;+ let (image, capture_dur) = capture_monitor_image(params.monitor).await?;debug!("screenshot captured in {:?} for monitor {}",- capture_dur, monitor_id+ capture_dur, params.monitor_id);// Walk accessibility tree on blocking thread (AX APIs are synchronous).// Apply adaptive budget overrides: expensive apps (Electron/Discord) get// reduced max_nodes and timeout to avoid blocking their UI thread.- let mut config = tree_walker_config.clone();+ let mut config = params.tree_walker_config.clone();// Get the focused app name for budget decisions. AppSwitch triggers carry// the name directly; for all other triggers (visual change, idle, manual)@@ -841,7 +845,7 @@ async fn do_capture(TreeWalkResult::Skipped(reason) => {debug!("skipping capture: window filtered ({}) on monitor {}",- reason, monitor_id+ reason, params.monitor_id);return Ok(CaptureOutput {result: None,@@ -866,7 +870,7 @@ async fn do_capture(if prev == new_hash && new_hash != 0 {info!("content dedup: skipping capture for monitor {} (hash={}, trigger={})",- monitor_id,+ params.monitor_id,new_hash,trigger.as_str());@@ -897,7 +901,7 @@ async fn do_capture({warn!("skipping capture: lock screen app '{}' on monitor {}",- app, monitor_id+ app, params.monitor_id);crate::sleep_monitor::set_screen_locked(true);return Ok(CaptureOutput {@@ -909,7 +913,7 @@ async fn do_capture(// Screen was marked locked but now a real app is focused — unlockdebug!("screen unlocked: app '{}' detected on monitor {}",- app, monitor_id+ app, params.monitor_id);crate::sleep_monitor::set_screen_locked(false);}@@ -919,7 +923,7 @@ async fn do_capture(// can't read loginwindow's UI so app_name comes back None/"Unknown".warn!("skipping capture: no app detected and screen is locked on monitor {}",- monitor_id+ params.monitor_id);return Ok(CaptureOutput {result: None,@@ -932,7 +936,7 @@ async fn do_capture(// When detected, set the global pause flag so ALL monitors stop capture// and the monitor watcher releases all SCK handles.if crate::drm_detector::check_and_update_drm_state(- pause_on_drm_content,+ params.pause_on_drm_content,app_name_owned.as_deref(),browser_url_owned.as_deref(),) {@@ -944,19 +948,19 @@ async fn do_capture(}let ctx = CaptureContext {- db,- snapshot_writer,+ db: params.db,+ snapshot_writer: params.snapshot_writer,image: Arc::new(image),captured_at,- monitor_id,- device_name,+ monitor_id: params.monitor_id,+ device_name: params.device_name,app_name: app_name_owned.as_deref(),window_name: window_name_owned.as_deref(),browser_url: browser_url_owned.as_deref(),focused: true, // event-driven captures are always for the focused windowcapture_trigger: trigger.as_str(),- use_pii_removal,- languages: languages.to_vec(),+ use_pii_removal: params.use_pii_removal,+ languages: params.languages.to_vec(),elements_ref_frame_id,};diff --git a/crates/screenpipe-engine/src/meeting_detector.rs b/crates/screenpipe-engine/src/meeting_detector.rsindex c3a86a405..ccd485b70 100644--- a/crates/screenpipe-engine/src/meeting_detector.rs+++ b/crates/screenpipe-engine/src/meeting_detector.rs@@ -947,46 +947,46 @@ fn check_signal_match_precomputed() -> bool {match &ps.signal {CallSignal::AutomationId(id) => {- identifier_lower.map_or(false, |ident| ident.eq_ignore_ascii_case(id))+ identifier_lower.is_some_and(|ident| ident.eq_ignore_ascii_case(id))}CallSignal::AutomationIdContains(_) => {- identifier_lower.map_or(false, |ident| ident.contains(&ps.lower[..]))+ identifier_lower.is_some_and(|ident| ident.contains(&ps.lower[..]))}CallSignal::KeyboardShortcut(_) => {- let in_desc = desc_lower.map_or(false, |d| d.contains(&ps.lower[..]));- let in_title = title_lower.map_or(false, |t| t.contains(&ps.lower[..]));+ let in_desc = desc_lower.is_some_and(|d| d.contains(&ps.lower[..]));+ let in_title = title_lower.is_some_and(|t| t.contains(&ps.lower[..]));in_desc || in_title}CallSignal::RoleWithName { role: r, .. } => {if role != *r {return false;}- let in_title = title_lower.map_or(false, |t| t.contains(&ps.lower[..]));- let in_desc = desc_lower.map_or(false, |d| d.contains(&ps.lower[..]));+ let in_title = title_lower.is_some_and(|t| t.contains(&ps.lower[..]));+ let in_desc = desc_lower.is_some_and(|d| d.contains(&ps.lower[..]));in_title || in_desc}CallSignal::MenuBarItem { .. } => {if role != "AXMenuBarItem" {return false;}- title_lower.map_or(false, |t| t.contains(&ps.lower[..]))+ title_lower.is_some_and(|t| t.contains(&ps.lower[..]))}CallSignal::MenuItemId(_) => {if role != "AXMenuItem" {return false;}- identifier_lower.map_or(false, |ident| ident == &ps.lower[..])+ identifier_lower.is_some_and(|ident| ident == &ps.lower[..])}CallSignal::NameContains(_) => {// Role-agnostic: match any element whose title or description contains the text- let in_title = title_lower.map_or(false, |t| t.contains(&ps.lower[..]));- let in_desc = desc_lower.map_or(false, |d| d.contains(&ps.lower[..]));+ let in_title = title_lower.is_some_and(|t| t.contains(&ps.lower[..]));+ let in_desc = desc_lower.is_some_and(|d| d.contains(&ps.lower[..]));in_title || in_desc}CallSignal::WindowTitle { .. } => {// Checked separately against root window element, not during tree walk.// But support it here for completeness (matches on title).- title_lower.map_or(false, |t| t.contains(&ps.lower[..]))+ title_lower.is_some_and(|t| t.contains(&ps.lower[..]))}}}@@ -1044,7 +1044,7 @@ fn get_ax_identifier(elem: &cidre::ax::UiElement) -> Option<String> {// Try AXIdentifier (native apps)let ident_name = cidre::cf::String::from_str("AXIdentifier");let ident_attr = cidre::ax::Attr::with_string(&ident_name);- if let Some(val) = get_ax_string_attr(elem, &ident_attr) {+ if let Some(val) = get_ax_string_attr(elem, ident_attr) {if !val.is_empty() {return Some(val);}@@ -1053,7 +1053,7 @@ fn get_ax_identifier(elem: &cidre::ax::UiElement) -> Option<String> {// Try AXDOMIdentifier (web content in browsers/Electron)let dom_ident_name = cidre::cf::String::from_str("AXDOMIdentifier");let dom_ident_attr = cidre::ax::Attr::with_string(&dom_ident_name);- if let Some(val) = get_ax_string_attr(elem, &dom_ident_attr) {+ if let Some(val) = get_ax_string_attr(elem, dom_ident_attr) {if !val.is_empty() {return Some(val);}@@ -1811,16 +1811,15 @@ pub fn find_running_meeting_apps(// Check browser URL patterns — only if this is a browserif !profile.app_identifiers.browser_url_patterns.is_empty()&& BROWSER_NAMES.iter().any(|b| name_lower.contains(b))+ && has_browser_meeting_url(pid, profile.app_identifiers.browser_url_patterns){- if has_browser_meeting_url(pid, &profile.app_identifiers.browser_url_patterns) {- results.push(RunningMeetingApp {- pid,- app_name: name.clone(),- profile_index: idx,- browser_url: None,- });- break;- }+ results.push(RunningMeetingApp {+ pid,+ app_name: name.clone(),+ profile_index: idx,+ browser_url: None,+ });+ break;}}}@@ -2311,7 +2310,7 @@ pub async fn run_meeting_detection_loop(current_interval = IDLE_NO_APPS_SCAN_INTERVAL;idle_scan_count += 1;// Periodic summary every ~60s (2 cycles at 30s)- if idle_scan_count % 2 == 0 {+ if idle_scan_count.is_multiple_of(2) {debug!("meeting v2: idle, no meeting apps (scans={})",idle_scan_count@@ -2354,7 +2353,13 @@ pub async fn run_meeting_detection_loop(// 2b. Check output audio when in Ending state for browser meetings.// If the audio output device still has data, the meeting is likely// still going — the user just switched tabs/apps.- let has_output_audio = if matches!(state, MeetingState::Ending { is_browser: true, .. }) {+ let has_output_audio = if matches!(+ state,+ MeetingState::Ending {+ is_browser: true,+ ..+ }+ ) {db.has_recent_output_audio(30).await.unwrap_or(false)} else {false@@ -3109,7 +3114,14 @@ mod tests {let (new_state, action) = advance_state(state, &results, true);assert!(- matches!(new_state, MeetingState::Active { meeting_id: 42, is_browser: true, .. }),+ matches!(+ new_state,+ MeetingState::Active {+ meeting_id: 42,+ is_browser: true,+ ..+ }+ ),"browser meeting should stay Active when output audio is flowing");assert!(action.is_none());@@ -3131,7 +3143,10 @@ mod tests {let (new_state, action) = advance_state(state, &results, true);assert!(matches!(new_state, MeetingState::Idle));- assert!(matches!(action, Some(StateAction::EndMeeting { meeting_id: 42 })));+ assert!(matches!(+ action,+ Some(StateAction::EndMeeting { meeting_id: 42 })+ ));}// ── Edge case tests ────────────────────────────────────────────────diff --git a/crates/screenpipe-engine/src/routes/browser.rs b/crates/screenpipe-engine/src/routes/browser.rsindex 44692c1d3..8b9019fc0 100644--- a/crates/screenpipe-engine/src/routes/browser.rs+++ b/crates/screenpipe-engine/src/routes/browser.rs@@ -148,10 +148,8 @@ pub async fn browser_eval_handler(let send_result = {let mut sink = ext_tx.lock().await;- sink.send(Message::Text(- serde_json::to_string(&ws_msg).unwrap().into(),- ))- .await+ sink.send(Message::Text(serde_json::to_string(&ws_msg).unwrap()))+ .await};if let Err(e) = send_result {diff --git a/crates/screenpipe-engine/src/routes/transcribe.rs b/crates/screenpipe-engine/src/routes/transcribe.rsindex 09df82ca7..63ff0083d 100644--- a/crates/screenpipe-engine/src/routes/transcribe.rs+++ b/crates/screenpipe-engine/src/routes/transcribe.rs@@ -109,7 +109,7 @@ pub async fn transcribe_handler(// Write to temp file so ffmpeg can decode itlet ext = filename.rsplit('.').next().unwrap_or("bin");- let tmp = match NamedTempFile::with_suffix(&format!(".{}", ext)) {+ let tmp = match NamedTempFile::with_suffix(format!(".{}", ext)) {Ok(t) => t,Err(e) => {error!("failed to create temp file: {}", e);diff --git a/crates/screenpipe-engine/src/sync_api.rs b/crates/screenpipe-engine/src/sync_api.rsindex 3f144cd0d..f0ec09cef 100644--- a/crates/screenpipe-engine/src/sync_api.rs+++ b/crates/screenpipe-engine/src/sync_api.rs@@ -103,7 +103,7 @@ pub async fn sync_init(// Generate or use provided machine IDlet machine_id = request.machine_id- .unwrap_or_else(|| screenpipe_core::sync::get_or_create_machine_id());+ .unwrap_or_else(screenpipe_core::sync::get_or_create_machine_id);// Get device infolet device_name = hostname::get()diff --git a/crates/screenpipe-engine/src/vision_manager/manager.rs b/crates/screenpipe-engine/src/vision_manager/manager.rsindex fcb4552df..88b39ed87 100644--- a/crates/screenpipe-engine/src/vision_manager/manager.rs+++ b/crates/screenpipe-engine/src/vision_manager/manager.rs@@ -432,8 +432,7 @@ mod tests {// Simulate stop_monitor logicif let Some((_, handle)) = tasks.remove(&1) {handle.abort();- let result =- tokio::time::timeout(std::time::Duration::from_secs(3), handle).await;+ let result = tokio::time::timeout(std::time::Duration::from_secs(3), handle).await;// Should complete well before 3sassert!(result.is_ok(), "normal task should finish within timeout");}@@ -457,8 +456,7 @@ mod tests {if let Some((_, handle)) = tasks.remove(&1) {handle.abort();let start = std::time::Instant::now();- let result =- tokio::time::timeout(std::time::Duration::from_secs(3), handle).await;+ let result = tokio::time::timeout(std::time::Duration::from_secs(3), handle).await;let elapsed = start.elapsed();// The timeout should fire around 3s, not 30s@@ -484,8 +482,7 @@ mod tests {if let Some((_, handle)) = tasks.remove(&1) {handle.abort();- let result =- tokio::time::timeout(std::time::Duration::from_secs(3), handle).await;+ let result = tokio::time::timeout(std::time::Duration::from_secs(3), handle).await;assert!(result.is_ok(),"already-finished task should resolve instantly"