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

release-app - few fixes on timeline which is now renamed to rewind, more intuitive, bug fixes, better AI agent chat panel ui

Louis Beaumont884a978ca38c
diff --git a/pipes/obsidian/src/lib/hooks/use-settings.tsx b/pipes/obsidian/src/lib/hooks/use-settings.tsx
index 2a4d7a485..de4da8e01 100644
--- a/pipes/obsidian/src/lib/hooks/use-settings.tsx
+++ b/pipes/obsidian/src/lib/hooks/use-settings.tsx
@@ -34,7 +34,6 @@ remember: you're analyzing screen ocr text & audio, etc. from my computer, so fo
};
const [settings, setSettings] = useState<Settings | null>(null);
- console.log("settings", settings);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<Error | null>(null);
@@ -62,7 +61,7 @@ remember: you're analyzing screen ocr text & audio, etc. from my computer, so fo
window.addEventListener("focus", onFocus);
// Optional: periodic refresh every 30s
- const interval = setInterval(loadSettings, 30000);
+ const interval = setInterval(loadSettings, 2000);
return () => {
window.removeEventListener("focus", onFocus);
diff --git a/pipes/timeline/bun.lockb b/pipes/timeline/bun.lockb
index 15363e10d..8e14c97a5 100755
Binary files a/pipes/timeline/bun.lockb and b/pipes/timeline/bun.lockb differ
diff --git a/pipes/timeline/package.json b/pipes/timeline/package.json
index 8478618a5..4d7dd058f 100644
--- a/pipes/timeline/package.json
+++ b/pipes/timeline/package.json
@@ -23,7 +23,7 @@
"@radix-ui/react-switch": "^1.1.2",
"@radix-ui/react-toast": "^1.2.3",
"@radix-ui/react-tooltip": "^1.1.5",
- "@screenpipe/browser": "^0.1.17",
+ "@screenpipe/browser": "^0.1.21",
"@screenpipe/js": "^1.0.6",
"@shadcn/ui": "^0.0.4",
"@tanstack/react-query": "^5.62.7",
diff --git a/pipes/timeline/src/app/page.tsx b/pipes/timeline/src/app/page.tsx
index 27d0c7a65..7a3c0aa5a 100644
--- a/pipes/timeline/src/app/page.tsx
+++ b/pipes/timeline/src/app/page.tsx
@@ -1,6 +1,5 @@
"use client";
import { useEffect, useState, useRef, useMemo } from "react";
-import { useSettings } from "@/lib/hooks/use-settings";
import { Loader2, RotateCcw, AlertCircle } from "lucide-react";
import { TimelineIconsSection } from "@/components/timeline/timeline-dock-section";
import { AudioTranscript } from "@/components/timeline/audio-transcript";
@@ -55,13 +54,10 @@ export default function Timeline() {
const [error, setError] = useState<string | null>(null);
const eventSourceRef = useRef<EventSource | null>(null);
const retryTimeoutRef = useRef<NodeJS.Timeout | null>(null);
- const retryCount = useRef(0);
const [loadedTimeRange, setLoadedTimeRange] = useState<TimeRange | null>(
null
);
- const { settings } = useSettings();
const [isAiPanelExpanded, setIsAiPanelExpanded] = useState(false);
- const aiPanelRef = useRef<HTMLDivElement>(null);
const containerRef = useRef<HTMLDivElement | null>(null);
const [position, setPosition] = useState({
x: 0,
@@ -356,9 +352,19 @@ export default function Timeline() {
)}
{error && (
<div className="absolute inset-0 flex items-center justify-center">
- <div className="bg-destructive/10 p-5 border-destructive/20 border rounded-lg text-destructive">
- <AlertCircle className="h-4 w-4 mb-2 mx-auto" />
- <p>{error}</p>
+ <div className="bg-destructive/10 p-5 border-destructive/20 border rounded-lg text-destructive flex flex-col items-center">
+ <AlertCircle className="h-4 w-4 mb-2" />
+ <p className="mb-4">
+ i cannot reach your screenpipe data, did you enable the
+ timeline feature?
+ </p>
+ <button
+ onClick={handleRefresh}
+ className="flex items-center gap-2 px-4 py-2 bg-background text-foreground hover:bg-muted transition-colors rounded-md border border-input"
+ >
+ <RotateCcw className="h-4 w-4" />
+ reload
+ </button>
</div>
</div>
)}
@@ -420,7 +426,6 @@ export default function Timeline() {
}}
frames={frames}
agents={AGENTS}
- settings={settings}
isExpanded={isAiPanelExpanded}
onExpandedChange={setIsAiPanelExpanded}
/>
diff --git a/pipes/timeline/src/components/timeline/agents.tsx b/pipes/timeline/src/components/timeline/agents.tsx
index 591d4f6f5..b795f7a2a 100644
--- a/pipes/timeline/src/components/timeline/agents.tsx
+++ b/pipes/timeline/src/components/timeline/agents.tsx
@@ -12,6 +12,7 @@ export interface Agent {
options: {
model: string;
onProgress: (chunk: string) => void;
+ signal?: AbortSignal;
},
userQuery: string
) => Promise<void>;
@@ -24,6 +25,7 @@ async function streamCompletion(
options: {
model: string;
onProgress: (chunk: string) => void;
+ signal?: AbortSignal;
}
) {
const messagesWithQuery = [
@@ -34,11 +36,16 @@ async function streamCompletion(
},
];
- const stream = await openai.chat.completions.create({
- model: options.model,
- messages: messagesWithQuery,
- stream: true,
- });
+ const stream = await openai.chat.completions.create(
+ {
+ model: options.model,
+ messages: messagesWithQuery,
+ stream: true,
+ },
+ {
+ signal: options.signal,
+ }
+ );
let fullResponse = "";
for await (const chunk of stream) {
@@ -51,22 +58,28 @@ async function streamCompletion(
export async function analyzeChunk(
chunk: any[],
openai: OpenAI,
- model: string
+ model: string,
+ signal?: AbortSignal
): Promise<string> {
- const response = await openai.chat.completions.create({
- model,
- messages: [
- {
- role: "user" as const,
- content:
- "summarize this chunk of activity in 2-3 sentences, focus on key events and patterns",
- },
- {
- role: "user",
- content: JSON.stringify(chunk),
- },
- ],
- });
+ const response = await openai.chat.completions.create(
+ {
+ model,
+ messages: [
+ {
+ role: "user" as const,
+ content:
+ "summarize this chunk of activity in 2-3 sentences, focus on key events and patterns",
+ },
+ {
+ role: "user",
+ content: JSON.stringify(chunk),
+ },
+ ],
+ },
+ {
+ signal,
+ }
+ );
return response.choices[0]?.message?.content || "";
}
@@ -79,9 +92,11 @@ export const AGENTS: Agent[] = [
analyze: async (
frames,
openai,
- { model, onProgress = () => {} },
+ { model, onProgress = () => {}, signal },
userQuery
) => {
+ console.log("userQuery", userQuery);
+ console.log("frames", frames);
if (!frames.length) {
onProgress("no frames to analyze\n\n");
return;
@@ -119,7 +134,7 @@ export const AGENTS: Agent[] = [
const chunkSummaries = await Promise.all(
chunks.map(async (chunk, index) => {
- const summary = await analyzeChunk(chunk, openai, model);
+ const summary = await analyzeChunk(chunk, openai, model, signal);
onProgress(`chunk ${index + 1}/${chunks.length}: ${summary}\n`);
return {
time: new Date(chunk[0].timestamp).toLocaleTimeString(),
@@ -159,7 +174,7 @@ export const AGENTS: Agent[] = [
},
],
userQuery,
- { model, onProgress }
+ { model, onProgress, signal }
);
},
},
@@ -167,7 +182,12 @@ export const AGENTS: Agent[] = [
id: "context-master",
name: "context master",
description: "analyzes everything: apps, windows, text & audio",
- analyze: async (frames, openai, { model, onProgress }, userQuery) => {
+ analyze: async (
+ frames,
+ openai,
+ { model, onProgress, signal },
+ userQuery
+ ) => {
const contextData = frames.map((frame) => ({
timestamp: frame.timestamp,
devices: frame.devices.map((device) => ({
@@ -191,7 +211,7 @@ export const AGENTS: Agent[] = [
},
],
userQuery,
- { model, onProgress }
+ { model, onProgress, signal }
);
},
},
@@ -199,7 +219,12 @@ export const AGENTS: Agent[] = [
id: "window-tracker",
name: "window tracker",
description: "focuses on app & window usage data",
- analyze: async (frames, openai, { model, onProgress }, userQuery) => {
+ analyze: async (
+ frames,
+ openai,
+ { model, onProgress, signal },
+ userQuery
+ ) => {
const windowData = frames.map((frame) => ({
timestamp: frame.timestamp,
windows: frame.devices.map((device) => ({
@@ -222,7 +247,7 @@ export const AGENTS: Agent[] = [
},
],
userQuery,
- { model, onProgress }
+ { model, onProgress, signal }
);
},
},
@@ -230,7 +255,12 @@ export const AGENTS: Agent[] = [
id: "text-scanner",
name: "text scanner",
description: "analyzes visible text (OCR)",
- analyze: async (frames, openai, { model, onProgress }, userQuery) => {
+ analyze: async (
+ frames,
+ openai,
+ { model, onProgress, signal },
+ userQuery
+ ) => {
const textData = frames.map((frame) => ({
timestamp: frame.timestamp,
text: frame.devices
@@ -252,7 +282,7 @@ export const AGENTS: Agent[] = [
},
],
userQuery,
- { model, onProgress }
+ { model, onProgress, signal }
);
},
},
@@ -260,7 +290,12 @@ export const AGENTS: Agent[] = [
id: "voice-analyzer",
name: "voice analyzer",
description: "focuses on audio transcriptions",
- analyze: async (frames, openai, { model, onProgress }, userQuery) => {
+ analyze: async (
+ frames,
+ openai,
+ { model, onProgress, signal },
+ userQuery
+ ) => {
const audioData = frames.map((frame) => ({
timestamp: frame.timestamp,
audio: frame.devices.flatMap((device) => device.audio),
@@ -280,7 +315,7 @@ export const AGENTS: Agent[] = [
},
],
userQuery,
- { model, onProgress }
+ { model, onProgress, signal }
);
},
},
diff --git a/pipes/timeline/src/components/timeline/ai-panel.tsx b/pipes/timeline/src/components/timeline/ai-panel.tsx
index 8b611c98d..c420851a1 100644
--- a/pipes/timeline/src/components/timeline/ai-panel.tsx
+++ b/pipes/timeline/src/components/timeline/ai-panel.tsx
@@ -5,11 +5,19 @@ import { ChatMessage } from "@/components/chat-message";
import { useToast } from "@/components/ui/use-toast";
import { Input } from "@/components/ui/input";
import { Button } from "@/components/ui/button";
-import { Loader2, Send, Square, X, GripHorizontal } from "lucide-react";
+import { Loader2, Send, Square, X, GripHorizontal, Bot } from "lucide-react";
import { StreamTimeSeriesResponse } from "@/app/page";
import { useTimelineSelection } from "@/lib/hooks/use-timeline-selection";
import { Agent } from "./agents";
import { pipe, type Settings } from "@screenpipe/browser";
+import { useAiProvider } from "@/lib/hooks/use-ai-provider";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
+import { useSettings } from "@/lib/hooks/use-settings";
interface AIPanelProps {
position: { x: number; y: number };
@@ -17,7 +25,6 @@ interface AIPanelProps {
onClose: () => void;
frames: StreamTimeSeriesResponse[];
agents: Agent[];
- settings: Settings;
isExpanded: boolean;
onExpandedChange: (expanded: boolean) => void;
}
@@ -28,10 +35,10 @@ export function AIPanel({
onClose,
frames,
agents,
- settings,
isExpanded,
onExpandedChange,
}: AIPanelProps) {
+ const { settings } = useSettings();
const [chatMessages, setChatMessages] = useState<Array<Message>>([]);
const [isAiLoading, setIsAiLoading] = useState(false);
const [isStreaming, setIsStreaming] = useState(false);
@@ -50,9 +57,27 @@ export function AIPanel({
const resizerRef = useRef<HTMLDivElement | null>(null);
const { toast } = useToast();
const { selectionRange, setSelectionRange } = useTimelineSelection();
+ const { isAvailable, error } = useAiProvider(settings);
+
+ // Add abort controller ref
+ const abortControllerRef = useRef<AbortController | null>(null);
useEffect(() => {
- setOsType(window.navigator.platform);
+ const detectOS = () => {
+ // Try using modern API first
+ if ("userAgentData" in navigator) {
+ // @ts-ignore - userAgentData is not yet in all TypeScript definitions
+ return navigator.userAgentData.platform;
+ }
+ // Fallback to user agent string parsing
+ const userAgent = window.navigator.userAgent.toLowerCase();
+ if (userAgent.includes("mac")) return "macos";
+ if (userAgent.includes("win")) return "windows";
+ if (userAgent.includes("linux")) return "linux";
+ return "unknown";
+ };
+
+ setOsType(detectOS());
}, []);
const handlePanelMouseDown = (e: React.MouseEvent<HTMLDivElement>) => {
@@ -150,6 +175,29 @@ export function AIPanel({
setSelectedAgent(newAgent);
};
+ const handleClose = () => {
+ // Abort any ongoing request
+ if (abortControllerRef.current) {
+ abortControllerRef.current.abort();
+ abortControllerRef.current = null;
+ }
+ setIsAiLoading(false);
+ setIsStreaming(false);
+ setChatMessages([]);
+ setAiInput("");
+ onClose();
+ setSelectionRange(null);
+ };
+
+ const handleStopStreaming = () => {
+ if (abortControllerRef.current) {
+ abortControllerRef.current.abort();
+ abortControllerRef.current = null;
+ setIsStreaming(false);
+ setIsAiLoading(false);
+ }
+ };
+
const handleAiSubmit = async (e: React.FormEvent) => {
pipe.captureMainFeatureEvent("ai-panel", {
action: "ai-submit",
@@ -157,6 +205,9 @@ export function AIPanel({
e.preventDefault();
if (!selectionRange || !aiInput.trim()) return;
+ // Create new abort controller for this request
+ abortControllerRef.current = new AbortController();
+
const userMessage = {
id: generateId(),
role: "user" as const,
@@ -165,6 +216,7 @@ export function AIPanel({
setChatMessages((prev) => [...prev, userMessage]);
setAiInput("");
setIsAiLoading(true);
+ setIsStreaming(true);
try {
const relevantFrames = frames.filter((frame) => {
@@ -201,29 +253,27 @@ export function AIPanel({
{ id: generateId(), role: "assistant", content: currentResponse },
]);
},
+ signal: abortControllerRef.current.signal,
},
aiInput
);
} catch (error) {
- console.error("Error generating AI response:", error);
- toast({
- title: "error",
- description: "failed to generate AI response. please try again.",
- variant: "destructive",
- });
+ // Only show error if not aborted
+ if (!(error instanceof Error && error.name === "AbortError")) {
+ console.error("Error generating AI response:", error);
+ toast({
+ title: "error",
+ description: "failed to generate AI response. please try again.",
+ variant: "destructive",
+ });
+ }
} finally {
setIsAiLoading(false);
setIsStreaming(false);
+ abortControllerRef.current = null;
}
};
- const handleClose = () => {
- setChatMessages([]);
- setAiInput("");
- onClose();
- setSelectionRange(null);
- };
-
if (!selectionRange) return null;
return (
@@ -309,36 +359,60 @@ export function AIPanel({
className="p-3 border-t border-muted-foreground"
>
<div className="flex flex-col gap-2">
- <select
- value={selectedAgent.id}
- onChange={(e) => handleAgentChange(e.target.value)}
- className="w-full bg-background border border-muted-foreground text-foreground rounded px-2 py-1 text-xs"
- >
- {agents.map((agent) => (
- <option
- key={agent.id}
- value={agent.id}
- className="bg-background text-foreground"
- >
- {agent.name} - {agent.description}
- </option>
- ))}
- </select>
+ <div className="flex items-center gap-2">
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger>
+ <Bot className="h-4 w-4 text-muted-foreground" />
+ </TooltipTrigger>
+ <TooltipContent>
+ <p className="text-xs">using {settings.aiModel}</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ <select
+ value={selectedAgent.id}
+ onChange={(e) => handleAgentChange(e.target.value)}
+ className="w-full bg-background border border-muted-foreground text-foreground rounded px-2 py-1 text-xs"
+ >
+ {agents.map((agent) => (
+ <option
+ key={agent.id}
+ value={agent.id}
+ className="bg-background text-foreground"
+ >
+ {agent.name} - {agent.description}
+ </option>
+ ))}
+ </select>
+ </div>
<div className="flex gap-2">
- <Input
- ref={inputRef}
- type="text"
- value={aiInput}
- onChange={(e) => setAiInput(e.target.value)}
- placeholder="ask about this time range..."
- className="flex-1 bg-background border border-muted-foreground text-foreground placeholder-muted-foreground"
- disabled={isAiLoading}
- />
+ <TooltipProvider>
+ <Tooltip open={!isAvailable}>
+ <TooltipTrigger asChild>
+ <div className="flex-1">
+ <Input
+ ref={inputRef}
+ type="text"
+ value={aiInput}
+ onChange={(e) => setAiInput(e.target.value)}
+ placeholder="ask about this time range..."
+ className="flex-1 bg-background border border-muted-foreground text-foreground placeholder-muted-foreground"
+ disabled={isAiLoading || !isAvailable}
+ />
+ </div>
+ </TooltipTrigger>
+ <TooltipContent side="top">
+ <p className="text-sm text-destructive">{error}</p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
<Button
type="submit"
variant="outline"
className="hover:bg-accent transition-colors"
- disabled={isAiLoading}
+ disabled={!isAvailable}
+ onClick={isStreaming ? handleStopStreaming : handleAiSubmit}
>
{isStreaming ? (
<Square className="h-4 w-4" />
diff --git a/pipes/timeline/src/lib/hooks/use-ai-provider.tsx b/pipes/timeline/src/lib/hooks/use-ai-provider.tsx
new file mode 100644
index 000000000..827efdb05
--- /dev/null
+++ b/pipes/timeline/src/lib/hooks/use-ai-provider.tsx
@@ -0,0 +1,81 @@
+import { useState, useEffect } from "react";
+import type { Settings } from "@screenpipe/browser";
+
+interface AIProviderStatus {
+ isAvailable: boolean;
+ error: string;
+}
+
+export function useAiProvider(settings: Settings): AIProviderStatus {
+ const [status, setStatus] = useState<AIProviderStatus>({
+ isAvailable: true,
+ error: "",
+ });
+
+ useEffect(() => {
+ const checkAiProvider = async () => {
+ try {
+ switch (settings.aiProviderType) {
+ case "openai":
+ if (!settings.openaiApiKey) {
+ setStatus({
+ isAvailable: false,
+ error: "openai api key not configured",
+ });
+ return;
+ }
+ break;
+
+ case "native-ollama":
+ try {
+ const response = await fetch("http://localhost:11434/api/tags");
+ if (!response.ok) throw new Error();
+ } catch {
+ setStatus({
+ isAvailable: false,
+ error: "ollama not running on port 11434",
+ });
+ return;
+ }
+ break;
+
+ case "screenpipe-cloud":
+ if (!settings.user?.token) {
+ setStatus({
+ isAvailable: false,
+ error: "login required for screenpipe cloud",
+ });
+ return;
+ }
+ break;
+
+ case "custom":
+ if (!settings.aiUrl) {
+ setStatus({
+ isAvailable: false,
+ error: "custom ai url not configured",
+ });
+ return;
+ }
+ break;
+ }
+
+ setStatus({ isAvailable: true, error: "" });
+ } catch (error) {
+ setStatus({
+ isAvailable: false,
+ error: "failed to check ai provider",
+ });
+ }
+ };
+
+ checkAiProvider();
+ }, [
+ settings.aiProviderType,
+ settings.openaiApiKey,
+ settings.aiUrl,
+ settings.user?.token,
+ ]);
+
+ return status;
+}
diff --git a/pipes/timeline/src/lib/hooks/use-settings.tsx b/pipes/timeline/src/lib/hooks/use-settings.tsx
index afb31f94b..1e9a327b9 100644
--- a/pipes/timeline/src/lib/hooks/use-settings.tsx
+++ b/pipes/timeline/src/lib/hooks/use-settings.tsx
@@ -1,34 +1,10 @@
"use client";
import { useState, useEffect } from "react";
-import type { Settings } from "@screenpipe/browser";
+import { getDefaultSettings, type Settings } from "@screenpipe/browser";
export function useSettings() {
- const defaultSettings: Settings = {
- analyticsEnabled: true,
- openaiApiKey: "",
- deepgramApiKey: "",
- aiModel: "gpt-4",
- aiUrl: "https://api.openai.com/v1",
- customPrompt: "",
- port: 3030,
- dataDir: "default",
- disableAudio: false,
- ignoredWindows: [],
- includedWindows: [],
- aiProviderType: "openai",
- embeddedLLM: {
- enabled: false,
- model: "llama3.2:1b-instruct-q4_K_M",
- port: 11438,
- },
- enableFrameCache: true,
- enableUiMonitoring: false,
- aiMaxContextChars: 128000,
- user: {
- token: "",
- },
- };
+ const defaultSettings = getDefaultSettings();
const [settings, setSettings] = useState<Settings>(defaultSettings);
const [loading, setLoading] = useState(false);
diff --git a/screenpipe-app-tauri/components/recording-settings.tsx b/screenpipe-app-tauri/components/recording-settings.tsx
index b917ed49c..1daae5af8 100644
--- a/screenpipe-app-tauri/components/recording-settings.tsx
+++ b/screenpipe-app-tauri/components/recording-settings.tsx
@@ -1497,10 +1497,10 @@ export function RecordingSettings() {
<div className="flex items-center justify-between">
<div className="space-y-1">
- <h4 className="font-medium">enable timeline ui</h4>
+ <h4 className="font-medium">enable rewind</h4>
<p className="text-sm text-muted-foreground">
- experimental feature that provides a timeline interface like
- rewind.ai
+ experimental feature that provides a rewind interface for the
+ rewind pipe
</p>
</div>
<Switch
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index 00e20434c..4e4981363 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "0.26.3"
+version = "0.26.4"
description = ""
authors = ["you"]
license = ""