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: improve search pipe, added some AI feature to speed up querying
Louis Beaumont6e8da592beab
diff --git a/pipes/search/bun.lockb b/pipes/search/bun.lockbindex e85803833..f0e625d6b 100755Binary files a/pipes/search/bun.lockb and b/pipes/search/bun.lockb differdiff --git a/pipes/search/package.json b/pipes/search/package.jsonindex 3e2b3d690..7d73982cc 100644--- a/pipes/search/package.json+++ b/pipes/search/package.json@@ -1,6 +1,6 @@{"name": "search",- "version": "0.1.6",+ "version": "0.1.7","private": true,"scripts": {"dev": "next dev --turbopack",@@ -11,7 +11,7 @@"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-dialog": "^1.1.6","@radix-ui/react-label": "^2.1.1","@radix-ui/react-popover": "^1.1.3","@radix-ui/react-progress": "^1.1.1",@@ -32,7 +32,7 @@"ai": "^4.0.18","class-variance-authority": "^0.7.1","clsx": "^2.1.1",- "cmdk": "1.0.0",+ "cmdk": "1.0.4","date-fns": "^4.1.0","framer-motion": "^11.14.4","install": "^0.13.0",diff --git a/pipes/search/src/app/globals.css b/pipes/search/src/app/globals.cssindex ff005b73a..459287407 100644--- a/pipes/search/src/app/globals.css+++ b/pipes/search/src/app/globals.css@@ -70,3 +70,14 @@ body {@apply bg-background text-foreground !pointer-events-auto;}}++[role="dialog"] {+ max-width: 696px !important;+ max-height: 60vh !important;+ width: 70vw !important;+ height: 65vh !important;+ margin: 0 auto;+ left: 50% !important;+ transform: translate(-50%, -50%) !important;+}+diff --git a/pipes/search/src/components/search-chat.tsx b/pipes/search/src/components/search-chat.tsxindex ae5d6dca2..c141a47ae 100644--- a/pipes/search/src/components/search-chat.tsx+++ b/pipes/search/src/components/search-chat.tsx@@ -39,6 +39,7 @@ import {SpeechIcon,ChevronsUpDown,Bot,+ Settings,} from "lucide-react";import { useToast } from "@/lib/use-toast";import { AnimatePresence, motion } from "framer-motion";@@ -100,6 +101,7 @@ import {PopoverTrigger,} from "@/components/ui/popover";import { useSettings } from "@/lib/hooks/use-settings";+import { SearchFilterGenerator } from "./search-filter-generator";interface Agent {id: string;@@ -317,19 +319,51 @@ export function SearchChat() {}, [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);+ // More reliable OS detection using navigator.userAgentData when available+ if ("userAgentData" in navigator) {+ // @ts-ignore - TypeScript doesn't know about userAgentData yet+ const platform = navigator.userAgent.toLowerCase();+ setCurrentPlatform(+ platform.includes("mac")+ ? "macos"+ : platform.includes("win")+ ? "windows"+ : platform.includes("linux")+ ? "linux"+ : "unknown"+ );+ } else {+ // Fallback to platform for older browsers+ const platform = window.navigator.platform.toLowerCase();+ setCurrentPlatform(+ platform.includes("mac")+ ? "macos"+ : platform.includes("win")+ ? "windows"+ : platform.includes("linux")+ ? "linux"+ : "unknown"+ );+ }}, []);+ // Add keyboard shortcut handler+ useEffect(() => {+ const handleKeyDown = (e: KeyboardEvent) => {+ if (+ e.key === "Enter" &&+ ((currentPlatform === "macos" && e.metaKey) ||+ (currentPlatform !== "macos" && e.ctrlKey))+ ) {+ e.preventDefault();+ handleSearch(0);+ }+ };++ window.addEventListener("keydown", handleKeyDown);+ return () => window.removeEventListener("keydown", handleKeyDown);+ }, [currentPlatform]);+const handleSpeakerChange = (speaker: Speaker) => {setSelectedSpeakers((prev) => {const newSpeakers = { ...prev, [speaker.id]: speaker };@@ -399,6 +433,18 @@ export function SearchChat() {}};+ const handleContentTypeFromFilter = (contentType: string) => {+ // Update content type+ setContentType(contentType);++ // Update checkbox states based on content type+ setSelectedTypes({+ ocr: contentType.includes("ocr") || contentType === "all",+ audio: contentType.includes("audio") || contentType === "all",+ ui: contentType.includes("ui") || contentType === "all",+ });+ };+const [selectedAgent, setSelectedAgent] = useState<Agent>(AGENTS[0]);useEffect(() => {@@ -1139,7 +1185,6 @@ export function SearchChat() {// 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">@@ -1153,105 +1198,104 @@ export function SearchChat() {<Plus className="h-4 w-4" /></Button></div>++ <div className="flex items-center justify-center mb-16">+ {/* Add the new SearchFilterGenerator component */}+ <SearchFilterGenerator+ onApplyFilters={(filters) => {+ // Update all the relevant state variables+ if (filters.query !== undefined) setQuery(filters.query);+ if (filters.contentType !== undefined)+ handleContentTypeFromFilter(filters.contentType);+ if (filters.appName !== undefined) setAppName(filters.appName);+ if (filters.windowName !== undefined)+ setWindowName(filters.windowName);+ if (filters.startDate !== undefined)+ setStartDate(filters.startDate);+ if (filters.endDate !== undefined) setEndDate(filters.endDate);+ if (filters.limit !== undefined) setLimit(filters.limit);++ // Automatically perform search with new filters+ handleSearch(0);+ }}+ />+ </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 justify-center mb-4">+ <div className="flex items-center justify-between gap-2">+ <div className="flex items-center space-x-4"><div className="flex items-center space-x-1"><Checkbox- id="ui-type"- checked={selectedTypes.ui}- onCheckedChange={() => handleContentTypeChange("ui")}+ id="audio-type"+ checked={selectedTypes.audio}+ onCheckedChange={() => handleContentTypeChange("audio")}className="h-4 w-4"/>- <Label htmlFor="ui-type" className="text-xs">- screen UI- </Label>++ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <Label htmlFor="audio-type" className="text-xs">+ speech+ </Label>+ </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"+ />++ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <Label htmlFor="ui-type" className="text-xs">+ screen UI+ </Label>+ </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"+ />+<TooltipProvider><Tooltip><TooltipTrigger asChild>- <HelpCircle className="h-3 w-3 text-muted-foreground ml-0.5" />+ <Label htmlFor="ocr-type" className="text-xs">+ screen capture+ </Label></TooltipTrigger><TooltipContent><p>- text emitted directly from the source code of the desktop- applications+ recognized text from screenshots taken every 5s by default</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 */}@@ -1288,7 +1332,7 @@ export function SearchChat() {variant="outline"onClick={() => setIsQueryParamsDialogOpen(true)}>- advanced+ <Settings className="h-4 w-4" /></Button><TooltipProvider>@@ -1313,7 +1357,7 @@ export function SearchChat() {) : (<><Search className="mr-2 h-4 w-4" />- search+ {currentPlatform === "macos" ? "⌘" : "ctrl"} + ↵</>)}</Button>@@ -1352,11 +1396,10 @@ export function SearchChat() {<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" />+ <Label htmlFor="start-date">start date</Label></TooltipTrigger><TooltipContent><p>select the start date to search for content</p>@@ -1373,11 +1416,10 @@ export function SearchChat() {<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" />+ <Label htmlFor="end-date">end date</Label></TooltipTrigger><TooltipContent><p>select the end date to search for content</p>@@ -1448,7 +1490,37 @@ export function SearchChat() {</DialogDescription></DialogHeader><div className="grid gap-4 py-4">- {/* Keep other advanced search options */}+ {/* Add the curl command button at the top */}+ <div className="flex justify-end">+ <Dialog>+ <DialogTrigger asChild>+ <Button variant="outline" className="text-sm">+ <IconCode className="h-4 w-4 mx-2" />+ curl command+ </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>++ {/* Rest of the advanced settings content */}<div className="grid grid-cols-4 items-center gap-4"><Label htmlFor="app-name" className="text-right">app name@@ -1834,8 +1906,11 @@ export function SearchChat() {type="text"placeholder="ask a question about the results..."value={floatingInput}- disabled={- calculateSelectedContentLength() > MAX_CONTENT_LENGTH || isAiDisabled || !isAvailable+ disabled={+ calculateSelectedContentLength() >+ MAX_CONTENT_LENGTH ||+ isAiDisabled ||+ !isAvailable}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"diff --git a/pipes/search/src/components/search-filter-generator.tsx b/pipes/search/src/components/search-filter-generator.tsxnew file mode 100644index 000000000..d468ceed6--- /dev/null+++ b/pipes/search/src/components/search-filter-generator.tsx@@ -0,0 +1,440 @@+"use client";++import * as React from "react";+import { useState } from "react";+import { Bot, Wand2, Search } from "lucide-react";+import { Button } from "@/components/ui/button";+import { CommandDialog, CommandInput } from "@/components/ui/command";+import OpenAI from "openai";+import { useSettings } from "@/lib/hooks/use-settings";+import {+ Tooltip,+ TooltipContent,+ TooltipProvider,+ TooltipTrigger,+} from "@/components/ui/tooltip";+import { toast } from "@/lib/use-toast";+import { SheetTitle } from "./ui/sheet";+import { motion } from "framer-motion";+import { z } from "zod";+import { zodResponseFormat } from "openai/helpers/zod";+import { Card, CardContent } from "@/components/ui/card";+import { Badge } from "@/components/ui/badge";++interface SearchFilters {+ query: string;+ contentType: string;+ appName: string;+ windowName: string;+ startDate: Date;+ endDate: Date;+ limit: number;+}++interface SearchFilterGeneratorProps {+ onApplyFilters: (filters: Partial<SearchFilters>) => void;+}++interface SearchFilterVariant {+ filters: Partial<SearchFilters>;+ description: string;+ title: string;+}++const SearchFilterSchema = z.object({+ title: z.string(),+ query: z.string().optional(),+ contentType: z+ .enum(["all", "ocr", "audio", "ui", "audio+ui", "ocr+ui", "audio+ocr"])+ .optional(),+ appName: z.string().optional(),+ windowName: z.string().optional(),+ startDate: z.string().optional(), // ISO date string+ endDate: z.string().optional(), // ISO date string+ limit: z.number().optional(),+});++export function SearchFilterGenerator({+ onApplyFilters,+}: SearchFilterGeneratorProps) {+ const [open, setOpen] = useState(false);+ const [prompt, setPrompt] = useState("");+ const [isLoading, setIsLoading] = useState(false);+ const [isMac, setIsMac] = useState(false);+ const [filterVariants, setFilterVariants] = useState<SearchFilterVariant[]>(+ []+ );+ const { settings } = useSettings();++ React.useEffect(() => {+ setIsMac(navigator.userAgent.includes("Mac"));+ }, []);++ React.useEffect(() => {+ const down = (e: KeyboardEvent) => {+ if (e.key === "k" && (e.metaKey || e.ctrlKey)) {+ e.preventDefault();+ setOpen((open) => !open);+ }+ };+ document.addEventListener("keydown", down);+ return () => document.removeEventListener("keydown", down);+ }, []);++ const handleGenerateFilters = async () => {+ if (!prompt.trim()) return;+ setIsLoading(true);+ setFilterVariants([]);++ try {+ const openai = new OpenAI({+ apiKey:+ settings.aiProviderType === "screenpipe-cloud"+ ? settings.user.token+ : settings.openaiApiKey,+ baseURL: settings.aiUrl,+ dangerouslyAllowBrowser: true,+ });++ const currentDate = new Date().toISOString();++ const completion = await openai.beta.chat.completions.parse({+ model: settings.aiModel,+ messages: [+ {+ role: "system",+ content: `You are a search filter generator for Screenpipe's 24/7 recording context database. Generate 3 different search filter interpretations based on the user's natural language query. The current date and time is ${currentDate}. Use this as reference when interpreting relative time expressions like "today", "last week", etc.++Key Database Tables & Content Types:++1. Screen Recording (OCR):+- Captures all visible text from screens via OCR+- Includes app_name, window_name, timestamp+- Full text search via ocr_text_fts table+- Best for finding: code snippets, documentation, browser content, chat messages, emails++2. Audio Recording:+- Transcribed speech from microphone input+- Includes speaker identification, device info+- Full text search via audio_transcriptions_fts+- Best for finding: meetings, calls, voice notes, spoken commands+- Can filter by specific speakers or devices++3. UI Monitoring:+- App and window state/focus tracking+- Includes app_name, window_name, timestamps+- Full text search via ui_monitoring_fts+- Best for: productivity analysis, app usage patterns, window switching behavior++Common Query Types & Examples:++1. Meeting & Communication:+{+ query: "meet",+ contentType: "audio",+ startDate: "2024-03-20T09:00:00Z",+ endDate: "2024-03-20T12:00:00Z",+ limit: 120+}++2. Email & Messages:+{+ query: "john",+ contentType: "ocr",+ windowName: "Gmail",+ startDate: "2024-03-13T00:00:00Z",+ endDate: "2024-03-20T23:59:59Z",+ limit: 25+}++3. Code & Development:+{+ query: "transformers",+ contentType: "ocr",+ windowName: "Visual Studio Code",+ limit: 50+}++4. Productivity Analysis:+{+ query: "",+ contentType: "ui",+ windowName: "Twitter", // Single window name, not pipe-separated+ startDate: "2024-03-19T00:00:00Z",+ endDate: "2024-03-19T23:59:59Z",+ limit: 100+}++5. Research & Documentation:+{+ query: "papers",+ contentType: "ocr+audio",+ windowName: "arXiv.org", // Exact window name+ limit: 30+}++Search Filter Parameters:+- query: Text to search for across content types+- contentType: "all" | "ocr" | "audio" | "ui" | "audio+ui" | "ocr+ui" | "audio+ocr"+- startDate & endDate: ISO timestamp for time range+- appName: Exact application name (e.g., "Chrome", "Code")+- windowName: Exact window title (e.g., "Gmail", "arXiv.org", or browser tab name)+- limit: Max number of results (default 100)+- speakerIds: Filter audio by specific speakers++Generation Strategy:+1. Analyze the user's query for:+ - Keywords (e.g., "meeting", "code", "email", do not use spaces or multiple words). Have a bias for no keywords to prevent filtering out all content.+ - Time context (today, last week, specific date)+ - Content type hints (meeting → audio, code → ocr)+ - App/window context (exact names, no wildcards, do not use spaces, keep empty if wants to select all)+ - Length requirements (short snippets vs full content)++2. Generate 3 variations:+ - Broad: Wider time range, multiple content types+ - Focused: Specific content type, exact window/app name+ - Balanced: Medium scope with optimal filters++Return exactly 3 JSON objects in an array with no additional text.`,+ },+ {+ role: "user",+ content: prompt,+ },+ ],+ response_format: zodResponseFormat(+ z.array(SearchFilterSchema).length(3),+ "search_filters"+ ),+ });++ const variants = completion.choices[0].message.parsed;+ if (variants) {+ const now = new Date();+ const yesterday = new Date(now.getTime() - 24 * 60 * 60 * 1000);++ setFilterVariants(+ variants.map((filters, i) => ({+ filters: {+ ...filters,+ startDate: filters.startDate+ ? new Date(filters.startDate).toString() === "Invalid Date"+ ? yesterday+ : new Date(filters.startDate)+ : undefined,+ endDate: filters.endDate+ ? new Date(filters.endDate).toString() === "Invalid Date"+ ? now+ : new Date(filters.endDate)+ : undefined,+ },+ description: `variant ${i + 1}`,+ title: filters.title || `variant ${i + 1}`,+ }))+ );+ }+ } catch (error: any) {+ console.error("error generating filters:", error);+ toast({+ title: "error",+ description: "failed to generate search filters",+ variant: "destructive",+ });+ } finally {+ setIsLoading(false);+ }+ };++ return (+ <>+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <Button+ variant="outline"+ size="icon"+ className="h-8 w-8 relative group"+ onClick={() => setOpen(true)}+ disabled={isLoading}+ >+ <Wand2 className={`h-4 w-4 ${isLoading ? "opacity-0" : ""}`} />+ {isLoading && (+ <motion.div+ className="absolute inset-0 flex items-center justify-center"+ initial={{ opacity: 0 }}+ animate={{ opacity: 1 }}+ exit={{ opacity: 0 }}+ >+ <motion.div+ className="h-4 w-4 border-2 border-primary border-t-transparent rounded-full"+ animate={{ rotate: 360 }}+ transition={{+ duration: 1,+ repeat: Infinity,+ ease: "linear",+ }}+ />+ </motion.div>+ )}+ <span className="sr-only">generate filters with ai</span>+ <kbd className="pointer-events-none absolute hidden h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-0 group-hover:opacity-100 right-full mr-2 sm:flex">+ <span className="text-xs">{isMac ? "⌘" : "ctrl"}</span>K+ </kbd>+ </Button>+ </TooltipTrigger>+ <TooltipContent>+ <p>generate filters with ai</p>+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>++ <CommandDialog open={open} onOpenChange={setOpen}>+ <SheetTitle></SheetTitle>+ <motion.div+ className="flex items-center justify-center gap-2 p-4"+ initial={{ opacity: 0, y: 10 }}+ animate={{ opacity: 1, y: 0 }}+ transition={{ duration: 0.2 }}+ >+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger>+ <Bot className="h-4 w-4 text-muted-foreground" />+ </TooltipTrigger>+ <TooltipContent side="left">+ <p className="text-xs">using {settings.aiModel}</p>+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>+ <CommandInput+ className="w-full max-w-xl"+ placeholder="describe what you want to search for..."+ value={prompt}+ onValueChange={setPrompt}+ disabled={isLoading}+ onKeyDown={(e) => {+ if (e.key === "Enter" && !isLoading) {+ e.preventDefault();+ handleGenerateFilters();+ }+ }}+ />+ </motion.div>++ {!isLoading && filterVariants.length === 0 && (+ <div className="flex flex-col items-center justify-center p-8 text-center space-y-4">+ <Search className="h-12 w-12 text-muted-foreground/50" />+ <div className="space-y-2">+ <h4 className="text-sm font-medium text-muted-foreground">+ try examples like:+ </h4>+ <div className="flex flex-wrap gap-2 justify-center">+ <Badge+ variant="secondary"+ className="cursor-pointer hover:bg-muted"+ onClick={() =>+ setPrompt("find my zoom meetings from last week")+ }+ >+ zoom meetings from last week+ </Badge>+ <Badge+ variant="secondary"+ className="cursor-pointer hover:bg-muted"+ onClick={() => setPrompt("what did i discuss with john recently?")}+ >+ what did i discuss with john recently?+ </Badge>+ <Badge+ variant="secondary"+ className="cursor-pointer hover:bg-muted"+ onClick={() => setPrompt("stuff i did on twitter this week")}+ >+ stuff i did on twitter this week+ </Badge>+ </div>+ </div>+ </div>+ )}++ {isLoading && (+ <div className="grid grid-cols-1 md:grid-cols-3 gap-4 p-4 max-h-[60vh] overflow-y-auto">+ {[1, 2, 3].map((i) => (+ <Card+ key={i}+ className="relative bg-background border h-32 animate-pulse"+ >+ <CardContent className="p-3 flex flex-col h-full space-y-3">+ <div className="flex items-center">+ <div className="h-4 w-4 rounded bg-muted mr-2" />+ <div className="h-4 w-24 bg-muted rounded" />+ </div>+ <div className="flex flex-wrap gap-2">+ {[1, 2, 3].map((j) => (+ <div key={j} className="h-5 w-20 bg-muted rounded-full" />+ ))}+ </div>+ </CardContent>+ </Card>+ ))}+ </div>+ )}++ {filterVariants.length > 0 && (+ <div className="grid grid-cols-1 md:grid-cols-3 gap-4 p-4 max-h-[60vh] overflow-y-auto">+ {filterVariants.map((variant, index) => (+ <TooltipProvider key={index}>+ <Tooltip>+ <TooltipTrigger asChild>+ <div className="relative group h-full">+ <Card+ className="cursor-pointer relative bg-background border h-full transition-all duration-300 ease-out hover:scale-[0.98] hover:border-primary"+ onClick={() => {+ onApplyFilters(variant.filters);+ setOpen(false);+ }}+ >+ <CardContent className="p-3 flex flex-col h-full">+ <div className="flex items-center mb-1">+ <h3 className="text-sm font-semibold">+ {variant.title}+ </h3>+ </div>+ <div className="flex flex-wrap gap-2 mt-2">+ {variant.filters.query && (+ <Badge>query: {variant.filters.query}</Badge>+ )}+ {variant.filters.contentType && (+ <Badge>{variant.filters.contentType}</Badge>+ )}+ {variant.filters.appName && (+ <Badge>app: {variant.filters.appName}</Badge>+ )}+ {variant.filters.windowName && (+ <Badge>+ window: {variant.filters.windowName}+ </Badge>+ )}+ {variant.filters.startDate && (+ <Badge>+ from:{" "}+ {variant.filters.startDate.toLocaleDateString()}+ </Badge>+ )}+ {variant.filters.limit && (+ <Badge>limit: {variant.filters.limit}</Badge>+ )}+ </div>+ </CardContent>+ </Card>+ </div>+ </TooltipTrigger>+ </Tooltip>+ </TooltipProvider>+ ))}+ </div>+ )}+ </CommandDialog>+ </>+ );+}diff --git a/pipes/search/src/components/ui/sheet.tsx b/pipes/search/src/components/ui/sheet.tsxnew file mode 100644index 000000000..a37f17ba0--- /dev/null+++ b/pipes/search/src/components/ui/sheet.tsx@@ -0,0 +1,140 @@+"use client"++import * as React from "react"+import * as SheetPrimitive from "@radix-ui/react-dialog"+import { cva, type VariantProps } from "class-variance-authority"+import { X } from "lucide-react"++import { cn } from "@/lib/utils"++const Sheet = SheetPrimitive.Root++const SheetTrigger = SheetPrimitive.Trigger++const SheetClose = SheetPrimitive.Close++const SheetPortal = SheetPrimitive.Portal++const SheetOverlay = React.forwardRef<+ React.ElementRef<typeof SheetPrimitive.Overlay>,+ React.ComponentPropsWithoutRef<typeof SheetPrimitive.Overlay>+>(({ className, ...props }, ref) => (+ <SheetPrimitive.Overlay+ 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}+ ref={ref}+ />+))+SheetOverlay.displayName = SheetPrimitive.Overlay.displayName++const sheetVariants = cva(+ "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",+ {+ variants: {+ side: {+ top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",+ bottom:+ "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",+ left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",+ right:+ "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",+ },+ },+ defaultVariants: {+ side: "right",+ },+ }+)++interface SheetContentProps+ extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,+ VariantProps<typeof sheetVariants> {}++const SheetContent = React.forwardRef<+ React.ElementRef<typeof SheetPrimitive.Content>,+ SheetContentProps+>(({ side = "right", className, children, ...props }, ref) => (+ <SheetPortal>+ <SheetOverlay />+ <SheetPrimitive.Content+ ref={ref}+ className={cn(sheetVariants({ side }), className)}+ {...props}+ >+ {children}+ <SheetPrimitive.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-secondary">+ <X className="h-4 w-4" />+ <span className="sr-only">Close</span>+ </SheetPrimitive.Close>+ </SheetPrimitive.Content>+ </SheetPortal>+))+SheetContent.displayName = SheetPrimitive.Content.displayName++const SheetHeader = ({+ className,+ ...props+}: React.HTMLAttributes<HTMLDivElement>) => (+ <div+ className={cn(+ "flex flex-col space-y-2 text-center sm:text-left",+ className+ )}+ {...props}+ />+)+SheetHeader.displayName = "SheetHeader"++const SheetFooter = ({+ className,+ ...props+}: React.HTMLAttributes<HTMLDivElement>) => (+ <div+ className={cn(+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",+ className+ )}+ {...props}+ />+)+SheetFooter.displayName = "SheetFooter"++const SheetTitle = React.forwardRef<+ React.ElementRef<typeof SheetPrimitive.Title>,+ React.ComponentPropsWithoutRef<typeof SheetPrimitive.Title>+>(({ className, ...props }, ref) => (+ <SheetPrimitive.Title+ ref={ref}+ className={cn("text-lg font-semibold text-foreground", className)}+ {...props}+ />+))+SheetTitle.displayName = SheetPrimitive.Title.displayName++const SheetDescription = React.forwardRef<+ React.ElementRef<typeof SheetPrimitive.Description>,+ React.ComponentPropsWithoutRef<typeof SheetPrimitive.Description>+>(({ className, ...props }, ref) => (+ <SheetPrimitive.Description+ ref={ref}+ className={cn("text-sm text-muted-foreground", className)}+ {...props}+ />+))+SheetDescription.displayName = SheetPrimitive.Description.displayName++export {+ Sheet,+ SheetPortal,+ SheetOverlay,+ SheetTrigger,+ SheetClose,+ SheetContent,+ SheetHeader,+ SheetFooter,+ SheetTitle,+ SheetDescription,+}