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

perf: skip WhatsApp session permission sweep after first run

Louis Beaumont271503bade9a
diff --git a/Cargo.lock b/Cargo.lock
index c7b923a8a..712370cb5 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6811,7 +6811,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio"
-version = "0.3.278"
+version = "0.3.279"
dependencies = [
"anyhow",
"audiopipe",
@@ -6871,7 +6871,7 @@ dependencies = [
[[package]]
name = "screenpipe-config"
-version = "0.3.278"
+version = "0.3.279"
dependencies = [
"dirs 6.0.0",
"serde",
@@ -6884,7 +6884,7 @@ dependencies = [
[[package]]
name = "screenpipe-connect"
-version = "0.3.278"
+version = "0.3.279"
dependencies = [
"anyhow",
"async-trait",
@@ -6912,7 +6912,7 @@ dependencies = [
[[package]]
name = "screenpipe-core"
-version = "0.3.278"
+version = "0.3.279"
dependencies = [
"accessibility",
"accessibility-sys",
@@ -6958,7 +6958,7 @@ dependencies = [
[[package]]
name = "screenpipe-db"
-version = "0.3.278"
+version = "0.3.279"
dependencies = [
"anyhow",
"chrono",
@@ -6984,7 +6984,7 @@ dependencies = [
[[package]]
name = "screenpipe-engine"
-version = "0.3.278"
+version = "0.3.279"
dependencies = [
"anyhow",
"async-trait",
@@ -7055,7 +7055,7 @@ dependencies = [
[[package]]
name = "screenpipe-events"
-version = "0.3.278"
+version = "0.3.279"
dependencies = [
"anyhow",
"chrono",
@@ -7073,7 +7073,7 @@ dependencies = [
[[package]]
name = "screenpipe-screen"
-version = "0.3.278"
+version = "0.3.279"
dependencies = [
"accessibility-sys",
"anyhow",
@@ -7129,7 +7129,7 @@ dependencies = [
[[package]]
name = "screenpipe-vault"
-version = "0.3.278"
+version = "0.3.279"
dependencies = [
"argon2",
"chacha20poly1305",
diff --git a/apps/screenpipe-app-tauri/bun.lock b/apps/screenpipe-app-tauri/bun.lock
index 3eb74222f..f07ccc5ec 100644
--- a/apps/screenpipe-app-tauri/bun.lock
+++ b/apps/screenpipe-app-tauri/bun.lock
@@ -68,6 +68,7 @@
"react-markdown": "^9.1.0",
"react-resizable-panels": "^2.1.9",
"react-syntax-highlighter": "^15.6.6",
+ "rehype-raw": "^7.0.0",
"remark-gfm": "^4.0.1",
"remark-math": "^6.0.0",
"sonner": "^2.0.7",
@@ -1807,10 +1808,16 @@
"hasown": ["[email protected]", "", { "dependencies": { "function-bind": "^1.1.2" } }, ""],
+ "hast-util-from-parse5": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "devlop": "^1.0.0", "hastscript": "^9.0.0", "property-information": "^7.0.0", "vfile": "^6.0.0", "vfile-location": "^5.0.0", "web-namespaces": "^2.0.0" } }, "sha512-3kxEVkEKt0zvcZ3hCRYI8rqrgwtlIOFMWkbclACvjlDw8Li9S2hk/d51OI0nr/gIpdMHNepwgOKqZ/sy0Clpyg=="],
+
"hast-util-parse-selector": ["[email protected]", "", {}, ""],
+ "hast-util-raw": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "@ungap/structured-clone": "^1.0.0", "hast-util-from-parse5": "^8.0.0", "hast-util-to-parse5": "^8.0.0", "html-void-elements": "^3.0.0", "mdast-util-to-hast": "^13.0.0", "parse5": "^7.0.0", "unist-util-position": "^5.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0", "web-namespaces": "^2.0.0", "zwitch": "^2.0.0" } }, "sha512-Y8/SBAHkZGoNkpzqqfCldijcuUKh7/su31kEBp67cFY09Wy0mTRgtsLYsiIxMJxlu0f6AA5SUTbDR8K0rxnbUw=="],
+
"hast-util-to-jsx-runtime": ["[email protected]", "", { "dependencies": { "@types/estree": "^1.0.0", "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "comma-separated-tokens": "^2.0.0", "devlop": "^1.0.0", "estree-util-is-identifier-name": "^3.0.0", "hast-util-whitespace": "^3.0.0", "mdast-util-mdx-expression": "^2.0.0", "mdast-util-mdx-jsx": "^3.0.0", "mdast-util-mdxjs-esm": "^2.0.0", "property-information": "^6.0.0", "space-separated-tokens": "^2.0.0", "style-to-object": "^1.0.0", "unist-util-position": "^5.0.0", "vfile-message": "^4.0.0" } }, ""],
+ "hast-util-to-parse5": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "comma-separated-tokens": "^2.0.0", "devlop": "^1.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0", "web-namespaces": "^2.0.0", "zwitch": "^2.0.0" } }, "sha512-MlWT6Pjt4CG9lFCjiz4BH7l9wmrMkfkJYCxFwKQic8+RTZgWPuWxwAfjJElsXkex7DJjfSJsQIt931ilUgmwdA=="],
+
"hast-util-whitespace": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0" } }, ""],
"hastscript": ["[email protected]", "", { "dependencies": { "@types/hast": "^2.0.0", "comma-separated-tokens": "^1.0.0", "hast-util-parse-selector": "^2.0.0", "property-information": "^5.0.0", "space-separated-tokens": "^1.0.0" } }, ""],
@@ -1833,6 +1840,8 @@
"html-url-attributes": ["[email protected]", "", {}, ""],
+ "html-void-elements": ["[email protected]", "", {}, "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg=="],
+
"htmlfy": ["[email protected]", "", {}, "sha512-xWROBw9+MEGwxpotll0h672KCaLrKKiCYzsyN8ZgL9cQbVumFnyvsk2JqiB9ELAV1GLj1GG/jxZUjV9OZZi/yQ=="],
"htmlparser2": ["[email protected]", "", { "dependencies": { "domelementtype": "^2.3.0", "domhandler": "^5.0.3", "domutils": "^3.2.2", "entities": "^7.0.1" } }, "sha512-VTZkM9GWRAtEpveh7MSF6SjjrpNVNNVJfFup7xTY3UpFtm67foy9HDVXneLtFVt4pMz5kZtgNcvCniNFb1hlEQ=="],
@@ -2673,6 +2682,8 @@
"registry-url": ["[email protected]", "", { "dependencies": { "rc": "^1.2.8" } }, "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw=="],
+ "rehype-raw": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-raw": "^9.0.0", "vfile": "^6.0.0" } }, "sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww=="],
+
"remark-gfm": ["[email protected]", "", { "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-gfm": "^3.0.0", "micromark-extension-gfm": "^3.0.0", "remark-parse": "^11.0.0", "remark-stringify": "^11.0.0", "unified": "^11.0.0" } }, "sha512-1quofZ2RQ9EWdeN34S79+KExV1764+wCUGop5CPL1WGdD0ocPpu91lzPGbwWMECpEpd42kJGQwzRfyov9j4yNg=="],
"remark-math": ["[email protected]", "", { "dependencies": { "@types/mdast": "^4.0.0", "mdast-util-math": "^3.0.0", "micromark-extension-math": "^3.0.0", "unified": "^11.0.0" } }, ""],
@@ -3109,6 +3120,8 @@
"vfile": ["[email protected]", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-stringify-position": "^4.0.0", "vfile-message": "^4.0.0" } }, ""],
+ "vfile-location": ["[email protected]", "", { "dependencies": { "@types/unist": "^3.0.0", "vfile": "^6.0.0" } }, "sha512-5yXvWDEgqeiYiBe1lbxYF7UMAIm/IcopxMHrMQDq3nvKcjPKIhZklUKL+AE7J7uApI4kwe2snsK+eI6UTj9EHg=="],
+
"vfile-message": ["[email protected]", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-stringify-position": "^4.0.0" } }, ""],
"vite": ["[email protected]", "", { "dependencies": { "esbuild": "^0.21.3", "postcss": "^8.4.43", "rollup": "^4.20.0" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^18.0.0 || >=20.0.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.4.0" }, "optionalPeers": ["@types/node", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser"], "bin": { "vite": "bin/vite.js" } }, "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw=="],
@@ -3139,6 +3152,8 @@
"wdio-video-reporter": ["[email protected]", "", { "dependencies": { "@ffmpeg-installer/ffmpeg": "^1.1.0", "@wdio/allure-reporter": "^9.1.3", "@wdio/globals": "^9.2.6", "@wdio/logger": "^9.1.3", "@wdio/reporter": "^9.1.3", "@wdio/types": "^9.1.3", "glob": "^11.0.0" } }, "sha512-b/LHQFluxIcP7foWW0gJ/5W6x1NsTVzJ2yiZZ+W4ETtYBUFU0Xfd2fYVC3q3Uxb3He6QkuNT+h0xCefJSZRyVg=="],
+ "web-namespaces": ["[email protected]", "", {}, "sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ=="],
+
"web-streams-polyfill": ["[email protected]", "", {}, ""],
"web-vitals": ["[email protected]", "", {}, "sha512-ArI3kx5jI0atlTtmV0fWU3fjpLmq/nD3Zr1iFFlJLaqa5wLBkUSzINwBPySCX/8jRyjlmy1Volw1kz1g9XE4Jg=="],
@@ -3619,6 +3634,12 @@
"has-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA=="],
+ "hast-util-from-parse5/hastscript": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0", "comma-separated-tokens": "^2.0.0", "hast-util-parse-selector": "^4.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0" } }, "sha512-g7df9rMFX/SPi34tyGCyUBREQoKkapwdY/T04Qn9TDWfHhAYt4/I0gMVirzK5wEzeUqIjEB+LXC/ypb7Aqno5w=="],
+
+ "hast-util-from-parse5/property-information": ["[email protected]", "", {}, "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ=="],
+
+ "hast-util-to-parse5/property-information": ["[email protected]", "", {}, "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ=="],
+
"hastscript/@types/hast": ["@types/[email protected]", "", { "dependencies": { "@types/unist": "^2" } }, ""],
"hastscript/comma-separated-tokens": ["[email protected]", "", {}, ""],
@@ -4283,6 +4304,8 @@
"glob/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^1.0.0" } }, ""],
+ "hast-util-from-parse5/hastscript/hast-util-parse-selector": ["[email protected]", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A=="],
+
"hastscript/@types/hast/@types/unist": ["@types/[email protected]", "", {}, ""],
"http-proxy-agent/debug/ms": ["[email protected]", "", {}, ""],
diff --git a/apps/screenpipe-app-tauri/lib/utils/tauri.ts b/apps/screenpipe-app-tauri/lib/utils/tauri.ts
index 5cd69cec4..8261dea74 100644
--- a/apps/screenpipe-app-tauri/lib/utils/tauri.ts
+++ b/apps/screenpipe-app-tauri/lib/utils/tauri.ts
@@ -1348,7 +1348,11 @@ scheduleEnabled?: boolean;
/**
* Per-day schedule rules (only used when schedule_enabled is true)
*/
-scheduleRules?: ScheduleRule[] }) &
+scheduleRules?: ScheduleRule[];
+/**
+ * Require authentication for remote (non-localhost) API access.
+ */
+apiAuth?: boolean }) &
/**
* Catch-all for fields added by the frontend (e.g. chatHistory)
* that the Rust struct doesn't know about. Without this, `save()` would
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index 656ca77d9..faf8f89ff 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -9727,7 +9727,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "2.3.64"
+version = "2.3.69"
dependencies = [
"anyhow",
"arboard",
@@ -9773,6 +9773,7 @@ dependencies = [
"screenpipe-engine",
"screenpipe-events",
"screenpipe-screen",
+ "screenpipe-secrets",
"screenpipe-vault",
"sentry 0.42.0",
"serde",
@@ -9830,7 +9831,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio"
-version = "0.3.278"
+version = "0.3.279"
dependencies = [
"anyhow",
"audiopipe",
@@ -9885,7 +9886,7 @@ dependencies = [
[[package]]
name = "screenpipe-config"
-version = "0.3.278"
+version = "0.3.279"
dependencies = [
"dirs 6.0.0",
"serde",
@@ -9897,7 +9898,7 @@ dependencies = [
[[package]]
name = "screenpipe-connect"
-version = "0.3.278"
+version = "0.3.279"
dependencies = [
"anyhow",
"async-trait",
@@ -9925,7 +9926,7 @@ dependencies = [
[[package]]
name = "screenpipe-core"
-version = "0.3.278"
+version = "0.3.279"
dependencies = [
"accessibility",
"accessibility-sys",
@@ -9971,7 +9972,7 @@ dependencies = [
[[package]]
name = "screenpipe-db"
-version = "0.3.278"
+version = "0.3.279"
dependencies = [
"anyhow",
"chrono",
@@ -9996,7 +9997,7 @@ dependencies = [
[[package]]
name = "screenpipe-engine"
-version = "0.3.278"
+version = "0.3.279"
dependencies = [
"anyhow",
"async-trait",
@@ -10036,6 +10037,7 @@ dependencies = [
"screenpipe-db",
"screenpipe-events",
"screenpipe-screen",
+ "screenpipe-secrets",
"screenpipe-vault",
"sentry 0.36.0",
"serde",
@@ -10059,7 +10061,7 @@ dependencies = [
[[package]]
name = "screenpipe-events"
-version = "0.3.278"
+version = "0.3.279"
dependencies = [
"anyhow",
"chrono",
@@ -10075,7 +10077,7 @@ dependencies = [
[[package]]
name = "screenpipe-screen"
-version = "0.3.278"
+version = "0.3.279"
dependencies = [
"accessibility-sys",
"anyhow",
@@ -10109,9 +10111,24 @@ dependencies = [
"zbus",
]
+[[package]]
+name = "screenpipe-secrets"
+version = "0.1.0"
+dependencies = [
+ "anyhow",
+ "base64 0.22.1",
+ "chacha20poly1305",
+ "rand 0.8.5",
+ "serde",
+ "serde_json",
+ "sqlx",
+ "tokio",
+ "tracing",
+]
+
[[package]]
name = "screenpipe-vault"
-version = "0.3.278"
+version = "0.3.279"
dependencies = [
"argon2",
"chacha20poly1305",
diff --git a/crates/screenpipe-audio/src/core/device_detection.rs b/crates/screenpipe-audio/src/core/device_detection.rs
index e8eb9dfb6..602afb825 100644
--- a/crates/screenpipe-audio/src/core/device_detection.rs
+++ b/crates/screenpipe-audio/src/core/device_detection.rs
@@ -45,13 +45,13 @@ impl InputDeviceKind {
// Tier 2 — major brand Bluetooth headsets (95 % accuracy)
let tier2 = [
"bluetooth",
- "wh-1000x", // Sony WH-1000XM series
- "wf-1000x", // Sony WF in-ear
+ "wh-1000x", // Sony WH-1000XM series
+ "wf-1000x", // Sony WF in-ear
"wl-1000x",
"quietcomfort", // Bose QC
"bose 700",
"bose nc",
- "freebuds", // Huawei
+ "freebuds", // Huawei
"galaxy buds",
"surface headphones",
"beats studio",
@@ -62,7 +62,7 @@ impl InputDeviceKind {
"plantronics",
"poly",
"sennheiser",
- "momentum", // Sennheiser Momentum BT
+ "momentum", // Sennheiser Momentum BT
"jbl tune",
"jbl live",
"anker",
@@ -75,7 +75,15 @@ impl InputDeviceKind {
}
// Tier 3 — generic Bluetooth markers (85 % accuracy)
- let tier3 = [" bt ", " bt\t", "(bt)", "bt-", "-bt-", "wireless mic", "wireless headset"];
+ let tier3 = [
+ " bt ",
+ " bt\t",
+ "(bt)",
+ "bt-",
+ "-bt-",
+ "wireless mic",
+ "wireless headset",
+ ];
if tier3.iter().any(|p| lower.contains(p)) {
return InputDeviceKind::Bluetooth;
}
@@ -87,7 +95,15 @@ impl InputDeviceKind {
}
// Built-in / internal: definitely wired
- let wired = ["built-in", "internal", "macbook", "imac", "hdmi", "displayport", "usb"];
+ let wired = [
+ "built-in",
+ "internal",
+ "macbook",
+ "imac",
+ "hdmi",
+ "displayport",
+ "usb",
+ ];
if wired.iter().any(|p| lower.contains(p)) {
return InputDeviceKind::Wired;
}
@@ -108,18 +124,9 @@ impl InputDeviceKind {
/// - Wired USB/built-in: < 20 ms latency, negligible jitter
pub fn buffer_timeout(&self) -> (Duration, Duration) {
match self {
- InputDeviceKind::Wired => (
- Duration::from_millis(20),
- Duration::from_millis(50),
- ),
- InputDeviceKind::Bluetooth => (
- Duration::from_millis(80),
- Duration::from_millis(200),
- ),
- InputDeviceKind::Unknown => (
- Duration::from_millis(80),
- Duration::from_millis(180),
- ),
+ InputDeviceKind::Wired => (Duration::from_millis(20), Duration::from_millis(50)),
+ InputDeviceKind::Bluetooth => (Duration::from_millis(80), Duration::from_millis(200)),
+ InputDeviceKind::Unknown => (Duration::from_millis(80), Duration::from_millis(180)),
}
}
@@ -142,33 +149,66 @@ mod tests {
#[test]
fn detects_airpods() {
- assert_eq!(InputDeviceKind::detect("AirPods Pro"), InputDeviceKind::Bluetooth);
- assert_eq!(InputDeviceKind::detect("Ansh's AirPods Max"), InputDeviceKind::Bluetooth);
- assert_eq!(InputDeviceKind::detect("AirPods (3rd generation)"), InputDeviceKind::Bluetooth);
+ assert_eq!(
+ InputDeviceKind::detect("AirPods Pro"),
+ InputDeviceKind::Bluetooth
+ );
+ assert_eq!(
+ InputDeviceKind::detect("Ansh's AirPods Max"),
+ InputDeviceKind::Bluetooth
+ );
+ assert_eq!(
+ InputDeviceKind::detect("AirPods (3rd generation)"),
+ InputDeviceKind::Bluetooth
+ );
}
#[test]
fn detects_sony_wh() {
- assert_eq!(InputDeviceKind::detect("WH-1000XM5"), InputDeviceKind::Bluetooth);
- assert_eq!(InputDeviceKind::detect("Sony WH-1000XM4"), InputDeviceKind::Bluetooth);
+ assert_eq!(
+ InputDeviceKind::detect("WH-1000XM5"),
+ InputDeviceKind::Bluetooth
+ );
+ assert_eq!(
+ InputDeviceKind::detect("Sony WH-1000XM4"),
+ InputDeviceKind::Bluetooth
+ );
}
#[test]
fn detects_jabra() {
- assert_eq!(InputDeviceKind::detect("Jabra Evolve2 65"), InputDeviceKind::Bluetooth);
+ assert_eq!(
+ InputDeviceKind::detect("Jabra Evolve2 65"),
+ InputDeviceKind::Bluetooth
+ );
}
#[test]
fn detects_virtual_as_wired() {
- assert_eq!(InputDeviceKind::detect("BlackHole 2ch"), InputDeviceKind::Wired);
- assert_eq!(InputDeviceKind::detect("VB-Audio Virtual Cable"), InputDeviceKind::Wired);
- assert_eq!(InputDeviceKind::detect("Loopback Audio"), InputDeviceKind::Wired);
+ assert_eq!(
+ InputDeviceKind::detect("BlackHole 2ch"),
+ InputDeviceKind::Wired
+ );
+ assert_eq!(
+ InputDeviceKind::detect("VB-Audio Virtual Cable"),
+ InputDeviceKind::Wired
+ );
+ assert_eq!(
+ InputDeviceKind::detect("Loopback Audio"),
+ InputDeviceKind::Wired
+ );
}
#[test]
fn detects_builtin_as_wired() {
- assert_eq!(InputDeviceKind::detect("MacBook Pro Microphone"), InputDeviceKind::Wired);
- assert_eq!(InputDeviceKind::detect("Built-in Microphone"), InputDeviceKind::Wired);
+ assert_eq!(
+ InputDeviceKind::detect("MacBook Pro Microphone"),
+ InputDeviceKind::Wired
+ );
+ assert_eq!(
+ InputDeviceKind::detect("Built-in Microphone"),
+ InputDeviceKind::Wired
+ );
}
#[test]
diff --git a/crates/screenpipe-audio/src/core/e2e_ghost_word_silent_room.rs b/crates/screenpipe-audio/src/core/e2e_ghost_word_silent_room.rs
index 747ef3e00..6ec71d4d5 100644
--- a/crates/screenpipe-audio/src/core/e2e_ghost_word_silent_room.rs
+++ b/crates/screenpipe-audio/src/core/e2e_ghost_word_silent_room.rs
@@ -22,10 +22,7 @@ use crate::{
stream::AudioStream,
},
metrics::AudioPipelineMetrics,
- transcription::{
- engine::TranscriptionEngine,
- whisper::model::get_cached_whisper_model_path,
- },
+ transcription::{engine::TranscriptionEngine, whisper::model::get_cached_whisper_model_path},
AudioInput,
};
use screenpipe_core::Language;
@@ -109,8 +106,8 @@ async fn silent_room_no_ghost_words() {
});
let chunk_samples = 320_usize;
- let total_chunks = ((segment_secs as f64 * 1.5 * sample_rate as f64) / chunk_samples as f64)
- .ceil() as usize;
+ let total_chunks =
+ ((segment_secs as f64 * 1.5 * sample_rate as f64) / chunk_samples as f64).ceil() as usize;
tokio::time::sleep(Duration::from_millis(150)).await;
@@ -132,15 +129,10 @@ async fn silent_room_no_ghost_words() {
let _ = tokio::time::timeout(Duration::from_secs(15), pipeline_handle).await;
- let transcription_engine = TranscriptionEngine::new(
- engine_config,
- None,
- None,
- vec![Language::English],
- vec![],
- )
- .await
- .expect("failed to load Whisper tiny");
+ let transcription_engine =
+ TranscriptionEngine::new(engine_config, None, None, vec![Language::English], vec![])
+ .await
+ .expect("failed to load Whisper tiny");
let mut session = transcription_engine
.create_session()
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 87196c0d9..afd5b6eb3 100644
--- a/crates/screenpipe-audio/src/core/run_record_and_transcribe.rs
+++ b/crates/screenpipe-audio/src/core/run_record_and_transcribe.rs
@@ -52,8 +52,7 @@ pub async fn run_record_and_transcribe(
// Per-device source buffer: detects Bluetooth packet-drop gaps and inserts
// digital silence in place of crackle/noise. Silence is filtered by VAD before
// reaching Whisper, so it has no transcription impact.
- let mut source_buffer =
- SourceBuffer::new(device_name.as_str(), sample_rate as u32);
+ let mut source_buffer = SourceBuffer::new(device_name.as_str(), sample_rate as u32);
info!(
"starting continuous recording for {} ({} / {}s segments)",
diff --git a/crates/screenpipe-audio/src/core/source_buffer.rs b/crates/screenpipe-audio/src/core/source_buffer.rs
index 9b9d51d0f..d8513c5af 100644
--- a/crates/screenpipe-audio/src/core/source_buffer.rs
+++ b/crates/screenpipe-audio/src/core/source_buffer.rs
@@ -68,11 +68,7 @@ impl SourceBuffer {
pub fn new(device_name: impl Into<String>, sample_rate: u32) -> Self {
let name = device_name.into();
let kind = InputDeviceKind::detect(&name);
- debug!(
- "SourceBuffer created for '{}' ({})",
- name,
- kind.label()
- );
+ debug!("SourceBuffer created for '{}' ({})", name, kind.label());
Self {
device_name: name,
device_kind: kind,
@@ -97,8 +93,7 @@ impl SourceBuffer {
}
let now = Instant::now();
- let chunk_duration_ms =
- (samples.len() as f64 / self.sample_rate as f64) * 1000.0;
+ let chunk_duration_ms = (samples.len() as f64 / self.sample_rate as f64) * 1000.0;
// Update expected chunk duration using a simple exponential moving average.
// This adapts if CPAL changes its callback chunk size mid-stream.
@@ -165,8 +160,7 @@ impl SourceBuffer {
if self.chunks_received == 0 {
return;
}
- let silence_ms =
- (self.silence_inserted_samples as f64 / self.sample_rate as f64) * 1000.0;
+ let silence_ms = (self.silence_inserted_samples as f64 / self.sample_rate as f64) * 1000.0;
debug!(
"[{}] source-buffer stats: {} chunks, {} gaps, {:.0}ms silence inserted",
self.device_name, self.chunks_received, self.gaps_detected, silence_ms
@@ -271,14 +265,16 @@ mod tests {
buf.drain_all(); // consume, establish expected_chunk_duration
// Simulate a 100ms wall-clock gap — Bluetooth packet drop
- buf.last_chunk_time =
- Some(Instant::now() - std::time::Duration::from_millis(100));
+ buf.last_chunk_time = Some(Instant::now() - std::time::Duration::from_millis(100));
// Next real chunk arrives
buf.push(real_chunk.clone());
let out = buf.drain_all();
- assert!(buf.gaps_detected > 0, "gap must be detected for this test to be valid");
+ assert!(
+ buf.gaps_detected > 0,
+ "gap must be detected for this test to be valid"
+ );
let n_silence = buf.silence_inserted_samples as usize;
assert!(n_silence > 0, "silence must have been inserted");
@@ -320,8 +316,7 @@ mod tests {
// 150ms gap — at 16kHz, that's 2400 samples of missing audio
let gap_ms = 150_u64;
- buf.last_chunk_time =
- Some(Instant::now() - std::time::Duration::from_millis(gap_ms));
+ buf.last_chunk_time = Some(Instant::now() - std::time::Duration::from_millis(gap_ms));
buf.push(vec![0.1_f32; 320]);
buf.drain_all();
diff --git a/crates/screenpipe-audio/src/core/stream.rs b/crates/screenpipe-audio/src/core/stream.rs
index 57389c105..0137b6aca 100644
--- a/crates/screenpipe-audio/src/core/stream.rs
+++ b/crates/screenpipe-audio/src/core/stream.rs
@@ -239,7 +239,7 @@ impl AudioStream {
};
(stream, tx_arc)
}
-} // end impl AudioStream
+} // end impl AudioStream
#[cfg(not(all(target_os = "linux", feature = "pulseaudio")))]
fn create_error_callback(
diff --git a/crates/screenpipe-audio/tests/bluetooth_gap_hallucination_test.rs b/crates/screenpipe-audio/tests/bluetooth_gap_hallucination_test.rs
index b65b2c1f2..b160df9d5 100644
--- a/crates/screenpipe-audio/tests/bluetooth_gap_hallucination_test.rs
+++ b/crates/screenpipe-audio/tests/bluetooth_gap_hallucination_test.rs
@@ -18,7 +18,9 @@ fn crackle(n_samples: usize, amplitude: f32) -> Vec<f32> {
let mut state: u64 = 0xdeadbeef_cafebabe;
(0..n_samples)
.map(|_| {
- state = state.wrapping_mul(6364136223846793005).wrapping_add(1442695040888963407);
+ state = state
+ .wrapping_mul(6364136223846793005)
+ .wrapping_add(1442695040888963407);
let norm = ((state >> 33) as f32 / u32::MAX as f32) * 2.0 - 1.0;
norm * amplitude
})
@@ -47,15 +49,22 @@ fn rms_gate_routes_silence_vs_crackle() {
let silence_audio = silence(n);
let silence_rms = rms(&silence_audio);
- println!("crackle RMS: {:.6} (threshold: {:.6})", crackle_rms, MIN_RMS_ENERGY);
- println!("silence RMS: {:.6} (threshold: {:.6})", silence_rms, MIN_RMS_ENERGY);
+ println!(
+ "crackle RMS: {:.6} (threshold: {:.6})",
+ crackle_rms, MIN_RMS_ENERGY
+ );
+ println!(
+ "silence RMS: {:.6} (threshold: {:.6})",
+ silence_rms, MIN_RMS_ENERGY
+ );
// Crackle must exceed the RMS gate → it goes to Whisper → hallucination possible
assert!(
crackle_rms > MIN_RMS_ENERGY,
"crackle RMS {:.6} should exceed MIN_RMS_ENERGY {:.6} — \
crackle must reach Whisper for the test to be meaningful",
- crackle_rms, MIN_RMS_ENERGY
+ crackle_rms,
+ MIN_RMS_ENERGY
);
// Silence must fall below the RMS gate → it is blocked before Whisper → no hallucination
@@ -63,7 +72,8 @@ fn rms_gate_routes_silence_vs_crackle() {
silence_rms < MIN_RMS_ENERGY,
"silence RMS {:.6} must be below MIN_RMS_ENERGY {:.6} — \
silence must be filtered before reaching Whisper",
- silence_rms, MIN_RMS_ENERGY
+ silence_rms,
+ MIN_RMS_ENERGY
);
// The ratio shows how much headroom the gate has
@@ -77,7 +87,9 @@ fn rms_gate_routes_silence_vs_crackle() {
#[tokio::test]
#[ignore = "Silero VAD model cached on first run"]
async fn silero_rejects_silence() {
- let mut vad = SileroVad::new().await.expect("failed to load Silero VAD model");
+ let mut vad = SileroVad::new()
+ .await
+ .expect("failed to load Silero VAD model");
// 1 second chunks — long enough for Silero to build up frame history
let n = SAMPLE_RATE as usize;
@@ -108,7 +120,11 @@ async fn silero_rejects_silence() {
// and that crackle is *caught* by the RMS gate in process_with_whisper (Test 1).
println!(
"Silero on crackle: {} — Silero may reject it too, but RMS gate is the primary defence",
- if crackle_is_speech { "classified as speech (reaches Whisper)" } else { "rejected (good extra filter)" }
+ if crackle_is_speech {
+ "classified as speech (reaches Whisper)"
+ } else {
+ "rejected (good extra filter)"
+ }
);
}
@@ -116,8 +132,8 @@ async fn silero_rejects_silence() {
#[ignore = "Whisper tiny cached"]
async fn whisper_hallucination_before_after() {
use screenpipe_audio::core::engine::AudioTranscriptionEngine;
- use screenpipe_audio::transcription::whisper::model::get_cached_whisper_model_path;
use screenpipe_audio::transcription::whisper::model::create_whisper_context_parameters;
+ use screenpipe_audio::transcription::whisper::model::get_cached_whisper_model_path;
use screenpipe_core::Language;
use std::sync::Arc;
use whisper_rs::WhisperContext;
diff --git a/crates/screenpipe-engine/src/power/monitor.rs b/crates/screenpipe-engine/src/power/monitor.rs
index 17d5271d6..71eb6c4a3 100644
--- a/crates/screenpipe-engine/src/power/monitor.rs
+++ b/crates/screenpipe-engine/src/power/monitor.rs
@@ -16,9 +16,9 @@
use serde::{Deserialize, Serialize};
use std::time::Duration;
+use tracing::debug;
#[cfg(target_os = "macos")]
use tracing::warn;
-use tracing::debug;
/// Thermal pressure level reported by the OS.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
diff --git a/crates/screenpipe-secrets/src/migration.rs b/crates/screenpipe-secrets/src/migration.rs
index 525102806..821deee97 100644
--- a/crates/screenpipe-secrets/src/migration.rs
+++ b/crates/screenpipe-secrets/src/migration.rs
@@ -207,10 +207,13 @@ pub fn fix_secret_file_permissions(screenpipe_dir: &Path) -> usize {
}
}
- // Walk whatsapp-session/ directory recursively
+ // Walk whatsapp-session/ directory recursively — but only once.
+ // This can be 7000+ files; skip if already done (marker file).
let whatsapp_dir = screenpipe_dir.join("whatsapp-session");
- if whatsapp_dir.is_dir() {
+ let whatsapp_marker = screenpipe_dir.join(".whatsapp-perms-fixed");
+ if whatsapp_dir.is_dir() && !whatsapp_marker.exists() {
count += fix_permissions_recursive(&whatsapp_dir);
+ let _ = std::fs::write(&whatsapp_marker, b"");
}
count