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: obsidian intelligence route prompt, feat: screenpipe doctor subcommand, feat: real time transcription through screenpipe cloud
Louis Beaumont5e3ab8c2c9a0
diff --git a/pipes/obsidian/package.json b/pipes/obsidian/package.jsonindex 8b6e0ea76..0ced49e79 100644--- a/pipes/obsidian/package.json+++ b/pipes/obsidian/package.json@@ -1,6 +1,6 @@{"name": "obsidian",- "version": "0.1.9",+ "version": "0.1.10","private": true,"scripts": {"dev": "next dev --turbopack",diff --git a/pipes/obsidian/src/app/api/intelligence/route.ts b/pipes/obsidian/src/app/api/intelligence/route.tsindex 67bfaa4e6..c2560c0f7 100644--- a/pipes/obsidian/src/app/api/intelligence/route.ts+++ b/pipes/obsidian/src/app/api/intelligence/route.ts@@ -62,6 +62,8 @@ async function analyzeRelationships("opportunities": ["schedule a call", "send a follow-up email"]}}++ of course adapt the example response to the actual data you have, do not use John Doe in your example response, use the names and companies of the people you see in the logs.`;const provider = ollama(model);diff --git a/screenpipe-app-tauri/src-tauri/src/sidecar.rs b/screenpipe-app-tauri/src-tauri/src/sidecar.rsindex 5369281fa..5cc661b99 100644--- a/screenpipe-app-tauri/src-tauri/src/sidecar.rs+++ b/screenpipe-app-tauri/src-tauri/src/sidecar.rs@@ -408,6 +408,7 @@ fn spawn_sidecar(app: &tauri::AppHandle) -> Result<CommandChild, String> {"DEEPGRAM_API_URL","https://ai-proxy.i-f9f.workers.dev/v1/listen",);+ c = c.env("DEEPGRAM_WEBSOCKET_URL", "wss://ai-proxy.i-f9f.workers.dev/v1/listen");// Add token if screenpipe-cloud is selected and user has a tokenif user.id.is_some() {c = c.env("CUSTOM_DEEPGRAM_API_TOKEN", user.id.as_ref().unwrap());@@ -440,6 +441,7 @@ fn spawn_sidecar(app: &tauri::AppHandle) -> Result<CommandChild, String> {"DEEPGRAM_API_URL","https://ai-proxy.i-f9f.workers.dev/v1/listen",);+ c = c.env("DEEPGRAM_WEBSOCKET_URL", "wss://ai-proxy.i-f9f.workers.dev/v1/listen");// Add token if screenpipe-cloud is selected and user has a tokenif user.id.is_some() {c = c.env("CUSTOM_DEEPGRAM_API_TOKEN", user.id.as_ref().unwrap());diff --git a/screenpipe-server/src/bin/screenpipe-server.rs b/screenpipe-server/src/bin/screenpipe-server.rsindex 8c82e2274..4c6bbc596 100644--- a/screenpipe-server/src/bin/screenpipe-server.rs+++ b/screenpipe-server/src/bin/screenpipe-server.rs@@ -189,6 +189,10 @@ async fn main() -> anyhow::Result<()> {output: OutputFormat::Text,..}) => true,+ Some(Command::Doctor {+ output: OutputFormat::Text,+ ..+ }) => true,_ => true,};@@ -338,6 +342,10 @@ async fn main() -> anyhow::Result<()> {.await?;return Ok(());}+ Command::Doctor { output, fix } => {+ handle_doctor_command(output, fix).await?;+ return Ok(());+ }}}@@ -1619,3 +1627,93 @@ async fn check_ffmpeg() -> anyhow::Result<()> {Ok(())}++async fn handle_doctor_command(output: OutputFormat, fix: bool) -> anyhow::Result<()> {+ let mut checks = Vec::new();++ // Check ffmpeg+ let ffmpeg_status = match find_ffmpeg_path() {+ Some(path) => ("ffmpeg", true, format!("found at {}", path.display())),+ None => ("ffmpeg", false, "not found in PATH".to_string()),+ };+ checks.push(ffmpeg_status);++ // Check data directory+ let data_dir = get_base_dir(&None)?;+ let data_dir_status = (+ "data directory",+ data_dir.exists(),+ format!("{}", data_dir.display()),+ );+ checks.push(data_dir_status);++ // Check database+ let db_path = data_dir.join("db.sqlite");+ let db_exists = db_path.exists();+ let db_status = ("database", db_exists, format!("{}", db_path.display()));+ checks.push(db_status);++ // Check audio devices+ let audio_devices = match list_audio_devices().await {+ Ok(devices) => {+ let count = devices.len();+ (+ "audio devices",+ count > 0,+ format!("{} devices found", count),+ )+ }+ Err(e) => ("audio devices", false, format!("error: {}", e)),+ };+ checks.push(audio_devices);++ // Check monitors+ let monitors = list_monitors().await;+ let monitor_status = (+ "monitors",+ !monitors.is_empty(),+ format!("{} found", monitors.len()),+ );+ checks.push(monitor_status);++ // Output results+ match output {+ OutputFormat::Json => {+ let json = serde_json::json!({+ "checks": checks.iter().map(|(name, status, msg)| {+ serde_json::json!({+ "name": name,+ "status": status,+ "message": msg,+ })+ }).collect::<Vec<_>>(),+ "healthy": checks.iter().all(|(_, status, _)| *status),+ });+ println!("{}", serde_json::to_string_pretty(&json)?);+ }+ OutputFormat::Text => {+ println!("\nπ screenpipe system diagnostics\n");++ for (name, status, msg) in &checks {+ let symbol = if *status { "β " } else { "β" };+ println!("{} {}: {}", symbol, name, msg);+ }++ if fix {+ println!("\nπ§ attempting to fix issues...");+ // Add auto-fix logic here if needed+ let db = DatabaseManager::new(&db_path.to_string_lossy()).await?;+ db.repair_database().await?;+ }++ let healthy = checks.iter().all(|(_, status, _)| *status);+ println!(+ "\n{} overall health: {}\n",+ if healthy { "β " } else { "β" },+ if healthy { "healthy" } else { "issues found" }+ );+ }+ }++ Ok(())+}diff --git a/screenpipe-server/src/cli.rs b/screenpipe-server/src/cli.rsindex 23523547d..b8025542a 100644--- a/screenpipe-server/src/cli.rs+++ b/screenpipe-server/src/cli.rs@@ -331,6 +331,16 @@ pub enum Command {},/// Run database migrationsMigrate,+ /// Run system diagnostics and health checks+ Doctor {+ /// Output format+ #[arg(short, long, value_enum, default_value_t = OutputFormat::Text)]+ output: OutputFormat,++ /// Fix issues automatically when possible+ #[arg(short, long, default_value_t = false)]+ fix: bool,+ },}diff --git a/screenpipe-server/src/db.rs b/screenpipe-server/src/db.rsindex 81b50f47a..71584527a 100644--- a/screenpipe-server/src/db.rs+++ b/screenpipe-server/src/db.rs@@ -2003,4 +2003,91 @@ impl DatabaseManager {.await?;Ok(())}++ pub async fn repair_database(&self) -> Result<(), anyhow::Error> {+ debug!("starting aggressive database repair process");++ // Force close any pending transactions+ let emergency_steps = [+ "PRAGMA locking_mode = EXCLUSIVE;",+ "ROLLBACK;", // Force rollback any stuck transactions+ "PRAGMA busy_timeout = 60000;", // Increase timeout to 60s+ ];++ for step in emergency_steps {+ if let Err(e) = sqlx::query(step).execute(&self.pool).await {+ warn!("emergency step failed (continuing anyway): {}", e);+ }+ }++ // Force checkpoint and cleanup WAL files+ let wal_cleanup = [+ "PRAGMA wal_checkpoint(TRUNCATE);",+ "PRAGMA journal_mode = DELETE;", // Temporarily disable WAL+ "PRAGMA journal_size_limit = 0;", // Clear journal+ ];++ for step in wal_cleanup {+ if let Err(e) = sqlx::query(step).execute(&self.pool).await {+ warn!("wal cleanup failed (continuing anyway): {}", e);+ }+ }++ // Aggressive recovery steps+ let recovery_steps = [+ ("PRAGMA synchronous = OFF;", "disable synchronous"),+ ("PRAGMA cache_size = -2000000;", "increase cache"), // 2GB cache+ ("VACUUM;", "vacuum database"),+ ("PRAGMA integrity_check;", "check integrity"),+ ("PRAGMA foreign_key_check;", "check foreign keys"),+ ("REINDEX;", "rebuild indexes"),+ ("ANALYZE;", "update statistics"),+ ("VACUUM;", "final vacuum"), // Second vacuum after reindex+ ];++ for (query, step) in recovery_steps {+ debug!("running aggressive recovery step: {}", step);+ match sqlx::query(query).execute(&self.pool).await {+ Ok(_) => debug!("recovery step '{}' succeeded", step),+ Err(e) => warn!("recovery step '{}' failed: {}", step, e),+ }+ }++ // Restore safe settings+ let restore_steps = [+ "PRAGMA synchronous = NORMAL;",+ "PRAGMA journal_mode = WAL;",+ "PRAGMA wal_autocheckpoint = 1000;",+ "PRAGMA cache_size = -2000;", // Back to 2MB cache+ "PRAGMA locking_mode = NORMAL;",+ "PRAGMA busy_timeout = 5000;", // Back to 5s timeout+ ];++ for step in restore_steps {+ if let Err(e) = sqlx::query(step).execute(&self.pool).await {+ warn!("restore step failed: {}", e);+ }+ }++ // Final verification+ match sqlx::query_scalar::<_, String>("PRAGMA quick_check;")+ .fetch_one(&self.pool)+ .await+ {+ Ok(result) if result == "ok" => {+ debug!("database successfully repaired");+ Ok(())+ }+ Ok(result) => {+ let msg = format!("database still corrupted after repair: {}", result);+ error!("{}", msg);+ Err(anyhow::anyhow!(msg))+ }+ Err(e) => {+ let msg = format!("database repair failed catastrophically: {}", e);+ error!("{}", msg);+ Err(anyhow::anyhow!(msg))+ }+ }+ }}