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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix: cargo fmt + sync pending changes
Louis Beaumont6c165cf47450
diff --git a/crates/screenpipe-core/src/agents/pi.rs b/crates/screenpipe-core/src/agents/pi.rsindex 82d437895..3b581382d 100644--- a/crates/screenpipe-core/src/agents/pi.rs+++ b/crates/screenpipe-core/src/agents/pi.rs@@ -511,7 +511,8 @@ impl PiExecutor {loop {line_bytes.clear();- let n = tokio::io::AsyncBufReadExt::read_until(&mut reader, b'\n', &mut line_bytes).await?;+ let n =+ tokio::io::AsyncBufReadExt::read_until(&mut reader, b'\n', &mut line_bytes).await?;if n == 0 {break;}@@ -1129,7 +1130,11 @@ mod tests {child3.wait().await.unwrap();assert_eq!(lines.len(), 2);- assert!(lines[0].starts_with("Hi"), "first line should start with Hi, got: {}", lines[0]);+ assert!(+ lines[0].starts_with("Hi"),+ "first line should start with Hi, got: {}",+ lines[0]+ );assert_eq!(lines[1], "OK");}diff --git a/crates/screenpipe-integrations/screenpipe-mcp/src/index.ts b/crates/screenpipe-integrations/screenpipe-mcp/src/index.tsindex 9a6d0ef5e..3e1b3edff 100644--- a/crates/screenpipe-integrations/screenpipe-mcp/src/index.ts+++ b/crates/screenpipe-integrations/screenpipe-mcp/src/index.ts@@ -223,7 +223,9 @@ const BASE_TOOLS: Tool[] = [name: "activity-summary",description:"Get a lightweight compressed activity overview for a time range (~200-500 tokens). " +- "Returns app usage (name, frame count, minutes), recent accessibility texts, and audio speaker summary. " ++ "Returns app usage (name, frame count, active minutes, first/last seen), recent accessibility texts, and audio speaker summary. " ++ "Minutes are based on active session time (consecutive frames with gaps < 5min count as active). " ++ "first_seen/last_seen show the wall-clock span per app. " +"Use this FIRST for broad questions like 'what was I doing?' before drilling into search-content or search-elements. " +"Much cheaper than search-content for getting an overview.",annotations: {@@ -993,8 +995,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {// Format appsconst appsLines = (data.apps || []).map(- (a: { name: string; frame_count: number; minutes: number }) =>- ` ${a.name}: ${a.minutes} min (${a.frame_count} frames)`+ (a: { name: string; frame_count: number; minutes: number; first_seen?: string; last_seen?: string }) => {+ const timeSpan = a.first_seen && a.last_seen+ ? `, ${a.first_seen.slice(11, 16)}–${a.last_seen.slice(11, 16)} UTC`+ : "";+ return ` ${a.name}: ${a.minutes} min (${a.frame_count} frames${timeSpan})`;+ });// Format audiodiff --git a/crates/screenpipe-server/src/routes/activity_summary.rs b/crates/screenpipe-server/src/routes/activity_summary.rsindex 520fcdb0d..472c97ca8 100644--- a/crates/screenpipe-server/src/routes/activity_summary.rs+++ b/crates/screenpipe-server/src/routes/activity_summary.rs@@ -33,6 +33,8 @@ pub struct AppUsage {pub name: String,pub frame_count: i64,pub minutes: f64,+ pub first_seen: String,+ pub last_seen: String,}#[derive(Serialize, OaSchema)]@@ -87,11 +89,20 @@ pub async fn get_activity_summary(.unwrap_or_default();let apps_query = format!(- "SELECT app_name, COUNT(*) as frame_count, ROUND(COUNT(*) * 2.0 / 60, 1) as minutes \- FROM frames \- WHERE timestamp BETWEEN '{}' AND '{}'{} \- AND app_name IS NOT NULL AND app_name != '' \- GROUP BY app_name ORDER BY 2 DESC LIMIT 20",+ "SELECT app_name, \+ COUNT(*) as frame_count, \+ ROUND(SUM(CASE WHEN gap_sec < 300 THEN gap_sec ELSE 0 END) / 60.0, 1) as minutes, \+ MIN(ts) as first_seen, \+ MAX(ts) as last_seen \+ FROM ( \+ SELECT app_name, timestamp as ts, \+ (JULIANDAY(LEAD(timestamp) OVER (PARTITION BY app_name ORDER BY timestamp)) \+ - JULIANDAY(timestamp)) * 86400 AS gap_sec \+ FROM frames \+ WHERE timestamp BETWEEN '{}' AND '{}'{} \+ AND app_name IS NOT NULL AND app_name != '' \+ ) gaps \+ GROUP BY app_name ORDER BY minutes DESC LIMIT 20",start, end, app_filter);@@ -149,11 +160,23 @@ pub async fn get_activity_summary(.or_else(|| v.as_str().and_then(|s| s.parse().ok()))}).unwrap_or(0.0);+ let first_seen = row+ .get("first_seen")+ .and_then(|v| v.as_str())+ .unwrap_or("")+ .to_string();+ let last_seen = row+ .get("last_seen")+ .and_then(|v| v.as_str())+ .unwrap_or("")+ .to_string();total_frames += frame_count;apps.push(AppUsage {name,frame_count,minutes,+ first_seen,+ last_seen,});}}