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: keep original migration checksum to avoid breaking source builders
Louis Beaumont7618376dcff4
diff --git a/Cargo.lock b/Cargo.lockindex ee8cbe492..080f3c5ec 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -6641,7 +6641,7 @@ dependencies = [[[package]]name = "screenpipe-audio"-version = "0.3.130"+version = "0.3.131"dependencies = ["anyhow","bytemuck",@@ -6694,7 +6694,7 @@ dependencies = [[[package]]name = "screenpipe-core"-version = "0.3.130"+version = "0.3.131"dependencies = ["accessibility","accessibility-sys",@@ -6745,7 +6745,7 @@ dependencies = [[[package]]name = "screenpipe-db"-version = "0.3.130"+version = "0.3.131"dependencies = ["anyhow","chrono",@@ -6769,7 +6769,7 @@ dependencies = [[[package]]name = "screenpipe-events"-version = "0.3.130"+version = "0.3.131"dependencies = ["anyhow","chrono",@@ -6787,7 +6787,7 @@ dependencies = [[[package]]name = "screenpipe-integrations"-version = "0.3.130"+version = "0.3.131"dependencies = ["anyhow","image",@@ -6802,7 +6802,7 @@ dependencies = [[[package]]name = "screenpipe-server"-version = "0.3.130"+version = "0.3.131"dependencies = ["anyhow","async-trait",@@ -6873,7 +6873,7 @@ dependencies = [[[package]]name = "screenpipe-vision"-version = "0.3.130"+version = "0.3.131"dependencies = ["accessibility-sys","anyhow",diff --git a/apps/screenpipe-app-tauri/components/rewind/current-frame-timeline.tsx b/apps/screenpipe-app-tauri/components/rewind/current-frame-timeline.tsxindex 52a94726c..6637badfe 100644--- a/apps/screenpipe-app-tauri/components/rewind/current-frame-timeline.tsx+++ b/apps/screenpipe-app-tauri/components/rewind/current-frame-timeline.tsx@@ -74,7 +74,7 @@ export const CurrentFrameTimeline: FC<CurrentFrameTimelineProps> = ({const [debouncedFrame, setDebouncedFrame] = useState<{filePath: string;offsetIndex: number;- fps: number | null;+ fps: number;frameId: string;} | null>(null);@@ -93,7 +93,7 @@ export const CurrentFrameTimeline: FC<CurrentFrameTimelineProps> = ({const frameId = device?.frame_id;const filePath = device?.metadata?.file_path;const offsetIndex = device?.offset_index ?? 0;- const fpsFromServer = device?.fps ?? null; // null = pre-migration chunk+ const fpsFromServer = device?.fps ?? 0.5;// Track skipped frames for analyticsuseEffect(() => {@@ -131,15 +131,21 @@ export const CurrentFrameTimeline: FC<CurrentFrameTimelineProps> = ({}}, []);- // Resolve the effective fps for a chunk: use server value, cached calibration, or compute from video+ // Resolve the effective fps for a chunk: validate server value, or auto-calibrate from video duration.+ // Pre-migration chunks default to 0.5 which may be wrong (e.g., CLI uses 1.0).+ // The sanity check catches this and recalibrates.const resolveEffectiveFps = useCallback((path: string,- serverFps: number | null,+ serverFps: number,video: HTMLVideoElement,offsetIndex: number,): number | null => {- // 1. If server provided fps, validate it against video duration- if (serverFps !== null && serverFps > 0) {+ // 1. Check calibration cache first (from a previous correction)+ const cached = calibratedFpsCache.get(path);+ if (cached !== undefined) return cached;++ // 2. Validate server fps against video duration+ if (serverFps > 0) {const expectedTime = offsetIndex / serverFps;if (expectedTime <= video.duration + 0.5) {return serverFps; // looks valid@@ -148,24 +154,13 @@ export const CurrentFrameTimeline: FC<CurrentFrameTimelineProps> = ({console.warn(`fps ${serverFps} invalid for offset ${offsetIndex}: would seek to ${expectedTime.toFixed(1)}s but video is ${video.duration.toFixed(1)}s`);}- // 2. Check calibration cache- const cached = calibratedFpsCache.get(path);- if (cached !== undefined) return cached;-- // 3. Auto-calibrate: estimate fps from video duration- // At constant fps, video duration ≈ (totalFrames - 1) / fps + 1/fps = totalFrames / fps- // We don't know totalFrames here, but we can bound it:- // - If offsetIndex is the highest we'll see in this chunk, fps ≈ (offsetIndex + 1) / duration- // - We use a conservative estimate since offsetIndex may not be the max- // For now, we try common fps values and pick the one where all offsets fit+ // 3. Auto-calibrate from video durationconst duration = video.duration;if (duration <= 0 || !isFinite(duration)) return null;// Try common fps values: 0.2, 0.5, 1.0, 2.0const commonFps = [0.2, 0.5, 1.0, 2.0];for (const candidate of commonFps) {- // At this fps, max frames in this video = floor(duration * candidate)- // offset_index should be < maxFramesconst maxOffset = Math.floor(duration * candidate);if (offsetIndex < maxOffset) {calibratedFpsCache.set(path, candidate);@@ -175,7 +170,6 @@ export const CurrentFrameTimeline: FC<CurrentFrameTimelineProps> = ({}// Last resort: derive directly- // Assume at least offsetIndex+1 frames exist, so fps ≈ (offsetIndex + 1) / durationconst derived = (offsetIndex + 1) / duration;calibratedFpsCache.set(path, derived);console.log(`derived fps=${derived.toFixed(3)} for ${path} (duration=${duration.toFixed(1)}s, offset=${offsetIndex})`);@@ -275,7 +269,7 @@ export const CurrentFrameTimeline: FC<CurrentFrameTimelineProps> = ({frame_id: fid,success: true,mode: "video_seek",- fps_source: serverFps !== null ? "server" : "calibrated",+ fps_source: calibratedFpsCache.has(path) ? "calibrated" : "server",effective_fps: effectiveFps,frames_skipped: framesSkippedRef.current,image_width: video.videoWidth,diff --git a/apps/screenpipe-app-tauri/components/rewind/timeline.tsx b/apps/screenpipe-app-tauri/components/rewind/timeline.tsxindex 498f1589b..91aae9705 100644--- a/apps/screenpipe-app-tauri/components/rewind/timeline.tsx+++ b/apps/screenpipe-app-tauri/components/rewind/timeline.tsx@@ -30,8 +30,7 @@ export interface DeviceFrameResponse {frame_id: string;frame: string; // base64 encoded imageoffset_index: number;- /** null for pre-migration chunks — frontend auto-calibrates from video duration */- fps: number | null;+ fps: number;metadata: DeviceMetadata;audio: AudioData[];}diff --git a/crates/screenpipe-db/src/db.rs b/crates/screenpipe-db/src/db.rsindex 7c23df2d9..7e387f3c9 100644--- a/crates/screenpipe-db/src/db.rs+++ b/crates/screenpipe-db/src/db.rs@@ -2117,7 +2117,7 @@ impl DatabaseManager {let offset_index: i64 = row.get("offset_index");let key = (timestamp, offset_index);- let chunk_fps: Option<f64> = row.try_get("chunk_fps").unwrap_or(None);+ let chunk_fps: f64 = row.try_get("chunk_fps").unwrap_or(0.5);let frame_data = frames_map.entry(key).or_insert_with(|| FrameData {frame_id: row.get("id"),timestamp,diff --git a/crates/screenpipe-db/src/migrations/20260206200000_add_fps_to_video_chunks.sql b/crates/screenpipe-db/src/migrations/20260206200000_add_fps_to_video_chunks.sqlindex 382a7b969..dcdf60393 100644--- a/crates/screenpipe-db/src/migrations/20260206200000_add_fps_to_video_chunks.sql+++ b/crates/screenpipe-db/src/migrations/20260206200000_add_fps_to_video_chunks.sql@@ -1,3 +1,3 @@-- Add fps column to video_chunks so the frontend can seek with video.currentTime = offset_index / fps--- NULL for pre-existing chunks: frontend detects NULL and auto-calibrates from video duration-ALTER TABLE video_chunks ADD COLUMN fps REAL;+-- Default 0.5 matches the app default; CLI default is 1.0 but most users are on the app.+ALTER TABLE video_chunks ADD COLUMN fps REAL NOT NULL DEFAULT 0.5;diff --git a/crates/screenpipe-db/src/types.rs b/crates/screenpipe-db/src/types.rsindex 63120d4a1..ac7d36843 100644--- a/crates/screenpipe-db/src/types.rs+++ b/crates/screenpipe-db/src/types.rs@@ -216,8 +216,7 @@ pub struct FrameData {pub frame_id: i64,pub timestamp: DateTime<Utc>,pub offset_index: i64,- /// None for pre-migration chunks — frontend auto-calibrates from video duration- pub fps: Option<f64>,+ pub fps: f64,pub ocr_entries: Vec<OCREntry>,pub audio_entries: Vec<AudioEntry>,}diff --git a/crates/screenpipe-server/src/server.rs b/crates/screenpipe-server/src/server.rsindex dfabfa7bf..44b36486d 100644--- a/crates/screenpipe-server/src/server.rs+++ b/crates/screenpipe-server/src/server.rs@@ -1895,8 +1895,7 @@ pub struct DeviceFrameResponse {// pub frame: String, // base64 encoded imagepub frame_id: i64,pub offset_index: i64,- /// None for pre-migration chunks — frontend auto-calibrates from video duration- pub fps: Option<f64>,+ pub fps: f64,pub metadata: DeviceMetadata,pub audio: Vec<AudioData>,}@@ -4306,7 +4305,7 @@ mod tests {frame_id: 12345,timestamp: chrono::Utc::now(),offset_index: 0,- fps: Some(0.5),+ fps: 0.5,ocr_entries,audio_entries,}diff --git a/crates/screenpipe-server/src/video_cache.rs b/crates/screenpipe-server/src/video_cache.rsindex 0f4c6300f..6570e4625 100644--- a/crates/screenpipe-server/src/video_cache.rs+++ b/crates/screenpipe-server/src/video_cache.rs@@ -23,7 +23,7 @@ pub struct TimeSeriesFrame {pub timestamp: DateTime<Utc>,pub frame_data: Vec<DeviceFrame>,pub offset_index: i64,- pub fps: Option<f64>,+ pub fps: f64,pub error: Option<String>,}