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
style: fix cargo fmt formatting issues
Louis Beaumont972e6ce45431
diff --git a/screenpipe-audio/src/audio_manager/manager.rs b/screenpipe-audio/src/audio_manager/manager.rsindex 363b0c559..4ad88639f 100644--- a/screenpipe-audio/src/audio_manager/manager.rs+++ b/screenpipe-audio/src/audio_manager/manager.rs@@ -426,10 +426,7 @@ impl AudioManager {// Stop the device in device manager (clears streams and states)let _ = self.device_manager.stop_device(&device).await;- info!(- "cleaned up stale device {} for restart",- device_name- );+ info!("cleaned up stale device {} for restart", device_name);Ok(())}diff --git a/screenpipe-audio/src/core/device.rs b/screenpipe-audio/src/core/device.rsindex 1ebb5e797..a71deb51e 100644--- a/screenpipe-audio/src/core/device.rs+++ b/screenpipe-audio/src/core/device.rs@@ -305,10 +305,7 @@ fn test_device_works(device: &cpal::Device, is_input: bool) -> bool {/// Linux fallback: try default device, then enumerate and find first working device#[cfg(target_os = "linux")]-fn get_linux_device_with_fallback(- host: &cpal::Host,- is_input: bool,-) -> Result<cpal::Device> {+fn get_linux_device_with_fallback(host: &cpal::Host, is_input: bool) -> Result<cpal::Device> {// First, try the default devicelet default_device = if is_input {host.default_input_device()diff --git a/screenpipe-audio/src/transcription/transcription_result.rs b/screenpipe-audio/src/transcription/transcription_result.rsindex 594ef2a81..88da08162 100644--- a/screenpipe-audio/src/transcription/transcription_result.rs+++ b/screenpipe-audio/src/transcription/transcription_result.rs@@ -219,7 +219,8 @@ mod tests {/// Test that PII removal preserves non-PII content#[test]fn test_pii_removal_preserves_non_pii() {- let input = "The meeting is at 3 PM in conference room 42. We'll discuss the quarterly report.";+ let input =+ "The meeting is at 3 PM in conference room 42. We'll discuss the quarterly report.";let result = remove_pii(input);assert_eq!(result, input); // No changes - no PII present}@@ -267,7 +268,10 @@ mod tests {// Meeting transcription with email mentionlet input = "So Sarah said to email her at [email protected] about the proposal";let result = remove_pii(input);- assert_eq!(result, "So Sarah said to email her at [EMAIL] about the proposal");+ assert_eq!(+ result,+ "So Sarah said to email her at [EMAIL] about the proposal"+ );// Customer service call with card numberlet input = "I'll read you the card number: 4111 1111 1111 1111";diff --git a/screenpipe-audio/tests/dedup_benchmark/fixtures.rs b/screenpipe-audio/tests/dedup_benchmark/fixtures.rsindex 0e92b3407..8bf0c684c 100644--- a/screenpipe-audio/tests/dedup_benchmark/fixtures.rs+++ b/screenpipe-audio/tests/dedup_benchmark/fixtures.rs@@ -90,11 +90,11 @@ pub struct SpeakerProfile {#[derive(Debug, Clone, Copy)]pub enum SpeakingStyle {- Formal, // Business-like, complete sentences- Casual, // Relaxed, informal- Technical, // Precise, jargon-heavy- Verbose, // Long explanations- Concise, // Short, to the point+ Formal, // Business-like, complete sentences+ Casual, // Relaxed, informal+ Technical, // Precise, jargon-heavy+ Verbose, // Long explanations+ Concise, // Short, to the point}pub const SPEAKER_PROFILES: &[SpeakerProfile] = &[@@ -230,7 +230,10 @@ pub const OVERLAP_PATTERNS: &[(&str, &str)] = &[// Subset overlap("the meeting starts at three", "at three oclock sharp"),// No overlap- ("the weather is nice today", "lets go for a walk in the park"),+ (+ "the weather is nice today",+ "lets go for a walk in the park",+ ),];// =============================================================================@@ -310,7 +313,8 @@ pub fn generate_intermittent_scenario(let mut rng = StdRng::seed_from_u64(seed);let total_secs = total_duration_minutes * 60.0;- let silence_between = (total_secs - (burst_count as f64 * avg_burst_duration_secs)) / burst_count as f64;+ let silence_between =+ (total_secs - (burst_count as f64 * avg_burst_duration_secs)) / burst_count as f64;let speaker = SimSpeaker::new(0, "Speaker");let mut session = RecordingSession::new(seed)@@ -330,7 +334,8 @@ pub fn generate_intermittent_scenario(let segments_in_burst = rng.random_range(2..6);for _ in 0..segments_in_burst {let text = *CASUAL_SEGMENTS.choose(&mut rng).unwrap();- session = session.add_segment(SpeechSegment::speech(text, speaker.clone(), current_time));+ session =+ session.add_segment(SpeechSegment::speech(text, speaker.clone(), current_time));let duration = session.segments.last().map(|s| s.duration()).unwrap_or(2.0);current_time += duration + rng.random_range(0.2..0.8);}@@ -378,13 +383,13 @@ pub fn generate_24h_scenario(seed: u64) -> RecordingSession {// Activity probability varies by hourlet activity_prob = match hour_of_day as usize {- 0..=5 => 0.05, // Night: very low activity- 6..=8 => 0.3, // Morning: moderate- 9..=11 => 0.7, // Work hours: high- 12..=13 => 0.5, // Lunch: moderate- 14..=17 => 0.7, // Afternoon: high- 18..=21 => 0.4, // Evening: moderate- _ => 0.1, // Late night: low+ 0..=5 => 0.05, // Night: very low activity+ 6..=8 => 0.3, // Morning: moderate+ 9..=11 => 0.7, // Work hours: high+ 12..=13 => 0.5, // Lunch: moderate+ 14..=17 => 0.7, // Afternoon: high+ 18..=21 => 0.4, // Evening: moderate+ _ => 0.1, // Late night: low};if rng.random::<f64>() < activity_prob {diff --git a/screenpipe-audio/tests/dedup_benchmark/integration.rs b/screenpipe-audio/tests/dedup_benchmark/integration.rsindex fb4723d54..4a3165bb6 100644--- a/screenpipe-audio/tests/dedup_benchmark/integration.rs+++ b/screenpipe-audio/tests/dedup_benchmark/integration.rs@@ -300,11 +300,11 @@ fn test_interleaved_devices_stress() {let sequence = vec![("speaker", "hello world"),- ("mic", "hello world"), // dup of speaker+ ("mic", "hello world"), // dup of speaker("speaker", "how are you"),- ("mic", "how are you"), // dup of speaker+ ("mic", "how are you"), // dup of speaker("speaker", "im doing well"),- ("mic", "im doing well"), // dup of speaker+ ("mic", "im doing well"), // dup of speaker];for (_device, text) in &sequence {@@ -330,18 +330,16 @@ fn test_interleaved_devices_failure_case() {// t=2: Mic → "hello world" (delayed capture of t=0)// The mic's "hello world" is compared to "how are you", no overlap, INSERTED- sim.process_fixed("hello world"); // Speaker t=0- sim.process_fixed("how are you"); // Speaker t=1- sim.process_fixed("hello world"); // Mic t=2 (delayed)+ sim.process_fixed("hello world"); // Speaker t=0+ sim.process_fixed("how are you"); // Speaker t=1+ sim.process_fixed("hello world"); // Mic t=2 (delayed)// This WILL insert the duplicate because previous is "how are you"// This is a known limitation that requires per-device or time-based trackingprintln!("\n=== KNOWN LIMITATION TEST ===");println!("Inserted: {:?}", sim.inserted);- println!(- "Note: Delayed mic capture bypasses dedup due to single-state tracking"- );+ println!("Note: Delayed mic capture bypasses dedup due to single-state tracking");println!("Fix requires: per-device tracking or time-windowed comparison");println!("=============================\n");@@ -445,13 +443,13 @@ fn comprehensive_accuracy_report() {let mut sim = HandleNewTranscriptSimulator::new();let sequence = ["welcome to the meeting",- "welcome to the meeting", // dup+ "welcome to the meeting", // dup"lets discuss the agenda",- "lets discuss the agenda", // dup+ "lets discuss the agenda", // dup"any questions",- "no questions here", // different+ "no questions here", // different"okay moving on",- "okay moving on", // dup+ "okay moving on", // dup];for t in &sequence {diff --git a/screenpipe-audio/tests/dedup_benchmark/metrics.rs b/screenpipe-audio/tests/dedup_benchmark/metrics.rsindex bb9163ae1..f88cd4202 100644--- a/screenpipe-audio/tests/dedup_benchmark/metrics.rs+++ b/screenpipe-audio/tests/dedup_benchmark/metrics.rs@@ -257,7 +257,12 @@ impl fmt::Display for BenchmarkResult {writeln!(f, "Description: {}", self.description)?;writeln!(f)?;writeln!(f, "Configuration:")?;- writeln!(f, " Duration: {:.1}s ({:.1} min)", self.duration_secs, self.duration_secs / 60.0)?;+ writeln!(+ f,+ " Duration: {:.1}s ({:.1} min)",+ self.duration_secs,+ self.duration_secs / 60.0+ )?;writeln!(f, " Devices: {}", self.num_devices)?;writeln!(f, " Speakers: {}", self.num_speakers)?;writeln!(f, " Total inputs: {}", self.total_inputs)?;@@ -271,11 +276,7 @@ impl fmt::Display for BenchmarkResult {writeln!(f, "{}", self.fixed_metrics)?;writeln!(f, "{:->15} IMPROVEMENT {:->15}", "", "")?;- writeln!(- f,- " F1 Score: {:+.2}%",- self.f1_improvement() * 100.0- )?;+ writeln!(f, " F1 Score: {:+.2}%", self.f1_improvement() * 100.0)?;writeln!(f," Recall: {:+.2}%",diff --git a/screenpipe-audio/tests/dedup_benchmark/scenarios.rs b/screenpipe-audio/tests/dedup_benchmark/scenarios.rsindex e8f46946e..40c35401e 100644--- a/screenpipe-audio/tests/dedup_benchmark/scenarios.rs+++ b/screenpipe-audio/tests/dedup_benchmark/scenarios.rs@@ -119,7 +119,11 @@ fn scenario_exact_duplicates_cross_device() {let mut current_time = 0.0;for segment in segments {- session = session.add_segment(SpeechSegment::speech(segment, speaker.clone(), current_time));+ session = session.add_segment(SpeechSegment::speech(+ segment,+ speaker.clone(),+ current_time,+ ));current_time += 5.0; // 5 second gap between segments}@@ -209,7 +213,11 @@ fn scenario_noisy_transcriptions() {let mut current_time = 0.0;for segment in segments {- session = session.add_segment(SpeechSegment::speech(segment, speaker.clone(), current_time));+ session = session.add_segment(SpeechSegment::speech(+ segment,+ speaker.clone(),+ current_time,+ ));current_time += 5.0;}@@ -240,9 +248,9 @@ fn scenario_multiple_speakers() {println!("\n");let session = generate_meeting_scenario(- 5.0, // 5 minutes- 6, // 6 speakers- 0.7, // 70% speech density+ 5.0, // 5 minutes+ 6, // 6 speakers+ 0.7, // 70% speech density42,);@@ -272,9 +280,9 @@ fn scenario_intermittent_speech() {println!("\n");let session = generate_intermittent_scenario(- 10.0, // 10 minutes total- 8, // 8 speech bursts- 15.0, // Average 15 seconds per burst+ 10.0, // 10 minutes total+ 8, // 8 speech bursts+ 15.0, // Average 15 seconds per burst42,);@@ -342,7 +350,11 @@ fn scenario_edge_cases() {let mut current_time = 0.0;for segment in EDGE_CASE_SEGMENTS {- session = session.add_segment(SpeechSegment::speech(segment, speaker.clone(), current_time));+ session = session.add_segment(SpeechSegment::speech(+ segment,+ speaker.clone(),+ current_time,+ ));current_time += 3.0;}@@ -385,7 +397,11 @@ fn scenario_high_frequency_device_switching() {let mut current_time = 0.0;for segment in segments {- session = session.add_segment(SpeechSegment::speech(segment, speaker.clone(), current_time));+ session = session.add_segment(SpeechSegment::speech(+ segment,+ speaker.clone(),+ current_time,+ ));current_time += 2.0; // Very short gaps}@@ -426,12 +442,36 @@ fn scenario_overlapping_speakers() {// Create overlapping speech segmentssession = session- .add_segment(SpeechSegment::speech("hello everyone welcome to the meeting", speaker1.clone(), 0.0))- .add_segment(SpeechSegment::speech("yes thank you for having us here", speaker2.clone(), 1.5)) // Overlaps- .add_segment(SpeechSegment::speech("lets start with the agenda", speaker1.clone(), 4.0))- .add_segment(SpeechSegment::speech("sounds good to me", speaker2.clone(), 4.5)) // Overlaps- .add_segment(SpeechSegment::speech("first item is the project update", speaker1.clone(), 7.0))- .add_segment(SpeechSegment::speech("i have some updates to share", speaker2.clone(), 8.0)); // Overlaps+ .add_segment(SpeechSegment::speech(+ "hello everyone welcome to the meeting",+ speaker1.clone(),+ 0.0,+ ))+ .add_segment(SpeechSegment::speech(+ "yes thank you for having us here",+ speaker2.clone(),+ 1.5,+ )) // Overlaps+ .add_segment(SpeechSegment::speech(+ "lets start with the agenda",+ speaker1.clone(),+ 4.0,+ ))+ .add_segment(SpeechSegment::speech(+ "sounds good to me",+ speaker2.clone(),+ 4.5,+ )) // Overlaps+ .add_segment(SpeechSegment::speech(+ "first item is the project update",+ speaker1.clone(),+ 7.0,+ ))+ .add_segment(SpeechSegment::speech(+ "i have some updates to share",+ speaker2.clone(),+ 8.0,+ )); // Overlapslet result = run_scenario("Overlapping Speakers",@@ -465,11 +505,19 @@ fn benchmark_all_scenarios() {let mut current_time = 0.0;for segment in segments {- session = session.add_segment(SpeechSegment::speech(segment, speaker.clone(), current_time));+ session = session.add_segment(SpeechSegment::speech(+ segment,+ speaker.clone(),+ current_time,+ ));current_time += 5.0;}- report.add(run_scenario("Exact Duplicates", "Cross-device capture", session));+ report.add(run_scenario(+ "Exact Duplicates",+ "Cross-device capture",+ session,+ ));}// Scenario 2: Noisy transcriptions@@ -484,29 +532,49 @@ fn benchmark_all_scenarios() {let mut current_time = 0.0;for segment in segments {- session = session.add_segment(SpeechSegment::speech(segment, speaker.clone(), current_time));+ session = session.add_segment(SpeechSegment::speech(+ segment,+ speaker.clone(),+ current_time,+ ));current_time += 5.0;}- report.add(run_scenario("Noisy Transcriptions", "With Whisper noise", session));+ report.add(run_scenario(+ "Noisy Transcriptions",+ "With Whisper noise",+ session,+ ));}// Scenario 3: Multiple speakers{let session = generate_meeting_scenario(5.0, 6, 0.7, 44);- report.add(run_scenario("6-Speaker Meeting", "High activity meeting", session));+ report.add(run_scenario(+ "6-Speaker Meeting",+ "High activity meeting",+ session,+ ));}// Scenario 4: Intermittent speech{let session = generate_intermittent_scenario(10.0, 8, 15.0, 45);- report.add(run_scenario("Intermittent Speech", "Speech bursts with silences", session));+ report.add(run_scenario(+ "Intermittent Speech",+ "Speech bursts with silences",+ session,+ ));}// Scenario 5: 24/7 recording{let session = generate_24h_scenario(46);- report.add(run_scenario("24/7 Recording", "Continuous capture", session));+ report.add(run_scenario(+ "24/7 Recording",+ "Continuous capture",+ session,+ ));}// Scenario 6: Edge cases@@ -520,7 +588,11 @@ fn benchmark_all_scenarios() {let mut current_time = 0.0;for segment in EDGE_CASE_SEGMENTS {- session = session.add_segment(SpeechSegment::speech(segment, speaker.clone(), current_time));+ session = session.add_segment(SpeechSegment::speech(+ segment,+ speaker.clone(),+ current_time,+ ));current_time += 3.0;}diff --git a/screenpipe-audio/tests/dedup_benchmark/simulation.rs b/screenpipe-audio/tests/dedup_benchmark/simulation.rsindex 3d8982055..9dfeaafe4 100644--- a/screenpipe-audio/tests/dedup_benchmark/simulation.rs+++ b/screenpipe-audio/tests/dedup_benchmark/simulation.rs@@ -92,7 +92,7 @@ impl SimSpeaker {Self {id,name: name.to_string(),- wpm: 150.0, // Average speaking rate+ wpm: 150.0, // Average speaking ratefiller_rate: 0.05,repetition_rate: 0.02,}diff --git a/screenpipe-audio/tests/overlap_dedup_test.rs b/screenpipe-audio/tests/overlap_dedup_test.rsindex aceea7daa..a47b24098 100644--- a/screenpipe-audio/tests/overlap_dedup_test.rs+++ b/screenpipe-audio/tests/overlap_dedup_test.rs@@ -417,7 +417,10 @@ mod tests {if i > 0 && i < ground_truth_segments.len() - 1 {let overlap = format!("{} {}",- ground_truth_segments[i - 1].split_whitespace().last().unwrap_or(""),+ ground_truth_segments[i - 1]+ .split_whitespace()+ .last()+ .unwrap_or(""),segment.split_whitespace().next().unwrap_or(""));if overlap.split_whitespace().count() >= 2 {@@ -450,10 +453,7 @@ mod tests {println!("Blocked (duplicates): {}", blocked);println!("Expected unique: {}", expected_unique);println!("Dedup rate: {:.1}%", dedup_rate);- println!(- "Accuracy (inserted/expected): {:.1}%",- accuracy- );+ println!("Accuracy (inserted/expected): {:.1}%", accuracy);println!("================================\n");// We should block at least 30% as duplicates@@ -501,8 +501,14 @@ mod tests {println!("\n=== BUGGY vs FIXED COMPARISON ===");println!("Input: {} unique transcripts, each sent twice", expected);- println!("Buggy logic inserted: {} (should be {})", buggy_count, expected);- println!("Fixed logic inserted: {} (should be {})", fixed_count, expected);+ println!(+ "Buggy logic inserted: {} (should be {})",+ buggy_count, expected+ );+ println!(+ "Fixed logic inserted: {} (should be {})",+ fixed_count, expected+ );println!("Buggy duplicate rate: {:.1}%",(buggy_count as f64 / (expected * 2) as f64) * 100.0diff --git a/screenpipe-core/src/pii_removal.rs b/screenpipe-core/src/pii_removal.rsindex 5cefff06d..6c47ca2bf 100644--- a/screenpipe-core/src/pii_removal.rs+++ b/screenpipe-core/src/pii_removal.rs@@ -84,7 +84,9 @@ pub fn remove_pii(text: &str) -> String {////// This function sanitizes the "text" field in each OCR bounding box entry,/// preserving the coordinate information while redacting any PII.-pub fn remove_pii_from_text_json(text_json: &[HashMap<String, String>]) -> Vec<HashMap<String, String>> {+pub fn remove_pii_from_text_json(+ text_json: &[HashMap<String, String>],+) -> Vec<HashMap<String, String>> {text_json.iter().map(|entry| {@@ -377,14 +379,8 @@ mod tests {#[test]fn test_remove_pii_phone_numbers() {- assert_eq!(- remove_pii("Call me at 234-567-8901"),- "Call me at [PHONE]"- );- assert_eq!(- remove_pii("Phone: (555) 123-4567"),- "Phone: [PHONE]"- );+ assert_eq!(remove_pii("Call me at 234-567-8901"), "Call me at [PHONE]");+ assert_eq!(remove_pii("Phone: (555) 123-4567"), "Phone: [PHONE]");assert_eq!(remove_pii("Reach me at +1-800-555-1234"),"Reach me at [PHONE]"@@ -439,10 +435,7 @@ mod tests {remove_pii("Use key sk-proj-1234567890abcdefghijklmnop"),"Use key [API_KEY]");- assert_eq!(- remove_pii("AWS: AKIAIOSFODNN7EXAMPLE"),- "AWS: [AWS_KEY]"- );+ assert_eq!(remove_pii("AWS: AKIAIOSFODNN7EXAMPLE"), "AWS: [AWS_KEY]");assert_eq!(remove_pii("GitHub token: ghp_abcdefghijklmnopqrstuvwxyz1234567890"),"GitHub token: [GITHUB_TOKEN]"@@ -453,9 +446,18 @@ mod tests {fn test_get_pii_type_new_patterns() {assert_eq!(get_pii_type("234-567-8901"), Some("PHONE".to_string()));assert_eq!(get_pii_type("192.168.1.1"), Some("IP_ADDRESS".to_string()));- assert_eq!(get_pii_type("sk-abcdefghijklmnopqrst"), Some("API_KEY".to_string()));- assert_eq!(get_pii_type("AKIAIOSFODNN7EXAMPLE"), Some("AWS_KEY".to_string()));- assert_eq!(get_pii_type("ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"), Some("GITHUB_TOKEN".to_string()));+ assert_eq!(+ get_pii_type("sk-abcdefghijklmnopqrst"),+ Some("API_KEY".to_string())+ );+ assert_eq!(+ get_pii_type("AKIAIOSFODNN7EXAMPLE"),+ Some("AWS_KEY".to_string())+ );+ assert_eq!(+ get_pii_type("ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),+ Some("GITHUB_TOKEN".to_string())+ );}#[test]@@ -569,18 +571,9 @@ mod tests {#[test]fn test_password_context_basic() {// Basic password: value patterns- assert_eq!(- remove_pii("password: secret123"),- "password: [PASSWORD]"- );- assert_eq!(- remove_pii("Password: MyP@ssw0rd!"),- "Password: [PASSWORD]"- );- assert_eq!(- remove_pii("PASSWORD: test"),- "PASSWORD: [PASSWORD]"- );+ assert_eq!(remove_pii("password: secret123"), "password: [PASSWORD]");+ assert_eq!(remove_pii("Password: MyP@ssw0rd!"), "Password: [PASSWORD]");+ assert_eq!(remove_pii("PASSWORD: test"), "PASSWORD: [PASSWORD]");}#[test]@@ -599,24 +592,16 @@ mod tests {#[test]fn test_password_context_variants() {// Different password-related keywords- assert_eq!(- remove_pii("passcode: 123456"),- "passcode: [PASSWORD]"- );+ assert_eq!(remove_pii("passcode: 123456"), "passcode: [PASSWORD]");// Note: passphrase captures first token only to avoid over-redacting- assert!(remove_pii("passphrase: correct horse battery staple").contains("passphrase: [PASSWORD]"));- assert_eq!(- remove_pii("PIN: 1234"),- "PIN: [PASSWORD]"- );+ assert!(remove_pii("passphrase: correct horse battery staple")+ .contains("passphrase: [PASSWORD]"));+ assert_eq!(remove_pii("PIN: 1234"), "PIN: [PASSWORD]");assert_eq!(remove_pii("secret key: abc123xyz"),"secret key: [PASSWORD]");- assert_eq!(- remove_pii("unlock code: 9876"),- "unlock code: [PASSWORD]"- );+ assert_eq!(remove_pii("unlock code: 9876"), "unlock code: [PASSWORD]");assert_eq!(remove_pii("security code: 789"),"security code: [PASSWORD]"@@ -626,14 +611,8 @@ mod tests {#[test]fn test_password_context_equals_sign() {// Equals sign as separator- assert_eq!(- remove_pii("password=secret123"),- "password=[PASSWORD]"- );- assert_eq!(- remove_pii("PASSWORD = mypass"),- "PASSWORD = [PASSWORD]"- );+ assert_eq!(remove_pii("password=secret123"), "password=[PASSWORD]");+ assert_eq!(remove_pii("PASSWORD = mypass"), "PASSWORD = [PASSWORD]");}#[test]@@ -664,10 +643,7 @@ mod tests {remove_pii("password manager app"),"password manager app" // No colon/equals);- assert_eq!(- remove_pii("reset password link"),- "reset password link"- );+ assert_eq!(remove_pii("reset password link"), "reset password link");}#[test]diff --git a/screenpipe-db/tests/frame_offset_sync_test.rs b/screenpipe-db/tests/frame_offset_sync_test.rsindex 677bc2a74..d9d6a4b8a 100644--- a/screenpipe-db/tests/frame_offset_sync_test.rs+++ b/screenpipe-db/tests/frame_offset_sync_test.rs@@ -40,7 +40,10 @@ mod tests {let db = setup_test_db().await;// Create a video chunk- let chunk_id = db.insert_video_chunk("/tmp/test.mp4", "test_monitor").await.unwrap();+ let chunk_id = db+ .insert_video_chunk("/tmp/test.mp4", "test_monitor")+ .await+ .unwrap();assert!(chunk_id > 0, "Video chunk should be created");// First call should return 0 (no frames yet)@@ -99,7 +102,10 @@ mod tests {println!("\n=== FRAME OFFSET DESYNC DEMONSTRATION ===\n");// Create a video chunk- let _chunk_id = db.insert_video_chunk("/tmp/monitor1.mp4", "monitor_1").await.unwrap();+ let _chunk_id = db+ .insert_video_chunk("/tmp/monitor1.mp4", "monitor_1")+ .await+ .unwrap();// Simulate: Capture produces frames with frame_numbers 0, 1, 2, 3, 4// But video queue drops frame 2 (due to queue full)@@ -153,10 +159,7 @@ mod tests {"User searches for 'App3' (frame_number={})",searched_frame_number);- println!(- "DB returns offset={} for this frame",- db_offset_for_frame_3- );+ println!("DB returns offset={} for this frame", db_offset_for_frame_3);println!("Video position {} actually contains frame {} (App{})",db_offset_for_frame_3, actual_frame_at_video_pos_3, actual_frame_at_video_pos_3@@ -180,7 +183,10 @@ mod tests {println!("\n=== SOLUTION: Use frame_number as offset ===\n");// Create a video chunk- let _chunk_id = db.insert_video_chunk("/tmp/monitor2.mp4", "monitor_2").await.unwrap();+ let _chunk_id = db+ .insert_video_chunk("/tmp/monitor2.mp4", "monitor_2")+ .await+ .unwrap();// Same scenario: Video drops frame 2// But now we store frames with their actual frame_number as offset@@ -265,7 +271,10 @@ mod tests {async fn test_multiple_windows_same_offset() {let db = setup_test_db().await;- let _chunk_id = db.insert_video_chunk("/tmp/multi.mp4", "multi_window_monitor").await.unwrap();+ let _chunk_id = db+ .insert_video_chunk("/tmp/multi.mp4", "multi_window_monitor")+ .await+ .unwrap();// Single capture cycle produces 3 windows// All should share the same video offset since they're from same screenshot@@ -326,7 +335,10 @@ mod tests {let db = setup_test_db().await;// First chunk- let _chunk1 = db.insert_video_chunk("/tmp/chunk1.mp4", "reset_test").await.unwrap();+ let _chunk1 = db+ .insert_video_chunk("/tmp/chunk1.mp4", "reset_test")+ .await+ .unwrap();let offset1 = db.get_next_frame_offset("reset_test").await.unwrap();assert_eq!(offset1, 0, "First chunk should start at offset 0");@@ -354,7 +366,10 @@ mod tests {);// Create new chunk- let _chunk2 = db.insert_video_chunk("/tmp/chunk2.mp4", "reset_test").await.unwrap();+ let _chunk2 = db+ .insert_video_chunk("/tmp/chunk2.mp4", "reset_test")+ .await+ .unwrap();// Offset should reset to 0 for new chunklet offset_after_new_chunk = db.get_next_frame_offset("reset_test").await.unwrap();@@ -371,7 +386,10 @@ mod tests {async fn test_none_offset_uses_db_fallback() {let db = setup_test_db().await;- let _chunk = db.insert_video_chunk("/tmp/fallback.mp4", "fallback_test").await.unwrap();+ let _chunk = db+ .insert_video_chunk("/tmp/fallback.mp4", "fallback_test")+ .await+ .unwrap();// Insert with explicit offsetlet _ = db@@ -403,12 +421,11 @@ mod tests {assert!(frame2_id > 0);// Verify it got offset 1- let offset: (i64,) =- sqlx::query_as("SELECT offset_index FROM frames WHERE id = ?1")- .bind(frame2_id)- .fetch_one(&db.pool)- .await- .unwrap();+ let offset: (i64,) = sqlx::query_as("SELECT offset_index FROM frames WHERE id = ?1")+ .bind(frame2_id)+ .fetch_one(&db.pool)+ .await+ .unwrap();assert_eq!(offset.0, 1, "None offset should fallback to MAX+1");diff --git a/screenpipe-server/src/bin/screenpipe-server.rs b/screenpipe-server/src/bin/screenpipe-server.rsindex b4cd76770..485759ef5 100644--- a/screenpipe-server/src/bin/screenpipe-server.rs+++ b/screenpipe-server/src/bin/screenpipe-server.rs@@ -24,8 +24,11 @@ use screenpipe_server::{},handle_index_command,pipe_manager::PipeInfo,- start_continuous_recording, watch_pid, PipeManager, ResourceMonitor, SCServer,- vision_manager::{VisionManager, VisionManagerConfig, start_monitor_watcher, stop_monitor_watcher},+ start_continuous_recording,+ vision_manager::{+ start_monitor_watcher, stop_monitor_watcher, VisionManager, VisionManagerConfig,+ },+ watch_pid, PipeManager, ResourceMonitor, SCServer,};use screenpipe_vision::monitor::list_monitors;use serde::Deserialize;@@ -767,7 +770,8 @@ async fn main() -> anyhow::Result<()> {};// Create VisionManager for dynamic monitor detection if enabled- let vision_manager: Option<Arc<VisionManager>> = if cli.use_all_monitors && !cli.disable_vision {+ let vision_manager: Option<Arc<VisionManager>> = if cli.use_all_monitors && !cli.disable_vision+ {info!("Using dynamic monitor detection (--use-all-monitors)");let config = VisionManagerConfig {output_path: output_path_clone.to_string(),@@ -782,7 +786,11 @@ async fn main() -> anyhow::Result<()> {capture_unfocused_windows: cli.capture_unfocused_windows,realtime_vision: cli.enable_realtime_audio_transcription,};- Some(Arc::new(VisionManager::new(config, db_clone.clone(), vision_handle.clone())))+ Some(Arc::new(VisionManager::new(+ config,+ db_clone.clone(),+ vision_handle.clone(),+ )))} else {None};diff --git a/screenpipe-server/src/core.rs b/screenpipe-server/src/core.rsindex 01aec4f0c..b0d0b9e0f 100644--- a/screenpipe-server/src/core.rs+++ b/screenpipe-server/src/core.rs@@ -243,14 +243,19 @@ pub async fn record_video(// Check if this frame was actually written to video// If not, skip DB insertion to prevent offset mismatch- let frame_write_info = video_capture.frame_write_tracker.get_offset(frame.frame_number);+ let frame_write_info = video_capture+ .frame_write_tracker+ .get_offset(frame.frame_number);let video_frame_offset = match frame_write_info {Some(info) => info.offset as i64,None => {// Frame wasn't written to video (likely dropped from video queue)// Wait a bit and retry - the video encoder might not have processed it yettokio::time::sleep(std::time::Duration::from_millis(100)).await;- match video_capture.frame_write_tracker.get_offset(frame.frame_number) {+ match video_capture+ .frame_write_tracker+ .get_offset(frame.frame_number)+ {Some(info) => info.offset as i64,None => {debug!(@@ -296,7 +301,8 @@ pub async fn record_video(// Apply PII removal if enabledlet (text, sanitized_text_json) = if use_pii_removal {let sanitized_text = remove_pii(&window_result.text);- let sanitized_json = remove_pii_from_text_json(&window_result.text_json);+ let sanitized_json =+ remove_pii_from_text_json(&window_result.text_json);(sanitized_text, sanitized_json)} else {(window_result.text.clone(), window_result.text_json.clone())diff --git a/screenpipe-server/src/lib.rs b/screenpipe-server/src/lib.rsindex 9d5eb8c0f..be8e8bd30 100644--- a/screenpipe-server/src/lib.rs+++ b/screenpipe-server/src/lib.rs@@ -17,7 +17,7 @@ pub use add::handle_index_command;pub use auto_destruct::watch_pid;pub use axum::Json as JsonResponse;pub use cli::Cli;-pub use core::{start_continuous_recording, record_video};+pub use core::{record_video, start_continuous_recording};pub use pipe_manager::PipeManager;pub use resource_monitor::{ResourceMonitor, RestartSignal};pub use screenpipe_core::Language;diff --git a/screenpipe-server/src/server.rs b/screenpipe-server/src/server.rsindex 15c2cb230..e31f78eb4 100644--- a/screenpipe-server/src/server.rs+++ b/screenpipe-server/src/server.rs@@ -2494,7 +2494,6 @@ async fn stop_audio_device(}))}-#[derive(Debug, Serialize)]struct ExportProgress {status: String,@@ -2565,16 +2564,16 @@ async fn handle_video_export(if payload.frame_ids.is_empty() {info!("No frame_ids in URL, waiting for WebSocket message...");// Wait for frame_ids message with timeout- let timeout = tokio::time::timeout(- std::time::Duration::from_secs(30),- socket.recv()- ).await;+ let timeout = tokio::time::timeout(std::time::Duration::from_secs(30), socket.recv()).await;match timeout {Ok(Some(Ok(Message::Text(text)))) => {match serde_json::from_str::<VideoExportMessage>(&text) {Ok(msg) => {- info!("Received {} frame_ids via WebSocket message", msg.frame_ids.len());+ info!(+ "Received {} frame_ids via WebSocket message",+ msg.frame_ids.len()+ );payload.frame_ids = msg.frame_ids;}Err(e) => {diff --git a/screenpipe-server/src/video.rs b/screenpipe-server/src/video.rsindex be4dce57a..1c4fbe04c 100644--- a/screenpipe-server/src/video.rs+++ b/screenpipe-server/src/video.rs@@ -54,10 +54,8 @@ impl FrameWriteTracker {"FrameWriteTracker: recorded frame {} at offset {} in {}",frame_number, offset, video_path);- self.writes.insert(- frame_number,- FrameWriteInfo { offset, video_path },- );+ self.writes+ .insert(frame_number, FrameWriteInfo { offset, video_path });}/// Get the video offset for a frame. Returns None if frame wasn't written to video.@@ -707,7 +705,9 @@ async fn process_frames(*frame_count += 1;debug!("Wrote frame {} (frame_number={}) to FFmpeg at offset {}",- frame_count, frame_number, *frame_count - 1+ frame_count,+ frame_number,+ *frame_count - 1);flush_ffmpeg_input(stdin, *frame_count, fps).await;diff --git a/screenpipe-server/src/vision_manager/manager.rs b/screenpipe-server/src/vision_manager/manager.rsindex dff9443b8..7343737e9 100644--- a/screenpipe-server/src/vision_manager/manager.rs+++ b/screenpipe-server/src/vision_manager/manager.rs@@ -87,7 +87,10 @@ impl VisionManager {for monitor in monitors {let monitor_id = monitor.id();if let Err(e) = self.start_monitor(monitor_id).await {- warn!("Failed to start recording on monitor {}: {:?}", monitor_id, e);+ warn!(+ "Failed to start recording on monitor {}: {:?}",+ monitor_id, e+ );}}@@ -107,10 +110,17 @@ impl VisionManager {drop(status);// Stop all monitors- let monitor_ids: Vec<u32> = self.recording_tasks.iter().map(|entry| *entry.key()).collect();+ let monitor_ids: Vec<u32> = self+ .recording_tasks+ .iter()+ .map(|entry| *entry.key())+ .collect();for monitor_id in monitor_ids {if let Err(e) = self.stop_monitor(monitor_id).await {- warn!("Failed to stop recording on monitor {}: {:?}", monitor_id, e);+ warn!(+ "Failed to stop recording on monitor {}: {:?}",+ monitor_id, e+ );}}@@ -129,7 +139,8 @@ impl VisionManager {}// Verify monitor exists- let monitor = get_monitor_by_id(monitor_id).await+ let monitor = get_monitor_by_id(monitor_id)+ .await.ok_or_else(|| anyhow::anyhow!("Monitor {} not found", monitor_id))?;info!(@@ -170,13 +181,18 @@ impl VisionManager {languages.clone(),capture_unfocused_windows,realtime_vision,- ).await {+ )+ .await+ {Ok(_) => {info!("Monitor {} recording completed normally", monitor_id);break;}Err(e) => {- error!("Monitor {} recording error: {:?}, restarting in 1s...", monitor_id, e);+ error!(+ "Monitor {} recording error: {:?}, restarting in 1s...",+ monitor_id, e+ );tokio::time::sleep(Duration::from_secs(1)).await;}}@@ -208,7 +224,10 @@ impl VisionManager {/// Get list of currently recording monitor IDspub async fn active_monitors(&self) -> Vec<u32> {- self.recording_tasks.iter().map(|entry| *entry.key()).collect()+ self.recording_tasks+ .iter()+ .map(|entry| *entry.key())+ .collect()}/// Shutdown the VisionManagerdiff --git a/screenpipe-server/src/vision_manager/monitor_watcher.rs b/screenpipe-server/src/vision_manager/monitor_watcher.rsindex 4a06caa3f..f2950abd1 100644--- a/screenpipe-server/src/vision_manager/monitor_watcher.rs+++ b/screenpipe-server/src/vision_manager/monitor_watcher.rs@@ -1,9 +1,9 @@//! Monitor Watcher - Polls for monitor connect/disconnect events+use once_cell::sync::Lazy;use std::collections::HashSet;use std::sync::Arc;use std::time::Duration;-use once_cell::sync::Lazy;use tokio::sync::Mutex;use tokio::task::JoinHandle;use tracing::{debug, info, warn};@@ -43,7 +43,8 @@ pub async fn start_monitor_watcher(vision_manager: Arc<VisionManager>) -> anyhowlet current_ids: HashSet<u32> = current_monitors.iter().map(|m| m.id()).collect();// Get currently recording monitors- let active_ids: HashSet<u32> = vision_manager.active_monitors().await.into_iter().collect();+ let active_ids: HashSet<u32> =+ vision_manager.active_monitors().await.into_iter().collect();// Detect newly connected monitorsfor monitor_id in ¤t_ids {@@ -56,7 +57,10 @@ pub async fn start_monitor_watcher(vision_manager: Arc<VisionManager>) -> anyhow}if let Err(e) = vision_manager.start_monitor(*monitor_id).await {- warn!("Failed to start recording on monitor {}: {:?}", monitor_id, e);+ warn!(+ "Failed to start recording on monitor {}: {:?}",+ monitor_id, e+ );}}}@@ -66,7 +70,10 @@ pub async fn start_monitor_watcher(vision_manager: Arc<VisionManager>) -> anyhowif !current_ids.contains(monitor_id) {info!("Monitor {} disconnected, stopping recording", monitor_id);if let Err(e) = vision_manager.stop_monitor(*monitor_id).await {- warn!("Failed to stop recording on monitor {}: {:?}", monitor_id, e);+ warn!(+ "Failed to stop recording on monitor {}: {:?}",+ monitor_id, e+ );}}}diff --git a/screenpipe-vision/src/capture_screenshot_by_window.rs b/screenpipe-vision/src/capture_screenshot_by_window.rsindex 5568cd117..ac645f804 100644--- a/screenpipe-vision/src/capture_screenshot_by_window.rs+++ b/screenpipe-vision/src/capture_screenshot_by_window.rs@@ -269,17 +269,19 @@ impl WindowFilters {// For patterns without TLD (e.g., "chase" instead of "chase.com")if !blocked.contains('.') {// Match "chase.com", "chase.net", etc.- if host_lower == format!("{}.com", blocked) ||- host_lower == format!("{}.net", blocked) ||- host_lower == format!("{}.org", blocked) ||- host_lower == format!("{}.bank", blocked) {+ if host_lower == format!("{}.com", blocked)+ || host_lower == format!("{}.net", blocked)+ || host_lower == format!("{}.org", blocked)+ || host_lower == format!("{}.bank", blocked)+ {return true;}// Match "www.chase.com", "online.chase.com", etc.- if host_lower.ends_with(&format!(".{}.com", blocked)) ||- host_lower.ends_with(&format!(".{}.net", blocked)) ||- host_lower.ends_with(&format!(".{}.org", blocked)) ||- host_lower.ends_with(&format!(".{}.bank", blocked)) {+ if host_lower.ends_with(&format!(".{}.com", blocked))+ || host_lower.ends_with(&format!(".{}.net", blocked))+ || host_lower.ends_with(&format!(".{}.org", blocked))+ || host_lower.ends_with(&format!(".{}.bank", blocked))+ {return true;}}@@ -292,7 +294,9 @@ impl WindowFilters {// Fallback to simple contains check if URL parsing fails// This is less precise but ensures we don't miss obvious matcheslet url_lower = url.to_lowercase();- self.ignored_urls.iter().any(|blocked| url_lower.contains(blocked))+ self.ignored_urls+ .iter()+ .any(|blocked| url_lower.contains(blocked))}/// Check if a window title suggests it's a blocked site (fallback for unfocused windows)@@ -308,7 +312,8 @@ impl WindowFilters {self.ignored_urls.iter().any(|blocked| {// Remove TLD for title matching (wellsfargo.com -> wellsfargo)- let pattern = blocked.trim_end_matches(".com")+ let pattern = blocked+ .trim_end_matches(".com").trim_end_matches(".net").trim_end_matches(".org").trim_end_matches(".bank");@@ -321,9 +326,9 @@ impl WindowFilters {let no_space_match = title_no_spaces.contains(pattern);// Strategy 3: Check if pattern appears with word boundaries- let boundary_match = title_lower.starts_with(&format!("{} ", pattern)) ||- title_lower.contains(&format!(" {} ", pattern)) ||- title_lower.ends_with(&format!(" {}", pattern));+ let boundary_match = title_lower.starts_with(&format!("{} ", pattern))+ || title_lower.contains(&format!(" {} ", pattern))+ || title_lower.ends_with(&format!(" {}", pattern));word_match || no_space_match || boundary_match})@@ -491,7 +496,10 @@ pub async fn capture_all_visible_windows(// Check if URL should be blocked for privacy (e.g., banking sites)if let Some(ref url) = browser_url {if window_filters.is_url_blocked(url) {- tracing::info!("Privacy filter: Skipping window due to blocked URL: {}", url);+ tracing::info!(+ "Privacy filter: Skipping window due to blocked URL: {}",+ url+ );continue;}}@@ -711,11 +719,8 @@ mod tests {assert!(filters.is_valid("Chrome", "Google"));assert!(filters.is_valid("Chrome", "Private Window")); // ignore_set not checked!- let filters_with_include = WindowFilters::new(- &["private".to_string()],- &["chrome".to_string()],- &[],- );+ let filters_with_include =+ WindowFilters::new(&["private".to_string()], &["chrome".to_string()], &[]);// Chrome matches include, so valid even if title has "private"assert!(filters_with_include.is_valid("Chrome", "Google"));assert!(filters_with_include.is_valid("Chrome", "Private Window")); // include wins