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

Merge pull request #3351 from Anshgrover23/feat/new-one-click-browser-extension

Louis Beaumont0387a38d9519
diff --cc apps/screenpipe-app-tauri/src-tauri/src/commands.rs
index e95c64ee0,5aa949ef4..803d9b68f
--- a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
@@@ -335,58 -337,18 +337,67 @@@ pub async fn set_api_auth_key(app_handl
let data_dir = screenpipe_core::paths::default_screenpipe_data_dir();
screenpipe_engine::auth_key::set_api_auth_key(&data_dir, &key)
.await
- .map_err(|e| e.to_string())
+ .map_err(|e| e.to_string())?;
+ persist_api_auth_key_to_settings(&app_handle, &key)
+ }
+
+ fn persist_api_auth_key_to_settings(app_handle: &tauri::AppHandle, key: &str) -> Result<(), String> {
+ let mut store = SettingsStore::get(app_handle)?.unwrap_or_default();
+ store.recording.api_key = key.to_string();
+ store.save(app_handle)?;
+ crate::store::seed_api_auth_key(key.to_string());
+ Ok(())
}
+/// Toggle the "Cloud audio + video + image analysis" capability
+/// in the screenpipe-api skill that Pi installs on every run.
+///
+/// Mechanism: the screenpipe-core `Pi::ensure_screenpipe_skill` reads
+/// `~/.screenpipe/cloud_media_analysis.disabled` at install time and
+/// conditionally appends the Gemma 4 E4B confidential-enclave section
+/// to `<project>/.pi/skills/screenpipe-api/SKILL.md`. Default (no
+/// marker) = enabled. This command just creates or removes the marker.
+///
+/// Why a marker file instead of editing the rendered skill: Pi rewrites
+/// the rendered skill from a compiled-in template on every run, so any
+/// post-install edits get overwritten on the next pipe execution. The
+/// only stable seam is at install time.
+///
+/// Idempotent. Effect takes hold on the next Pi run (next pipe
+/// execution or new pi-chat session).
+#[tauri::command]
+#[specta::specta]
+pub fn set_cloud_media_analysis_skill(enabled: bool) -> Result<(), String> {
+ let home = dirs::home_dir().ok_or_else(|| "no home directory".to_string())?;
+ let dir = home.join(".screenpipe");
+ let marker = dir.join("cloud_media_analysis.disabled");
+
+ if enabled {
+ // Default = enabled. Remove any marker file from a prior opt-out.
+ if marker.exists() {
+ std::fs::remove_file(&marker)
+ .map_err(|e| format!("remove {}: {e}", marker.display()))?;
+ }
+ } else {
+ std::fs::create_dir_all(&dir)
+ .map_err(|e| format!("create {}: {e}", dir.display()))?;
+ std::fs::write(
+ &marker,
+ "Opt-out marker — Pi will install the screenpipe-api skill \
+ without the Gemma 4 E4B confidential-enclave block. \
+ Delete this file (or toggle in Settings → Privacy) to \
+ re-enable cloud audio/video/image analysis.\n",
+ )
+ .map_err(|e| format!("write {}: {e}", marker.display()))?;
+ }
+ info!(
+ "cloud media analysis {} (marker: {})",
+ if enabled { "enabled" } else { "disabled" },
+ marker.display()
+ );
+ Ok(())
+}
+
/// Read the enterprise license key from `enterprise.json`.
/// Checks in order:
/// 1. Next to executable (pushed via Intune/MDM to Program Files / .app bundle)