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(ci): unbreak main after WindowServer perf series
Louis Beaumont2712dad6ee43
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lockindex bdc9b656e..18beaa004 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.60.2",+ "windows-sys 0.61.2",][[package]]@@ -435,7 +435,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"dependencies = ["anstyle","once_cell_polyfill",- "windows-sys 0.60.2",+ "windows-sys 0.61.2",][[package]]@@ -495,7 +495,7 @@ dependencies = ["objc2-foundation 0.3.2","parking_lot","percent-encoding",- "windows-sys 0.60.2",+ "windows-sys 0.59.0","x11rb",]@@ -3809,7 +3809,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]]@@ -4974,7 +4974,7 @@ dependencies = ["gobject-sys 0.21.5","libc","system-deps 7.0.7",- "windows-sys 0.52.0",+ "windows-sys 0.59.0",][[package]]@@ -6135,7 +6135,7 @@ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46"dependencies = ["hermit-abi","libc",- "windows-sys 0.52.0",+ "windows-sys 0.59.0",][[package]]@@ -9635,7 +9635,7 @@ dependencies = ["once_cell","socket2 0.5.10","tracing",- "windows-sys 0.60.2",+ "windows-sys 0.59.0",][[package]]@@ -10531,7 +10531,7 @@ dependencies = ["errno","libc","linux-raw-sys 0.12.1",- "windows-sys 0.52.0",+ "windows-sys 0.59.0",][[package]]@@ -10619,7 +10619,7 @@ dependencies = ["security-framework","security-framework-sys","webpki-root-certs",- "windows-sys 0.52.0",+ "windows-sys 0.59.0",][[package]]@@ -10826,7 +10826,7 @@ dependencies = [[[package]]name = "sck-rs"version = "0.1.0"-source = "git+https://github.com/screenpipe/sck-rs#cc39b0fee819f470b881d37658c940e7172c6431"+source = "git+https://github.com/screenpipe/sck-rs#a581b6a61c59c7c10258631f57fd837657f27380"dependencies = ["cidre 0.15.1","image 0.25.10",@@ -10876,7 +10876,7 @@ dependencies = [[[package]]name = "screenpipe-app"-version = "2.4.268"+version = "2.4.270"dependencies = ["aes 0.8.4","aes-gcm 0.10.3",@@ -12292,7 +12292,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]]@@ -13913,7 +13913,7 @@ dependencies = ["getrandom 0.4.2","once_cell","rustix 1.1.4",- "windows-sys 0.52.0",+ "windows-sys 0.59.0",][[package]]@@ -14756,7 +14756,7 @@ checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e"dependencies = ["memoffset","tempfile",- "windows-sys 0.60.2",+ "windows-sys 0.61.2",][[package]]diff --git a/crates/screenpipe-engine/src/event_driven_capture.rs b/crates/screenpipe-engine/src/event_driven_capture.rsindex 502e375a9..3a8c85249 100644--- a/crates/screenpipe-engine/src/event_driven_capture.rs+++ b/crates/screenpipe-engine/src/event_driven_capture.rs@@ -596,7 +596,10 @@ pub async fn event_driven_capture_loop(tokio::time::sleep(poll_interval).await;continue;} else if was_in_pause_state {- info!("monitor {}: exiting pause state, capture resumes", monitor_id);+ info!(+ "monitor {}: exiting pause state, capture resumes",+ monitor_id+ );was_in_pause_state = false;}diff --git a/crates/screenpipe-screen/examples/ocr_scale_bench.rs b/crates/screenpipe-screen/examples/ocr_scale_bench.rsindex 1f14df931..de589a6b0 100644--- a/crates/screenpipe-screen/examples/ocr_scale_bench.rs+++ b/crates/screenpipe-screen/examples/ocr_scale_bench.rs@@ -11,129 +11,166 @@// As a sanity check we also do one SCK-scaled capture and compare it// against the same-width synthetic resize.//+// macOS only — relies on sck-rs (ScreenCaptureKit) and Apple Vision OCR.+//// Run with:// cargo run --release --example ocr_scale_bench -p screenpipe-screen-use image::imageops::FilterType;-use image::DynamicImage;-use sck_rs::Monitor;-use screenpipe_core::Language;-use screenpipe_screen::apple::perform_ocr_apple;-use std::collections::HashSet;-use std::time::Instant;--fn normalize_words(text: &str) -> HashSet<String> {- text.split_whitespace()- .map(|w| {- w.to_lowercase()- .trim_matches(|c: char| !c.is_alphanumeric())- .to_string()- })- .filter(|w| w.len() >= 3)- .collect()+#[cfg(not(target_os = "macos"))]+fn main() {+ eprintln!("ocr_scale_bench is macOS-only (uses sck-rs and Apple Vision)");}-fn report(label: &str, baseline_text: &str, baseline_words: &HashSet<String>, text: &str, conf: Option<f64>) {- let words = normalize_words(text);- let intersection: usize = baseline_words.intersection(&words).count();- let recall = if !baseline_words.is_empty() {- 100.0 * intersection as f64 / baseline_words.len() as f64- } else {- 0.0- };- // Lost words = baseline - downscaled. Sample first few for spot-checking.- let lost: Vec<&String> = baseline_words.difference(&words).take(10).collect();- let edit = strsim::levenshtein(baseline_text, text);- let ced = 100.0 * edit as f64 / baseline_text.len().max(1) as f64;- println!(- " {:14} len={:6} uniq_words={:5} recall={:5.1}% CER≈{:4.1}% conf={:?}",- label,- text.len(),- words.len(),- recall,- ced,- conf.map(|c| (c * 100.0).round() / 100.0)- );- if !lost.is_empty() && recall < 99.0 {- let sample: Vec<String> = lost.iter().take(8).map(|s| (*s).clone()).collect();- println!(" lost-words sample: {:?}", sample);- }+#[cfg(target_os = "macos")]+fn main() {+ macos::run()}-fn main() {- let monitors = Monitor::all().expect("Monitor::all (grant Screen Recording)");- let monitor = monitors- .into_iter()- .find(|m| m.is_primary())- .expect("no primary monitor");- let native_w = monitor.raw_width();- let native_h = monitor.raw_height();- println!("monitor: {} ({}x{} native)\n", monitor.name(), native_w, native_h);+#[cfg(target_os = "macos")]+mod macos {+ use image::imageops::FilterType;+ use image::DynamicImage;+ use sck_rs::Monitor;+ use screenpipe_core::Language;+ use screenpipe_screen::apple::perform_ocr_apple;+ use std::collections::HashSet;+ use std::time::Instant;- std::fs::create_dir_all("/tmp/ocr-bench").ok();+ fn normalize_words(text: &str) -> HashSet<String> {+ text.split_whitespace()+ .map(|w| {+ w.to_lowercase()+ .trim_matches(|c: char| !c.is_alphanumeric())+ .to_string()+ })+ .filter(|w| w.len() >= 3)+ .collect()+ }- // --- 1. Native capture + OCR baseline ---- let t = Instant::now();- let native_rgba = monitor.capture_image().expect("native capture");- let native_cap = t.elapsed();- let native_img = DynamicImage::ImageRgba8(native_rgba);+ fn report(+ label: &str,+ baseline_text: &str,+ baseline_words: &HashSet<String>,+ text: &str,+ conf: Option<f64>,+ ) {+ let words = normalize_words(text);+ let intersection: usize = baseline_words.intersection(&words).count();+ let recall = if !baseline_words.is_empty() {+ 100.0 * intersection as f64 / baseline_words.len() as f64+ } else {+ 0.0+ };+ // Lost words = baseline - downscaled. Sample first few for spot-checking.+ let lost: Vec<&String> = baseline_words.difference(&words).take(10).collect();+ let edit = strsim::levenshtein(baseline_text, text);+ let ced = 100.0 * edit as f64 / baseline_text.len().max(1) as f64;+ println!(+ " {:14} len={:6} uniq_words={:5} recall={:5.1}% CER≈{:4.1}% conf={:?}",+ label,+ text.len(),+ words.len(),+ recall,+ ced,+ conf.map(|c| (c * 100.0).round() / 100.0)+ );+ if !lost.is_empty() && recall < 99.0 {+ let sample: Vec<String> = lost.iter().take(8).map(|s| (*s).clone()).collect();+ println!(" lost-words sample: {:?}", sample);+ }+ }- let t = Instant::now();- let (native_text, _json, native_conf) =- perform_ocr_apple(&native_img, &[Language::English]);- let native_ocr = t.elapsed();- let baseline_words = normalize_words(&native_text);- std::fs::write("/tmp/ocr-bench/native.txt", &native_text).ok();+ pub fn run() {+ let monitors = Monitor::all().expect("Monitor::all (grant Screen Recording)");+ let monitor = monitors+ .into_iter()+ .find(|m| m.is_primary())+ .expect("no primary monitor");+ let native_w = monitor.raw_width();+ let native_h = monitor.raw_height();+ println!(+ "monitor: {} ({}x{} native)\n",+ monitor.name(),+ native_w,+ native_h+ );- println!(- "baseline (native {}x{}): cap={:?} ocr={:?} text_len={} uniq_words={}",- native_img.width(),- native_img.height(),- native_cap,- native_ocr,- native_text.len(),- baseline_words.len()- );- println!();+ std::fs::create_dir_all("/tmp/ocr-bench").ok();- // --- 2. Synthetic downscale comparisons ---- println!("synthetic downscale (bilinear in-memory, isolates the downscale variable):");- let widths = [1920u32, 1280, 960, 768, 480];- for &max_w in &widths {- if max_w >= native_w {- println!(" {:14} (skipped: native already <= {})", format!("{}px", max_w), max_w);- continue;- }- // Preserve aspect; height derived from ratio.- let target_h = ((max_w as u64 * native_h as u64) / native_w as u64) as u32;- let scaled = native_img.resize_exact(max_w, target_h, FilterType::Triangle);+ // --- 1. Native capture + OCR baseline ---let t = Instant::now();- let (text, _json, conf) = perform_ocr_apple(&scaled, &[Language::English]);- let ocr_ms = t.elapsed();- let label = format!("{}px ({}ms)", max_w, ocr_ms.as_millis());- report(&label, &native_text, &baseline_words, &text, conf);- std::fs::write(format!("/tmp/ocr-bench/synthetic_{}.txt", max_w), &text).ok();- }+ let native_rgba = monitor.capture_image().expect("native capture");+ let native_cap = t.elapsed();+ let native_img = DynamicImage::ImageRgba8(native_rgba);- // --- 3. SCK-scaled sanity check (validates synthetic proxy) ---- println!("\nSCK-scaled capture (validates synthetic resize as a proxy):");- let cap = 1280u32;- if cap >= native_w {- println!(" {}px: skipped (native already <= cap)", cap);- } else {- std::thread::sleep(std::time::Duration::from_millis(200));- let t = Instant::now();- let sck_rgba = monitor.capture_image_scaled(cap).expect("scaled capture");- let cap_dur = t.elapsed();- let sck_img = DynamicImage::ImageRgba8(sck_rgba);let t = Instant::now();- let (text, _json, conf) = perform_ocr_apple(&sck_img, &[Language::English]);- let ocr_ms = t.elapsed();- let label = format!("sck_{}px ({}x{}) cap={}ms ocr={}ms",- cap, sck_img.width(), sck_img.height(), cap_dur.as_millis(), ocr_ms.as_millis());- report(&label, &native_text, &baseline_words, &text, conf);- std::fs::write(format!("/tmp/ocr-bench/sck_{}.txt", cap), &text).ok();- }+ let (native_text, _json, native_conf) =+ perform_ocr_apple(&native_img, &[Language::English]);+ let native_ocr = t.elapsed();+ let baseline_words = normalize_words(&native_text);+ std::fs::write("/tmp/ocr-bench/native.txt", &native_text).ok();- println!("\noutput texts saved in /tmp/ocr-bench/ for spot-checking.");+ println!(+ "baseline (native {}x{}): cap={:?} ocr={:?} text_len={} uniq_words={}",+ native_img.width(),+ native_img.height(),+ native_cap,+ native_ocr,+ native_text.len(),+ baseline_words.len()+ );+ println!();+ let _ = native_conf;++ // --- 2. Synthetic downscale comparisons ---+ println!("synthetic downscale (bilinear in-memory, isolates the downscale variable):");+ let widths = [1920u32, 1280, 960, 768, 480];+ for &max_w in &widths {+ if max_w >= native_w {+ println!(+ " {:14} (skipped: native already <= {})",+ format!("{}px", max_w),+ max_w+ );+ continue;+ }+ // Preserve aspect; height derived from ratio.+ let target_h = ((max_w as u64 * native_h as u64) / native_w as u64) as u32;+ let scaled = native_img.resize_exact(max_w, target_h, FilterType::Triangle);+ let t = Instant::now();+ let (text, _json, conf) = perform_ocr_apple(&scaled, &[Language::English]);+ let ocr_ms = t.elapsed();+ let label = format!("{}px ({}ms)", max_w, ocr_ms.as_millis());+ report(&label, &native_text, &baseline_words, &text, conf);+ std::fs::write(format!("/tmp/ocr-bench/synthetic_{}.txt", max_w), &text).ok();+ }++ // --- 3. SCK-scaled sanity check (validates synthetic proxy) ---+ println!("\nSCK-scaled capture (validates synthetic resize as a proxy):");+ let cap = 1280u32;+ if cap >= native_w {+ println!(" {}px: skipped (native already <= cap)", cap);+ } else {+ std::thread::sleep(std::time::Duration::from_millis(200));+ let t = Instant::now();+ let sck_rgba = monitor.capture_image_scaled(cap).expect("scaled capture");+ let cap_dur = t.elapsed();+ let sck_img = DynamicImage::ImageRgba8(sck_rgba);+ let t = Instant::now();+ let (text, _json, conf) = perform_ocr_apple(&sck_img, &[Language::English]);+ let ocr_ms = t.elapsed();+ let label = format!(+ "sck_{}px ({}x{}) cap={}ms ocr={}ms",+ cap,+ sck_img.width(),+ sck_img.height(),+ cap_dur.as_millis(),+ ocr_ms.as_millis()+ );+ report(&label, &native_text, &baseline_words, &text, conf);+ std::fs::write(format!("/tmp/ocr-bench/sck_{}.txt", cap), &text).ok();+ }++ println!("\noutput texts saved in /tmp/ocr-bench/ for spot-checking.");+ }}