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: pipe discovery and CLI error reporting
Louis Beaumontc124fda34a8d
diff --git a/Cargo.lock b/Cargo.lockindex b270b6a8f..3041ece92 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -6513,7 +6513,7 @@ dependencies = [[[package]]name = "screenpipe-audio"-version = "0.3.190"+version = "0.3.194"dependencies = ["anyhow","audiopipe",@@ -6572,7 +6572,7 @@ dependencies = [[[package]]name = "screenpipe-config"-version = "0.3.190"+version = "0.3.194"dependencies = ["dirs 6.0.0","serde",@@ -6585,7 +6585,7 @@ dependencies = [[[package]]name = "screenpipe-connect"-version = "0.3.190"+version = "0.3.194"dependencies = ["anyhow","async-trait",@@ -6611,7 +6611,7 @@ dependencies = [[[package]]name = "screenpipe-core"-version = "0.3.190"+version = "0.3.194"dependencies = ["accessibility","accessibility-sys",@@ -6654,7 +6654,7 @@ dependencies = [[[package]]name = "screenpipe-db"-version = "0.3.190"+version = "0.3.194"dependencies = ["anyhow","chrono",@@ -6679,7 +6679,7 @@ dependencies = [[[package]]name = "screenpipe-engine"-version = "0.3.190"+version = "0.3.194"dependencies = ["anyhow","async-trait",@@ -6747,7 +6747,7 @@ dependencies = [[[package]]name = "screenpipe-events"-version = "0.3.190"+version = "0.3.194"dependencies = ["anyhow","chrono",@@ -6765,7 +6765,7 @@ dependencies = [[[package]]name = "screenpipe-screen"-version = "0.3.190"+version = "0.3.194"dependencies = ["accessibility-sys","anyhow",@@ -6805,7 +6805,7 @@ dependencies = [[[package]]name = "screenpipe-vault"-version = "0.3.190"+version = "0.3.194"dependencies = ["argon2","chacha20poly1305",diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lockindex 446e76ce8..5f6ed2fb9 100644--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock@@ -9440,7 +9440,7 @@ dependencies = [[[package]]name = "screenpipe-audio"-version = "0.3.190"+version = "0.3.194"dependencies = ["anyhow","audiopipe",@@ -9494,7 +9494,7 @@ dependencies = [[[package]]name = "screenpipe-config"-version = "0.3.190"+version = "0.3.194"dependencies = ["dirs 6.0.0","serde",@@ -9506,7 +9506,7 @@ dependencies = [[[package]]name = "screenpipe-connect"-version = "0.3.190"+version = "0.3.194"dependencies = ["anyhow","async-trait",@@ -9532,7 +9532,7 @@ dependencies = [[[package]]name = "screenpipe-core"-version = "0.3.190"+version = "0.3.194"dependencies = ["accessibility","accessibility-sys",@@ -9574,7 +9574,7 @@ dependencies = [[[package]]name = "screenpipe-db"-version = "0.3.190"+version = "0.3.194"dependencies = ["anyhow","chrono",@@ -9599,7 +9599,7 @@ dependencies = [[[package]]name = "screenpipe-engine"-version = "0.3.190"+version = "0.3.194"dependencies = ["anyhow","async-trait",@@ -9662,7 +9662,7 @@ dependencies = [[[package]]name = "screenpipe-events"-version = "0.3.190"+version = "0.3.194"dependencies = ["anyhow","chrono",@@ -9678,7 +9678,7 @@ dependencies = [[[package]]name = "screenpipe-screen"-version = "0.3.190"+version = "0.3.194"dependencies = ["accessibility-sys","anyhow",@@ -9714,7 +9714,7 @@ dependencies = [[[package]]name = "screenpipe-vault"-version = "0.3.190"+version = "0.3.194"dependencies = ["argon2","chacha20poly1305",diff --git a/apps/screenpipe-app-tauri/src-tauri/lib/utils/tauri.ts b/apps/screenpipe-app-tauri/src-tauri/lib/utils/tauri.tsindex 13805b7fd..5224af12d 100644--- a/apps/screenpipe-app-tauri/src-tauri/lib/utils/tauri.ts+++ b/apps/screenpipe-app-tauri/src-tauri/lib/utils/tauri.ts@@ -391,6 +391,18 @@ async hideNotificationPanel() : Promise<Result<null, string>> {else return { status: "error", error: e as any };}},+/**+ * Check if the mouse cursor is inside a given window's bounds.+ * Used by NSPanel webviews where JS mouse events don't fire (non-key window).+ */+async isMouseInsideWindow(label: string) : Promise<Result<boolean, string>> {+ try {+ return { status: "ok", data: await TAURI_INVOKE("is_mouse_inside_window", { label }) };+} catch (e) {+ if(e instanceof Error) throw e;+ else return { status: "error", error: e as any };+}+},/*** Register window-specific shortcuts (Escape, search shortcut) when main window is visible* These should only be active when the overlay is open to avoid blocking other appsdiff --git a/crates/screenpipe-core/src/pipes/mod.rs b/crates/screenpipe-core/src/pipes/mod.rsindex 0e44d4290..13a69d2a8 100644--- a/crates/screenpipe-core/src/pipes/mod.rs+++ b/crates/screenpipe-core/src/pipes/mod.rs@@ -775,26 +775,25 @@ impl PipeManager {if !pipe_md.exists() {continue;}+ let dir_name = path+ .file_name()+ .unwrap_or_default()+ .to_string_lossy()+ .to_string();match std::fs::read_to_string(&pipe_md) {Ok(content) => {match parse_frontmatter(&content) {Ok((mut config, body)) => {- // Use directory name as canonical name- let dir_name = path- .file_name()- .unwrap_or_default()- .to_string_lossy()- .to_string();config.name = dir_name.clone();info!("loaded pipe: {}", dir_name);pipes.insert(dir_name, (config, body, content));}Err(e) => {- warn!("failed to parse {:?}: {}", pipe_md, e);+ warn!("pipe '{}': failed to parse pipe.md: {}", dir_name, e);}}}- Err(e) => warn!("failed to read {:?}: {}", pipe_md, e),+ Err(e) => warn!("pipe '{}': failed to read pipe.md: {}", dir_name, e),}}@@ -1037,6 +1036,46 @@ impl PipeManager {.collect()}+ /// Build a diagnostic error when a pipe name isn't in the in-memory map.+ /// Checks the filesystem to explain *why* it wasn't loaded.+ fn pipe_not_found_error(&self, name: &str) -> anyhow::Error {+ let pipe_dir = self.pipes_dir.join(name);+ if !pipe_dir.exists() {+ return anyhow!(+ "pipe '{}' not found — directory does not exist: {}\nhint: install it first with `screenpipe pipe install <source>`",+ name,+ pipe_dir.display()+ );+ }+ let pipe_md = pipe_dir.join("pipe.md");+ if !pipe_md.exists() {+ return anyhow!(+ "pipe '{}' not found — directory exists but pipe.md is missing: {}",+ name,+ pipe_md.display()+ );+ }+ match std::fs::read_to_string(&pipe_md) {+ Ok(content) => match parse_frontmatter(&content) {+ Ok(_) => anyhow!(+ "pipe '{}' not found in registry but pipe.md looks valid — try restarting or listing pipes first",+ name+ ),+ Err(e) => anyhow!(+ "pipe '{}' not found — pipe.md has invalid frontmatter: {}\nhint: check the YAML between the --- delimiters in {}",+ name,+ e,+ pipe_md.display()+ ),+ },+ Err(e) => anyhow!(+ "pipe '{}' not found — could not read pipe.md: {}",+ name,+ e+ ),+ }+ }+/// Run a pipe once (manual trigger or scheduled)./// NOTE: this blocks for the entire execution — avoid calling while/// holding the outer PipeManager mutex from an API handler.@@ -1051,10 +1090,10 @@ impl PipeManager {pub async fn start_pipe_background(&self, name: &str) -> Result<()> {let (config, body, _raw) = {let pipes = self.pipes.lock().await;- pipes- .get(name)- .cloned()- .ok_or_else(|| anyhow!("pipe '{}' not found", name))?+ match pipes.get(name).cloned() {+ Some(v) => v,+ None => return Err(self.pipe_not_found_error(name)),+ }};let executor = self@@ -1428,10 +1467,10 @@ impl PipeManager {Box::pin(async move {let (config, body, _raw) = {let pipes = self.pipes.lock().await;- pipes- .get(name)- .cloned()- .ok_or_else(|| anyhow!("pipe '{}' not found", name))?+ match pipes.get(name).cloned() {+ Some(v) => v,+ None => return Err(self.pipe_not_found_error(name)),+ }};let executor = self@@ -1822,7 +1861,7 @@ impl PipeManager {pub async fn enable_pipe(&self, name: &str, enabled: bool) -> Result<()> {let pipe_md = self.pipes_dir.join(name).join("pipe.md");if !pipe_md.exists() {- return Err(anyhow!("pipe '{}' not found", name));+ return Err(self.pipe_not_found_error(name));}let content = std::fs::read_to_string(&pipe_md)?;@@ -2086,7 +2125,7 @@ impl PipeManager {pub async fn delete_pipe(&self, name: &str) -> Result<()> {let dir = self.pipes_dir.join(name);if !dir.exists() {- return Err(anyhow!("pipe '{}' not found", name));+ return Err(self.pipe_not_found_error(name));}// Stop if runningdiff --git a/crates/screenpipe-engine/src/cli/pipe.rs b/crates/screenpipe-engine/src/cli/pipe.rsindex 88e1e2f74..2af4a64a3 100644--- a/crates/screenpipe-engine/src/cli/pipe.rs+++ b/crates/screenpipe-engine/src/cli/pipe.rs@@ -58,7 +58,7 @@ pub async fn handle_pipe_command(command: &PipeCommand) -> anyhow::Result<()> {}PipeCommand::Install { source } => match manager.install_pipe(source).await {Ok(name) => println!("installed pipe: {}", name),- Err(e) => eprintln!("error: {}", e),+ Err(e) => anyhow::bail!("failed to install pipe: {}", e),},PipeCommand::Enable { name } => {manager.enable_pipe(name, true).await?;@@ -81,19 +81,31 @@ pub async fn handle_pipe_command(command: &PipeCommand) -> anyhow::Result<()> {println!("\n{}", log.stdout);}} else {- eprintln!("✗ failed");+ let mut msg = format!("pipe '{}' execution failed", name);if !log.stderr.is_empty() {- eprintln!("{}", log.stderr);+ msg.push_str(&format!(":\n{}", log.stderr));}+ anyhow::bail!(msg);}}- Err(e) => eprintln!("error: {}", e),+ Err(e) => return Err(e),}}PipeCommand::Logs { name, follow: _ } => {+ // Verify the pipe exists before showing logs+ if manager.get_pipe(name).await.is_none() {+ let pipe_dir = pipes_dir.join(name);+ if !pipe_dir.exists() {+ anyhow::bail!(+ "pipe '{}' not found — directory does not exist: {}\nhint: install it first with `screenpipe pipe install <source>`",+ name,+ pipe_dir.display()+ );+ }+ }let logs = manager.get_logs(name).await;if logs.is_empty() {- println!("no logs for pipe '{}'", name);+ println!("no logs for pipe '{}' (it hasn't been run yet)", name);} else {for log in &logs {let status = if log.success { "✓" } else { "✗" };diff --git a/crates/screenpipe-engine/src/pipes_api.rs b/crates/screenpipe-engine/src/pipes_api.rsindex 54f0d5a82..c19940e8e 100644--- a/crates/screenpipe-engine/src/pipes_api.rs+++ b/crates/screenpipe-engine/src/pipes_api.rs@@ -84,8 +84,12 @@ pub async fn list_pipes(}/// GET /pipes/:id — single pipe detail.+/// Re-scans disk so pipes installed externally are picked up.pub async fn get_pipe(State(pm): State<SharedPipeManager>, Path(id): Path<String>) -> Json<Value> {let mgr = pm.lock().await;+ if let Err(e) = mgr.reload_pipes().await {+ tracing::warn!("failed to reload pipes from disk: {}", e);+ }match mgr.get_pipe(&id).await {Some(pipe) => Json(json!({ "data": pipe })),None => Json(json!({ "error": format!("pipe '{}' not found", id) })),@@ -124,6 +128,11 @@ pub async fn run_pipe_now() -> Json<Value> {let mut mgr = pm.lock().await;+ // Re-scan disk so newly installed pipes are discovered before lookup+ if let Err(e) = mgr.reload_pipes().await {+ tracing::warn!("failed to reload pipes from disk: {}", e);+ }+// If notification_context is provided, temporarily set it as extra contextlet prev_context = if let Some(Json(ref b)) = body {if let Some(ref ctx) = b.notification_context {