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: Pi sidecar on Windows — add Windows paths, auto-install from chat

Louis Beaumont02cd35e36a3e
diff --git a/apps/screenpipe-app-tauri/components/standalone-chat.tsx b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
index 2c34c3377..e786dc264 100644
--- a/apps/screenpipe-app-tauri/components/standalone-chat.tsx
+++ b/apps/screenpipe-app-tauri/components/standalone-chat.tsx
@@ -965,9 +965,36 @@ export function StandaloneChat() {
}
}, [isPi, piProjectDir]);
+ // Auto-install Pi if not available
+ const [piInstalling, setPiInstalling] = useState(false);
+ useEffect(() => {
+ if (!isPi) return;
+ const checkAndInstall = async () => {
+ const result = await commands.piCheck();
+ if (result.status === "ok" && result.data.available) return;
+ console.log("[Pi] Not found, installing in background...");
+ setPiInstalling(true);
+ await commands.piInstall();
+ };
+ checkAndInstall();
+
+ const unlisten = listen<boolean>("pi_installed", (event) => {
+ setPiInstalling(false);
+ if (event.payload) {
+ console.log("[Pi] Installed successfully, will auto-start");
+ piRestartCountRef.current = 0; // reset so auto-start kicks in
+ } else {
+ console.error("[Pi] Installation failed");
+ toast({ title: "Failed to install Pi", description: "Install manually: bun add -g @mariozechner/pi-coding-agent", variant: "destructive" });
+ }
+ });
+
+ return () => { unlisten.then((fn_) => fn_()); };
+ }, [isPi]);
+
// Start Pi when needed
useEffect(() => {
- const shouldStart = isPi && !needsLogin && piProjectDir && !piStarting && !piInfo?.running;
+ const shouldStart = isPi && !needsLogin && piProjectDir && !piStarting && !piInfo?.running && !piInstalling;
if (!shouldStart) return;
if (piStartInFlightRef.current) return;
@@ -1005,7 +1032,7 @@ export function StandaloneChat() {
}
};
startPi();
- }, [isPi, needsLogin, piProjectDir, piStarting, piInfo?.running, settings.user?.token]);
+ }, [isPi, needsLogin, piProjectDir, piStarting, piInfo?.running, piInstalling, settings.user?.token]);
// Listen for Pi events
useEffect(() => {
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index e2cdc6b65..843c530fb 100755
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -9007,7 +9007,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "2.0.352"
+version = "2.0.356"
dependencies = [
"anyhow",
"async-stream",
@@ -9099,7 +9099,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio"
-version = "0.3.135"
+version = "0.3.138"
dependencies = [
"anyhow",
"bytemuck",
@@ -9147,7 +9147,7 @@ dependencies = [
[[package]]
name = "screenpipe-core"
-version = "0.3.135"
+version = "0.3.138"
dependencies = [
"accessibility",
"accessibility-sys",
@@ -9198,7 +9198,7 @@ dependencies = [
[[package]]
name = "screenpipe-db"
-version = "0.3.135"
+version = "0.3.138"
dependencies = [
"anyhow",
"chrono",
@@ -9222,7 +9222,7 @@ dependencies = [
[[package]]
name = "screenpipe-events"
-version = "0.3.135"
+version = "0.3.138"
dependencies = [
"anyhow",
"chrono",
@@ -9238,7 +9238,7 @@ dependencies = [
[[package]]
name = "screenpipe-integrations"
-version = "0.3.135"
+version = "0.3.138"
dependencies = [
"anyhow",
"image 0.25.9",
@@ -9253,7 +9253,7 @@ dependencies = [
[[package]]
name = "screenpipe-server"
-version = "0.3.135"
+version = "0.3.138"
dependencies = [
"anyhow",
"async-trait",
@@ -9319,7 +9319,7 @@ dependencies = [
[[package]]
name = "screenpipe-vision"
-version = "0.3.135"
+version = "0.3.138"
dependencies = [
"accessibility-sys",
"anyhow",
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs b/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
index b5109f51e..e7f56160d 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
@@ -174,6 +174,7 @@ fn find_pi_executable() -> Option<String> {
.map(|h| h.to_string_lossy().to_string())
.unwrap_or_default();
+ #[cfg(unix)]
let paths = vec![
format!("{}/.bun/bin/pi", home),
format!("{}/.npm-global/bin/pi", home),
@@ -181,6 +182,15 @@ fn find_pi_executable() -> Option<String> {
"/usr/local/bin/pi".to_string(),
];
+ #[cfg(windows)]
+ let paths = vec![
+ format!("{}\\.bun\\bin\\pi.exe", home),
+ format!("{}\\AppData\\Roaming\\npm\\pi.cmd", home),
+ format!("{}\\AppData\\Roaming\\npm\\pi", home),
+ format!("{}\\AppData\\Local\\bun\\bin\\pi.exe", home),
+ format!("{}\\.npm-global\\pi.cmd", home),
+ ];
+
for path in paths {
if std::path::Path::new(&path).exists() {
return Some(path);
@@ -625,12 +635,19 @@ pub async fn pi_install(app: AppHandle) -> Result<(), String> {
.map(|h| h.to_string_lossy().to_string())
.unwrap_or_default();
+ #[cfg(unix)]
let bun_paths = vec![
format!("{}/.bun/bin/bun", home),
"/opt/homebrew/bin/bun".to_string(),
"/usr/local/bin/bun".to_string(),
];
+ #[cfg(windows)]
+ let bun_paths = vec![
+ format!("{}\\.bun\\bin\\bun.exe", home),
+ format!("{}\\AppData\\Local\\bun\\bin\\bun.exe", home),
+ ];
+
let bun = bun_paths
.iter()
.find(|p| std::path::Path::new(p).exists())