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: pass search results directly to Main window for bottom nav bar
Louis Beaumont82098d51b90a
diff --git a/apps/screenpipe-app-tauri/app/search/page.tsx b/apps/screenpipe-app-tauri/app/search/page.tsxindex c09ea721f..177ad776c 100644--- a/apps/screenpipe-app-tauri/app/search/page.tsx+++ b/apps/screenpipe-app-tauri/app/search/page.tsx@@ -10,9 +10,9 @@ import { invoke } from "@tauri-apps/api/core";import { commands } from "@/lib/utils/tauri";export default function SearchPage() {- const handleNavigate = useCallback(async (timestamp: string, frameId?: number, searchTerms?: string[]) => {+ const handleNavigate = useCallback(async (timestamp: string, frameId?: number, searchTerms?: string[], searchResultsJson?: string, searchQuery?: string) => {// Rust command: shows Main, emits navigation event from app handle, closes Search- invoke("search_navigate_to_timeline", { timestamp, frameId, searchTerms }).catch(console.error);+ invoke("search_navigate_to_timeline", { timestamp, frameId, searchTerms, searchResultsJson, searchQuery }).catch(console.error);}, []);const handleClose = useCallback(async () => {diff --git a/apps/screenpipe-app-tauri/components/rewind/search-modal.tsx b/apps/screenpipe-app-tauri/components/rewind/search-modal.tsxindex 754490e1d..972def04b 100644--- a/apps/screenpipe-app-tauri/components/rewind/search-modal.tsx+++ b/apps/screenpipe-app-tauri/components/rewind/search-modal.tsx@@ -40,7 +40,7 @@ interface TaggedFrame {interface SearchModalProps {isOpen: boolean;onClose: () => void;- onNavigateToTimestamp: (timestamp: string, frameId?: number, searchTerms?: string[]) => void;+ onNavigateToTimestamp: (timestamp: string, frameId?: number, searchTerms?: string[], searchResultsJson?: string, searchQuery?: string) => void;embedded?: boolean;/** When true, this is rendered in its own Tauri window (no backdrop, always open) */standalone?: boolean;@@ -1045,9 +1045,10 @@ export function SearchModal({ isOpen, onClose, onNavigateToTimestamp, embedded =// Track which result was selected so timeline arrow keys can cycle from hereconst idx = searchResults.findIndex((r) => r.frame_id === result.frame_id);if (idx >= 0) setCurrentResultIndex(idx);- onNavigateToTimestamp(result.timestamp, result.frame_id, queryTokens);+ const resultsJson = JSON.stringify(searchResults);+ onNavigateToTimestamp(result.timestamp, result.frame_id, queryTokens, resultsJson, searchQuery);onClose();- }, [onNavigateToTimestamp, onClose, queryTokens, setHighlight, searchResults, setCurrentResultIndex]);+ }, [onNavigateToTimestamp, onClose, queryTokens, setHighlight, searchResults, searchQuery, setCurrentResultIndex]);// Keyboard navigation — uses refs for data arrays to avoid re-mounting when results changeuseEffect(() => {@@ -1378,7 +1379,8 @@ export function SearchModal({ isOpen, onClose, onNavigateToTimestamp, embedded =<divkey={frame.frame_id}onClick={() => {- onNavigateToTimestamp(frame.timestamp, frame.frame_id, queryTokens);+ const resultsJson = JSON.stringify(searchResults);+ onNavigateToTimestamp(frame.timestamp, frame.frame_id, queryTokens, resultsJson, searchQuery);if (!embedded) onClose();}}className="cursor-pointer rounded overflow-hidden border border-border hover:border-foreground/50 transition-all duration-150"diff --git a/apps/screenpipe-app-tauri/components/rewind/timeline.tsx b/apps/screenpipe-app-tauri/components/rewind/timeline.tsxindex 0084ffa16..9f3963311 100644--- a/apps/screenpipe-app-tauri/components/rewind/timeline.tsx+++ b/apps/screenpipe-app-tauri/components/rewind/timeline.tsx@@ -910,10 +910,12 @@ export default function Timeline({ embedded = false }: { embedded?: boolean }) {// a fresh fetch and uses pendingNavigationRef to jump once frames arrive.useEffect(() => {let lastHandledTs = "";- const unlisten = listen<{ timestamp: string; frame_id?: number; search_terms?: string[] }>("search-navigate-to-timestamp", (event) => {+ const unlisten = listen<{ timestamp: string; frame_id?: number; search_terms?: string[]; search_results_json?: string; search_query?: string }>("search-navigate-to-timestamp", (event) => {const timestamp = event.payload.timestamp;const frameId = event.payload.frame_id;const searchTerms = event.payload.search_terms;+ const searchResultsJson = event.payload.search_results_json;+ const searchQuery = event.payload.search_query;// Deduplicate — Rust emits multiple times to survive mount raceif (timestamp === lastHandledTs) return;lastHandledTs = timestamp;@@ -921,10 +923,31 @@ export default function Timeline({ embedded = false }: { embedded?: boolean }) {// Set highlight in Main window's store (fixes yellow highlight for standalone search)if (searchTerms && searchTerms.length > 0 && frameId) {setHighlight(searchTerms, frameId);- // Kick off a background search to populate Main's keyword search store- // (enables bottom nav bar for cycling through results)- const query = searchTerms.join(" ");- useKeywordSearchStore.getState().searchKeywords(query);+ }++ // Populate Main's keyword search store with results from Search window+ // (enables bottom nav bar for cycling through results)+ if (searchResultsJson && searchQuery) {+ try {+ const results = JSON.parse(searchResultsJson);+ // Directly set the store state instead of re-running the search+ useKeywordSearchStore.setState({+ searchResults: results,+ searchQuery: searchQuery,+ searchGroups: results.map((m: any) => ({+ representative: m,+ group_size: 1,+ start_time: m.timestamp,+ end_time: m.timestamp,+ frame_ids: [m.frame_id],+ })),+ currentResultIndex: results.findIndex((r: any) => r.frame_id === frameId),+ isSearching: false,+ error: null,+ });+ } catch (e) {+ console.error("failed to parse search results from event", e);+ }}const targetDate = new Date(timestamp);diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lockindex 26480f2ed..3822bb9ff 100644--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock@@ -9299,7 +9299,7 @@ dependencies = [[[package]]name = "screenpipe-app"-version = "2.2.111"+version = "2.2.112"dependencies = ["anyhow","arboard",diff --git a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs b/apps/screenpipe-app-tauri/src-tauri/src/commands.rsindex edd113f42..c11910469 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs@@ -544,6 +544,8 @@ pub async fn search_navigate_to_timeline(timestamp: String,frame_id: Option<i64>,search_terms: Option<Vec<String>>,+ search_results_json: Option<String>,+ search_query: Option<String>,) -> Result<(), String> {// Show the Main timelineShowRewindWindow::Main.show(&app_handle).map_err(|e| e.to_string())?;@@ -559,6 +561,8 @@ pub async fn search_navigate_to_timeline("timestamp": timestamp,"frame_id": frame_id,"search_terms": search_terms,+ "search_results_json": search_results_json,+ "search_query": search_query,}));}tokio::time::sleep(tokio::time::Duration::from_millis(100)).await;