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
feat: add PII removal/redaction for frames (blur credit cards, SSNs, emails)
Louis Beaumontb074abf53b2c
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex f52b3da71..1c6388577 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -114,6 +114,12 @@ jobs:- name: Run specific Windows OCR cargo testrun: cargo test test_process_ocr_task_windows+ - name: Run PII removal tests+ run: cargo test -p screenpipe-core pii_removal++ - name: Run PII redaction tests+ run: cargo test -p screenpipe-server --lib pii_redaction_tests+- name: Run pipes_testrun: cargo test --package pipes_test@@ -159,3 +165,9 @@ jobs:env:DYLD_LIBRARY_PATH: /Users/runner/work/screenpipe/screenpipe/screenpipe-vision/librun: cargo test test_apple_native_ocr++ - name: Run PII removal tests+ run: cargo test -p screenpipe-core pii_removal++ - name: Run PII redaction tests+ run: cargo test -p screenpipe-server --lib pii_redaction_testsdiff --git a/.playwright-mcp/page-2026-01-22T21-28-52-678Z.png b/.playwright-mcp/page-2026-01-22T21-28-52-678Z.pngnew file mode 100644index 000000000..37044736dBinary files /dev/null and b/.playwright-mcp/page-2026-01-22T21-28-52-678Z.png differdiff --git a/.playwright-mcp/page-2026-01-22T21-29-19-644Z.png b/.playwright-mcp/page-2026-01-22T21-29-19-644Z.pngnew file mode 100644index 000000000..75429e4e3Binary files /dev/null and b/.playwright-mcp/page-2026-01-22T21-29-19-644Z.png differdiff --git a/Cargo.lock b/Cargo.lockindex 38f55d06a..6d7a09799 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -2,6 +2,22 @@# It is not intended for manual editing.version = 4+[[package]]+name = "ab_glyph"+version = "0.2.32"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "01c0457472c38ea5bd1c3b5ada5e368271cb550be7a4ca4a0b4634e9913f6cc2"+dependencies = [+ "ab_glyph_rasterizer",+ "owned_ttf_parser",+]++[[package]]+name = "ab_glyph_rasterizer"+version = "0.1.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618"+[[package]]name = "accessibility"version = "0.2.0"@@ -190,6 +206,15 @@ version = "1.0.97"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f"+[[package]]+name = "approx"+version = "0.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6"+dependencies = [+ "num-traits",+]+[[package]]name = "arbitrary"version = "1.4.1"@@ -934,7 +959,7 @@ dependencies = ["num-traits","num_cpus","rand 0.9.0",- "rand_distr",+ "rand_distr 0.5.1","rayon","safetensors","thiserror 1.0.69",@@ -1287,7 +1312,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"dependencies = ["lazy_static",- "windows-sys 0.48.0",+ "windows-sys 0.59.0",][[package]]@@ -1719,15 +1744,6 @@ dependencies = ["parking_lot_core",]-[[package]]-name = "dasp_frame"-version = "0.11.0"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b2a3937f5fe2135702897535c8d4a5553f8b116f76c1529088797f2eee7c5cd6"-dependencies = [- "dasp_sample",-]-[[package]]name = "dasp_sample"version = "0.11.0"@@ -1956,18 +1972,6 @@ dependencies = ["bytemuck",]-[[package]]-name = "ebur128"-version = "0.1.10"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e227cc62d64d6fe01abbef48134b9c1f17d470cef1e7a56337ad05b1f81df7f9"-dependencies = [- "bitflags 1.3.2",- "dasp_frame",- "dasp_sample",- "smallvec",-]-[[package]]name = "either"version = "1.15.0"@@ -2705,8 +2709,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"dependencies = ["cfg-if",+ "js-sys","libc","wasi 0.11.0+wasi-snapshot-preview1",+ "wasm-bindgen",][[package]]@@ -2805,7 +2811,7 @@ dependencies = ["crunchy","num-traits","rand 0.9.0",- "rand_distr",+ "rand_distr 0.5.1",][[package]]@@ -3469,6 +3475,24 @@ dependencies = ["quick-error",]+[[package]]+name = "imageproc"+version = "0.25.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2393fb7808960751a52e8a154f67e7dd3f8a2ef9bd80d1553078a7b4e8ed3f0d"+dependencies = [+ "ab_glyph",+ "approx",+ "getrandom 0.2.15",+ "image 0.25.5",+ "itertools 0.12.1",+ "nalgebra",+ "num",+ "rand 0.8.5",+ "rand_distr 0.4.3",+ "rayon",+]+[[package]]name = "imgref"version = "1.11.0"@@ -3822,7 +3846,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"dependencies = ["cfg-if",- "windows-targets 0.48.5",+ "windows-targets 0.52.6",][[package]]@@ -4202,6 +4226,21 @@ dependencies = ["syn 2.0.100",]+[[package]]+name = "nalgebra"+version = "0.32.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7b5c17de023a86f59ed79891b2e5d5a94c705dbe904a5b5c9c952ea6221b03e4"+dependencies = [+ "approx",+ "matrixmultiply",+ "num-complex",+ "num-rational",+ "num-traits",+ "simba",+ "typenum",+]+[[package]]name = "native-tls"version = "0.2.14"@@ -5136,6 +5175,15 @@ version = "0.1.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"+[[package]]+name = "owned_ttf_parser"+version = "0.25.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "36820e9051aca1014ddc75770aab4d68bc1e9e632f0f5627c4086bc216fb583b"+dependencies = [+ "ttf-parser",+]+[[package]]name = "parking"version = "2.2.1"@@ -5661,6 +5709,16 @@ dependencies = ["getrandom 0.3.2",]+[[package]]+name = "rand_distr"+version = "0.4.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "32cb0b9bc82b0a0876c2dd994a7e7a2683d3e7390ca40e6886785ef0c7e3ee31"+dependencies = [+ "num-traits",+ "rand 0.8.5",+]+[[package]]name = "rand_distr"version = "0.5.1"@@ -6211,6 +6269,15 @@ version = "1.0.20"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"+[[package]]+name = "safe_arch"+version = "0.7.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "96b02de82ddbe1b636e6170c21be622223aea188ef2e139be0a5b219ec215323"+dependencies = [+ "bytemuck",+]+[[package]]name = "safetensors"version = "0.4.5"@@ -6439,6 +6506,7 @@ dependencies = ["futures","hf-hub","image 0.25.5",+ "imageproc","killport","lru","ndarray 0.15.6",@@ -6919,6 +6987,19 @@ dependencies = ["rand_core 0.6.4",]+[[package]]+name = "simba"+version = "0.8.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "061507c94fc6ab4ba1c9a0305018408e312e17c041eb63bef8aa726fa33aceae"+dependencies = [+ "approx",+ "num-complex",+ "num-traits",+ "paste",+ "wide",+]+[[package]]name = "simd-adler32"version = "0.3.7"@@ -8207,6 +8288,12 @@ version = "0.2.5"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"+[[package]]+name = "ttf-parser"+version = "0.25.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"+[[package]]name = "tungstenite"version = "0.19.0"@@ -8518,16 +8605,13 @@ dependencies = [[[package]]name = "vad-rs"-version = "0.1.4"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "9ab0d73aca95799526e386248ea8d1049d166a635ef4d56e029071cd2beff865"+version = "0.2.0"dependencies = [- "ebur128","eyre","ndarray 0.16.1","ort",+ "ort-sys","ringbuffer",- "samplerate",][[package]]@@ -8864,6 +8948,16 @@ dependencies = ["wasite",]+[[package]]+name = "wide"+version = "0.7.33"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0ce5da8ecb62bcd8ec8b7ea19f69a51275e91299be594ea5cc6ef7819e16cd03"+dependencies = [+ "bytemuck",+ "safe_arch",+]+[[package]]name = "widestring"version = "1.2.0"@@ -8892,7 +8986,7 @@ version = "0.1.9"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"dependencies = [- "windows-sys 0.48.0",+ "windows-sys 0.59.0",][[package]]diff --git a/screenpipe-app-tauri/app/layout.tsx b/screenpipe-app-tauri/app/layout.tsxindex d1a8980f3..381df5152 100644--- a/screenpipe-app-tauri/app/layout.tsx+++ b/screenpipe-app-tauri/app/layout.tsx@@ -5,6 +5,7 @@ import { Providers } from "./providers";import { Toaster } from "@/components/ui/toaster";import { useEffect } from "react";import { DeeplinkHandler } from "@/components/deeplink-handler";+import { ShortcutTracker } from "@/components/shortcut-reminder";const inter = Inter({ subsets: ["latin"] });@@ -85,6 +86,7 @@ export default function RootLayout({<Providers><body className={`${inter.className} scrollbar-hide`}><DeeplinkHandler />+ <ShortcutTracker />{children}<Toaster /></body>diff --git a/screenpipe-app-tauri/app/shortcut-reminder/page.tsx b/screenpipe-app-tauri/app/shortcut-reminder/page.tsxnew file mode 100644index 000000000..12e089167--- /dev/null+++ b/screenpipe-app-tauri/app/shortcut-reminder/page.tsx@@ -0,0 +1,74 @@+"use client";++import { useEffect, useState } from "react";+import { listen } from "@tauri-apps/api/event";+import { getCurrentWindow } from "@tauri-apps/api/window";+import posthog from "posthog-js";++export default function ShortcutReminderPage() {+ const [shortcut, setShortcut] = useState("⌘ ⌃ S");+ const [visible, setVisible] = useState(true);++ useEffect(() => {+ // Listen for shortcut info from main process+ const unlistenShortcut = listen<string>("shortcut-reminder-update", (event) => {+ setShortcut(formatShortcut(event.payload));+ });++ // Listen for hide event+ const unlistenHide = listen("shortcut-reminder-hide", () => {+ setVisible(false);+ setTimeout(async () => {+ const window = getCurrentWindow();+ await window.hide();+ }, 300);+ });++ // Track that reminder was shown+ posthog.capture("shortcut_reminder_shown", { type: "native_window" });++ return () => {+ unlistenShortcut.then((fn) => fn());+ unlistenHide.then((fn) => fn());+ };+ }, []);++ const handleClick = async () => {+ posthog.capture("shortcut_reminder_dismissed", { type: "native_window" });+ setVisible(false);+ setTimeout(async () => {+ const window = getCurrentWindow();+ await window.hide();+ }, 300);+ };++ return (+ <div+ className={`w-full h-full flex items-center justify-center transition-opacity duration-300 ${+ visible ? "opacity-100" : "opacity-0"+ }`}+ style={{ background: "transparent" }}+ >+ <div+ onClick={handleClick}+ className="bg-black/90 text-white px-5 py-3 rounded-full flex items-center gap-2 cursor-pointer hover:bg-black/80 transition-colors shadow-2xl backdrop-blur-sm border border-white/10"+ >+ <span className="text-sm text-white/70">Press</span>+ <span className="font-mono text-sm font-semibold text-pink-400">+ {shortcut}+ </span>+ <span className="text-sm text-white/70">to open screenpipe</span>+ </div>+ </div>+ );+}++function formatShortcut(shortcut: string): string {+ if (!shortcut) return "⌘ ⌃ S";+ return shortcut+ .replace(/Super|Command|Cmd/gi, "⌘")+ .replace(/Ctrl|Control/gi, "⌃")+ .replace(/Alt|Option/gi, "⌥")+ .replace(/Shift/gi, "⇧")+ .replace(/\+/g, " ");+}diff --git a/screenpipe-app-tauri/components/onboarding/status.tsx b/screenpipe-app-tauri/components/onboarding/status.tsxindex 31444653e..4123233ef 100644--- a/screenpipe-app-tauri/components/onboarding/status.tsx+++ b/screenpipe-app-tauri/components/onboarding/status.tsx@@ -1,13 +1,24 @@import React, { useState, useEffect, useRef } from "react";-import { Check, Monitor, Mic } from "lucide-react";+import { Check, Monitor, Mic, Command } from "lucide-react";import { Button } from "../ui/button";import { invoke } from "@tauri-apps/api/core";import posthog from "posthog-js";import { usePlatform } from "@/lib/hooks/use-platform";-import { commands, OSPermissionsCheck } from "@/lib/utils/tauri";+import { commands, type OSPermissionsCheck } from "@/lib/utils/tauri";import { motion } from "framer-motion";import { useSettings, DEFAULT_PROMPT } from "@/lib/hooks/use-settings";+// Format shortcut for display+function formatShortcut(shortcut: string): string {+ if (!shortcut) return "";+ return shortcut+ .replace(/Super|Command|Cmd/gi, "⌘")+ .replace(/Ctrl|Control/gi, "⌃")+ .replace(/Alt|Option/gi, "⌥")+ .replace(/Shift/gi, "⇧")+ .replace(/\+/g, " ");+}+interface OnboardingStatusProps {className?: string;handlePrevSlide: () => void;@@ -45,6 +56,10 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({const handleComplete = async () => {await ensureDefaultPreset();+ // Show native shortcut reminder window+ if (settings.showScreenpipeShortcut) {+ commands.showShortcutReminder(settings.showScreenpipeShortcut);+ }handleNextSlide();};@@ -227,6 +242,17 @@ const OnboardingStatus: React.FC<OnboardingStatusProps> = ({</p></div>+ {/* Shortcut reminder */}+ <div className="bg-muted/50 border border-border px-4 py-3 rounded-lg">+ <p className="font-mono text-xs text-center text-muted-foreground">+ press{" "}+ <span className="font-semibold text-foreground">+ {formatShortcut(settings.showScreenpipeShortcut)}+ </span>{" "}+ anytime to open screenpipe+ </p>+ </div>+<div className="flex items-center space-x-4 text-xs font-mono text-muted-foreground"><div className="flex items-center space-x-2"><Check className="w-4 h-4" strokeWidth={1.5} />diff --git a/screenpipe-app-tauri/components/rewind/export-button.tsx b/screenpipe-app-tauri/components/rewind/export-button.tsxindex 38cb6663f..8f75bf5dd 100644--- a/screenpipe-app-tauri/components/rewind/export-button.tsx+++ b/screenpipe-app-tauri/components/rewind/export-button.tsx@@ -5,6 +5,7 @@ import { useTimelineSelection } from "@/lib/hooks/use-timeline-selection";import { toast } from "./ui/use-toast";import { useSettings } from "@/lib/hooks/use-settings";import { parseInt } from "lodash";+import posthog from "posthog-js";export function ExportButton() {const [isExporting, setIsExporting] = useState(false);@@ -21,6 +22,13 @@ export function ExportButton() {});return;}++ // Track export started+ posthog.capture("timeline_export_started", {+ frames_count: selectionRange.frameIds.length,+ selection_duration_ms: selectionRange.end.getTime() - selectionRange.start.getTime(),+ });+setIsExporting(true);setProgress(0);try {@@ -108,6 +116,9 @@ export function ExportButton() {filePath,new Uint8Array(data.video_data),);+ posthog.capture("timeline_export_completed", {+ frames_count: selectionRange?.frameIds.length,+ });toast({title: "Video exported",description:@@ -131,6 +142,9 @@ export function ExportButton() {window.URL.revokeObjectURL(url);a.remove();+ posthog.capture("timeline_export_completed", {+ frames_count: selectionRange?.frameIds.length,+ });toast({title: "Video exported",description: "Your video has been exported successfully",diff --git a/screenpipe-app-tauri/components/rewind/timeline.tsx b/screenpipe-app-tauri/components/rewind/timeline.tsxindex 8fb617a11..1faecce90 100644--- a/screenpipe-app-tauri/components/rewind/timeline.tsx+++ b/screenpipe-app-tauri/components/rewind/timeline.tsx@@ -16,6 +16,7 @@ import { useTimelineStore } from "@/lib/hooks/use-timeline-store";import { hasFramesForDate } from "@/lib/actions/has-frames-date";import { CommandShortcut } from "@/components/ui/command";import { CurrentFrameTimeline } from "@/components/rewind/current-frame-timeline";+import posthog from "posthog-js";export interface StreamTimeSeriesResponse {timestamp: string;@@ -99,6 +100,11 @@ export default function Timeline() {}}, [frames.length, currentFrame, setCurrentFrame]);+ // Track timeline opened+ useEffect(() => {+ posthog.capture("timeline_opened");+ }, []);+useEffect(() => {const getStartDateAndSet = async () => {const data = await getStartDate();@@ -308,6 +314,12 @@ export default function Timeline() {return;}+ // Track date change+ posthog.capture("timeline_date_changed", {+ from_date: currentDate.toISOString(),+ to_date: newDate.toISOString(),+ });+setCurrentDate(newDate);} else {jumpToTime(newDate);diff --git a/screenpipe-app-tauri/components/rewind/timeline/ai-panel.tsx b/screenpipe-app-tauri/components/rewind/timeline/ai-panel.tsxindex 8d697ab92..362d31e17 100644--- a/screenpipe-app-tauri/components/rewind/timeline/ai-panel.tsx+++ b/screenpipe-app-tauri/components/rewind/timeline/ai-panel.tsx@@ -21,6 +21,7 @@ import { ExportButton } from "../export-button";import Image from "next/image";import { AIPresetsSelector } from "../ai-presets-selector";import { AIPreset } from "@/lib/utils/tauri";+import posthog from "posthog-js";const providerIcons = {openai: <Image src="/images/openai.png" alt="OpenAI" width={16} height={16} />,@@ -228,6 +229,16 @@ export function AIPanel({return;}+ // Track AI query+ posthog.capture("timeline_ai_query", {+ query_length: aiInput.length,+ agent_id: selectedAgent.id,+ agent_name: selectedAgent.name,+ provider: activePreset?.provider,+ model: activePreset?.model,+ selection_duration_ms: selectionRange.end.getTime() - selectionRange.start.getTime(),+ });+// Create new abort controller for this requestabortControllerRef.current = new AbortController();@@ -397,6 +408,7 @@ export function AIPanel({className="px-3 py-1 bg-background hover:bg-accent border text-foreground text-xs rounded flex items-center gap-2 transition-colors"onClick={(e) => {e.stopPropagation();+ posthog.capture("timeline_ai_panel_expanded");onExpandedChange(true);setTimeout(() => {inputRef.current?.focus();diff --git a/screenpipe-app-tauri/components/rewind/timeline/timeline-search.tsx b/screenpipe-app-tauri/components/rewind/timeline/timeline-search.tsxindex 8a40e132a..8a0d440c7 100644--- a/screenpipe-app-tauri/components/rewind/timeline/timeline-search.tsx+++ b/screenpipe-app-tauri/components/rewind/timeline/timeline-search.tsx@@ -21,6 +21,7 @@ import {TooltipProvider,TooltipTrigger,} from "@/components/ui/tooltip";+import posthog from "posthog-js";interface TimelineSearchProps {frames: StreamTimeSeriesResponse[];@@ -610,8 +611,14 @@ prioritize precision over recall - better to return no match than a wrong match.setIsSearching(true);setSearchStatus("");+ // Track search+ posthog.capture("timeline_search", {+ query_length: query.length,+ frames_count: frames.length,+ });+const defaultPreset = settings?.aiPresets?.find(p => p.defaultPreset) || settings?.aiPresets?.[0];-+const openai = new OpenAI({apiKey:(defaultPreset?.provider === "screenpipe-cloud"@@ -637,9 +644,15 @@ prioritize precision over recall - better to return no match than a wrong match.);if (frameIndex !== null) {+ posthog.capture("timeline_search_result_found", {+ query_length: query.length,+ });onResultSelect(frameIndex);setOpen(false);} else {+ posthog.capture("timeline_search_no_result", {+ query_length: query.length,+ });setSearchStatus("couldn't find that moment. try being more specific about the app or content you're looking for.",);diff --git a/screenpipe-app-tauri/components/shortcut-reminder.tsx b/screenpipe-app-tauri/components/shortcut-reminder.tsxnew file mode 100644index 000000000..62495df07--- /dev/null+++ b/screenpipe-app-tauri/components/shortcut-reminder.tsx@@ -0,0 +1,49 @@+"use client";++import { useEffect } from "react";+import { listen } from "@tauri-apps/api/event";+import posthog from "posthog-js";++// Track shortcut usage with PostHog - invisible component+export function ShortcutTracker() {+ useEffect(() => {+ const unsubscribers: (() => void)[] = [];++ const shortcuts = [+ { event: "shortcut-show", name: "show_screenpipe" },+ { event: "shortcut-start-recording", name: "start_recording" },+ { event: "shortcut-stop-recording", name: "stop_recording" },+ { event: "shortcut-start-audio", name: "start_audio" },+ { event: "shortcut-stop-audio", name: "stop_audio" },+ ];++ shortcuts.forEach(({ event, name }) => {+ listen(event, () => {+ posthog.capture("shortcut_used", {+ shortcut_name: name,+ });+ }).then((unlisten) => {+ unsubscribers.push(unlisten);+ });+ });++ return () => {+ unsubscribers.forEach((unlisten) => unlisten());+ };+ }, []);++ // This component is invisible - just for tracking+ return null;+}++// Format shortcut for display (e.g., "Super+Alt+S" -> "⌘ ⌥ S")+export function formatShortcut(shortcut: string): string {+ if (!shortcut) return "";++ return shortcut+ .replace(/Super|Command|Cmd/gi, "⌘")+ .replace(/Ctrl|Control/gi, "⌃")+ .replace(/Alt|Option/gi, "⌥")+ .replace(/Shift/gi, "⇧")+ .replace(/\+/g, " ");+}diff --git a/screenpipe-app-tauri/lib/hooks/use-settings.tsx b/screenpipe-app-tauri/lib/hooks/use-settings.tsxindex 1431622b8..e5b69eeba 100644--- a/screenpipe-app-tauri/lib/hooks/use-settings.tsx+++ b/screenpipe-app-tauri/lib/hooks/use-settings.tsx@@ -99,6 +99,7 @@ let DEFAULT_SETTINGS: Settings = {deepgramApiKey: "",isLoading: false,userId: "",+ analyticsId: "",devMode: false,audioTranscriptionEngine: "whisper-large-v3-turbo",ocrEngine: "default",@@ -284,18 +285,19 @@ export const SettingsProvider: React.FC<{ children: React.ReactNode }> = ({ chil};}, []);- // Track user changes for posthog+ // Identify with persistent analyticsId for consistent tracking across frontend/backenduseEffect(() => {- if (settings.user && settings.user.id) {- posthog.identify(settings.user.id, {- email: settings.user.email,- name: settings.user.name,- github_username: settings.user.github_username,- website: settings.user.website,- contact: settings.user.contact,+ if (settings.analyticsId) {+ posthog.identify(settings.analyticsId, {+ email: settings.user?.email,+ name: settings.user?.name,+ user_id: settings.user?.id,+ github_username: settings.user?.github_username,+ website: settings.user?.website,+ contact: settings.user?.contact,});}- }, [settings.user?.id]);+ }, [settings.analyticsId, settings.user?.id]);const updateSettings = async (updates: Partial<Settings>) => {await settingsStore.set(updates);diff --git a/screenpipe-app-tauri/lib/utils/tauri.ts b/screenpipe-app-tauri/lib/utils/tauri.tsindex 0536fe524..23c2e733e 100644--- a/screenpipe-app-tauri/lib/utils/tauri.ts+++ b/screenpipe-app-tauri/lib/utils/tauri.ts@@ -153,6 +153,22 @@ async openSearchWindow(query: string | null) : Promise<Result<null, string>> {else return { status: "error", error: e as any };}},+async showShortcutReminder(shortcut: string) : Promise<Result<null, string>> {+ try {+ return { status: "ok", data: await TAURI_INVOKE("show_shortcut_reminder", { shortcut }) };+} catch (e) {+ if(e instanceof Error) throw e;+ else return { status: "error", error: e as any };+}+},+async hideShortcutReminder() : Promise<Result<null, string>> {+ try {+ return { status: "ok", data: await TAURI_INVOKE("hide_shortcut_reminder") };+} catch (e) {+ if(e instanceof Error) throw e;+ else return { status: "error", error: e as any };+}+},async setTrayUnhealthIcon() : Promise<void> {await TAURI_INVOKE("set_tray_unhealth_icon");},@@ -171,7 +187,7 @@ async setTrayHealthIcon() : Promise<void> {/** user-defined types **/-export type AIPreset = { id: string; prompt: string; provider: AIProviderType; url: string; model: string; defaultPreset: boolean; apiKey: string | null; maxContextChars: number }+export type AIPreset = { id: string; prompt: string; provider: AIProviderType; url?: string; model?: string; defaultPreset: boolean; apiKey: string | null; maxContextChars: number }export type AIProviderType = "openai" | "native-ollama" | "custom" | "screenpipe-cloud"export type Credits = { amount: number }export type EmbeddedLLM = { enabled: boolean; model: string; port: number }@@ -181,7 +197,11 @@ export type OSPermission = "screenRecording" | "microphone"export type OSPermissionStatus = "notNeeded" | "empty" | "granted" | "denied"export type OSPermissionsCheck = { screenRecording: OSPermissionStatus; microphone: OSPermissionStatus }export type OnboardingStore = { isCompleted: boolean; completedAt: string | null }-export type SettingsStore = { aiPresets: AIPreset[]; deepgramApiKey: string; isLoading: boolean; userId: string; devMode: boolean; audioTranscriptionEngine: string; ocrEngine: string; monitorIds: string[]; audioDevices: string[]; usePiiRemoval: boolean; restartInterval: number; port: number; dataDir: string; disableAudio: boolean; ignoredWindows: string[]; includedWindows: string[]; fps: number; vadSensitivity: string; analyticsEnabled: boolean; audioChunkDuration: number; useChineseMirror: boolean; languages: string[]; embeddedLLM: EmbeddedLLM; enableBeta: boolean; isFirstTimeUser: boolean; autoStartEnabled: boolean; enableFrameCache: boolean; enableUiMonitoring: boolean; platform: string; disabledShortcuts: string[]; user: User; showScreenpipeShortcut: string; startRecordingShortcut: string; stopRecordingShortcut: string; startAudioShortcut: string; stopAudioShortcut: string; enableRealtimeAudioTranscription: boolean; realtimeAudioTranscriptionEngine: string; disableVision: boolean; useAllMonitors: boolean; enableRealtimeVision: boolean }+export type SettingsStore = { aiPresets: AIPreset[]; deepgramApiKey: string; isLoading: boolean; userId: string;+/**+ * Persistent analytics ID used for PostHog tracking (both frontend and backend)+ */+analyticsId: string; devMode: boolean; audioTranscriptionEngine: string; ocrEngine: string; monitorIds: string[]; audioDevices: string[]; usePiiRemoval: boolean; restartInterval: number; port: number; dataDir: string; disableAudio: boolean; ignoredWindows: string[]; includedWindows: string[]; fps: number; vadSensitivity: string; analyticsEnabled: boolean; audioChunkDuration: number; useChineseMirror: boolean; languages: string[]; embeddedLLM: EmbeddedLLM; enableBeta: boolean; isFirstTimeUser: boolean; autoStartEnabled: boolean; enableFrameCache: boolean; enableUiMonitoring: boolean; platform: string; disabledShortcuts: string[]; user: User; showScreenpipeShortcut: string; startRecordingShortcut: string; stopRecordingShortcut: string; startAudioShortcut: string; stopAudioShortcut: string; enableRealtimeAudioTranscription: boolean; realtimeAudioTranscriptionEngine: string; disableVision: boolean; useAllMonitors: boolean; enableRealtimeVision: boolean }export type ShowRewindWindow = "Main" | { Settings: { page: string | null } } | { Search: { query: string | null } } | "Onboarding"export type User = { id: string | null; name: string | null; email: string | null; image: string | null; token: string | null; clerk_id: string | null; api_key: string | null; credits: Credits | null; stripe_connected: boolean | null; stripe_account_status: string | null; github_username: string | null; bio: string | null; website: string | null; contact: string | null; cloud_subscribed: boolean | null }diff --git a/screenpipe-app-tauri/lib/utils/validation.ts b/screenpipe-app-tauri/lib/utils/validation.tsindex c9ca6b92c..af17d3971 100644--- a/screenpipe-app-tauri/lib/utils/validation.ts+++ b/screenpipe-app-tauri/lib/utils/validation.ts@@ -105,6 +105,7 @@ export const settingsStoreSchema = z.object({isLoading: z.boolean(),installedPipes: z.array(z.any()), // Define proper pipe schema if neededuserId: z.string(),+ analyticsId: z.string(),embeddedLLM: embeddedLLMSchema,user: userSchema,});diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lockindex 417a18599..ae7adce6f 100755--- a/screenpipe-app-tauri/src-tauri/Cargo.lock+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock@@ -5704,6 +5704,7 @@ dependencies = ["tracing","tracing-appender","tracing-subscriber",+ "uuid","windows 0.58.0","windows-icons","winreg 0.52.0",diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.tomlindex 6155d11bc..ba06f52a5 100644--- a/screenpipe-app-tauri/src-tauri/Cargo.toml+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml@@ -96,6 +96,7 @@ async-stream = "0.3"chrono = "0.4.39"tauri-plugin-opener = "2.5.0"+uuid = { version = "1.0", features = ["v4"] }[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]tauri-plugin-cli = "2.4.0"diff --git a/screenpipe-app-tauri/src-tauri/src/commands.rs b/screenpipe-app-tauri/src-tauri/src/commands.rsindex d7b9868bb..bd0942f77 100644--- a/screenpipe-app-tauri/src-tauri/src/commands.rs+++ b/screenpipe-app-tauri/src-tauri/src/commands.rs@@ -351,4 +351,78 @@ pub async fn open_search_window(app_handle: tauri::AppHandle, query: Option<StriShowRewindWindow::Main.close(&app_handle).map_err(|e| e.to_string())?;ShowRewindWindow::Search { query }.show(&app_handle).map_err(|e| e.to_string())?;Ok(())+}++#[tauri::command]+#[specta::specta]+pub async fn show_shortcut_reminder(+ app_handle: tauri::AppHandle,+ shortcut: String,+) -> Result<(), String> {+ use tauri::{Emitter, WebviewWindowBuilder};++ let label = "shortcut-reminder";++ // If window exists, just show it and update shortcut+ if let Some(window) = app_handle.get_webview_window(label) {+ let _ = app_handle.emit_to(label, "shortcut-reminder-update", &shortcut);+ let _ = window.show();+ return Ok(());+ }++ // Get primary monitor dimensions for positioning+ let monitor = app_handle+ .primary_monitor()+ .map_err(|e| e.to_string())?+ .ok_or("No primary monitor found")?;++ let screen_size = monitor.size();+ let scale_factor = monitor.scale_factor();++ // Window dimensions+ let window_width = 350.0;+ let window_height = 60.0;++ // Position at bottom center of screen+ let x = ((screen_size.width as f64 / scale_factor) - window_width) / 2.0;+ let y = (screen_size.height as f64 / scale_factor) - window_height - 100.0; // 100px from bottom++ let _window = WebviewWindowBuilder::new(+ &app_handle,+ label,+ tauri::WebviewUrl::App("shortcut-reminder".into()),+ )+ .title("Shortcut Reminder")+ .inner_size(window_width, window_height)+ .position(x, y)+ .decorations(false)+ .transparent(true)+ .always_on_top(true)+ .resizable(false)+ .skip_taskbar(true)+ .focused(false)+ .visible(true)+ .build()+ .map_err(|e| format!("Failed to create shortcut reminder window: {}", e))?;++ // Send the shortcut info to the window+ let _ = app_handle.emit_to(label, "shortcut-reminder-update", &shortcut);++ // Set up auto-hide after 10 seconds+ let app_handle_clone = app_handle.clone();+ tokio::spawn(async move {+ tokio::time::sleep(tokio::time::Duration::from_secs(10)).await;+ let _ = app_handle_clone.emit_to("shortcut-reminder", "shortcut-reminder-hide", ());+ });++ Ok(())+}++#[tauri::command]+#[specta::specta]+pub async fn hide_shortcut_reminder(app_handle: tauri::AppHandle) -> Result<(), String> {+ if let Some(window) = app_handle.get_webview_window("shortcut-reminder") {+ let _ = window.hide();+ }+ Ok(())}\ No newline at end of filediff --git a/screenpipe-app-tauri/src-tauri/src/main.rs b/screenpipe-app-tauri/src-tauri/src/main.rsindex 358b14ba4..508e59d64 100755--- a/screenpipe-app-tauri/src-tauri/src/main.rs+++ b/screenpipe-app-tauri/src-tauri/src/main.rs@@ -178,6 +178,7 @@ async fn apply_shortcuts(app: &AppHandle, config: &ShortcutConfig) -> Result<(),// Register show shortcutregister_shortcut(app, &config.show, config.is_disabled("show"), |app| {info!("show shortcut triggered");+ let _ = app.emit("shortcut-show", ());#[cfg(target_os = "macos")]{if let Ok(window) = app.get_webview_panel("main") {@@ -749,6 +750,9 @@ async fn main() {commands::reset_onboarding,commands::show_onboarding_window,commands::open_search_window,+ // Shortcut reminder commands+ commands::show_shortcut_reminder,+ commands::hide_shortcut_reminder,// Overlay commands (Windows)commands::enable_overlay_click_through,commands::disable_overlay_click_through,@@ -924,7 +928,8 @@ async fn main() {autostart_manager.is_enabled().unwrap());- let unique_id = store.user.id.unwrap_or_default();+ // Use persistent analytics_id for PostHog (consistent across frontend and backend)+ let unique_id = store.analytics_id.clone();let email = store.user.email.unwrap_or_default();if is_analytics_enabled {diff --git a/screenpipe-app-tauri/src-tauri/src/store.rs b/screenpipe-app-tauri/src-tauri/src/store.rsindex 9f5a82709..eb6b36182 100644--- a/screenpipe-app-tauri/src-tauri/src/store.rs+++ b/screenpipe-app-tauri/src-tauri/src/store.rs@@ -93,14 +93,18 @@ impl OnboardingStore {pub struct SettingsStore {#[serde(rename = "aiPresets")]pub ai_presets: Vec<AIPreset>,-+#[serde(rename = "deepgramApiKey")]pub deepgram_api_key: String,#[serde(rename = "isLoading")]pub is_loading: bool,-+#[serde(rename = "userId")]pub user_id: String,++ /// Persistent analytics ID used for PostHog tracking (both frontend and backend)+ #[serde(rename = "analyticsId")]+ pub analytics_id: String,#[serde(rename = "devMode")]pub dev_mode: bool,@@ -354,6 +358,7 @@ impl Default for SettingsStore {deepgram_api_key: "".to_string(),is_loading: false,user_id: "".to_string(),+ analytics_id: uuid::Uuid::new_v4().to_string(),dev_mode: false,audio_transcription_engine: "whisper-large-v3-turbo".to_string(),diff --git a/screenpipe-audio/build.rs b/screenpipe-audio/build.rsindex 08567264a..f8e8fadf1 100644--- a/screenpipe-audio/build.rs+++ b/screenpipe-audio/build.rs@@ -71,7 +71,9 @@ fn find_unzip() -> Option<std::path::PathBuf> {// check PATH firstwhich::which("unzip").ok(),// fallback to common GnuWin32 location- Some(std::path::PathBuf::from(r"C:\Program Files (x86)\GnuWin32\bin\unzip.exe")),+ Some(std::path::PathBuf::from(+ r"C:\Program Files (x86)\GnuWin32\bin\unzip.exe",+ )),];paths.into_iter().flatten().find(|p| p.exists())@@ -79,9 +81,9 @@ fn find_unzip() -> Option<std::path::PathBuf> {#[cfg(target_os = "windows")]fn install_onnxruntime() {- use std::time::Duration;use reqwest::blocking::Client;- use std::{process::Command, path::Path};+ use std::time::Duration;+ use std::{path::Path, process::Command};// Set static CRT for Windows MSVC targetif env::var("CARGO_CFG_TARGET_ENV").unwrap_or_default() == "msvc" {println!("cargo:rustc-env=KNF_STATIC_CRT=1");@@ -96,13 +98,15 @@ fn install_onnxruntime() {let resp = client.get(url).send().expect("request failed");let body = resp.bytes().expect("body invalid");fs::write("./onnxruntime-win-x64-gpu-1.19.2.zip", &body).expect("failed to write");- let unzip_path = find_unzip().expect("could not find unzip executable - please install it via GnuWin32 or add it to PATH");-+ let unzip_path = find_unzip().expect(+ "could not find unzip executable - please install it via GnuWin32 or add it to PATH",+ );+let status = Command::new(unzip_path).args(["-o", "onnxruntime-win-x64-gpu-1.19.2.zip"]).status().expect("failed to execute unzip");-+if !status.success() {panic!("failed to install onnx binary");}@@ -110,9 +114,6 @@ fn install_onnxruntime() {if target_dir.exists() {fs::remove_dir_all(target_dir).expect("failed to remove existing directory");}- fs::rename(- "onnxruntime-win-x64-gpu-1.19.2",- target_dir,- ).expect("failed to rename");+ fs::rename("onnxruntime-win-x64-gpu-1.19.2", target_dir).expect("failed to rename");println!("cargo:rustc-link-search=native=../screenpipe-app-tauri/src-tauri/onnxruntime-win-x64-gpu-1.19.2/lib");}diff --git a/screenpipe-core/src/pii_removal.rs b/screenpipe-core/src/pii_removal.rsindex 251a7bc60..aac291ba3 100644--- a/screenpipe-core/src/pii_removal.rs+++ b/screenpipe-core/src/pii_removal.rs@@ -1,23 +1,148 @@use lazy_static::lazy_static;use regex::Regex;+use serde::{Deserialize, Serialize};+use std::collections::HashMap;lazy_static! {static ref PII_PATTERNS: Vec<(Regex, &'static str)> = vec![- (Regex::new(r"\b(?:\d{4}[-\s]?){3}\d{4}\b").unwrap(), "[CREDIT_CARD]"),- (Regex::new(r"\b\d{3}-\d{2}-\d{4}\b").unwrap(), "[SSN]"),- (Regex::new(r"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b").unwrap(), "[EMAIL]"),+ (Regex::new(r"\b(?:\d{4}[-\s]?){3}\d{4}\b").unwrap(), "CREDIT_CARD"),+ (Regex::new(r"\b\d{3}-\d{2}-\d{4}\b").unwrap(), "SSN"),+ (Regex::new(r"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b").unwrap(), "EMAIL"),// add more patterns as needed];}+/// Represents a region in an image that contains PII and should be redacted+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]+pub struct PiiRegion {+ /// X coordinate (pixels from left)+ pub x: u32,+ /// Y coordinate (pixels from top)+ pub y: u32,+ /// Width of the region in pixels+ pub width: u32,+ /// Height of the region in pixels+ pub height: u32,+ /// Type of PII detected (e.g., "CREDIT_CARD", "SSN", "EMAIL")+ pub pii_type: String,+}+pub fn remove_pii(text: &str) -> String {let mut sanitized = text.to_string();for (pattern, replacement) in PII_PATTERNS.iter() {- sanitized = pattern.replace_all(&sanitized, *replacement).to_string();+ let replacement_bracketed = format!("[{}]", replacement);+ sanitized = pattern.replace_all(&sanitized, replacement_bracketed.as_str()).to_string();}sanitized}+/// Check if a given text contains PII+pub fn contains_pii(text: &str) -> bool {+ for (pattern, _) in PII_PATTERNS.iter() {+ if pattern.is_match(text) {+ return true;+ }+ }+ false+}++/// Get the PII type for a given text, if any+pub fn get_pii_type(text: &str) -> Option<String> {+ for (pattern, pii_type) in PII_PATTERNS.iter() {+ if pattern.is_match(text) {+ return Some(pii_type.to_string());+ }+ }+ None+}++/// Detect PII regions from OCR text_json output with bounding boxes.+///+/// The text_json is expected to contain entries with:+/// - "text": the recognized text+/// - "left", "top", "width", "height": bounding box (can be normalized 0-1 or pixels)+///+/// If coordinates are normalized (0-1 range), they will be converted to pixels+/// using the provided image dimensions.+///+/// # Arguments+/// * `text_json` - Vector of HashMaps containing OCR results with bounding boxes+/// * `image_width` - Width of the image in pixels+/// * `image_height` - Height of the image in pixels+///+/// # Returns+/// Vector of PiiRegion structs representing areas to redact+pub fn detect_pii_regions(+ text_json: &[HashMap<String, String>],+ image_width: u32,+ image_height: u32,+) -> Vec<PiiRegion> {+ let mut regions = Vec::new();++ for entry in text_json {+ let text = match entry.get("text") {+ Some(t) => t,+ None => continue,+ };++ // Check if this text contains PII+ let pii_type = match get_pii_type(text) {+ Some(t) => t,+ None => continue,+ };++ // Parse bounding box coordinates+ let left = match entry.get("left").and_then(|v| v.parse::<f64>().ok()) {+ Some(v) => v,+ None => continue,+ };+ let top = match entry.get("top").and_then(|v| v.parse::<f64>().ok()) {+ Some(v) => v,+ None => continue,+ };+ let width = match entry.get("width").and_then(|v| v.parse::<f64>().ok()) {+ Some(v) => v,+ None => continue,+ };+ let height = match entry.get("height").and_then(|v| v.parse::<f64>().ok()) {+ Some(v) => v,+ None => continue,+ };++ // Determine if coordinates are normalized (0-1) or pixel values+ // Apple OCR returns normalized, Tesseract returns pixels+ let (x_px, y_px, w_px, h_px) = if left <= 1.0 && top <= 1.0 && width <= 1.0 && height <= 1.0 {+ // Normalized coordinates (Apple OCR style)+ // Note: Apple's coordinate system has origin at bottom-left, so we need to flip Y+ let x = (left * image_width as f64) as u32;+ let y = ((1.0 - top - height) * image_height as f64) as u32;+ let w = (width * image_width as f64) as u32;+ let h = (height * image_height as f64) as u32;+ (x, y, w, h)+ } else {+ // Pixel coordinates (Tesseract style)+ (left as u32, top as u32, width as u32, height as u32)+ };++ // Add some padding around the region for better coverage+ let padding = 5u32;+ let x_padded = x_px.saturating_sub(padding);+ let y_padded = y_px.saturating_sub(padding);+ let w_padded = (w_px + padding * 2).min(image_width - x_padded);+ let h_padded = (h_px + padding * 2).min(image_height - y_padded);++ regions.push(PiiRegion {+ x: x_padded,+ y: y_padded,+ width: w_padded,+ height: h_padded,+ pii_type,+ });+ }++ regions+}+#[cfg(test)]mod tests {use super::*;@@ -29,4 +154,151 @@ mod tests {let expected = "My card is [CREDIT_CARD] and SSN is [SSN]. Email: [EMAIL]";assert_eq!(remove_pii(input), expected);}++ #[test]+ fn test_contains_pii_credit_card() {+ assert!(contains_pii("4532-1234-5678-9012"));+ assert!(contains_pii("4532 1234 5678 9012"));+ assert!(contains_pii("4532123456789012"));+ }++ #[test]+ fn test_contains_pii_ssn() {+ assert!(contains_pii("123-45-6789"));+ }++ #[test]+ fn test_contains_pii_email() {+ assert!(contains_pii("[email protected]"));+ assert!(contains_pii("[email protected]"));+ }++ #[test]+ fn test_contains_pii_negative() {+ assert!(!contains_pii("Hello World"));+ assert!(!contains_pii("1234"));+ assert!(!contains_pii("not an email"));+ }++ #[test]+ fn test_get_pii_type() {+ assert_eq!(get_pii_type("4532-1234-5678-9012"), Some("CREDIT_CARD".to_string()));+ assert_eq!(get_pii_type("123-45-6789"), Some("SSN".to_string()));+ assert_eq!(get_pii_type("[email protected]"), Some("EMAIL".to_string()));+ assert_eq!(get_pii_type("Hello World"), None);+ }++ #[test]+ fn test_detect_pii_regions_credit_card_normalized() {+ // Simulating Apple OCR output with normalized coordinates+ let text_json = vec![+ HashMap::from([+ ("text".to_string(), "4532-1234-5678-9012".to_string()),+ ("left".to_string(), "0.1".to_string()),+ ("top".to_string(), "0.8".to_string()), // Apple has bottom-left origin+ ("width".to_string(), "0.3".to_string()),+ ("height".to_string(), "0.05".to_string()),+ ])+ ];++ let regions = detect_pii_regions(&text_json, 1920, 1080);++ assert_eq!(regions.len(), 1);+ assert_eq!(regions[0].pii_type, "CREDIT_CARD");+ // With padding of 5px, x should be (0.1 * 1920) - 5 = 192 - 5 = 187+ assert!(regions[0].x > 0);+ assert!(regions[0].width > 0);+ assert!(regions[0].height > 0);+ }++ #[test]+ fn test_detect_pii_regions_pixel_coordinates() {+ // Simulating Tesseract output with pixel coordinates+ let text_json = vec![+ HashMap::from([+ ("text".to_string(), "[email protected]".to_string()),+ ("left".to_string(), "100".to_string()),+ ("top".to_string(), "200".to_string()),+ ("width".to_string(), "300".to_string()),+ ("height".to_string(), "50".to_string()),+ ])+ ];++ let regions = detect_pii_regions(&text_json, 1920, 1080);++ assert_eq!(regions.len(), 1);+ assert_eq!(regions[0].pii_type, "EMAIL");+ // With padding, x should be 100 - 5 = 95+ assert_eq!(regions[0].x, 95);+ assert_eq!(regions[0].y, 195);+ }++ #[test]+ fn test_detect_pii_regions_multiple() {+ let text_json = vec![+ HashMap::from([+ ("text".to_string(), "4532-1234-5678-9012".to_string()),+ ("left".to_string(), "100".to_string()),+ ("top".to_string(), "100".to_string()),+ ("width".to_string(), "200".to_string()),+ ("height".to_string(), "30".to_string()),+ ]),+ HashMap::from([+ ("text".to_string(), "123-45-6789".to_string()),+ ("left".to_string(), "100".to_string()),+ ("top".to_string(), "200".to_string()),+ ("width".to_string(), "150".to_string()),+ ("height".to_string(), "30".to_string()),+ ]),+ HashMap::from([+ ("text".to_string(), "Normal text here".to_string()),+ ("left".to_string(), "100".to_string()),+ ("top".to_string(), "300".to_string()),+ ("width".to_string(), "200".to_string()),+ ("height".to_string(), "30".to_string()),+ ]),+ ];++ let regions = detect_pii_regions(&text_json, 1920, 1080);++ assert_eq!(regions.len(), 2);+ assert_eq!(regions[0].pii_type, "CREDIT_CARD");+ assert_eq!(regions[1].pii_type, "SSN");+ }++ #[test]+ fn test_detect_pii_regions_no_pii() {+ let text_json = vec![+ HashMap::from([+ ("text".to_string(), "Hello World".to_string()),+ ("left".to_string(), "100".to_string()),+ ("top".to_string(), "100".to_string()),+ ("width".to_string(), "200".to_string()),+ ("height".to_string(), "30".to_string()),+ ]),+ ];++ let regions = detect_pii_regions(&text_json, 1920, 1080);+ assert!(regions.is_empty());+ }++ #[test]+ fn test_detect_pii_regions_missing_coordinates() {+ let text_json = vec![+ HashMap::from([+ ("text".to_string(), "4532-1234-5678-9012".to_string()),+ // Missing bounding box coordinates+ ]),+ ];++ let regions = detect_pii_regions(&text_json, 1920, 1080);+ assert!(regions.is_empty());+ }++ #[test]+ fn test_detect_pii_regions_empty_input() {+ let text_json: Vec<HashMap<String, String>> = vec![];+ let regions = detect_pii_regions(&text_json, 1920, 1080);+ assert!(regions.is_empty());+ }}diff --git a/screenpipe-db/src/db.rs b/screenpipe-db/src/db.rsindex 85ef0c874..05bcfb58c 100644--- a/screenpipe-db/src/db.rs+++ b/screenpipe-db/src/db.rs@@ -971,6 +971,27 @@ impl DatabaseManager {.await}+ /// Get the OCR text_json for a frame, which contains bounding box information+ /// needed for PII redaction+ pub async fn get_frame_ocr_text_json(+ &self,+ frame_id: i64,+ ) -> Result<Option<String>, sqlx::Error> {+ let result = sqlx::query_scalar::<_, Option<String>>(+ r#"+ SELECT text_json+ FROM ocr_text+ WHERE frame_id = ?1+ LIMIT 1+ "#,+ )+ .bind(frame_id)+ .fetch_optional(&self.pool)+ .await?;++ Ok(result.flatten())+ }+#[allow(clippy::too_many_arguments)]pub async fn count_search_results(&self,diff --git a/screenpipe-db/tests/timeline_performance_test.rs b/screenpipe-db/tests/timeline_performance_test.rsnew file mode 100644index 000000000..14bc3d123--- /dev/null+++ b/screenpipe-db/tests/timeline_performance_test.rs@@ -0,0 +1,592 @@+#[cfg(test)]+mod timeline_performance_tests {+ use chrono::{Duration, Utc};+ use screenpipe_db::{AudioDevice, DatabaseManager, DeviceType, OcrEngine};+ use std::sync::Arc;+ use std::time::Instant;++ async fn setup_test_db() -> DatabaseManager {+ let _ = tracing_subscriber::fmt()+ .with_max_level(tracing::Level::INFO)+ .try_init();++ let db = DatabaseManager::new("sqlite::memory:").await.unwrap();++ sqlx::migrate!("./src/migrations")+ .run(&db.pool)+ .await+ .expect("Failed to run migrations");++ db+ }++ /// Helper to insert N frames with OCR data, simulating a day of screen recording+ async fn insert_frames_with_ocr(+ db: &DatabaseManager,+ count: usize,+ start_time: chrono::DateTime<Utc>,+ ) {+ // Insert video chunk first+ let _ = db+ .insert_video_chunk("test_video.mp4", "test_device")+ .await+ .unwrap();++ for i in 0..count {+ // Space frames 2 seconds apart (simulating 0.5 FPS recording)+ let timestamp = start_time + Duration::seconds(i as i64 * 2);++ let frame_id = db+ .insert_frame(+ "test_device",+ Some(timestamp), // Pass the timestamp!+ None,+ Some(&format!("App{}", i % 10)), // Rotate through 10 apps+ Some(&format!("Window {}", i)),+ false,+ )+ .await+ .unwrap();++ // Simulate realistic OCR text - screens have LOTS of text+ // A typical screen capture with code editor, browser, etc can have 2000-5000 chars+ let ocr_text = format!(+ "Frame {} - Application: VSCode - Window: main.rs - screenpipe - \+ fn main() {{ println!(\"Hello world\"); let x = 42; let y = compute_something(x); }} \+ File Edit Selection View Go Run Terminal Help Explorer Search Source Control Run and Debug Extensions \+ PROBLEMS OUTPUT DEBUG CONSOLE TERMINAL Ports {} issues {} info {} warnings \+ Chrome - Gmail Inbox (42) - [email protected] - RE: Project Update - Meeting tomorrow at 3pm \+ Slack - #engineering - Latest: Can someone review PR #{}? - Unread: 15 \+ Finder - Documents/projects/screenpipe - 42 items, 1.2 GB available \+ System Preferences - Displays - Built-in Retina Display - Resolution: Scaled \+ Menu bar: File Edit View Insert Format Tools Extensions Help \+ Status bar: Ln 42, Col 15 - Spaces: 4 - UTF-8 - LF - Rust - Formatted \+ Terminal output: Compiling screenpipe v0.2.76 warning: unused variable \+ Browser tabs: GitHub - mediar-ai/screenpipe - Stack Overflow - rust async \+ Dock: Finder Safari Chrome VSCode Slack Notion Calendar Spotify Terminal \+ This additional text simulates more content that would typically be on screen {}",+ i, i % 100, i % 50, i % 20, i % 100, "x".repeat(500)+ );++ db.insert_ocr_text(frame_id, &ocr_text, "", Arc::new(OcrEngine::Tesseract))+ .await+ .unwrap();+ }+ }++ /// Helper to insert N audio transcriptions+ async fn insert_audio_transcriptions(+ db: &DatabaseManager,+ count: usize,+ start_time: chrono::DateTime<Utc>,+ ) {+ for i in 0..count {+ let audio_chunk_id = db+ .insert_audio_chunk(&format!("audio_{}.mp4", i))+ .await+ .unwrap();++ let transcription = format!(+ "This is audio transcription number {}. The speaker is discussing project updates and deadlines. \+ We need to finish the feature by next week.",+ i+ );++ db.insert_audio_transcription(+ audio_chunk_id,+ &transcription,+ 0,+ "",+ &AudioDevice {+ name: "default".to_string(),+ device_type: DeviceType::Output,+ },+ None,+ None,+ None,+ )+ .await+ .unwrap();+ }+ }++ // =========================================================================+ // TEST: Reproduce slow timeline loading with realistic data volume+ // =========================================================================++ /// Test that simulates loading a full day of frames+ ///+ /// At 0.5 FPS recording for 8 hours = 14,400 frames+ /// This test uses a smaller set but measures the performance characteristics+ #[tokio::test]+ async fn test_find_video_chunks_performance_small() {+ let db = setup_test_db().await;+ let frame_count = 100; // Small test++ let start_time = Utc::now() - Duration::hours(1);+ let end_time = Utc::now();++ println!("\n=== SMALL DATASET TEST ({} frames) ===", frame_count);++ // Insert frames+ let insert_start = Instant::now();+ insert_frames_with_ocr(&db, frame_count, start_time).await;+ println!("Insert time: {:?}", insert_start.elapsed());++ // Time the find_video_chunks query (this is what the WebSocket handler calls)+ let query_start = Instant::now();+ let result = db.find_video_chunks(start_time, end_time).await.unwrap();+ let query_duration = query_start.elapsed();++ println!("Query time: {:?}", query_duration);+ println!("Frames returned: {}", result.frames.len());+ println!(+ "Average time per frame: {:?}",+ query_duration / frame_count as u32+ );++ // Assert reasonable performance+ assert!(+ query_duration.as_millis() < 1000,+ "Query took too long: {:?}",+ query_duration+ );+ }++ /// Test with medium dataset - simulates ~1 hour of recording+ #[tokio::test]+ async fn test_find_video_chunks_performance_medium() {+ let db = setup_test_db().await;+ let frame_count = 1000; // ~30 minutes at 0.5 FPS++ let start_time = Utc::now() - Duration::hours(1);+ let end_time = Utc::now();++ println!("\n=== MEDIUM DATASET TEST ({} frames) ===", frame_count);++ let insert_start = Instant::now();+ insert_frames_with_ocr(&db, frame_count, start_time).await;+ println!("Insert time: {:?}", insert_start.elapsed());++ let query_start = Instant::now();+ let result = db.find_video_chunks(start_time, end_time).await.unwrap();+ let query_duration = query_start.elapsed();++ println!("Query time: {:?}", query_duration);+ println!("Frames returned: {}", result.frames.len());+ println!(+ "Average time per frame: {:?}",+ query_duration / frame_count as u32+ );++ // This is where we expect to see slowdown+ if query_duration.as_millis() > 2000 {+ println!("WARNING: Query exceeds 2 second threshold - user will experience hang!");+ }+ }++ /// Test with large dataset - simulates a full day of recording+ /// This is the scenario that causes the customer's "loading timeline" hang+ #[tokio::test]+ async fn test_find_video_chunks_performance_large() {+ let db = setup_test_db().await;+ let frame_count = 5000; // ~2.5 hours at 0.5 FPS++ let start_time = Utc::now() - Duration::hours(8);+ let end_time = Utc::now();++ println!("\n=== LARGE DATASET TEST ({} frames) ===", frame_count);+ println!("This simulates a partial day of recording");++ let insert_start = Instant::now();+ insert_frames_with_ocr(&db, frame_count, start_time).await;+ println!("Insert time: {:?}", insert_start.elapsed());++ // Also add some audio+ insert_audio_transcriptions(&db, frame_count / 10, start_time).await;++ let query_start = Instant::now();+ let result = db.find_video_chunks(start_time, end_time).await.unwrap();+ let query_duration = query_start.elapsed();++ println!("Query time: {:?}", query_duration);+ println!("Frames returned: {}", result.frames.len());+ println!(+ "Average time per frame: {:?}",+ query_duration / frame_count as u32+ );++ // Calculate data size+ let estimated_json_size: usize = result+ .frames+ .iter()+ .map(|f| {+ f.ocr_entries+ .iter()+ .map(|e| e.text.len() + e.app_name.len() + e.window_name.len())+ .sum::<usize>()+ })+ .sum();+ println!(+ "Estimated JSON payload size: {} KB",+ estimated_json_size / 1024+ );++ if query_duration.as_secs() > 5 {+ println!("CRITICAL: Query exceeds 5 seconds - this is the customer's hang!");+ println!("User is trapped in fullscreen overlay while this query runs.");+ }+ }++ // =========================================================================+ // TEST: Memory usage during sort operations+ // =========================================================================++ #[tokio::test]+ async fn test_sort_performance_on_large_result() {+ let db = setup_test_db().await;+ let frame_count = 3000;++ let start_time = Utc::now() - Duration::hours(4);+ let end_time = Utc::now();++ println!("\n=== SORT PERFORMANCE TEST ({} frames) ===", frame_count);++ insert_frames_with_ocr(&db, frame_count, start_time).await;++ // Get the chunks+ let mut chunks = db.find_video_chunks(start_time, end_time).await.unwrap();+ println!("Fetched {} frames", chunks.frames.len());++ // Time the sort operation (this is done in server.rs:2917-2922)+ let sort_start = Instant::now();+ chunks+ .frames+ .sort_by_key(|a| std::cmp::Reverse((a.timestamp, a.offset_index)));+ let sort_duration = sort_start.elapsed();++ println!("Sort time: {:?}", sort_duration);++ if sort_duration.as_millis() > 100 {+ println!("WARNING: Sort takes >100ms - this adds to perceived latency");+ }+ }++ // =========================================================================+ // TEST: Simulate full WebSocket flow+ // =========================================================================++ #[tokio::test]+ async fn test_simulate_websocket_frame_streaming() {+ let db = setup_test_db().await;+ let frame_count = 2000;++ let start_time = Utc::now() - Duration::hours(2);+ let end_time = Utc::now();++ println!(+ "\n=== WEBSOCKET SIMULATION TEST ({} frames) ===",+ frame_count+ );++ insert_frames_with_ocr(&db, frame_count, start_time).await;+ insert_audio_transcriptions(&db, frame_count / 10, start_time).await;++ // Simulate the full flow:+ // 1. Query database+ let query_start = Instant::now();+ let mut chunks = db.find_video_chunks(start_time, end_time).await.unwrap();+ let query_time = query_start.elapsed();++ // 2. Sort results+ let sort_start = Instant::now();+ chunks+ .frames+ .sort_by_key(|a| std::cmp::Reverse((a.timestamp, a.offset_index)));+ let sort_time = sort_start.elapsed();++ // 3. Estimate data size (can't serialize FrameData directly)+ let total_ocr_chars: usize = chunks+ .frames+ .iter()+ .flat_map(|f| f.ocr_entries.iter())+ .map(|e| e.text.len())+ .sum();++ let total_time = query_time + sort_time;++ println!("Query time: {:?}", query_time);+ println!("Sort time: {:?}", sort_time);+ println!("TOTAL TIME: {:?}", total_time);+ println!("Total OCR chars: {} KB", total_ocr_chars / 1024);++ if total_time.as_secs() > 3 {+ println!("\nCRITICAL: Total processing time > 3 seconds");+ println!("This explains the 'loading timeline' hang the customer experiences.");+ println!("\nBreakdown:");+ println!(+ " - DB query: {:.1}%",+ query_time.as_millis() as f64 / total_time.as_millis() as f64 * 100.0+ );+ println!(+ " - Sorting: {:.1}%",+ sort_time.as_millis() as f64 / total_time.as_millis() as f64 * 100.0+ );+ }+ }++ // =========================================================================+ // TEST: What happens with a real day of data (estimated)+ // =========================================================================++ #[tokio::test]+ async fn test_estimate_full_day_performance() {+ let db = setup_test_db().await;++ // Full day at 0.5 FPS = 43,200 frames+ // We'll test with 1000 and extrapolate+ let sample_count = 1000;++ let start_time = Utc::now() - Duration::hours(1);+ let end_time = Utc::now();++ println!("\n=== FULL DAY ESTIMATION TEST ===");+ println!("Sample size: {} frames", sample_count);++ insert_frames_with_ocr(&db, sample_count, start_time).await;++ let query_start = Instant::now();+ let result = db.find_video_chunks(start_time, end_time).await.unwrap();+ let query_duration = query_start.elapsed();++ // Extrapolate to full day (8 hours active recording)+ let full_day_frames = 8 * 60 * 60 / 2; // 14,400 frames at 0.5 FPS+ let extrapolated_time_ms =+ (query_duration.as_millis() as f64 / sample_count as f64) * full_day_frames as f64;++ println!("Sample query time: {:?}", query_duration);+ println!("Frames in sample: {}", result.frames.len());+ println!("\nExtrapolated for full day ({} frames):", full_day_frames);+ println!(+ " Estimated query time: {:.1} seconds",+ extrapolated_time_ms / 1000.0+ );++ if extrapolated_time_ms > 10000.0 {+ println!("\nCRITICAL: Full day query would take > 10 seconds!");+ println!("This is why the customer sees the app 'hang' on startup.");+ println!("\nRecommendations:");+ println!(" 1. Add pagination (LIMIT/OFFSET) to query");+ println!(" 2. Load only visible time range initially");+ println!(" 3. Use lighter 'index' query without OCR text");+ println!(" 4. Stream first 50 frames immediately, rest in background");+ }+ }++ // =========================================================================+ // TEST: File-based SQLite (closer to real conditions)+ // =========================================================================++ async fn setup_file_db(path: &str) -> DatabaseManager {+ let _ = tracing_subscriber::fmt()+ .with_max_level(tracing::Level::INFO)+ .try_init();++ // Remove if exists+ let _ = std::fs::remove_file(path);++ let db_url = format!("sqlite:{}", path);++ let db = DatabaseManager::new(&db_url).await.unwrap();++ sqlx::migrate!("./src/migrations")+ .run(&db.pool)+ .await+ .expect("Failed to run migrations");++ db+ }++ /// Test with file-based SQLite - closer to real customer experience+ #[tokio::test]+ async fn test_file_based_db_performance() {+ let db_path = "/tmp/screenpipe_test_perf.db";+ let db = setup_file_db(db_path).await;+ let frame_count = 3000; // ~1 hour at 0.5 FPS++ let start_time = Utc::now() - Duration::hours(2);+ let end_time = Utc::now();++ println!("\n=== FILE-BASED DB TEST ({} frames) ===", frame_count);+ println!("This simulates real file I/O conditions");++ let insert_start = Instant::now();+ insert_frames_with_ocr(&db, frame_count, start_time).await;+ insert_audio_transcriptions(&db, frame_count / 10, start_time).await;+ println!("Insert time: {:?}", insert_start.elapsed());++ // Force flush to disk+ sqlx::query("PRAGMA wal_checkpoint(TRUNCATE)")+ .execute(&db.pool)+ .await+ .ok();++ let query_start = Instant::now();+ let result = db.find_video_chunks(start_time, end_time).await.unwrap();+ let query_duration = query_start.elapsed();++ println!("Query time: {:?}", query_duration);+ println!("Frames returned: {}", result.frames.len());++ // Run query multiple times to see if caching helps+ println!("\nRunning query 3 more times to check consistency:");+ for i in 1..=3 {+ let query_start = Instant::now();+ let _ = db.find_video_chunks(start_time, end_time).await.unwrap();+ println!(" Run {}: {:?}", i, query_start.elapsed());+ }++ if query_duration.as_millis() > 500 {+ println!("\nWARNING: Query > 500ms - user will notice delay");+ }++ // Cleanup+ let _ = std::fs::remove_file(db_path);+ }++ /// Test the actual query that's used (check if JOINs are the bottleneck)+ #[tokio::test]+ async fn test_query_without_ocr_join() {+ let db = setup_test_db().await;+ let frame_count = 3000;++ let start_time = Utc::now() - Duration::hours(2);+ let end_time = Utc::now();++ println!("\n=== QUERY COMPARISON TEST ({} frames) ===", frame_count);++ insert_frames_with_ocr(&db, frame_count, start_time).await;++ // Time the full query (with OCR join)+ let full_query_start = Instant::now();+ let _ = db.find_video_chunks(start_time, end_time).await.unwrap();+ let full_query_time = full_query_start.elapsed();++ // Time a simple query (frames only, no OCR)+ let simple_query = r#"+ SELECT f.id, f.timestamp, f.app_name+ FROM frames f+ WHERE f.timestamp >= ?1 AND f.timestamp <= ?2+ ORDER BY f.timestamp DESC+ "#;++ let simple_query_start = Instant::now();+ let _: Vec<(i64, chrono::DateTime<Utc>, Option<String>)> = sqlx::query_as(simple_query)+ .bind(start_time)+ .bind(end_time)+ .fetch_all(&db.pool)+ .await+ .unwrap();+ let simple_query_time = simple_query_start.elapsed();++ println!("Full query (with OCR join): {:?}", full_query_time);+ println!("Simple query (no OCR): {:?}", simple_query_time);+ println!(+ "OCR join overhead: {:.1}x slower",+ full_query_time.as_micros() as f64 / simple_query_time.as_micros() as f64+ );++ if full_query_time.as_micros() > simple_query_time.as_micros() * 5 {+ println!("\nCRITICAL: OCR join is >5x slower than simple query!");+ println!(+ "Recommendation: Load timeline index first (no OCR), then load OCR on demand."+ );+ }+ }++ /// Test to see what happens with a very large time range (multiple days)+ #[tokio::test]+ async fn test_large_time_range_query() {+ let db = setup_test_db().await;++ // Insert frames spread across multiple "days"+ let frame_count = 2000;++ println!("\n=== LARGE TIME RANGE TEST ===");+ println!("Simulating frames spread across 7 days");++ // Insert frames over 7 days+ for day in 0..7 {+ let day_start = Utc::now() - Duration::days(7 - day);+ insert_frames_with_ocr(&db, frame_count / 7, day_start).await;+ }++ // Query for full week+ let start_time = Utc::now() - Duration::days(7);+ let end_time = Utc::now();++ let query_start = Instant::now();+ let result = db.find_video_chunks(start_time, end_time).await.unwrap();+ let query_duration = query_start.elapsed();++ println!("Query time for 7 days: {:?}", query_duration);+ println!("Frames returned: {}", result.frames.len());++ // Query for just today+ let today_start = Utc::now() - Duration::hours(24);+ let query_start = Instant::now();+ let result = db.find_video_chunks(today_start, end_time).await.unwrap();+ let today_query_time = query_start.elapsed();++ println!("Query time for today: {:?}", today_query_time);+ println!("Frames returned: {}", result.frames.len());++ println!(+ "\nTime range impact: 7-day query is {:.1}x slower than 1-day",+ query_duration.as_micros() as f64 / today_query_time.as_micros().max(1) as f64+ );+ }++ // =========================================================================+ // TEST: Stress test to find breaking point+ // =========================================================================++ /// This test tries to find when performance degrades significantly+ /// Run with: cargo test -p screenpipe-db --test timeline_performance_test test_stress -- --nocapture --ignored+ #[tokio::test]+ #[ignore] // Enable with --ignored flag+ async fn test_stress_find_breaking_point() {+ let db = setup_test_db().await;++ println!("\n=== STRESS TEST: Finding Breaking Point ===");+ println!("Testing with increasing frame counts...\n");++ let end_time = Utc::now();++ for frame_count in [100, 500, 1000, 2000, 5000, 10000, 20000] {+ let start_time = end_time - Duration::hours(frame_count as i64 / 1800 + 1);++ // Insert frames+ insert_frames_with_ocr(&db, frame_count, start_time).await;++ // Query+ let query_start = Instant::now();+ let result = db.find_video_chunks(start_time, end_time).await.unwrap();+ let query_time = query_start.elapsed();++ println!(+ "{:>6} frames: {:>8.2}ms ({:>6.2}µs/frame) [returned: {}]",+ frame_count,+ query_time.as_secs_f64() * 1000.0,+ query_time.as_micros() as f64 / frame_count as f64,+ result.frames.len()+ );++ if query_time.as_secs() > 5 {+ println!("\n** BREAKING POINT FOUND at {} frames **", frame_count);+ println!("Query time exceeds 5 seconds - this causes customer hang.");+ break;+ }+ }+ }+}diff --git a/screenpipe-integrations/screenpipe-mcp/package-lock.json b/screenpipe-integrations/screenpipe-mcp/package-lock.jsonindex 336496e37..e9d792782 100644--- a/screenpipe-integrations/screenpipe-mcp/package-lock.json+++ b/screenpipe-integrations/screenpipe-mcp/package-lock.json@@ -1,23 +1,26 @@{"name": "screenpipe-mcp",- "version": "0.2.0",+ "version": "0.3.1","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "screenpipe-mcp",- "version": "0.2.0",+ "version": "0.3.1","license": "MIT","dependencies": {- "@modelcontextprotocol/sdk": "^1.0.0"+ "@modelcontextprotocol/sdk": "^1.0.0",+ "ws": "^8.18.0"},"bin": {"screenpipe-mcp": "dist/index.js"},"devDependencies": {"@types/node": "^20.0.0",+ "@types/ws": "^8.5.13","ts-node": "^10.9.0",- "typescript": "^5.0.0"+ "typescript": "^5.0.0",+ "vitest": "^2.1.0"},"engines": {"node": ">=18.0.0"@@ -36,6 +39,397 @@"node": ">=12"}},+ "node_modules/@esbuild/aix-ppc64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz",+ "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==",+ "cpu": [+ "ppc64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "aix"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/android-arm": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz",+ "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/android-arm64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz",+ "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/android-x64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz",+ "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/darwin-arm64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz",+ "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/darwin-x64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz",+ "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/freebsd-arm64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz",+ "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/freebsd-x64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz",+ "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/linux-arm": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz",+ "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/linux-arm64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz",+ "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/linux-ia32": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz",+ "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==",+ "cpu": [+ "ia32"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/linux-loong64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz",+ "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==",+ "cpu": [+ "loong64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/linux-mips64el": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz",+ "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==",+ "cpu": [+ "mips64el"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/linux-ppc64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz",+ "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==",+ "cpu": [+ "ppc64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/linux-riscv64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz",+ "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==",+ "cpu": [+ "riscv64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/linux-s390x": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz",+ "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==",+ "cpu": [+ "s390x"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/linux-x64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz",+ "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/netbsd-x64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz",+ "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "netbsd"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/openbsd-x64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz",+ "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "openbsd"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/sunos-x64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz",+ "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "sunos"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/win32-arm64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz",+ "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/win32-ia32": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz",+ "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==",+ "cpu": [+ "ia32"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/@esbuild/win32-x64": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz",+ "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "engines": {+ "node": ">=12"+ }+ },"node_modules/@hono/node-server": {"version": "1.19.9","resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.19.9.tgz",@@ -115,6 +509,356 @@}}},+ "node_modules/@rollup/rollup-android-arm-eabi": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.56.0.tgz",+ "integrity": "sha512-LNKIPA5k8PF1+jAFomGe3qN3bbIgJe/IlpDBwuVjrDKrJhVWywgnJvflMt/zkbVNLFtF1+94SljYQS6e99klnw==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ]+ },+ "node_modules/@rollup/rollup-android-arm64": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.56.0.tgz",+ "integrity": "sha512-lfbVUbelYqXlYiU/HApNMJzT1E87UPGvzveGg2h0ktUNlOCxKlWuJ9jtfvs1sKHdwU4fzY7Pl8sAl49/XaEk6Q==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ]+ },+ "node_modules/@rollup/rollup-darwin-arm64": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.56.0.tgz",+ "integrity": "sha512-EgxD1ocWfhoD6xSOeEEwyE7tDvwTgZc8Bss7wCWe+uc7wO8G34HHCUH+Q6cHqJubxIAnQzAsyUsClt0yFLu06w==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ]+ },+ "node_modules/@rollup/rollup-darwin-x64": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.56.0.tgz",+ "integrity": "sha512-1vXe1vcMOssb/hOF8iv52A7feWW2xnu+c8BV4t1F//m9QVLTfNVpEdja5ia762j/UEJe2Z1jAmEqZAK42tVW3g==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ]+ },+ "node_modules/@rollup/rollup-freebsd-arm64": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.56.0.tgz",+ "integrity": "sha512-bof7fbIlvqsyv/DtaXSck4VYQ9lPtoWNFCB/JY4snlFuJREXfZnm+Ej6yaCHfQvofJDXLDMTVxWscVSuQvVWUQ==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ]+ },+ "node_modules/@rollup/rollup-freebsd-x64": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.56.0.tgz",+ "integrity": "sha512-KNa6lYHloW+7lTEkYGa37fpvPq+NKG/EHKM8+G/g9WDU7ls4sMqbVRV78J6LdNuVaeeK5WB9/9VAFbKxcbXKYg==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ]+ },+ "node_modules/@rollup/rollup-linux-arm-gnueabihf": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.56.0.tgz",+ "integrity": "sha512-E8jKK87uOvLrrLN28jnAAAChNq5LeCd2mGgZF+fGF5D507WlG/Noct3lP/QzQ6MrqJ5BCKNwI9ipADB6jyiq2A==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-arm-musleabihf": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.56.0.tgz",+ "integrity": "sha512-jQosa5FMYF5Z6prEpTCCmzCXz6eKr/tCBssSmQGEeozA9tkRUty/5Vx06ibaOP9RCrW1Pvb8yp3gvZhHwTDsJw==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-arm64-gnu": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.56.0.tgz",+ "integrity": "sha512-uQVoKkrC1KGEV6udrdVahASIsaF8h7iLG0U0W+Xn14ucFwi6uS539PsAr24IEF9/FoDtzMeeJXJIBo5RkbNWvQ==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-arm64-musl": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.56.0.tgz",+ "integrity": "sha512-vLZ1yJKLxhQLFKTs42RwTwa6zkGln+bnXc8ueFGMYmBTLfNu58sl5/eXyxRa2RarTkJbXl8TKPgfS6V5ijNqEA==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-loong64-gnu": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.56.0.tgz",+ "integrity": "sha512-FWfHOCub564kSE3xJQLLIC/hbKqHSVxy8vY75/YHHzWvbJL7aYJkdgwD/xGfUlL5UV2SB7otapLrcCj2xnF1dg==",+ "cpu": [+ "loong64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-loong64-musl": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.56.0.tgz",+ "integrity": "sha512-z1EkujxIh7nbrKL1lmIpqFTc/sr0u8Uk0zK/qIEFldbt6EDKWFk/pxFq3gYj4Bjn3aa9eEhYRlL3H8ZbPT1xvA==",+ "cpu": [+ "loong64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-ppc64-gnu": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.56.0.tgz",+ "integrity": "sha512-iNFTluqgdoQC7AIE8Q34R3AuPrJGJirj5wMUErxj22deOcY7XwZRaqYmB6ZKFHoVGqRcRd0mqO+845jAibKCkw==",+ "cpu": [+ "ppc64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-ppc64-musl": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.56.0.tgz",+ "integrity": "sha512-MtMeFVlD2LIKjp2sE2xM2slq3Zxf9zwVuw0jemsxvh1QOpHSsSzfNOTH9uYW9i1MXFxUSMmLpeVeUzoNOKBaWg==",+ "cpu": [+ "ppc64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-riscv64-gnu": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.56.0.tgz",+ "integrity": "sha512-in+v6wiHdzzVhYKXIk5U74dEZHdKN9KH0Q4ANHOTvyXPG41bajYRsy7a8TPKbYPl34hU7PP7hMVHRvv/5aCSew==",+ "cpu": [+ "riscv64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-riscv64-musl": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.56.0.tgz",+ "integrity": "sha512-yni2raKHB8m9NQpI9fPVwN754mn6dHQSbDTwxdr9SE0ks38DTjLMMBjrwvB5+mXrX+C0npX0CVeCUcvvvD8CNQ==",+ "cpu": [+ "riscv64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-s390x-gnu": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.56.0.tgz",+ "integrity": "sha512-zhLLJx9nQPu7wezbxt2ut+CI4YlXi68ndEve16tPc/iwoylWS9B3FxpLS2PkmfYgDQtosah07Mj9E0khc3Y+vQ==",+ "cpu": [+ "s390x"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-x64-gnu": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.56.0.tgz",+ "integrity": "sha512-MVC6UDp16ZSH7x4rtuJPAEoE1RwS8N4oK9DLHy3FTEdFoUTCFVzMfJl/BVJ330C+hx8FfprA5Wqx4FhZXkj2Kw==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-linux-x64-musl": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.56.0.tgz",+ "integrity": "sha512-ZhGH1eA4Qv0lxaV00azCIS1ChedK0V32952Md3FtnxSqZTBTd6tgil4nZT5cU8B+SIw3PFYkvyR4FKo2oyZIHA==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ]+ },+ "node_modules/@rollup/rollup-openbsd-x64": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.56.0.tgz",+ "integrity": "sha512-O16XcmyDeFI9879pEcmtWvD/2nyxR9mF7Gs44lf1vGGx8Vg2DRNx11aVXBEqOQhWb92WN4z7fW/q4+2NYzCbBA==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "openbsd"+ ]+ },+ "node_modules/@rollup/rollup-openharmony-arm64": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.56.0.tgz",+ "integrity": "sha512-LhN/Reh+7F3RCgQIRbgw8ZMwUwyqJM+8pXNT6IIJAqm2IdKkzpCh/V9EdgOMBKuebIrzswqy4ATlrDgiOwbRcQ==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "openharmony"+ ]+ },+ "node_modules/@rollup/rollup-win32-arm64-msvc": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.56.0.tgz",+ "integrity": "sha512-kbFsOObXp3LBULg1d3JIUQMa9Kv4UitDmpS+k0tinPBz3watcUiV2/LUDMMucA6pZO3WGE27P7DsfaN54l9ing==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },+ "node_modules/@rollup/rollup-win32-ia32-msvc": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.56.0.tgz",+ "integrity": "sha512-vSSgny54D6P4vf2izbtFm/TcWYedw7f8eBrOiGGecyHyQB9q4Kqentjaj8hToe+995nob/Wv48pDqL5a62EWtg==",+ "cpu": [+ "ia32"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },+ "node_modules/@rollup/rollup-win32-x64-gnu": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.56.0.tgz",+ "integrity": "sha512-FeCnkPCTHQJFbiGG49KjV5YGW/8b9rrXAM2Mz2kiIoktq2qsJxRD5giEMEOD2lPdgs72upzefaUvS+nc8E3UzQ==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },+ "node_modules/@rollup/rollup-win32-x64-msvc": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.56.0.tgz",+ "integrity": "sha512-H8AE9Ur/t0+1VXujj90w0HrSOuv0Nq9r1vSZF2t5km20NTfosQsGGUXDaKdQZzwuLts7IyL1fYT4hM95TI9c4g==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ]+ },"node_modules/@tsconfig/node10": {"version": "1.0.12","resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.12.tgz",@@ -143,6 +887,13 @@"dev": true,"license": "MIT"},+ "node_modules/@types/estree": {+ "version": "1.0.8",+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",+ "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",+ "dev": true,+ "license": "MIT"+ },"node_modules/@types/node": {"version": "20.19.30","resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.30.tgz",@@ -154,6 +905,129 @@"undici-types": "~6.21.0"}},+ "node_modules/@types/ws": {+ "version": "8.18.1",+ "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz",+ "integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/node": "*"+ }+ },+ "node_modules/@vitest/expect": {+ "version": "2.1.9",+ "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.9.tgz",+ "integrity": "sha512-UJCIkTBenHeKT1TTlKMJWy1laZewsRIzYighyYiJKZreqtdxSos/S1t+ktRMQWu2CKqaarrkeszJx1cgC5tGZw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/spy": "2.1.9",+ "@vitest/utils": "2.1.9",+ "chai": "^5.1.2",+ "tinyrainbow": "^1.2.0"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/@vitest/mocker": {+ "version": "2.1.9",+ "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-2.1.9.tgz",+ "integrity": "sha512-tVL6uJgoUdi6icpxmdrn5YNo3g3Dxv+IHJBr0GXHaEdTcw3F+cPKnsXFhli6nO+f/6SDKPHEK1UN+k+TQv0Ehg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/spy": "2.1.9",+ "estree-walker": "^3.0.3",+ "magic-string": "^0.30.12"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ },+ "peerDependencies": {+ "msw": "^2.4.9",+ "vite": "^5.0.0"+ },+ "peerDependenciesMeta": {+ "msw": {+ "optional": true+ },+ "vite": {+ "optional": true+ }+ }+ },+ "node_modules/@vitest/pretty-format": {+ "version": "2.1.9",+ "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-2.1.9.tgz",+ "integrity": "sha512-KhRIdGV2U9HOUzxfiHmY8IFHTdqtOhIzCpd8WRdJiE7D/HUcZVD0EgQCVjm+Q9gkUXWgBvMmTtZgIG48wq7sOQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "tinyrainbow": "^1.2.0"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/@vitest/runner": {+ "version": "2.1.9",+ "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-2.1.9.tgz",+ "integrity": "sha512-ZXSSqTFIrzduD63btIfEyOmNcBmQvgOVsPNPe0jYtESiXkhd8u2erDLnMxmGrDCwHCCHE7hxwRDCT3pt0esT4g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/utils": "2.1.9",+ "pathe": "^1.1.2"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/@vitest/snapshot": {+ "version": "2.1.9",+ "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-2.1.9.tgz",+ "integrity": "sha512-oBO82rEjsxLNJincVhLhaxxZdEtV0EFHMK5Kmx5sJ6H9L183dHECjiefOAdnqpIgT5eZwT04PoggUnW88vOBNQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/pretty-format": "2.1.9",+ "magic-string": "^0.30.12",+ "pathe": "^1.1.2"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/@vitest/spy": {+ "version": "2.1.9",+ "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-2.1.9.tgz",+ "integrity": "sha512-E1B35FwzXXTs9FHNK6bDszs7mtydNi5MIfUWpceJ8Xbfb1gBMscAnwLbEu+B44ed6W3XjL9/ehLPHR1fkf1KLQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "tinyspy": "^3.0.2"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/@vitest/utils": {+ "version": "2.1.9",+ "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-2.1.9.tgz",+ "integrity": "sha512-v0psaMSkNJ3A2NMrUEHFRzJtDPFn+/VWZ5WxImB21T9fjucJRmS7xCS3ppEnARb9y11OAzaD+P2Ps+b+BGX5iQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/pretty-format": "2.1.9",+ "loupe": "^3.1.2",+ "tinyrainbow": "^1.2.0"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },"node_modules/accepts": {"version": "2.0.0","resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz",@@ -233,6 +1107,16 @@"dev": true,"license": "MIT"},+ "node_modules/assertion-error": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz",+ "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=12"+ }+ },"node_modules/body-parser": {"version": "2.2.2","resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz",@@ -266,6 +1150,16 @@"node": ">= 0.8"}},+ "node_modules/cac": {+ "version": "6.7.14",+ "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz",+ "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },"node_modules/call-bind-apply-helpers": {"version": "1.0.2","resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",@@ -295,6 +1189,33 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/chai": {+ "version": "5.3.3",+ "resolved": "https://registry.npmjs.org/chai/-/chai-5.3.3.tgz",+ "integrity": "sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "assertion-error": "^2.0.1",+ "check-error": "^2.1.1",+ "deep-eql": "^5.0.1",+ "loupe": "^3.1.0",+ "pathval": "^2.0.0"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/check-error": {+ "version": "2.1.3",+ "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.3.tgz",+ "integrity": "sha512-PAJdDJusoxnwm1VwW07VWwUN1sl7smmC3OKggvndJFadxxDRyFJBX/ggnu/KE4kQAB7a3Dp8f/YXC1FlUprWmA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 16"+ }+ },"node_modules/content-disposition": {"version": "1.0.1","resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz",@@ -386,6 +1307,16 @@}}},+ "node_modules/deep-eql": {+ "version": "5.0.2",+ "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz",+ "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },"node_modules/depd": {"version": "2.0.0","resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",@@ -452,6 +1383,13 @@"node": ">= 0.4"}},+ "node_modules/es-module-lexer": {+ "version": "1.7.0",+ "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz",+ "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==",+ "dev": true,+ "license": "MIT"+ },"node_modules/es-object-atoms": {"version": "1.1.1","resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",@@ -464,12 +1402,61 @@"node": ">= 0.4"}},+ "node_modules/esbuild": {+ "version": "0.21.5",+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz",+ "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==",+ "dev": true,+ "hasInstallScript": true,+ "license": "MIT",+ "bin": {+ "esbuild": "bin/esbuild"+ },+ "engines": {+ "node": ">=12"+ },+ "optionalDependencies": {+ "@esbuild/aix-ppc64": "0.21.5",+ "@esbuild/android-arm": "0.21.5",+ "@esbuild/android-arm64": "0.21.5",+ "@esbuild/android-x64": "0.21.5",+ "@esbuild/darwin-arm64": "0.21.5",+ "@esbuild/darwin-x64": "0.21.5",+ "@esbuild/freebsd-arm64": "0.21.5",+ "@esbuild/freebsd-x64": "0.21.5",+ "@esbuild/linux-arm": "0.21.5",+ "@esbuild/linux-arm64": "0.21.5",+ "@esbuild/linux-ia32": "0.21.5",+ "@esbuild/linux-loong64": "0.21.5",+ "@esbuild/linux-mips64el": "0.21.5",+ "@esbuild/linux-ppc64": "0.21.5",+ "@esbuild/linux-riscv64": "0.21.5",+ "@esbuild/linux-s390x": "0.21.5",+ "@esbuild/linux-x64": "0.21.5",+ "@esbuild/netbsd-x64": "0.21.5",+ "@esbuild/openbsd-x64": "0.21.5",+ "@esbuild/sunos-x64": "0.21.5",+ "@esbuild/win32-arm64": "0.21.5",+ "@esbuild/win32-ia32": "0.21.5",+ "@esbuild/win32-x64": "0.21.5"+ }+ },"node_modules/escape-html": {"version": "1.0.3","resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz","integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==","license": "MIT"},+ "node_modules/estree-walker": {+ "version": "3.0.3",+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",+ "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0"+ }+ },"node_modules/etag": {"version": "1.8.1","resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",@@ -500,6 +1487,16 @@"node": ">=18.0.0"}},+ "node_modules/expect-type": {+ "version": "1.3.0",+ "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.3.0.tgz",+ "integrity": "sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==",+ "dev": true,+ "license": "Apache-2.0",+ "engines": {+ "node": ">=12.0.0"+ }+ },"node_modules/express": {"version": "5.2.1","resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz",@@ -620,6 +1617,21 @@"node": ">= 0.8"}},+ "node_modules/fsevents": {+ "version": "2.3.3",+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",+ "dev": true,+ "hasInstallScript": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "engines": {+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"+ }+ },"node_modules/function-bind": {"version": "1.1.2","resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",@@ -796,6 +1808,23 @@"integrity": "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==","license": "BSD-2-Clause"},+ "node_modules/loupe": {+ "version": "3.2.1",+ "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.2.1.tgz",+ "integrity": "sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/magic-string": {+ "version": "0.30.21",+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",+ "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@jridgewell/sourcemap-codec": "^1.5.5"+ }+ },"node_modules/make-error": {"version": "1.3.6","resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",@@ -864,6 +1893,25 @@"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==","license": "MIT"},+ "node_modules/nanoid": {+ "version": "3.3.11",+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",+ "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",+ "dev": true,+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "bin": {+ "nanoid": "bin/nanoid.cjs"+ },+ "engines": {+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"+ }+ },"node_modules/negotiator": {"version": "1.0.0","resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz",@@ -943,6 +1991,30 @@"url": "https://opencollective.com/express"}},+ "node_modules/pathe": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz",+ "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/pathval": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.1.tgz",+ "integrity": "sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">= 14.16"+ }+ },+ "node_modules/picocolors": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",+ "dev": true,+ "license": "ISC"+ },"node_modules/pkce-challenge": {"version": "5.0.1","resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.1.tgz",@@ -952,6 +2024,35 @@"node": ">=16.20.0"}},+ "node_modules/postcss": {+ "version": "8.5.6",+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz",+ "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==",+ "dev": true,+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/postcss/"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/funding/github/npm/postcss"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "nanoid": "^3.3.11",+ "picocolors": "^1.1.1",+ "source-map-js": "^1.2.1"+ },+ "engines": {+ "node": "^10 || ^12 || >=14"+ }+ },"node_modules/proxy-addr": {"version": "2.0.7","resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",@@ -1013,6 +2114,51 @@"node": ">=0.10.0"}},+ "node_modules/rollup": {+ "version": "4.56.0",+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.56.0.tgz",+ "integrity": "sha512-9FwVqlgUHzbXtDg9RCMgodF3Ua4Na6Gau+Sdt9vyCN4RhHfVKX2DCHy3BjMLTDd47ITDhYAnTwGulWTblJSDLg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/estree": "1.0.8"+ },+ "bin": {+ "rollup": "dist/bin/rollup"+ },+ "engines": {+ "node": ">=18.0.0",+ "npm": ">=8.0.0"+ },+ "optionalDependencies": {+ "@rollup/rollup-android-arm-eabi": "4.56.0",+ "@rollup/rollup-android-arm64": "4.56.0",+ "@rollup/rollup-darwin-arm64": "4.56.0",+ "@rollup/rollup-darwin-x64": "4.56.0",+ "@rollup/rollup-freebsd-arm64": "4.56.0",+ "@rollup/rollup-freebsd-x64": "4.56.0",+ "@rollup/rollup-linux-arm-gnueabihf": "4.56.0",+ "@rollup/rollup-linux-arm-musleabihf": "4.56.0",+ "@rollup/rollup-linux-arm64-gnu": "4.56.0",+ "@rollup/rollup-linux-arm64-musl": "4.56.0",+ "@rollup/rollup-linux-loong64-gnu": "4.56.0",+ "@rollup/rollup-linux-loong64-musl": "4.56.0",+ "@rollup/rollup-linux-ppc64-gnu": "4.56.0",+ "@rollup/rollup-linux-ppc64-musl": "4.56.0",+ "@rollup/rollup-linux-riscv64-gnu": "4.56.0",+ "@rollup/rollup-linux-riscv64-musl": "4.56.0",+ "@rollup/rollup-linux-s390x-gnu": "4.56.0",+ "@rollup/rollup-linux-x64-gnu": "4.56.0",+ "@rollup/rollup-linux-x64-musl": "4.56.0",+ "@rollup/rollup-openbsd-x64": "4.56.0",+ "@rollup/rollup-openharmony-arm64": "4.56.0",+ "@rollup/rollup-win32-arm64-msvc": "4.56.0",+ "@rollup/rollup-win32-ia32-msvc": "4.56.0",+ "@rollup/rollup-win32-x64-gnu": "4.56.0",+ "@rollup/rollup-win32-x64-msvc": "4.56.0",+ "fsevents": "~2.3.2"+ }+ },"node_modules/router": {"version": "2.2.0","resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",@@ -1179,6 +2325,30 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/siginfo": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz",+ "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==",+ "dev": true,+ "license": "ISC"+ },+ "node_modules/source-map-js": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",+ "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",+ "dev": true,+ "license": "BSD-3-Clause",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/stackback": {+ "version": "0.0.2",+ "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz",+ "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==",+ "dev": true,+ "license": "MIT"+ },"node_modules/statuses": {"version": "2.0.2","resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",@@ -1188,6 +2358,57 @@"node": ">= 0.8"}},+ "node_modules/std-env": {+ "version": "3.10.0",+ "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.10.0.tgz",+ "integrity": "sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/tinybench": {+ "version": "2.9.0",+ "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz",+ "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/tinyexec": {+ "version": "0.3.2",+ "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz",+ "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/tinypool": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.1.1.tgz",+ "integrity": "sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": "^18.0.0 || >=20.0.0"+ }+ },+ "node_modules/tinyrainbow": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-1.2.0.tgz",+ "integrity": "sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=14.0.0"+ }+ },+ "node_modules/tinyspy": {+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-3.0.2.tgz",+ "integrity": "sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=14.0.0"+ }+ },"node_modules/toidentifier": {"version": "1.0.1","resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",@@ -1302,6 +2523,155 @@"node": ">= 0.8"}},+ "node_modules/vite": {+ "version": "5.4.21",+ "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz",+ "integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "esbuild": "^0.21.3",+ "postcss": "^8.4.43",+ "rollup": "^4.20.0"+ },+ "bin": {+ "vite": "bin/vite.js"+ },+ "engines": {+ "node": "^18.0.0 || >=20.0.0"+ },+ "funding": {+ "url": "https://github.com/vitejs/vite?sponsor=1"+ },+ "optionalDependencies": {+ "fsevents": "~2.3.3"+ },+ "peerDependencies": {+ "@types/node": "^18.0.0 || >=20.0.0",+ "less": "*",+ "lightningcss": "^1.21.0",+ "sass": "*",+ "sass-embedded": "*",+ "stylus": "*",+ "sugarss": "*",+ "terser": "^5.4.0"+ },+ "peerDependenciesMeta": {+ "@types/node": {+ "optional": true+ },+ "less": {+ "optional": true+ },+ "lightningcss": {+ "optional": true+ },+ "sass": {+ "optional": true+ },+ "sass-embedded": {+ "optional": true+ },+ "stylus": {+ "optional": true+ },+ "sugarss": {+ "optional": true+ },+ "terser": {+ "optional": true+ }+ }+ },+ "node_modules/vite-node": {+ "version": "2.1.9",+ "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.1.9.tgz",+ "integrity": "sha512-AM9aQ/IPrW/6ENLQg3AGY4K1N2TGZdR5e4gu/MmmR2xR3Ll1+dib+nook92g4TV3PXVyeyxdWwtaCAiUL0hMxA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "cac": "^6.7.14",+ "debug": "^4.3.7",+ "es-module-lexer": "^1.5.4",+ "pathe": "^1.1.2",+ "vite": "^5.0.0"+ },+ "bin": {+ "vite-node": "vite-node.mjs"+ },+ "engines": {+ "node": "^18.0.0 || >=20.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },+ "node_modules/vitest": {+ "version": "2.1.9",+ "resolved": "https://registry.npmjs.org/vitest/-/vitest-2.1.9.tgz",+ "integrity": "sha512-MSmPM9REYqDGBI8439mA4mWhV5sKmDlBKWIYbA3lRb2PTHACE0mgKwA8yQ2xq9vxDTuk4iPrECBAEW2aoFXY0Q==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@vitest/expect": "2.1.9",+ "@vitest/mocker": "2.1.9",+ "@vitest/pretty-format": "^2.1.9",+ "@vitest/runner": "2.1.9",+ "@vitest/snapshot": "2.1.9",+ "@vitest/spy": "2.1.9",+ "@vitest/utils": "2.1.9",+ "chai": "^5.1.2",+ "debug": "^4.3.7",+ "expect-type": "^1.1.0",+ "magic-string": "^0.30.12",+ "pathe": "^1.1.2",+ "std-env": "^3.8.0",+ "tinybench": "^2.9.0",+ "tinyexec": "^0.3.1",+ "tinypool": "^1.0.1",+ "tinyrainbow": "^1.2.0",+ "vite": "^5.0.0",+ "vite-node": "2.1.9",+ "why-is-node-running": "^2.3.0"+ },+ "bin": {+ "vitest": "vitest.mjs"+ },+ "engines": {+ "node": "^18.0.0 || >=20.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ },+ "peerDependencies": {+ "@edge-runtime/vm": "*",+ "@types/node": "^18.0.0 || >=20.0.0",+ "@vitest/browser": "2.1.9",+ "@vitest/ui": "2.1.9",+ "happy-dom": "*",+ "jsdom": "*"+ },+ "peerDependenciesMeta": {+ "@edge-runtime/vm": {+ "optional": true+ },+ "@types/node": {+ "optional": true+ },+ "@vitest/browser": {+ "optional": true+ },+ "@vitest/ui": {+ "optional": true+ },+ "happy-dom": {+ "optional": true+ },+ "jsdom": {+ "optional": true+ }+ }+ },"node_modules/which": {"version": "2.0.2","resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",@@ -1317,12 +2687,50 @@"node": ">= 8"}},+ "node_modules/why-is-node-running": {+ "version": "2.3.0",+ "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz",+ "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "siginfo": "^2.0.0",+ "stackback": "0.0.2"+ },+ "bin": {+ "why-is-node-running": "cli.js"+ },+ "engines": {+ "node": ">=8"+ }+ },"node_modules/wrappy": {"version": "1.0.2","resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz","integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==","license": "ISC"},+ "node_modules/ws": {+ "version": "8.19.0",+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz",+ "integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==",+ "license": "MIT",+ "engines": {+ "node": ">=10.0.0"+ },+ "peerDependencies": {+ "bufferutil": "^4.0.1",+ "utf-8-validate": ">=5.0.2"+ },+ "peerDependenciesMeta": {+ "bufferutil": {+ "optional": true+ },+ "utf-8-validate": {+ "optional": true+ }+ }+ },"node_modules/yn": {"version": "3.1.1","resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",diff --git a/screenpipe-integrations/screenpipe-mcp/package.json b/screenpipe-integrations/screenpipe-mcp/package.jsonindex eb39cee79..4a16ddc20 100644--- a/screenpipe-integrations/screenpipe-mcp/package.json+++ b/screenpipe-integrations/screenpipe-mcp/package.json@@ -10,6 +10,8 @@"build": "tsc","start": "node dist/index.js","dev": "ts-node src/index.ts",+ "test": "vitest run",+ "test:watch": "vitest","prepublishOnly": "npm run build"},"keywords": [@@ -25,12 +27,15 @@"author": "Mediar AI","license": "MIT","dependencies": {- "@modelcontextprotocol/sdk": "^1.0.0"+ "@modelcontextprotocol/sdk": "^1.0.0",+ "ws": "^8.18.0"},"devDependencies": {"@types/node": "^20.0.0",+ "@types/ws": "^8.5.13","typescript": "^5.0.0",- "ts-node": "^10.9.0"+ "ts-node": "^10.9.0",+ "vitest": "^2.1.0"},"engines": {"node": ">=18.0.0"diff --git a/screenpipe-integrations/screenpipe-mcp/src/export-video.test.ts b/screenpipe-integrations/screenpipe-mcp/src/export-video.test.tsnew file mode 100644index 000000000..932b91917--- /dev/null+++ b/screenpipe-integrations/screenpipe-mcp/src/export-video.test.ts@@ -0,0 +1,370 @@+import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";+import WebSocket, { WebSocketServer } from "ws";+import * as http from "http";+import * as fs from "fs";+import * as path from "path";+import * as os from "os";++// Mock the search API response+function createMockSearchResponse(frameIds: number[]) {+ return {+ data: frameIds.map((id, index) => ({+ type: "OCR",+ content: {+ frame_id: id,+ text: `Screen content ${index}`,+ timestamp: new Date(Date.now() - (frameIds.length - index) * 60000).toISOString(),+ app_name: "Test App",+ window_name: "Test Window",+ },+ })),+ };+}++// Mock video export progress messages+function createExportProgressMessages(frameCount: number): string[] {+ const messages = [];++ // Extracting phase+ for (let i = 0; i <= 10; i++) {+ messages.push(JSON.stringify({+ status: "extracting",+ progress: (i / 10) * 0.5,+ video_data: null,+ error: null,+ }));+ }++ // Encoding phase+ for (let i = 0; i <= 10; i++) {+ messages.push(JSON.stringify({+ status: "encoding",+ progress: 0.5 + (i / 10) * 0.5,+ video_data: null,+ error: null,+ }));+ }++ return messages;+}++describe("export-video MCP tool", () => {+ let mockHttpServer: http.Server;+ let mockWsServer: WebSocketServer;+ let serverPort: number;++ beforeEach(async () => {+ // Create a mock HTTP server for the search API+ mockHttpServer = http.createServer((req, res) => {+ const url = new URL(req.url!, `http://localhost`);++ if (url.pathname === "/search") {+ const startTime = url.searchParams.get("start_time");+ const endTime = url.searchParams.get("end_time");+ const contentType = url.searchParams.get("content_type");++ // Validate required parameters+ if (!startTime || !endTime) {+ res.writeHead(400, { "Content-Type": "application/json" });+ res.end(JSON.stringify({ error: "Missing time parameters" }));+ return;+ }++ // Return mock search results with frame IDs+ const mockResponse = createMockSearchResponse([100, 101, 102, 103, 104]);+ res.writeHead(200, { "Content-Type": "application/json" });+ res.end(JSON.stringify(mockResponse));+ } else {+ res.writeHead(404);+ res.end();+ }+ });++ // Create WebSocket server for export endpoint+ mockWsServer = new WebSocketServer({ noServer: true });++ mockHttpServer.on("upgrade", (request, socket, head) => {+ const url = new URL(request.url!, `http://localhost`);++ if (url.pathname === "/frames/export") {+ mockWsServer.handleUpgrade(request, socket, head, (ws) => {+ // Send progress updates+ const progressMessages = createExportProgressMessages(5);+ let messageIndex = 0;++ const sendProgress = setInterval(() => {+ if (messageIndex < progressMessages.length) {+ ws.send(progressMessages[messageIndex]);+ messageIndex++;+ } else {+ clearInterval(sendProgress);++ // Send completed message with mock video data+ const mockVideoData = Buffer.from("mock video content for testing");+ ws.send(JSON.stringify({+ status: "completed",+ progress: 1.0,+ video_data: Array.from(mockVideoData),+ error: null,+ }));+ }+ }, 10);+ });+ }+ });++ // Start the server on a random port+ await new Promise<void>((resolve) => {+ mockHttpServer.listen(0, () => {+ const address = mockHttpServer.address() as { port: number };+ serverPort = address.port;+ resolve();+ });+ });+ });++ afterEach(async () => {+ mockWsServer.close();+ await new Promise<void>((resolve) => {+ mockHttpServer.close(() => resolve());+ });+ });++ it("should parse ISO 8601 timestamps correctly", () => {+ const startTime = "2024-01-15T10:00:00Z";+ const endTime = "2024-01-15T10:30:00Z";++ const startDate = new Date(startTime);+ const endDate = new Date(endTime);++ expect(startDate.getTime()).toBeLessThan(endDate.getTime());+ expect(endDate.getTime() - startDate.getTime()).toBe(30 * 60 * 1000); // 30 minutes+ });++ it("should extract unique frame IDs from search results", () => {+ const searchResults = createMockSearchResponse([100, 101, 100, 102, 101, 103]);+ const frameIds: number[] = [];+ const seenIds = new Set<number>();++ for (const result of searchResults.data) {+ if (result.type === "OCR" && result.content?.frame_id) {+ const frameId = result.content.frame_id;+ if (!seenIds.has(frameId)) {+ seenIds.add(frameId);+ frameIds.push(frameId);+ }+ }+ }++ expect(frameIds).toEqual([100, 101, 102, 103]);+ expect(frameIds.length).toBe(4);+ });++ it("should handle empty search results", () => {+ const emptyResults = { data: [] };++ const frameIds: number[] = [];+ for (const result of emptyResults.data) {+ if ((result as any).type === "OCR" && (result as any).content?.frame_id) {+ frameIds.push((result as any).content.frame_id);+ }+ }++ expect(frameIds.length).toBe(0);+ });++ it("should build correct WebSocket URL with frame IDs", () => {+ const frameIds = [100, 101, 102];+ const fps = 1.0;+ const port = 3030;++ const wsUrl = `ws://localhost:${port}/frames/export?frame_ids=${frameIds.join(",")}&fps=${fps}`;++ expect(wsUrl).toBe("ws://localhost:3030/frames/export?frame_ids=100,101,102&fps=1");+ });++ it("should connect to mock WebSocket server and receive messages", async () => {+ const wsUrl = `ws://localhost:${serverPort}/frames/export?frame_ids=100,101,102&fps=1`;++ const result = await new Promise<{ success: boolean; data?: any; error?: string }>((resolve) => {+ const ws = new WebSocket(wsUrl);+ let lastMessage: any;++ ws.on("error", (error) => {+ resolve({ success: false, error: error.message });+ });++ ws.on("message", (data) => {+ try {+ lastMessage = JSON.parse(data.toString());++ if (lastMessage.status === "completed") {+ ws.close();+ resolve({ success: true, data: lastMessage });+ }+ } catch (e) {+ // Ignore parse errors+ }+ });++ ws.on("close", () => {+ if (!lastMessage || lastMessage.status !== "completed") {+ resolve({ success: false, error: "Connection closed before completion" });+ }+ });++ // Timeout after 5 seconds+ setTimeout(() => {+ ws.close();+ resolve({ success: false, error: "Timeout" });+ }, 5000);+ });++ expect(result.success).toBe(true);+ expect(result.data).toBeDefined();+ expect(result.data.status).toBe("completed");+ expect(result.data.video_data).toBeDefined();+ expect(Array.isArray(result.data.video_data)).toBe(true);+ });++ it("should save video data to temp file", () => {+ const mockVideoData = Buffer.from("mock video content");+ const tempDir = os.tmpdir();+ const timestamp = new Date().toISOString().replace(/[:.]/g, "-");+ const filename = `screenpipe_export_test_${timestamp}.mp4`;+ const filePath = path.join(tempDir, filename);++ fs.writeFileSync(filePath, mockVideoData);++ expect(fs.existsSync(filePath)).toBe(true);++ const readData = fs.readFileSync(filePath);+ expect(readData.toString()).toBe("mock video content");++ // Cleanup+ fs.unlinkSync(filePath);+ });++ it("should sort frame IDs in ascending order", () => {+ const unsortedIds = [103, 100, 105, 101, 102];+ const sortedIds = [...unsortedIds].sort((a, b) => a - b);++ expect(sortedIds).toEqual([100, 101, 102, 103, 105]);+ });++ it("should handle search API errors gracefully", async () => {+ // Create a server that returns an error+ const errorServer = http.createServer((req, res) => {+ res.writeHead(500, { "Content-Type": "application/json" });+ res.end(JSON.stringify({ error: "Internal server error" }));+ });++ await new Promise<void>((resolve) => {+ errorServer.listen(0, () => resolve());+ });++ const address = errorServer.address() as { port: number };+ const port = address.port;++ try {+ const response = await fetch(`http://localhost:${port}/search?start_time=2024-01-01T00:00:00Z&end_time=2024-01-01T01:00:00Z`);+ expect(response.ok).toBe(false);+ expect(response.status).toBe(500);+ } finally {+ await new Promise<void>((resolve) => {+ errorServer.close(() => resolve());+ });+ }+ });++ it("should handle WebSocket connection errors", async () => {+ const ws = new WebSocket("ws://localhost:59999/invalid"); // Port that's not listening++ const result = await new Promise<{ connected: boolean; error?: string }>((resolve) => {+ ws.on("open", () => {+ resolve({ connected: true });+ });++ ws.on("error", (error) => {+ resolve({ connected: false, error: error.message });+ });++ setTimeout(() => {+ resolve({ connected: false, error: "Timeout" });+ }, 2000);+ });++ expect(result.connected).toBe(false);+ });++ it("should validate time range parameters", () => {+ const startTime = "2024-01-15T10:30:00Z";+ const endTime = "2024-01-15T10:00:00Z"; // End before start++ const startDate = new Date(startTime);+ const endDate = new Date(endTime);++ // This should be invalid (end before start)+ expect(endDate.getTime()).toBeLessThan(startDate.getTime());+ });++ it("should handle audio-only results (no frame IDs)", () => {+ const audioOnlyResults = {+ data: [+ {+ type: "Audio",+ content: {+ transcription: "Hello world",+ timestamp: "2024-01-15T10:00:00Z",+ device_name: "Microphone",+ },+ },+ {+ type: "Audio",+ content: {+ transcription: "How are you",+ timestamp: "2024-01-15T10:01:00Z",+ device_name: "Microphone",+ },+ },+ ],+ };++ const frameIds: number[] = [];+ for (const result of audioOnlyResults.data) {+ if (result.type === "OCR" && (result.content as any)?.frame_id) {+ frameIds.push((result.content as any).frame_id);+ }+ }++ expect(frameIds.length).toBe(0);+ });+});++describe("export-video tool schema validation", () => {+ it("should have correct input schema", () => {+ const schema = {+ type: "object",+ properties: {+ start_time: {+ type: "string",+ format: "date-time",+ },+ end_time: {+ type: "string",+ format: "date-time",+ },+ fps: {+ type: "number",+ default: 1.0,+ },+ },+ required: ["start_time", "end_time"],+ };++ expect(schema.required).toContain("start_time");+ expect(schema.required).toContain("end_time");+ expect(schema.required).not.toContain("fps"); // fps is optional+ expect(schema.properties.fps.default).toBe(1.0);+ });+});diff --git a/screenpipe-integrations/screenpipe-mcp/src/index.ts b/screenpipe-integrations/screenpipe-mcp/src/index.tsindex 654093470..e03e4c5d9 100644--- a/screenpipe-integrations/screenpipe-mcp/src/index.ts+++ b/screenpipe-integrations/screenpipe-mcp/src/index.ts@@ -7,6 +7,10 @@ import {ListToolsRequestSchema,Tool,} from "@modelcontextprotocol/sdk/types.js";+import { WebSocket } from "ws";+import * as fs from "fs";+import * as path from "path";+import * as os from "os";// Detect OSconst CURRENT_OS = process.platform;@@ -157,6 +161,37 @@ const BASE_TOOLS: Tool[] = [required: ["action_type", "data"],},},+ {+ name: "export-video",+ description:+ "Export a video of screen recordings for a specific time range. " ++ "Creates an MP4 video from the recorded frames between the start and end times. " ++ "Example: 'Export video from 10:00 AM to 10:30 AM today'",+ inputSchema: {+ type: "object",+ properties: {+ start_time: {+ type: "string",+ format: "date-time",+ description:+ "Start time in ISO 8601 format UTC (e.g., '2024-01-15T10:00:00Z')",+ },+ end_time: {+ type: "string",+ format: "date-time",+ description:+ "End time in ISO 8601 format UTC (e.g., '2024-01-15T10:30:00Z')",+ },+ fps: {+ type: "number",+ description:+ "Frames per second for the output video. Lower values create smaller files. Default: 1.0",+ default: 1.0,+ },+ },+ required: ["start_time", "end_time"],+ },+ },];const MACOS_TOOLS: Tool[] = [@@ -555,6 +590,172 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {};}+ case "export-video": {+ const startTime = args.start_time as string;+ const endTime = args.end_time as string;+ const fps = (args.fps as number) || 1.0;++ // Validate time inputs+ if (!startTime || !endTime) {+ return {+ content: [+ {+ type: "text",+ text: "Error: Both start_time and end_time are required in ISO 8601 format (e.g., '2024-01-15T10:00:00Z')",+ },+ ],+ };+ }++ // Step 1: Query the search API to get frame IDs for the time range+ const searchParams = new URLSearchParams({+ content_type: "ocr",+ start_time: startTime,+ end_time: endTime,+ limit: "10000", // Get all frames in range+ });++ const searchResponse = await fetchAPI(`/search?${searchParams.toString()}`);+ if (!searchResponse.ok) {+ throw new Error(`Failed to search for frames: HTTP ${searchResponse.status}`);+ }++ const searchData = await searchResponse.json();+ const results = searchData.data || [];++ if (results.length === 0) {+ return {+ content: [+ {+ type: "text",+ text: `No screen recordings found between ${startTime} and ${endTime}. Make sure screenpipe was recording during this time period.`,+ },+ ],+ };+ }++ // Extract unique frame IDs from OCR results+ const frameIds: number[] = [];+ const seenIds = new Set<number>();+ for (const result of results) {+ if (result.type === "OCR" && result.content?.frame_id) {+ const frameId = result.content.frame_id;+ if (!seenIds.has(frameId)) {+ seenIds.add(frameId);+ frameIds.push(frameId);+ }+ }+ }++ if (frameIds.length === 0) {+ return {+ content: [+ {+ type: "text",+ text: `Found ${results.length} results but no valid frame IDs. The recordings may be audio-only.`,+ },+ ],+ };+ }++ // Sort frame IDs+ frameIds.sort((a, b) => a - b);++ // Step 2: Connect to WebSocket and export video+ const wsUrl = `ws://localhost:${port}/frames/export?frame_ids=${frameIds.join(",")}&fps=${fps}`;++ const exportResult = await new Promise<{+ success: boolean;+ filePath?: string;+ error?: string;+ frameCount?: number;+ }>((resolve) => {+ const ws = new WebSocket(wsUrl);+ let resolved = false;++ const timeout = setTimeout(() => {+ if (!resolved) {+ resolved = true;+ ws.close();+ resolve({ success: false, error: "Export timed out after 5 minutes" });+ }+ }, 5 * 60 * 1000); // 5 minute timeout++ ws.on("error", (error) => {+ if (!resolved) {+ resolved = true;+ clearTimeout(timeout);+ resolve({ success: false, error: `WebSocket error: ${error.message}` });+ }+ });++ ws.on("close", () => {+ if (!resolved) {+ resolved = true;+ clearTimeout(timeout);+ resolve({ success: false, error: "Connection closed unexpectedly" });+ }+ });++ ws.on("message", (data) => {+ try {+ const message = JSON.parse(data.toString());++ if (message.status === "completed" && message.video_data) {+ // Save video to temp file+ const tempDir = os.tmpdir();+ const timestamp = new Date().toISOString().replace(/[:.]/g, "-");+ const filename = `screenpipe_export_${timestamp}.mp4`;+ const filePath = path.join(tempDir, filename);++ fs.writeFileSync(filePath, Buffer.from(message.video_data));++ resolved = true;+ clearTimeout(timeout);+ ws.close();+ resolve({+ success: true,+ filePath,+ frameCount: frameIds.length,+ });+ } else if (message.status === "error") {+ resolved = true;+ clearTimeout(timeout);+ ws.close();+ resolve({ success: false, error: message.error || "Export failed" });+ }+ // Ignore "extracting" and "encoding" status updates+ } catch (parseError) {+ // Ignore parse errors for progress messages+ }+ });+ });++ if (exportResult.success && exportResult.filePath) {+ return {+ content: [+ {+ type: "text",+ text: `Successfully exported video!\n\n` ++ `File: ${exportResult.filePath}\n` ++ `Frames: ${exportResult.frameCount}\n` ++ `Time range: ${startTime} to ${endTime}\n` ++ `FPS: ${fps}`,+ },+ ],+ };+ } else {+ return {+ content: [+ {+ type: "text",+ text: `Failed to export video: ${exportResult.error}`,+ },+ ],+ };+ }+ }+case "click-element": {const selector = {app_name: args.app,diff --git a/screenpipe-integrations/screenpipe-mcp/vitest.config.ts b/screenpipe-integrations/screenpipe-mcp/vitest.config.tsnew file mode 100644index 000000000..9f7da2178--- /dev/null+++ b/screenpipe-integrations/screenpipe-mcp/vitest.config.ts@@ -0,0 +1,13 @@+import { defineConfig } from "vitest/config";++export default defineConfig({+ test: {+ globals: true,+ environment: "node",+ include: ["src/**/*.test.ts"],+ coverage: {+ provider: "v8",+ reporter: ["text", "html"],+ },+ },+});diff --git a/screenpipe-server/Cargo.toml b/screenpipe-server/Cargo.tomlindex f18ef2883..57f2943e1 100644--- a/screenpipe-server/Cargo.toml+++ b/screenpipe-server/Cargo.toml@@ -23,6 +23,7 @@ killport = { version = "1.1.0" }# Image processingimage = { workspace = true }+imageproc = "0.25"# Dateschrono = { version = "0.4.31", features = ["serde"] }diff --git a/screenpipe-server/src/server.rs b/screenpipe-server/src/server.rsindex 50bbabe3a..92f6f6b22 100644--- a/screenpipe-server/src/server.rs+++ b/screenpipe-server/src/server.rs@@ -27,7 +27,7 @@ use futures::{future::{try_join, try_join_all},SinkExt, StreamExt,};-use image::ImageFormat::{self};+use image::{GenericImageView, ImageFormat};use screenpipe_events::{send_event, subscribe_to_all_events, Event as ScreenpipeEvent};use crate::{@@ -36,10 +36,12 @@ use crate::{video_cache::{AudioEntry, DeviceFrame, FrameCache, FrameMetadata, TimeSeriesFrame},video_utils::{extract_frame, extract_frame_from_video, extract_high_quality_frame, merge_videos,- validate_media, MergeVideosRequest, MergeVideosResponse, ValidateMediaParams,+ redact_frame_pii, validate_media, MergeVideosRequest, MergeVideosResponse,+ ValidateMediaParams,},PipeManager,};+use screenpipe_core::pii_removal::detect_pii_regions;use chrono::{DateTime, Utc};use screenpipe_audio::{audio_manager::AudioManager,@@ -2787,33 +2789,45 @@ pub struct KeywordSearchRequest {app_names: Option<Vec<String>>,}+/// Query parameters for frame retrieval+#[derive(Debug, Deserialize, OaSchema)]+pub struct GetFrameQuery {+ /// If true, blur/redact any detected PII (credit cards, SSNs, emails) in the frame+ #[serde(default)]+ pub redact_pii: bool,+}+#[oasgen]pub async fn get_frame_data(State(state): State<Arc<AppState>>,Path(frame_id): Path<i64>,+ Query(query): Query<GetFrameQuery>,) -> Result<Response<Body>, (StatusCode, JsonResponse<Value>)> {let start_time = Instant::now();match timeout(Duration::from_secs(5), async {- // Try to get frame from cache if enabled- if let Some(cache) = &state.frame_image_cache {- let cache_result = cache.try_lock();- match cache_result {- Ok(mut cache) => {- if let Some((file_path, timestamp)) = cache.get(&frame_id) {- if timestamp.elapsed() < Duration::from_secs(300) {- debug!(- "Cache hit for frame_id: {}. Retrieved in {:?}",- frame_id,- start_time.elapsed()- );- return serve_file(file_path).await;+ // Skip cache if redact_pii is requested (need fresh processing)+ if !query.redact_pii {+ // Try to get frame from cache if enabled+ if let Some(cache) = &state.frame_image_cache {+ let cache_result = cache.try_lock();+ match cache_result {+ Ok(mut cache) => {+ if let Some((file_path, timestamp)) = cache.get(&frame_id) {+ if timestamp.elapsed() < Duration::from_secs(300) {+ debug!(+ "Cache hit for frame_id: {}. Retrieved in {:?}",+ frame_id,+ start_time.elapsed()+ );+ return serve_file(file_path).await;+ }+ cache.pop(&frame_id);}- cache.pop(&frame_id);}- }- Err(_) => {- debug!("Cache lock contention for frame_id: {}", frame_id);+ Err(_) => {+ debug!("Cache lock contention for frame_id: {}", frame_id);+ }}}}@@ -2823,6 +2837,11 @@ pub async fn get_frame_data(Ok(Some((file_path, offset_index))) => {match extract_frame_from_video(&file_path, offset_index).await {Ok(frame_path) => {+ // Apply PII redaction if requested+ if query.redact_pii {+ return apply_pii_redaction(&state, frame_id, &frame_path).await;+ }+// Store in cache if enabled and we can get the lockif let Some(cache) = &state.frame_image_cache {if let Ok(mut cache) = cache.try_lock() {@@ -2878,6 +2897,92 @@ pub async fn get_frame_data(}}+/// Apply PII redaction to a frame image+async fn apply_pii_redaction(+ state: &Arc<AppState>,+ frame_id: i64,+ frame_path: &str,+) -> Result<Response<Body>, (StatusCode, JsonResponse<Value>)> {+ // Read the frame file+ let frame_data = match tokio::fs::read(frame_path).await {+ Ok(data) => data,+ Err(e) => {+ error!("Failed to read frame file for PII redaction: {}", e);+ return serve_file(frame_path).await; // Fall back to unredacted+ }+ };++ // Get OCR text_json for this frame+ let text_json_str = match state.db.get_frame_ocr_text_json(frame_id).await {+ Ok(Some(json)) => json,+ Ok(None) => {+ debug!("No OCR data for frame {}, serving unredacted", frame_id);+ return serve_file(frame_path).await;+ }+ Err(e) => {+ error!("Failed to get OCR data for frame {}: {}", frame_id, e);+ return serve_file(frame_path).await;+ }+ };++ // Parse the text_json+ let text_json: Vec<HashMap<String, String>> = match serde_json::from_str(&text_json_str) {+ Ok(json) => json,+ Err(e) => {+ debug!("Failed to parse OCR text_json: {}", e);+ return serve_file(frame_path).await;+ }+ };++ // Get image dimensions+ let img = match image::load_from_memory(&frame_data) {+ Ok(img) => img,+ Err(e) => {+ error!("Failed to load image for PII detection: {}", e);+ return serve_file(frame_path).await;+ }+ };+ let (width, height) = img.dimensions();++ // Detect PII regions+ let pii_regions = detect_pii_regions(&text_json, width, height);++ if pii_regions.is_empty() {+ debug!("No PII detected in frame {}", frame_id);+ return serve_file(frame_path).await;+ }++ debug!(+ "Detected {} PII regions in frame {}: {:?}",+ pii_regions.len(),+ frame_id,+ pii_regions.iter().map(|r| &r.pii_type).collect::<Vec<_>>()+ );++ // Apply redaction+ match redact_frame_pii(&frame_data, &pii_regions) {+ Ok(redacted_data) => {+ let body = Body::from(redacted_data);+ Response::builder()+ .header("content-type", "image/jpeg")+ .header("cache-control", "no-cache") // Don't cache redacted frames+ .header("x-pii-redacted", "true")+ .header("x-pii-regions-count", pii_regions.len().to_string())+ .body(body)+ .map_err(|e| {+ (+ StatusCode::INTERNAL_SERVER_ERROR,+ JsonResponse(json!({"error": format!("Failed to create response: {}", e)})),+ )+ })+ }+ Err(e) => {+ error!("Failed to redact PII from frame {}: {}", frame_id, e);+ serve_file(frame_path).await // Fall back to unredacted+ }+ }+}+async fn serve_file(path: &str) -> Result<Response, (StatusCode, JsonResponse<Value>)> {match File::open(path).await {Ok(file) => {diff --git a/screenpipe-server/src/video_utils.rs b/screenpipe-server/src/video_utils.rsindex b668e8aca..d97da3221 100644--- a/screenpipe-server/src/video_utils.rs+++ b/screenpipe-server/src/video_utils.rs@@ -2,11 +2,15 @@ use anyhow::Result;use base64::{engine::general_purpose, Engine as _};use chrono::NaiveDateTime;use chrono::{DateTime, Utc};-use image::DynamicImage;+use image::codecs::jpeg::JpegEncoder;+use image::{DynamicImage, GenericImageView, Rgba};+use imageproc::filter::gaussian_blur_f32;use oasgen::OaSchema;use screenpipe_core::find_ffmpeg_path;+use screenpipe_core::pii_removal::PiiRegion;use screenpipe_db::VideoMetadata as DBVideoMetadata;use serde::{Deserialize, Serialize};+use std::io::Cursor;use std::path::Path;use std::path::PathBuf;use tokio::io::AsyncReadExt;@@ -711,3 +715,216 @@ pub async fn extract_high_quality_frame(Ok(output_path.to_str().unwrap().to_string())}++/// Redact PII regions from a frame image by applying blur+///+/// # Arguments+/// * `image_data` - Raw JPEG image bytes+/// * `regions` - Vector of PII regions to blur+///+/// # Returns+/// Result containing the modified JPEG image bytes+pub fn redact_frame_pii(image_data: &[u8], regions: &[PiiRegion]) -> Result<Vec<u8>> {+ if regions.is_empty() {+ // No PII to redact, return original+ return Ok(image_data.to_vec());+ }++ // Load the image+ let img = image::load_from_memory(image_data)?;+ let mut img_rgba = img.to_rgba8();+ let (img_width, img_height) = img_rgba.dimensions();++ for region in regions {+ // Validate region bounds+ if region.x >= img_width || region.y >= img_height {+ continue;+ }++ // Clamp region to image bounds+ let x = region.x;+ let y = region.y;+ let w = region.width.min(img_width - x);+ let h = region.height.min(img_height - y);++ if w == 0 || h == 0 {+ continue;+ }++ // Extract the region to blur+ let sub_img = img_rgba.view(x, y, w, h).to_image();++ // Apply Gaussian blur (sigma of 10.0 provides strong blur)+ let blurred = gaussian_blur_f32(&sub_img, 10.0);++ // Copy blurred region back to the image+ for (dx, dy, pixel) in blurred.enumerate_pixels() {+ let target_x = x + dx;+ let target_y = y + dy;+ if target_x < img_width && target_y < img_height {+ img_rgba.put_pixel(target_x, target_y, *pixel);+ }+ }+ }++ // Encode back to JPEG+ let mut output = Cursor::new(Vec::new());+ let mut encoder = JpegEncoder::new_with_quality(&mut output, 85);+ encoder.encode_image(&img_rgba)?;++ Ok(output.into_inner())+}++/// Alternative redaction method using solid color overlay instead of blur+/// This is faster but less visually appealing+pub fn redact_frame_pii_solid(image_data: &[u8], regions: &[PiiRegion]) -> Result<Vec<u8>> {+ if regions.is_empty() {+ return Ok(image_data.to_vec());+ }++ let img = image::load_from_memory(image_data)?;+ let mut img_rgba = img.to_rgba8();+ let (img_width, img_height) = img_rgba.dimensions();++ // Use a dark gray color for redaction+ let redact_color = Rgba([40, 40, 40, 255]);++ for region in regions {+ if region.x >= img_width || region.y >= img_height {+ continue;+ }++ let x_end = (region.x + region.width).min(img_width);+ let y_end = (region.y + region.height).min(img_height);++ for py in region.y..y_end {+ for px in region.x..x_end {+ img_rgba.put_pixel(px, py, redact_color);+ }+ }+ }++ let mut output = Cursor::new(Vec::new());+ let mut encoder = JpegEncoder::new_with_quality(&mut output, 85);+ encoder.encode_image(&img_rgba)?;++ Ok(output.into_inner())+}++#[cfg(test)]+mod pii_redaction_tests {+ use super::*;+ use image::{ImageBuffer, Rgb};++ fn create_test_jpeg() -> Vec<u8> {+ // Create a simple 100x100 white image+ let img: ImageBuffer<Rgb<u8>, Vec<u8>> = ImageBuffer::from_fn(100, 100, |_, _| {+ Rgb([255, 255, 255])+ });+ let dynamic_img = DynamicImage::ImageRgb8(img);++ let mut output = Cursor::new(Vec::new());+ let mut encoder = JpegEncoder::new_with_quality(&mut output, 85);+ encoder.encode_image(&dynamic_img).unwrap();+ output.into_inner()+ }++ #[test]+ fn test_redact_frame_pii_empty_regions() {+ let image_data = create_test_jpeg();+ let regions: Vec<PiiRegion> = vec![];++ let result = redact_frame_pii(&image_data, ®ions).unwrap();+ assert_eq!(result, image_data);+ }++ #[test]+ fn test_redact_frame_pii_single_region() {+ let image_data = create_test_jpeg();+ let regions = vec![PiiRegion {+ x: 10,+ y: 10,+ width: 30,+ height: 20,+ pii_type: "CREDIT_CARD".to_string(),+ }];++ let result = redact_frame_pii(&image_data, ®ions).unwrap();+ // Result should be different from original (blurred)+ assert_ne!(result, image_data);+ // Should still be a valid image+ assert!(image::load_from_memory(&result).is_ok());+ }++ #[test]+ fn test_redact_frame_pii_multiple_regions() {+ let image_data = create_test_jpeg();+ let regions = vec![+ PiiRegion {+ x: 10,+ y: 10,+ width: 20,+ height: 15,+ pii_type: "CREDIT_CARD".to_string(),+ },+ PiiRegion {+ x: 50,+ y: 50,+ width: 25,+ height: 20,+ pii_type: "EMAIL".to_string(),+ },+ ];++ let result = redact_frame_pii(&image_data, ®ions).unwrap();+ assert!(image::load_from_memory(&result).is_ok());+ }++ #[test]+ fn test_redact_frame_pii_region_at_edge() {+ let image_data = create_test_jpeg();+ // Region that extends beyond image bounds+ let regions = vec![PiiRegion {+ x: 90,+ y: 90,+ width: 50, // Would extend beyond 100px image+ height: 50,+ pii_type: "SSN".to_string(),+ }];++ let result = redact_frame_pii(&image_data, ®ions).unwrap();+ assert!(image::load_from_memory(&result).is_ok());+ }++ #[test]+ fn test_redact_frame_pii_region_outside_bounds() {+ let image_data = create_test_jpeg();+ // Region completely outside image+ let regions = vec![PiiRegion {+ x: 200,+ y: 200,+ width: 50,+ height: 50,+ pii_type: "EMAIL".to_string(),+ }];++ let result = redact_frame_pii(&image_data, ®ions).unwrap();+ // Should return valid image unchanged (region was skipped)+ assert!(image::load_from_memory(&result).is_ok());+ }++ #[test]+ fn test_redact_frame_pii_solid() {+ let image_data = create_test_jpeg();+ let regions = vec![PiiRegion {+ x: 10,+ y: 10,+ width: 30,+ height: 20,+ pii_type: "CREDIT_CARD".to_string(),+ }];++ let result = redact_frame_pii_solid(&image_data, ®ions).unwrap();+ assert!(image::load_from_memory(&result).is_ok());+ }+}diff --git a/screenpipe-server/tests/endpoint_test.rs b/screenpipe-server/tests/endpoint_test.rsindex 58ff58658..e1d09e809 100644--- a/screenpipe-server/tests/endpoint_test.rs+++ b/screenpipe-server/tests/endpoint_test.rs@@ -48,7 +48,7 @@ mod tests {false,false,audio_manager,- true+ true,);let router = app.create_router(true).await;diff --git a/screenpipe-vision/src/microsoft.rs b/screenpipe-vision/src/microsoft.rsindex f9e4bd1d4..2a635da6a 100644--- a/screenpipe-vision/src/microsoft.rs+++ b/screenpipe-vision/src/microsoft.rs@@ -37,13 +37,48 @@ pub async fn perform_ocr_windows(image: &DynamicImage) -> Result<(String, Stringlet engine = WindowsOcrEngine::TryCreateFromUserProfileLanguages()?;let result = engine.RecognizeAsync(&bitmap)?.get()?;- let text = result.Text()?.to_string();+ let mut full_text = String::new();+ let mut ocr_results: Vec<serde_json::Value> = Vec::new();- let json_output = serde_json::json!([{- "text": text,- "confidence": "1.0" // Windows OCR doesn't provide confidence scores- }])- .to_string();+ // Iterate through lines and words to get bounding boxes+ if let Ok(lines) = result.Lines() {+ for line in lines {+ if let Ok(words) = line.Words() {+ for word in words {+ if let Ok(text) = word.Text() {+ let text_str = text.to_string();+ if !text_str.is_empty() {+ if !full_text.is_empty() {+ full_text.push(' ');+ }+ full_text.push_str(&text_str);- Ok((text, json_output, Some(1.0)))+ // Get bounding box for PII redaction support+ if let Ok(rect) = word.BoundingRect() {+ ocr_results.push(serde_json::json!({+ "text": text_str,+ "left": rect.X.to_string(),+ "top": rect.Y.to_string(),+ "width": rect.Width.to_string(),+ "height": rect.Height.to_string(),+ "conf": "1.0" // Windows OCR doesn't provide word-level confidence+ }));+ }+ }+ }+ }+ }+ }+ }++ // Fallback if iteration failed+ if full_text.is_empty() {+ if let Ok(text) = result.Text() {+ full_text = text.to_string();+ }+ }++ let json_output = serde_json::to_string(&ocr_results).unwrap_or_else(|_| "[]".to_string());++ Ok((full_text, json_output, Some(1.0)))}diff --git a/screenpipe-vision/src/tesseract.rs b/screenpipe-vision/src/tesseract.rsindex 1c1c518ae..e2a937470 100644--- a/screenpipe-vision/src/tesseract.rs+++ b/screenpipe-vision/src/tesseract.rs@@ -58,53 +58,31 @@ fn data_output_to_text(data_output: &DataOutput) -> String {}fn data_output_to_json(data_output: &DataOutput) -> String {- let mut lines: Vec<HashMap<String, String>> = Vec::new();- let mut current_line = String::new();- let mut current_conf = 0.0;- let mut word_count = 0;- let mut last_word_num = 0;+ let mut words: Vec<HashMap<String, String>> = Vec::new();for record in &data_output.data {- if record.word_num == 0 && !current_line.is_empty() {- let avg_conf = current_conf / word_count as f32;- let mut line_data = HashMap::new();- line_data.insert("text".to_string(), current_line.clone());- line_data.insert("confidence".to_string(), format!("{:.2}", avg_conf));- line_data.insert(- "line_position".to_string(),- format!(- "level{}page_num{}block_num{}par_num{}line_num{}",- record.level,- record.page_num,- record.block_num,- record.par_num,- record.line_num- ),- );- lines.push(line_data);- current_line.clear();- current_conf = 0.0;- word_count = 0;+ // Only include records that have text (word_num > 0 means it's a word)+ if record.word_num > 0 && !record.text.is_empty() {+ let mut word_data = HashMap::new();+ word_data.insert("text".to_string(), record.text.clone());+ word_data.insert("conf".to_string(), format!("{:.2}", record.conf));+ // Include bounding box coordinates for PII redaction+ word_data.insert("left".to_string(), record.left.to_string());+ word_data.insert("top".to_string(), record.top.to_string());+ word_data.insert("width".to_string(), record.width.to_string());+ word_data.insert("height".to_string(), record.height.to_string());+ // Include position metadata+ word_data.insert("level".to_string(), record.level.to_string());+ word_data.insert("page_num".to_string(), record.page_num.to_string());+ word_data.insert("block_num".to_string(), record.block_num.to_string());+ word_data.insert("par_num".to_string(), record.par_num.to_string());+ word_data.insert("line_num".to_string(), record.line_num.to_string());+ word_data.insert("word_num".to_string(), record.word_num.to_string());+ words.push(word_data);}- if record.word_num > last_word_num {- if !current_line.is_empty() {- current_line.push(' ');- }- current_line.push_str(&record.text);- current_conf += record.conf;- word_count += 1;- }- last_word_num = record.word_num;- }- if !current_line.is_empty() {- let avg_conf = current_conf / word_count as f32;- let mut line_data = HashMap::new();- line_data.insert("text".to_string(), current_line);- line_data.insert("confidence".to_string(), format!("{:.2}", avg_conf));- lines.push(line_data);}- serde_json::to_string_pretty(&lines).unwrap()+ serde_json::to_string(&words).unwrap_or_else(|_| "[]".to_string())}fn calculate_overall_confidence(data_output: &DataOutput) -> f64 {