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.127, CLI to v0.3.4

Louis Beaumont35e44cd447cd
diff --git a/Cargo.lock b/Cargo.lock
index bb6ef7d8b..c36621df4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6669,6 +6669,7 @@ dependencies = [
"console-subscriber",
"criterion",
"crossbeam",
+ "dashmap",
"dirs",
"env_logger 0.10.2",
"fastrand",
diff --git a/Cargo.toml b/Cargo.toml
index 69d2fd22c..13d095b84 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,7 @@ exclude = ["screenpipe-app-tauri/src-tauri"]
resolver = "2"
[workspace.package]
-version = "0.3.3"
+version = "0.3.4"
authors = ["louis030195 <[email protected]>"]
description = ""
repository = "https://github.com/mediar-ai/screenpipe"
diff --git a/content/changelogs/v2.0.127.md b/content/changelogs/v2.0.127.md
new file mode 100644
index 000000000..d22fba687
--- /dev/null
+++ b/content/changelogs/v2.0.127.md
@@ -0,0 +1,11 @@
+## New Features
+- Added `--use-all-monitors` flag for dynamic monitor detection: automatically records all connected monitors and detects when monitors are connected/disconnected in real-time
+
+## Improvements
+- VisionManager: New architecture for per-monitor recording with automatic monitor lifecycle management
+- MonitorWatcher: Polls for monitor changes every 2 seconds for seamless multi-monitor support
+
+## Bug Fixes
+- Fixed timeline z-index for audio transcript panel
+
+#### **Full Changelog:** [a5b8dacf..HEAD](https://github.com/mediar-ai/screenpipe/compare/a5b8dacf..HEAD)
diff --git a/screenpipe-app-tauri/components/rewind/timeline.tsx b/screenpipe-app-tauri/components/rewind/timeline.tsx
index c4ffe2ee5..181f0ae28 100644
--- a/screenpipe-app-tauri/components/rewind/timeline.tsx
+++ b/screenpipe-app-tauri/components/rewind/timeline.tsx
@@ -759,7 +759,7 @@ export default function Timeline() {
{/* Audio Transcript Panel - Re-enabled and properly positioned */}
{currentFrame && showAudioTranscript && (
- <div className="absolute bottom-28 left-4 right-4 z-35">
+ <div className="absolute bottom-28 left-4 right-4 z-[35]">
<AudioTranscript
frames={frames}
currentIndex={currentIndex}
diff --git a/screenpipe-app-tauri/public/CHANGELOG.md b/screenpipe-app-tauri/public/CHANGELOG.md
index 02c3ef3e6..d22fba687 100644
--- a/screenpipe-app-tauri/public/CHANGELOG.md
+++ b/screenpipe-app-tauri/public/CHANGELOG.md
@@ -1,15 +1,11 @@
## New Features
-- Redesigned shortcut reminder with brand-aligned styling (black/white, sharp corners)
-- Shortcut reminder now shows both shortcuts: timeline overlay (⌘⌥S) and AI chat (⌘⌥L)
-- AI chat shortcut is now configurable in settings
+- Added `--use-all-monitors` flag for dynamic monitor detection: automatically records all connected monitors and detects when monitors are connected/disconnected in real-time
## Improvements
-- AI chat window now appears above fullscreen apps on macOS
-- AI chat window is now draggable via header bar
-- Search input automatically focuses when opening search
+- VisionManager: New architecture for per-monitor recording with automatic monitor lifecycle management
+- MonitorWatcher: Polls for monitor changes every 2 seconds for seamless multi-monitor support
## Bug Fixes
-- Fixed timeline day navigation arrows not working (race condition in date sync)
-- Fixed error handling in frame date checking that could cause navigation issues
+- Fixed timeline z-index for audio transcript panel
-#### **Full Changelog:** [bb0f001c..02dd997b](https://github.com/mediar-ai/screenpipe/compare/bb0f001c..02dd997b)
+#### **Full Changelog:** [a5b8dacf..HEAD](https://github.com/mediar-ai/screenpipe/compare/a5b8dacf..HEAD)
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index f407efab5..f6e7d254e 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "2.0.126"
+version = "2.0.127"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/screenpipe-server/Cargo.toml b/screenpipe-server/Cargo.toml
index c5e245ae9..4e60f9d97 100644
--- a/screenpipe-server/Cargo.toml
+++ b/screenpipe-server/Cargo.toml
@@ -116,6 +116,8 @@ lru = "0.13.0"
tokio-util = { version = "0.7", features = ["io"] }
once_cell = { workspace = true }
+dashmap = { workspace = true }
+
[dev-dependencies]
env_logger = "0.10"
tempfile = "3.3.0"
diff --git a/screenpipe-server/src/bin/screenpipe-server.rs b/screenpipe-server/src/bin/screenpipe-server.rs
index b2bf35a23..5743800d6 100644
--- a/screenpipe-server/src/bin/screenpipe-server.rs
+++ b/screenpipe-server/src/bin/screenpipe-server.rs
@@ -25,6 +25,7 @@ use screenpipe_server::{
handle_index_command,
pipe_manager::PipeInfo,
start_continuous_recording, watch_pid, PipeManager, ResourceMonitor, SCServer,
+ vision_manager::{VisionManager, VisionManagerConfig, start_monitor_watcher, stop_monitor_watcher},
};
use screenpipe_vision::monitor::list_monitors;
use serde::Deserialize;
@@ -764,7 +765,57 @@ async fn main() -> anyhow::Result<()> {
}
};
- let handle = {
+ // Create VisionManager for dynamic monitor detection if enabled
+ let vision_manager: Option<Arc<VisionManager>> = if cli.use_all_monitors && !cli.disable_vision {
+ info!("Using dynamic monitor detection (--use-all-monitors)");
+ let config = VisionManagerConfig {
+ output_path: output_path_clone.to_string(),
+ fps,
+ video_chunk_duration: Duration::from_secs(cli.video_chunk_duration),
+ ocr_engine: Arc::new(cli.ocr_engine.clone().into()),
+ use_pii_removal: cli.use_pii_removal,
+ ignored_windows: cli.ignored_windows.clone(),
+ included_windows: cli.included_windows.clone(),
+ languages: languages_clone.clone(),
+ capture_unfocused_windows: cli.capture_unfocused_windows,
+ realtime_vision: cli.enable_realtime_audio_transcription,
+ };
+ Some(Arc::new(VisionManager::new(config, db_clone.clone(), vision_handle.clone())))
+ } else {
+ None
+ };
+
+ let handle = if let Some(ref vm) = vision_manager {
+ // Use VisionManager for dynamic monitor detection
+ let vm_clone = vm.clone();
+ let shutdown_tx_clone2 = shutdown_tx_clone.clone();
+ let runtime = &tokio::runtime::Handle::current();
+ runtime.spawn(async move {
+ let mut shutdown_rx = shutdown_tx_clone2.subscribe();
+
+ // Start VisionManager
+ if let Err(e) = vm_clone.start().await {
+ error!("Failed to start VisionManager: {:?}", e);
+ return;
+ }
+
+ // Start MonitorWatcher for dynamic detection
+ if let Err(e) = start_monitor_watcher(vm_clone.clone()).await {
+ error!("Failed to start monitor watcher: {:?}", e);
+ }
+
+ // Wait for shutdown signal
+ let _ = shutdown_rx.recv().await;
+ info!("received shutdown signal for VisionManager");
+
+ // Stop monitor watcher and VisionManager
+ let _ = stop_monitor_watcher().await;
+ if let Err(e) = vm_clone.shutdown().await {
+ error!("Error shutting down VisionManager: {:?}", e);
+ }
+ })
+ } else {
+ // Use traditional start_continuous_recording
let runtime = &tokio::runtime::Handle::current();
runtime.spawn(async move {
loop {
@@ -889,6 +940,7 @@ async fn main() -> anyhow::Result<()> {
println!("│ local llm │ {:<34} │", cli.enable_llm);
println!("│ use pii removal │ {:<34} │", cli.use_pii_removal);
+ println!("│ use all monitors │ {:<34} │", cli.use_all_monitors);
println!(
"│ ignored windows │ {:<34} │",
format_cell(&format!("{:?}", &ignored_windows_clone), VALUE_WIDTH)
diff --git a/screenpipe-server/src/cli.rs b/screenpipe-server/src/cli.rs
index 13b2ed214..a9e50ef68 100644
--- a/screenpipe-server/src/cli.rs
+++ b/screenpipe-server/src/cli.rs
@@ -227,6 +227,11 @@ pub struct Cli {
#[arg(short = 'm', long)]
pub monitor_id: Vec<u32>,
+ /// Automatically record all monitors and dynamically detect when monitors are
+ /// connected/disconnected. Recording starts/stops automatically as monitors change.
+ #[arg(long, default_value_t = false)]
+ pub use_all_monitors: bool,
+
#[arg(short = 'l', long, value_enum)]
pub language: Vec<Language>,
diff --git a/screenpipe-server/src/core.rs b/screenpipe-server/src/core.rs
index 2a1f82d7e..ff6367423 100644
--- a/screenpipe-server/src/core.rs
+++ b/screenpipe-server/src/core.rs
@@ -111,7 +111,7 @@ pub async fn start_continuous_recording(
}
#[allow(clippy::too_many_arguments)]
-async fn record_video(
+pub async fn record_video(
db: Arc<DatabaseManager>,
output_path: Arc<String>,
fps: f64,
diff --git a/screenpipe-server/src/lib.rs b/screenpipe-server/src/lib.rs
index fb75338a4..26246ab49 100644
--- a/screenpipe-server/src/lib.rs
+++ b/screenpipe-server/src/lib.rs
@@ -12,11 +12,12 @@ pub mod text_embeds;
mod video;
pub mod video_cache;
pub mod video_utils;
+pub mod vision_manager;
pub use add::handle_index_command;
pub use auto_destruct::watch_pid;
pub use axum::Json as JsonResponse;
pub use cli::Cli;
-pub use core::start_continuous_recording;
+pub use core::{start_continuous_recording, record_video};
pub use pipe_manager::PipeManager;
pub use resource_monitor::{ResourceMonitor, RestartSignal};
pub use screenpipe_core::Language;
diff --git a/screenpipe-server/src/vision_manager/manager.rs b/screenpipe-server/src/vision_manager/manager.rs
new file mode 100644
index 000000000..f4f9ca289
--- /dev/null
+++ b/screenpipe-server/src/vision_manager/manager.rs
@@ -0,0 +1,216 @@
+//! VisionManager - Core manager for per-monitor recording tasks
+
+use anyhow::Result;
+use dashmap::DashMap;
+use screenpipe_core::Language;
+use screenpipe_db::DatabaseManager;
+use screenpipe_vision::monitor::{get_monitor_by_id, list_monitors};
+use screenpipe_vision::OcrEngine;
+use std::sync::Arc;
+use std::time::Duration;
+use tokio::runtime::Handle;
+use tokio::sync::RwLock;
+use tokio::task::JoinHandle;
+use tracing::{debug, error, info, warn};
+
+use crate::core::record_video;
+
+/// Configuration for VisionManager
+#[derive(Clone)]
+pub struct VisionManagerConfig {
+ pub output_path: String,
+ pub fps: f64,
+ pub video_chunk_duration: Duration,
+ pub ocr_engine: Arc<OcrEngine>,
+ pub use_pii_removal: bool,
+ pub ignored_windows: Vec<String>,
+ pub included_windows: Vec<String>,
+ pub languages: Vec<Language>,
+ pub capture_unfocused_windows: bool,
+ pub realtime_vision: bool,
+}
+
+/// Status of the VisionManager
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum VisionManagerStatus {
+ Stopped,
+ Running,
+ ShuttingDown,
+}
+
+/// Manages vision recording across multiple monitors with dynamic detection
+pub struct VisionManager {
+ config: VisionManagerConfig,
+ db: Arc<DatabaseManager>,
+ vision_handle: Handle,
+ status: Arc<RwLock<VisionManagerStatus>>,
+ /// Map of monitor_id -> JoinHandle
+ recording_tasks: Arc<DashMap<u32, JoinHandle<()>>>,
+}
+
+impl VisionManager {
+ /// Create a new VisionManager
+ pub fn new(
+ config: VisionManagerConfig,
+ db: Arc<DatabaseManager>,
+ vision_handle: Handle,
+ ) -> Self {
+ Self {
+ config,
+ db,
+ vision_handle,
+ status: Arc::new(RwLock::new(VisionManagerStatus::Stopped)),
+ recording_tasks: Arc::new(DashMap::new()),
+ }
+ }
+
+ /// Get current status
+ pub async fn status(&self) -> VisionManagerStatus {
+ *self.status.read().await
+ }
+
+ /// Start recording on all currently connected monitors
+ pub async fn start(&self) -> Result<()> {
+ let mut status = self.status.write().await;
+ if *status == VisionManagerStatus::Running {
+ debug!("VisionManager already running");
+ return Ok(());
+ }
+
+ info!("Starting VisionManager");
+ *status = VisionManagerStatus::Running;
+ drop(status);
+
+ // Get all monitors and start recording on each
+ let monitors = list_monitors().await;
+ for monitor in monitors {
+ let monitor_id = monitor.id();
+ if let Err(e) = self.start_monitor(monitor_id).await {
+ warn!("Failed to start recording on monitor {}: {:?}", monitor_id, e);
+ }
+ }
+
+ Ok(())
+ }
+
+ /// Stop all recording
+ pub async fn stop(&self) -> Result<()> {
+ let mut status = self.status.write().await;
+ if *status == VisionManagerStatus::Stopped {
+ debug!("VisionManager already stopped");
+ return Ok(());
+ }
+
+ info!("Stopping VisionManager");
+ *status = VisionManagerStatus::ShuttingDown;
+ drop(status);
+
+ // Stop all monitors
+ let monitor_ids: Vec<u32> = self.recording_tasks.iter().map(|entry| *entry.key()).collect();
+ for monitor_id in monitor_ids {
+ if let Err(e) = self.stop_monitor(monitor_id).await {
+ warn!("Failed to stop recording on monitor {}: {:?}", monitor_id, e);
+ }
+ }
+
+ let mut status = self.status.write().await;
+ *status = VisionManagerStatus::Stopped;
+
+ Ok(())
+ }
+
+ /// Start recording on a specific monitor
+ pub async fn start_monitor(&self, monitor_id: u32) -> Result<()> {
+ // Check if already recording
+ if self.recording_tasks.contains_key(&monitor_id) {
+ debug!("Monitor {} is already recording", monitor_id);
+ return Ok(());
+ }
+
+ // Verify monitor exists
+ let monitor = get_monitor_by_id(monitor_id).await
+ .ok_or_else(|| anyhow::anyhow!("Monitor {} not found", monitor_id))?;
+
+ info!(
+ "Starting vision recording for monitor {} ({}x{})",
+ monitor_id,
+ monitor.width(),
+ monitor.height()
+ );
+
+ // Clone config values for the spawned task
+ let db = self.db.clone();
+ let output_path = Arc::new(self.config.output_path.clone());
+ let fps = self.config.fps;
+ let video_chunk_duration = self.config.video_chunk_duration;
+ let ocr_engine = self.config.ocr_engine.clone();
+ let use_pii_removal = self.config.use_pii_removal;
+ let ignored_windows = self.config.ignored_windows.clone();
+ let included_windows = self.config.included_windows.clone();
+ let languages = self.config.languages.clone();
+ let capture_unfocused_windows = self.config.capture_unfocused_windows;
+ let realtime_vision = self.config.realtime_vision;
+
+ // Spawn the recording task using the existing record_video function
+ let handle = self.vision_handle.spawn(async move {
+ loop {
+ match record_video(
+ db.clone(),
+ output_path.clone(),
+ fps,
+ ocr_engine.clone(),
+ monitor_id,
+ use_pii_removal,
+ &ignored_windows,
+ &included_windows,
+ video_chunk_duration,
+ languages.clone(),
+ capture_unfocused_windows,
+ realtime_vision,
+ ).await {
+ Ok(_) => {
+ info!("Monitor {} recording completed normally", monitor_id);
+ break;
+ }
+ Err(e) => {
+ error!("Monitor {} recording error: {:?}, restarting in 1s...", monitor_id, e);
+ tokio::time::sleep(Duration::from_secs(1)).await;
+ }
+ }
+ }
+ });
+
+ self.recording_tasks.insert(monitor_id, handle);
+
+ Ok(())
+ }
+
+ /// Stop recording on a specific monitor
+ pub async fn stop_monitor(&self, monitor_id: u32) -> Result<()> {
+ if let Some((_, handle)) = self.recording_tasks.remove(&monitor_id) {
+ info!("Stopping vision recording for monitor {}", monitor_id);
+
+ // Abort the task
+ handle.abort();
+
+ // Wait for it to finish
+ let _ = handle.await;
+
+ Ok(())
+ } else {
+ debug!("Monitor {} was not recording", monitor_id);
+ Ok(())
+ }
+ }
+
+ /// Get list of currently recording monitor IDs
+ pub async fn active_monitors(&self) -> Vec<u32> {
+ self.recording_tasks.iter().map(|entry| *entry.key()).collect()
+ }
+
+ /// Shutdown the VisionManager
+ pub async fn shutdown(&self) -> Result<()> {
+ info!("Shutting down VisionManager");
+ self.stop().await
+ }
+}
diff --git a/screenpipe-server/src/vision_manager/mod.rs b/screenpipe-server/src/vision_manager/mod.rs
new file mode 100644
index 000000000..b146ab2d3
--- /dev/null
+++ b/screenpipe-server/src/vision_manager/mod.rs
@@ -0,0 +1,10 @@
+//! Vision Manager - Dynamic monitor recording management
+//!
+//! This module provides automatic detection and recording of all connected monitors,
+//! with support for hot-plugging (monitors connecting/disconnecting).
+
+mod manager;
+mod monitor_watcher;
+
+pub use manager::{VisionManager, VisionManagerConfig, VisionManagerStatus};
+pub use monitor_watcher::{start_monitor_watcher, stop_monitor_watcher};
diff --git a/screenpipe-server/src/vision_manager/monitor_watcher.rs b/screenpipe-server/src/vision_manager/monitor_watcher.rs
new file mode 100644
index 000000000..4a06caa3f
--- /dev/null
+++ b/screenpipe-server/src/vision_manager/monitor_watcher.rs
@@ -0,0 +1,91 @@
+//! Monitor Watcher - Polls for monitor connect/disconnect events
+
+use std::collections::HashSet;
+use std::sync::Arc;
+use std::time::Duration;
+use once_cell::sync::Lazy;
+use tokio::sync::Mutex;
+use tokio::task::JoinHandle;
+use tracing::{debug, info, warn};
+
+use screenpipe_vision::monitor::list_monitors;
+
+use super::manager::{VisionManager, VisionManagerStatus};
+
+static MONITOR_WATCHER: Lazy<Mutex<Option<JoinHandle<()>>>> = Lazy::new(|| Mutex::new(None));
+
+/// Start the monitor watcher that polls for monitor changes
+pub async fn start_monitor_watcher(vision_manager: Arc<VisionManager>) -> anyhow::Result<()> {
+ // Stop existing watcher if any
+ stop_monitor_watcher().await?;
+
+ info!("Starting monitor watcher (polling every 2 seconds)");
+
+ let handle = tokio::spawn(async move {
+ // Track monitors that were disconnected (for reconnection detection)
+ let mut known_monitors: HashSet<u32> = HashSet::new();
+
+ // Initialize with current monitors
+ let initial_monitors = list_monitors().await;
+ for monitor in &initial_monitors {
+ known_monitors.insert(monitor.id());
+ }
+
+ loop {
+ // Only poll when running
+ if vision_manager.status().await != VisionManagerStatus::Running {
+ tokio::time::sleep(Duration::from_secs(2)).await;
+ continue;
+ }
+
+ // Get currently connected monitors
+ let current_monitors = list_monitors().await;
+ let current_ids: HashSet<u32> = current_monitors.iter().map(|m| m.id()).collect();
+
+ // Get currently recording monitors
+ let active_ids: HashSet<u32> = vision_manager.active_monitors().await.into_iter().collect();
+
+ // Detect newly connected monitors
+ for monitor_id in &current_ids {
+ if !active_ids.contains(monitor_id) {
+ if known_monitors.contains(monitor_id) {
+ info!("Monitor {} reconnected, resuming recording", monitor_id);
+ } else {
+ info!("New monitor {} detected, starting recording", monitor_id);
+ known_monitors.insert(*monitor_id);
+ }
+
+ if let Err(e) = vision_manager.start_monitor(*monitor_id).await {
+ warn!("Failed to start recording on monitor {}: {:?}", monitor_id, e);
+ }
+ }
+ }
+
+ // Detect disconnected monitors
+ for monitor_id in &active_ids {
+ if !current_ids.contains(monitor_id) {
+ info!("Monitor {} disconnected, stopping recording", monitor_id);
+ if let Err(e) = vision_manager.stop_monitor(*monitor_id).await {
+ warn!("Failed to stop recording on monitor {}: {:?}", monitor_id, e);
+ }
+ }
+ }
+
+ // Poll every 2 seconds
+ tokio::time::sleep(Duration::from_secs(2)).await;
+ }
+ });
+
+ *MONITOR_WATCHER.lock().await = Some(handle);
+
+ Ok(())
+}
+
+/// Stop the monitor watcher
+pub async fn stop_monitor_watcher() -> anyhow::Result<()> {
+ if let Some(handle) = MONITOR_WATCHER.lock().await.take() {
+ debug!("Stopping monitor watcher");
+ handle.abort();
+ }
+ Ok(())
+}