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

feat: daily summary in timeline via Apple Intelligence

Louis Beaumontf9790b15bb5f
diff --git a/Cargo.lock b/Cargo.lock
index 7b89f8663..11b8cfe12 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6642,7 +6642,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio"
-version = "0.3.109"
+version = "0.3.112"
dependencies = [
"anyhow",
"bytemuck",
@@ -6695,7 +6695,7 @@ dependencies = [
[[package]]
name = "screenpipe-core"
-version = "0.3.109"
+version = "0.3.112"
dependencies = [
"accessibility",
"accessibility-sys",
@@ -6746,7 +6746,7 @@ dependencies = [
[[package]]
name = "screenpipe-db"
-version = "0.3.109"
+version = "0.3.112"
dependencies = [
"anyhow",
"chrono",
@@ -6770,7 +6770,7 @@ dependencies = [
[[package]]
name = "screenpipe-events"
-version = "0.3.109"
+version = "0.3.112"
dependencies = [
"anyhow",
"chrono",
@@ -6788,7 +6788,7 @@ dependencies = [
[[package]]
name = "screenpipe-integrations"
-version = "0.3.109"
+version = "0.3.112"
dependencies = [
"anyhow",
"image",
@@ -6803,7 +6803,7 @@ dependencies = [
[[package]]
name = "screenpipe-server"
-version = "0.3.109"
+version = "0.3.112"
dependencies = [
"anyhow",
"async-trait",
@@ -6873,7 +6873,7 @@ dependencies = [
[[package]]
name = "screenpipe-vision"
-version = "0.3.109"
+version = "0.3.112"
dependencies = [
"accessibility-sys",
"anyhow",
diff --git a/Cargo.toml b/Cargo.toml
index fa7d0c8f4..e4f7cc49a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,7 +6,7 @@ exclude = ["apps/screenpipe-app-tauri/src-tauri"]
resolver = "2"
[workspace.package]
-version = "0.3.112"
+version = "0.3.113"
authors = ["louis030195 <[email protected]>"]
description = ""
repository = "https://github.com/screenpipe/screenpipe"
diff --git a/apps/screenpipe-app-tauri/components/rewind/daily-summary.tsx b/apps/screenpipe-app-tauri/components/rewind/daily-summary.tsx
new file mode 100644
index 000000000..dc0b9866b
--- /dev/null
+++ b/apps/screenpipe-app-tauri/components/rewind/daily-summary.tsx
@@ -0,0 +1,566 @@
+"use client";
+
+import React, { useState, useEffect, useCallback, useRef } from "react";
+import {
+ Loader2,
+ Sparkles,
+ ChevronDown,
+ ChevronUp,
+ Copy,
+ Check,
+ X,
+} from "lucide-react";
+import { platform } from "@tauri-apps/plugin-os";
+import { Command } from "@tauri-apps/plugin-shell";
+
+const API = "http://localhost:3030";
+
+interface DailySummary {
+ date: string; // YYYY-MM-DD
+ generatedAt: string;
+ timeBreakdown: { app: string; minutes: number }[];
+ keyMoments: { time: string; description: string }[];
+ actionItems: { text: string; urgency: "high" | "medium" | "low" }[];
+ peopleMentioned: { name: string; context: string }[];
+ oneLiner: string;
+}
+
+const SUMMARY_PROMPT = `Analyze this screen activity and audio data. Output ONLY valid JSON, no other text.
+{
+ "timeBreakdown": [{"app": "VS Code", "minutes": 120}],
+ "keyMoments": [{"time": "2:30 PM", "description": "Merged PR #42"}],
+ "actionItems": [{"text": "Review draft by Friday", "urgency": "high"}],
+ "peopleMentioned": [{"name": "Dan", "context": "discussed pricing"}],
+ "oneLiner": "Mostly coding with a quick meeting about pricing"
+}
+Rules:
+- timeBreakdown: top 5 apps by usage, estimate minutes from context
+- keyMoments: max 5, most important events
+- actionItems: things to do, "high"/"medium"/"low" urgency
+- peopleMentioned: real people names only, not apps
+- oneLiner: casual 1-sentence summary of the day
+- If not enough data, use fewer items. Empty arrays are fine.`;
+
+function getStorageKey(date: string) {
+ return `daily-summary-${date}`;
+}
+
+function loadSummary(date: string): DailySummary | null {
+ try {
+ const raw = localStorage?.getItem(getStorageKey(date));
+ if (raw) return JSON.parse(raw);
+ } catch {}
+ return null;
+}
+
+function saveSummary(summary: DailySummary) {
+ try {
+ localStorage?.setItem(getStorageKey(summary.date), JSON.stringify(summary));
+ } catch {}
+}
+
+function isAppleIntelligenceEnabled(): boolean {
+ try {
+ return localStorage?.getItem("apple-intelligence-enabled") !== "false";
+ } catch {
+ return true;
+ }
+}
+
+function formatDate(dateStr: string): string {
+ const d = new Date(dateStr + "T12:00:00");
+ return d.toLocaleDateString("en-US", {
+ weekday: "long",
+ month: "long",
+ day: "numeric",
+ });
+}
+
+async function isPluggedIn(): Promise<boolean> {
+ try {
+ const os = platform();
+ if (os !== "macos") return true; // assume plugged in on non-mac
+
+ const cmd = Command.create("exec-sh", [
+ "-c",
+ "pmset -g batt | head -1",
+ ]);
+ const output = await cmd.execute();
+ return output.stdout.includes("AC Power");
+ } catch {
+ return true; // assume plugged in if detection fails
+ }
+}
+
+async function checkAiAvailable(): Promise<boolean> {
+ try {
+ const resp = await fetch(`${API}/ai/status`, {
+ signal: AbortSignal.timeout(2000),
+ });
+ if (!resp.ok) return false;
+ const data = await resp.json();
+ return data.available === true;
+ } catch {
+ return false;
+ }
+}
+
+// ─── Component ──────────────────────────────────────────────────────────────
+
+export function DailySummaryCard({
+ currentDate,
+}: {
+ currentDate: Date;
+}) {
+ const [summary, setSummary] = useState<DailySummary | null>(null);
+ const [isGenerating, setIsGenerating] = useState(false);
+ const [isExpanded, setIsExpanded] = useState(false);
+ const [copied, setCopied] = useState(false);
+ const [aiAvailable, setAiAvailable] = useState(false);
+ const [isVisible, setIsVisible] = useState(false);
+ const [error, setError] = useState<string | null>(null);
+ const autoTriggeredRef = useRef<string>("");
+
+ const dateStr =
+ currentDate.getFullYear() +
+ "-" +
+ String(currentDate.getMonth() + 1).padStart(2, "0") +
+ "-" +
+ String(currentDate.getDate()).padStart(2, "0");
+
+ // Check AI availability
+ useEffect(() => {
+ const os = platform();
+ if (os !== "macos") return;
+
+ checkAiAvailable().then((available) => {
+ setAiAvailable(available);
+ setIsVisible(available && isAppleIntelligenceEnabled());
+ });
+ }, []);
+
+ // Load cached summary when date changes
+ useEffect(() => {
+ const cached = loadSummary(dateStr);
+ setSummary(cached);
+ setIsExpanded(false);
+ setError(null);
+ }, [dateStr]);
+
+ // Auto-trigger at 6pm for today
+ useEffect(() => {
+ if (!aiAvailable || !isVisible) return;
+
+ const checkAutoTrigger = async () => {
+ const now = new Date();
+ const todayStr =
+ now.getFullYear() +
+ "-" +
+ String(now.getMonth() + 1).padStart(2, "0") +
+ "-" +
+ String(now.getDate()).padStart(2, "0");
+
+ // Only auto-trigger for today, after 6pm, once per day
+ if (dateStr !== todayStr) return;
+ if (now.getHours() < 18) return;
+ if (autoTriggeredRef.current === todayStr) return;
+ if (loadSummary(todayStr)) return;
+
+ // Check if plugged in
+ const plugged = await isPluggedIn();
+ if (!plugged) return;
+
+ autoTriggeredRef.current = todayStr;
+ generateSummary();
+ };
+
+ checkAutoTrigger();
+ const interval = setInterval(checkAutoTrigger, 60000); // check every minute
+ return () => clearInterval(interval);
+ }, [aiAvailable, isVisible, dateStr]);
+
+ // ─── Generate Summary ───────────────────────────────────────────────────
+
+ const generateSummary = useCallback(async () => {
+ if (isGenerating) return;
+ setIsGenerating(true);
+ setError(null);
+
+ try {
+ // Check power state
+ const plugged = await isPluggedIn();
+ if (!plugged) {
+ setError("Waiting for power — summaries only generate when plugged in");
+ return;
+ }
+
+ // Fetch the day's data
+ const dayStart = new Date(dateStr + "T00:00:00");
+ const dayEnd = new Date(dateStr + "T23:59:59");
+ const now = new Date();
+ const endTime = dayEnd > now ? now : dayEnd;
+
+ const params = new URLSearchParams({
+ content_type: "all",
+ start_time: dayStart.toISOString(),
+ end_time: endTime.toISOString(),
+ limit: "100",
+ min_length: "20",
+ });
+
+ const searchResp = await fetch(`${API}/search?${params}`);
+ if (!searchResp.ok) throw new Error("Failed to fetch data");
+ const searchData = await searchResp.json();
+
+ // Build context
+ const parts: string[] = [];
+ for (const item of searchData.data || []) {
+ if (item.type === "OCR") {
+ const c = item.content;
+ const text = c?.text?.trim();
+ if (text) {
+ const time = new Date(c.timestamp).toLocaleTimeString("en-US", {
+ hour: "numeric",
+ minute: "2-digit",
+ });
+ parts.push(`[${time}] [${c.app_name || "?"}] ${text}`);
+ }
+ } else if (item.type === "Audio") {
+ const c = item.content;
+ const text = c?.transcription?.trim();
+ if (text) {
+ const time = new Date(c.timestamp).toLocaleTimeString("en-US", {
+ hour: "numeric",
+ minute: "2-digit",
+ });
+ parts.push(`[${time}] [Audio] ${text}`);
+ }
+ }
+ }
+
+ if (parts.length === 0) {
+ setError("No activity data for this day");
+ return;
+ }
+
+ // Truncate to ~1500 chars
+ let context = parts.join("\n");
+ if (context.length > 1500) context = context.slice(0, 1500);
+
+ // Call AI
+ const aiResp = await fetch(`${API}/ai/chat/completions`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({
+ messages: [
+ { role: "system", content: SUMMARY_PROMPT },
+ { role: "user", content: context },
+ ],
+ }),
+ });
+
+ if (!aiResp.ok) throw new Error(`AI error: ${aiResp.status}`);
+
+ const aiData = await aiResp.json();
+ let raw = aiData.choices?.[0]?.message?.content || "{}";
+
+ // Strip markdown fences
+ raw = raw.trim();
+ if (raw.startsWith("```")) {
+ raw = raw
+ .split("\n")
+ .slice(1)
+ .filter((l: string) => !l.startsWith("```"))
+ .join("\n");
+ }
+
+ const parsed = JSON.parse(raw);
+
+ const newSummary: DailySummary = {
+ date: dateStr,
+ generatedAt: new Date().toISOString(),
+ timeBreakdown: parsed.timeBreakdown || [],
+ keyMoments: parsed.keyMoments || [],
+ actionItems: (parsed.actionItems || []).map((a: any) => ({
+ text: a.text || a.task || "",
+ urgency: ["high", "medium", "low"].includes(a.urgency)
+ ? a.urgency
+ : "medium",
+ })),
+ peopleMentioned: parsed.peopleMentioned || [],
+ oneLiner: parsed.oneLiner || "No summary available",
+ };
+
+ saveSummary(newSummary);
+ setSummary(newSummary);
+ setIsExpanded(true);
+ } catch (e) {
+ setError(e instanceof Error ? e.message : "Failed to generate summary");
+ } finally {
+ setIsGenerating(false);
+ }
+ }, [isGenerating, dateStr]);
+
+ // ─── Copy ───────────────────────────────────────────────────────────────
+
+ const copySummary = () => {
+ if (!summary) return;
+ const lines = [
+ `# ${formatDate(summary.date)}`,
+ "",
+ summary.oneLiner,
+ "",
+ ];
+
+ if (summary.timeBreakdown.length > 0) {
+ lines.push("## Time");
+ for (const t of summary.timeBreakdown) {
+ const h = Math.floor(t.minutes / 60);
+ const m = t.minutes % 60;
+ lines.push(
+ `- ${t.app}: ${h > 0 ? h + "h " : ""}${m > 0 ? m + "m" : ""}`
+ );
+ }
+ lines.push("");
+ }
+
+ if (summary.keyMoments.length > 0) {
+ lines.push("## Key Moments");
+ for (const k of summary.keyMoments)
+ lines.push(`- ${k.time} — ${k.description}`);
+ lines.push("");
+ }
+
+ if (summary.actionItems.length > 0) {
+ lines.push("## Action Items");
+ for (const a of summary.actionItems) {
+ const icon = a.urgency === "high" ? "⚡" : a.urgency === "medium" ? "●" : "○";
+ lines.push(`- ${icon} ${a.text}`);
+ }
+ lines.push("");
+ }
+
+ if (summary.peopleMentioned.length > 0) {
+ lines.push("## People");
+ for (const p of summary.peopleMentioned)
+ lines.push(`- ${p.name} — ${p.context}`);
+ }
+
+ navigator.clipboard.writeText(lines.join("\n"));
+ setCopied(true);
+ setTimeout(() => setCopied(false), 2000);
+ };
+
+ // ─── Render ─────────────────────────────────────────────────────────────
+
+ if (!isVisible) return null;
+
+ const urgencyIcon = (u: string) =>
+ u === "high" ? "⚡" : u === "medium" ? "●" : "○";
+ const urgencyColor = (u: string) =>
+ u === "high"
+ ? "text-orange-400"
+ : u === "medium"
+ ? "text-yellow-400"
+ : "text-muted-foreground";
+
+ return (
+ <div className="w-72 backdrop-blur-xl bg-black/60 border border-white/10 rounded-xl overflow-hidden shadow-2xl">
+ {/* Header — always visible */}
+ <button
+ onClick={() => {
+ if (summary) {
+ setIsExpanded(!isExpanded);
+ } else {
+ generateSummary();
+ }
+ }}
+ className="w-full flex items-center gap-2.5 px-3 py-2.5 hover:bg-white/5 transition-colors"
+ >
+ <img
+ src="/apple-intelligence-logo.svg"
+ alt=""
+ className="w-5 h-5 rounded flex-shrink-0"
+ />
+ <div className="flex-1 min-w-0 text-left">
+ {isGenerating ? (
+ <div className="flex items-center gap-1.5">
+ <Loader2 className="h-3 w-3 animate-spin text-white/60" />
+ <span className="text-xs text-white/60">
+ generating summary...
+ </span>
+ </div>
+ ) : summary ? (
+ <p className="text-xs text-white/90 truncate">{summary.oneLiner}</p>
+ ) : (
+ <p className="text-xs text-white/50">
+ tap to generate daily summary
+ </p>
+ )}
+ </div>
+ {summary && (
+ <div className="flex-shrink-0">
+ {isExpanded ? (
+ <ChevronUp className="h-3 w-3 text-white/40" />
+ ) : (
+ <ChevronDown className="h-3 w-3 text-white/40" />
+ )}
+ </div>
+ )}
+ </button>
+
+ {/* Error */}
+ {error && (
+ <div className="px-3 py-1.5 border-t border-white/5">
+ <div className="flex items-center gap-1.5">
+ <span className="text-[10px] text-red-400 truncate flex-1">
+ {error}
+ </span>
+ <button onClick={() => setError(null)}>
+ <X className="h-2.5 w-2.5 text-white/30" />
+ </button>
+ </div>
+ </div>
+ )}
+
+ {/* Expanded content */}
+ {summary && isExpanded && (
+ <div className="border-t border-white/10 max-h-[50vh] overflow-y-auto">
+ {/* Time breakdown */}
+ {summary.timeBreakdown.length > 0 && (
+ <div className="px-3 py-2 border-b border-white/5">
+ <p className="text-[10px] text-white/40 uppercase tracking-wider mb-1.5">
+ time
+ </p>
+ <div className="space-y-1">
+ {summary.timeBreakdown.map((t, i) => {
+ const maxMin = Math.max(
+ ...summary.timeBreakdown.map((x) => x.minutes)
+ );
+ const pct = maxMin > 0 ? (t.minutes / maxMin) * 100 : 0;
+ const h = Math.floor(t.minutes / 60);
+ const m = t.minutes % 60;
+ return (
+ <div key={i} className="flex items-center gap-2">
+ <span className="text-[10px] text-white/60 w-16 truncate">
+ {t.app}
+ </span>
+ <div className="flex-1 h-1.5 bg-white/5 rounded-full overflow-hidden">
+ <div
+ className="h-full bg-white/30 rounded-full"
+ style={{ width: `${pct}%` }}
+ />
+ </div>
+ <span className="text-[10px] text-white/40 w-10 text-right">
+ {h > 0 ? `${h}h` : ""}{m > 0 ? `${m}m` : ""}
+ </span>
+ </div>
+ );
+ })}
+ </div>
+ </div>
+ )}
+
+ {/* Key moments */}
+ {summary.keyMoments.length > 0 && (
+ <div className="px-3 py-2 border-b border-white/5">
+ <p className="text-[10px] text-white/40 uppercase tracking-wider mb-1.5">
+ key moments
+ </p>
+ <div className="space-y-1">
+ {summary.keyMoments.map((k, i) => (
+ <div key={i} className="flex gap-2">
+ <span className="text-[10px] text-white/40 w-14 flex-shrink-0">
+ {k.time}
+ </span>
+ <span className="text-[10px] text-white/80">
+ {k.description}
+ </span>
+ </div>
+ ))}
+ </div>
+ </div>
+ )}
+
+ {/* Action items */}
+ {summary.actionItems.length > 0 && (
+ <div className="px-3 py-2 border-b border-white/5">
+ <p className="text-[10px] text-white/40 uppercase tracking-wider mb-1.5">
+ action items
+ </p>
+ <div className="space-y-1">
+ {summary.actionItems.map((a, i) => (
+ <div key={i} className="flex items-start gap-1.5">
+ <span
+ className={`text-[10px] mt-px ${urgencyColor(a.urgency)}`}
+ >
+ {urgencyIcon(a.urgency)}
+ </span>
+ <span className="text-[10px] text-white/80">{a.text}</span>
+ </div>
+ ))}
+ </div>
+ </div>
+ )}
+
+ {/* People */}
+ {summary.peopleMentioned.length > 0 && (
+ <div className="px-3 py-2 border-b border-white/5">
+ <p className="text-[10px] text-white/40 uppercase tracking-wider mb-1.5">
+ people
+ </p>
+ <div className="space-y-1">
+ {summary.peopleMentioned.map((p, i) => (
+ <div key={i} className="flex gap-1.5">
+ <span className="text-[10px] text-white/70 font-medium">
+ {p.name}
+ </span>
+ <span className="text-[10px] text-white/40">
+ — {p.context}
+ </span>
+ </div>
+ ))}
+ </div>
+ </div>
+ )}
+
+ {/* Footer */}
+ <div className="px-3 py-2 flex items-center justify-between">
+ <span className="text-[9px] text-white/30">
+ {new Date(summary.generatedAt).toLocaleTimeString("en-US", {
+ hour: "numeric",
+ minute: "2-digit",
+ })}
+ {" · on-device"}
+ </span>
+ <div className="flex items-center gap-1">
+ <button
+ onClick={(e) => {
+ e.stopPropagation();
+ generateSummary();
+ }}
+ className="px-2 py-0.5 text-[9px] text-white/40 hover:text-white/70 transition-colors"
+ title="Regenerate"
+ >
+ ↻
+ </button>
+ <button
+ onClick={(e) => {
+ e.stopPropagation();
+ copySummary();
+ }}
+ className="px-2 py-0.5 text-[9px] text-white/40 hover:text-white/70 transition-colors"
+ >
+ {copied ? (
+ <Check className="h-2.5 w-2.5 inline" />
+ ) : (
+ <Copy className="h-2.5 w-2.5 inline" />
+ )}
+ </button>
+ </div>
+ </div>
+ </div>
+ )}
+ </div>
+ );
+}
diff --git a/apps/screenpipe-app-tauri/components/rewind/timeline.tsx b/apps/screenpipe-app-tauri/components/rewind/timeline.tsx
index a42e27602..1f1a18ef2 100644
--- a/apps/screenpipe-app-tauri/components/rewind/timeline.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/timeline.tsx
@@ -18,6 +18,7 @@ import { hasFramesForDate } from "@/lib/actions/has-frames-date";
import { CurrentFrameTimeline } from "@/components/rewind/current-frame-timeline";
import posthog from "posthog-js";
+import { DailySummaryCard } from "@/components/rewind/daily-summary";
export interface StreamTimeSeriesResponse {
timestamp: string;
@@ -1095,6 +1096,11 @@ export default function Timeline() {
</div>
</div>
+ {/* Daily Summary — top right, below controls */}
+ <div className="absolute top-[calc(env(safe-area-inset-top)+56px)] right-4 z-40">
+ <DailySummaryCard currentDate={currentDate} />
+ </div>
+
{/* Loading/Error States - Progressive loading: only block when no frames yet */}
{showBlockingLoader && (
<div className="absolute inset-0 z-50 flex items-center justify-center bg-background/90">
diff --git a/apps/screenpipe-app-tauri/components/settings/apple-intelligence-card.tsx b/apps/screenpipe-app-tauri/components/settings/apple-intelligence-card.tsx
index eba28b188..2c28dea17 100644
--- a/apps/screenpipe-app-tauri/components/settings/apple-intelligence-card.tsx
+++ b/apps/screenpipe-app-tauri/components/settings/apple-intelligence-card.tsx
@@ -2,105 +2,39 @@
import React, { useState, useEffect, useCallback } from "react";
import { Card, CardContent } from "@/components/ui/card";
-import { Button } from "@/components/ui/button";
-import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from "@/components/ui/select";
+import { Switch } from "@/components/ui/switch";
import { Label } from "@/components/ui/label";
-import {
- Collapsible,
- CollapsibleContent,
- CollapsibleTrigger,
-} from "@/components/ui/collapsible";
-import {
- Loader2,
- ChevronDown,
- ChevronRight,
- Copy,
- Check,
- AlertCircle,
- Sparkles,
- X,
- Trash2,
-} from "lucide-react";
-import { Badge } from "@/components/ui/badge";
-import { useToast } from "@/components/ui/use-toast";
+import { AlertCircle } from "lucide-react";
import { platform } from "@tauri-apps/plugin-os";
-// Apple Intelligence logo — loaded from static asset
-
-// ─── Types ──────────────────────────────────────────────────────────────────
-
-interface TodoItem {
- text: string;
- app?: string;
- urgency: "low" | "medium" | "high";
-}
-
const API = "http://localhost:3030";
-const SYSTEM_PROMPT = `Extract action items as JSON. Output ONLY a JSON array, nothing else.
-Each item must have exactly these fields: "text" (string), "app" (string), "urgency" (one of: "high", "medium", "low").
-Example: [{"text":"Review PR #42","app":"GitHub","urgency":"high"}]
-If no action items, output: []`;
-
-// ─── Component ──────────────────────────────────────────────────────────────
-
export function AppleIntelligenceCard() {
- const { toast } = useToast();
const [os, setOs] = useState<string>("");
- const [isExpanded, setIsExpanded] = useState(false);
const [aiStatus, setAiStatus] = useState<
"unknown" | "available" | "unavailable"
>("unknown");
- const [isExtracting, setIsExtracting] = useState(false);
- const [todos, setTodos] = useState<TodoItem[]>([]);
- const [todosOpen, setTodosOpen] = useState(true);
- const [lastRun, setLastRun] = useState<Date | null>(null);
- const [error, setError] = useState<string | null>(null);
- const [copied, setCopied] = useState(false);
- const [lookbackMinutes, setLookbackMinutes] = useState(30);
+ const [enabled, setEnabled] = useState(true);
useEffect(() => {
setOs(platform());
}, []);
- // Load cached results
+ // Load enabled state
useEffect(() => {
try {
- const saved = localStorage?.getItem("apple-intelligence-todos");
- if (saved) {
- const parsed = JSON.parse(saved);
- setTodos(parsed.items || []);
- if (parsed.lastRun) setLastRun(new Date(parsed.lastRun));
- }
- const lb = localStorage?.getItem("apple-intelligence-lookback");
- if (lb) setLookbackMinutes(parseInt(lb));
+ const stored = localStorage?.getItem("apple-intelligence-enabled");
+ if (stored !== null) setEnabled(stored !== "false");
} catch {}
}, []);
- // Persist
- useEffect(() => {
+ // Save enabled state
+ const toggleEnabled = (val: boolean) => {
+ setEnabled(val);
try {
- localStorage?.setItem(
- "apple-intelligence-todos",
- JSON.stringify({ items: todos, lastRun: lastRun?.toISOString() })
- );
+ localStorage?.setItem("apple-intelligence-enabled", String(val));
} catch {}
- }, [todos, lastRun]);
-
- useEffect(() => {
- try {
- localStorage?.setItem(
- "apple-intelligence-lookback",
- String(lookbackMinutes)
- );
- } catch {}
- }, [lookbackMinutes]);
+ };
// Check AI availability
const checkStatus = useCallback(async () => {
@@ -125,146 +59,6 @@ export function AppleIntelligenceCard() {
return () => clearInterval(interval);
}, [checkStatus]);
- // ─── Extract TODOs ──────────────────────────────────────────────────────
-
- const runExtraction = async () => {
- if (isExtracting || aiStatus !== "available") return;
- setIsExtracting(true);
- setError(null);
-
- try {
- // 1. Fetch recent data from screenpipe
- const now = new Date();
- const start = new Date(now.getTime() - lookbackMinutes * 60 * 1000);
- const params = new URLSearchParams({
- content_type: "all",
- start_time: start.toISOString(),
- end_time: now.toISOString(),
- limit: "50",
- min_length: "20",
- });
-
- const searchResp = await fetch(`${API}/search?${params}`);
- if (!searchResp.ok) throw new Error("Failed to fetch screenpipe data");
- const searchData = await searchResp.json();
-
- // 2. Build context string from results
- const parts: string[] = [];
- for (const item of searchData.data || []) {
- if (item.type === "OCR") {
- const c = item.content;
- const text = c?.text?.trim();
- if (text) parts.push(`[${c.app_name || "?"}] ${text}`);
- } else if (item.type === "Audio") {
- const c = item.content;
- const text = c?.transcription?.trim();
- if (text) parts.push(`[Audio] ${text}`);
- }
- }
-
- if (parts.length === 0) {
- setError("No recent data found");
- return;
- }
-
- // 3. Truncate to fit model context (~1500 chars for content)
- let context = parts.join("\n");
- if (context.length > 1500) {
- context = context.slice(0, 1500);
- }
-
- // 4. Single call to generic AI endpoint
- const aiResp = await fetch(`${API}/ai/chat/completions`, {
- method: "POST",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify({
- messages: [
- { role: "system", content: SYSTEM_PROMPT },
- { role: "user", content: context },
- ],
- }),
- });
-
- if (!aiResp.ok) {
- const err = await aiResp.json().catch(() => ({}));
- throw new Error(err.error || `AI error: ${aiResp.status}`);
- }
-
- const aiData = await aiResp.json();
- const raw = aiData.choices?.[0]?.message?.content || "[]";
-
- // 5. Parse JSON (strip markdown fences if present)
- let jsonStr = raw.trim();
- if (jsonStr.startsWith("```")) {
- jsonStr = jsonStr
- .split("\n")
- .slice(1)
- .filter((l: string) => !l.startsWith("```"))
- .join("\n");
- }
-
- const rawItems: any[] = JSON.parse(jsonStr);
- // Normalize — model sometimes uses "task"/"category" instead of "text"/"app"
- const valid: TodoItem[] = rawItems
- .map((t: any) => ({
- text: t.text || t.task || t.action || t.item || "",
- app: t.app || t.category || t.source || "",
- urgency: (["high", "medium", "low"].includes(t.urgency)
- ? t.urgency
- : "medium") as "high" | "medium" | "low",
- }))
- .filter((t) => t.text.trim());
-
- setTodos(valid);
- setLastRun(new Date());
-
- if (valid.length > 0) {
- toast({
- title: `Found ${valid.length} action item${valid.length > 1 ? "s" : ""}`,
- });
- } else {
- toast({ title: "No action items found" });
- }
- } catch (e) {
- const msg = e instanceof Error ? e.message : String(e);
- setError(msg);
- } finally {
- setIsExtracting(false);
- }
- };
-
- // ─── Helpers ──────────────────────────────────────────────────────────────
-
- const copyTodos = () => {
- const text = todos
- .map(
- (t, i) =>
- `${i + 1}. ${t.text}${t.app ? ` (${t.app})` : ""}${t.urgency === "high" ? " ⚡" : ""}`
- )
- .join("\n");
- navigator.clipboard.writeText(text);
- setCopied(true);
- setTimeout(() => setCopied(false), 2000);
- };
-
- const formatLastRun = (date: Date | null) => {
- if (!date) return "Never";
- const diff = Date.now() - date.getTime();
- const mins = Math.floor(diff / 60000);
- if (mins < 1) return "Just now";
- if (mins < 60) return `${mins}m ago`;
- return `${Math.floor(mins / 60)}h ago`;
- };
-
- const urgencyIcon = (u: string) =>
- u === "high" ? "⚡" : u === "medium" ? "●" : "○";
- const urgencyColor = (u: string) =>
- u === "high"
- ? "text-red-500"
- : u === "medium"
- ? "text-yellow-500"
- : "text-muted-foreground";
-
if (os && os !== "macos") return null;
return (
@@ -293,178 +87,39 @@ export function AppleIntelligenceCard() {
</span>
)}
</div>
- <p className="text-xs text-muted-foreground mb-3">
- Extract action items from your screen & audio using on-device AI.
- {aiStatus === "unavailable" && (
- <span className="block mt-1">
- <AlertCircle className="h-3 w-3 inline mr-1" />
- Requires macOS 26+ with Apple Intelligence enabled.
- </span>
- )}
- </p>
-
- <div className="flex flex-wrap items-center gap-2">
- <Button
- onClick={() => {
- if (aiStatus !== "available") {
- setError(
- "Apple Intelligence not available. Requires macOS 26+ with Apple Intelligence enabled, and the server built with --features apple-intelligence."
- );
- return;
- }
- runExtraction();
- }}
- disabled={isExtracting}
- size="sm"
- className="gap-1.5 h-7 text-xs min-w-[120px]"
- >
- {isExtracting ? (
- <>
- <Loader2 className="h-3 w-3 animate-spin flex-shrink-0" />
- <span>extracting...</span>
- </>
- ) : (
- <>
- <Sparkles className="h-3 w-3 flex-shrink-0" />
- <span>extract todos</span>
- </>
- )}
- </Button>
- <Select
- value={String(lookbackMinutes)}
- onValueChange={(v) => setLookbackMinutes(parseInt(v))}
- >
- <SelectTrigger className="h-7 text-xs w-[90px]">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- <SelectItem value="15">15 min</SelectItem>
- <SelectItem value="30">30 min</SelectItem>
- <SelectItem value="60">1 hour</SelectItem>
- <SelectItem value="120">2 hours</SelectItem>
- </SelectContent>
- </Select>
+ <p className="text-xs text-muted-foreground mb-3 leading-relaxed">
+ Generates a daily summary of your activity in the timeline at 6pm.
+ Includes time breakdown, key moments, action items, and people
+ mentioned. Runs entirely on-device using Apple&apos;s Foundation
+ Models. Only processes when plugged in.
+ </p>
- {todos.length > 0 && (
- <Button
- onClick={() => {
- setTodos([]);
- setLastRun(null);
- }}
- variant="ghost"
- size="sm"
- className="gap-1 h-7 text-xs text-muted-foreground"
- >
- <Trash2 className="h-3 w-3" />
- </Button>
- )}
+ {aiStatus === "unavailable" && (
+ <p className="text-xs text-muted-foreground mb-3">
+ <AlertCircle className="h-3 w-3 inline mr-1" />
+ Requires macOS 26+ with Apple Intelligence enabled.
+ </p>
+ )}
+
+ <div className="flex items-center gap-3">
+ <Switch
+ checked={enabled}
+ onCheckedChange={toggleEnabled}
+ disabled={aiStatus !== "available"}
+ />
+ <Label className="text-xs text-muted-foreground">
+ {enabled ? "Daily summaries enabled" : "Daily summaries disabled"}
+ </Label>
</div>
</div>
</div>
- {/* TODO items */}
- {todos.length > 0 && (
- <div className="border-t border-border">
- <Collapsible open={todosOpen} onOpenChange={setTodosOpen}>
- <CollapsibleTrigger asChild>
- <button className="flex items-center justify-between w-full px-4 py-2 hover:bg-muted/50 transition-colors">
- <div className="flex items-center gap-2">
- {todosOpen ? (
- <ChevronDown className="h-3 w-3 text-muted-foreground" />
- ) : (
- <ChevronRight className="h-3 w-3 text-muted-foreground" />
- )}
- <span className="text-xs font-medium">Action Items</span>
- <Badge
- variant="secondary"
- className="h-4 px-1.5 text-[10px]"
- >
- {todos.length}
- </Badge>
- </div>
- <Button
- variant="ghost"
- size="sm"
- className="h-6 px-2 text-[10px] gap-1"
- onClick={(e) => {
- e.stopPropagation();
- copyTodos();
- }}
- >
- {copied ? (
- <Check className="h-3 w-3" />
- ) : (
- <Copy className="h-3 w-3" />
- )}
- </Button>
- </button>
- </CollapsibleTrigger>
- <CollapsibleContent>
- <div className="px-4 pb-3 space-y-1">
- {todos.map((todo, i) => (
- <div
- key={i}
- className="flex items-start gap-2 py-1.5 px-2 rounded hover:bg-muted/50 group"
- >
- <span
- className={`text-xs mt-0.5 ${urgencyColor(todo.urgency)}`}
- >
- {urgencyIcon(todo.urgency)}
- </span>
- <div className="flex-1 min-w-0">
- <p className="text-xs text-foreground leading-relaxed">
- {todo.text}
- </p>
- {todo.app && (
- <span className="text-[10px] text-muted-foreground">
- {todo.app}
- </span>
- )}
- </div>
- <Button
- variant="ghost"
- size="sm"
- className="h-5 w-5 p-0 opacity-0 group-hover:opacity-100"
- onClick={() => {
- navigator.clipboard.writeText(todo.text);
- toast({ title: "Copied" });
- }}
- >
- <Copy className="h-2.5 w-2.5" />
- </Button>
- </div>
- ))}
- </div>
- </CollapsibleContent>
- </Collapsible>
- </div>
- )}
-
- {/* Error */}
- {error && (
- <div className="px-4 py-2 border-t border-border">
- <div className="flex items-center gap-2 text-xs text-red-500">
- <AlertCircle className="h-3 w-3 flex-shrink-0" />
- <span className="truncate">{error}</span>
- <Button
- variant="ghost"
- size="sm"
- className="h-5 w-5 p-0 ml-auto"
- onClick={() => setError(null)}
- >
- <X className="h-3 w-3" />
- </Button>
- </div>
- </div>
- )}
-
{/* Status bar */}
<div className="px-4 py-2 bg-muted/50 border-t border-border">
<div className="flex items-center gap-3 text-xs text-muted-foreground">
<span>
- Last:{" "}
- <span className="text-foreground">{formatLastRun(lastRun)}</span>
+ Summaries appear in your timeline · you can also generate manually
</span>
<span
className={`ml-auto ${aiStatus === "available" ? "text-green-500" : ""}`}
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
index 8f02fe790..f9214b634 100755
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -9007,7 +9007,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "2.0.317"
+version = "2.0.318"
dependencies = [
"anyhow",
"async-stream",
@@ -9100,7 +9100,7 @@ dependencies = [
[[package]]
name = "screenpipe-audio"
-version = "0.3.111"
+version = "0.3.112"
dependencies = [
"anyhow",
"bytemuck",
@@ -9148,7 +9148,7 @@ dependencies = [
[[package]]
name = "screenpipe-core"
-version = "0.3.111"
+version = "0.3.112"
dependencies = [
"accessibility",
"accessibility-sys",
@@ -9199,7 +9199,7 @@ dependencies = [
[[package]]
name = "screenpipe-db"
-version = "0.3.111"
+version = "0.3.112"
dependencies = [
"anyhow",
"chrono",
@@ -9223,7 +9223,7 @@ dependencies = [
[[package]]
name = "screenpipe-events"
-version = "0.3.111"
+version = "0.3.112"
dependencies = [
"anyhow",
"chrono",
@@ -9239,7 +9239,7 @@ dependencies = [
[[package]]
name = "screenpipe-integrations"
-version = "0.3.111"
+version = "0.3.112"
dependencies = [
"anyhow",
"image 0.25.9",
@@ -9254,7 +9254,7 @@ dependencies = [
[[package]]
name = "screenpipe-server"
-version = "0.3.111"
+version = "0.3.112"
dependencies = [
"anyhow",
"async-trait",
@@ -9319,7 +9319,7 @@ dependencies = [
[[package]]
name = "screenpipe-vision"
-version = "0.3.111"
+version = "0.3.112"
dependencies = [
"accessibility-sys",
"anyhow",
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index 9bc5e7bf6..0c429153a 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "2.0.318"
+version = "2.0.319"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""