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

style: cargo fmt tauri workspace (enterprise_policy, capture_session, pi, tray, +10 more)

Louis Beaumont6bc6ea2b3961
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/audio_exclusions.rs b/apps/screenpipe-app-tauri/src-tauri/src/audio_exclusions.rs
index 016134b8c..4e6feaaea 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/audio_exclusions.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/audio_exclusions.rs
@@ -49,14 +49,8 @@ fn exclusions_path() -> PathBuf {
fn parse_excluded_app(entry: &serde_json::Value) -> Option<ExcludedApp> {
let bundle_id = entry.get("bundle_id")?.as_str()?.to_string();
- let name = entry
- .get("name")
- .and_then(|v| v.as_str())
- .map(String::from);
- let icon = entry
- .get("icon")
- .and_then(|v| v.as_str())
- .map(String::from);
+ let name = entry.get("name").and_then(|v| v.as_str()).map(String::from);
+ let icon = entry.get("icon").and_then(|v| v.as_str()).map(String::from);
Some(ExcludedApp {
bundle_id,
name,
@@ -102,8 +96,7 @@ pub fn read_audio_exclusions() -> Result<Vec<ExcludedApp>, String> {
pub async fn write_audio_exclusions(apps: Vec<ExcludedApp>) -> Result<(), String> {
let path = exclusions_path();
if let Some(parent) = path.parent() {
- std::fs::create_dir_all(parent)
- .map_err(|e| format!("mkdir {}: {e}", parent.display()))?;
+ std::fs::create_dir_all(parent).map_err(|e| format!("mkdir {}: {e}", parent.display()))?;
}
let excluded_apps: Vec<serde_json::Value> = apps
.iter()
@@ -129,20 +122,14 @@ pub async fn write_audio_exclusions(apps: Vec<ExcludedApp>) -> Result<(), String
let tmp = path.with_extension("json.tmp");
{
- let mut file =
- File::create(&tmp).map_err(|e| format!("write {}: {e}", tmp.display()))?;
+ let mut file = File::create(&tmp).map_err(|e| format!("write {}: {e}", tmp.display()))?;
file.write_all(body.as_bytes())
.map_err(|e| format!("write {}: {e}", tmp.display()))?;
file.sync_all()
.map_err(|e| format!("fsync {}: {e}", tmp.display()))?;
}
- std::fs::rename(&tmp, &path).map_err(|e| {
- format!(
- "rename {} -> {}: {e}",
- tmp.display(),
- path.display()
- )
- })?;
+ std::fs::rename(&tmp, &path)
+ .map_err(|e| format!("rename {} -> {}: {e}", tmp.display(), path.display()))?;
Ok(())
}
@@ -212,8 +199,8 @@ fn icon_data_url_for_app(app_path: &str) -> Option<String> {
fn read_app_bundle_metadata_impl(path: &str) -> Result<ExcludedApp, String> {
let app_path = PathBuf::from(path);
let plist_path = app_path.join("Contents/Info.plist");
- let plist: plist::Value = plist::from_file(&plist_path)
- .map_err(|e| format!("read {}: {e}", plist_path.display()))?;
+ let plist: plist::Value =
+ plist::from_file(&plist_path).map_err(|e| format!("read {}: {e}", plist_path.display()))?;
let bundle_id = plist
.as_dictionary()
@@ -265,9 +252,12 @@ mod tests {
#[test]
#[serial_test::serial]
fn read_returns_empty_when_missing() {
- with_env("/nonexistent/screenpipe-audio-exclusion-cmd-test.json", || {
- assert_eq!(read_audio_exclusions().unwrap(), Vec::<ExcludedApp>::new());
- });
+ with_env(
+ "/nonexistent/screenpipe-audio-exclusion-cmd-test.json",
+ || {
+ assert_eq!(read_audio_exclusions().unwrap(), Vec::<ExcludedApp>::new());
+ },
+ );
}
#[test]
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/capture_session.rs b/apps/screenpipe-app-tauri/src-tauri/src/capture_session.rs
index a6649a4db..95a73e4b9 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/capture_session.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/capture_session.rs
@@ -327,11 +327,8 @@ async fn reconfigure_audio_manager(
let audio_devices = if config.disable_audio {
Vec::new()
} else {
- resolve_audio_devices_for_capture(
- &config.audio_devices,
- config.use_system_default_audio,
- )
- .await
+ resolve_audio_devices_for_capture(&config.audio_devices, config.use_system_default_audio)
+ .await
};
let mut audio_manager_builder = config
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/engine_events/power.rs b/apps/screenpipe-app-tauri/src-tauri/src/engine_events/power.rs
index 561f9f9c0..e91eef899 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/engine_events/power.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/engine_events/power.rs
@@ -77,8 +77,7 @@ pub(super) fn handle(_app: &AppHandle, _name: &str, data: &Value) {
),
("FullPause", Some("os_low_power")) => (
"low power mode on — capture paused",
- "macos low power mode is on. plug in or turn off low power mode to resume."
- .to_string(),
+ "macos low power mode is on. plug in or turn off low power mode to resume.".to_string(),
),
("FullPause", _) => (
"battery critical — capture paused",
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/enterprise_sync.rs b/apps/screenpipe-app-tauri/src-tauri/src/enterprise_sync.rs
index 6a409c563..e0f97e48b 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/enterprise_sync.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/enterprise_sync.rs
@@ -496,10 +496,8 @@ mod imp {
// recording server hasn't finished booting and the key is
// usually `None`. ScreenpipeLocalClient re-reads it from
// RecordingState on every request via the app handle.
- let local: Arc<dyn LocalApiClient> = Arc::new(ScreenpipeLocalClient::new(
- api_url_base,
- app.clone(),
- ));
+ let local: Arc<dyn LocalApiClient> =
+ Arc::new(ScreenpipeLocalClient::new(api_url_base, app.clone()));
let (tx, rx) = tokio::sync::watch::channel(false);
tauri::async_runtime::spawn(async move {
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/google_calendar.rs b/apps/screenpipe-app-tauri/src-tauri/src/google_calendar.rs
index ce842fcdd..dce204ffc 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/google_calendar.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/google_calendar.rs
@@ -136,9 +136,7 @@ fn into_calendar_event_item(event: GoogleCalendarEventDto) -> CalendarEventItem
attendees: event.attendees,
location: event.location,
meeting_url: event.meeting_url,
- calendar_name: event
- .calendar_name
- .unwrap_or_else(|| "primary".to_string()),
+ calendar_name: event.calendar_name.unwrap_or_else(|| "primary".to_string()),
is_all_day: event.is_all_day,
source: "google".to_string(),
}
@@ -146,10 +144,18 @@ fn into_calendar_event_item(event: GoogleCalendarEventDto) -> CalendarEventItem
fn format_display(start: &str, end: &str) -> (String, String) {
let s = chrono::DateTime::parse_from_rfc3339(start)
- .map(|dt| dt.with_timezone(&chrono::Local).format("%-I:%M %p").to_string())
+ .map(|dt| {
+ dt.with_timezone(&chrono::Local)
+ .format("%-I:%M %p")
+ .to_string()
+ })
.unwrap_or_default();
let e = chrono::DateTime::parse_from_rfc3339(end)
- .map(|dt| dt.with_timezone(&chrono::Local).format("%-I:%M %p").to_string())
+ .map(|dt| {
+ dt.with_timezone(&chrono::Local)
+ .format("%-I:%M %p")
+ .to_string()
+ })
.unwrap_or_default();
(s, e)
}
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/health.rs b/apps/screenpipe-app-tauri/src-tauri/src/health.rs
index 121b90086..1b436ceff 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/health.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/health.rs
@@ -221,9 +221,7 @@ pub fn get_high_fps_status() -> HighFpsCacheEntry {
}
pub fn set_high_fps_status(entry: HighFpsCacheEntry) {
- let mut guard = HIGH_FPS_STATUS
- .write()
- .unwrap_or_else(|e| e.into_inner());
+ let mut guard = HIGH_FPS_STATUS.write().unwrap_or_else(|e| e.into_inner());
*guard = entry;
}
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/oauth.rs b/apps/screenpipe-app-tauri/src-tauri/src/oauth.rs
index 86d8670c9..db1362a7d 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/oauth.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/oauth.rs
@@ -467,12 +467,8 @@ pub async fn oauth_status(
// not a user-initiated disconnect. Surface that distinction so the UI can
// show "needs attention" instead of pushing the user to reconnect blindly.
let needs_attention = !connected
- && oauth::oauth_instance_token_exists(
- store.as_ref(),
- &integration_id,
- instance.as_deref(),
- )
- .await;
+ && oauth::oauth_instance_token_exists(store.as_ref(), &integration_id, instance.as_deref())
+ .await;
Ok(OAuthStatus {
connected,
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/owned_browser.rs b/apps/screenpipe-app-tauri/src-tauri/src/owned_browser.rs
index 33a176002..aba0f099d 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/owned_browser.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/owned_browser.rs
@@ -793,8 +793,7 @@ fn normalize_url(raw: &str) -> Result<url::Url, String> {
"view-source:",
"chrome:",
];
- let has_scheme =
- raw.contains("://") || HOSTLESS_SCHEMES.iter().any(|s| raw.starts_with(s));
+ let has_scheme = raw.contains("://") || HOSTLESS_SCHEMES.iter().any(|s| raw.starts_with(s));
let candidate = if has_scheme {
raw.to_owned()
} else if raw.starts_with("//") {
@@ -921,7 +920,8 @@ async fn inject_cookies_for_url(app: &AppHandle, url: &url::Url) {
if cookies.is_empty() {
#[cfg(target_os = "windows")]
{
- if let Some(block) = crate::owned_browser_cookies::v20_cookie_block_for_host(host).await {
+ if let Some(block) = crate::owned_browser_cookies::v20_cookie_block_for_host(host).await
+ {
// App-bound encrypted (v20) cookies — try extension first.
match extension_cookies_for_host(app, host).await {
Ok(extension_cookies) if !extension_cookies.is_empty() => {
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs b/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
index 6fdc303f7..e99a0c236 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
@@ -561,8 +561,7 @@ fn seed_pi_package_json(install_dir: &std::path::Path) {
}
removed_legacy = legacy_keys.len();
if deps_obj.get("@anthropic-ai/sdk") != Some(&expected_sdk) {
- deps_obj
- .insert("@anthropic-ai/sdk".to_string(), expected_sdk.clone());
+ deps_obj.insert("@anthropic-ai/sdk".to_string(), expected_sdk.clone());
changed = true;
}
if deps_obj.get("@earendil-works/pi-coding-agent")
@@ -574,9 +573,7 @@ fn seed_pi_package_json(install_dir: &std::path::Path) {
);
changed = true;
}
- if deps_obj.get("@earendil-works/pi-ai")
- != Some(&expected_pi_ai_version)
- {
+ if deps_obj.get("@earendil-works/pi-ai") != Some(&expected_pi_ai_version) {
deps_obj.insert(
"@earendil-works/pi-ai".to_string(),
expected_pi_ai_version.clone(),
@@ -2562,10 +2559,7 @@ pub fn ensure_pi_installed_background() {
}
Err(e) => {
error!("Pi upgrade/fix: bun error: {}", e);
- set_pi_install_error(format!(
- "could not spawn bun: {}",
- e
- ));
+ set_pi_install_error(format!("could not spawn bun: {}", e));
}
}
PI_INSTALL_DONE.store(true, Ordering::SeqCst);
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/pi_command_queue.rs b/apps/screenpipe-app-tauri/src-tauri/src/pi_command_queue.rs
index dd4fa7683..555bac074 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/pi_command_queue.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/pi_command_queue.rs
@@ -789,9 +789,7 @@ mod tests {
// Queue two commands
let h1 = {
let h = handle.clone();
- tokio::spawn(
- async move { h.send(json!({"type": "prompt"}), WaitMode::Prompt).await },
- )
+ tokio::spawn(async move { h.send(json!({"type": "prompt"}), WaitMode::Prompt).await })
};
let h2 = {
let h = handle.clone();
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/recording.rs b/apps/screenpipe-app-tauri/src-tauri/src/recording.rs
index f3eddc12d..3d011d219 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/recording.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/recording.rs
@@ -296,7 +296,12 @@ async fn remember_active_meeting_for_capture_restart(state: &RecordingState) {
let manual_id = *server.manual_meeting.read().await;
let meeting = match manual_id {
Some(id) => server.db.get_active_meeting_by_id(id).await.ok().flatten(),
- None => server.db.get_most_recent_active_meeting().await.ok().flatten(),
+ None => server
+ .db
+ .get_most_recent_active_meeting()
+ .await
+ .ok()
+ .flatten(),
};
let Some(meeting) = meeting else {
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/server_core.rs b/apps/screenpipe-app-tauri/src-tauri/src/server_core.rs
index 3d3a41936..6356a6ff7 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/server_core.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/server_core.rs
@@ -403,11 +403,7 @@ impl ServerCore {
let memory_sync = Arc::new(
screenpipe_engine::external_memory_sync::ExternalMemorySyncScheduler::new(),
);
- memory_sync.start(
- db.clone(),
- Some(store_arc.clone()),
- local_data_dir.clone(),
- );
+ memory_sync.start(db.clone(), Some(store_arc.clone()), local_data_dir.clone());
server.external_memory_sync = Some(memory_sync);
server.secret_store = Some(store_arc);
@@ -630,10 +626,7 @@ impl ServerCore {
// authenticates redactor requests. Without this the worker logs
// "no api key — requests will be un-authenticated" on every
// restart even when the user is signed in.
- let tinfoil_api_key = config
- .user_id
- .clone()
- .filter(|s| !s.is_empty());
+ let tinfoil_api_key = config.user_id.clone().filter(|s| !s.is_empty());
// One shutdown signal, shared across both worker spawn paths and
// stored on Self for `shutdown()` to fire on app quit.
@@ -706,8 +699,7 @@ impl ServerCore {
"fetching v45 phase 3 ONNX text redactor (~278 MB INT8 on first run, \
cached at ~/.screenpipe/models/v45_phase3_onnx/)"
);
- let onnx_result =
- OnnxRedactor::load_or_download(OnnxConfig::default()).await;
+ let onnx_result = OnnxRedactor::load_or_download(OnnxConfig::default()).await;
let pipeline = match onnx_result {
Ok(adapter) => {
info!(
@@ -780,12 +772,11 @@ impl ServerCore {
has_api_key = tinfoil_api_key.is_some(),
"starting async image-PII worker (backend=tinfoil)"
);
- let detector =
- Arc::new(TinfoilImageRedactor::new(TinfoilImageConfig {
- api_key: tinfoil_api_key.clone(),
- labels: pii_labels.clone(),
- ..Default::default()
- })) as Arc<dyn ImageRedactor>;
+ let detector = Arc::new(TinfoilImageRedactor::new(TinfoilImageConfig {
+ api_key: tinfoil_api_key.clone(),
+ labels: pii_labels.clone(),
+ ..Default::default()
+ })) as Arc<dyn ImageRedactor>;
let _ = ImageWorker::new(
pool,
detector,
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/suggestions.rs b/apps/screenpipe-app-tauri/src-tauri/src/suggestions.rs
index fb948ed8e..e62696430 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/suggestions.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/suggestions.rs
@@ -623,9 +623,7 @@ fn browsing_suggestions(apps: &[AppActivity], windows: &[WindowActivity]) -> Vec
let top_pages: Vec<String> = browser_windows
.iter()
.take(3)
- .map(|w| {
- truncate_string(&w.window_name, 35)
- })
+ .map(|w| truncate_string(&w.window_name, 35))
.collect();
let mut suggestions = vec![Suggestion {
@@ -689,9 +687,7 @@ fn meeting_suggestions(apps: &[AppActivity], windows: &[WindowActivity]) -> Vec<
.find(|w| {
MEETING_APPS.iter().any(|m| *m == w.app_name.to_lowercase()) && w.window_name.len() > 3
})
- .map(|w| {
- truncate_string(&w.window_name, 40)
- });
+ .map(|w| truncate_string(&w.window_name, 40));
let preview = if meeting_mins > 0 {
if let Some(title) = &meeting_title {
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/tray.rs b/apps/screenpipe-app-tauri/src-tauri/src/tray.rs
index 9c7e6f8b9..6d38bbb6a 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/tray.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/tray.rs
@@ -245,9 +245,7 @@ fn get_effective_recording_status() -> RecordingStatus {
if *status == RecordingStatus::Starting
&& matches!(
real,
- RecordingStatus::Error
- | RecordingStatus::Paused
- | RecordingStatus::Stopped
+ RecordingStatus::Error | RecordingStatus::Paused | RecordingStatus::Stopped
)
{
*opt = None;
@@ -733,9 +731,8 @@ fn create_dynamic_menu(
Some(f) => format!("Stop HD recording (~{} fps, {} {})", f, remaining, why),
None => format!("Stop HD recording ({} {})", remaining, why),
};
- menu_builder = menu_builder.item(
- &MenuItemBuilder::with_id("stop_hd_recording", label).build(app)?,
- );
+ menu_builder = menu_builder
+ .item(&MenuItemBuilder::with_id("stop_hd_recording", label).build(app)?);
// "Just realized I want to keep recording" path. +30 min is
// the most common "one more demo / one more topic" extension;
// bigger bumps go via the API or restart timer from scratch.
diff --git a/ee/desktop-rust/enterprise_policy.rs b/ee/desktop-rust/enterprise_policy.rs
index 059a9b9ce..34a71ca0d 100644
--- a/ee/desktop-rust/enterprise_policy.rs
+++ b/ee/desktop-rust/enterprise_policy.rs
@@ -195,10 +195,7 @@ pub fn set_sync_streams(
/// poisoned — fail-open here mirrors the centralized-data master-switch
/// behavior: the ingest endpoint will still enforce policy server-side.
pub fn current_sync_streams() -> SyncStreams {
- SYNC_STREAMS
- .read()
- .map(|guard| *guard)
- .unwrap_or_default()
+ SYNC_STREAMS.read().map(|guard| *guard).unwrap_or_default()
}
/// Check if a section is hidden by enterprise policy.
diff --git a/ee/desktop-rust/enterprise_sync.rs b/ee/desktop-rust/enterprise_sync.rs
index 8127a27d5..d3a8d71a5 100644
--- a/ee/desktop-rust/enterprise_sync.rs
+++ b/ee/desktop-rust/enterprise_sync.rs
@@ -163,8 +163,7 @@ impl EnterpriseSyncConfig {
/// → uploads start" flow possible without any env-var setup on the
/// customer's machine.
pub async fn resolve_upload_mode(&mut self) {
- let resolved =
- EnterpriseUploadMode::resolve(&self.license_key, &self.ingest_url).await;
+ let resolved = EnterpriseUploadMode::resolve(&self.license_key, &self.ingest_url).await;
self.upload_mode = resolved;
}
}
@@ -454,8 +453,7 @@ pub fn build_jsonl(
memories: &[MemoryRow],
) -> Vec<u8> {
let mut out = Vec::with_capacity(
- (frames.len() + audio.len() + ui.len() + memories.len()) * 256
- + snapshots.len() * 50_000,
+ (frames.len() + audio.len() + ui.len() + memories.len()) * 256 + snapshots.len() * 50_000,
);
for f in frames {
let rec = TelemetryRecord::Frame {