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.34 — recording watchdog diagnostics, tray/sync fixes

Louis Beaumontaf2b4f3d4e41
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index d39852dac..bd36d4be6 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.33"
+version = "2.2.34"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/tray.rs b/apps/screenpipe-app-tauri/src-tauri/src/tray.rs
index 9a5e3a068..5bdcf9af7 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/tray.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/tray.rs
@@ -283,19 +283,9 @@ fn create_dynamic_menu(
.and_then(|v| v.as_str().map(String::from))
.unwrap_or_else(|| default_chat.to_string());
- // --- Header: version ---
- let is_beta = app.config().identifier.contains("beta");
- let version_text = if is_beta {
- format!("screenpipe v{} (Beta)", app.package_info().version)
- } else {
- format!("screenpipe v{}", app.package_info().version)
- };
+ // --- Open screenpipe ---
menu_builder = menu_builder
- .item(
- &MenuItemBuilder::with_id("version", version_text)
- .enabled(false)
- .build(app)?,
- )
+ .item(&MenuItemBuilder::with_id("settings_top", "Open screenpipe").build(app)?)
.item(&PredefinedMenuItem::separator(app)?);
// --- Primary actions (most-used first) ---
@@ -393,6 +383,19 @@ fn create_dynamic_menu(
.item(update_item);
}
+ // --- Version (below update item) ---
+ let is_beta = app.config().identifier.contains("beta");
+ let version_text = if is_beta {
+ format!("screenpipe v{} (Beta)", app.package_info().version)
+ } else {
+ format!("screenpipe v{}", app.package_info().version)
+ };
+ menu_builder = menu_builder.item(
+ &MenuItemBuilder::with_id("version", version_text)
+ .enabled(false)
+ .build(app)?,
+ );
+
// --- Recording controls ---
let (default_start_rec, default_stop_rec) = if cfg!(target_os = "windows") {
("Alt+Shift+U", "Alt+Shift+X")
@@ -558,7 +561,7 @@ fn handle_menu_event(app_handle: &AppHandle, event: tauri::menu::MenuEvent) {
}
});
}
- "settings" => {
+ "settings" | "settings_top" => {
let app = app_handle.clone();
let _ = app_handle.run_on_main_thread(move || {
let _ = ShowRewindWindow::Settings { page: None }.show(&app);
diff --git a/crates/screenpipe-audio/src/audio_manager/device_monitor.rs b/crates/screenpipe-audio/src/audio_manager/device_monitor.rs
index 118cb71e0..2c5ae358e 100644
--- a/crates/screenpipe-audio/src/audio_manager/device_monitor.rs
+++ b/crates/screenpipe-audio/src/audio_manager/device_monitor.rs
@@ -10,7 +10,7 @@ use std::{
use anyhow::Result;
use tokio::{sync::Mutex, task::JoinHandle, time::sleep};
-use tracing::{debug, error, info, warn};
+use tracing::{error, info, warn};
use crate::{
core::device::{default_input_device, default_output_device, parse_audio_device, DeviceType},
@@ -294,8 +294,8 @@ pub async fn start_device_monitor(
// This handles cases where audio stream was hijacked by another app
let stale_devices = audio_manager.check_stale_recording_handles().await;
for device_name in stale_devices {
- debug!(
- "detected stale recording handle for {}, cleaning up for restart",
+ warn!(
+ "[DEVICE_RECOVERY] detected stale recording handle for {}, cleaning up for restart",
device_name
);
let _ = audio_manager.cleanup_stale_device(&device_name).await;
@@ -347,9 +347,17 @@ pub async fn start_device_monitor(
}
}
- if audio_manager.start_device(&device).await.is_ok() {
- info!("successfully restarted device {}", device_name);
- disconnected_devices.remove(&device_name);
+ match audio_manager.start_device(&device).await {
+ Ok(()) => {
+ info!("[DEVICE_RECOVERY] successfully restarted device {}", device_name);
+ disconnected_devices.remove(&device_name);
+ }
+ Err(e) => {
+ warn!(
+ "[DEVICE_RECOVERY] failed to restart device {}: {}",
+ device_name, e
+ );
+ }
}
}
diff --git a/crates/screenpipe-audio/src/audio_manager/manager.rs b/crates/screenpipe-audio/src/audio_manager/manager.rs
index 443f46029..91896004d 100644
--- a/crates/screenpipe-audio/src/audio_manager/manager.rs
+++ b/crates/screenpipe-audio/src/audio_manager/manager.rs
@@ -368,6 +368,7 @@ impl AudioManager {
(record_and_transcribe_handle.await, Ok(Ok(())))
};
+ // Check for JoinError (task panic/cancel)
if record_result.is_err() || realtime_result.is_err() {
let mut e = anyhow!("record_device failed");
@@ -386,12 +387,28 @@ impl AudioManager {
return Err(e);
}
- debug!(
- "recording handle for device {} quit unexpectedly",
+ // Check for inner Result errors (record_and_transcribe returned Err)
+ if let Ok(Err(ref e)) = record_result {
+ warn!(
+ "recording for device {} exited with error: {}",
+ device_clone, e
+ );
+ return Err(anyhow!("record_device {} failed: {}", device_clone, e));
+ }
+ if let Ok(Err(ref e)) = realtime_result {
+ warn!(
+ "realtime recording for device {} exited with error: {}",
+ device_clone, e
+ );
+ return Err(anyhow!("realtime {} failed: {}", device_clone, e));
+ }
+
+ warn!(
+ "recording handle for device {} exited unexpectedly with Ok",
device_clone
);
- Ok(())
+ Err(anyhow!("recording handle for device {} exited unexpectedly", device_clone))
});
Ok(recording_handle)
diff --git a/crates/screenpipe-audio/src/core/run_record_and_transcribe.rs b/crates/screenpipe-audio/src/core/run_record_and_transcribe.rs
index 7c5d8353a..b906803f7 100644
--- a/crates/screenpipe-audio/src/core/run_record_and_transcribe.rs
+++ b/crates/screenpipe-audio/src/core/run_record_and_transcribe.rs
@@ -79,7 +79,7 @@ pub async fn run_record_and_transcribe(
}
// Flush remaining audio on exit
- flush_audio(
+ if let Err(e) = flush_audio(
&mut collected_audio,
0,
segment_start_time,
@@ -89,7 +89,9 @@ pub async fn run_record_and_transcribe(
&metrics,
)
.await
- .ok();
+ {
+ warn!("final flush failed for {}: {}", device_name, e);
+ }
info!("stopped recording for {}", device_name);
Ok(())
diff --git a/crates/screenpipe-server/src/archive.rs b/crates/screenpipe-server/src/archive.rs
index 242777515..d92e34cc5 100644
--- a/crates/screenpipe-server/src/archive.rs
+++ b/crates/screenpipe-server/src/archive.rs
@@ -14,6 +14,7 @@ use screenpipe_core::sync::{BlobType, SyncClientConfig, SyncManager};
use screenpipe_db::DatabaseManager;
use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
+use sqlx::Row;
use std::sync::Arc;
use tokio::sync::RwLock;
use tracing::{error, info, warn};
@@ -642,24 +643,13 @@ async fn get_archive_chunk(
// Get UI events in range
#[allow(clippy::type_complexity)]
- let ui_events: Vec<(
- i64,
- String,
- String,
- Option<String>,
- Option<String>,
- Option<String>,
- Option<String>,
- Option<i32>,
- Option<i32>,
- Option<i32>,
- Option<i32>,
- Option<String>,
- Option<String>,
- )> = sqlx::query_as(
+ let ui_events = sqlx::query(
r#"
SELECT id, timestamp, event_type, app_name, window_title, browser_url,
- text_content, x, y, key_code, modifiers, element_role, element_name
+ text_content, x, y, key_code, modifiers, element_role, element_name,
+ session_id, relative_ms, delta_x, delta_y, button, click_count,
+ text_length, app_pid, element_value, element_description,
+ element_automation_id, element_bounds, frame_id
FROM ui_events
WHERE timestamp >= ? AND timestamp < ?
ORDER BY timestamp ASC
@@ -692,7 +682,7 @@ async fn get_archive_chunk(
all_timestamps.push(&a.1);
}
for u in &ui_events {
- all_timestamps.push(&u.1);
+ all_timestamps.push(u.get::<&str, _>("timestamp"));
}
all_timestamps.sort();
@@ -719,11 +709,11 @@ async fn get_archive_chunk(
});
}
- // Get OCR for frames
+ // Get OCR for frames (include app_name/window_name for cross-machine sync)
let ocr_records = if !frame_ids.is_empty() {
- let ocr_results: Vec<(i64, String, bool)> = sqlx::query_as(
+ let ocr_results: Vec<(i64, String, bool, Option<String>, Option<String>)> = sqlx::query_as(
r#"
- SELECT frame_id, text, focused
+ SELECT frame_id, text, focused, app_name, window_name
FROM ocr_text
WHERE frame_id IN (SELECT value FROM json_each(?))
"#,
@@ -734,7 +724,7 @@ async fn get_archive_chunk(
ocr_results
.into_iter()
- .filter_map(|(frame_id, text, focused)| {
+ .filter_map(|(frame_id, text, focused, app_name, window_name)| {
frame_sync_map
.get(&frame_id)
.map(|frame_sync_id| OcrRecord {
@@ -742,6 +732,8 @@ async fn get_archive_chunk(
frame_sync_id: frame_sync_id.clone(),
text,
focused,
+ app_name,
+ window_name,
})
})
.collect()
@@ -784,39 +776,34 @@ async fn get_archive_chunk(
// Build UI event records
let ui_event_records: Vec<UiEventSyncRecord> = ui_events
.into_iter()
- .map(
- |(
- _,
- timestamp,
- event_type,
- app_name,
- window_title,
- browser_url,
- text_content,
- x,
- y,
- key_code,
- modifiers,
- element_role,
- element_name,
- )| {
- UiEventSyncRecord {
- sync_id: Uuid::new_v4().to_string(),
- timestamp,
- event_type,
- app_name,
- window_title,
- browser_url,
- text_content,
- x,
- y,
- key_code,
- modifiers,
- element_role,
- element_name,
- }
- },
- )
+ .map(|r| UiEventSyncRecord {
+ sync_id: Uuid::new_v4().to_string(),
+ timestamp: r.get("timestamp"),
+ event_type: r.get("event_type"),
+ app_name: r.get("app_name"),
+ window_title: r.get("window_title"),
+ browser_url: r.get("browser_url"),
+ text_content: r.get("text_content"),
+ x: r.get("x"),
+ y: r.get("y"),
+ key_code: r.get("key_code"),
+ modifiers: r.get("modifiers"),
+ element_role: r.get("element_role"),
+ element_name: r.get("element_name"),
+ session_id: r.get("session_id"),
+ relative_ms: r.get("relative_ms"),
+ delta_x: r.get("delta_x"),
+ delta_y: r.get("delta_y"),
+ button: r.get("button"),
+ click_count: r.get("click_count"),
+ text_length: r.get("text_length"),
+ app_pid: r.get("app_pid"),
+ element_value: r.get("element_value"),
+ element_description: r.get("element_description"),
+ element_automation_id: r.get("element_automation_id"),
+ element_bounds: r.get("element_bounds"),
+ frame_id: r.get("frame_id"),
+ })
.collect();
Ok(Some(SyncChunk {
diff --git a/crates/screenpipe-server/src/sync_provider.rs b/crates/screenpipe-server/src/sync_provider.rs
index ac940a2da..dd000df5a 100644
--- a/crates/screenpipe-server/src/sync_provider.rs
+++ b/crates/screenpipe-server/src/sync_provider.rs
@@ -8,6 +8,7 @@ use chrono::Utc;
use screenpipe_core::sync::{BlobType, PendingBlob, SyncDataProvider, SyncError, SyncResult};
use screenpipe_db::DatabaseManager;
use serde::{Deserialize, Serialize};
+use sqlx::Row;
use std::sync::Arc;
use tracing::debug;
use uuid::Uuid;
@@ -62,6 +63,12 @@ pub struct OcrRecord {
pub frame_sync_id: String,
pub text: String,
pub focused: bool,
+ /// App name from the source machine (added to avoid empty ocr_text.app_name on import)
+ #[serde(default)]
+ pub app_name: Option<String>,
+ /// Window name from the source machine
+ #[serde(default)]
+ pub window_name: Option<String>,
}
/// Audio transcription record for sync
@@ -102,6 +109,32 @@ pub struct UiEventSyncRecord {
pub modifiers: Option<i32>,
pub element_role: Option<String>,
pub element_name: Option<String>,
+ #[serde(default)]
+ pub session_id: Option<String>,
+ #[serde(default)]
+ pub relative_ms: Option<i32>,
+ #[serde(default)]
+ pub delta_x: Option<i32>,
+ #[serde(default)]
+ pub delta_y: Option<i32>,
+ #[serde(default)]
+ pub button: Option<i32>,
+ #[serde(default)]
+ pub click_count: Option<i32>,
+ #[serde(default)]
+ pub text_length: Option<i32>,
+ #[serde(default)]
+ pub app_pid: Option<i32>,
+ #[serde(default)]
+ pub element_value: Option<String>,
+ #[serde(default)]
+ pub element_description: Option<String>,
+ #[serde(default)]
+ pub element_automation_id: Option<String>,
+ #[serde(default)]
+ pub element_bounds: Option<String>,
+ #[serde(default)]
+ pub frame_id: Option<i64>,
}
/// Current schema version for sync chunks
@@ -151,10 +184,10 @@ impl ScreenpipeSyncProvider {
let time_start = frames.first().map(|f| f.1.clone()).unwrap();
let time_end = frames.last().map(|f| f.1.clone()).unwrap();
- // Get OCR for these frames
- let ocr_results: Vec<(i64, String, bool)> = sqlx::query_as(
+ // Get OCR for these frames (include app_name/window_name for cross-machine sync)
+ let ocr_results: Vec<(i64, String, bool, Option<String>, Option<String>)> = sqlx::query_as(
r#"
- SELECT frame_id, text, focused
+ SELECT frame_id, text, focused, app_name, window_name
FROM ocr_text
WHERE frame_id IN (SELECT value FROM json_each(?))
"#,
@@ -188,7 +221,7 @@ impl ScreenpipeSyncProvider {
// Build OCR records
let ocr_records: Vec<OcrRecord> = ocr_results
.into_iter()
- .filter_map(|(frame_id, text, focused)| {
+ .filter_map(|(frame_id, text, focused, app_name, window_name)| {
frame_sync_map
.get(&frame_id)
.map(|frame_sync_id| OcrRecord {
@@ -196,6 +229,8 @@ impl ScreenpipeSyncProvider {
frame_sync_id: frame_sync_id.clone(),
text,
focused,
+ app_name,
+ window_name,
})
})
.collect();
@@ -338,25 +373,13 @@ impl ScreenpipeSyncProvider {
) -> SyncResult<Option<(SyncChunk, String, String)>> {
let pool = &self.db.pool;
- #[allow(clippy::type_complexity)]
- let records: Vec<(
- i64,
- String,
- String,
- Option<String>,
- Option<String>,
- Option<String>,
- Option<String>,
- Option<i32>,
- Option<i32>,
- Option<i32>,
- Option<i32>,
- Option<String>,
- Option<String>,
- )> = sqlx::query_as(
+ let records = sqlx::query(
r#"
SELECT id, timestamp, event_type, app_name, window_title, browser_url,
- text_content, x, y, key_code, modifiers, element_role, element_name
+ text_content, x, y, key_code, modifiers, element_role, element_name,
+ session_id, relative_ms, delta_x, delta_y, button, click_count,
+ text_length, app_pid, element_value, element_description,
+ element_automation_id, element_bounds, frame_id
FROM ui_events
WHERE synced_at IS NULL
ORDER BY timestamp ASC
@@ -372,42 +395,41 @@ impl ScreenpipeSyncProvider {
return Ok(None);
}
- let time_start = records.first().map(|r| r.1.clone()).unwrap();
- let time_end = records.last().map(|r| r.1.clone()).unwrap();
+ let time_start: String = records.first().unwrap().get("timestamp");
+ let time_end: String = records.last().unwrap().get("timestamp");
let ui_events: Vec<UiEventSyncRecord> = records
.into_iter()
- .map(
- |(
- _,
- timestamp,
- event_type,
- app_name,
- window_title,
- browser_url,
- text_content,
- x,
- y,
- key_code,
- modifiers,
- element_role,
- element_name,
- )| UiEventSyncRecord {
+ .map(|r| {
+ UiEventSyncRecord {
sync_id: Uuid::new_v4().to_string(),
- timestamp,
- event_type,
- app_name,
- window_title,
- browser_url,
- text_content,
- x,
- y,
- key_code,
- modifiers,
- element_role,
- element_name,
- },
- )
+ timestamp: r.get("timestamp"),
+ event_type: r.get("event_type"),
+ app_name: r.get("app_name"),
+ window_title: r.get("window_title"),
+ browser_url: r.get("browser_url"),
+ text_content: r.get("text_content"),
+ x: r.get("x"),
+ y: r.get("y"),
+ key_code: r.get("key_code"),
+ modifiers: r.get("modifiers"),
+ element_role: r.get("element_role"),
+ element_name: r.get("element_name"),
+ session_id: r.get("session_id"),
+ relative_ms: r.get("relative_ms"),
+ delta_x: r.get("delta_x"),
+ delta_y: r.get("delta_y"),
+ button: r.get("button"),
+ click_count: r.get("click_count"),
+ text_length: r.get("text_length"),
+ app_pid: r.get("app_pid"),
+ element_value: r.get("element_value"),
+ element_description: r.get("element_description"),
+ element_automation_id: r.get("element_automation_id"),
+ element_bounds: r.get("element_bounds"),
+ frame_id: r.get("frame_id"),
+ }
+ })
.collect();
let chunk = SyncChunk {
@@ -527,6 +549,13 @@ impl ScreenpipeSyncProvider {
std::collections::HashMap::new()
};
+ // Build frame_sync_id -> FrameRecord map for fallback app_name/window_name
+ let frame_record_map: std::collections::HashMap<&str, &FrameRecord> = chunk
+ .frames
+ .iter()
+ .map(|f| (f.sync_id.as_str(), f))
+ .collect();
+
// Import OCR
for ocr in &chunk.ocr_records {
if let Some(&frame_id) = frame_id_map.get(&ocr.frame_sync_id) {
@@ -543,15 +572,30 @@ impl ScreenpipeSyncProvider {
continue;
}
+ // Resolve app_name/window_name: prefer OCR record, fall back to frame record
+ // (old schema chunks won't have these fields on OcrRecord)
+ let frame_rec = frame_record_map.get(ocr.frame_sync_id.as_str());
+ let app_name = ocr
+ .app_name
+ .as_deref()
+ .or_else(|| frame_rec.and_then(|f| f.app_name.as_deref()))
+ .unwrap_or("");
+ let window_name = ocr
+ .window_name
+ .as_deref()
+ .or_else(|| frame_rec.and_then(|f| f.window_name.as_deref()));
+
sqlx::query(
r#"
- INSERT INTO ocr_text (frame_id, text, focused, sync_id, synced_at)
- VALUES (?, ?, ?, ?, ?)
+ INSERT INTO ocr_text (frame_id, text, focused, app_name, window_name, sync_id, synced_at)
+ VALUES (?, ?, ?, ?, ?, ?, ?)
"#,
)
.bind(frame_id)
.bind(&ocr.text)
.bind(ocr.focused)
+ .bind(app_name)
+ .bind(window_name)
.bind(&ocr.sync_id)
.bind(Utc::now().to_rfc3339())
.execute(pool)
@@ -678,8 +722,11 @@ impl ScreenpipeSyncProvider {
r#"
INSERT INTO ui_events (timestamp, event_type, app_name, window_title, browser_url,
text_content, x, y, key_code, modifiers, element_role, element_name,
+ session_id, relative_ms, delta_x, delta_y, button, click_count,
+ text_length, app_pid, element_value, element_description,
+ element_automation_id, element_bounds, frame_id,
sync_id, machine_id, synced_at)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
"#,
)
.bind(&event.timestamp)
@@ -694,6 +741,19 @@ impl ScreenpipeSyncProvider {
.bind(event.modifiers)
.bind(&event.element_role)
.bind(&event.element_name)
+ .bind(&event.session_id)
+ .bind(event.relative_ms)
+ .bind(event.delta_x)
+ .bind(event.delta_y)
+ .bind(event.button)
+ .bind(event.click_count)
+ .bind(event.text_length)
+ .bind(event.app_pid)
+ .bind(&event.element_value)
+ .bind(&event.element_description)
+ .bind(&event.element_automation_id)
+ .bind(&event.element_bounds)
+ .bind(event.frame_id)
.bind(&event.sync_id)
.bind(&chunk.machine_id)
.bind(Utc::now().to_rfc3339())