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

fix: respect offline mode when installing web-search extension for Pi

Louis Beaumont4fcdd0a0bac4
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs b/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
index 5ee42cf7e..0f5d71114 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
@@ -597,11 +597,32 @@ fn ensure_web_search_extension(
.join("extensions");
let ext_path = ext_dir.join("web-search.ts");
- let is_screenpipe_cloud = match provider_config {
- Some(config) => matches!(config.provider.as_str(), "screenpipe-cloud" | "pi"),
- None => true, // default preset = screenpipe cloud
+ // Offline mode: never install web search (it calls api.screenpi.pe)
+ // Re-read from store.bin each time (not cached) so runtime toggles take effect
+ let offline = {
+ let store_path = screenpipe_core::paths::default_screenpipe_data_dir().join("store.bin");
+ std::fs::read_to_string(&store_path)
+ .ok()
+ .and_then(|c| serde_json::from_str::<serde_json::Value>(&c).ok())
+ .map(|data| {
+ data.get("offlineMode")
+ .and_then(|v| v.as_bool())
+ .or_else(|| {
+ data.get("settings")
+ .and_then(|s| s.get("offlineMode"))
+ .and_then(|v| v.as_bool())
+ })
+ .unwrap_or(false)
+ })
+ .unwrap_or(false)
};
+ let is_screenpipe_cloud = !offline
+ && match provider_config {
+ Some(config) => matches!(config.provider.as_str(), "screenpipe-cloud" | "pi"),
+ None => true, // default preset = screenpipe cloud
+ };
+
if is_screenpipe_cloud {
std::fs::create_dir_all(&ext_dir)
.map_err(|e| format!("Failed to create extensions dir: {}", e))?;