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.133, fix linux ort bundling, sync/engine improvements

Louis Beaumont1b9909b403a5
diff --git a/apps/screenpipe-app-tauri/components/settings/sync-settings.tsx b/apps/screenpipe-app-tauri/components/settings/sync-settings.tsx
index d5d17824f..312406373 100644
--- a/apps/screenpipe-app-tauri/components/settings/sync-settings.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/sync-settings.tsx
@@ -441,6 +441,7 @@ function ActiveSyncSettings({
onToggleSync,
onTriggerSync,
onRemoveDevice,
+ onDeleteDeviceLocalData,
onDeleteCloudData,
isSyncing,
}: {
@@ -449,6 +450,7 @@ function ActiveSyncSettings({
onToggleSync: (enabled: boolean) => void;
onTriggerSync: () => void;
onRemoveDevice: (deviceId: string) => void;
+ onDeleteDeviceLocalData: (deviceId: string) => void;
onDeleteCloudData: () => void;
isSyncing: boolean;
}) {
@@ -602,13 +604,24 @@ function ActiveSyncSettings({
</div>
</div>
{!device.isCurrent && (
- <Button
- variant="ghost"
- size="sm"
- onClick={() => onRemoveDevice(device.deviceId)}
- >
- <Trash2 className="h-4 w-4 text-muted-foreground" />
- </Button>
+ <div className="flex items-center gap-1">
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() => onDeleteDeviceLocalData(device.deviceId)}
+ title="delete synced data from this device"
+ >
+ <span className="text-xs text-muted-foreground">clean local data</span>
+ </Button>
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() => onRemoveDevice(device.deviceId)}
+ title="unlink device from sync"
+ >
+ <Trash2 className="h-4 w-4 text-muted-foreground" />
+ </Button>
+ </div>
)}
</Card>
))}
@@ -1134,6 +1147,31 @@ export function SyncSettings() {
}
};
+ const handleDeleteDeviceLocalData = async (deviceId: string) => {
+ const confirmed = window.confirm(
+ "this will delete all data synced from this device on your local machine.\n\n" +
+ "to re-sync, disable and re-enable cloud sync.\n\n" +
+ "continue?"
+ );
+ if (!confirmed) return;
+
+ try {
+ const result = await invoke("delete_device_local_data", { machineId: deviceId });
+ const parsed = typeof result === "string" ? JSON.parse(result) : result;
+ const total = (parsed.frames_deleted || 0) + (parsed.ocr_deleted || 0) + (parsed.audio_transcriptions_deleted || 0) + (parsed.ui_events_deleted || 0);
+ toast({
+ title: "local data cleaned",
+ description: `removed ${total} records synced from this device`,
+ });
+ } catch (error) {
+ toast({
+ title: "failed to delete device data",
+ description: String(error),
+ variant: "destructive",
+ });
+ }
+ };
+
const handleDeleteCloudData = async () => {
try {
await invoke("delete_cloud_data");
@@ -1199,6 +1237,7 @@ export function SyncSettings() {
onToggleSync={handleToggleSync}
onTriggerSync={handleTriggerSync}
onRemoveDevice={handleRemoveDevice}
+ onDeleteDeviceLocalData={handleDeleteDeviceLocalData}
onDeleteCloudData={handleDeleteCloudData}
isSyncing={isSyncing}
/>
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index c98c16277..60b6e2a86 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -9329,7 +9329,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "2.2.131"
+version = "2.2.132"
dependencies = [
"anyhow",
"arboard",
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index c13ba3169..c0187a4ed 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.132"
+version = "2.2.133"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index 44a187181..b32d100f5 100755
--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -1355,6 +1355,7 @@ async fn main() {
sync::update_sync_config,
sync::get_sync_devices,
sync::remove_sync_device,
+ sync::delete_device_local_data,
sync::init_sync,
sync::lock_sync,
sync::delete_cloud_data,
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/sync.rs b/apps/screenpipe-app-tauri/src-tauri/src/sync.rs
index a948f108b..4ea63dfbf 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/sync.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/sync.rs
@@ -228,20 +228,29 @@ pub async fn trigger_sync(state: State<'_, SyncState>) -> Result<(), String> {
/// Get sync configuration.
#[tauri::command]
#[specta::specta]
-pub async fn get_sync_config() -> Result<SyncConfig, String> {
- // TODO: Read from persistent storage
- Ok(SyncConfig::default())
+pub async fn get_sync_config(app: AppHandle) -> Result<SyncConfig, String> {
+ let store = crate::store::get_store(&app, None).map_err(|e| e.to_string())?;
+ let config = store.get("sync_config").unwrap_or(serde_json::Value::Null);
+ match serde_json::from_value::<SyncConfig>(config) {
+ Ok(c) => Ok(c),
+ Err(_) => Ok(SyncConfig::default()),
+ }
}
/// Update sync configuration.
#[tauri::command]
#[specta::specta]
pub async fn update_sync_config(
+ app: AppHandle,
state: State<'_, SyncState>,
config: SyncConfig,
) -> Result<(), String> {
*state.enabled.write().await = config.enabled;
- // TODO: Persist config and update sync service
+
+ let store = crate::store::get_store(&app, None).map_err(|e| e.to_string())?;
+ store.set("sync_config", serde_json::json!(config));
+ store.save().map_err(|e| e.to_string())?;
+
Ok(())
}
@@ -292,6 +301,36 @@ pub async fn remove_sync_device(
Ok(())
}
+/// Delete all locally-stored data that was synced from a specific remote device.
+/// This calls the local screenpipe server's /data/delete-device endpoint.
+/// Refuses to delete data for the current device as a safety guard.
+#[tauri::command]
+#[specta::specta]
+pub async fn delete_device_local_data(
+ state: State<'_, SyncState>,
+ machine_id: String,
+) -> Result<String, String> {
+ if machine_id == state.machine_id {
+ return Err("cannot delete your own device's local data".to_string());
+ }
+
+ let client = reqwest::Client::new();
+ let resp = client
+ .post("http://localhost:3030/data/delete-device")
+ .json(&serde_json::json!({ "machine_id": machine_id }))
+ .send()
+ .await
+ .map_err(|e| format!("failed to call delete-device: {}", e))?;
+
+ if !resp.status().is_success() {
+ let body = resp.text().await.unwrap_or_default();
+ return Err(format!("delete-device failed: {}", body));
+ }
+
+ let body = resp.text().await.unwrap_or_default();
+ Ok(body)
+}
+
/// Initialize sync with password.
/// This initializes both the local SyncManager (for device queries) and
/// the server's SyncService (for actual data sync).
diff --git a/crates/screenpipe-audio/Cargo.toml b/crates/screenpipe-audio/Cargo.toml
index 62182efea..15c5626f4 100644
--- a/crates/screenpipe-audio/Cargo.toml
+++ b/crates/screenpipe-audio/Cargo.toml
@@ -77,8 +77,9 @@ sysinfo = "0.29.0"
lazy_static = { version = "1.4.0" }
realfft = "3.4.0"
ndarray = "0.16"
-ort = "=2.0.0-rc.6"
-ort-sys = "=2.0.0-rc.6"
+# Base ort dep — each platform overrides with specific features below
+ort = { version = "=2.0.0-rc.6", default-features = false, features = ["ndarray", "half"] }
+ort-sys = { version = "=2.0.0-rc.6", default-features = false }
knf-rs = "0.3.2"
futures = "0.3.31"
deepgram = "0.6.4"
@@ -89,6 +90,10 @@ rand = "0.9.0"
[target.'cfg(target_os = "linux")'.dependencies]
libpulse-binding = { version = "2.28", optional = true }
libpulse-simple-binding = { version = "2.28", optional = true }
+# Use load-dynamic on Linux so we don't bundle ONNX Runtime (or its CUDA providers) into the AppImage.
+# The user's system onnxruntime lib is loaded at runtime instead.
+ort = { version = "=2.0.0-rc.6", default-features = false, features = ["ndarray", "half", "load-dynamic"] }
+ort-sys = { version = "=2.0.0-rc.6", default-features = false, features = ["load-dynamic"] }
# Windows COM API for querying the "Default Communications Device" role.
# MS Teams/Zoom route audio to the eCommunications endpoint, which may
diff --git a/crates/screenpipe-db/src/db.rs b/crates/screenpipe-db/src/db.rs
index 4ac78ab8a..c4c06b5e5 100644
--- a/crates/screenpipe-db/src/db.rs
+++ b/crates/screenpipe-db/src/db.rs
@@ -3953,6 +3953,89 @@ impl DatabaseManager {
})
}
+ /// Delete all locally-stored data that was synced from a specific remote device.
+ /// Uses JOINs to find related OCR/transcription records since those tables
+ /// lack a direct machine_id column.
+ pub async fn delete_by_machine_id(
+ &self,
+ machine_id: &str,
+ ) -> Result<DeleteTimeRangeResult, sqlx::Error> {
+ let mut tx = self.begin_immediate_with_retry().await?;
+
+ // 1. Delete ocr_text for frames from this machine
+ let ocr_result = sqlx::query(
+ "DELETE FROM ocr_text WHERE frame_id IN (SELECT id FROM frames WHERE machine_id = ?1)",
+ )
+ .bind(machine_id)
+ .execute(&mut **tx.conn())
+ .await?;
+ let ocr_deleted = ocr_result.rows_affected();
+
+ // 2. Delete frames from this machine (vision_tags CASCADE automatically)
+ let frames_result = sqlx::query("DELETE FROM frames WHERE machine_id = ?1")
+ .bind(machine_id)
+ .execute(&mut **tx.conn())
+ .await?;
+ let frames_deleted = frames_result.rows_affected();
+
+ // 3. Delete orphaned video_chunks (cloud:// placeholders from sync)
+ let video_chunks_result = sqlx::query(
+ "DELETE FROM video_chunks WHERE machine_id = ?1 AND id NOT IN (SELECT DISTINCT video_chunk_id FROM frames)",
+ )
+ .bind(machine_id)
+ .execute(&mut **tx.conn())
+ .await?;
+ let video_chunks_deleted = video_chunks_result.rows_affected();
+
+ // 4. Delete audio_transcriptions for audio_chunks from this machine
+ let audio_transcriptions_result = sqlx::query(
+ "DELETE FROM audio_transcriptions WHERE audio_chunk_id IN (SELECT id FROM audio_chunks WHERE machine_id = ?1)",
+ )
+ .bind(machine_id)
+ .execute(&mut **tx.conn())
+ .await?;
+ let audio_transcriptions_deleted = audio_transcriptions_result.rows_affected();
+
+ // 5. Delete orphaned audio_chunks from this machine (audio_tags CASCADE automatically)
+ let audio_chunks_result = sqlx::query(
+ "DELETE FROM audio_chunks WHERE machine_id = ?1 AND id NOT IN (SELECT DISTINCT audio_chunk_id FROM audio_transcriptions)",
+ )
+ .bind(machine_id)
+ .execute(&mut **tx.conn())
+ .await?;
+ let audio_chunks_deleted = audio_chunks_result.rows_affected();
+
+ // 6. Delete ui_events from this machine
+ let ui_events_result = sqlx::query("DELETE FROM ui_events WHERE machine_id = ?1")
+ .bind(machine_id)
+ .execute(&mut **tx.conn())
+ .await?;
+ let ui_events_deleted = ui_events_result.rows_affected();
+
+ tx.commit().await.map_err(|e| {
+ error!("failed to commit delete_by_machine_id transaction: {}", e);
+ e
+ })?;
+
+ debug!(
+ "delete_by_machine_id({}) committed: frames={}, ocr={}, audio_transcriptions={}, audio_chunks={}, video_chunks={}, ui_events={}",
+ machine_id, frames_deleted, ocr_deleted, audio_transcriptions_deleted, audio_chunks_deleted, video_chunks_deleted, ui_events_deleted
+ );
+
+ Ok(DeleteTimeRangeResult {
+ frames_deleted,
+ ocr_deleted,
+ audio_transcriptions_deleted,
+ audio_chunks_deleted,
+ video_chunks_deleted,
+ accessibility_deleted: 0,
+ ui_events_deleted,
+ video_files: vec![],
+ audio_files: vec![],
+ snapshot_files: vec![],
+ })
+ }
+
// =========================================================================
// Cloud archive media upload tracking
// =========================================================================
diff --git a/crates/screenpipe-engine/src/pipe_permissions_middleware.rs b/crates/screenpipe-engine/src/pipe_permissions_middleware.rs
index 79dcbc320..24945b947 100644
--- a/crates/screenpipe-engine/src/pipe_permissions_middleware.rs
+++ b/crates/screenpipe-engine/src/pipe_permissions_middleware.rs
@@ -58,6 +58,7 @@ fn extract_pipe_token(req: &Request<Body>) -> Option<String> {
/// Paths that pipes should never be able to call (data mutation).
const MUTATION_PATHS: &[&str] = &[
"/data/delete-range",
+ "/data/delete-device",
"/audio/retranscribe",
"/speakers/merge",
"/speakers/reassign",
diff --git a/crates/screenpipe-engine/src/routes/data.rs b/crates/screenpipe-engine/src/routes/data.rs
index 1787f4943..b469b329e 100644
--- a/crates/screenpipe-engine/src/routes/data.rs
+++ b/crates/screenpipe-engine/src/routes/data.rs
@@ -11,7 +11,7 @@ use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
use std::sync::Arc;
-use tracing::warn;
+use tracing::{info, warn};
use crate::server::AppState;
@@ -94,3 +94,51 @@ pub(crate) async fn delete_time_range_handler(
audio_files_deleted,
}))
}
+
+#[derive(Deserialize)]
+pub struct DeleteDeviceDataRequest {
+ pub machine_id: String,
+}
+
+/// Delete all locally-stored data that was synced from a specific remote device.
+pub(crate) async fn delete_device_data_handler(
+ State(state): State<Arc<AppState>>,
+ Json(payload): Json<DeleteDeviceDataRequest>,
+) -> Result<JsonResponse<DeleteTimeRangeResponse>, (StatusCode, JsonResponse<Value>)> {
+ if payload.machine_id.trim().is_empty() {
+ return Err((
+ StatusCode::BAD_REQUEST,
+ JsonResponse(json!({"error": "machine_id is required"})),
+ ));
+ }
+
+ info!("deleting local data for machine_id: {}", payload.machine_id);
+
+ let result = state
+ .db
+ .delete_by_machine_id(&payload.machine_id)
+ .await
+ .map_err(|e| {
+ (
+ StatusCode::INTERNAL_SERVER_ERROR,
+ JsonResponse(json!({"error": format!("failed to delete device data: {}", e)})),
+ )
+ })?;
+
+ info!(
+ "deleted device data for {}: frames={}, ocr={}, audio={}",
+ payload.machine_id, result.frames_deleted, result.ocr_deleted, result.audio_transcriptions_deleted
+ );
+
+ Ok(JsonResponse(DeleteTimeRangeResponse {
+ frames_deleted: result.frames_deleted,
+ ocr_deleted: result.ocr_deleted,
+ audio_transcriptions_deleted: result.audio_transcriptions_deleted,
+ audio_chunks_deleted: result.audio_chunks_deleted,
+ video_chunks_deleted: result.video_chunks_deleted,
+ accessibility_deleted: result.accessibility_deleted,
+ ui_events_deleted: result.ui_events_deleted,
+ video_files_deleted: 0,
+ audio_files_deleted: 0,
+ }))
+}
diff --git a/crates/screenpipe-engine/src/routes/frames.rs b/crates/screenpipe-engine/src/routes/frames.rs
index 5c65ed49d..2fc1422a2 100644
--- a/crates/screenpipe-engine/src/routes/frames.rs
+++ b/crates/screenpipe-engine/src/routes/frames.rs
@@ -102,6 +102,27 @@ pub async fn get_frame_data(
// If not in cache or cache disabled, get from database
match state.db.get_frame(frame_id).await {
Ok(Some((file_path, offset_index, is_snapshot))) => {
+ // Synced frame from another device — no local file exists.
+ // Return metadata (OCR text, app/window context) instead of 410.
+ if file_path.starts_with("cloud://") {
+ let ocr_text = state.db.get_frame_ocr_text_json(frame_id).await.ok().flatten();
+ let timestamp = state.db.get_frame_timestamp(frame_id).await.ok().flatten();
+ let (acc_text, _) = state.db.get_frame_accessibility_data(frame_id).await.unwrap_or((None, None));
+
+ let metadata = json!({
+ "error": "Frame is on a remote device",
+ "error_type": "remote_device",
+ "frame_id": frame_id,
+ "timestamp": timestamp,
+ "ocr_text": ocr_text,
+ "accessibility_text": acc_text,
+ });
+ return Err((
+ StatusCode::NOT_FOUND,
+ JsonResponse(metadata),
+ ));
+ }
+
if is_snapshot {
// Snapshot frame — serve JPEG directly (no ffmpeg needed)
if query.redact_pii {
diff --git a/crates/screenpipe-engine/src/server.rs b/crates/screenpipe-engine/src/server.rs
index bca323b2a..a526f0d96 100644
--- a/crates/screenpipe-engine/src/server.rs
+++ b/crates/screenpipe-engine/src/server.rs
@@ -24,7 +24,7 @@ use crate::{
add_tags, add_to_database, execute_raw_sql, get_tags_batch, merge_frames_handler,
remove_tags, validate_media_handler,
},
- data::delete_time_range_handler,
+ data::{delete_device_data_handler, delete_time_range_handler},
elements::{get_frame_elements, search_elements},
frames::{
get_frame_context, get_frame_data, get_frame_metadata, get_frame_text_data,
@@ -548,6 +548,10 @@ impl SCServer {
"/data/delete-range",
axum::routing::post(delete_time_range_handler),
)
+ .route(
+ "/data/delete-device",
+ axum::routing::post(delete_device_data_handler),
+ )
.route(
"/audio/retranscribe",
axum::routing::post(crate::routes::retranscribe::retranscribe_handler),