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
chore: #934 move timeline to store
Louis Beaumont67ee9c87f676
diff --git a/pipes/timeline/.gitignore b/pipes/timeline/.gitignorenew file mode 100644index 000000000..5ef6a5207--- /dev/null+++ b/pipes/timeline/.gitignore@@ -0,0 +1,41 @@+# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.++# dependencies+/node_modules+/.pnp+.pnp.*+.yarn/*+!.yarn/patches+!.yarn/plugins+!.yarn/releases+!.yarn/versions++# testing+/coverage++# next.js+/.next/+/out/++# production+/build++# misc+.DS_Store+*.pem++# debug+npm-debug.log*+yarn-debug.log*+yarn-error.log*+.pnpm-debug.log*++# env files (can opt-in for committing if needed)+.env*++# vercel+.vercel++# typescript+*.tsbuildinfo+next-env.d.tsdiff --git a/pipes/timeline/README.md b/pipes/timeline/README.mdnew file mode 100644index 000000000..e215bc4cc--- /dev/null+++ b/pipes/timeline/README.md@@ -0,0 +1,36 @@+This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).++## Getting Started++First, run the development server:++```bash+npm run dev+# or+yarn dev+# or+pnpm dev+# or+bun dev+```++Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.++You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.++This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.++## Learn More++To learn more about Next.js, take a look at the following resources:++- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.+- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.++You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!++## Deploy on Vercel++The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.++Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.diff --git a/pipes/timeline/bun.lockb b/pipes/timeline/bun.lockbnew file mode 100755index 000000000..6927ae9f3Binary files /dev/null and b/pipes/timeline/bun.lockb differdiff --git a/pipes/timeline/components.json b/pipes/timeline/components.jsonnew file mode 100644index 000000000..d710b4962--- /dev/null+++ b/pipes/timeline/components.json@@ -0,0 +1,21 @@+{+ "$schema": "https://ui.shadcn.com/schema.json",+ "style": "default",+ "rsc": true,+ "tsx": true,+ "tailwind": {+ "config": "tailwind.config.ts",+ "css": "src/app/globals.css",+ "baseColor": "neutral",+ "cssVariables": true,+ "prefix": ""+ },+ "aliases": {+ "components": "@/components",+ "utils": "@/lib/utils",+ "ui": "@/components/ui",+ "lib": "@/lib",+ "hooks": "@/hooks"+ },+ "iconLibrary": "lucide"+}\ No newline at end of filediff --git a/pipes/timeline/eslint.config.mjs b/pipes/timeline/eslint.config.mjsnew file mode 100644index 000000000..c85fb67c4--- /dev/null+++ b/pipes/timeline/eslint.config.mjs@@ -0,0 +1,16 @@+import { dirname } from "path";+import { fileURLToPath } from "url";+import { FlatCompat } from "@eslint/eslintrc";++const __filename = fileURLToPath(import.meta.url);+const __dirname = dirname(__filename);++const compat = new FlatCompat({+ baseDirectory: __dirname,+});++const eslintConfig = [+ ...compat.extends("next/core-web-vitals", "next/typescript"),+];++export default eslintConfig;diff --git a/pipes/timeline/next.config.ts b/pipes/timeline/next.config.tsnew file mode 100644index 000000000..b3978a6a4--- /dev/null+++ b/pipes/timeline/next.config.ts@@ -0,0 +1,16 @@+import type { NextConfig } from "next";++const nextConfig: NextConfig = {+ transpilePackages: ["@screenpipe/js"],+ webpack: (config, { isServer }) => {+ config.resolve.alias = {+ ...config.resolve.alias,+ "@screenpipe/js": isServer+ ? "@screenpipe/js/dist/node.js"+ : "@screenpipe/js/dist/browser.js",+ };+ return config;+ },+};++export default nextConfig;diff --git a/pipes/timeline/package.json b/pipes/timeline/package.jsonnew file mode 100644index 000000000..224dd7a20--- /dev/null+++ b/pipes/timeline/package.json@@ -0,0 +1,69 @@+{+ "name": "search",+ "version": "0.1.0",+ "private": true,+ "scripts": {+ "dev": "next dev --turbopack",+ "build": "next build",+ "start": "next start",+ "lint": "next lint"+ },+ "dependencies": {+ "@radix-ui/react-accordion": "^1.2.2",+ "@radix-ui/react-checkbox": "^1.1.3",+ "@radix-ui/react-dialog": "^1.1.3",+ "@radix-ui/react-label": "^2.1.1",+ "@radix-ui/react-popover": "^1.1.3",+ "@radix-ui/react-progress": "^1.1.1",+ "@radix-ui/react-scroll-area": "^1.2.2",+ "@radix-ui/react-select": "^2.1.3",+ "@radix-ui/react-separator": "^1.1.1",+ "@radix-ui/react-slider": "^1.2.2",+ "@radix-ui/react-slot": "^1.1.1",+ "@radix-ui/react-switch": "^1.1.2",+ "@radix-ui/react-toast": "^1.2.3",+ "@radix-ui/react-tooltip": "^1.1.5",+ "@screenpipe/js": "0.1.10-beta.18",+ "@shadcn/ui": "^0.0.4",+ "@tanstack/react-query": "^5.62.7",+ "@types/js-levenshtein": "^1.1.3",+ "@types/lodash": "^4.17.13",+ "@types/react-syntax-highlighter": "^15.5.13",+ "ai": "^4.0.18",+ "class-variance-authority": "^0.7.1",+ "clsx": "^2.1.1",+ "cmdk": "1.0.0",+ "date-fns": "^4.1.0",+ "framer-motion": "^11.14.4",+ "install": "^0.13.0",+ "js-levenshtein": "^1.1.6",+ "localforage": "^1.10.0",+ "lodash": "^4.17.21",+ "lucide-react": "^0.468.0",+ "magic-ui": "^0.1.0",+ "next": "15.1.0",+ "npm": "^10.9.2",+ "openai": "^4.76.3",+ "react": "^19.0.0",+ "react-day-picker": "8.10.1",+ "react-dom": "^19.0.0",+ "react-markdown": "^9.0.1",+ "react-syntax-highlighter": "^15.6.1",+ "remark-gfm": "^4.0.0",+ "remark-math": "^6.0.0",+ "tailwind-merge": "^2.5.5",+ "tailwindcss-animate": "^1.0.7"+ },+ "devDependencies": {+ "@eslint/eslintrc": "^3",+ "@types/node": "^22.10.2",+ "@types/react": "^19",+ "@types/react-dom": "^19",+ "autoprefixer": "^10.4.20",+ "eslint": "^9",+ "eslint-config-next": "15.1.0",+ "postcss": "^8.4.49",+ "tailwindcss": "^3.4.16",+ "typescript": "^5"+ }+}diff --git a/pipes/timeline/postcss.config.mjs b/pipes/timeline/postcss.config.mjsnew file mode 100644index 000000000..1a69fd2a4--- /dev/null+++ b/pipes/timeline/postcss.config.mjs@@ -0,0 +1,8 @@+/** @type {import('postcss-load-config').Config} */+const config = {+ plugins: {+ tailwindcss: {},+ },+};++export default config;diff --git a/pipes/timeline/public/file.svg b/pipes/timeline/public/file.svgnew file mode 100644index 000000000..004145cdd--- /dev/null+++ b/pipes/timeline/public/file.svg@@ -0,0 +1 @@+<svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>\ No newline at end of filediff --git a/pipes/timeline/public/globe.svg b/pipes/timeline/public/globe.svgnew file mode 100644index 000000000..567f17b0d--- /dev/null+++ b/pipes/timeline/public/globe.svg@@ -0,0 +1 @@+<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>\ No newline at end of filediff --git a/pipes/timeline/public/next.svg b/pipes/timeline/public/next.svgnew file mode 100644index 000000000..5174b28c5--- /dev/null+++ b/pipes/timeline/public/next.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M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of filediff --git a/pipes/timeline/public/vercel.svg b/pipes/timeline/public/vercel.svgnew file mode 100644index 000000000..770539603--- /dev/null+++ b/pipes/timeline/public/vercel.svg@@ -0,0 +1 @@+<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>\ No newline at end of filediff --git a/pipes/timeline/public/window.svg b/pipes/timeline/public/window.svgnew file mode 100644index 000000000..b2b2a44f6--- /dev/null+++ b/pipes/timeline/public/window.svg@@ -0,0 +1 @@+<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>\ No newline at end of filediff --git a/pipes/timeline/src/app/api/settings/route.ts b/pipes/timeline/src/app/api/settings/route.tsnew file mode 100644index 000000000..8d4a2b4fc--- /dev/null+++ b/pipes/timeline/src/app/api/settings/route.ts@@ -0,0 +1,80 @@+// app/api/settings/route.ts+import { pipe } from "@screenpipe/js";+import { NextResponse } from "next/server";+import type { Settings } from "@screenpipe/js";+// Force Node.js runtime+export const runtime = "nodejs"; // Add this line+export const dynamic = 'force-dynamic'++export async function GET() {+ const defaultSettings: Settings = {+ 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,+ };++ try {+ const settingsManager = pipe.settings;+ if (!settingsManager) {+ throw new Error("settingsManager not found");+ }+ const rawSettings = await settingsManager.getAll();+ return NextResponse.json(rawSettings);+ } catch (error) {+ console.error("failed to get settings:", error);+ return NextResponse.json(defaultSettings);+ }+}++export async function PUT(request: Request) {+ try {+ const settingsManager = pipe.settings;+ if (!settingsManager) {+ throw new Error("settingsManager not found");+ }++ const body = await request.json();+ const { key, value, isPartialUpdate, reset } = body;++ if (reset) {+ if (key) {+ await settingsManager.resetKey(key);+ } else {+ await settingsManager.reset();+ }+ return NextResponse.json({ success: true });+ }++ if (isPartialUpdate) {+ const serializedSettings = JSON.parse(JSON.stringify(value));+ await settingsManager.update(serializedSettings);+ } else {+ const serializedValue = JSON.parse(JSON.stringify(value));+ await settingsManager.set(key, serializedValue);+ }++ return NextResponse.json({ success: true });+ } catch (error) {+ console.error("failed to update settings:", error);+ return NextResponse.json(+ { error: "failed to update settings" },+ { status: 500 }+ );+ }+}diff --git a/pipes/timeline/src/app/favicon.ico b/pipes/timeline/src/app/favicon.iconew file mode 100644index 000000000..718d6fea4Binary files /dev/null and b/pipes/timeline/src/app/favicon.ico differdiff --git a/pipes/timeline/src/app/globals.css b/pipes/timeline/src/app/globals.cssnew file mode 100644index 000000000..a23ac26b0--- /dev/null+++ b/pipes/timeline/src/app/globals.css@@ -0,0 +1,72 @@+@tailwind base;+@tailwind components;+@tailwind utilities;++body {+ font-family: Arial, Helvetica, sans-serif;+}++@layer base {+ :root {+ --background: 0 0% 100%;+ --foreground: 0 0% 3.9%;+ --card: 0 0% 100%;+ --card-foreground: 0 0% 3.9%;+ --popover: 0 0% 100%;+ --popover-foreground: 0 0% 3.9%;+ --primary: 0 0% 9%;+ --primary-foreground: 0 0% 98%;+ --secondary: 0 0% 96.1%;+ --secondary-foreground: 0 0% 9%;+ --muted: 0 0% 96.1%;+ --muted-foreground: 0 0% 45.1%;+ --accent: 0 0% 96.1%;+ --accent-foreground: 0 0% 9%;+ --destructive: 0 84.2% 60.2%;+ --destructive-foreground: 0 0% 98%;+ --border: 0 0% 89.8%;+ --input: 0 0% 89.8%;+ --ring: 0 0% 3.9%;+ --chart-1: 12 76% 61%;+ --chart-2: 173 58% 39%;+ --chart-3: 197 37% 24%;+ --chart-4: 43 74% 66%;+ --chart-5: 27 87% 67%;+ --radius: 0.5rem;+ }+ .dark {+ --background: 0 0% 3.9%;+ --foreground: 0 0% 98%;+ --card: 0 0% 3.9%;+ --card-foreground: 0 0% 98%;+ --popover: 0 0% 3.9%;+ --popover-foreground: 0 0% 98%;+ --primary: 0 0% 98%;+ --primary-foreground: 0 0% 9%;+ --secondary: 0 0% 14.9%;+ --secondary-foreground: 0 0% 98%;+ --muted: 0 0% 14.9%;+ --muted-foreground: 0 0% 63.9%;+ --accent: 0 0% 14.9%;+ --accent-foreground: 0 0% 98%;+ --destructive: 0 62.8% 30.6%;+ --destructive-foreground: 0 0% 98%;+ --border: 0 0% 14.9%;+ --input: 0 0% 14.9%;+ --ring: 0 0% 83.1%;+ --chart-1: 220 70% 50%;+ --chart-2: 160 60% 45%;+ --chart-3: 30 80% 55%;+ --chart-4: 280 65% 60%;+ --chart-5: 340 75% 55%;+ }+}++@layer base {+ * {+ @apply border-border;+ }+ body {+ @apply bg-background text-foreground;+ }+}diff --git a/pipes/timeline/src/app/layout.tsx b/pipes/timeline/src/app/layout.tsxnew file mode 100644index 000000000..140191d39--- /dev/null+++ b/pipes/timeline/src/app/layout.tsx@@ -0,0 +1,35 @@+import type { Metadata } from "next";+import { Geist, Geist_Mono } from "next/font/google";+import "./globals.css";++const geistSans = Geist({+ variable: "--font-geist-sans",+ subsets: ["latin"],+});++const geistMono = Geist_Mono({+ variable: "--font-geist-mono",+ subsets: ["latin"],+});+++export const metadata: Metadata = {+ title: "Create Next App",+ description: "Generated by create next app",+};++export default function RootLayout({+ children,+}: Readonly<{+ children: React.ReactNode;+}>) {+ return (+ <html lang="en">+ <body+ className={`${geistSans.variable} ${geistMono.variable} antialiased`}+ >+ {children}+ </body>+ </html>+ );+}diff --git a/screenpipe-app-tauri/app/timeline/page.tsx b/pipes/timeline/src/app/page.tsxsimilarity index 97%rename from screenpipe-app-tauri/app/timeline/page.tsxrename to pipes/timeline/src/app/page.tsxindex a93ba5255..c2a404813 100644--- a/screenpipe-app-tauri/app/timeline/page.tsx+++ b/pipes/timeline/src/app/page.tsx@@ -2,7 +2,6 @@import { useEffect, useState, useRef, useMemo } from "react";import { useSettings } from "@/lib/hooks/use-settings";import { Loader2, RotateCcw, AlertCircle } from "lucide-react";-import posthog from "posthog-js";import { TimelineIconsSection } from "@/components/timeline/timeline-dock-section";import { AudioTranscript } from "@/components/timeline/audio-transcript";import { AIPanel } from "@/components/timeline/ai-panel";@@ -101,7 +100,9 @@ export default function Timeline() {const connectionTimeout = setTimeout(() => {if (eventSource.readyState !== EventSource.OPEN) {- console.error("Connection timeout: Unable to establish connection, make sure screenpipe is running");+ console.error(+ "Connection timeout: Unable to establish connection, make sure screenpipe is running"+ );setIsLoading(false);setMessage(null);setError("unable to establish connection, is screenpipe running?");@@ -115,7 +116,9 @@ export default function Timeline() {if (data === "keep-alive-text") {setError(null);setIsLoading(false);- setMessage("please wait, we are collecting data to stream timeline...");+ setMessage(+ "please wait, we are collecting data to stream timeline..."+ );return;}@@ -169,7 +172,7 @@ export default function Timeline() {};eventSource.onerror = (error) => {- clearTimeout(connectionTimeout);+ clearTimeout(connectionTimeout);if (eventSource.readyState === EventSource.CLOSED) {console.log("stream ended (expected behavior)", error);setMessage(null);@@ -185,7 +188,7 @@ export default function Timeline() {console.log("eventsource connection opened");clearTimeout(connectionTimeout);setError(null);- setMessage(null)+ setMessage(null);setIsLoading(true);};};@@ -289,8 +292,6 @@ export default function Timeline() {}, []);const handleRefresh = () => {- posthog.capture("timeline_refresh");-window.location.reload();setFrames([]);setCurrentFrame(null);@@ -305,12 +306,12 @@ export default function Timeline() {useEffect(() => {const container = containerRef.current;if (container) {- container.addEventListener('wheel', handleScroll, { passive: false });+ container.addEventListener("wheel", handleScroll, { passive: false });}return () => {if (container) {- container.removeEventListener('wheel', handleScroll);+ container.removeEventListener("wheel", handleScroll);}};}, [handleScroll]);diff --git a/pipes/timeline/src/components/chat-message-actions.tsx b/pipes/timeline/src/components/chat-message-actions.tsxnew file mode 100644index 000000000..da312d152--- /dev/null+++ b/pipes/timeline/src/components/chat-message-actions.tsx@@ -0,0 +1,40 @@+"use client";++// import { type Message } from "ai";++import { Button } from "@/components/ui/button";+import { IconCheck, IconCopy } from "@/components/ui/icons";+import { useCopyToClipboard } from "@/lib/hooks/use-copy-to-clipboard";+import { cn } from "@/lib/utils";++interface ChatMessageActionsProps extends React.ComponentProps<"div"> {+ message: any;+}++export function ChatMessageActions({+ message,+ className,+ ...props+}: ChatMessageActionsProps) {+ const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2000 });++ const onCopy = () => {+ if (isCopied) return;+ copyToClipboard(message.content);+ };++ return (+ <div+ className={cn(+ "flex items-center justify-end transition-opacity group-hover:opacity-100 md:absolute md:-right-10 md:-top-2 md:opacity-0",+ className+ )}+ {...props}+ >+ <Button variant="ghost" size="icon" onClick={onCopy}>+ {isCopied ? <IconCheck /> : <IconCopy />}+ <span className="sr-only">Copy message</span>+ </Button>+ </div>+ );+}diff --git a/pipes/timeline/src/components/chat-message.tsx b/pipes/timeline/src/components/chat-message.tsxnew file mode 100644index 000000000..2dee23299--- /dev/null+++ b/pipes/timeline/src/components/chat-message.tsx@@ -0,0 +1,111 @@+import { Message } from "ai";+import remarkGfm from "remark-gfm";+import remarkMath from "remark-math";++import { cn } from "@/lib/utils";+import { CodeBlock } from "@/components/ui/codeblock";+import { MemoizedReactMarkdown } from "@/components/markdown";+import { IconOpenAI, IconUser, IconOllama } from "@/components/ui/icons";+import { ChatMessageActions } from "@/components/chat-message-actions";+import { useSettings } from "@/lib/hooks/use-settings";+import { VideoComponent } from "./video";++export interface ChatMessageProps {+ message: Message;+}++export function ChatMessage({ message, ...props }: ChatMessageProps) {+ const { settings } = useSettings();++ const hasMP4File = (content: string) =>+ content.trim().toLowerCase().includes(".mp4");++ if (!message?.content?.trim()) {+ return null;+ }++ return (+ <div+ className={cn("group relative mb-4 flex items-start w-full")}+ {...props}+ >+ <div+ className={cn(+ "flex size-8 shrink-0 select-none items-center justify-center rounded-md border shadow",+ message.role === "user"+ ? "bg-background"+ : "bg-primary text-primary-foreground"+ )}+ >+ {message.role === "user" ? (+ <IconUser />+ ) : settings.aiUrl.includes("openai") ||+ settings.aiUrl.includes("worker") ? (+ <IconOpenAI />+ ) : (+ <>🦙</>+ )}+ </div>+ <div className="flex-1 px-1 ml-4 space-y-2 overflow-hidden w-[96em]">+ <MemoizedReactMarkdown+ className="prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0 w-full"+ remarkPlugins={[remarkGfm, remarkMath]}+ components={{+ p({ children }) {+ return <p className="mb-2 last:mb-0">{children}</p>;+ },+ a({ node, href, children, ...props }) {+ const isMP4Link = href?.toLowerCase().includes(".mp4");++ if (isMP4Link && href) {+ return <VideoComponent filePath={href} />;+ }+ return (+ <a+ href={href}+ target="_blank"+ rel="noopener noreferrer"+ {...props}+ >+ {children}+ </a>+ );+ },+ code({ node, className, children, ...props }) {+ const content = String(children).replace(/\n$/, "");+ const match = /language-(\w+)/.exec(className || "");++ const isMP4File = hasMP4File(content);++ if (isMP4File || !match) {+ if (isMP4File) {+ return <VideoComponent filePath={content.trim()} />;+ }+ return (+ <code+ className="px-1 py-0.5 rounded-sm font-mono text-sm"+ {...props}+ >+ {content}+ </code>+ );+ }++ return (+ <CodeBlock+ key={Math.random()}+ language={(match && match[1]) || ""}+ value={content}+ {...props}+ />+ );+ },+ }}+ >+ {message.content}+ </MemoizedReactMarkdown>+ <ChatMessageActions message={message} />+ </div>+ </div>+ );+}diff --git a/pipes/timeline/src/components/context-usage-indicator.tsx b/pipes/timeline/src/components/context-usage-indicator.tsxnew file mode 100644index 000000000..daa188abd--- /dev/null+++ b/pipes/timeline/src/components/context-usage-indicator.tsx@@ -0,0 +1,46 @@+import React from "react";+import { motion } from "framer-motion";+import { AlertTriangle } from "lucide-react";++interface ContextUsageIndicatorProps {+ currentSize: number;+ maxSize: number;+}++export function ContextUsageIndicator({+ currentSize,+ maxSize,+}: ContextUsageIndicatorProps) {+ const percentage = Math.min((currentSize / maxSize) * 100, 100);+ const circumference = 2 * Math.PI * 14;++ return (+ <div className="w-8 h-8 relative">+ <svg width="32" height="32" viewBox="0 0 32 32">+ <circle+ cx="16"+ cy="16"+ r="14"+ fill="none"+ stroke="#e2e8f0"+ strokeWidth="2"+ />+ <motion.circle+ cx="16"+ cy="16"+ r="14"+ fill="none"+ stroke="black"+ strokeWidth="2"+ strokeDasharray={circumference}+ initial={{ strokeDashoffset: circumference }}+ animate={{ strokeDashoffset: circumference - (percentage / 100) * circumference }}+ transition={{ duration: 0.5 }}+ />+ </svg>+ {percentage > 90 && (+ <AlertTriangle className="w-5 h-5 absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-red-500" />+ )}+ </div>+ );+}diff --git a/pipes/timeline/src/components/date-time-picker.tsx b/pipes/timeline/src/components/date-time-picker.tsxnew file mode 100644index 000000000..1ef5766a7--- /dev/null+++ b/pipes/timeline/src/components/date-time-picker.tsx@@ -0,0 +1,80 @@+import * as React from "react";+import { format } from "date-fns";+import { Calendar as CalendarIcon } from "lucide-react";++import { cn } from "@/lib/utils";+import { Button } from "@/components/ui/button";+import { Calendar } from "@/components/ui/calendar";+import {+ Popover,+ PopoverContent,+ PopoverTrigger,+} from "@/components/ui/popover";+import { Input } from "./ui/input";++export function DateTimePicker({+ date,+ setDate,+ className,+}: {+ date: Date;+ setDate: (date: Date) => void;+ className?: string;+}) {+ const [selectedDateTime, setSelectedDateTime] = React.useState<Date>(date);++ React.useEffect(() => {+ setSelectedDateTime(date);+ }, [date]);++ const handleDateSelect = (selectedDate: Date | undefined) => {+ if (selectedDate) {+ const newDateTime = new Date(selectedDateTime);+ newDateTime.setFullYear(selectedDate.getFullYear());+ newDateTime.setMonth(selectedDate.getMonth());+ newDateTime.setDate(selectedDate.getDate());+ setSelectedDateTime(newDateTime);+ setDate(newDateTime);+ }+ };++ const handleTimeChange = (event: React.ChangeEvent<HTMLInputElement>) => {+ const [hours, minutes] = event.target.value.split(":").map(Number);+ if (!isNaN(hours) && !isNaN(minutes)) {+ const newDateTime = new Date(selectedDateTime);+ newDateTime.setHours(hours);+ newDateTime.setMinutes(minutes);+ setSelectedDateTime(newDateTime);+ setDate(newDateTime);+ }+ };++ return (+ <Popover>+ <PopoverTrigger asChild>+ <Button+ variant={"outline"}+ className={cn("w-full justify-start text-left font-normal")}+ >+ <CalendarIcon className="mr-2 h-4 w-4 text-gray-400" size={18} />+ {format(date, "PPP HH:mm").toLowerCase()}+ </Button>+ </PopoverTrigger>+ <PopoverContent className={cn("w-auto p-0", className)}>+ <Calendar+ mode="single"+ selected={selectedDateTime}+ onSelect={handleDateSelect}+ initialFocus+ />+ <div className="p-3 border-t border-border">+ <Input+ type="time"+ onChange={handleTimeChange}+ value={format(selectedDateTime, "HH:mm")}+ />+ </div>+ </PopoverContent>+ </Popover>+ );+}diff --git a/pipes/timeline/src/components/example-search-cards.tsx b/pipes/timeline/src/components/example-search-cards.tsxnew file mode 100644index 000000000..588be3870--- /dev/null+++ b/pipes/timeline/src/components/example-search-cards.tsx@@ -0,0 +1,127 @@+import React from "react";+import { Card, CardContent } from "@/components/ui/card";+import { Search, Mail, Clock, AlertCircle } from "lucide-react";+import { Badge } from "./ui/badge";+import {+ Tooltip,+ TooltipContent,+ TooltipProvider,+ TooltipTrigger,+} from "./ui/tooltip";+import { useHealthCheck } from "@/lib/hooks/use-health-check";++export interface ExampleSearch {+ title: string;+ windowName?: string;+ appName?: string;+ limit: number;+ minLength: number;+ contentType: string;+ startDate: Date;+}++interface ExampleSearchCardsProps {+ onSelect: (example: ExampleSearch) => void;+}++const exampleSearches: ExampleSearch[] = [+ {+ title: "summarize last hour meeting",+ contentType: "audio",+ limit: 120,+ minLength: 10,+ startDate: new Date(Date.now() - 60 * 60 * 1000), // 1 hour ago+ },+ {+ title: "summarize my mails",+ contentType: "ocr",+ windowName: "gmail",+ limit: 25,+ minLength: 50,+ startDate: new Date(new Date().setHours(0, 0, 0, 0)), // since midnight local time+ },+ {+ title: "time spent last hour",+ contentType: "ocr",+ limit: 25,+ minLength: 50,+ startDate: new Date(Date.now() - 60 * 60 * 1000), // 1 hour ago+ },+];++export function ExampleSearchCards({ onSelect }: ExampleSearchCardsProps) {+ const { health } = useHealthCheck();+ const getIcon = (title: string) => {+ switch (title) {+ case "summarize last hour meeting":+ return <Search className="mr-2 h-4 w-4" />;+ case "summarize my mails":+ return <Mail className="mr-2 h-4 w-4" />;+ case "time spent last hour":+ return <Clock className="mr-2 h-4 w-4" />;+ default:+ return <Search className="mr-2 h-4 w-4" />; // default icon+ }+ };++ const isHealthError = health?.status === "error";++ return (+ <div className="grid grid-cols-1 md:grid-cols-3 gap-4 mt-4">+ {exampleSearches.map((example, index) => (+ <TooltipProvider key={index}>+ <Tooltip>+ <TooltipTrigger asChild>+ <div+ className={`relative group h-[150px] ${+ isHealthError ? "opacity-50 cursor-not-allowed" : ""+ }`}+ >+ <div className="absolute inset-0 rounded-lg transition-all duration-300 ease-out group-hover:before:opacity-100 group-hover:before:scale-100 before:absolute before:inset-0 before:rounded-lg before:border-2 before:border-black dark:before:border-white before:opacity-0 before:scale-95 group-hover:before:opacity-100 group-hover:before:scale-100 before:transition-all before:duration-300 before:ease-out" />+ <Card+ className={`cursor-pointer relative bg-white dark:bg-gray-800 z-10 h-full transition-transform duration-300 ease-out ${+ isHealthError ? "" : "group-hover:scale-[0.98]"+ }`}+ onClick={() => !isHealthError && onSelect(example)}+ >+ <CardContent className="p-3 flex flex-col h-full">+ <div className="flex items-center mb-1">+ {getIcon(example.title)}+ <h3 className="text-sm font-semibold">{example.title}</h3>+ </div>+ <div className="flex flex-wrap gap-2 mt-2">+ {example.contentType && (+ <Badge>{example.contentType}</Badge>+ )}+ {example.windowName && (+ <Badge>window: {example.windowName}</Badge>+ )}+ {example.appName && <Badge>app: {example.appName}</Badge>}+ {example.limit && <Badge>limit: {example.limit}</Badge>}+ {example.minLength && (+ <Badge>min: {example.minLength}</Badge>+ )}+ {example.startDate && (+ <Badge>+ start: {example.startDate.toLocaleString()}+ </Badge>+ )}+ </div>+ </CardContent>+ </Card>+ </div>+ </TooltipTrigger>+ {isHealthError && (+ <TooltipContent>+ <div className="flex items-center">+ <AlertCircle className="mr-2 h-4 w-4 text-red-500" />+ <p>screenpipe is not running. examples are disabled.</p>+ </div>+ </TooltipContent>+ )}+ </Tooltip>+ </TooltipProvider>+ ))}+ </div>+ );+}diff --git a/pipes/timeline/src/components/markdown.tsx b/pipes/timeline/src/components/markdown.tsxnew file mode 100644index 000000000..d4491467a--- /dev/null+++ b/pipes/timeline/src/components/markdown.tsx@@ -0,0 +1,9 @@+import { FC, memo } from 'react'+import ReactMarkdown, { Options } from 'react-markdown'++export const MemoizedReactMarkdown: FC<Options> = memo(+ ReactMarkdown,+ (prevProps, nextProps) =>+ prevProps.children === nextProps.children &&+ prevProps.className === nextProps.className+)diff --git a/pipes/timeline/src/components/search-chat.tsx b/pipes/timeline/src/components/search-chat.tsxnew file mode 100644index 000000000..55bf5b7b6--- /dev/null+++ b/pipes/timeline/src/components/search-chat.tsx@@ -0,0 +1,1855 @@+"use client";++import React, { JSX, useEffect, useRef, useState } from "react";+import { Input } from "@/components/ui/input";+import { Button } from "@/components/ui/button";+import { Card, CardContent } from "@/components/ui/card";+import { pipe, ContentItem } from "@screenpipe/js";+import { Skeleton } from "@/components/ui/skeleton";+import { Slider } from "@/components/ui/slider";+import { Switch } from "@/components/ui/switch";+import { Label } from "@/components/ui/label";+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from "@/components/ui/select";+import { Progress } from "@/components/ui/progress";+import { DateTimePicker } from "./date-time-picker";+import { Badge } from "./ui/badge";+import {+ ChevronDown,+ ChevronLeft,+ ChevronRight,+ HelpCircle,+ Laptop,+ Layers,+ Layout,+ Loader2,+ Search,+ Send,+ Square,+ Clock,+ Check,+ Plus,+ SpeechIcon,+ ChevronsUpDown,+} from "lucide-react";+import { useToast } from "@/components/ui/use-toast";+import { AnimatePresence, motion } from "framer-motion";+import { generateId, Message } from "ai";+import { OpenAI } from "openai";+import { ChatMessage } from "@/components/chat-message";+import { spinner } from "@/components/spinner";+import {+ Accordion,+ AccordionContent,+ AccordionItem,+ AccordionTrigger,+} from "@/components/ui/accordion";+import { VideoComponent } from "@/components/video";+import {+ Dialog,+ DialogContent,+ DialogDescription,+ DialogHeader,+ DialogTitle,+ DialogTrigger,+ DialogFooter,+} from "@/components/ui/dialog";+import {+ Tooltip,+ TooltipContent,+ TooltipProvider,+ TooltipTrigger,+} from "@/components/ui/tooltip";+import { Separator } from "@/components/ui/separator";+import { ContextUsageIndicator } from "@/components/context-usage-indicator";+import { Checkbox } from "@/components/ui/checkbox";+import { IconCode } from "@/components/ui/icons";+import { CodeBlock } from "@/components/ui/codeblock";+import { SqlAutocompleteInput } from "@/components/sql-autocomplete-input";+import { cn, removeDuplicateSelections } from "@/lib/utils";+import {+ ExampleSearch,+ ExampleSearchCards,+} from "@/components/example-search-cards";+import { useDebounce } from "@/lib/hooks/use-debounce";+import { useHealthCheck } from "@/lib/hooks/use-health-check";+import {+ SearchHistory,+ useSearchHistory,+} from "@/lib/hooks/use-search-history";+import {+ CommandInput,+ CommandList,+ CommandEmpty,+ CommandGroup,+ CommandItem,+ Command,+} from "./ui/command";+import { Speaker } from "@screenpipe/js";+import {+ Popover,+ PopoverContent,+ PopoverTrigger,+} from "@/components/ui/popover";+import { useSettings } from "@/lib/hooks/use-settings";++interface Agent {+ id: string;+ name: string;+ description: string;+ dataSelector: (results: ContentItem[]) => any;+ systemPrompt: string;+}++const AGENTS: Agent[] = [+ {+ id: "context-master",+ name: "context master",+ description: "analyzes everything: apps, windows, text & audio",+ systemPrompt:+ "you analyze all types of data from screen recordings and audio transcriptions. provide comprehensive insights.",+ dataSelector: (results) => results,+ },+ {+ id: "window-detective",+ name: "window detective",+ description: "focuses on app usage patterns",+ systemPrompt:+ "you specialize in analyzing app usage patterns and window switching behavior. help users understand their app usage.",+ dataSelector: (results) =>+ results+ .filter(+ (item) =>+ item.type === "OCR" &&+ (item.content.appName || item.content.windowName)+ )+ .map((item) => ({+ timestamp: item.content.timestamp,+ // @ts-ignore+ appName: item.content.appName,+ // @ts-ignore+ windowName: item.content.windowName,+ })),+ },+ {+ id: "text-oracle",+ name: "text oracle",+ description: "analyzes screen text (OCR)",+ systemPrompt:+ "you focus on text extracted from screen recordings. help users find and understand text content.",+ dataSelector: (results) =>+ results+ .filter((item) => item.type === "OCR")+ .map((item) => ({+ timestamp: item.content.timestamp,+ text: item.content.text,+ appName: item.content.appName,+ })),+ },+ {+ id: "voice-sage",+ name: "voice sage",+ description: "focuses on audio transcriptions",+ systemPrompt:+ "you analyze audio transcriptions from recordings. help users understand spoken content.",+ dataSelector: (results) =>+ results+ .filter((item) => item.type === "Audio")+ .map((item) => ({+ timestamp: item.content.timestamp,+ transcription: item.content.transcription,+ })),+ },+];++// Add this helper function to highlight keywords in text+const highlightKeyword = (text: string, keyword: string): JSX.Element => {+ if (!keyword || !text) return <>{text}</>;++ const parts = text.split(new RegExp(`(${keyword})`, "gi"));+ return (+ <>+ {parts.map((part, i) =>+ part.toLowerCase() === keyword.toLowerCase() ? (+ <span+ key={i}+ className="bg-yellow-200 dark:bg-yellow-800 rounded px-0.5"+ >+ {part}+ </span>+ ) : (+ part+ )+ )}+ </>+ );+};++// Update the getContextAroundKeyword function to return both text and positions+const getContextAroundKeyword = (+ text: string,+ keyword: string,+ contextLength: number = 40+): string => {+ if (!keyword || !text) return text;++ const index = text.toLowerCase().indexOf(keyword.toLowerCase());+ if (index === -1) return text;++ const start = Math.max(0, index - contextLength);+ const end = Math.min(text.length, index + keyword.length + contextLength);++ let result = text.slice(start, end);+ if (start > 0) result = "..." + result;+ if (end < text.length) result = result + "...";++ return result;+};++export function SearchChat() {+ const {+ searches,+ currentSearchId,+ setCurrentSearchId,+ addSearch,+ deleteSearch,+ isCollapsed,+ toggleCollapse,+ } = useSearchHistory();+ // Search state+ const { health } = useHealthCheck();+ const [query, setQuery] = useState("");+ const [results, setResults] = useState<ContentItem[]>([]);+ const [isLoading, setIsLoading] = useState(false);+ const [startDate, setStartDate] = useState<Date>(+ new Date(Date.now() - 24 * 3600000)+ );+ const [endDate, setEndDate] = useState<Date>(new Date());+ const [includeFrames, setIncludeFrames] = useState(false);+ const [limit, setLimit] = useState(30);+ const [appName, setAppName] = useState("");+ const [windowName, setWindowName] = useState("");+ const [contentType, setContentType] = useState("all");+ const [offset, setOffset] = useState(0);+ const [totalResults, setTotalResults] = useState(0);+ const { settings } = useSettings();+ const [isAiLoading, setIsAiLoading] = useState(false);+ const [minLength, setMinLength] = useState(50);+ const [maxLength, setMaxLength] = useState(10000);+ const [speakers, setSpeakers] = useState<Speaker[]>([]);+ const [selectedSpeakers, setSelectedSpeakers] = useState<{+ [key: number]: Speaker;+ }>({});+ const [openSpeakers, setOpenSpeakers] = useState(false);+ // Chat state+ const [chatMessages, setChatMessages] = useState<Array<Message>>([]);++ const { toast } = useToast();+ const [progress, setProgress] = useState(0);++ const [floatingInput, setFloatingInput] = useState("");+ const [isFloatingInputVisible, setIsFloatingInputVisible] = useState(false);++ const floatingInputRef = useRef<HTMLInputElement>(null);+ const [showScrollButton, setShowScrollButton] = useState(false);++ const [isUserScrolling, setIsUserScrolling] = useState(false);+ const lastScrollPosition = useRef(0);++ const MAX_CONTENT_LENGTH = settings.aiMaxContextChars;++ const [selectedResults, setSelectedResults] = useState<Set<number>>(+ new Set()+ );+ const [similarityThreshold, setSimilarityThreshold] = useState(1);+ const [hoveredResult, setHoveredResult] = useState<number | null>(null);++ const [isCurlDialogOpen, setIsCurlDialogOpen] = useState(false);++ const [isStreaming, setIsStreaming] = useState(false);+ const abortControllerRef = useRef<AbortController | null>(null);++ const [selectAll, setSelectAll] = useState(true);++ const [showExamples, setShowExamples] = useState(true);++ const [hasSearched, setHasSearched] = useState(false);++ const [isFiltering, setIsFiltering] = useState(false);+ const debouncedThreshold = useDebounce(similarityThreshold, 300);++ const [isQueryParamsDialogOpen, setIsQueryParamsDialogOpen] = useState(false);++ // Add state for individual content types+ const [selectedTypes, setSelectedTypes] = useState({+ ocr: false,+ audio: false,+ ui: false,+ });++ // Add new state near the top with other state declarations+ const [hideDeselected, setHideDeselected] = useState(false);++ const [currentPlatform, setCurrentPlatform] = useState<string | null>(null);++ const [speakerSearchQuery, setSpeakerSearchQuery] = useState("");++ useEffect(() => {+ if (Object.keys(selectedSpeakers).length > 0) {+ setSelectedTypes({+ ocr: false,+ ui: false,+ audio: true,+ });+ setContentType("audio");+ }+ }, [selectedSpeakers]);++ useEffect(() => {+ // More reliable OS detection+ const platform = window.navigator.platform.toLowerCase();+ const os = platform.includes("mac")+ ? "macos"+ : platform.includes("win")+ ? "windows"+ : platform.includes("linux")+ ? "linux"+ : "unknown";++ setCurrentPlatform(os);+ }, []);++ const handleSpeakerChange = (speaker: Speaker) => {+ setSelectedSpeakers((prev) => {+ const newSpeakers = { ...prev, [speaker.id]: speaker };++ if (prev[speaker.id]) {+ delete newSpeakers[speaker.id];+ }++ return newSpeakers;+ });+ };++ useEffect(() => {+ if (isQueryParamsDialogOpen && !speakers.length) {+ loadSpeakers();+ }+ }, [isQueryParamsDialogOpen]);++ useEffect(() => {+ loadSpeakers();+ }, [speakerSearchQuery]);++ const loadSpeakers = async () => {+ try {+ const getSpeakers = await fetch(+ `http://localhost:3030/speakers/search?name=${speakerSearchQuery}`+ );+ const speakers = await getSpeakers.json();+ setSpeakers(speakers);+ } catch (error) {+ console.error("Error loading speakers:", error);+ setSpeakers([]);+ }+ };++ // Update content type when checkboxes change+ const handleContentTypeChange = (type: "ocr" | "audio" | "ui") => {+ const newTypes = { ...selectedTypes, [type]: !selectedTypes[type] };+ setSelectedTypes(newTypes);++ if (Object.keys(selectedSpeakers).length > 0) {+ setSelectedTypes({+ ocr: false,+ ui: false,+ audio: true,+ });+ setContentType("audio");+ }++ // Convert checkbox state to content type+ if (!newTypes.ocr && !newTypes.audio && !newTypes.ui) {+ setContentType("all"); // fallback to all if nothing selected+ } else if (newTypes.audio && newTypes.ui && !newTypes.ocr) {+ setContentType("audio+ui");+ } else if (newTypes.ocr && newTypes.ui && !newTypes.audio) {+ setContentType("ocr+ui");+ } else if (newTypes.audio && newTypes.ocr && !newTypes.ui) {+ setContentType("audio+ocr");+ } else if (newTypes.audio) {+ setContentType("audio");+ } else if (newTypes.ocr) {+ setContentType("ocr");+ } else if (newTypes.ui) {+ setContentType("ui"); // This was missing - single UI type+ } else {+ setContentType("all");+ }+ };++ const [selectedAgent, setSelectedAgent] = useState<Agent>(AGENTS[0]);++ useEffect(() => {+ const updateDates = () => {+ const now = new Date();+ setEndDate(now);+ // Optionally update startDate if you want to maintain a rolling time window+ // setStartDate(new Date(now.getTime() - 24 * 3600000)); // 24 hours ago+ };++ // Update dates immediately+ updateDates();++ // Set up interval to update dates every 5 minutes+ const intervalId = setInterval(updateDates, 5 * 60 * 1000);++ // Add event listener for when the page becomes visible+ document.addEventListener("visibilitychange", () => {+ if (!document.hidden) {+ updateDates();+ }+ });++ // Clean up on component unmount+ return () => {+ clearInterval(intervalId);+ document.removeEventListener("visibilitychange", updateDates);+ };+ }, []);++ const handleExampleSelect = async (example: ExampleSearch) => {+ const newWindowName = example.windowName || "";+ const newAppName = example.appName || "";+ const newLimit = example.limit || limit;+ const newMinLength = example.minLength || minLength;+ const newContentType =+ (example.contentType as "all" | "ocr" | "audio") || contentType;+ const newStartDate = example.startDate;++ setWindowName(newWindowName);+ setAppName(newAppName);+ setLimit(newLimit);+ setMinLength(newMinLength);+ setContentType(newContentType);+ setStartDate(newStartDate);+ setShowExamples(false);++ handleSearch(0, {+ windowName: newWindowName,+ appName: newAppName,+ limit: newLimit,+ minLength: newMinLength,+ contentType: newContentType,+ startDate: newStartDate,+ });+ };++ const generateCurlCommand = () => {+ const baseUrl = "http://localhost:3030";+ const params = {+ content_type: contentType,+ limit: limit.toString(),+ offset: offset.toString(),+ start_time: startDate.toISOString(),+ end_time: endDate.toISOString(),+ min_length: minLength.toString(),+ max_length: maxLength.toString(),+ q: query,+ app_name: appName,+ window_name: windowName,+ include_frames: includeFrames ? "true" : undefined,+ };++ const queryParams = Object.entries(params)+ .filter(([_, value]) => value !== undefined && value !== "")+ .map(([key, value]) => `${key}=${encodeURIComponent(value!)}`)+ .join("&");++ return `curl "${baseUrl}/search?${queryParams}" | jq`;+ };++ useEffect(() => {+ if (results.length > 0) {+ setSelectedResults(new Set(results.map((_, index) => index)));+ setSelectAll(true);+ }+ }, [results]);++ useEffect(() => {+ handleFilterDuplicates();+ }, [debouncedThreshold, results]);++ const handleFilterDuplicates = async () => {+ if (similarityThreshold === 1) {+ setSelectedResults(new Set(results.map((_, index) => index)));+ setSelectAll(true);+ return;+ }+ setIsFiltering(true);+ // simulate a delay to show loading state+ await new Promise((resolve) => setTimeout(resolve, 100));++ const allIndices = new Set(results.map((_, index) => index));+ setSelectedResults(+ removeDuplicateSelections(results, allIndices, debouncedThreshold)+ );+ setSelectAll(false);+ setIsFiltering(false);+ };++ useEffect(() => {+ const handleScroll = () => {+ const currentScrollPosition = window.scrollY;+ const scrollPercentage =+ (currentScrollPosition /+ (document.documentElement.scrollHeight - window.innerHeight)) *+ 100;+ const shouldShow = scrollPercentage < 90; // Show when scrolled up more than 10%++ setShowScrollButton(shouldShow);++ // Check if user is scrolling up while AI is loading+ if (isAiLoading && currentScrollPosition < lastScrollPosition.current) {+ setIsUserScrolling(true);+ }++ lastScrollPosition.current = currentScrollPosition;+ };++ window.addEventListener("scroll", handleScroll);++ return () => window.removeEventListener("scroll", handleScroll);+ }, [isAiLoading]);++ const scrollToBottom = () => {+ if (!isUserScrolling) {+ window.scrollTo({+ top: document.documentElement.scrollHeight,+ behavior: "smooth",+ });+ }+ };++ useEffect(() => {+ const handleKeyDown = (event: KeyboardEvent) => {+ if (event.key === "/") {+ event.preventDefault();+ setIsFloatingInputVisible(true);+ } else if (event.key === "Escape") {+ setIsFloatingInputVisible(false);+ }+ };++ window.addEventListener("keydown", handleKeyDown);+ return () => window.removeEventListener("keydown", handleKeyDown);+ }, []);++ useEffect(() => {+ if (isFloatingInputVisible && floatingInputRef.current) {+ floatingInputRef.current.focus();+ }+ }, [isFloatingInputVisible]);++ const handleResultSelection = (index: number) => {+ setSelectedResults((prev) => {+ const newSet = new Set(prev);+ if (newSet.has(index)) {+ newSet.delete(index);+ } else {+ newSet.add(index);+ }+ return newSet;+ });+ };++ const calculateSelectedContentLength = () => {+ return Array.from(selectedResults).reduce((total, index) => {+ const item = results[index];+ if (!item || !item.type) return total; // Add this check++ const contentLength =+ item.type === "OCR"+ ? item.content.text.length+ : item.type === "Audio"+ ? item.content.transcription.length+ : item.type === "UI"+ ? item.content.text.length+ : 0;+ return total + contentLength;+ }, 0);+ };++ const handleFloatingInputSubmit = async (e: React.FormEvent) => {+ e.preventDefault();+ if (!floatingInput.trim() && !isStreaming) return;++ if (isStreaming) {+ handleStopStreaming();+ return;+ }++ scrollToBottom();++ const selectedContentLength = calculateSelectedContentLength();+ if (selectedContentLength > MAX_CONTENT_LENGTH) {+ toast({+ title: "Content too large",+ description: `The selected content length (${selectedContentLength} characters) exceeds the maximum allowed (${MAX_CONTENT_LENGTH} characters). Please unselect some items to reduce the amount of content.`,+ variant: "destructive",+ });+ return;+ }++ const userMessage = {+ id: generateId(),+ role: "user" as const,+ content: floatingInput,+ };+ setChatMessages((prevMessages) => [+ ...prevMessages,+ userMessage,+ { id: generateId(), role: "assistant", content: "" },+ ]);+ setFloatingInput("");+ setIsAiLoading(true);++ try {+ const openai = new OpenAI({+ apiKey: settings.openaiApiKey,+ baseURL: settings.aiUrl,+ dangerouslyAllowBrowser: true,+ });+ console.log("openai", settings.openaiApiKey, settings.aiUrl);++ const model = settings.aiModel;+ const customPrompt = settings.customPrompt || "";++ const messages = [+ {+ role: "system" as const,+ content: `You are a helpful assistant specialized as a "${+ selectedAgent.name+ }". ${selectedAgent.systemPrompt}+ Rules:+ - Current time (JavaScript Date.prototype.toString): ${new Date().toString()}+ - User timezone: ${Intl.DateTimeFormat().resolvedOptions().timeZone}+ - User timezone offset: ${new Date().getTimezoneOffset()}+ - ${customPrompt ? `Custom prompt: ${customPrompt}` : ""}+ `,+ },+ ...chatMessages.map((msg) => ({+ role: msg.role as "user" | "assistant" | "system",+ content: msg.content,+ })),+ {+ role: "user" as const,+ content: `Context data: ${JSON.stringify(+ selectedAgent.dataSelector(+ results.filter((_, index) => selectedResults.has(index))+ )+ )}++ User query: ${floatingInput}`,+ },+ ];++ console.log("messages", messages);++ abortControllerRef.current = new AbortController();+ setIsStreaming(true);++ const stream = await openai.chat.completions.create(+ {+ model: model,+ messages: messages,+ stream: true,+ },+ {+ signal: abortControllerRef.current.signal,+ }+ );++ let fullResponse = "";+ // @ts-ignore+ setChatMessages((prevMessages) => [+ ...prevMessages.slice(0, -1),+ { id: generateId(), role: "assistant", content: fullResponse },+ ]);++ setIsUserScrolling(false);+ lastScrollPosition.current = window.scrollY;+ scrollToBottom();++ for await (const chunk of stream) {+ const content = chunk.choices[0]?.delta?.content || "";+ fullResponse += content;+ // @ts-ignore+ setChatMessages((prevMessages) => [+ ...prevMessages.slice(0, -1),+ { id: generateId(), role: "assistant", content: fullResponse },+ ]);+ scrollToBottom();+ }+ } catch (error: any) {+ if (error.toString().includes("aborted")) {+ console.log("Streaming was aborted");+ } else {+ console.error("Error generating AI response:", error);+ toast({+ title: "Error",+ description: "Failed to generate AI response. Please try again.",+ variant: "destructive",+ });+ }+ } finally {+ setIsAiLoading(false);+ setIsFloatingInputVisible(false);+ setIsStreaming(false);+ if (!isUserScrolling) {+ scrollToBottom();+ }+ }+ };++ const handleStopStreaming = () => {+ if (abortControllerRef.current) {+ abortControllerRef.current.abort();+ setIsStreaming(false);+ setIsAiLoading(false);+ }+ };++ const handleSearch = async (newOffset = 0, overrides: any = {}) => {+ setHasSearched(true);+ setShowExamples(false);+ setIsLoading(true);+ setOffset(newOffset);+ setProgress(0);+ setChatMessages([]);+ scrollToBottom();+ setResults([]);+ setSimilarityThreshold(1); // Reset similarity threshold to 1++ try {+ const searchParams = {+ q: query || undefined,+ contentType: overrides.contentType || contentType,+ limit: overrides.limit || limit,+ offset: newOffset,+ startTime:+ overrides.startDate?.toISOString() || startDate.toISOString(),+ endTime: endDate.toISOString(),+ appName: overrides.appName || appName || undefined,+ windowName: overrides.windowName || windowName || undefined,+ includeFrames: includeFrames,+ minLength: overrides.minLength || minLength,+ maxLength: maxLength,+ speakerIds: Object.values(selectedSpeakers).map(+ (speaker) => speaker.id+ ),+ };++ const response = await pipe.queryScreenpipe(searchParams);++ // Add debug logging+ console.log("search response:", response);++ if (!response || !Array.isArray(response.data)) {+ throw new Error("invalid response data");+ }++ setResults(response.data);+ setTotalResults(response.pagination.total);++ // Save search to history+ // await onAddSearch(searchParams, response.data);+ } catch (error) {+ console.error("search error:", error);+ toast({+ title: "error",+ description: "failed to fetch search results. please try again.",+ variant: "destructive",+ });+ setResults([]);+ setTotalResults(0);+ } finally {+ setIsLoading(false);+ }+ };++ const handleNextPage = () => {+ if (offset + limit < totalResults) {+ handleSearch(offset + limit);+ }+ };++ const handlePrevPage = () => {+ if (offset - limit >= 0) {+ handleSearch(offset - limit);+ }+ };++ const handleBadgeClick = (value: string, type: "app" | "window") => {+ if (type === "app") {+ setAppName(value);+ } else {+ setWindowName(value);+ }+ };++ const handleSelectAll = (checked: boolean) => {+ setSelectAll(checked);+ if (checked) {+ setSelectedResults(new Set(results.map((_, index) => index)));+ } else {+ setSelectedResults(new Set());+ }+ };++ const handleQuickTimeFilter = (minutes: number) => {+ const now = new Date();+ const newStartDate = new Date(now.getTime() - minutes * 60000);+ setStartDate(newStartDate);+ setEndDate(now);+ };++ const renderSearchResults = () => {+ if (isLoading) {+ return Array(3)+ .fill(0)+ .map((_, index) => (+ <Card key={index}>+ <CardContent className="p-4">+ <Skeleton className="h-4 w-1/4 mb-2" />+ <Skeleton className="h-4 w-full mb-2" />+ <Skeleton className="h-4 w-full mb-2" />+ <Skeleton className="h-4 w-3/4" />+ </CardContent>+ </Card>+ ));+ }++ if (hasSearched && results.length === 0) {+ return <p className="text-center">no results found</p>;+ }++ if (!hasSearched || results.length === 0) {+ return null;+ }++ // First filter results based on hideDeselected setting+ const visibleResults = results+ .map((item, index) => ({ item, originalIndex: index }))+ .filter(+ ({ originalIndex }) =>+ !hideDeselected || selectedResults.has(originalIndex)+ );++ return visibleResults.map(({ item, originalIndex }) => (+ <motion.div+ key={originalIndex}+ className="flex items-center mb-4 relative pl-8"+ >+ <div className="absolute left-0 top-1/2 transform -translate-y-1/2">+ <Checkbox+ checked={selectedResults.has(originalIndex)}+ onCheckedChange={() => handleResultSelection(originalIndex)}+ />+ </div>+ <Card className="w-full">+ <CardContent className="p-4">+ <Accordion type="single" collapsible className="w-full">+ <AccordionItem value={`item-${originalIndex}`}>+ <AccordionTrigger className="flex flex-col w-full py-2">+ {/* Main content */}+ <div className="flex w-full items-center gap-2">+ <span className="text-left truncate">+ {item.type === "OCR" &&+ highlightKeyword(+ getContextAroundKeyword(item.content.text, query),+ query+ )}+ {item.type === "Audio" &&+ highlightKeyword(+ getContextAroundKeyword(+ item.content.transcription,+ query+ ),+ query+ )}+ {item.type === "UI" &&+ highlightKeyword(+ getContextAroundKeyword(item.content.text, query),+ query+ )}+ </span>+ </div>+ </AccordionTrigger>+ <AccordionContent>+ {item.type === "UI" && (+ <>+ <div className="max-h-[400px] overflow-y-auto rounded border border-gray-100 dark:border-gray-800 p-4">+ <p className="whitespace-pre-line">+ {highlightKeyword(item.content.text, query)}+ </p>+ </div>+ <div className="flex justify-center mt-4">+ <VideoComponent filePath={item.content.filePath} />+ </div>+ <div className="flex flex-wrap items-center gap-2 mt-2">+ {item.content.appName && (+ <Badge+ className="text-xs cursor-pointer"+ onClick={() =>+ handleBadgeClick(item.content.appName, "app")+ }+ >+ {item.content.appName}+ </Badge>+ )}+ {item.content.windowName && (+ <Badge+ className="text-xs cursor-pointer"+ onClick={() =>+ handleBadgeClick(+ item.content.windowName,+ "window"+ )+ }+ >+ {item.content.windowName}+ </Badge>+ )}+ </div>+ </>+ )}+ {item.type === "OCR" && (+ <>+ <div className="max-h-[400px] overflow-y-auto rounded border border-gray-100 dark:border-gray-800 p-4">+ <p className="whitespace-pre-line">+ {highlightKeyword(item.content.text, query)}+ </p>+ </div>+ <div className="flex justify-center mt-4">+ <VideoComponent filePath={item.content.filePath} />+ </div>+ {includeFrames && item.content.frame && (+ <div className="mt-2 flex items-center">+ <Dialog>+ <DialogTrigger asChild>+ <img+ src={`data:image/jpeg;base64,${item.content.frame}`}+ alt="Frame"+ className="w-24 h-auto cursor-pointer"+ />+ </DialogTrigger>+ <DialogContent className="sm:max-w-[80vw]">+ <img+ src={`data:image/jpeg;base64,${item.content.frame}`}+ alt="Frame"+ className="w-full h-auto"+ />+ </DialogContent>+ </Dialog>+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircle className="h-4 w-4 text-gray-400 ml-2 cursor-help" />+ </TooltipTrigger>+ <TooltipContent>+ <p>this is the frame where the text appeared</p>+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>+ </div>+ )}+ </>+ )}+ {item.type === "Audio" && (+ <>+ <div className="max-h-[400px] overflow-y-auto rounded border border-gray-100 dark:border-gray-800 p-4">+ <p className="whitespace-pre-line">+ {highlightKeyword(item.content.transcription, query)}+ </p>+ </div>+ {item.content.filePath &&+ item.content.filePath.trim() !== "" ? (+ <div className="flex justify-center mt-4">+ <VideoComponent filePath={item.content.filePath} />+ </div>+ ) : (+ <p className="text-gray-500 italic mt-2">+ no file path available for this audio.+ </p>+ )}+ </>+ )}+ </AccordionContent>+ </AccordionItem>+ </Accordion>+ <div className="flex flex-wrap items-center gap-2 mt-2">+ <Badge variant="outline" className="text-xs">+ {item.type}+ </Badge>+ <p className="text-xs text-gray-400">+ {new Date(item.content.timestamp).toLocaleString()}{" "}+ {/* Display local time */}+ </p>+ {item.type === "Audio" && item.content.speaker?.name && (+ <p className="text-xs text-gray-400">+ {item.content.speaker.name}+ </p>+ )}+ {item.type === "OCR" && item.content.appName && (+ <div className="flex items-center gap-1">+ <span className="text-xs text-muted-foreground">app:</span>+ <Badge+ className="text-xs cursor-pointer"+ onClick={() =>+ handleBadgeClick(item.content.appName, "app")+ }+ >+ {item.content.appName}+ </Badge>+ </div>+ )}+ {item.type === "OCR" && item.content.windowName && (+ <div className="flex items-center gap-1">+ <span className="text-xs text-muted-foreground">window:</span>+ <Badge+ className="text-xs cursor-pointer"+ onClick={() =>+ handleBadgeClick(item.content.windowName, "window")+ }+ >+ {item.content.windowName}+ </Badge>+ </div>+ )}+ {"tags" in item.content &&+ item.content.tags &&+ item.content.tags.map((tag, index) => (+ <Badge key={index} className="text-xs">+ {tag}+ </Badge>+ ))}+ </div>+ </CardContent>+ </Card>+ </motion.div>+ ));+ };++ // Add effect to restore search when currentSearchId changes+ useEffect(() => {+ // if (currentSearchId) {+ const selectedSearch = searches.find((s) => s.id === currentSearchId);+ if (selectedSearch) {+ // Restore search parameters+ setQuery(selectedSearch.searchParams.q || "");+ setContentType(selectedSearch.searchParams.content_type);+ setLimit(selectedSearch.searchParams.limit);+ setStartDate(new Date(selectedSearch.searchParams.start_time));+ setEndDate(new Date(selectedSearch.searchParams.end_time));+ setAppName(selectedSearch.searchParams.app_name || "");+ setWindowName(selectedSearch.searchParams.window_name || "");+ setIncludeFrames(selectedSearch.searchParams.include_frames);+ setMinLength(selectedSearch.searchParams.min_length);+ setMaxLength(selectedSearch.searchParams.max_length);++ // Restore results+ setResults(selectedSearch.results);+ setTotalResults(selectedSearch.results.length);+ setHasSearched(true);+ setShowExamples(false);++ // Restore messages if any+ if (selectedSearch.messages) {+ setChatMessages(+ selectedSearch.messages.map((msg) => ({+ id: msg.id,+ role: msg.type === "ai" ? "assistant" : "user",+ content: msg.content,+ }))+ );+ }+ }+ // }+ }, [currentSearchId, searches]);++ const handleNewSearch = () => {+ // setCurrentSearchId(null);+ location.reload();+ // Add any other reset logic you need+ };+ return (+ <div className="w-full max-w-4xl mx-auto p-4 mt-12">+ <div className="fixed top-4 left-4 z-50 flex items-center gap-2">+ {/* <SidebarTrigger className="h-8 w-8" /> */}+ <Button+ variant="ghost"+ size="icon"+ onClick={handleNewSearch}+ className="h-8 w-8"+ >+ <Plus className="h-4 w-4" />+ </Button>+ </div>+ {/* Content Type Checkboxes and Code Button */}+ <div className="flex items-center justify-between mb-2">+ <div className="flex items-center space-x-4">+ <div className="flex items-center space-x-1">+ <Checkbox+ id="audio-type"+ checked={selectedTypes.audio}+ onCheckedChange={() => handleContentTypeChange("audio")}+ className="h-4 w-4"+ />+ <Label htmlFor="audio-type" className="text-xs">+ speech+ </Label>+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircle className="h-3 w-3 text-muted-foreground ml-0.5" />+ </TooltipTrigger>+ <TooltipContent>+ <p>audio transcripts</p>+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>+ </div>+ {currentPlatform === "macos" && (+ <div className="flex items-center space-x-1">+ <Checkbox+ id="ui-type"+ checked={selectedTypes.ui}+ onCheckedChange={() => handleContentTypeChange("ui")}+ className="h-4 w-4"+ />+ <Label htmlFor="ui-type" className="text-xs">+ screen UI+ </Label>+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircle className="h-3 w-3 text-muted-foreground ml-0.5" />+ </TooltipTrigger>+ <TooltipContent>+ <p>+ text emitted directly from the source code of the desktop+ applications+ </p>+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>+ </div>+ )}+ <div className="flex items-center space-x-1">+ <Checkbox+ id="ocr-type"+ checked={selectedTypes.ocr}+ onCheckedChange={() => handleContentTypeChange("ocr")}+ className="h-4 w-4"+ />+ <Label htmlFor="ocr-type" className="text-xs">+ screen capture+ </Label>+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircle className="h-3 w-3 text-muted-foreground ml-0.5" />+ </TooltipTrigger>+ <TooltipContent>+ <p>+ recognized text from screenshots taken every 5s by default+ </p>+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>+ </div>+ </div>++ <Dialog open={isCurlDialogOpen} onOpenChange={setIsCurlDialogOpen}>+ <DialogTrigger asChild>+ <Button variant="outline" className="text-sm">+ <IconCode className="h-4 w-4 mx-2" />+ </Button>+ </DialogTrigger>+ <DialogContent className="max-w-2xl">+ <DialogHeader>+ <DialogTitle>curl command</DialogTitle>+ <DialogDescription>+ you can use this curl command to make the same search request+ from the command line.+ <br />+ <br />+ <span className="text-xs text-gray-500">+ note: you need to have `jq` installed to use the command.+ </span>{" "}+ </DialogDescription>+ </DialogHeader>+ <div className="overflow-x-auto">+ <CodeBlock language="bash" value={generateCurlCommand()} />+ </div>+ </DialogContent>+ </Dialog>+ </div>++ {/* Existing search bar and other controls */}+ <div className="flex items-center gap-4 mb-4">+ {/* Keyword search - smaller width */}+ <Input+ type="text"+ value={query}+ onChange={(e) => setQuery(e.target.value)}+ onKeyDown={(e) => {+ if (e.key === "Enter") {+ handleSearch(0);+ }+ }}+ placeholder="keyword search, you may leave it blank"+ className="w-[350px]"+ autoCorrect="off"+ autoComplete="off"+ />++ {/* Window name filter - increased width */}+ <SqlAutocompleteInput+ id="window-name"+ type="window"+ value={windowName}+ onChange={setWindowName}+ placeholder="filter by window"+ className="w-[300px]"+ icon={<Layout className="h-4 w-4" />}+ />++ {/* Advanced button */}+ <Button+ variant="outline"+ onClick={() => setIsQueryParamsDialogOpen(true)}+ >+ advanced+ </Button>++ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <span>+ <Button+ onClick={() => handleSearch(0)}+ disabled={isLoading || !health || health?.status === "error"}+ >+ {isLoading ? (+ <>+ <Loader2 className="mr-2 h-4 w-4 animate-spin" />+ searching...+ </>+ ) : (+ <>+ <Search className="mr-2 h-4 w-4" />+ search+ </>+ )}+ </Button>+ </span>+ </TooltipTrigger>+ {health?.status === "error" && (+ <TooltipContent>+ <p>screenpipe is not running...</p>+ </TooltipContent>+ )}+ </Tooltip>+ </TooltipProvider>+ </div>++ <div className="flex flex-wrap items-center gap-4 mb-4">+ <div className="flex-grow space-y-2">+ <div className="flex items-center space-x-2">+ <Label htmlFor="start-date">start date</Label>+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircle className="h-4 w-4 text-gray-400" />+ </TooltipTrigger>+ <TooltipContent>+ <p>select the start date to search for content</p>+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>+ </div>+ <DateTimePicker+ date={startDate}+ setDate={setStartDate}+ className="w-full"+ />+ </div>++ <div className="flex-grow space-y-2">+ <div className="flex items-center space-x-2">+ <Label htmlFor="end-date">end date</Label>+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircle className="h-4 w-4 text-gray-400" />+ </TooltipTrigger>+ <TooltipContent>+ <p>select the end date to search for content</p>+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>+ </div>+ <DateTimePicker+ date={endDate}+ setDate={setEndDate}+ className="w-full"+ />+ </div>+ </div>++ <div className="flex mt-4 space-x-2 justify-center">+ <Badge+ variant="outline"+ className="cursor-pointer hover:bg-secondary"+ onClick={() => handleQuickTimeFilter(30)}+ >+ <Clock className="mr-2 h-4 w-4" />+ last 30m+ </Badge>+ <Badge+ variant="outline"+ className="cursor-pointer hover:bg-secondary"+ onClick={() => handleQuickTimeFilter(60)}+ >+ <Clock className="mr-2 h-4 w-4" />+ last 60m+ </Badge>+ <Badge+ variant="outline"+ className="cursor-pointer hover:bg-secondary"+ onClick={() => handleQuickTimeFilter(24 * 60)}+ >+ <Clock className="mr-2 h-4 w-4" />+ last 24h+ </Badge>+ <Badge+ variant="outline"+ className="cursor-pointer hover:bg-secondary"+ onClick={() => handleQuickTimeFilter(7 * 24 * 60)}+ >+ <Clock className="mr-2 h-4 w-4" />+ last 7d+ </Badge>+ <Badge+ variant="outline"+ className="cursor-pointer hover:bg-secondary"+ onClick={() => handleQuickTimeFilter(30 * 24 * 60)}+ >+ <Clock className="mr-2 h-4 w-4" />+ last 30d+ </Badge>+ </div>++ <Dialog+ open={isQueryParamsDialogOpen}+ onOpenChange={setIsQueryParamsDialogOpen}+ >+ <DialogContent className="sm:max-w-[605px]">+ <DialogHeader>+ <DialogTitle>advanced search parameters</DialogTitle>+ <DialogDescription>+ adjust additional search parameters here.+ </DialogDescription>+ </DialogHeader>+ <div className="grid gap-4 py-4">+ {/* Remove the query section */}+ {/* <div className="grid grid-cols-4 items-center gap-4">+ <Label htmlFor="query" className="text-right">+ query+ </Label>+ ... query input ...+ </div> */}++ {/* Keep other advanced search options */}+ <div className="grid grid-cols-4 items-center gap-4">+ <Label htmlFor="app-name" className="text-right">+ app name+ </Label>+ <div className="col-span-3 flex items-center">+ <SqlAutocompleteInput+ id="app-name"+ type="app"+ icon={<Laptop className="h-4 w-4" />}+ value={appName}+ onChange={setAppName}+ placeholder="filter by app name"+ className="flex-grow"+ />+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircle className="h-4 w-4 text-gray-400 ml-2 cursor-help" />+ </TooltipTrigger>+ <TooltipContent>+ <p>filter results by specific application names</p>+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>+ </div>+ </div>+ <div className="grid grid-cols-4 items-center gap-4">+ <Label htmlFor="min-length" className="text-right">+ min length+ </Label>+ <div className="col-span-3 flex items-center">+ <Input+ id="min-length"+ type="number"+ value={minLength}+ onChange={(e) => setMinLength(Number(e.target.value))}+ className="flex-grow"+ />+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircle className="h-4 w-4 text-gray-400 ml-2 cursor-help" />+ </TooltipTrigger>+ <TooltipContent>+ <p>+ enter the minimum length of the content to search for+ <br />+ usually transcriptions are short while text extracted+ from images can be long.+ </p>+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>+ </div>+ </div>+ <div className="grid grid-cols-4 items-center gap-4">+ <Label htmlFor="max-length" className="text-right">+ max length+ </Label>+ <div className="col-span-3 flex items-center">+ <Input+ id="max-length"+ type="number"+ value={maxLength}+ onChange={(e) => setMaxLength(Number(e.target.value))}+ className="flex-grow"+ />+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircle className="h-4 w-4 text-gray-400 ml-2 cursor-help" />+ </TooltipTrigger>+ <TooltipContent>+ <p>+ enter the maximum length of the content to search for+ </p>+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>+ </div>+ </div>++ <div className="grid grid-cols-4 items-center gap-4">+ <Label htmlFor="limit-slider" className="text-right">+ page size: {limit}+ </Label>+ <div className="col-span-3 flex items-center">+ <Slider+ id="limit-slider"+ value={[limit]}+ onValueChange={(value: number[]) => setLimit(value[0])}+ min={10}+ max={15000}+ step={10}+ className="flex-grow"+ />+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircle className="h-4 w-4 text-gray-400 ml-2 cursor-help" />+ </TooltipTrigger>+ <TooltipContent>+ <p>+ select the number of results to display. usually ai+ cannot ingest more than 30 OCR results at a time and+ 1000 audio results at a time.+ </p>+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>+ </div>+ </div>+ </div>+ <div className="flex items-center justify-center space-x-2">+ <Switch+ id="include-frames"+ checked={includeFrames}+ onCheckedChange={setIncludeFrames}+ />+ <Label htmlFor="include-frames">include frames</Label>+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircle className="h-4 w-4 text-gray-400 cursor-help" />+ </TooltipTrigger>+ <TooltipContent>+ <p>+ include frames in the search results. this shows the frame+ where the text appeared. only works for ocr. this may slow+ down the search.+ </p>+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>+ </div>+ <div className="flex items-center justify-center space-x-2">+ <Label htmlFor="speakers" className="flex items-center space-x-2">+ <SpeechIcon className="h-4 w-4" />+ <span>speakers</span>+ </Label>+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircle className="h-4 w-4 text-gray-400 cursor-help" />+ </TooltipTrigger>+ <TooltipContent>+ <p>+ select the speakers to include in the search results. this+ will only show results from the selected speakers. note:+ only audio results can be returned+ </p>+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>+ <Popover open={openSpeakers} onOpenChange={setOpenSpeakers}>+ <PopoverTrigger asChild>+ <Button+ variant="outline"+ role="combobox"+ aria-expanded={openSpeakers}+ className="w-full justify-between"+ >+ {Object.values(selectedSpeakers).length > 0+ ? `${Object.values(selectedSpeakers)+ .map((s) => s.name)+ .join(", ")}`+ : "select speakers"}+ <ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />+ </Button>+ </PopoverTrigger>+ <PopoverContent className="w-full p-0">+ <Command>+ <CommandInput+ placeholder="search speakers..."+ value={speakerSearchQuery}+ onValueChange={setSpeakerSearchQuery}+ />+ <CommandList>+ <CommandEmpty>no speakers found.</CommandEmpty>+ <CommandGroup>+ {speakers.map((speaker: Speaker) => (+ <CommandItem+ key={speaker.id}+ value={speaker.name}+ onSelect={() => handleSpeakerChange(speaker)}+ >+ <div className="flex items-center">+ <Check+ className={cn(+ "mr-2 h-4 w-4",+ selectedSpeakers[speaker.id]+ ? "opacity-100"+ : "opacity-0"+ )}+ />+ <span+ style={{+ userSelect: "none",+ WebkitUserSelect: "none",+ MozUserSelect: "none",+ msUserSelect: "none",+ }}+ >+ {speaker.name}+ </span>+ </div>+ </CommandItem>+ ))}+ </CommandGroup>+ </CommandList>+ </Command>+ </PopoverContent>+ </Popover>+ </div>+ <DialogFooter>+ <Button onClick={() => setIsQueryParamsDialogOpen(false)}>+ done+ </Button>+ </DialogFooter>+ </DialogContent>+ </Dialog>++ {isLoading ? (+ <div className="my-8 flex justify-center">+ <Loader2 className="h-8 w-8 animate-spin" />+ </div>+ ) : (+ showExamples &&+ results.length === 0 && (+ <div className="my-8 flex justify-center">+ <ExampleSearchCards onSelect={handleExampleSelect} />+ </div>+ )+ )}+ {isLoading && (+ <div className="my-2">+ <Progress value={progress} className="w-full" />+ </div>+ )}+ {results.length > 0 && (+ <div className="flex flex-col space-y-4 mb-4 my-8">+ <div className="flex justify-between items-center">+ <div className="flex items-center space-x-4">+ <div className="flex items-center space-x-2">+ <Checkbox+ id="select-all"+ checked={selectAll}+ onCheckedChange={handleSelectAll}+ />+ <Label htmlFor="select-all">select all results</Label>+ </div>++ <Separator orientation="vertical" className="h-4" />++ <div className="flex items-center space-x-2">+ <Switch+ id="hide-deselected"+ checked={hideDeselected}+ onCheckedChange={setHideDeselected}+ />+ <Label htmlFor="hide-deselected">hide unselected</Label>+ </div>+ </div>++ <div className="flex items-center space-x-2">+ <Button+ variant="outline"+ size="sm"+ onClick={() => {+ setSimilarityThreshold(similarityThreshold === 0.5 ? 1 : 0.5);+ if (similarityThreshold === 0.5) {+ setSelectedResults(+ new Set(results.map((_, index) => index))+ );+ setSelectAll(true);+ }+ }}+ disabled={isFiltering}+ className="flex items-center gap-2 disabled:opacity-100"+ >+ {isFiltering ? (+ <Loader2 className="h-4 w-4 animate-spin" />+ ) : similarityThreshold === 0.5 ? (+ <Check className="h-4 w-4" />+ ) : (+ <Layers className="h-4 w-4" />+ )}+ {similarityThreshold === 0.5+ ? "duplicates removed"+ : "remove duplicates"}+ </Button>++ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircle className="h-4 w-4 text-gray-400 cursor-help" />+ </TooltipTrigger>+ <TooltipContent>+ <p>automatically unselect similar or duplicate results</p>+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>+ </div>+ </div>+ </div>+ )}+ <div className="space-y-4">+ {renderSearchResults()}+ {totalResults > 0 && (+ <div className="flex justify-between items-center mt-4">+ <Button+ onClick={handlePrevPage}+ disabled={offset === 0}+ variant="outline"+ size="sm"+ >+ <ChevronLeft className="mr-2 h-4 w-4" /> Previous+ </Button>+ <span className="text-sm text-gray-500">+ Showing {offset + 1} - {Math.min(offset + limit, totalResults)} of{" "}+ {totalResults}+ </span>+ <Button+ onClick={handleNextPage}+ disabled={offset + limit >= totalResults}+ variant="outline"+ size="sm"+ >+ Next <ChevronRight className="ml-2 h-4 w-4" />+ </Button>+ </div>+ )}+ </div>++ <AnimatePresence>+ {results.length > 0 && (+ <motion.div+ initial={{ opacity: 0, y: 50 }}+ animate={{ opacity: 1, y: 0 }}+ exit={{ opacity: 0, y: 50 }}+ className="fixed bottom-4 left-0 right-0 mx-auto w-full max-w-2xl z-50"+ >+ <form+ onSubmit={handleFloatingInputSubmit}+ className="flex flex-col space-y-2 bg-white dark:bg-gray-800 shadow-lg rounded-lg overflow-hidden p-4 border border-gray-200 dark:border-gray-700"+ >+ <div className="relative flex-grow flex items-center space-x-2">+ <Input+ ref={floatingInputRef}+ type="text"+ placeholder="ask a question about the results..."+ value={floatingInput}+ disabled={+ calculateSelectedContentLength() > MAX_CONTENT_LENGTH+ }+ onChange={(e) => setFloatingInput(e.target.value)}+ className="flex-1 h-12 focus:outline-none focus:ring-0 border-0 focus:border-black dark:focus:border-white focus:border-b transition-all duration-200"+ />++ <Select+ value={selectedAgent.id}+ onValueChange={(value) =>+ setSelectedAgent(+ AGENTS.find((a) => a.id === value) || AGENTS[0]+ )+ }+ >+ <SelectTrigger className="w-[170px] h-12">+ <SelectValue placeholder="select agent" />+ </SelectTrigger>+ <SelectContent>+ {AGENTS.map((agent) => (+ <SelectItem key={agent.id} value={agent.id}>+ <span className="font-mono text-sm">{agent.name}</span>+ </SelectItem>+ ))}+ </SelectContent>+ </Select>++ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircle className="h-4 w-4 text-gray-400" />+ </TooltipTrigger>+ <TooltipContent>+ <p>{selectedAgent.description}</p>+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>++ <Button+ type="submit"+ className="w-12"+ disabled={+ calculateSelectedContentLength() > MAX_CONTENT_LENGTH+ }+ >+ {isStreaming ? (+ <Square className="h-4 w-4" />+ ) : (+ <Send className="h-4 w-4" />+ )}+ </Button>++ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <span>+ <ContextUsageIndicator+ currentSize={calculateSelectedContentLength()}+ maxSize={MAX_CONTENT_LENGTH}+ />+ </span>+ </TooltipTrigger>+ <TooltipContent>+ <p>+ {calculateSelectedContentLength() > MAX_CONTENT_LENGTH+ ? `selected content exceeds maximum allowed: ${calculateSelectedContentLength()} / ${MAX_CONTENT_LENGTH} characters. unselect some items to use AI.`+ : `${calculateSelectedContentLength()} / ${MAX_CONTENT_LENGTH} characters used for AI message`}+ </p>+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>++ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <HelpCircle className="h-4 w-4 text-muted-foreground ml-1 cursor-help" />+ </TooltipTrigger>+ <TooltipContent>+ <p className="text-sm">+ ai models can only process a limited amount of text at+ once.+ <br />+ this circle shows how much of that limit you arere+ using.+ <br />! the exclamation mark indicates when you exceed+ the limit.+ </p>+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>+ </div>+ </form>+ </motion.div>+ )}+ </AnimatePresence>++ {results.length > 0 && <Separator className="my-8" />}++ {/* Display chat messages - Update this section */}+ {(chatMessages.length > 0 || isAiLoading) && (+ <>+ <div className="flex flex-col items-start flex-1 max-w-2xl gap-8 px-4 mx-auto">+ {chatMessages.map((msg, index) => (+ <ChatMessage key={index} message={msg} />+ ))}+ {isAiLoading && spinner}+ </div>+ </>+ )}++ {/* Scroll to Bottom Button */}+ {showScrollButton && (+ <Button+ className="fixed bottom-4 right-4 rounded-full p-2"+ onClick={scrollToBottom}+ >+ <ChevronDown className="h-6 w-6" />+ </Button>+ )}+ {results.length > 0 && <div className="h-32" />}+ </div>+ );+}diff --git a/pipes/timeline/src/components/spinner.tsx b/pipes/timeline/src/components/spinner.tsxnew file mode 100644index 000000000..68e47ccbd--- /dev/null+++ b/pipes/timeline/src/components/spinner.tsx@@ -0,0 +1,16 @@+"use client";++export const spinner = (+ <svg+ fill="none"+ stroke="currentColor"+ strokeWidth="1.5"+ viewBox="0 0 24 24"+ strokeLinecap="round"+ strokeLinejoin="round"+ xmlns="http://www.w3.org/2000/svg"+ className="size-5 animate-spin stroke-zinc-400"+ >+ <path d="M12 3v3m6.366-.366-2.12 2.12M21 12h-3m.366 6.366-2.12-2.12M12 21v-3m-6.366.366 2.12-2.12M3 12h3m-.366-6.366 2.12 2.12"></path>+ </svg>+);diff --git a/pipes/timeline/src/components/sql-autocomplete-input.tsx b/pipes/timeline/src/components/sql-autocomplete-input.tsxnew file mode 100644index 000000000..55807bebf--- /dev/null+++ b/pipes/timeline/src/components/sql-autocomplete-input.tsx@@ -0,0 +1,150 @@+import React, { useState, useRef, useCallback, useEffect } from "react";+import { useSqlAutocomplete } from "@/lib/hooks/use-sql-autocomplete";+import { Command } from "cmdk";+import { Input } from "@/components/ui/input";+import { Loader2, Search, X } from "lucide-react";+import { cn } from "@/lib/utils";++interface SqlAutocompleteInputProps {+ id: string;+ placeholder: string;+ value: string;+ onChange: (value: string) => void;+ type: "app" | "window";+ icon?: React.ReactNode;+ className?: string;+ onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;+}++export function SqlAutocompleteInput({+ id,+ placeholder,+ value,+ onChange,+ type,+ icon,+ className,+ onKeyDown,+}: SqlAutocompleteInputProps) {+ const { items, isLoading } = useSqlAutocomplete(type);+ const [open, setOpen] = useState(false);+ const [inputValue, setInputValue] = useState(value);+ const inputRef = useRef<HTMLInputElement>(null);+ const commandRef = useRef<HTMLDivElement>(null);++ // update local state when prop changes+ useEffect(() => {+ setInputValue(value);+ }, [value]);++ const handleSelect = (selectedValue: string) => {+ onChange(selectedValue);+ setInputValue(selectedValue);+ setOpen(false);+ inputRef.current?.focus();+ };++ const handleInputChange = useCallback(+ (e: React.ChangeEvent<HTMLInputElement>) => {+ const newValue = e.target.value;+ setInputValue(newValue);+ onChange(newValue);+ },+ [onChange]+ );++ const handleClearInput = useCallback(() => {+ setInputValue("");+ onChange("");+ inputRef.current?.focus();+ }, [onChange]);++ useEffect(() => {+ const handleClickOutside = (event: MouseEvent) => {+ if (+ commandRef.current &&+ !commandRef.current.contains(event.target as Node)+ ) {+ setOpen(false);+ }+ };++ document.addEventListener("mousedown", handleClickOutside);+ return () => {+ document.removeEventListener("mousedown", handleClickOutside);+ };+ }, []);++ return (+ <div className={cn("relative", className)} ref={commandRef}>+ <div className="absolute left-2 top-1/2 transform -translate-y-1/2 text-gray-400 z-10 flex items-center">+ {icon}+ <span className="w-2" />+ </div>+ <Command className="relative w-full" shouldFilter={false}>+ <div className="relative">+ <Input+ ref={inputRef}+ id={id}+ type="text"+ placeholder={placeholder}+ value={inputValue}+ onChange={handleInputChange}+ onFocus={() => setOpen(true)}+ className={cn("pr-8 w-full", icon ? "pl-7" : "pl-3")}+ autoCorrect="off"+ aria-autocomplete="none"+ onKeyDown={onKeyDown}+ />+ {inputValue && (+ <button+ onClick={handleClearInput}+ className="absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600"+ >+ <X className="h-4 w-4" />+ </button>+ )}+ </div>+ {open && (+ <Command.List className="absolute z-20 w-full bg-white border border-gray-300 rounded-md mt-1 max-h-60 overflow-auto shadow-lg text-sm">+ <div className="flex items-center px-3 py-2 border-b border-gray-200">+ <Search className="mr-2 h-4 w-4 text-gray-400" />+ <Command.Input+ placeholder="search..."+ value={inputValue}+ onValueChange={setInputValue}+ className="border-none focus:ring-0 outline-none w-full"+ />+ </div>+ {isLoading ? (+ <Command.Loading>+ <div className="px-4 py-2 text-gray-500 flex items-center">+ <Loader2 className="mr-2 h-4 w-4 animate-spin" />+ loading...+ </div>+ </Command.Loading>+ ) : (+ items+ .filter((item) =>+ item.name.toLowerCase().includes(inputValue.toLowerCase())+ )+ .map((item: any) => (+ <Command.Item+ key={item.name}+ value={item.name}+ onSelect={handleSelect}+ className="px-4 py-2 hover:bg-gray-100 cursor-pointer border-b border-gray-200 last:border-b-0"+ >+ {item.name} ({item.count})+ </Command.Item>+ ))+ )}+ {!isLoading && items.length === 0 && (+ <div className="px-4 py-2 text-gray-500">no results found</div>+ )}+ </Command.List>+ )}+ </Command>+ </div>+ );+}diff --git a/screenpipe-app-tauri/components/timeline/agents.tsx b/pipes/timeline/src/components/timeline/agents.tsxsimilarity index 99%rename from screenpipe-app-tauri/components/timeline/agents.tsxrename to pipes/timeline/src/components/timeline/agents.tsxindex c4f9faa0e..4683317a9 100644--- a/screenpipe-app-tauri/components/timeline/agents.tsx+++ b/pipes/timeline/src/components/timeline/agents.tsx@@ -1,4 +1,4 @@-import { StreamTimeSeriesResponse } from "@/app/timeline/page";+import { StreamTimeSeriesResponse } from "@/app/page";import OpenAI from "openai";import { ChatCompletionMessageParam } from "openai/resources/index.mjs";diff --git a/screenpipe-app-tauri/components/timeline/ai-panel.tsx b/pipes/timeline/src/components/timeline/ai-panel.tsxsimilarity index 97%rename from screenpipe-app-tauri/components/timeline/ai-panel.tsxrename to pipes/timeline/src/components/timeline/ai-panel.tsxindex 64aef67ef..5a84e6ac8 100644--- a/screenpipe-app-tauri/components/timeline/ai-panel.tsx+++ b/pipes/timeline/src/components/timeline/ai-panel.tsx@@ -1,14 +1,12 @@import { useRef, useState, useEffect } from "react";import { Message, generateId } from "ai";import { OpenAI } from "openai";-import { ChatMessage } from "@/components/chat-message-v2";+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 { StreamTimeSeriesResponse } from "@/app/timeline/page";-import { platform } from "@tauri-apps/plugin-os";-import posthog from "posthog-js";+import { StreamTimeSeriesResponse } from "@/app/page";import { useTimelineSelection } from "@/lib/hooks/use-timeline-selection";import { Agent } from "./agents";@@ -53,7 +51,7 @@ export function AIPanel({const { selectionRange, setSelectionRange } = useTimelineSelection();useEffect(() => {- setOsType(platform());+ setOsType(window.navigator.platform);}, []);const handlePanelMouseDown = (e: React.MouseEvent<HTMLDivElement>) => {@@ -147,9 +145,7 @@ export function AIPanel({const handleAgentChange = (agentId: string) => {const newAgent = agents.find((a) => a.id === agentId) || agents[0];- posthog.capture("timeline_change_agent", {- agent: newAgent.name,- });+setSelectedAgent(newAgent);};diff --git a/screenpipe-app-tauri/components/timeline/audio-transcript.tsx b/pipes/timeline/src/components/timeline/audio-transcript.tsxsimilarity index 97%rename from screenpipe-app-tauri/components/timeline/audio-transcript.tsxrename to pipes/timeline/src/components/timeline/audio-transcript.tsxindex 25d7237ec..907d6c7fd 100644--- a/screenpipe-app-tauri/components/timeline/audio-transcript.tsx+++ b/pipes/timeline/src/components/timeline/audio-transcript.tsx@@ -1,5 +1,5 @@import { useState, useEffect, useRef } from "react";-import { AudioData, StreamTimeSeriesResponse } from "@/app/timeline/page";+import { AudioData, StreamTimeSeriesResponse } from "@/app/page";import { Button } from "@/components/ui/button";import { Card } from "@/components/ui/card";import { Play, Pause, Volume2, GripHorizontal, X } from "lucide-react";@@ -55,8 +55,8 @@ export function AudioTranscript({});// Check if any nearby frames have audio- const hasNearbyAudio = nearbyFrames.some(frame =>- frame.devices.some(device => device.audio.length > 0)+ const hasNearbyAudio = nearbyFrames.some((frame) =>+ frame.devices.some((device) => device.audio.length > 0));// Show/hide panel based on nearby audiodiff --git a/screenpipe-app-tauri/components/timeline/timeline-dock-section.tsx b/pipes/timeline/src/components/timeline/timeline-dock-section.tsxsimilarity index 85%rename from screenpipe-app-tauri/components/timeline/timeline-dock-section.tsxrename to pipes/timeline/src/components/timeline/timeline-dock-section.tsxindex 13c966c58..b42688c55 100644--- a/screenpipe-app-tauri/components/timeline/timeline-dock-section.tsx+++ b/pipes/timeline/src/components/timeline/timeline-dock-section.tsx@@ -1,8 +1,6 @@import localforage from "localforage";import React, { useEffect, useState, useCallback, useMemo } from "react";-import { platform } from "@tauri-apps/plugin-os";-import { invoke } from "@tauri-apps/api/core";-import { StreamTimeSeriesResponse } from "@/app/timeline/page";+import { StreamTimeSeriesResponse } from "@/app/page";import { stringToColor } from "@/lib/utils";import { motion, useAnimation } from "framer-motion";import {@@ -12,6 +10,7 @@ import {DialogTitle,} from "@/components/ui/dialog";import { ScrollArea } from "@/components/ui/scroll-area";+import { useTimelineSelection } from "@/lib/hooks/use-timeline-selection";import { Button } from "@/components/ui/button";import { MessageSquarePlus, Volume2 } from "lucide-react";@@ -30,15 +29,50 @@ interface ProcessedBlock {}>;}+interface AppIcon {+ base64: string;+ path?: string;+}++async function getAppIcon(+ appName: string,+ appPath?: string+): Promise<AppIcon | null> {+ const params = new URLSearchParams({+ name: appName,+ ...(appPath && { path: appPath }),+ });++ try {+ const response = await fetch(`http://localhost:11435/app-icon?${params}`, {+ method: "GET",+ headers: {+ Accept: "application/json",+ },+ });++ if (!response.ok) {+ const error = await response.text();+ throw new Error(`failed to get app icon: ${error}`);+ }++ return await response.json();+ } catch (error) {+ console.error("error getting app icon:", error);+ return null;+ }+}+export function TimelineIconsSection({blocks,}: {blocks: StreamTimeSeriesResponse[];}) {- const os = platform();const [iconCache, setIconCache] = useState<{ [key: string]: string }>({});const [selectedApp, setSelectedApp] = useState<ProcessedBlock | null>(null);- const [iconInvocationCount, setIconInvocationCount] = useState<{ [key: string]: number }>({});+ const [iconInvocationCount, setIconInvocationCount] = useState<{+ [key: string]: number;+ }>({});const { setSelectionRange } = useTimelineSelection();// Get the visible time range@@ -55,27 +89,31 @@ export function TimelineIconsSection({// Process audio groups firstconst audioGroups = blocks- .flatMap(frame =>- frame.devices.flatMap(device =>- device.audio.map(audio => ({+ .flatMap((frame) =>+ frame.devices.flatMap((device) =>+ device.audio.map((audio) => ({deviceName: audio.device_name,isInput: audio.is_input,timestamp: new Date(frame.timestamp),duration: audio.duration_secs,- percentThroughDay:- ((new Date(frame.timestamp).getTime() - timeRange.start.getTime()) /- (timeRange.end.getTime() - timeRange.start.getTime())) * 100+ percentThroughDay:+ ((new Date(frame.timestamp).getTime() -+ timeRange.start.getTime()) /+ (timeRange.end.getTime() - timeRange.start.getTime())) *+ 100,}))))- .filter(audio => {+ .filter((audio) => {const timestamp = audio.timestamp;return timestamp >= timeRange.start && timestamp <= timeRange.end;}).filter((audio, index, array) => {if (index === 0) return true;const prevAudio = array[index - 1];- return Math.abs(audio.percentThroughDay - prevAudio.percentThroughDay) > 0.25;+ return (+ Math.abs(audio.percentThroughDay - prevAudio.percentThroughDay) > 0.25+ );});// Process app blocks (existing logic)@@ -166,9 +204,12 @@ export function TimelineIconsSection({.filter((block, index, array) => {if (index === 0) return true;const prevBlock = array[index - 1];- return Math.abs(block.percentThroughDay - prevBlock.percentThroughDay) > 0.25;+ return (+ Math.abs(block.percentThroughDay - prevBlock.percentThroughDay) >+ 0.25+ );}),- processedAudioGroups: audioGroups+ processedAudioGroups: audioGroups,};}, [blocks, iconCache, timeRange]);@@ -188,10 +229,7 @@ export function TimelineIconsSection({if (iconInvocationCount[appName] >= 100) return;- const icon = await invoke<{ base64: string; path: string } | null>(- "get_app_icon",- { appName, appPath }- );+ const icon = await getAppIcon(appName, appPath);if (icon?.base64) {// Add null check for base64@@ -217,7 +255,6 @@ export function TimelineIconsSection({useEffect(() => {const loadIcons = async () => {-// Load icons for unique app names onlyprocessedBlocks.forEach((block) => {loadAppIcon(block.appName);@@ -264,9 +301,9 @@ export function TimelineIconsSection({><imgsrc={- os === "linux"- ? `data:image/svg+xml;base64,${block.iconSrc}`- : `data:image/png;base64,${block.iconSrc}`+ window.navigator.platform === "Linux"+ ? `data:image/svg+xml;base64,${block.iconSrc}`+ : `data:image/png;base64,${block.iconSrc}`}className="w-full h-full opacity-70"alt={block.appName}@@ -328,9 +365,9 @@ export function TimelineIconsSection({{selectedApp?.iconSrc && (<imgsrc={- os === "linux"- ? `data:image/svg+xml;base64,${selectedApp.iconSrc}`- : `data:image/png;base64,${selectedApp.iconSrc}`+ window.navigator.platform === "Linux"+ ? `data:image/svg+xml;base64,${selectedApp.iconSrc}`+ : `data:image/png;base64,${selectedApp.iconSrc}`}className="w-6 h-6"alt={selectedApp.appName}diff --git a/screenpipe-app-tauri/components/timeline/timeline-selection.tsx b/pipes/timeline/src/components/timeline/timeline-selection.tsxsimilarity index 100%rename from screenpipe-app-tauri/components/timeline/timeline-selection.tsxrename to pipes/timeline/src/components/timeline/timeline-selection.tsxdiff --git a/pipes/timeline/src/components/ui/accordion.tsx b/pipes/timeline/src/components/ui/accordion.tsxnew file mode 100644index 000000000..24c788c2c--- /dev/null+++ b/pipes/timeline/src/components/ui/accordion.tsx@@ -0,0 +1,58 @@+"use client"++import * as React from "react"+import * as AccordionPrimitive from "@radix-ui/react-accordion"+import { ChevronDown } from "lucide-react"++import { cn } from "@/lib/utils"++const Accordion = AccordionPrimitive.Root++const AccordionItem = React.forwardRef<+ React.ElementRef<typeof AccordionPrimitive.Item>,+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>+>(({ className, ...props }, ref) => (+ <AccordionPrimitive.Item+ ref={ref}+ className={cn("border-b", className)}+ {...props}+ />+))+AccordionItem.displayName = "AccordionItem"++const AccordionTrigger = React.forwardRef<+ React.ElementRef<typeof AccordionPrimitive.Trigger>,+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>+>(({ className, children, ...props }, ref) => (+ <AccordionPrimitive.Header className="flex">+ <AccordionPrimitive.Trigger+ ref={ref}+ className={cn(+ "flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",+ className+ )}+ {...props}+ >+ {children}+ <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />+ </AccordionPrimitive.Trigger>+ </AccordionPrimitive.Header>+))+AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName++const AccordionContent = React.forwardRef<+ React.ElementRef<typeof AccordionPrimitive.Content>,+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>+>(({ className, children, ...props }, ref) => (+ <AccordionPrimitive.Content+ ref={ref}+ className="overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"+ {...props}+ >+ <div className={cn("pb-4 pt-0", className)}>{children}</div>+ </AccordionPrimitive.Content>+))++AccordionContent.displayName = AccordionPrimitive.Content.displayName++export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }diff --git a/pipes/timeline/src/components/ui/badge.tsx b/pipes/timeline/src/components/ui/badge.tsxnew file mode 100644index 000000000..f000e3ef5--- /dev/null+++ b/pipes/timeline/src/components/ui/badge.tsx@@ -0,0 +1,36 @@+import * as React from "react"+import { cva, type VariantProps } from "class-variance-authority"++import { cn } from "@/lib/utils"++const badgeVariants = cva(+ "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",+ {+ variants: {+ variant: {+ default:+ "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",+ secondary:+ "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",+ destructive:+ "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",+ outline: "text-foreground",+ },+ },+ defaultVariants: {+ variant: "default",+ },+ }+)++export interface BadgeProps+ extends React.HTMLAttributes<HTMLDivElement>,+ VariantProps<typeof badgeVariants> {}++function Badge({ className, variant, ...props }: BadgeProps) {+ return (+ <div className={cn(badgeVariants({ variant }), className)} {...props} />+ )+}++export { Badge, badgeVariants }diff --git a/pipes/timeline/src/components/ui/button.tsx b/pipes/timeline/src/components/ui/button.tsxnew file mode 100644index 000000000..36496a287--- /dev/null+++ b/pipes/timeline/src/components/ui/button.tsx@@ -0,0 +1,56 @@+import * as React from "react"+import { Slot } from "@radix-ui/react-slot"+import { cva, type VariantProps } from "class-variance-authority"++import { cn } from "@/lib/utils"++const buttonVariants = cva(+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",+ {+ variants: {+ variant: {+ default: "bg-primary text-primary-foreground hover:bg-primary/90",+ destructive:+ "bg-destructive text-destructive-foreground hover:bg-destructive/90",+ outline:+ "border border-input bg-background hover:bg-accent hover:text-accent-foreground",+ secondary:+ "bg-secondary text-secondary-foreground hover:bg-secondary/80",+ ghost: "hover:bg-accent hover:text-accent-foreground",+ link: "text-primary underline-offset-4 hover:underline",+ },+ size: {+ default: "h-10 px-4 py-2",+ sm: "h-9 rounded-md px-3",+ lg: "h-11 rounded-md px-8",+ icon: "h-10 w-10",+ },+ },+ defaultVariants: {+ variant: "default",+ size: "default",+ },+ }+)++export interface ButtonProps+ extends React.ButtonHTMLAttributes<HTMLButtonElement>,+ VariantProps<typeof buttonVariants> {+ asChild?: boolean+}++const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(+ ({ className, variant, size, asChild = false, ...props }, ref) => {+ const Comp = asChild ? Slot : "button"+ return (+ <Comp+ className={cn(buttonVariants({ variant, size, className }))}+ ref={ref}+ {...props}+ />+ )+ }+)+Button.displayName = "Button"++export { Button, buttonVariants }diff --git a/pipes/timeline/src/components/ui/calendar.tsx b/pipes/timeline/src/components/ui/calendar.tsxnew file mode 100644index 000000000..61d2b451e--- /dev/null+++ b/pipes/timeline/src/components/ui/calendar.tsx@@ -0,0 +1,66 @@+"use client"++import * as React from "react"+import { ChevronLeft, ChevronRight } from "lucide-react"+import { DayPicker } from "react-day-picker"++import { cn } from "@/lib/utils"+import { buttonVariants } from "@/components/ui/button"++export type CalendarProps = React.ComponentProps<typeof DayPicker>++function Calendar({+ className,+ classNames,+ showOutsideDays = true,+ ...props+}: CalendarProps) {+ return (+ <DayPicker+ showOutsideDays={showOutsideDays}+ className={cn("p-3", className)}+ classNames={{+ months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",+ month: "space-y-4",+ caption: "flex justify-center pt-1 relative items-center",+ caption_label: "text-sm font-medium",+ nav: "space-x-1 flex items-center",+ nav_button: cn(+ buttonVariants({ variant: "outline" }),+ "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"+ ),+ nav_button_previous: "absolute left-1",+ nav_button_next: "absolute right-1",+ table: "w-full border-collapse space-y-1",+ head_row: "flex",+ head_cell:+ "text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",+ row: "flex w-full mt-2",+ cell: "h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",+ day: cn(+ buttonVariants({ variant: "ghost" }),+ "h-9 w-9 p-0 font-normal aria-selected:opacity-100"+ ),+ day_range_end: "day-range-end",+ day_selected:+ "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",+ day_today: "bg-accent text-accent-foreground",+ day_outside:+ "day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",+ day_disabled: "text-muted-foreground opacity-50",+ day_range_middle:+ "aria-selected:bg-accent aria-selected:text-accent-foreground",+ day_hidden: "invisible",+ ...classNames,+ }}+ components={{+ IconLeft: ({ ...props }) => <ChevronLeft className="h-4 w-4" />,+ IconRight: ({ ...props }) => <ChevronRight className="h-4 w-4" />,+ }}+ {...props}+ />+ )+}+Calendar.displayName = "Calendar"++export { Calendar }diff --git a/pipes/timeline/src/components/ui/card.tsx b/pipes/timeline/src/components/ui/card.tsxnew file mode 100644index 000000000..f62edea57--- /dev/null+++ b/pipes/timeline/src/components/ui/card.tsx@@ -0,0 +1,79 @@+import * as React from "react"++import { cn } from "@/lib/utils"++const Card = React.forwardRef<+ HTMLDivElement,+ React.HTMLAttributes<HTMLDivElement>+>(({ className, ...props }, ref) => (+ <div+ ref={ref}+ className={cn(+ "rounded-lg border bg-card text-card-foreground shadow-sm",+ className+ )}+ {...props}+ />+))+Card.displayName = "Card"++const CardHeader = React.forwardRef<+ HTMLDivElement,+ React.HTMLAttributes<HTMLDivElement>+>(({ className, ...props }, ref) => (+ <div+ ref={ref}+ className={cn("flex flex-col space-y-1.5 p-6", className)}+ {...props}+ />+))+CardHeader.displayName = "CardHeader"++const CardTitle = React.forwardRef<+ HTMLDivElement,+ React.HTMLAttributes<HTMLDivElement>+>(({ className, ...props }, ref) => (+ <div+ ref={ref}+ className={cn(+ "text-2xl font-semibold leading-none tracking-tight",+ className+ )}+ {...props}+ />+))+CardTitle.displayName = "CardTitle"++const CardDescription = React.forwardRef<+ HTMLDivElement,+ React.HTMLAttributes<HTMLDivElement>+>(({ className, ...props }, ref) => (+ <div+ ref={ref}+ className={cn("text-sm text-muted-foreground", className)}+ {...props}+ />+))+CardDescription.displayName = "CardDescription"++const CardContent = React.forwardRef<+ HTMLDivElement,+ React.HTMLAttributes<HTMLDivElement>+>(({ className, ...props }, ref) => (+ <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />+))+CardContent.displayName = "CardContent"++const CardFooter = React.forwardRef<+ HTMLDivElement,+ React.HTMLAttributes<HTMLDivElement>+>(({ className, ...props }, ref) => (+ <div+ ref={ref}+ className={cn("flex items-center p-6 pt-0", className)}+ {...props}+ />+))+CardFooter.displayName = "CardFooter"++export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }diff --git a/pipes/timeline/src/components/ui/checkbox.tsx b/pipes/timeline/src/components/ui/checkbox.tsxnew file mode 100644index 000000000..df61a1388--- /dev/null+++ b/pipes/timeline/src/components/ui/checkbox.tsx@@ -0,0 +1,30 @@+"use client"++import * as React from "react"+import * as CheckboxPrimitive from "@radix-ui/react-checkbox"+import { Check } from "lucide-react"++import { cn } from "@/lib/utils"++const Checkbox = React.forwardRef<+ React.ElementRef<typeof CheckboxPrimitive.Root>,+ React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>+>(({ className, ...props }, ref) => (+ <CheckboxPrimitive.Root+ ref={ref}+ className={cn(+ "peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",+ className+ )}+ {...props}+ >+ <CheckboxPrimitive.Indicator+ className={cn("flex items-center justify-center text-current")}+ >+ <Check className="h-4 w-4" />+ </CheckboxPrimitive.Indicator>+ </CheckboxPrimitive.Root>+))+Checkbox.displayName = CheckboxPrimitive.Root.displayName++export { Checkbox }diff --git a/pipes/timeline/src/components/ui/codeblock.tsx b/pipes/timeline/src/components/ui/codeblock.tsxnew file mode 100644index 000000000..e52893032--- /dev/null+++ b/pipes/timeline/src/components/ui/codeblock.tsx@@ -0,0 +1,148 @@+// Inspired by Chatbot-UI and modified to fit the needs of this project+// @see https://github.com/mckaywrigley/chatbot-ui/blob/main/components/Markdown/CodeBlock.tsx++"use client";++import { FC, memo } from "react";+import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";+import { coldarkDark } from "react-syntax-highlighter/dist/cjs/styles/prism";++import { useCopyToClipboard } from "@/lib/hooks/use-copy-to-clipboard";+import { IconCheck, IconCopy, IconDownload } from "@/components/ui/icons";+import { Button } from "@/components/ui/button";++interface Props {+ language: string;+ value: string;+}++interface languageMap {+ [key: string]: string | undefined;+}++export const programmingLanguages: languageMap = {+ javascript: ".js",+ python: ".py",+ java: ".java",+ c: ".c",+ cpp: ".cpp",+ "c++": ".cpp",+ "c#": ".cs",+ ruby: ".rb",+ php: ".php",+ swift: ".swift",+ "objective-c": ".m",+ kotlin: ".kt",+ typescript: ".ts",+ go: ".go",+ perl: ".pl",+ rust: ".rs",+ scala: ".scala",+ haskell: ".hs",+ lua: ".lua",+ shell: ".sh",+ sql: ".sql",+ html: ".html",+ css: ".css",+ // add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component+};++export const generateRandomString = (length: number, lowercase = false) => {+ const chars = "ABCDEFGHJKLMNPQRSTUVWXY3456789"; // excluding similar looking characters like Z, 2, I, 1, O, 0+ let result = "";+ for (let i = 0; i < length; i++) {+ result += chars.charAt(Math.floor(Math.random() * chars.length));+ }+ return lowercase ? result.toLowerCase() : result;+};++const CodeBlock: FC<Props> = memo(({ language, value }) => {+ const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2000 });++ const downloadAsFile = () => {+ if (typeof window === "undefined") {+ return;+ }+ const fileExtension = programmingLanguages[language] || ".file";+ const suggestedFileName = `file-${generateRandomString(+ 3,+ true+ )}${fileExtension}`;+ const fileName = window.prompt("Enter file name", suggestedFileName);++ if (!fileName) {+ // User pressed cancel on prompt.+ return;+ }++ const blob = new Blob([value], { type: "text/plain" });+ const url = URL.createObjectURL(blob);+ const link = document.createElement("a");+ link.download = fileName;+ link.href = url;+ link.style.display = "none";+ document.body.appendChild(link);+ link.click();+ document.body.removeChild(link);+ URL.revokeObjectURL(url);+ };++ const onCopy = () => {+ if (isCopied) return;+ copyToClipboard(value);+ };++ return (+ <div className="relative w-full font-sans codeblock bg-zinc-950">+ <div className="flex items-center justify-between w-full px-6 py-2 pr-4 bg-zinc-800 text-zinc-100">+ <span className="text-xs lowercase">{language}</span>+ <div className="flex items-center space-x-1">+ <Button+ variant="ghost"+ className="hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0"+ onClick={downloadAsFile}+ size="icon"+ >+ <IconDownload />+ <span className="sr-only">Download</span>+ </Button>+ <Button+ variant="ghost"+ size="icon"+ className="text-xs hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0"+ onClick={onCopy}+ >+ {isCopied ? <IconCheck /> : <IconCopy />}+ <span className="sr-only">Copy code</span>+ </Button>+ </div>+ </div>+ <SyntaxHighlighter+ language={language}+ style={coldarkDark}+ PreTag="div"+ showLineNumbers+ customStyle={{+ margin: 0,+ width: "100%",+ background: "transparent",+ padding: "1.5rem 1rem",+ }}+ lineNumberStyle={{+ userSelect: "none",+ }}+ codeTagProps={{+ style: {+ fontSize: "0.9rem",+ fontFamily: "var(--font-mono)",+ },+ }}+ >+ {value}+ </SyntaxHighlighter>+ </div>+ );+});+CodeBlock.displayName = "CodeBlock";++export { CodeBlock };diff --git a/pipes/timeline/src/components/ui/command.tsx b/pipes/timeline/src/components/ui/command.tsxnew file mode 100644index 000000000..59a264529--- /dev/null+++ b/pipes/timeline/src/components/ui/command.tsx@@ -0,0 +1,153 @@+"use client"++import * as React from "react"+import { type DialogProps } from "@radix-ui/react-dialog"+import { Command as CommandPrimitive } from "cmdk"+import { Search } from "lucide-react"++import { cn } from "@/lib/utils"+import { Dialog, DialogContent } from "@/components/ui/dialog"++const Command = React.forwardRef<+ React.ElementRef<typeof CommandPrimitive>,+ React.ComponentPropsWithoutRef<typeof CommandPrimitive>+>(({ className, ...props }, ref) => (+ <CommandPrimitive+ ref={ref}+ className={cn(+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",+ className+ )}+ {...props}+ />+))+Command.displayName = CommandPrimitive.displayName++const CommandDialog = ({ children, ...props }: DialogProps) => {+ return (+ <Dialog {...props}>+ <DialogContent className="overflow-hidden p-0 shadow-lg">+ <Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">+ {children}+ </Command>+ </DialogContent>+ </Dialog>+ )+}++const CommandInput = React.forwardRef<+ React.ElementRef<typeof CommandPrimitive.Input>,+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>+>(({ className, ...props }, ref) => (+ <div className="flex items-center border-b px-3" cmdk-input-wrapper="">+ <Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />+ <CommandPrimitive.Input+ ref={ref}+ className={cn(+ "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",+ className+ )}+ {...props}+ />+ </div>+))++CommandInput.displayName = CommandPrimitive.Input.displayName++const CommandList = React.forwardRef<+ React.ElementRef<typeof CommandPrimitive.List>,+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>+>(({ className, ...props }, ref) => (+ <CommandPrimitive.List+ ref={ref}+ className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}+ {...props}+ />+))++CommandList.displayName = CommandPrimitive.List.displayName++const CommandEmpty = React.forwardRef<+ React.ElementRef<typeof CommandPrimitive.Empty>,+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>+>((props, ref) => (+ <CommandPrimitive.Empty+ ref={ref}+ className="py-6 text-center text-sm"+ {...props}+ />+))++CommandEmpty.displayName = CommandPrimitive.Empty.displayName++const CommandGroup = React.forwardRef<+ React.ElementRef<typeof CommandPrimitive.Group>,+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>+>(({ className, ...props }, ref) => (+ <CommandPrimitive.Group+ ref={ref}+ className={cn(+ "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",+ className+ )}+ {...props}+ />+))++CommandGroup.displayName = CommandPrimitive.Group.displayName++const CommandSeparator = React.forwardRef<+ React.ElementRef<typeof CommandPrimitive.Separator>,+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>+>(({ className, ...props }, ref) => (+ <CommandPrimitive.Separator+ ref={ref}+ className={cn("-mx-1 h-px bg-border", className)}+ {...props}+ />+))+CommandSeparator.displayName = CommandPrimitive.Separator.displayName++const CommandItem = React.forwardRef<+ React.ElementRef<typeof CommandPrimitive.Item>,+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>+>(({ className, ...props }, ref) => (+ <CommandPrimitive.Item+ ref={ref}+ className={cn(+ "relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",+ className+ )}+ {...props}+ />+))++CommandItem.displayName = CommandPrimitive.Item.displayName++const CommandShortcut = ({+ className,+ ...props+}: React.HTMLAttributes<HTMLSpanElement>) => {+ return (+ <span+ className={cn(+ "ml-auto text-xs tracking-widest text-muted-foreground",+ className+ )}+ {...props}+ />+ )+}+CommandShortcut.displayName = "CommandShortcut"++export {+ Command,+ CommandDialog,+ CommandInput,+ CommandList,+ CommandEmpty,+ CommandGroup,+ CommandItem,+ CommandShortcut,+ CommandSeparator,+}diff --git a/pipes/timeline/src/components/ui/dialog.tsx b/pipes/timeline/src/components/ui/dialog.tsxnew file mode 100644index 000000000..01ff19c7e--- /dev/null+++ b/pipes/timeline/src/components/ui/dialog.tsx@@ -0,0 +1,122 @@+"use client"++import * as React from "react"+import * as DialogPrimitive from "@radix-ui/react-dialog"+import { X } from "lucide-react"++import { cn } from "@/lib/utils"++const Dialog = DialogPrimitive.Root++const DialogTrigger = DialogPrimitive.Trigger++const DialogPortal = DialogPrimitive.Portal++const DialogClose = DialogPrimitive.Close++const DialogOverlay = React.forwardRef<+ React.ElementRef<typeof DialogPrimitive.Overlay>,+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>+>(({ className, ...props }, ref) => (+ <DialogPrimitive.Overlay+ ref={ref}+ className={cn(+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",+ className+ )}+ {...props}+ />+))+DialogOverlay.displayName = DialogPrimitive.Overlay.displayName++const DialogContent = React.forwardRef<+ React.ElementRef<typeof DialogPrimitive.Content>,+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>+>(({ className, children, ...props }, ref) => (+ <DialogPortal>+ <DialogOverlay />+ <DialogPrimitive.Content+ ref={ref}+ className={cn(+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",+ className+ )}+ {...props}+ >+ {children}+ <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">+ <X className="h-4 w-4" />+ <span className="sr-only">Close</span>+ </DialogPrimitive.Close>+ </DialogPrimitive.Content>+ </DialogPortal>+))+DialogContent.displayName = DialogPrimitive.Content.displayName++const DialogHeader = ({+ className,+ ...props+}: React.HTMLAttributes<HTMLDivElement>) => (+ <div+ className={cn(+ "flex flex-col space-y-1.5 text-center sm:text-left",+ className+ )}+ {...props}+ />+)+DialogHeader.displayName = "DialogHeader"++const DialogFooter = ({+ className,+ ...props+}: React.HTMLAttributes<HTMLDivElement>) => (+ <div+ className={cn(+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",+ className+ )}+ {...props}+ />+)+DialogFooter.displayName = "DialogFooter"++const DialogTitle = React.forwardRef<+ React.ElementRef<typeof DialogPrimitive.Title>,+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>+>(({ className, ...props }, ref) => (+ <DialogPrimitive.Title+ ref={ref}+ className={cn(+ "text-lg font-semibold leading-none tracking-tight",+ className+ )}+ {...props}+ />+))+DialogTitle.displayName = DialogPrimitive.Title.displayName++const DialogDescription = React.forwardRef<+ React.ElementRef<typeof DialogPrimitive.Description>,+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>+>(({ className, ...props }, ref) => (+ <DialogPrimitive.Description+ ref={ref}+ className={cn("text-sm text-muted-foreground", className)}+ {...props}+ />+))+DialogDescription.displayName = DialogPrimitive.Description.displayName++export {+ Dialog,+ DialogPortal,+ DialogOverlay,+ DialogClose,+ DialogTrigger,+ DialogContent,+ DialogHeader,+ DialogFooter,+ DialogTitle,+ DialogDescription,+}diff --git a/pipes/timeline/src/components/ui/icons.tsx b/pipes/timeline/src/components/ui/icons.tsxnew file mode 100644index 000000000..492377647--- /dev/null+++ b/pipes/timeline/src/components/ui/icons.tsx@@ -0,0 +1,593 @@+"use client";++import * as React from "react";++import { cn } from "@/lib/utils";++function IconNextChat({+ className,+ inverted,+ ...props+}: React.ComponentProps<"svg"> & { inverted?: boolean }) {+ const id = React.useId();++ return (+ <svg+ viewBox="0 0 17 17"+ fill="none"+ xmlns="http://www.w3.org/2000/svg"+ className={cn("size-4", className)}+ {...props}+ >+ <defs>+ <linearGradient+ id={`gradient-${id}-1`}+ x1="10.6889"+ y1="10.3556"+ x2="13.8445"+ y2="14.2667"+ gradientUnits="userSpaceOnUse"+ >+ <stop stopColor={inverted ? "white" : "black"} />+ <stop+ offset={1}+ stopColor={inverted ? "white" : "black"}+ stopOpacity={0}+ />+ </linearGradient>+ <linearGradient+ id={`gradient-${id}-2`}+ x1="11.7555"+ y1="4.8"+ x2="11.7376"+ y2="9.50002"+ gradientUnits="userSpaceOnUse"+ >+ <stop stopColor={inverted ? "white" : "black"} />+ <stop+ offset={1}+ stopColor={inverted ? "white" : "black"}+ stopOpacity={0}+ />+ </linearGradient>+ </defs>+ <path+ d="M1 16L2.58314 11.2506C1.83084 9.74642 1.63835 8.02363 2.04013 6.39052C2.4419 4.75741 3.41171 3.32057 4.776 2.33712C6.1403 1.35367 7.81003 0.887808 9.4864 1.02289C11.1628 1.15798 12.7364 1.8852 13.9256 3.07442C15.1148 4.26363 15.842 5.83723 15.9771 7.5136C16.1122 9.18997 15.6463 10.8597 14.6629 12.224C13.6794 13.5883 12.2426 14.5581 10.6095 14.9599C8.97637 15.3616 7.25358 15.1692 5.74942 14.4169L1 16Z"+ fill={inverted ? "black" : "white"}+ stroke={inverted ? "black" : "white"}+ strokeWidth={2}+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ <mask+ id="mask0_91_2047"+ style={{ maskType: "alpha" }}+ maskUnits="userSpaceOnUse"+ x={1}+ y={0}+ width={16}+ height={16}+ >+ <circle cx={9} cy={8} r={8} fill={inverted ? "black" : "white"} />+ </mask>+ <g mask="url(#mask0_91_2047)">+ <circle cx={9} cy={8} r={8} fill={inverted ? "black" : "white"} />+ <path+ d="M14.2896 14.0018L7.146 4.8H5.80005V11.1973H6.87681V6.16743L13.4444 14.6529C13.7407 14.4545 14.0231 14.2369 14.2896 14.0018Z"+ fill={`url(#gradient-${id}-1)`}+ />+ <rect+ x="11.2222"+ y="4.8"+ width="1.06667"+ height="6.4"+ fill={`url(#gradient-${id}-2)`}+ />+ </g>+ </svg>+ );+}++function IconOpenAI({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ fill="currentColor"+ viewBox="0 0 24 24"+ role="img"+ xmlns="http://www.w3.org/2000/svg"+ className={cn("size-4", className)}+ {...props}+ >+ <title>OpenAI icon</title>+ <path d="M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z" />+ </svg>+ );+}++function IconVercel({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ aria-label="Vercel logomark"+ role="img"+ viewBox="0 0 74 64"+ className={cn("size-4", className)}+ {...props}+ >+ <path+ d="M37.5896 0.25L74.5396 64.25H0.639648L37.5896 0.25Z"+ fill="currentColor"+ ></path>+ </svg>+ );+}++function IconGitHub({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ role="img"+ viewBox="0 0 24 24"+ xmlns="http://www.w3.org/2000/svg"+ fill="currentColor"+ className={cn("size-4", className)}+ {...props}+ >+ <title>GitHub</title>+ <path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" />+ </svg>+ );+}++function IconSeparator({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ fill="none"+ shapeRendering="geometricPrecision"+ stroke="currentColor"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="1"+ viewBox="0 0 24 24"+ aria-hidden="true"+ className={cn("size-4", className)}+ {...props}+ >+ <path d="M16.88 3.549L7.12 20.451"></path>+ </svg>+ );+}++function IconArrowDown({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 256 256"+ fill="currentColor"+ className={cn("size-4", className)}+ {...props}+ >+ <path d="m205.66 149.66-72 72a8 8 0 0 1-11.32 0l-72-72a8 8 0 0 1 11.32-11.32L120 196.69V40a8 8 0 0 1 16 0v156.69l58.34-58.35a8 8 0 0 1 11.32 11.32Z" />+ </svg>+ );+}++function IconArrowRight({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 256 256"+ fill="currentColor"+ className={cn("size-4", className)}+ {...props}+ >+ <path d="m221.66 133.66-72 72a8 8 0 0 1-11.32-11.32L196.69 136H40a8 8 0 0 1 0-16h156.69l-58.35-58.34a8 8 0 0 1 11.32-11.32l72 72a8 8 0 0 1 0 11.32Z" />+ </svg>+ );+}++function IconUser({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 256 256"+ fill="currentColor"+ className={cn("size-4", className)}+ {...props}+ >+ <path d="M230.92 212c-15.23-26.33-38.7-45.21-66.09-54.16a72 72 0 1 0-73.66 0c-27.39 8.94-50.86 27.82-66.09 54.16a8 8 0 1 0 13.85 8c18.84-32.56 52.14-52 89.07-52s70.23 19.44 89.07 52a8 8 0 1 0 13.85-8ZM72 96a56 56 0 1 1 56 56 56.06 56.06 0 0 1-56-56Z" />+ </svg>+ );+}++function IconPlus({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 256 256"+ fill="currentColor"+ className={cn("size-4", className)}+ {...props}+ >+ <path d="M224 128a8 8 0 0 1-8 8h-80v80a8 8 0 0 1-16 0v-80H40a8 8 0 0 1 0-16h80V40a8 8 0 0 1 16 0v80h80a8 8 0 0 1 8 8Z" />+ </svg>+ );+}++function IconArrowElbow({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 256 256"+ fill="currentColor"+ className={cn("size-4", className)}+ {...props}+ >+ <path d="M200 32v144a8 8 0 0 1-8 8H67.31l34.35 34.34a8 8 0 0 1-11.32 11.32l-48-48a8 8 0 0 1 0-11.32l48-48a8 8 0 0 1 11.32 11.32L67.31 168H184V32a8 8 0 0 1 16 0Z" />+ </svg>+ );+}++function IconSpinner({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 256 256"+ fill="currentColor"+ className={cn("size-4 animate-spin", className)}+ {...props}+ >+ <path d="M232 128a104 104 0 0 1-208 0c0-41 23.81-78.36 60.66-95.27a8 8 0 0 1 6.68 14.54C60.15 61.59 40 93.27 40 128a88 88 0 0 0 176 0c0-34.73-20.15-66.41-51.34-80.73a8 8 0 0 1 6.68-14.54C208.19 49.64 232 87 232 128Z" />+ </svg>+ );+}++function IconMessage({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 256 256"+ fill="currentColor"+ className={cn("size-4", className)}+ {...props}+ >+ <path d="M216 48H40a16 16 0 0 0-16 16v160a15.84 15.84 0 0 0 9.25 14.5A16.05 16.05 0 0 0 40 240a15.89 15.89 0 0 0 10.25-3.78.69.69 0 0 0 .13-.11L82.5 208H216a16 16 0 0 0 16-16V64a16 16 0 0 0-16-16ZM40 224Zm176-32H82.5a16 16 0 0 0-10.3 3.75l-.12.11L40 224V64h176Z" />+ </svg>+ );+}++function IconTrash({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 256 256"+ fill="currentColor"+ className={cn("size-4", className)}+ {...props}+ >+ <path d="M216 48h-40v-8a24 24 0 0 0-24-24h-48a24 24 0 0 0-24 24v8H40a8 8 0 0 0 0 16h8v144a16 16 0 0 0 16 16h128a16 16 0 0 0 16-16V64h8a8 8 0 0 0 0-16ZM96 40a8 8 0 0 1 8-8h48a8 8 0 0 1 8 8v8H96Zm96 168H64V64h128Zm-80-104v64a8 8 0 0 1-16 0v-64a8 8 0 0 1 16 0Zm48 0v64a8 8 0 0 1-16 0v-64a8 8 0 0 1 16 0Z" />+ </svg>+ );+}++function IconRefresh({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 256 256"+ fill="currentColor"+ className={cn("size-4", className)}+ {...props}+ >+ <path d="M197.67 186.37a8 8 0 0 1 0 11.29C196.58 198.73 170.82 224 128 224c-37.39 0-64.53-22.4-80-39.85V208a8 8 0 0 1-16 0v-48a8 8 0 0 1 8-8h48a8 8 0 0 1 0 16H55.44C67.76 183.35 93 208 128 208c36 0 58.14-21.46 58.36-21.68a8 8 0 0 1 11.31.05ZM216 40a8 8 0 0 0-8 8v23.85C192.53 54.4 165.39 32 128 32c-42.82 0-68.58 25.27-69.66 26.34a8 8 0 0 0 11.3 11.34C69.86 69.46 92 48 128 48c35 0 60.24 24.65 72.56 40H168a8 8 0 0 0 0 16h48a8 8 0 0 0 8-8V48a8 8 0 0 0-8-8Z" />+ </svg>+ );+}++function IconStop({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 256 256"+ fill="currentColor"+ className={cn("size-4", className)}+ {...props}+ >+ <path d="M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24Zm0 192a88 88 0 1 1 88-88 88.1 88.1 0 0 1-88 88Zm24-120h-48a8 8 0 0 0-8 8v48a8 8 0 0 0 8 8h48a8 8 0 0 0 8-8v-48a8 8 0 0 0-8-8Zm-8 48h-32v-32h32Z" />+ </svg>+ );+}++function IconSidebar({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 256 256"+ fill="currentColor"+ className={cn("size-4", className)}+ {...props}+ >+ <path d="M216 40H40a16 16 0 0 0-16 16v144a16 16 0 0 0 16 16h176a16 16 0 0 0 16-16V56a16 16 0 0 0-16-16ZM40 56h40v144H40Zm176 144H96V56h120v144Z" />+ </svg>+ );+}++function IconMoon({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 256 256"+ fill="currentColor"+ className={cn("size-4", className)}+ {...props}+ >+ <path d="M233.54 142.23a8 8 0 0 0-8-2 88.08 88.08 0 0 1-109.8-109.8 8 8 0 0 0-10-10 104.84 104.84 0 0 0-52.91 37A104 104 0 0 0 136 224a103.09 103.09 0 0 0 62.52-20.88 104.84 104.84 0 0 0 37-52.91 8 8 0 0 0-1.98-7.98Zm-44.64 48.11A88 88 0 0 1 65.66 67.11a89 89 0 0 1 31.4-26A106 106 0 0 0 96 56a104.11 104.11 0 0 0 104 104 106 106 0 0 0 14.92-1.06 89 89 0 0 1-26.02 31.4Z" />+ </svg>+ );+}++function IconSun({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 256 256"+ fill="currentColor"+ className={cn("size-4", className)}+ {...props}+ >+ <path d="M120 40V16a8 8 0 0 1 16 0v24a8 8 0 0 1-16 0Zm72 88a64 64 0 1 1-64-64 64.07 64.07 0 0 1 64 64Zm-16 0a48 48 0 1 0-48 48 48.05 48.05 0 0 0 48-48ZM58.34 69.66a8 8 0 0 0 11.32-11.32l-16-16a8 8 0 0 0-11.32 11.32Zm0 116.68-16 16a8 8 0 0 0 11.32 11.32l16-16a8 8 0 0 0-11.32-11.32ZM192 72a8 8 0 0 0 5.66-2.34l16-16a8 8 0 0 0-11.32-11.32l-16 16A8 8 0 0 0 192 72Zm5.66 114.34a8 8 0 0 0-11.32 11.32l16 16a8 8 0 0 0 11.32-11.32ZM48 128a8 8 0 0 0-8-8H16a8 8 0 0 0 0 16h24a8 8 0 0 0 8-8Zm80 80a8 8 0 0 0-8 8v24a8 8 0 0 0 16 0v-24a8 8 0 0 0-8-8Zm112-88h-24a8 8 0 0 0 0 16h24a8 8 0 0 0 0-16Z" />+ </svg>+ );+}++function IconCopy({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 256 256"+ fill="currentColor"+ className={cn("size-4", className)}+ {...props}+ >+ <path d="M216 32H88a8 8 0 0 0-8 8v40H40a8 8 0 0 0-8 8v128a8 8 0 0 0 8 8h128a8 8 0 0 0 8-8v-40h40a8 8 0 0 0 8-8V40a8 8 0 0 0-8-8Zm-56 176H48V96h112Zm48-48h-32V88a8 8 0 0 0-8-8H96V48h112Z" />+ </svg>+ );+}++function IconCheck({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 256 256"+ fill="currentColor"+ className={cn("size-4", className)}+ {...props}+ >+ <path d="m229.66 77.66-128 128a8 8 0 0 1-11.32 0l-56-56a8 8 0 0 1 11.32-11.32L96 188.69 218.34 66.34a8 8 0 0 1 11.32 11.32Z" />+ </svg>+ );+}++function IconDownload({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 256 256"+ fill="currentColor"+ className={cn("size-4", className)}+ {...props}+ >+ <path d="M224 152v56a16 16 0 0 1-16 16H48a16 16 0 0 1-16-16v-56a8 8 0 0 1 16 0v56h160v-56a8 8 0 0 1 16 0Zm-101.66 5.66a8 8 0 0 0 11.32 0l40-40a8 8 0 0 0-11.32-11.32L136 132.69V40a8 8 0 0 0-16 0v92.69l-26.34-26.35a8 8 0 0 0-11.32 11.32Z" />+ </svg>+ );+}++function IconClose({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 256 256"+ fill="currentColor"+ className={cn("size-4", className)}+ {...props}+ >+ <path d="M205.66 194.34a8 8 0 0 1-11.32 11.32L128 139.31l-66.34 66.35a8 8 0 0 1-11.32-11.32L116.69 128 50.34 61.66a8 8 0 0 1 11.32-11.32L128 116.69l66.34-66.35a8 8 0 0 1 11.32 11.32L139.31 128Z" />+ </svg>+ );+}++function IconEdit({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ fill="none"+ viewBox="0 0 24 24"+ strokeWidth={1.5}+ stroke="currentColor"+ className={cn("size-4", className)}+ {...props}+ >+ <path+ strokeLinecap="round"+ strokeLinejoin="round"+ d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"+ />+ </svg>+ );+}++function IconShare({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ fill="currentColor"+ className={cn("size-4", className)}+ viewBox="0 0 256 256"+ {...props}+ >+ <path d="m237.66 106.35-80-80A8 8 0 0 0 144 32v40.35c-25.94 2.22-54.59 14.92-78.16 34.91-28.38 24.08-46.05 55.11-49.76 87.37a12 12 0 0 0 20.68 9.58c11-11.71 50.14-48.74 107.24-52V192a8 8 0 0 0 13.66 5.65l80-80a8 8 0 0 0 0-11.3ZM160 172.69V144a8 8 0 0 0-8-8c-28.08 0-55.43 7.33-81.29 21.8a196.17 196.17 0 0 0-36.57 26.52c5.8-23.84 20.42-46.51 42.05-64.86C99.41 99.77 127.75 88 152 88a8 8 0 0 0 8-8V51.32L220.69 112Z" />+ </svg>+ );+}++function IconUsers({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ fill="currentColor"+ className={cn("size-4", className)}+ viewBox="0 0 256 256"+ {...props}+ >+ <path d="M117.25 157.92a60 60 0 1 0-66.5 0 95.83 95.83 0 0 0-47.22 37.71 8 8 0 1 0 13.4 8.74 80 80 0 0 1 134.14 0 8 8 0 0 0 13.4-8.74 95.83 95.83 0 0 0-47.22-37.71ZM40 108a44 44 0 1 1 44 44 44.05 44.05 0 0 1-44-44Zm210.14 98.7a8 8 0 0 1-11.07-2.33A79.83 79.83 0 0 0 172 168a8 8 0 0 1 0-16 44 44 0 1 0-16.34-84.87 8 8 0 1 1-5.94-14.85 60 60 0 0 1 55.53 105.64 95.83 95.83 0 0 1 47.22 37.71 8 8 0 0 1-2.33 11.07Z" />+ </svg>+ );+}++function IconExternalLink({+ className,+ ...props+}: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ fill="currentColor"+ className={cn("size-4", className)}+ viewBox="0 0 256 256"+ {...props}+ >+ <path d="M224 104a8 8 0 0 1-16 0V59.32l-66.33 66.34a8 8 0 0 1-11.32-11.32L196.68 48H152a8 8 0 0 1 0-16h64a8 8 0 0 1 8 8Zm-40 24a8 8 0 0 0-8 8v72H48V80h72a8 8 0 0 0 0-16H48a16 16 0 0 0-16 16v128a16 16 0 0 0 16 16h128a16 16 0 0 0 16-16v-72a8 8 0 0 0-8-8Z" />+ </svg>+ );+}++function IconChevronUpDown({+ className,+ ...props+}: React.ComponentProps<"svg">) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ fill="currentColor"+ className={cn("size-4", className)}+ viewBox="0 0 256 256"+ {...props}+ >+ <path d="M181.66 170.34a8 8 0 0 1 0 11.32l-48 48a8 8 0 0 1-11.32 0l-48-48a8 8 0 0 1 11.32-11.32L128 212.69l42.34-42.35a8 8 0 0 1 11.32 0Zm-96-84.68L128 43.31l42.34 42.35a8 8 0 0 0 11.32-11.32l-48-48a8 8 0 0 0-11.32 0l-48 48a8 8 0 0 0 11.32 11.32Z" />+ </svg>+ );+}++function IconLlama({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ fill="currentColor"+ viewBox="0 0 24 24"+ role="img"+ xmlns="http://www.w3.org/2000/svg"+ className={cn("size-4", className)}+ {...props}+ >+ <title>Llama3 icon</title>+ <circle+ cx="12"+ cy="12"+ r="10"+ stroke="currentColor"+ strokeWidth="2"+ fill="none"+ />+ <path+ d="M6 9l6 6 6-6"+ stroke="currentColor"+ strokeWidth="2"+ strokeLinecap="round"+ strokeLinejoin="round"+ />+ </svg>+ );+}++function IconCode({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ width="15"+ height="15"+ viewBox="0 0 15 15"+ fill="none"+ xmlns="http://www.w3.org/2000/svg"+ >+ <path+ d="M9.96424 2.68571C10.0668 2.42931 9.94209 2.13833 9.6857 2.03577C9.4293 1.93322 9.13832 2.05792 9.03576 2.31432L5.03576 12.3143C4.9332 12.5707 5.05791 12.8617 5.3143 12.9642C5.5707 13.0668 5.86168 12.9421 5.96424 12.6857L9.96424 2.68571ZM3.85355 5.14646C4.04882 5.34172 4.04882 5.6583 3.85355 5.85356L2.20711 7.50001L3.85355 9.14646C4.04882 9.34172 4.04882 9.6583 3.85355 9.85356C3.65829 10.0488 3.34171 10.0488 3.14645 9.85356L1.14645 7.85356C0.951184 7.6583 0.951184 7.34172 1.14645 7.14646L3.14645 5.14646C3.34171 4.9512 3.65829 4.9512 3.85355 5.14646ZM11.1464 5.14646C11.3417 4.9512 11.6583 4.9512 11.8536 5.14646L13.8536 7.14646C14.0488 7.34172 14.0488 7.6583 13.8536 7.85356L11.8536 9.85356C11.6583 10.0488 11.3417 10.0488 11.1464 9.85356C10.9512 9.6583 10.9512 9.34172 11.1464 9.14646L12.7929 7.50001L11.1464 5.85356C10.9512 5.6583 10.9512 5.34172 11.1464 5.14646Z"+ fill="currentColor"+ fillRule="evenodd"+ clipRule="evenodd"+ ></path>+ </svg>+ );+}++function IconOllama({ className, ...props }: React.ComponentProps<"svg">) {+ return (+ <svg+ width="133"+ height="185"+ viewBox="0 0 133 185"+ fill="none"+ xmlns="http://www.w3.org/2000/svg"+ xmlnsXlink="http://www.w3.org/1999/xlink"+ >+ <rect width="133" height="185" fill="url(#pattern0)" />+ <defs>+ <pattern+ id="pattern0"+ patternContentUnits="objectBoundingBox"+ width="1"+ height="1"+ >+ <use+ xlinkHref="#image0_406_1657"+ transform="matrix(0.00552486 0 0 0.00397193 0 -0.00840675)"+ />+ </pattern>+ <image+ id="image0_406_1657"+ width="181"+ height="256"+ xlinkHref="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALUAAAEACAYAAAD1IzfbAAAMQGlDQ1BJQ0MgUHJvZmlsZQAASImVVwdYU8kWnluSkEBoAQSkhN4EkRpASggt9I5gIyQBQokxEFTsyKKCa0FFBGzoqoiCFRA7YmdR7H2xoKKsiwW78iYFdN1XvjffN3f++8+Z/5w5d+beOwCoHeeIRDmoOgC5wnxxbLA/fVxyCp30FJAAARCBOjDncPNEzOjocADLUPv38u46QKTtFXup1j/7/2vR4PHzuAAg0RCn8fK4uRDvBwCv4YrE+QAQpbzZtHyRFMMKtMQwQIgXSXGGHNdIcZoc75bZxMeyIG4HQEmFwxFnAKB6CfL0Am4G1FDth9hRyBMIAVCjQ+yTmzuFB3EqxNbQRgSxVJ+R9oNOxt8004Y1OZyMYSyfi6woBQjyRDmcGf9nOv53yc2RDPmwhFUlUxwSK50zzNvN7ClhUqwCcZ8wLTIKYk2IPwh4MnuIUUqmJCRBbo8acPNYMGdAB2JHHicgDGIDiIOEOZHhCj4tXRDEhhiuEHS6IJ8dD7EuxIv4eYFxCpuN4imxCl9oU7qYxVTwZzlimV+pr/uS7ASmQv91Jp+t0MdUCzPjkyCmQGxeIEiMhFgVYoe87Lgwhc3YwkxW5JCNWBIrjd8c4li+MNhfro8VpIuDYhX2pbl5Q/PFNmYK2JEKvDc/Mz5Enh+sncuRxQ/ngl3iC5kJQzr8vHHhQ3Ph8QMC5XPHnvGFCXEKnQ+ifP9Y+VicIsqJVtjjpvycYClvCrFLXkGcYiyemA8XpFwfTxflR8fL48QLszih0fJ48OUgHLBA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RUfePt9UPSiIRALQJWHvXxtkjqdWrDlg/gT2ySJASaImDlUR9vi6TeyJjVfUa7ZJYQyCNg5VEfb4ukzgcI2b8rZHAamxCoQCAKj4qkXrciWF1zWvmoQyj1+yBg5VEfb4uktr6QZD1t+BSaxowPAlYe9fG2SGorfCyaJ0kINEUgCo+KpOZpjkU2sBglm4RAAQErj/p4WyT1tEeOhaBVH9ep6kjtCYEABKw86uNtkdSPBiSQH7p2/kPaTwgYEbD++GMfb4uk7juMByS2acDYNDQhUIXAllUdNe19vC2Smt9gsAg/qZAkIdAUgW2MDvp4WyR137VJQIAdAsamoQmBKgSsPOrjbZHU1mfv0/6kpirr1J4QcCBg5ZGTt/xG2QNSrlFC9GmN71sA1+ckCYEQBOAPPArhHWPha99vPhaP1Ay6QRoqK8vg5aFGaXxCIIcA/IFHoQJf4e2UFElNR/AP7016Sz9kMwVr2jEgYOWPF1/nK6HQUwDjH5bOliZJCIQiAG/gj4V3832CzTE6J6E9fQKkMQmBAgLwxkJobOYUfJX+BfgyDbquONDzc98fQHrapGEJAStvrhd0y4rwlV1TM+as4kCPz89ozE0e49KQhEARAXgDf0Ll22UG/w9yreSQIAJvAgAAAABJRU5ErkJggg=="+ />+ </defs>+ </svg>+ );+}++export {+ IconOllama,+ IconEdit,+ IconNextChat,+ IconOpenAI,+ IconVercel,+ IconGitHub,+ IconSeparator,+ IconArrowDown,+ IconArrowRight,+ IconUser,+ IconPlus,+ IconArrowElbow,+ IconSpinner,+ IconMessage,+ IconTrash,+ IconRefresh,+ IconStop,+ IconSidebar,+ IconMoon,+ IconSun,+ IconCopy,+ IconCheck,+ IconDownload,+ IconClose,+ IconShare,+ IconUsers,+ IconExternalLink,+ IconChevronUpDown,+ IconLlama,+ IconCode,+};diff --git a/pipes/timeline/src/components/ui/input.tsx b/pipes/timeline/src/components/ui/input.tsxnew file mode 100644index 000000000..68551b927--- /dev/null+++ b/pipes/timeline/src/components/ui/input.tsx@@ -0,0 +1,22 @@+import * as React from "react"++import { cn } from "@/lib/utils"++const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<"input">>(+ ({ className, type, ...props }, ref) => {+ return (+ <input+ type={type}+ className={cn(+ "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",+ className+ )}+ ref={ref}+ {...props}+ />+ )+ }+)+Input.displayName = "Input"++export { Input }diff --git a/pipes/timeline/src/components/ui/label.tsx b/pipes/timeline/src/components/ui/label.tsxnew file mode 100644index 000000000..534182176--- /dev/null+++ b/pipes/timeline/src/components/ui/label.tsx@@ -0,0 +1,26 @@+"use client"++import * as React from "react"+import * as LabelPrimitive from "@radix-ui/react-label"+import { cva, type VariantProps } from "class-variance-authority"++import { cn } from "@/lib/utils"++const labelVariants = cva(+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"+)++const Label = React.forwardRef<+ React.ElementRef<typeof LabelPrimitive.Root>,+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &+ VariantProps<typeof labelVariants>+>(({ className, ...props }, ref) => (+ <LabelPrimitive.Root+ ref={ref}+ className={cn(labelVariants(), className)}+ {...props}+ />+))+Label.displayName = LabelPrimitive.Root.displayName++export { Label }diff --git a/pipes/timeline/src/components/ui/popover.tsx b/pipes/timeline/src/components/ui/popover.tsxnew file mode 100644index 000000000..a0ec48bee--- /dev/null+++ b/pipes/timeline/src/components/ui/popover.tsx@@ -0,0 +1,31 @@+"use client"++import * as React from "react"+import * as PopoverPrimitive from "@radix-ui/react-popover"++import { cn } from "@/lib/utils"++const Popover = PopoverPrimitive.Root++const PopoverTrigger = PopoverPrimitive.Trigger++const PopoverContent = React.forwardRef<+ React.ElementRef<typeof PopoverPrimitive.Content>,+ React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>+>(({ className, align = "center", sideOffset = 4, ...props }, ref) => (+ <PopoverPrimitive.Portal>+ <PopoverPrimitive.Content+ ref={ref}+ align={align}+ sideOffset={sideOffset}+ className={cn(+ "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",+ className+ )}+ {...props}+ />+ </PopoverPrimitive.Portal>+))+PopoverContent.displayName = PopoverPrimitive.Content.displayName++export { Popover, PopoverTrigger, PopoverContent }diff --git a/pipes/timeline/src/components/ui/progress.tsx b/pipes/timeline/src/components/ui/progress.tsxnew file mode 100644index 000000000..5c87ea486--- /dev/null+++ b/pipes/timeline/src/components/ui/progress.tsx@@ -0,0 +1,28 @@+"use client"++import * as React from "react"+import * as ProgressPrimitive from "@radix-ui/react-progress"++import { cn } from "@/lib/utils"++const Progress = React.forwardRef<+ React.ElementRef<typeof ProgressPrimitive.Root>,+ React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>+>(({ className, value, ...props }, ref) => (+ <ProgressPrimitive.Root+ ref={ref}+ className={cn(+ "relative h-4 w-full overflow-hidden rounded-full bg-secondary",+ className+ )}+ {...props}+ >+ <ProgressPrimitive.Indicator+ className="h-full w-full flex-1 bg-primary transition-all"+ style={{ transform: `translateX(-${100 - (value || 0)}%)` }}+ />+ </ProgressPrimitive.Root>+))+Progress.displayName = ProgressPrimitive.Root.displayName++export { Progress }diff --git a/pipes/timeline/src/components/ui/scroll-area.tsx b/pipes/timeline/src/components/ui/scroll-area.tsxnew file mode 100644index 000000000..0b4a48d87--- /dev/null+++ b/pipes/timeline/src/components/ui/scroll-area.tsx@@ -0,0 +1,48 @@+"use client"++import * as React from "react"+import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"++import { cn } from "@/lib/utils"++const ScrollArea = React.forwardRef<+ React.ElementRef<typeof ScrollAreaPrimitive.Root>,+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>+>(({ className, children, ...props }, ref) => (+ <ScrollAreaPrimitive.Root+ ref={ref}+ className={cn("relative overflow-hidden", className)}+ {...props}+ >+ <ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">+ {children}+ </ScrollAreaPrimitive.Viewport>+ <ScrollBar />+ <ScrollAreaPrimitive.Corner />+ </ScrollAreaPrimitive.Root>+))+ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName++const ScrollBar = React.forwardRef<+ React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>+>(({ className, orientation = "vertical", ...props }, ref) => (+ <ScrollAreaPrimitive.ScrollAreaScrollbar+ ref={ref}+ orientation={orientation}+ className={cn(+ "flex touch-none select-none transition-colors",+ orientation === "vertical" &&+ "h-full w-2.5 border-l border-l-transparent p-[1px]",+ orientation === "horizontal" &&+ "h-2.5 flex-col border-t border-t-transparent p-[1px]",+ className+ )}+ {...props}+ >+ <ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />+ </ScrollAreaPrimitive.ScrollAreaScrollbar>+))+ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName++export { ScrollArea, ScrollBar }diff --git a/pipes/timeline/src/components/ui/select.tsx b/pipes/timeline/src/components/ui/select.tsxnew file mode 100644index 000000000..cbe5a36b6--- /dev/null+++ b/pipes/timeline/src/components/ui/select.tsx@@ -0,0 +1,160 @@+"use client"++import * as React from "react"+import * as SelectPrimitive from "@radix-ui/react-select"+import { Check, ChevronDown, ChevronUp } from "lucide-react"++import { cn } from "@/lib/utils"++const Select = SelectPrimitive.Root++const SelectGroup = SelectPrimitive.Group++const SelectValue = SelectPrimitive.Value++const SelectTrigger = React.forwardRef<+ React.ElementRef<typeof SelectPrimitive.Trigger>,+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>+>(({ className, children, ...props }, ref) => (+ <SelectPrimitive.Trigger+ ref={ref}+ className={cn(+ "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",+ className+ )}+ {...props}+ >+ {children}+ <SelectPrimitive.Icon asChild>+ <ChevronDown className="h-4 w-4 opacity-50" />+ </SelectPrimitive.Icon>+ </SelectPrimitive.Trigger>+))+SelectTrigger.displayName = SelectPrimitive.Trigger.displayName++const SelectScrollUpButton = React.forwardRef<+ React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>+>(({ className, ...props }, ref) => (+ <SelectPrimitive.ScrollUpButton+ ref={ref}+ className={cn(+ "flex cursor-default items-center justify-center py-1",+ className+ )}+ {...props}+ >+ <ChevronUp className="h-4 w-4" />+ </SelectPrimitive.ScrollUpButton>+))+SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName++const SelectScrollDownButton = React.forwardRef<+ React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>+>(({ className, ...props }, ref) => (+ <SelectPrimitive.ScrollDownButton+ ref={ref}+ className={cn(+ "flex cursor-default items-center justify-center py-1",+ className+ )}+ {...props}+ >+ <ChevronDown className="h-4 w-4" />+ </SelectPrimitive.ScrollDownButton>+))+SelectScrollDownButton.displayName =+ SelectPrimitive.ScrollDownButton.displayName++const SelectContent = React.forwardRef<+ React.ElementRef<typeof SelectPrimitive.Content>,+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>+>(({ className, children, position = "popper", ...props }, ref) => (+ <SelectPrimitive.Portal>+ <SelectPrimitive.Content+ ref={ref}+ className={cn(+ "relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",+ position === "popper" &&+ "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",+ className+ )}+ position={position}+ {...props}+ >+ <SelectScrollUpButton />+ <SelectPrimitive.Viewport+ className={cn(+ "p-1",+ position === "popper" &&+ "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"+ )}+ >+ {children}+ </SelectPrimitive.Viewport>+ <SelectScrollDownButton />+ </SelectPrimitive.Content>+ </SelectPrimitive.Portal>+))+SelectContent.displayName = SelectPrimitive.Content.displayName++const SelectLabel = React.forwardRef<+ React.ElementRef<typeof SelectPrimitive.Label>,+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>+>(({ className, ...props }, ref) => (+ <SelectPrimitive.Label+ ref={ref}+ className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}+ {...props}+ />+))+SelectLabel.displayName = SelectPrimitive.Label.displayName++const SelectItem = React.forwardRef<+ React.ElementRef<typeof SelectPrimitive.Item>,+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>+>(({ className, children, ...props }, ref) => (+ <SelectPrimitive.Item+ ref={ref}+ className={cn(+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",+ className+ )}+ {...props}+ >+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">+ <SelectPrimitive.ItemIndicator>+ <Check className="h-4 w-4" />+ </SelectPrimitive.ItemIndicator>+ </span>++ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>+ </SelectPrimitive.Item>+))+SelectItem.displayName = SelectPrimitive.Item.displayName++const SelectSeparator = React.forwardRef<+ React.ElementRef<typeof SelectPrimitive.Separator>,+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>+>(({ className, ...props }, ref) => (+ <SelectPrimitive.Separator+ ref={ref}+ className={cn("-mx-1 my-1 h-px bg-muted", className)}+ {...props}+ />+))+SelectSeparator.displayName = SelectPrimitive.Separator.displayName++export {+ Select,+ SelectGroup,+ SelectValue,+ SelectTrigger,+ SelectContent,+ SelectLabel,+ SelectItem,+ SelectSeparator,+ SelectScrollUpButton,+ SelectScrollDownButton,+}diff --git a/pipes/timeline/src/components/ui/separator.tsx b/pipes/timeline/src/components/ui/separator.tsxnew file mode 100644index 000000000..12d81c4a8--- /dev/null+++ b/pipes/timeline/src/components/ui/separator.tsx@@ -0,0 +1,31 @@+"use client"++import * as React from "react"+import * as SeparatorPrimitive from "@radix-ui/react-separator"++import { cn } from "@/lib/utils"++const Separator = React.forwardRef<+ React.ElementRef<typeof SeparatorPrimitive.Root>,+ React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>+>(+ (+ { className, orientation = "horizontal", decorative = true, ...props },+ ref+ ) => (+ <SeparatorPrimitive.Root+ ref={ref}+ decorative={decorative}+ orientation={orientation}+ className={cn(+ "shrink-0 bg-border",+ orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",+ className+ )}+ {...props}+ />+ )+)+Separator.displayName = SeparatorPrimitive.Root.displayName++export { Separator }diff --git a/pipes/timeline/src/components/ui/skeleton.tsx b/pipes/timeline/src/components/ui/skeleton.tsxnew file mode 100644index 000000000..01b8b6d4f--- /dev/null+++ b/pipes/timeline/src/components/ui/skeleton.tsx@@ -0,0 +1,15 @@+import { cn } from "@/lib/utils"++function Skeleton({+ className,+ ...props+}: React.HTMLAttributes<HTMLDivElement>) {+ return (+ <div+ className={cn("animate-pulse rounded-md bg-muted", className)}+ {...props}+ />+ )+}++export { Skeleton }diff --git a/pipes/timeline/src/components/ui/slider.tsx b/pipes/timeline/src/components/ui/slider.tsxnew file mode 100644index 000000000..c31c2b3bc--- /dev/null+++ b/pipes/timeline/src/components/ui/slider.tsx@@ -0,0 +1,28 @@+"use client"++import * as React from "react"+import * as SliderPrimitive from "@radix-ui/react-slider"++import { cn } from "@/lib/utils"++const Slider = React.forwardRef<+ React.ElementRef<typeof SliderPrimitive.Root>,+ React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>+>(({ className, ...props }, ref) => (+ <SliderPrimitive.Root+ ref={ref}+ className={cn(+ "relative flex w-full touch-none select-none items-center",+ className+ )}+ {...props}+ >+ <SliderPrimitive.Track className="relative h-2 w-full grow overflow-hidden rounded-full bg-secondary">+ <SliderPrimitive.Range className="absolute h-full bg-primary" />+ </SliderPrimitive.Track>+ <SliderPrimitive.Thumb className="block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" />+ </SliderPrimitive.Root>+))+Slider.displayName = SliderPrimitive.Root.displayName++export { Slider }diff --git a/pipes/timeline/src/components/ui/switch.tsx b/pipes/timeline/src/components/ui/switch.tsxnew file mode 100644index 000000000..bc69cf2db--- /dev/null+++ b/pipes/timeline/src/components/ui/switch.tsx@@ -0,0 +1,29 @@+"use client"++import * as React from "react"+import * as SwitchPrimitives from "@radix-ui/react-switch"++import { cn } from "@/lib/utils"++const Switch = React.forwardRef<+ React.ElementRef<typeof SwitchPrimitives.Root>,+ React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>+>(({ className, ...props }, ref) => (+ <SwitchPrimitives.Root+ className={cn(+ "peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",+ className+ )}+ {...props}+ ref={ref}+ >+ <SwitchPrimitives.Thumb+ className={cn(+ "pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"+ )}+ />+ </SwitchPrimitives.Root>+))+Switch.displayName = SwitchPrimitives.Root.displayName++export { Switch }diff --git a/pipes/timeline/src/components/ui/toast.tsx b/pipes/timeline/src/components/ui/toast.tsxnew file mode 100644index 000000000..521b94b07--- /dev/null+++ b/pipes/timeline/src/components/ui/toast.tsx@@ -0,0 +1,129 @@+"use client"++import * as React from "react"+import * as ToastPrimitives from "@radix-ui/react-toast"+import { cva, type VariantProps } from "class-variance-authority"+import { X } from "lucide-react"++import { cn } from "@/lib/utils"++const ToastProvider = ToastPrimitives.Provider++const ToastViewport = React.forwardRef<+ React.ElementRef<typeof ToastPrimitives.Viewport>,+ React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>+>(({ className, ...props }, ref) => (+ <ToastPrimitives.Viewport+ ref={ref}+ className={cn(+ "fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",+ className+ )}+ {...props}+ />+))+ToastViewport.displayName = ToastPrimitives.Viewport.displayName++const toastVariants = cva(+ "group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",+ {+ variants: {+ variant: {+ default: "border bg-background text-foreground",+ destructive:+ "destructive group border-destructive bg-destructive text-destructive-foreground",+ },+ },+ defaultVariants: {+ variant: "default",+ },+ }+)++const Toast = React.forwardRef<+ React.ElementRef<typeof ToastPrimitives.Root>,+ React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &+ VariantProps<typeof toastVariants>+>(({ className, variant, ...props }, ref) => {+ return (+ <ToastPrimitives.Root+ ref={ref}+ className={cn(toastVariants({ variant }), className)}+ {...props}+ />+ )+})+Toast.displayName = ToastPrimitives.Root.displayName++const ToastAction = React.forwardRef<+ React.ElementRef<typeof ToastPrimitives.Action>,+ React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>+>(({ className, ...props }, ref) => (+ <ToastPrimitives.Action+ ref={ref}+ className={cn(+ "inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",+ className+ )}+ {...props}+ />+))+ToastAction.displayName = ToastPrimitives.Action.displayName++const ToastClose = React.forwardRef<+ React.ElementRef<typeof ToastPrimitives.Close>,+ React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>+>(({ className, ...props }, ref) => (+ <ToastPrimitives.Close+ ref={ref}+ className={cn(+ "absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",+ className+ )}+ toast-close=""+ {...props}+ >+ <X className="h-4 w-4" />+ </ToastPrimitives.Close>+))+ToastClose.displayName = ToastPrimitives.Close.displayName++const ToastTitle = React.forwardRef<+ React.ElementRef<typeof ToastPrimitives.Title>,+ React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>+>(({ className, ...props }, ref) => (+ <ToastPrimitives.Title+ ref={ref}+ className={cn("text-sm font-semibold", className)}+ {...props}+ />+))+ToastTitle.displayName = ToastPrimitives.Title.displayName++const ToastDescription = React.forwardRef<+ React.ElementRef<typeof ToastPrimitives.Description>,+ React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>+>(({ className, ...props }, ref) => (+ <ToastPrimitives.Description+ ref={ref}+ className={cn("text-sm opacity-90", className)}+ {...props}+ />+))+ToastDescription.displayName = ToastPrimitives.Description.displayName++type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>++type ToastActionElement = React.ReactElement<typeof ToastAction>++export {+ type ToastProps,+ type ToastActionElement,+ ToastProvider,+ ToastViewport,+ Toast,+ ToastTitle,+ ToastDescription,+ ToastClose,+ ToastAction,+}diff --git a/pipes/timeline/src/components/ui/toaster.tsx b/pipes/timeline/src/components/ui/toaster.tsxnew file mode 100644index 000000000..fe7103d70--- /dev/null+++ b/pipes/timeline/src/components/ui/toaster.tsx@@ -0,0 +1,35 @@+"use client"++import { useToast } from "@/components/ui/use-toast"+import {+ Toast,+ ToastClose,+ ToastDescription,+ ToastProvider,+ ToastTitle,+ ToastViewport,+} from "@/components/ui/toast"++export function Toaster() {+ const { toasts } = useToast()++ return (+ <ToastProvider>+ {toasts.map(function ({ id, title, description, action, ...props }) {+ return (+ <Toast key={id} {...props}>+ <div className="grid gap-1">+ {title && <ToastTitle>{title}</ToastTitle>}+ {description && (+ <ToastDescription>{description}</ToastDescription>+ )}+ </div>+ {action}+ <ToastClose />+ </Toast>+ )+ })}+ <ToastViewport />+ </ToastProvider>+ )+}diff --git a/pipes/timeline/src/components/ui/tooltip.tsx b/pipes/timeline/src/components/ui/tooltip.tsxnew file mode 100644index 000000000..30fc44d90--- /dev/null+++ b/pipes/timeline/src/components/ui/tooltip.tsx@@ -0,0 +1,30 @@+"use client"++import * as React from "react"+import * as TooltipPrimitive from "@radix-ui/react-tooltip"++import { cn } from "@/lib/utils"++const TooltipProvider = TooltipPrimitive.Provider++const Tooltip = TooltipPrimitive.Root++const TooltipTrigger = TooltipPrimitive.Trigger++const TooltipContent = React.forwardRef<+ React.ElementRef<typeof TooltipPrimitive.Content>,+ React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>+>(({ className, sideOffset = 4, ...props }, ref) => (+ <TooltipPrimitive.Content+ ref={ref}+ sideOffset={sideOffset}+ className={cn(+ "z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",+ className+ )}+ {...props}+ />+))+TooltipContent.displayName = TooltipPrimitive.Content.displayName++export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }diff --git a/pipes/timeline/src/components/ui/use-toast.ts b/pipes/timeline/src/components/ui/use-toast.tsnew file mode 100644index 000000000..02e111d81--- /dev/null+++ b/pipes/timeline/src/components/ui/use-toast.ts@@ -0,0 +1,194 @@+"use client"++// Inspired by react-hot-toast library+import * as React from "react"++import type {+ ToastActionElement,+ ToastProps,+} from "@/components/ui/toast"++const TOAST_LIMIT = 1+const TOAST_REMOVE_DELAY = 1000000++type ToasterToast = ToastProps & {+ id: string+ title?: React.ReactNode+ description?: React.ReactNode+ action?: ToastActionElement+}++const actionTypes = {+ ADD_TOAST: "ADD_TOAST",+ UPDATE_TOAST: "UPDATE_TOAST",+ DISMISS_TOAST: "DISMISS_TOAST",+ REMOVE_TOAST: "REMOVE_TOAST",+} as const++let count = 0++function genId() {+ count = (count + 1) % Number.MAX_SAFE_INTEGER+ return count.toString()+}++type ActionType = typeof actionTypes++type Action =+ | {+ type: ActionType["ADD_TOAST"]+ toast: ToasterToast+ }+ | {+ type: ActionType["UPDATE_TOAST"]+ toast: Partial<ToasterToast>+ }+ | {+ type: ActionType["DISMISS_TOAST"]+ toastId?: ToasterToast["id"]+ }+ | {+ type: ActionType["REMOVE_TOAST"]+ toastId?: ToasterToast["id"]+ }++interface State {+ toasts: ToasterToast[]+}++const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()++const addToRemoveQueue = (toastId: string) => {+ if (toastTimeouts.has(toastId)) {+ return+ }++ const timeout = setTimeout(() => {+ toastTimeouts.delete(toastId)+ dispatch({+ type: "REMOVE_TOAST",+ toastId: toastId,+ })+ }, TOAST_REMOVE_DELAY)++ toastTimeouts.set(toastId, timeout)+}++export const reducer = (state: State, action: Action): State => {+ switch (action.type) {+ case "ADD_TOAST":+ return {+ ...state,+ toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),+ }++ case "UPDATE_TOAST":+ return {+ ...state,+ toasts: state.toasts.map((t) =>+ t.id === action.toast.id ? { ...t, ...action.toast } : t+ ),+ }++ case "DISMISS_TOAST": {+ const { toastId } = action++ // ! Side effects ! - This could be extracted into a dismissToast() action,+ // but I'll keep it here for simplicity+ if (toastId) {+ addToRemoveQueue(toastId)+ } else {+ state.toasts.forEach((toast) => {+ addToRemoveQueue(toast.id)+ })+ }++ return {+ ...state,+ toasts: state.toasts.map((t) =>+ t.id === toastId || toastId === undefined+ ? {+ ...t,+ open: false,+ }+ : t+ ),+ }+ }+ case "REMOVE_TOAST":+ if (action.toastId === undefined) {+ return {+ ...state,+ toasts: [],+ }+ }+ return {+ ...state,+ toasts: state.toasts.filter((t) => t.id !== action.toastId),+ }+ }+}++const listeners: Array<(state: State) => void> = []++let memoryState: State = { toasts: [] }++function dispatch(action: Action) {+ memoryState = reducer(memoryState, action)+ listeners.forEach((listener) => {+ listener(memoryState)+ })+}++type Toast = Omit<ToasterToast, "id">++function toast({ ...props }: Toast) {+ const id = genId()++ const update = (props: ToasterToast) =>+ dispatch({+ type: "UPDATE_TOAST",+ toast: { ...props, id },+ })+ const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id })++ dispatch({+ type: "ADD_TOAST",+ toast: {+ ...props,+ id,+ open: true,+ onOpenChange: (open) => {+ if (!open) dismiss()+ },+ },+ })++ return {+ id: id,+ dismiss,+ update,+ }+}++function useToast() {+ const [state, setState] = React.useState<State>(memoryState)++ React.useEffect(() => {+ listeners.push(setState)+ return () => {+ const index = listeners.indexOf(setState)+ if (index > -1) {+ listeners.splice(index, 1)+ }+ }+ }, [state])++ return {+ ...state,+ toast,+ dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }),+ }+}++export { useToast, toast }diff --git a/pipes/timeline/src/components/video.tsx b/pipes/timeline/src/components/video.tsxnew file mode 100644index 000000000..20adfda27--- /dev/null+++ b/pipes/timeline/src/components/video.tsx@@ -0,0 +1,133 @@+import { memo, useCallback, useEffect, useState } from "react";+import { cn } from "@/lib/utils";+import { getMediaFile } from '@/lib/actions/video-actions'++export const VideoComponent = memo(function VideoComponent({+ filePath,+ customDescription,+ className,+}: {+ filePath: string;+ customDescription?: string;+ className?: string;+}) {+ const [mediaSrc, setMediaSrc] = useState<string | null>(null);+ const [error, setError] = useState<string | null>(null);+ const [isAudio, setIsAudio] = useState(false);++ const sanitizeFilePath = useCallback((path: string): string => {+ const isWindows = navigator.userAgent.includes("Windows");+ if (isWindows) {+ return path; // no sanitization on windows+ }+ return path+ .replace(/^["']|["']$/g, "")+ .trim()+ .replace(/\//g, "/");+ }, []);++ const renderFileLink = () => (+ // TODO button open link+ <p className={"mt-2 text-center text-xs text-gray-500"}>+ {customDescription || filePath}+ </p>+ );++ const getMimeType = (path: string): string => {+ const ext = path.split(".").pop()?.toLowerCase();+ switch (ext) {+ case "mp4":+ return "video/mp4";+ case "webm":+ return "video/webm";+ case "ogg":+ return "video/ogg";+ case "mp3":+ return "audio/mpeg";+ case "wav":+ return "audio/wav";+ default:+ return isAudio ? "audio/mpeg" : "video/mp4";+ }+ };++ useEffect(() => {+ async function loadMedia() {+ try {+ console.log("Loading media:", filePath);+ const sanitizedPath = sanitizeFilePath(filePath);+ console.log("Sanitized path:", sanitizedPath);+ if (!sanitizedPath) {+ throw new Error("Invalid file path");+ }++ setIsAudio(+ sanitizedPath.toLowerCase().includes("input") ||+ sanitizedPath.toLowerCase().includes("output")+ );++ const { data, mimeType } = await getMediaFile(sanitizedPath);+ const binaryData = atob(data);+ const bytes = new Uint8Array(binaryData.length);+ for (let i = 0; i < binaryData.length; i++) {+ bytes[i] = binaryData.charCodeAt(i);+ }+ const blob = new Blob([bytes], { type: mimeType });+ setMediaSrc(URL.createObjectURL(blob));+ } catch (error) {+ console.error("Failed to load media:", error);+ setError(+ `Failed to load media: ${+ error instanceof Error ? error.message : "Unknown error"+ }`+ );+ }+ }++ loadMedia();+ return () => {+ if (mediaSrc) URL.revokeObjectURL(mediaSrc);+ };+ }, [filePath, sanitizeFilePath]);++ if (error) {+ return (+ <div className="w-full p-4 bg-red-100 border border-red-300 rounded-md">+ <p className="text-red-700">{error}</p>+ {renderFileLink()}+ </div>+ );+ }++ if (!mediaSrc) {+ return (+ <div+ className={cn(+ "w-full h-48 bg-gray-200 animate-pulse rounded-md flex items-center justify-center",+ className+ )}+ >+ <span className="text-gray-500">Loading media...</span>+ </div>+ );+ }++ return (+ <div className={cn("w-full max-w-2xl text-center", className)}>+ {isAudio ? (+ <div className="bg-gray-100 p-4 rounded-md">+ <audio controls className="w-full">+ <source src={mediaSrc} type="audio/mpeg" />+ Your browser does not support the audio element.+ </audio>+ </div>+ ) : (+ <video controls className="w-full rounded-md">+ <source src={mediaSrc} type="video/mp4" />+ Your browser does not support the video tag.+ </video>+ )}+ {renderFileLink()}+ </div>+ );+});diff --git a/pipes/timeline/src/lib/actions/video-actions.ts b/pipes/timeline/src/lib/actions/video-actions.tsnew file mode 100644index 000000000..9238c9e96--- /dev/null+++ b/pipes/timeline/src/lib/actions/video-actions.ts@@ -0,0 +1,35 @@+'use server'++import { readFile } from 'node:fs/promises'+import { resolve } from 'node:path'++export async function getMediaFile(filePath: string): Promise<{ data: string; mimeType: string }> {+ try {+ const absolutePath = resolve(filePath)+ const buffer = await readFile(absolutePath)+ // convert to base64+ const data = buffer.toString('base64')++ const getMimeType = (path: string): string => {+ const ext = path.split('.').pop()?.toLowerCase()+ const isAudio = path.toLowerCase().includes('input') || path.toLowerCase().includes('output')++ switch (ext) {+ case 'mp4': return 'video/mp4'+ case 'webm': return 'video/webm'+ case 'ogg': return 'video/ogg'+ case 'mp3': return 'audio/mpeg'+ case 'wav': return 'audio/wav'+ default: return isAudio ? 'audio/mpeg' : 'video/mp4'+ }+ }++ return {+ data,+ mimeType: getMimeType(filePath)+ }+ } catch (error) {+ console.error('failed to read media file:', error)+ throw new Error(`failed to read media file: ${error instanceof Error ? error.message : 'unknown error'}`)+ }+}diff --git a/pipes/timeline/src/lib/hooks/use-copy-to-clipboard.tsx b/pipes/timeline/src/lib/hooks/use-copy-to-clipboard.tsxnew file mode 100644index 000000000..e011d69bd--- /dev/null+++ b/pipes/timeline/src/lib/hooks/use-copy-to-clipboard.tsx@@ -0,0 +1,33 @@+"use client";++import * as React from "react";++export interface useCopyToClipboardProps {+ timeout?: number;+}++export function useCopyToClipboard({+ timeout = 2000,+}: useCopyToClipboardProps) {+ const [isCopied, setIsCopied] = React.useState<Boolean>(false);++ const copyToClipboard = (value: string) => {+ if (typeof window === "undefined" || !navigator.clipboard?.writeText) {+ return;+ }++ if (!value) {+ return;+ }++ navigator.clipboard.writeText(value).then(() => {+ setIsCopied(true);++ setTimeout(() => {+ setIsCopied(false);+ }, timeout);+ });+ };++ return { isCopied, copyToClipboard };+}diff --git a/pipes/timeline/src/lib/hooks/use-debounce.tsx b/pipes/timeline/src/lib/hooks/use-debounce.tsxnew file mode 100644index 000000000..ba49720b5--- /dev/null+++ b/pipes/timeline/src/lib/hooks/use-debounce.tsx@@ -0,0 +1,17 @@+import { useState, useEffect } from "react";++export function useDebounce<T>(value: T, delay: number): T {+ const [debouncedValue, setDebouncedValue] = useState<T>(value);++ useEffect(() => {+ const handler = setTimeout(() => {+ setDebouncedValue(value);+ }, delay);++ return () => {+ clearTimeout(handler);+ };+ }, [value, delay]);++ return debouncedValue;+}diff --git a/pipes/timeline/src/lib/hooks/use-health-check.tsx b/pipes/timeline/src/lib/hooks/use-health-check.tsxnew file mode 100644index 000000000..8d32570d0--- /dev/null+++ b/pipes/timeline/src/lib/hooks/use-health-check.tsx@@ -0,0 +1,131 @@+import { useState, useEffect, useCallback, useRef } from "react";++import { debounce } from "lodash";+++interface HealthCheckResponse {+ status: string;+ status_code: number;+ last_frame_timestamp: string | null;+ last_audio_timestamp: string | null;+ last_ui_timestamp: string | null;+ frame_status: string;+ audio_status: string;+ ui_status: string;+ message: string;+}++function isHealthChanged(+ oldHealth: HealthCheckResponse | null,+ newHealth: HealthCheckResponse+): boolean {+ if (!oldHealth) return true;+ return (+ oldHealth.status !== newHealth.status ||+ oldHealth.status_code !== newHealth.status_code ||+ oldHealth.last_frame_timestamp !== newHealth.last_frame_timestamp ||+ oldHealth.last_audio_timestamp !== newHealth.last_audio_timestamp ||+ oldHealth.last_ui_timestamp !== newHealth.last_ui_timestamp ||+ oldHealth.frame_status !== newHealth.frame_status ||+ oldHealth.audio_status !== newHealth.audio_status ||+ oldHealth.ui_status !== newHealth.ui_status ||+ oldHealth.message !== newHealth.message+ );+}++interface HealthCheckHook {+ health: HealthCheckResponse | null;+ isServerDown: boolean;+ isLoading: boolean;+ fetchHealth: () => Promise<void>;+ debouncedFetchHealth: () => Promise<void>;+}++export function useHealthCheck() {+ const [health, setHealth] = useState<HealthCheckResponse | null>(null);+ const [isServerDown, setIsServerDown] = useState(false);+ const [isLoading, setIsLoading] = useState(false);+ const abortControllerRef = useRef<AbortController | null>(null);+ const healthRef = useRef(health);++ const fetchHealth = useCallback(async () => {+ if (abortControllerRef.current) {+ abortControllerRef.current.abort();+ }++ abortControllerRef.current = new AbortController();++ try {+ setIsLoading(true);+ const response = await fetch("http://localhost:3030/health", {+ cache: "no-store",+ signal: abortControllerRef.current.signal,+ headers: {+ "Cache-Control": "no-cache",+ Pragma: "no-cache",+ },+ });++ if (!response.ok) {+ throw new Error(`HTTP error! status: ${response.status}`);+ }++ const data: HealthCheckResponse = await response.json();++ if (isHealthChanged(healthRef.current, data)) {+ setHealth(data);+ healthRef.current = data;+ }++ setIsServerDown(false);+ } catch (error) {+ if (error instanceof Error && error.name === "AbortError") {+ return;+ }++ // console.error("Health check error:", error);+ if (!isServerDown) {+ setIsServerDown(true);+ const errorHealth: HealthCheckResponse = {+ last_frame_timestamp: null,+ last_audio_timestamp: null,+ last_ui_timestamp: null,+ frame_status: "error",+ audio_status: "error",+ ui_status: "error",+ status: "error",+ status_code: 500,+ message: "Failed to fetch health status. Server might be down.",+ };+ setHealth(errorHealth);+ healthRef.current = errorHealth;+ }+ } finally {+ setIsLoading(false);+ }+ }, [isServerDown, setIsLoading]);++ const debouncedFetchHealth = useCallback(debounce(fetchHealth, 200), [+ fetchHealth,+ ]);++ useEffect(() => {+ fetchHealth();+ const interval = setInterval(fetchHealth, 1000);++ return () => {+ clearInterval(interval);+ if (abortControllerRef.current) {+ abortControllerRef.current.abort();+ }+ };+ }, [fetchHealth]);++ return {+ health,+ isServerDown,+ isLoading,+ fetchHealth,+ debouncedFetchHealth,+ } as HealthCheckHook;+}diff --git a/pipes/timeline/src/lib/hooks/use-search-history.tsx b/pipes/timeline/src/lib/hooks/use-search-history.tsxnew file mode 100644index 000000000..4673e3e22--- /dev/null+++ b/pipes/timeline/src/lib/hooks/use-search-history.tsx@@ -0,0 +1,127 @@+"use client";++import { useEffect, useState } from 'react';+import localforage from 'localforage';++export interface SearchHistory {+ id: string;+ query: string;+ timestamp: string;+ searchParams: {+ q?: string;+ content_type: string;+ limit: number;+ offset: number;+ start_time: string;+ end_time: string;+ app_name?: string;+ window_name?: string;+ include_frames: boolean;+ min_length: number;+ max_length: number;+ };+ results: any[];+ messages: {+ id: string;+ type: 'search' | 'ai';+ content: string;+ timestamp: string;+ }[];+ }++const HISTORY_KEY = 'screenpipe-search-history';++export function useSearchHistory() {+ const [searches, setSearches] = useState<SearchHistory[]>([]);+ const [currentSearchId, setCurrentSearchId] = useState<string | null>(null);+ const [isLoading, setIsLoading] = useState(true);+ const [isCollapsed, setIsCollapsed] = useState(true);++ useEffect(() => {+ loadSearches();+ }, []);++ const loadSearches = async () => {+ try {+ const stored = await localforage.getItem<SearchHistory[]>(HISTORY_KEY);+ setSearches(stored || []);+ } catch (error) {+ console.error('failed to load search history:', error);+ }+ setIsLoading(false);+ };++ const saveSearches = async (updated: SearchHistory[]) => {+ try {+ await localforage.setItem(HISTORY_KEY, updated);+ setSearches(updated);+ } catch (error) {+ console.error('failed to save search history:', error);+ }+ };++ const addSearch = async (searchParams: any, results: any[]) => {+ const timestamp = new Date().toISOString();+ const newSearch: SearchHistory = {+ id: crypto.randomUUID(),+ query: searchParams.q || '',+ timestamp,+ searchParams,+ results,+ messages: [{+ id: crypto.randomUUID(),+ type: 'search' as const,+ content: searchParams.q || '',+ timestamp+ }]+ };++ const updated = [newSearch, ...searches];+ await saveSearches(updated);+ setCurrentSearchId(newSearch.id);+ return newSearch.id;+ };++ const addAIResponse = async (searchId: string, response: string) => {+ const timestamp = new Date().toISOString();+ const updated = searches.map(search => {+ if (search.id === searchId) {+ return {+ ...search,+ messages: [...search.messages, {+ id: crypto.randomUUID(),+ type: 'ai' as const,+ content: response,+ timestamp+ }]+ };+ }+ return search;+ });+ await saveSearches(updated);+ };++ const deleteSearch = async (id: string) => {+ const updated = searches.filter(s => s.id !== id);+ await saveSearches(updated);+ if (currentSearchId === id) {+ setCurrentSearchId(null);+ }+ };++ const toggleCollapse = () => {+ setIsCollapsed(!isCollapsed);+ };++ return {+ searches,+ currentSearchId,+ setCurrentSearchId,+ addSearch,+ addAIResponse,+ deleteSearch,+ isLoading,+ isCollapsed,+ toggleCollapse+ };+}diff --git a/pipes/timeline/src/lib/hooks/use-settings.tsx b/pipes/timeline/src/lib/hooks/use-settings.tsxnew file mode 100644index 000000000..f949d6458--- /dev/null+++ b/pipes/timeline/src/lib/hooks/use-settings.tsx@@ -0,0 +1,103 @@+"use client";++import { useState, useEffect } from "react";+import type { Settings } from "@screenpipe/js";++export function useSettings() {+ const defaultSettings: Settings = {+ 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,+ };++ const [settings, setSettings] = useState<Settings>(defaultSettings);+ const [loading, setLoading] = useState(false);+ const [error, setError] = useState<Error | null>(null);++ useEffect(() => {+ const loadSettings = async () => {+ setLoading(true);+ try {+ const response = await fetch("/api/settings");+ const data = await response.json();+ setSettings({ ...defaultSettings, ...data });+ } catch (err) {+ setError(err as Error);+ } finally {+ setLoading(false);+ }+ };+ loadSettings();+ }, []);++ const updateSetting = async <T extends keyof Settings>(+ key: T,+ value: Settings[T]+ ) => {+ try {+ await fetch("/api/settings", {+ method: "PUT",+ body: JSON.stringify({ key, value }),+ });+ setSettings((prev) => ({ ...prev, [key]: value }));+ } catch (err) {+ setError(err as Error);+ }+ };++ const updateSettings = async (newSettings: Partial<Settings>) => {+ try {+ await fetch("/api/settings", {+ method: "PUT",+ body: JSON.stringify({ value: newSettings, isPartialUpdate: true }),+ });+ setSettings((prev) => ({ ...prev, ...newSettings }));+ } catch (err) {+ setError(err as Error);+ }+ };++ const resetSettings = async (settingKey?: keyof Settings) => {+ try {+ await fetch("/api/settings", {+ method: "PUT",+ body: JSON.stringify({ reset: true, key: settingKey }),+ });+ if (settingKey) {+ setSettings((prev) => ({+ ...prev,+ [settingKey]: defaultSettings[settingKey],+ }));+ } else {+ setSettings(defaultSettings);+ }+ } catch (err) {+ setError(err as Error);+ }+ };++ return {+ settings,+ loading,+ error,+ updateSetting,+ updateSettings,+ resetSettings,+ };+}diff --git a/pipes/timeline/src/lib/hooks/use-sql-autocomplete.tsx b/pipes/timeline/src/lib/hooks/use-sql-autocomplete.tsxnew file mode 100644index 000000000..7db3de855--- /dev/null+++ b/pipes/timeline/src/lib/hooks/use-sql-autocomplete.tsx@@ -0,0 +1,61 @@+import { useState, useEffect, useCallback } from "react";++interface AutocompleteItem {+ name: string;+ count: number;+}++const CACHE_DURATION = 5 * 60 * 1000; // 5 minutes++const cache: Record<string, { data: AutocompleteItem[]; timestamp: number }> =+ {};++export function useSqlAutocomplete(type: "app" | "window") {+ const [items, setItems] = useState<AutocompleteItem[]>([]);+ const [isLoading, setIsLoading] = useState(false);++ const fetchItems = useCallback(async () => {+ setIsLoading(true);+ try {+ const cachedData = cache[type];+ if (cachedData && Date.now() - cachedData.timestamp < CACHE_DURATION) {+ setItems(cachedData.data);+ } else {+ const query = `+ SELECT ${+ type === "app" ? "ocr.app_name" : "ocr.window_name"+ } as name, COUNT(*) as count+ FROM ocr_text ocr+ JOIN frames f ON ocr.frame_id = f.id+ WHERE f.timestamp > datetime('now', '-7 days')+ GROUP BY ${type === "app" ? "ocr.app_name" : "ocr.window_name"}+ ORDER BY count DESC+ LIMIT 100+ `;+ const response = await fetch("http://localhost:3030/raw_sql", {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ },+ body: JSON.stringify({ query }),+ });+ if (!response.ok) {+ throw new Error(`HTTP error! status: ${response.status}`);+ }+ const result = await response.json();+ setItems(result);+ cache[type] = { data: result, timestamp: Date.now() };+ }+ } catch (error) {+ console.error("failed to fetch items:", error);+ } finally {+ setIsLoading(false);+ }+ }, [type]);++ useEffect(() => {+ fetchItems();+ }, [fetchItems]);++ return { items, isLoading };+}diff --git a/screenpipe-app-tauri/lib/hooks/use-timeline-selection.tsx b/pipes/timeline/src/lib/hooks/use-timeline-selection.tsxsimilarity index 100%rename from screenpipe-app-tauri/lib/hooks/use-timeline-selection.tsxrename to pipes/timeline/src/lib/hooks/use-timeline-selection.tsxdiff --git a/pipes/timeline/src/lib/utils.ts b/pipes/timeline/src/lib/utils.tsnew file mode 100644index 000000000..847c458cf--- /dev/null+++ b/pipes/timeline/src/lib/utils.ts@@ -0,0 +1,60 @@+import { ContentItem } from "@screenpipe/js";+import { clsx, type ClassValue } from "clsx";+import { twMerge } from "tailwind-merge";+import levenshtein from "js-levenshtein";++export function cn(...inputs: ClassValue[]) {+ return twMerge(clsx(inputs));+}++export const removeDuplicateSelections = (+ results: ContentItem[],+ selectedResults: Set<number>,+ similarityThreshold: number = 0.9+): Set<number> => {+ const newSelectedResults = new Set<number>();+ const seenContents: string[] = [];++ const getSimilarity = (str1: string, str2: string): number => {+ const maxLength = Math.max(str1.length, str2.length);+ const distance = levenshtein(str1, str2);+ return 1 - distance / maxLength;+ };++ const isDuplicate = (content: string): boolean => {+ return seenContents.some(+ (seenContent) =>+ getSimilarity(content, seenContent) >= similarityThreshold+ );+ };++ Array.from(selectedResults).forEach((index) => {+ const item = results[index];+ if (!item || !item.type) return;++ let content = "";+ if (item.type === "OCR") content = item.content.text;+ else if (item.type === "Audio") content = item.content.transcription;+ else if (item.type === "UI") content = item.content.text;++ if (!isDuplicate(content)) {+ seenContents.push(content);+ newSelectedResults.add(index);+ }+ });++ return newSelectedResults;+};++export function stringToColor(str: string): string {+ let hash = 0;+ for (let i = 0; i < str.length; i++) {+ hash = str.charCodeAt(i) + ((hash << 5) - hash);+ }+ let color = "#";+ for (let i = 0; i < 3; i++) {+ const value = (hash >> (i * 8)) & 0xff;+ color += ("00" + value.toString(16)).substr(-2);+ }+ return color;+}diff --git a/pipes/timeline/tailwind.config.ts b/pipes/timeline/tailwind.config.tsnew file mode 100644index 000000000..9a58f7ad4--- /dev/null+++ b/pipes/timeline/tailwind.config.ts@@ -0,0 +1,84 @@+import type { Config } from "tailwindcss";++export default {+ darkMode: ["class"],+ content: [+ "./src/pages/**/*.{js,ts,jsx,tsx,mdx}",+ "./src/components/**/*.{js,ts,jsx,tsx,mdx}",+ "./src/app/**/*.{js,ts,jsx,tsx,mdx}",+ ],+ theme: {+ extend: {+ colors: {+ background: 'hsl(var(--background))',+ foreground: 'hsl(var(--foreground))',+ card: {+ DEFAULT: 'hsl(var(--card))',+ foreground: 'hsl(var(--card-foreground))'+ },+ popover: {+ DEFAULT: 'hsl(var(--popover))',+ foreground: 'hsl(var(--popover-foreground))'+ },+ primary: {+ DEFAULT: 'hsl(var(--primary))',+ foreground: 'hsl(var(--primary-foreground))'+ },+ secondary: {+ DEFAULT: 'hsl(var(--secondary))',+ foreground: 'hsl(var(--secondary-foreground))'+ },+ muted: {+ DEFAULT: 'hsl(var(--muted))',+ foreground: 'hsl(var(--muted-foreground))'+ },+ accent: {+ DEFAULT: 'hsl(var(--accent))',+ foreground: 'hsl(var(--accent-foreground))'+ },+ destructive: {+ DEFAULT: 'hsl(var(--destructive))',+ foreground: 'hsl(var(--destructive-foreground))'+ },+ border: 'hsl(var(--border))',+ input: 'hsl(var(--input))',+ ring: 'hsl(var(--ring))',+ chart: {+ '1': 'hsl(var(--chart-1))',+ '2': 'hsl(var(--chart-2))',+ '3': 'hsl(var(--chart-3))',+ '4': 'hsl(var(--chart-4))',+ '5': 'hsl(var(--chart-5))'+ }+ },+ borderRadius: {+ lg: 'var(--radius)',+ md: 'calc(var(--radius) - 2px)',+ sm: 'calc(var(--radius) - 4px)'+ },+ keyframes: {+ 'accordion-down': {+ from: {+ height: '0'+ },+ to: {+ height: 'var(--radix-accordion-content-height)'+ }+ },+ 'accordion-up': {+ from: {+ height: 'var(--radix-accordion-content-height)'+ },+ to: {+ height: '0'+ }+ }+ },+ animation: {+ 'accordion-down': 'accordion-down 0.2s ease-out',+ 'accordion-up': 'accordion-up 0.2s ease-out'+ }+ }+ },+ plugins: [require("tailwindcss-animate")],+} satisfies Config;diff --git a/pipes/timeline/tsconfig.json b/pipes/timeline/tsconfig.jsonnew file mode 100644index 000000000..c1334095f--- /dev/null+++ b/pipes/timeline/tsconfig.json@@ -0,0 +1,27 @@+{+ "compilerOptions": {+ "target": "ES2017",+ "lib": ["dom", "dom.iterable", "esnext"],+ "allowJs": true,+ "skipLibCheck": true,+ "strict": true,+ "noEmit": true,+ "esModuleInterop": true,+ "module": "esnext",+ "moduleResolution": "bundler",+ "resolveJsonModule": true,+ "isolatedModules": true,+ "jsx": "preserve",+ "incremental": true,+ "plugins": [+ {+ "name": "next"+ }+ ],+ "paths": {+ "@/*": ["./src/*"]+ }+ },+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],+ "exclude": ["node_modules"]+}diff --git a/screenpipe-app-tauri/components/header.tsx b/screenpipe-app-tauri/components/header.tsxindex 4305d317f..359da87b5 100644--- a/screenpipe-app-tauri/components/header.tsx+++ b/screenpipe-app-tauri/components/header.tsx@@ -123,10 +123,6 @@ export default function Header() {const { setShowOnboarding } = useOnboarding();const { setShowChangelogDialog } = useChangelogDialog();- const handleShowTimeline = async () => {- await invoke("show_timeline");- };-const handleShowMeetingHistory = async () => {await invoke("show_meetings");};@@ -186,18 +182,6 @@ export default function Header() {</DropdownMenuGroup><DropdownMenuSeparator /><DropdownMenuGroup>- <DropdownMenuItem- className="cursor-pointer"- onClick={handleShowTimeline}- disabled={- !settings.enableFrameCache ||- !health ||- health.status === "error"- }- >- <Clock className="mr-2 h-4 w-4" />- <span>timeline</span>- </DropdownMenuItem><DropdownMenuItemclassName="cursor-pointer"onClick={handleShowMeetingHistory}diff --git a/screenpipe-app-tauri/src-tauri/src/commands.rs b/screenpipe-app-tauri/src-tauri/src/commands.rsindex 9a1414dd7..b4ed2c208 100644--- a/screenpipe-app-tauri/src-tauri/src/commands.rs+++ b/screenpipe-app-tauri/src-tauri/src/commands.rs@@ -108,33 +108,7 @@ pub fn show_main_window(app_handle: &tauri::AppHandle<tauri::Wry>, overlay: bool}}-#[tauri::command]-pub fn show_timeline(app_handle: tauri::AppHandle<tauri::Wry>) {- if let Some(window) = app_handle.get_webview_window("timeline") {- #[cfg(target_os = "macos")]- let _ = app_handle.set_activation_policy(tauri::ActivationPolicy::Accessory);- // let _ = window.set_visible_on_all_workspaces(true);- // let _ = window.set_always_on_top(true);- let _ = window.set_decorations(true);- let _ = window.show();- let _ = window.set_focus();- } else {- let _window = tauri::WebviewWindowBuilder::new(- &app_handle,- "timeline",- tauri::WebviewUrl::App("timeline.html".into()),- )- .title("timeline")- .decorations(true)- .transparent(true)- // .always_on_top(true)- // .visible_on_all_workspaces(true) // Added this- .center()- .build()- .unwrap();- }-}#[tauri::command]pub fn show_meetings(app_handle: tauri::AppHandle<tauri::Wry>) {if let Some(window) = app_handle.get_webview_window("meetings") {diff --git a/screenpipe-app-tauri/src-tauri/src/icons.rs b/screenpipe-app-tauri/src-tauri/src/icons.rsindex 61099885c..d5f0164af 100644--- a/screenpipe-app-tauri/src-tauri/src/icons.rs+++ b/screenpipe-app-tauri/src-tauri/src/icons.rs@@ -6,7 +6,6 @@ pub struct AppIcon {pub path: Option<String>,}-#[tauri::command]#[cfg(target_os = "macos")]pub async fn get_app_icon(app_name: &str,@@ -18,7 +17,6 @@ pub async fn get_app_icon(use objc::{class, msg_send, sel, sel_impl};unsafe {- // Create autorelease poollet pool = NSAutoreleasePool::new(nil);let result = (|| {@@ -29,7 +27,6 @@ pub async fn get_app_icon(} else {let ns_app_name = NSString::alloc(nil).init_str(app_name);let path: id = msg_send![workspace, fullPathForApplication: ns_app_name];- // Release the NSString we createdlet _: () = msg_send![ns_app_name, release];if path == nil {@@ -49,7 +46,6 @@ pub async fn get_app_icon(return Ok(None);}- // Rest of the conversion logic remains the samelet tiff_data: id = msg_send![icon, TIFFRepresentation];let image_rep: id = msg_send![class!(NSBitmapImageRep), imageRepWithData: tiff_data];let png_data: id = msg_send![image_rep, representationUsingType:4 properties:nil];@@ -66,7 +62,6 @@ pub async fn get_app_icon(}))})();- // Drain the autorelease poollet _: () = msg_send![pool, drain];result@@ -79,12 +74,12 @@ use lazy_static::lazy_static;use std::sync::Arc;#[cfg(target_os = "windows")]use tokio::sync::Semaphore;+#[cfg(target_os = "windows")]lazy_static! {static ref SEMAPHORE: Arc<Semaphore> = Arc::new(Semaphore::new(5));}-#[tauri::command]#[cfg(target_os = "windows")]pub async fn get_app_icon(app_name: &str,@@ -310,7 +305,6 @@ async fn get_exe_by_appx(app_name: &str) -> Option<String> {None}-#[tauri::command]#[cfg(target_os = "linux")]pub async fn get_app_icon(app_name: &str,@@ -337,7 +331,6 @@ pub async fn get_app_icon(None => find_icon_path(app_name).ok_or_else(|| "could not find icon path".to_string())?,};- // base64 will be in svg!let icon_data = fs::read(&path).map_err(|e| e.to_string())?;let base64 = STANDARD.encode(&icon_data);diff --git a/screenpipe-app-tauri/src-tauri/src/main.rs b/screenpipe-app-tauri/src-tauri/src/main.rsindex ba303e225..245c6cdc0 100755--- a/screenpipe-app-tauri/src-tauri/src/main.rs+++ b/screenpipe-app-tauri/src-tauri/src/main.rs@@ -161,8 +161,6 @@ async fn main() {llm_sidecar::start_ollama_sidecar,llm_sidecar::stop_ollama_sidecar,commands::update_show_screenpipe_shortcut,- commands::show_timeline,- icons::get_app_icon,commands::open_auth_window,commands::show_meetings,commands::show_identify_speakers,diff --git a/screenpipe-app-tauri/src-tauri/src/server.rs b/screenpipe-app-tauri/src-tauri/src/server.rsindex 04ce8fec0..37edbf11b 100644--- a/screenpipe-app-tauri/src-tauri/src/server.rs+++ b/screenpipe-app-tauri/src-tauri/src/server.rs@@ -1,5 +1,6 @@+use crate::icons::AppIcon;use axum::{- extract::State,+ extract::{Query, State},http::{Method, StatusCode},Json, Router,};@@ -15,6 +16,7 @@ use tokio::sync::mpsc;use tower_http::cors::{Any, CorsLayer};use tower_http::trace::{DefaultMakeSpan, TraceLayer};use tracing::{error, info};+#[derive(Clone, serde::Serialize, serde::Deserialize)]struct LogEntry {pipe_id: String,@@ -71,6 +73,12 @@ struct AuthData {user_id: String,}+#[derive(Debug, Deserialize)]+struct AppIconQuery {+ name: String,+ path: Option<String>,+}+pub async fn run_server(app_handle: tauri::AppHandle, port: u16) {let state = ServerState { app_handle };@@ -85,6 +93,7 @@ pub async fn run_server(app_handle: tauri::AppHandle, port: u16) {.route("/inbox", axum::routing::post(send_inbox_message)).route("/log", axum::routing::post(log_message)).route("/auth", axum::routing::post(handle_auth))+ .route("/app-icon", axum::routing::get(get_app_icon_handler)).layer(cors).layer(TraceLayer::new_for_http()@@ -218,6 +227,35 @@ async fn handle_auth(}))}+async fn get_app_icon_handler(+ State(_): State<ServerState>,+ Query(app_name): Query<AppIconQuery>,+) -> Result<Json<Option<AppIcon>>, (StatusCode, String)> {+ info!("received app icon request: {:?}", app_name);++ #[cfg(any(target_os = "macos", target_os = "windows", target_os = "linux"))]+ {+ match crate::icons::get_app_icon(&app_name.name, app_name.path).await {+ Ok(icon) => Ok(Json(icon)),+ Err(e) => {+ error!("failed to get app icon: {}", e);+ Err((+ StatusCode::INTERNAL_SERVER_ERROR,+ format!("failed to get app icon: {}", e),+ ))+ }+ }+ }++ #[cfg(not(any(target_os = "macos", target_os = "windows", target_os = "linux")))]+ {+ Err((+ StatusCode::NOT_IMPLEMENTED,+ "app icon retrieval not supported on this platform".to_string(),+ ))+ }+}+pub fn spawn_server(app_handle: tauri::AppHandle, port: u16) -> mpsc::Sender<()> {let (tx, mut rx) = mpsc::channel(1);diff --git a/screenpipe-app-tauri/src-tauri/tauri.conf.json b/screenpipe-app-tauri/src-tauri/tauri.conf.jsonindex d3ce0b512..e8b1741a5 100644--- a/screenpipe-app-tauri/src-tauri/tauri.conf.json+++ b/screenpipe-app-tauri/src-tauri/tauri.conf.json@@ -89,19 +89,6 @@"minHeight": 850,"resizable": true},- {- "title": "timeline",- "url": "/timeline",- "width": 1200,- "height": 1000,- "minWidth": 1000,- "minHeight": 600,- "visible": false,- "decorations": true,- "transparent": true,- "alwaysOnTop": true,- "label": "timeline"- },{"title": "meetings","url": "/meetings",