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(timeline): restore daily summary in native controls
Louis Beaumontd741dc4fa517
diff --git a/apps/screenpipe-app-tauri/components/rewind/native-timeline.tsx b/apps/screenpipe-app-tauri/components/rewind/native-timeline.tsxindex fd6a3c835..c3e9cda12 100644--- a/apps/screenpipe-app-tauri/components/rewind/native-timeline.tsx+++ b/apps/screenpipe-app-tauri/components/rewind/native-timeline.tsx@@ -26,6 +26,24 @@ import { getCurrentWindow } from "@tauri-apps/api/window";import { commands } from "@/lib/utils/tauri";import { getApiKey, getApiPort } from "@/lib/api";+import { TimelineDailySummary } from "@/components/rewind/timeline/daily-summary";++export function parseTimelineDay(day: string): Date | null {+ const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(day);+ if (!match) return null;+ const year = Number(match[1]);+ const month = Number(match[2]);+ const date = Number(match[3]);+ const parsed = new Date(year, month - 1, date, 12);+ if (+ parsed.getFullYear() !== year ||+ parsed.getMonth() !== month - 1 ||+ parsed.getDate() !== date+ ) {+ return null;+ }+ return parsed;+}/*** Routes the actions the Swift window cannot perform on its own. Mount once,@@ -36,6 +54,11 @@ import { getApiKey, getApiPort } from "@/lib/api";* silently does nothing.*/export function NativeTimelineBridge() {+ const [dailySummaryRequest, setDailySummaryRequest] = useState<{+ date: Date;+ id: number;+ } | null>(null);+useEffect(() => {const subscriptions = [listen("timeline-open-search", () => {@@ -44,6 +67,14 @@ export function NativeTimelineBridge() {listen("timeline-open-chat", () => {void commands.showWindow("Chat");}),+ listen<string>("timeline-open-daily-summary", (event) => {+ const date = parseTimelineDay(event.payload);+ if (!date) return;+ setDailySummaryRequest((request) => ({+ date,+ id: (request?.id ?? 0) + 1,+ }));+ }),];return () => {for (const subscription of subscriptions) {@@ -52,7 +83,17 @@ export function NativeTimelineBridge() {};}, []);- return null;+ if (!dailySummaryRequest) return null;++ return (+ <TimelineDailySummary+ key={dailySummaryRequest.date.toISOString()}+ currentDate={dailySummaryRequest.date}+ embedded+ hideTrigger+ openRequest={dailySummaryRequest.id}+ />+ );}/**@@ -132,7 +173,7 @@ export function NativeTimeline({ fallback }: { fallback: React.ReactNode }) {// would be behind it. Nothing in the DOM can stack above an AppKit window,// so the window has to get out of the way instead.const OVERLAY_SELECTOR =- '[role="dialog"], [role="alertdialog"], [data-radix-popper-content-wrapper]';+ '[role="dialog"], [role="alertdialog"], [data-radix-popper-content-wrapper], [data-native-timeline-occluder="true"]';let occluded = false;let queued = 0;diff --git a/apps/screenpipe-app-tauri/components/rewind/timeline/daily-summary.test.tsx b/apps/screenpipe-app-tauri/components/rewind/timeline/daily-summary.test.tsxindex 3e7c449e2..adf97d914 100644--- a/apps/screenpipe-app-tauri/components/rewind/timeline/daily-summary.test.tsx+++ b/apps/screenpipe-app-tauri/components/rewind/timeline/daily-summary.test.tsx@@ -198,6 +198,32 @@ describe("TimelineDailySummary", () => {expect(trigger).not.toHaveTextContent("daily summary");});+ it("opens from the native timeline request without rendering a duplicate trigger", async () => {+ const selectedDate = new Date(2026, 6, 25);+ mocks.settings.user = null;+ window.localStorage.setItem(+ dailySummaryCacheKey(selectedDate),+ GENERATED_SUMMARY,+ );++ render(+ <TimelineDailySummary+ currentDate={selectedDate}+ embedded+ hideTrigger+ openRequest={1}+ />,+ );++ expect(+ screen.queryByTestId("timeline-daily-summary-trigger"),+ ).not.toBeInTheDocument();+ const panel = await screen.findByTestId("timeline-daily-summary-panel");+ expect(panel).toHaveAttribute("data-native-timeline-occluder", "true");+ expect(panel).toHaveTextContent("focused implementation session");+ expect(mocks.runDailySummaryWithPi).not.toHaveBeenCalled();+ });+it("keeps wheel navigation inside the summary and closes on outside click", async () => {const selectedDate = new Date(2026, 6, 25);mocks.settings.user = null;diff --git a/apps/screenpipe-app-tauri/components/rewind/timeline/daily-summary.tsx b/apps/screenpipe-app-tauri/components/rewind/timeline/daily-summary.tsxindex cac1f55b9..d7d6bd879 100644--- a/apps/screenpipe-app-tauri/components/rewind/timeline/daily-summary.tsx+++ b/apps/screenpipe-app-tauri/components/rewind/timeline/daily-summary.tsx@@ -129,9 +129,13 @@ export function presentGenerationError(export function TimelineDailySummary({currentDate,embedded = false,+ hideTrigger = false,+ openRequest,}: {currentDate: Date;embedded?: boolean;+ hideTrigger?: boolean;+ openRequest?: number;}) {const { settings, updateSettings } = useSettings();const [summary, setSummary] = useState("");@@ -147,6 +151,7 @@ export function TimelineDailySummary({const abortRef = useRef<AbortController | null>(null);const triggerRef = useRef<HTMLButtonElement | null>(null);const panelRef = useRef<HTMLElement | null>(null);+ const handledOpenRequestRef = useRef<number | undefined>(undefined);const dateId = format(currentDate, "yyyy-MM-dd");const enhancedAI = settings?.enhancedAI ?? false;const userToken = settings?.user?.token ?? "";@@ -260,17 +265,20 @@ export function TimelineDailySummary({[currentDate, dailySummaryPreset, dateId, userToken],);- const handleTriggerClick = () => {+ const handleTriggerClick = useCallback(() => {+ const cachedSummary = summary || readCachedSummary(currentDate);posthog.capture("timeline_daily_summary_clicked", {selected_date: dateId,enhanced_ai_enabled: enhancedAI,- has_cached_summary: Boolean(summary),+ has_cached_summary: Boolean(cachedSummary),});// Cached summaries are local output. Keep them readable if the user later// disables Enhanced AI or signs out; only a new generation needs consent// and an authenticated model session.- if (summary) {+ if (cachedSummary) {+ setSummary(cachedSummary);+ setStatus("complete");setPanelOpen(true);return;}@@ -290,7 +298,17 @@ export function TimelineDailySummary({}void generate();- };+ }, [currentDate, dateId, enhancedAI, generate, isGenerating, summary, userToken]);++ useEffect(() => {+ if (+ openRequest === undefined ||+ handledOpenRequestRef.current === openRequest+ )+ return;+ handledOpenRequestRef.current = openRequest;+ handleTriggerClick();+ }, [handleTriggerClick, openRequest]);const handleEnableAndGenerate = async () => {if (!userToken) {@@ -384,45 +402,48 @@ export function TimelineDailySummary({return (<>- <TooltipProvider delayDuration={200}>- <Tooltip>- <TooltipTrigger asChild>- <button- ref={triggerRef}- type="button"- data-testid="timeline-daily-summary-trigger"- onClick={handleTriggerClick}- className={cn(- "group relative flex h-10 w-10 shrink-0 items-center justify-center border border-border bg-background text-foreground transition-colors duration-150 hover:bg-foreground hover:text-background",- panelOpen && "bg-foreground text-background",- )}- aria-label={tooltipText}- aria-expanded={panelOpen}- >- {isGenerating ? (- <Loader2 className="h-4 w-4 animate-spin" />- ) : (- <span className="relative">- <CalendarDays className="h-4 w-4" />- <Sparkles className="absolute -right-1.5 -top-1.5 h-2.5 w-2.5 fill-current" />- </span>- )}- {summary && !isGenerating && (- <span className="absolute -right-1 -top-1 h-2.5 w-2.5 border-2 border-background bg-foreground" />- )}- </button>- </TooltipTrigger>- <TooltipContent side="bottom" className="font-mono text-xs">- {tooltipText}- </TooltipContent>- </Tooltip>- </TooltipProvider>+ {!hideTrigger && (+ <TooltipProvider delayDuration={200}>+ <Tooltip>+ <TooltipTrigger asChild>+ <button+ ref={triggerRef}+ type="button"+ data-testid="timeline-daily-summary-trigger"+ onClick={handleTriggerClick}+ className={cn(+ "group relative flex h-10 w-10 shrink-0 items-center justify-center border border-border bg-background text-foreground transition-colors duration-150 hover:bg-foreground hover:text-background",+ panelOpen && "bg-foreground text-background",+ )}+ aria-label={tooltipText}+ aria-expanded={panelOpen}+ >+ {isGenerating ? (+ <Loader2 className="h-4 w-4 animate-spin" />+ ) : (+ <span className="relative">+ <CalendarDays className="h-4 w-4" />+ <Sparkles className="absolute -right-1.5 -top-1.5 h-2.5 w-2.5 fill-current" />+ </span>+ )}+ {summary && !isGenerating && (+ <span className="absolute -right-1 -top-1 h-2.5 w-2.5 border-2 border-background bg-foreground" />+ )}+ </button>+ </TooltipTrigger>+ <TooltipContent side="bottom" className="font-mono text-xs">+ {tooltipText}+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>+ )}<AnimatePresence>{panelOpen && (<motion.asideref={panelRef}data-testid="timeline-daily-summary-panel"+ data-native-timeline-occluder="true"className={cn("ai-panel fixed right-5 z-[150] flex max-h-[min(620px,calc(100vh-112px))] w-[min(420px,calc(100vw-32px))] flex-col overflow-hidden border border-border bg-background/95 text-foreground shadow-lg shadow-black/5 backdrop-blur-xl",embeddeddiff --git a/apps/screenpipe-app-tauri/src-tauri/src/commands/native_actions.rs b/apps/screenpipe-app-tauri/src-tauri/src/commands/native_actions.rsindex d810cc824..e4de37d91 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/commands/native_actions.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/commands/native_actions.rs@@ -194,6 +194,9 @@ fn native_timeline_action_callback_inner(action_ptr: *const std::os::raw::c_charTimelineAction::OpenSearch => {let _ = app.emit("timeline-open-search", ());}+ TimelineAction::OpenDailySummary { date } => {+ let _ = app.emit("timeline-open-daily-summary", date);+ }TimelineAction::OpenChat => {let _ = app.emit("timeline-open-chat", ());}diff --git a/apps/screenpipe-app-tauri/src-tauri/src/native_timeline.rs b/apps/screenpipe-app-tauri/src-tauri/src/native_timeline.rsindex f7ee281ee..324e1624e 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/native_timeline.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/native_timeline.rs@@ -102,6 +102,7 @@ use serde::{Deserialize, Serialize};pub enum TimelineAction {CloseWindow,OpenSearch,+ OpenDailySummary { date: String },OpenChat,OpenRecordingSettings,CopyFrame { frame_id: String },@@ -123,6 +124,9 @@ impl TimelineAction {match (name, argument) {("close_window", _) => Self::CloseWindow,("open_search", _) => Self::OpenSearch,+ ("open_daily_summary", Some(date)) => Self::OpenDailySummary {+ date: date.to_string(),+ },("open_chat", _) => Self::OpenChat,("open_recording_settings", _) => Self::OpenRecordingSettings,("copy_frame", Some(id)) => Self::CopyFrame {@@ -263,6 +267,12 @@ mod tests {#[test]fn parses_actions_with_arguments() {+ assert_eq!(+ TimelineAction::parse("open_daily_summary:2026-08-16"),+ TimelineAction::OpenDailySummary {+ date: "2026-08-16".to_string()+ }+ );assert_eq!(TimelineAction::parse("copy_frame:12345"),TimelineAction::CopyFrame {@@ -301,6 +311,12 @@ mod tests {#[test]fn an_argument_action_without_its_argument_is_unknown() {+ assert_eq!(+ TimelineAction::parse("open_daily_summary"),+ TimelineAction::Unknown {+ raw: "open_daily_summary".to_string()+ }+ );assert_eq!(TimelineAction::parse("copy_frame"),TimelineAction::Unknown {diff --git a/apps/screenpipe-app-tauri/src-tauri/swift/timeline/TimelineViews.swift b/apps/screenpipe-app-tauri/src-tauri/swift/timeline/TimelineViews.swiftindex bbb32a821..d92a9566c 100644--- a/apps/screenpipe-app-tauri/src-tauri/swift/timeline/TimelineViews.swift+++ b/apps/screenpipe-app-tauri/src-tauri/swift/timeline/TimelineViews.swift@@ -398,6 +398,7 @@ struct TimelineControlBar: View {var body: some View {HStack(spacing: 8) {dateGroup+ dailySummaryActionif model.hasAudioNearby { playbackGroup }searchActionif !embedded { chatAction }@@ -488,6 +489,25 @@ struct TimelineControlBar: View {: String(model.playbackSpeed)}+ private var dailySummaryAction: some View {+ Button {+ let date = model.currentTimestamp ?? model.currentDate+ TimelineActionBridge.shared.emit(+ "open_daily_summary:\(TimelineDateNavigation.dayKey(date))"+ )+ } label: {+ ZStack(alignment: .topTrailing) {+ Image(systemName: "calendar")+ Image(systemName: "sparkles")+ .font(.system(size: 7, weight: .bold))+ .offset(x: 4, y: -4)+ }+ }+ .buttonStyle(TimelineControlStyle())+ .accessibilityLabel("daily summary")+ .help("Generate a summary for this day")+ }+private var searchAction: some View {Button { TimelineActionBridge.shared.emit("open_search") } label: {HStack(spacing: 6) {diff --git a/apps/screenpipe-app-tauri/src-tauri/swift/timeline_interaction_tests.swift b/apps/screenpipe-app-tauri/src-tauri/swift/timeline_interaction_tests.swiftindex 6de4e98c7..054185610 100644--- a/apps/screenpipe-app-tauri/src-tauri/swift/timeline_interaction_tests.swift+++ b/apps/screenpipe-app-tauri/src-tauri/swift/timeline_interaction_tests.swift@@ -292,6 +292,18 @@ private func testControlBarButtonsRespond(window: NSWindow, model: TimelineViewMexpect(actionable.count == buttons.count,"every button must expose a press action, \(buttons.count - actionable.count) did not")+ if let dailySummary = buttons.first(where: { $0.label == "daily summary" }) {+ _ = TimelineActionBridge.shared.drainEmitted()+ press(dailySummary)+ let actions = TimelineActionBridge.shared.drainEmitted()+ expect(actions.contains { $0.range(+ of: #"^open_daily_summary:\d{4}-\d{2}-\d{2}$"#,+ options: .regularExpression+ ) != nil }, "the daily summary control must send its selected local day, got \(actions)")+ } else {+ failures.append("the daily summary control is missing")+ }+if let captions = buttons.first(where: { $0.label == "hide captions" }) {model.showSubtitles = truepress(captions)