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: make sure all pipes stop when auto destruct is initiated, move path persistence to a sub command screenpipe add-to-path

Louis Beaumontc5e1705766e3
diff --git a/Cargo.toml b/Cargo.toml
index aa0d0975e..baf194050 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@ resolver = "2"
[workspace.package]
-version = "0.2.32"
+version = "0.2.33"
authors = ["louis030195 <[email protected]>"]
description = ""
repository = "https://github.com/mediar-ai/screenpipe"
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index 4bcab87a4..64c7fb052 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.30.4"
+version = "0.30.5"
description = ""
authors = ["you"]
license = ""
diff --git a/screenpipe-server/src/bin/screenpipe-server.rs b/screenpipe-server/src/bin/screenpipe-server.rs
index 285bbdcd2..7cf80a59d 100644
--- a/screenpipe-server/src/bin/screenpipe-server.rs
+++ b/screenpipe-server/src/bin/screenpipe-server.rs
@@ -425,21 +425,33 @@ async fn main() -> anyhow::Result<()> {
handle_doctor_command(output, fix).await?;
return Ok(());
}
+ Command::AddToPath { yes } => {
+ if !yes {
+ print!("add screenpipe to system PATH? [y/N] ");
+ std::io::stdout().flush()?;
+ let mut input = String::new();
+ std::io::stdin().read_line(&mut input)?;
+ if !input.trim().eq_ignore_ascii_case("y") {
+ println!("operation cancelled");
+ return Ok(());
+ }
+ }
+
+ match ensure_screenpipe_in_path().await {
+ Ok(_) => {
+ println!("✓ screenpipe successfully added to PATH");
+ println!("note: you may need to restart your terminal for changes to take effect");
+ }
+ Err(e) => {
+ eprintln!("failed to add screenpipe to PATH: {}", e);
+ return Err(e);
+ }
+ }
+ return Ok(());
+ }
Command::Completions { .. } => todo!(),
}
}
-
- // Check if Screenpipe is present in PATH
- // TODO: likely should not force user to install in PATH (eg brew, powershell, or button in UI)
- // match ensure_screenpipe_in_path().await {
- // Ok(_) => info!("screenpipe is available and properly set in the PATH"),
- // Err(e) => {
- // warn!("screenpipe PATH check failed: {}", e);
- // warn!("please ensure screenpipe is installed correctly and is in your PATH");
- // // do not crash
- // }
- // }
-
if find_ffmpeg_path().is_none() {
eprintln!("ffmpeg not found. please install ffmpeg and ensure it is in your path.");
std::process::exit(1);
@@ -1128,11 +1140,41 @@ async fn main() -> anyhow::Result<()> {
if let Some(pid) = cli.auto_destruct_pid {
info!("watching pid {} for auto-destruction", pid);
let shutdown_tx_clone = shutdown_tx.clone();
+ let pipe_manager = pipe_manager.clone();
tokio::spawn(async move {
// sleep for 5 seconds
tokio::time::sleep(std::time::Duration::from_secs(5)).await;
if watch_pid(pid).await {
info!("Watched pid ({}) has stopped, initiating shutdown", pid);
+
+ // Get list of enabled pipes
+ let pipes = pipe_manager.list_pipes().await;
+ let enabled_pipes: Vec<_> = pipes.into_iter().filter(|p| p.enabled).collect();
+
+ // Stop all enabled pipes in parallel
+ let stop_futures = enabled_pipes.iter().map(|pipe| {
+ let pipe_manager = pipe_manager.clone();
+ let pipe_id = pipe.id.clone();
+ tokio::spawn(async move {
+ if let Err(e) = pipe_manager.stop_pipe(&pipe_id).await {
+ error!("failed to stop pipe {}: {}", pipe_id, e);
+ }
+ })
+ });
+
+ // Wait for all pipes to stop with timeout
+ let timeout = tokio::time::sleep(Duration::from_secs(10));
+ tokio::pin!(timeout);
+
+ tokio::select! {
+ _ = futures::future::join_all(stop_futures) => {
+ info!("all pipes stopped successfully");
+ }
+ _ = &mut timeout => {
+ warn!("timeout waiting for pipes to stop");
+ }
+ }
+
let _ = shutdown_tx_clone.send(());
}
});
diff --git a/screenpipe-server/src/cli.rs b/screenpipe-server/src/cli.rs
index af8735d61..60d67bc44 100644
--- a/screenpipe-server/src/cli.rs
+++ b/screenpipe-server/src/cli.rs
@@ -367,6 +367,12 @@ pub enum Command {
#[arg(short, long, default_value_t = false)]
fix: bool,
},
+ /// Add screenpipe to system PATH
+ AddToPath {
+ /// Skip confirmation prompt
+ #[arg(short = 'y', long)]
+ yes: bool,
+ },
}
#[derive(Subcommand)]
diff --git a/screenpipe-vision/bin/ui_monitor b/screenpipe-vision/bin/ui_monitor
index c18230ba8..602bde837 100755
Binary files a/screenpipe-vision/bin/ui_monitor and b/screenpipe-vision/bin/ui_monitor differ
diff --git a/screenpipe-vision/bin/ui_monitor-aarch64-apple-darwin b/screenpipe-vision/bin/ui_monitor-aarch64-apple-darwin
index c18230ba8..602bde837 100755
Binary files a/screenpipe-vision/bin/ui_monitor-aarch64-apple-darwin and b/screenpipe-vision/bin/ui_monitor-aarch64-apple-darwin differ