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

release-app resolve memory leak on vision

Louis Beaumont752e7614af8f
diff --git a/pipes/rewind/package.json b/pipes/rewind/package.json
index b74be7d9b..7e1ed14d8 100644
--- a/pipes/rewind/package.json
+++ b/pipes/rewind/package.json
@@ -1,6 +1,6 @@
{
"name": "rewind",
- "version": "0.1.14",
+ "version": "0.1.15",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index 85c42feb8..12f6b5352 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "0.39.2"
+version = "0.39.3"
description = ""
authors = ["you"]
license = ""
diff --git a/screenpipe-js/cli/src/commands/pipe/register.ts b/screenpipe-js/cli/src/commands/pipe/register.ts
index c315e7765..b4920eb9f 100644
--- a/screenpipe-js/cli/src/commands/pipe/register.ts
+++ b/screenpipe-js/cli/src/commands/pipe/register.ts
@@ -19,8 +19,8 @@ export const registerCommand = new Command()
throw new Error("name can only contain letters, numbers, and hyphens");
}
// Check maximum length
- if (value.length > 10) {
- throw new Error("name cannot be longer than 10 characters");
+ if (value.length > 20) {
+ throw new Error("name cannot be longer than 20 characters");
}
return value;
})
diff --git a/screenpipe-vision/Cargo.toml b/screenpipe-vision/Cargo.toml
index 55e4fde3a..74797e327 100644
--- a/screenpipe-vision/Cargo.toml
+++ b/screenpipe-vision/Cargo.toml
@@ -43,7 +43,7 @@ tracing = { workspace = true }
which = "6.0"
serde = "1.0.200"
-xcap = "0.3.3"
+xcap = "0.4.0"
once_cell = { workspace = true }
base64 = "0.22.1"
diff --git a/screenpipe-vision/src/bin/screenpipe-vision.rs b/screenpipe-vision/src/bin/screenpipe-vision.rs
index c15d23a2e..c5c7552e5 100644
--- a/screenpipe-vision/src/bin/screenpipe-vision.rs
+++ b/screenpipe-vision/src/bin/screenpipe-vision.rs
@@ -1,9 +1,7 @@
use clap::Parser;
use screenpipe_core::Language;
use screenpipe_vision::{
- capture_screenshot_by_window::WindowFilters,
- continuous_capture,
- OcrEngine,
+ capture_screenshot_by_window::WindowFilters, continuous_capture, OcrEngine,
};
use std::{sync::Arc, time::Duration};
use tokio::sync::mpsc::channel;
@@ -37,15 +35,10 @@ async fn main() {
let languages = cli.language;
// Get monitor ID before spawning the task
- let monitor_id = tokio::task::spawn_blocking(|| {
- Monitor::all()
- .unwrap()
- .first()
- .unwrap()
- .id()
- })
- .await
- .unwrap();
+ let monitor_id =
+ tokio::task::spawn_blocking(|| Monitor::all().unwrap().first().unwrap().id().unwrap())
+ .await
+ .unwrap();
let window_filters = Arc::new(WindowFilters::new(&[], &[]));
diff --git a/screenpipe-vision/src/capture_screenshot_by_window.rs b/screenpipe-vision/src/capture_screenshot_by_window.rs
index 8c72ee87b..59e451091 100644
--- a/screenpipe-vision/src/capture_screenshot_by_window.rs
+++ b/screenpipe-vision/src/capture_screenshot_by_window.rs
@@ -201,10 +201,10 @@ pub async fn capture_all_visible_windows(
.into_iter()
.filter_map(|window| {
// Extract all necessary data from the window while in the main thread
- let app_name = window.app_name().to_string();
- let title = window.title().to_string();
- let is_focused = window.is_focused();
- let process_id = window.pid();
+ let app_name = window.app_name().unwrap();
+ let title = window.title().unwrap();
+ let is_focused = window.is_focused().unwrap();
+ let process_id = window.pid().unwrap();
// Capture image immediately while we have access to the window
match window.capture_image() {
Ok(buffer) => Some((app_name, title, is_focused, buffer, process_id)),
diff --git a/screenpipe-vision/src/monitor.rs b/screenpipe-vision/src/monitor.rs
index 7c893d1d8..e6fa7d8fc 100644
--- a/screenpipe-vision/src/monitor.rs
+++ b/screenpipe-vision/src/monitor.rs
@@ -1,4 +1,4 @@
-use anyhow::{Result, Error};
+use anyhow::{Error, Result};
use image::DynamicImage;
use std::sync::Arc;
use xcap::Monitor;
@@ -19,14 +19,14 @@ pub struct MonitorData {
impl SafeMonitor {
pub fn new(monitor: Monitor) -> Self {
- let monitor_id = monitor.id();
+ let monitor_id = monitor.id().unwrap();
let monitor_data = Arc::new(MonitorData {
- width: monitor.width(),
- height: monitor.height(),
- name: monitor.name().to_string(),
- is_primary: monitor.is_primary(),
+ width: monitor.width().unwrap(),
+ height: monitor.height().unwrap(),
+ name: monitor.name().unwrap(),
+ is_primary: monitor.is_primary().unwrap(),
});
-
+
Self {
monitor_id,
monitor_data,
@@ -35,25 +35,26 @@ impl SafeMonitor {
pub async fn capture_image(&self) -> Result<DynamicImage> {
let monitor_id = self.monitor_id;
-
+
let image = std::thread::spawn(move || -> Result<DynamicImage> {
let monitor = Monitor::all()
.map_err(Error::from)?
.into_iter()
- .find(|m| m.id() == monitor_id)
+ .find(|m| m.id().unwrap() == monitor_id)
.ok_or_else(|| anyhow::anyhow!("Monitor not found"))?;
- if monitor.width() == 0 || monitor.height() == 0 {
+ if monitor.width().unwrap() == 0 || monitor.height().unwrap() == 0 {
return Err(anyhow::anyhow!("Invalid monitor dimensions"));
}
-
- monitor.capture_image()
+
+ monitor
+ .capture_image()
.map_err(Error::from)
.map(DynamicImage::ImageRgba8)
})
.join()
.unwrap()?;
-
+
Ok(image)
}
@@ -111,7 +112,7 @@ pub async fn get_monitor_by_id(id: u32) -> Option<SafeMonitor> {
Monitor::all()
.unwrap()
.into_iter()
- .find(|m| m.id() == id)
+ .find(|m| m.id().unwrap() == id)
.map(SafeMonitor::new)
})
.await