Skip to content

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

Bump app to v2.2.27

Louis Beaumont2d9c1b1d3329
diff --git a/Cargo.lock b/Cargo.lock
index 109c34bf4..5c898f0b2 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5716,6 +5716,7 @@ dependencies = [
"serde",
"serde_json",
"sha2",
+ "socket2 0.5.10",
"sqlx",
"sysinfo",
"tempfile",
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index 28df5bcc6..b14b81c2f 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "2.2.26"
+version = "2.2.27"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/crates/screenpipe-accessibility/src/platform/macos.rs b/crates/screenpipe-accessibility/src/platform/macos.rs
index 6c12ca471..908033e28 100644
--- a/crates/screenpipe-accessibility/src/platform/macos.rs
+++ b/crates/screenpipe-accessibility/src/platform/macos.rs
@@ -703,81 +703,85 @@ fn run_app_observer(
let mut last_window: Option<String> = None;
while !stop.load(Ordering::Relaxed) {
- let apps = workspace.running_apps();
- let active_app = apps.iter().find(|app| app.is_active());
-
- if let Some(app) = active_app {
- let name = app
- .localized_name()
- .map(|s| s.to_string())
- .unwrap_or_else(|| "?".to_string());
- let pid = app.pid();
-
- // Check exclusions
- if !config.should_capture_app(&name) {
- std::thread::sleep(std::time::Duration::from_millis(100));
- continue;
- }
+ // Wrap each iteration in autorelease pool — running_apps() returns
+ // autoreleased NSRunningApplication objects that accumulate on Rust
+ // threads (no automatic drain), causing ~800MB+ leak over hours.
+ cidre::objc::ar_pool(|| {
+ let apps = workspace.running_apps();
+ let active_app = apps.iter().find(|app| app.is_active());
+
+ if let Some(app) = active_app {
+ let name = app
+ .localized_name()
+ .map(|s| s.to_string())
+ .unwrap_or_else(|| "?".to_string());
+ let pid = app.pid();
+
+ // Check exclusions
+ if !config.should_capture_app(&name) {
+ return;
+ }
- let app_changed = last_app.as_ref() != Some(&name) || last_pid != pid;
+ let app_changed = last_app.as_ref() != Some(&name) || last_pid != pid;
- if app_changed {
- // Update shared state for event tap thread
- *current_app.lock() = Some(name.clone());
+ if app_changed {
+ // Update shared state for event tap thread
+ *current_app.lock() = Some(name.clone());
- if config.capture_app_switch {
- // Capture focused element's context (including text field values)
- let focused_element = get_focused_element_context(&config);
+ if config.capture_app_switch {
+ // Capture focused element's context (including text field values)
+ let focused_element = get_focused_element_context(&config);
- let mut event = UiEvent::app_switch(
- Utc::now(),
- start.elapsed().as_millis() as u64,
- name.clone(),
- pid,
- );
- event.element = focused_element;
- let _ = tx.try_send(event);
+ let mut event = UiEvent::app_switch(
+ Utc::now(),
+ start.elapsed().as_millis() as u64,
+ name.clone(),
+ pid,
+ );
+ event.element = focused_element;
+ let _ = tx.try_send(event);
+ }
+ last_app = Some(name.clone());
+ last_pid = pid;
}
- last_app = Some(name.clone());
- last_pid = pid;
- }
- // Check window change
- let window_title = get_focused_window_title(pid);
+ // Check window change
+ let window_title = get_focused_window_title(pid);
- // Check window exclusions
- let should_capture = window_title
- .as_ref()
- .map(|w| config.should_capture_window(w))
- .unwrap_or(true);
+ // Check window exclusions
+ let should_capture = window_title
+ .as_ref()
+ .map(|w| config.should_capture_window(w))
+ .unwrap_or(true);
- if should_capture && (window_title != last_window || app_changed) {
- // Update shared state for event tap thread
- *current_window.lock() = window_title.clone();
+ if should_capture && (window_title != last_window || app_changed) {
+ // Update shared state for event tap thread
+ *current_window.lock() = window_title.clone();
- if config.capture_window_focus {
- // Capture focused element's context (including text field values)
- let focused_element = get_focused_element_context(&config);
+ if config.capture_window_focus {
+ // Capture focused element's context (including text field values)
+ let focused_element = get_focused_element_context(&config);
- let event = UiEvent {
- id: None,
- timestamp: Utc::now(),
- relative_ms: start.elapsed().as_millis() as u64,
- data: EventData::WindowFocus {
- app: name,
- title: window_title.clone().map(|s| truncate(&s, 200)),
- },
- app_name: None,
- window_title: None,
- browser_url: None,
- element: focused_element,
- frame_id: None,
- };
- let _ = tx.try_send(event);
+ let event = UiEvent {
+ id: None,
+ timestamp: Utc::now(),
+ relative_ms: start.elapsed().as_millis() as u64,
+ data: EventData::WindowFocus {
+ app: name,
+ title: window_title.clone().map(|s| truncate(&s, 200)),
+ },
+ app_name: None,
+ window_title: None,
+ browser_url: None,
+ element: focused_element,
+ frame_id: None,
+ };
+ let _ = tx.try_send(event);
+ }
+ last_window = window_title;
}
- last_window = window_title;
}
- }
+ });
std::thread::sleep(std::time::Duration::from_millis(100));
}
diff --git a/crates/screenpipe-vision/src/capture_screenshot_by_window.rs b/crates/screenpipe-vision/src/capture_screenshot_by_window.rs
index 1fbeaa128..e32ea8c41 100644
--- a/crates/screenpipe-vision/src/capture_screenshot_by_window.rs
+++ b/crates/screenpipe-vision/src/capture_screenshot_by_window.rs
@@ -390,14 +390,19 @@ struct WindowData {
/// causing multiple apps to appear as "focused" simultaneously.
#[cfg(target_os = "macos")]
fn get_frontmost_pid() -> Option<i32> {
- let workspace = cidre::ns::Workspace::shared();
- let apps = workspace.running_apps();
- for app in apps.iter() {
- if app.is_active() {
- return Some(app.pid());
+ // Wrap in autorelease pool — running_apps() returns autoreleased
+ // NSRunningApplication objects that accumulate on Rust threads
+ // (no automatic drain), causing ~800MB+ leak over hours.
+ cidre::objc::ar_pool(|| {
+ let workspace = cidre::ns::Workspace::shared();
+ let apps = workspace.running_apps();
+ for app in apps.iter() {
+ if app.is_active() {
+ return Some(app.pid());
+ }
}
- }
- None
+ None
+ })
}
/// Rectangle bounds for overlap calculations