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

Bump app to v2.0.555

Louis Beaumont0551625eb81d
diff --git a/apps/screenpipe-app-tauri/components/rewind/timeline/timeline.tsx b/apps/screenpipe-app-tauri/components/rewind/timeline/timeline.tsx
index a3f1d4839..5a3a7b5ee 100644
--- a/apps/screenpipe-app-tauri/components/rewind/timeline/timeline.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/timeline/timeline.tsx
@@ -306,8 +306,8 @@ export const TimelineSlider = ({
}, 300);
}, []);
- // App dot tooltip state (portal-based to escape overflow clipping)
- const [hoveredAppDot, setHoveredAppDot] = useState<{ name: string; x: number; y: number } | null>(null);
+ // Filter dot tooltip state (portal-based to escape overflow clipping)
+ const [hoveredFilterDot, setHoveredFilterDot] = useState<{ name: string; x: number; y: number } | null>(null);
// App context popover state
const [activePopoverGroup, setActivePopoverGroup] = useState<number | null>(null);
@@ -689,7 +689,11 @@ export const TimelineSlider = ({
? "hsl(var(--foreground) / 0.4)"
: "hsl(var(--foreground) / 0.15)",
}}
- title={`${id.replace("monitor_", "monitor ")}${selectedDeviceId === id ? " (click to show all)" : ""}`}
+ onMouseEnter={(e) => {
+ const rect = e.currentTarget.getBoundingClientRect();
+ setHoveredFilterDot({ name: id.replace("monitor_", "Monitor "), x: rect.right + 8, y: rect.top + rect.height / 2 });
+ }}
+ onMouseLeave={() => setHoveredFilterDot(null)}
/>
))}
</div>
@@ -716,9 +720,9 @@ export const TimelineSlider = ({
}}
onMouseEnter={(e) => {
const rect = e.currentTarget.getBoundingClientRect();
- setHoveredAppDot({ name, x: rect.right + 8, y: rect.top + rect.height / 2 });
+ setHoveredFilterDot({ name, x: rect.right + 8, y: rect.top + rect.height / 2 });
}}
- onMouseLeave={() => setHoveredAppDot(null)}
+ onMouseLeave={() => setHoveredFilterDot(null)}
/>
))}
</div>
@@ -1083,16 +1087,16 @@ export const TimelineSlider = ({
)}
{/* App filter dot tooltip */}
- {hoveredAppDot && createPortal(
+ {hoveredFilterDot && createPortal(
<div
className="fixed z-[9999] bg-popover border border-border rounded px-1.5 py-0.5 text-[10px] text-popover-foreground whitespace-nowrap shadow-lg pointer-events-none"
style={{
- left: `${hoveredAppDot.x}px`,
- top: `${hoveredAppDot.y}px`,
+ left: `${hoveredFilterDot.x}px`,
+ top: `${hoveredFilterDot.y}px`,
transform: "translateY(-50%)",
}}
>
- {hoveredAppDot.name}
+ {hoveredFilterDot.name}
</div>,
document.body
)}
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index 0e6e3a26a..360af695d 100755
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -8097,7 +8097,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "2.0.553"
+version = "2.0.554"
dependencies = [
"anyhow",
"arboard",
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index e60c137d2..504df06c3 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "2.0.554"
+version = "2.0.555"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs b/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
index 7b3ab46c1..9799f8bab 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
@@ -146,6 +146,11 @@ pub struct PiManager {
last_activity: std::time::Instant,
/// Handle to the idle watchdog task so stop() can abort it
watchdog_handle: Option<tokio::task::JoinHandle<()>>,
+ /// Shared flag: set by the idle watchdog before stopping Pi, read by the
+ /// stdout reader to decide whether to emit `pi_terminated(0)` (idle) or
+ /// `pi_terminated(pid)` (crash). Each Pi session creates a fresh Arc so
+ /// old reader threads don't interfere with new sessions.
+ idle_stopped: Arc<AtomicBool>,
}
impl PiManager {
@@ -158,6 +163,7 @@ impl PiManager {
app_handle,
last_activity: std::time::Instant::now(),
watchdog_handle: None,
+ idle_stopped: Arc::new(AtomicBool::new(false)),
}
}
@@ -168,17 +174,16 @@ impl PiManager {
/// Check if the child process is actually alive via try_wait().
/// If the process has exited, cleans up child/stdin and returns false.
+ /// NOTE: does NOT emit `pi_terminated` — the stdout reader thread is the
+ /// single source of truth for termination events (avoids duplicate emissions).
fn check_alive(&mut self) -> bool {
if let Some(ref mut child) = self.child {
match child.try_wait() {
Ok(Some(status)) => {
- // Process exited — clean up
let pid = child.id();
info!("Pi process (pid {}) has exited with status: {}", pid, status);
self.child = None;
self.stdin = None;
- // Emit pi_terminated so frontend can auto-restart
- let _ = self.app_handle.emit("pi_terminated", pid);
false
}
Ok(None) => true, // Still running
@@ -873,6 +878,7 @@ pub async fn pi_start_inner(
let stderr = child.stderr.take();
// Update manager
+ let idle_stopped = Arc::new(AtomicBool::new(false));
if let Some(m) = manager_guard.as_mut() {
m.child = Some(child);
m.stdin = Some(stdin);
@@ -880,6 +886,8 @@ pub async fn pi_start_inner(
// Reset idle timer so the watchdog doesn't use a stale timestamp
// from a previous session and immediately kill this new process
m.last_activity = std::time::Instant::now();
+ // Fresh flag for this session — old reader threads keep their own Arc
+ m.idle_stopped = idle_stopped.clone();
}
// Snapshot the state BEFORE dropping the lock, so we don't hold it during I/O
@@ -892,8 +900,12 @@ pub async fn pi_start_inner(
// queued pi_start calls from stacking behind a 500ms sleep while holding the lock
drop(manager_guard);
- // Spawn stdout reader thread
+ // Spawn stdout reader thread — this is the SOLE emitter of `pi_terminated`.
+ // Using idle_stopped (shared with the watchdog) to distinguish idle stops
+ // from crashes: idle → emit pid=0 (frontend skips restart), crash → emit
+ // real pid (frontend auto-restarts).
let app_handle = app.clone();
+ let idle_stopped_reader = idle_stopped.clone();
std::thread::spawn(move || {
let reader = BufReader::new(stdout);
info!("Pi stdout reader started (pid: {})", pid);
@@ -916,7 +928,9 @@ pub async fn pi_start_inner(
}
}
Err(e) => {
- warn!("Pi stdout not JSON: {} (line: {})", e, &line[..line.len().min(100)]);
+ let end = line.len().min(100);
+ let end = line.floor_char_boundary(end);
+ warn!("Pi stdout not JSON: {} (line: {})", e, &line[..end]);
}
}
if let Err(e) = app_handle.emit("pi_output", &line) {
@@ -930,7 +944,8 @@ pub async fn pi_start_inner(
}
}
info!("Pi stdout reader ended (pid: {}), processed {} lines", pid, line_count);
- let _ = app_handle.emit("pi_terminated", pid);
+ let terminated_pid = if idle_stopped_reader.load(Ordering::Acquire) { 0u32 } else { pid };
+ let _ = app_handle.emit("pi_terminated", terminated_pid);
});
// Spawn stderr reader thread — Pi may emit JSON events to stderr in some
@@ -969,25 +984,28 @@ pub async fn pi_start_inner(
});
}
- // Spawn idle watchdog — auto-stops Pi after PI_IDLE_TIMEOUT of inactivity
+ // Spawn idle watchdog — auto-stops Pi after PI_IDLE_TIMEOUT of inactivity.
+ // The watchdog does NOT emit `pi_terminated` directly. Instead, it sets
+ // `idle_stopped` and calls stop(). The stdout reader thread detects EOF
+ // from the killed process and emits the single authoritative event.
{
let state_clone = state.0.clone();
- let app_handle_wd = app.clone();
let watchdog = tokio::spawn(async move {
loop {
tokio::time::sleep(PI_WATCHDOG_INTERVAL).await;
let mut guard = state_clone.lock().await;
if let Some(m) = guard.as_mut() {
if !m.check_alive() {
- info!("Watchdog: Pi process is dead, emitting pi_terminated");
- let _ = app_handle_wd.emit("pi_terminated", 0u32);
+ // Process already dead — stdout reader will emit pi_terminated
+ info!("Watchdog: Pi process is dead, reader thread will handle termination");
break;
}
let idle = m.idle_duration();
if idle >= PI_IDLE_TIMEOUT {
info!("Watchdog: Pi idle for {:?}, stopping to save resources", idle);
+ m.idle_stopped.store(true, Ordering::Release);
m.stop();
- let _ = app_handle_wd.emit("pi_terminated", 0u32);
+ // stdout reader will see EOF and emit pi_terminated(0)
break;
}
} else {