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.0.244, CLI to v0.3.38

Louis Beaumont503e0cc34ff0
diff --git a/Cargo.lock b/Cargo.lock
index 996654753..d99aa0d40 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6628,7 +6628,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio"
-version = "0.3.37"
+version = "0.3.38"
dependencies = [
"anyhow",
"bytemuck",
@@ -6681,7 +6681,7 @@ dependencies = [
[[package]]
name = "screenpipe-core"
-version = "0.3.37"
+version = "0.3.38"
dependencies = [
"accessibility",
"accessibility-sys",
@@ -6732,7 +6732,7 @@ dependencies = [
[[package]]
name = "screenpipe-db"
-version = "0.3.37"
+version = "0.3.38"
dependencies = [
"anyhow",
"chrono",
@@ -6756,7 +6756,7 @@ dependencies = [
[[package]]
name = "screenpipe-events"
-version = "0.3.37"
+version = "0.3.38"
dependencies = [
"anyhow",
"chrono",
@@ -6774,7 +6774,7 @@ dependencies = [
[[package]]
name = "screenpipe-integrations"
-version = "0.3.37"
+version = "0.3.38"
dependencies = [
"anyhow",
"image",
@@ -6789,7 +6789,7 @@ dependencies = [
[[package]]
name = "screenpipe-server"
-version = "0.3.37"
+version = "0.3.38"
dependencies = [
"anyhow",
"async-trait",
@@ -6858,7 +6858,7 @@ dependencies = [
[[package]]
name = "screenpipe-vision"
-version = "0.3.37"
+version = "0.3.38"
dependencies = [
"accessibility-sys",
"anyhow",
diff --git a/Cargo.toml b/Cargo.toml
index 65c95fe29..8d8cd5455 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,7 +6,7 @@ exclude = ["apps/screenpipe-app-tauri/src-tauri"]
resolver = "2"
[workspace.package]
-version = "0.3.37"
+version = "0.3.38"
authors = ["louis030195 <[email protected]>"]
description = ""
repository = "https://github.com/screenpipe/screenpipe"
diff --git a/apps/screenpipe-app-tauri/scripts/pre_build.js b/apps/screenpipe-app-tauri/scripts/pre_build.js
index fabf37334..d3674c696 100644
--- a/apps/screenpipe-app-tauri/scripts/pre_build.js
+++ b/apps/screenpipe-app-tauri/scripts/pre_build.js
@@ -297,6 +297,8 @@ if (platform == 'windows') {
console.log('Copying screenpipe binary...');
const potentialPaths = [
+ path.join(__dirname, '..', '..', '..', 'target', 'release', 'screenpipe.exe'),
+ path.join(__dirname, '..', '..', '..', 'target', 'x86_64-pc-windows-msvc', 'release', 'screenpipe.exe'),
path.join(__dirname, '..', '..', 'target', 'release', 'screenpipe.exe'),
path.join(__dirname, '..', '..', 'target', 'x86_64-pc-windows-msvc', 'release', 'screenpipe.exe'),
path.join(__dirname, '..', 'target', 'release', 'screenpipe.exe'),
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index 7873e4ba5..c613d8f4f 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.0.243"
+version = "2.0.244"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/crates/screenpipe-db/src/db.rs b/crates/screenpipe-db/src/db.rs
index 9875bd031..edc01e0e5 100644
--- a/crates/screenpipe-db/src/db.rs
+++ b/crates/screenpipe-db/src/db.rs
@@ -3010,81 +3010,95 @@ LIMIT ? OFFSET ?
new_speaker_name: &str,
propagate_similar: bool,
) -> Result<(i64, u64, u64), sqlx::Error> {
- let mut tx = self.pool.begin().await?;
-
- // 1. Get the current speaker_id for this audio chunk
- let current_speaker_id: Option<i64> = sqlx::query_scalar(
- "SELECT speaker_id FROM audio_transcriptions WHERE audio_chunk_id = ? LIMIT 1",
- )
- .bind(audio_chunk_id)
- .fetch_optional(&mut *tx)
- .await?;
+ // Phase 1: Short write transaction – reassign the chunk and move one embedding.
+ // Avoid holding a write lock during expensive vector search.
+ let (current_speaker_id, target_speaker_id, transcriptions_updated, mut embeddings_moved) = {
+ let mut tx = self.pool.begin().await?;
+
+ // 1. Get the current speaker_id for this audio chunk
+ let current_speaker_id: Option<i64> = sqlx::query_scalar(
+ "SELECT speaker_id FROM audio_transcriptions WHERE audio_chunk_id = ? LIMIT 1",
+ )
+ .bind(audio_chunk_id)
+ .fetch_optional(&mut *tx)
+ .await?;
- let current_speaker_id = match current_speaker_id {
- Some(id) => id,
- None => {
- tx.rollback().await?;
- return Err(sqlx::Error::RowNotFound);
- }
- };
+ let current_speaker_id = match current_speaker_id {
+ Some(id) => id,
+ None => {
+ tx.rollback().await?;
+ return Err(sqlx::Error::RowNotFound);
+ }
+ };
- // 2. Find or create the target speaker
- let target_speaker: Speaker = match sqlx::query_as::<_, Speaker>(
- "SELECT id, name, metadata FROM speakers WHERE name = ? AND hallucination = 0",
- )
- .bind(new_speaker_name)
- .fetch_optional(&mut *tx)
- .await?
- {
- Some(speaker) => speaker,
- None => {
- // Create new speaker
- let id = sqlx::query("INSERT INTO speakers (name) VALUES (?)")
- .bind(new_speaker_name)
- .execute(&mut *tx)
- .await?
- .last_insert_rowid();
+ // 2. Find or create the target speaker
+ let target_speaker: Speaker = match sqlx::query_as::<_, Speaker>(
+ "SELECT id, name, metadata FROM speakers WHERE name = ? AND hallucination = 0",
+ )
+ .bind(new_speaker_name)
+ .fetch_optional(&mut *tx)
+ .await?
+ {
+ Some(speaker) => speaker,
+ None => {
+ let id = sqlx::query("INSERT INTO speakers (name) VALUES (?)")
+ .bind(new_speaker_name)
+ .execute(&mut *tx)
+ .await?
+ .last_insert_rowid();
- Speaker {
- id,
- name: new_speaker_name.to_string(),
- metadata: String::new(),
+ Speaker {
+ id,
+ name: new_speaker_name.to_string(),
+ metadata: String::new(),
+ }
}
- }
- };
+ };
- // 3. Update the transcription's speaker_id
- let transcriptions_updated =
- sqlx::query("UPDATE audio_transcriptions SET speaker_id = ? WHERE audio_chunk_id = ?")
- .bind(target_speaker.id)
- .bind(audio_chunk_id)
- .execute(&mut *tx)
- .await?
- .rows_affected();
+ // 3. Update the transcription's speaker_id
+ let transcriptions_updated = sqlx::query(
+ "UPDATE audio_transcriptions SET speaker_id = ? WHERE audio_chunk_id = ?",
+ )
+ .bind(target_speaker.id)
+ .bind(audio_chunk_id)
+ .execute(&mut *tx)
+ .await?
+ .rows_affected();
- // 4. Move the embedding from old speaker to new speaker
- let embedding_id: Option<i64> =
- sqlx::query_scalar("SELECT id FROM speaker_embeddings WHERE speaker_id = ? LIMIT 1")
- .bind(current_speaker_id)
- .fetch_optional(&mut *tx)
- .await?;
+ // 4. Move the embedding from old speaker to new speaker
+ let embedding_id: Option<i64> = sqlx::query_scalar(
+ "SELECT id FROM speaker_embeddings WHERE speaker_id = ? LIMIT 1",
+ )
+ .bind(current_speaker_id)
+ .fetch_optional(&mut *tx)
+ .await?;
- let mut embeddings_moved = 0u64;
- if let Some(emb_id) = embedding_id {
- sqlx::query("UPDATE speaker_embeddings SET speaker_id = ? WHERE id = ?")
- .bind(target_speaker.id)
- .bind(emb_id)
- .execute(&mut *tx)
- .await?;
- embeddings_moved = 1;
- }
+ let mut embeddings_moved = 0u64;
+ if let Some(emb_id) = embedding_id {
+ sqlx::query("UPDATE speaker_embeddings SET speaker_id = ? WHERE id = ?")
+ .bind(target_speaker.id)
+ .bind(emb_id)
+ .execute(&mut *tx)
+ .await?;
+ embeddings_moved = 1;
+ }
- // 5. If propagate_similar, find and reassign similar embeddings
+ tx.commit().await?;
+ (
+ current_speaker_id,
+ target_speaker.id,
+ transcriptions_updated,
+ embeddings_moved,
+ )
+ };
+
+ // Phase 2: If propagate_similar, do the expensive vector similarity search
+ // OUTSIDE any transaction so we don't hold a write lock.
if propagate_similar {
let threshold = 0.5; // Same as speaker matching threshold
- // Find similar embeddings from other speakers
- let similar_rows = sqlx::query(
+ // Read-only: find similar embeddings from other speakers
+ let similar_rows: Vec<(i64, i64)> = sqlx::query(
r#"
SELECT se2.id as embedding_id, se2.speaker_id
FROM speaker_embeddings se1
@@ -3094,65 +3108,78 @@ LIMIT ? OFFSET ?
AND se2.speaker_id != ?
"#,
)
- .bind(target_speaker.id)
+ .bind(target_speaker_id)
.bind(threshold)
- .bind(target_speaker.id)
- .fetch_all(&mut *tx)
- .await?;
-
- for row in similar_rows {
+ .bind(target_speaker_id)
+ .fetch_all(&self.pool)
+ .await?
+ .iter()
+ .map(|row| {
let emb_id: i64 = row.get("embedding_id");
let old_speaker_id: i64 = row.get("speaker_id");
+ (emb_id, old_speaker_id)
+ })
+ .collect();
- // Move the embedding
- sqlx::query("UPDATE speaker_embeddings SET speaker_id = ? WHERE id = ?")
- .bind(target_speaker.id)
- .bind(emb_id)
- .execute(&mut *tx)
- .await?;
- embeddings_moved += 1;
+ // Phase 3: Short write transaction – apply the similarity results.
+ if !similar_rows.is_empty() {
+ let mut tx = self.pool.begin().await?;
- // Move transcriptions from the old speaker
- sqlx::query("UPDATE audio_transcriptions SET speaker_id = ? WHERE speaker_id = ?")
- .bind(target_speaker.id)
+ for (emb_id, old_speaker_id) in &similar_rows {
+ // Move the embedding
+ sqlx::query("UPDATE speaker_embeddings SET speaker_id = ? WHERE id = ?")
+ .bind(target_speaker_id)
+ .bind(emb_id)
+ .execute(&mut *tx)
+ .await?;
+ embeddings_moved += 1;
+
+ // Move transcriptions from the old speaker
+ sqlx::query(
+ "UPDATE audio_transcriptions SET speaker_id = ? WHERE speaker_id = ?",
+ )
+ .bind(target_speaker_id)
.bind(old_speaker_id)
.execute(&mut *tx)
.await?;
- // Check if old speaker has no more embeddings, delete if empty
- let remaining: i64 = sqlx::query_scalar(
- "SELECT COUNT(*) FROM speaker_embeddings WHERE speaker_id = ?",
- )
- .bind(old_speaker_id)
- .fetch_one(&mut *tx)
- .await?;
+ // Check if old speaker has no more embeddings, delete if empty
+ let remaining: i64 = sqlx::query_scalar(
+ "SELECT COUNT(*) FROM speaker_embeddings WHERE speaker_id = ?",
+ )
+ .bind(old_speaker_id)
+ .fetch_one(&mut *tx)
+ .await?;
- if remaining == 0 {
- sqlx::query("DELETE FROM speakers WHERE id = ?")
- .bind(old_speaker_id)
- .execute(&mut *tx)
- .await?;
+ if remaining == 0 {
+ sqlx::query("DELETE FROM speakers WHERE id = ?")
+ .bind(old_speaker_id)
+ .execute(&mut *tx)
+ .await?;
+ }
}
+
+ tx.commit().await?;
}
}
- // 6. Clean up: if original speaker has no embeddings left, delete it
- let remaining: i64 =
- sqlx::query_scalar("SELECT COUNT(*) FROM speaker_embeddings WHERE speaker_id = ?")
- .bind(current_speaker_id)
- .fetch_one(&mut *tx)
- .await?;
+ // Phase 4: Clean up – if original speaker has no embeddings left, delete it
+ {
+ let remaining: i64 =
+ sqlx::query_scalar("SELECT COUNT(*) FROM speaker_embeddings WHERE speaker_id = ?")
+ .bind(current_speaker_id)
+ .fetch_one(&self.pool)
+ .await?;
- if remaining == 0 && current_speaker_id != target_speaker.id {
- sqlx::query("DELETE FROM speakers WHERE id = ?")
- .bind(current_speaker_id)
- .execute(&mut *tx)
- .await?;
+ if remaining == 0 && current_speaker_id != target_speaker_id {
+ sqlx::query("DELETE FROM speakers WHERE id = ?")
+ .bind(current_speaker_id)
+ .execute(&self.pool)
+ .await?;
+ }
}
- tx.commit().await?;
-
- Ok((target_speaker.id, transcriptions_updated, embeddings_moved))
+ Ok((target_speaker_id, transcriptions_updated, embeddings_moved))
}
// ============================================================================