Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: make screenpipe-js node/browser compatible

Louis Beaumont02c04e3bad63
diff --git a/pipes/search/bun.lockb b/pipes/search/bun.lockb
index b79a47aa7..72144bfcc 100755
Binary files a/pipes/search/bun.lockb and b/pipes/search/bun.lockb differ
diff --git a/pipes/search/next.config.ts b/pipes/search/next.config.ts
index e1d79b7a3..b3978a6a4 100644
--- a/pipes/search/next.config.ts
+++ b/pipes/search/next.config.ts
@@ -1,24 +1,15 @@
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
- transpilePackages: ['@screenpipe/js'],
+ transpilePackages: ["@screenpipe/js"],
webpack: (config, { isServer }) => {
- if (!isServer) {
- // don't resolve 'fs' module on the client to prevent this error on build --> Error: Can't resolve 'fs'
- config.resolve.fallback = {
- fs: false,
- net: false,
- tls: false,
- child_process: false,
- "stream": false,
- "crypto": false,
- "zlib": false,
- "http": false,
- "https": false,
- "path": false,
- }
- }
- return config
+ config.resolve.alias = {
+ ...config.resolve.alias,
+ "@screenpipe/js": isServer
+ ? "@screenpipe/js/dist/node.js"
+ : "@screenpipe/js/dist/browser.js",
+ };
+ return config;
},
};
diff --git a/pipes/search/package.json b/pipes/search/package.json
index 619e09cbc..36d4e8208 100644
--- a/pipes/search/package.json
+++ b/pipes/search/package.json
@@ -22,7 +22,7 @@
"@radix-ui/react-switch": "^1.1.2",
"@radix-ui/react-toast": "^1.2.3",
"@radix-ui/react-tooltip": "^1.1.5",
- "@screenpipe/js": "0.1.10-beta.11",
+ "@screenpipe/js": "0.1.10-beta.18",
"@shadcn/ui": "^0.0.4",
"@tanstack/react-query": "^5.62.7",
"@types/js-levenshtein": "^1.1.3",
diff --git a/pipes/search/src/app/api/settings/route.ts b/pipes/search/src/app/api/settings/route.ts
new file mode 100644
index 000000000..8d4a2b4fc
--- /dev/null
+++ b/pipes/search/src/app/api/settings/route.ts
@@ -0,0 +1,80 @@
+// app/api/settings/route.ts
+import { pipe } from "@screenpipe/js";
+import { NextResponse } from "next/server";
+import type { Settings } from "@screenpipe/js";
+// Force Node.js runtime
+export const runtime = "nodejs"; // Add this line
+export const dynamic = 'force-dynamic'
+
+export async function GET() {
+ const defaultSettings: Settings = {
+ openaiApiKey: "",
+ deepgramApiKey: "",
+ aiModel: "gpt-4",
+ aiUrl: "https://api.openai.com/v1",
+ customPrompt: "",
+ port: 3030,
+ dataDir: "default",
+ disableAudio: false,
+ ignoredWindows: [],
+ includedWindows: [],
+ aiProviderType: "openai",
+ embeddedLLM: {
+ enabled: false,
+ model: "llama3.2:1b-instruct-q4_K_M",
+ port: 11438,
+ },
+ enableFrameCache: true,
+ enableUiMonitoring: false,
+ aiMaxContextChars: 128000,
+ };
+
+ try {
+ const settingsManager = pipe.settings;
+ if (!settingsManager) {
+ throw new Error("settingsManager not found");
+ }
+ const rawSettings = await settingsManager.getAll();
+ return NextResponse.json(rawSettings);
+ } catch (error) {
+ console.error("failed to get settings:", error);
+ return NextResponse.json(defaultSettings);
+ }
+}
+
+export async function PUT(request: Request) {
+ try {
+ const settingsManager = pipe.settings;
+ if (!settingsManager) {
+ throw new Error("settingsManager not found");
+ }
+
+ const body = await request.json();
+ const { key, value, isPartialUpdate, reset } = body;
+
+ if (reset) {
+ if (key) {
+ await settingsManager.resetKey(key);
+ } else {
+ await settingsManager.reset();
+ }
+ return NextResponse.json({ success: true });
+ }
+
+ if (isPartialUpdate) {
+ const serializedSettings = JSON.parse(JSON.stringify(value));
+ await settingsManager.update(serializedSettings);
+ } else {
+ const serializedValue = JSON.parse(JSON.stringify(value));
+ await settingsManager.set(key, serializedValue);
+ }
+
+ return NextResponse.json({ success: true });
+ } catch (error) {
+ console.error("failed to update settings:", error);
+ return NextResponse.json(
+ { error: "failed to update settings" },
+ { status: 500 }
+ );
+ }
+}
diff --git a/pipes/search/src/components/search-chat.tsx b/pipes/search/src/components/search-chat.tsx
index 98a99a9f2..267db3a50 100644
--- a/pipes/search/src/components/search-chat.tsx
+++ b/pipes/search/src/components/search-chat.tsx
@@ -4,7 +4,7 @@ import React, { JSX, useEffect, useRef, useState } from "react";
import { Input } from "@/components/ui/input";
import { Button } from "@/components/ui/button";
import { Card, CardContent } from "@/components/ui/card";
-import { queryScreenpipe, ContentItem } from "@screenpipe/js";
+import { pipe, ContentItem } from "@screenpipe/js";
import { Skeleton } from "@/components/ui/skeleton";
import { Slider } from "@/components/ui/slider";
import { Switch } from "@/components/ui/switch";
@@ -72,10 +72,16 @@ import { IconCode } from "@/components/ui/icons";
import { CodeBlock } from "@/components/ui/codeblock";
import { SqlAutocompleteInput } from "@/components/sql-autocomplete-input";
import { cn, removeDuplicateSelections } from "@/lib/utils";
-import { ExampleSearch, ExampleSearchCards } from "@/components/example-search-cards";
+import {
+ ExampleSearch,
+ ExampleSearchCards,
+} from "@/components/example-search-cards";
import { useDebounce } from "@/lib/hooks/use-debounce";
import { useHealthCheck } from "@/lib/hooks/use-health-check";
-import { SearchHistory, useSearchHistory } from "@/lib/hooks/use-search-history";
+import {
+ SearchHistory,
+ useSearchHistory,
+} from "@/lib/hooks/use-search-history";
import {
CommandInput,
CommandList,
@@ -85,11 +91,13 @@ import {
Command,
} from "./ui/command";
import { Speaker } from "@screenpipe/js";
-import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/components/ui/popover";
import { useSettings } from "@/lib/hooks/use-settings";
-
-
interface Agent {
id: string;
name: string;
@@ -230,6 +238,7 @@ export function SearchChat() {
const [offset, setOffset] = useState(0);
const [totalResults, setTotalResults] = useState(0);
const { settings } = useSettings();
+ console.log("settings", settings);
const [isAiLoading, setIsAiLoading] = useState(false);
const [minLength, setMinLength] = useState(50);
const [maxLength, setMaxLength] = useState(10000);
@@ -305,12 +314,14 @@ export function SearchChat() {
useEffect(() => {
// More reliable OS detection
const platform = window.navigator.platform.toLowerCase();
- const os =
- platform.includes('mac') ? 'macos' :
- platform.includes('win') ? 'windows' :
- platform.includes('linux') ? 'linux' :
- 'unknown';
-
+ const os = platform.includes("mac")
+ ? "macos"
+ : platform.includes("win")
+ ? "windows"
+ : platform.includes("linux")
+ ? "linux"
+ : "unknown";
+
setCurrentPlatform(os);
}, []);
@@ -385,8 +396,6 @@ export function SearchChat() {
const [selectedAgent, setSelectedAgent] = useState<Agent>(AGENTS[0]);
- console.log("content type", contentType);
-
useEffect(() => {
const updateDates = () => {
const now = new Date();
@@ -416,7 +425,6 @@ export function SearchChat() {
}, []);
const handleExampleSelect = async (example: ExampleSearch) => {
-
const newWindowName = example.windowName || "";
const newAppName = example.appName || "";
const newLimit = example.limit || limit;
@@ -599,7 +607,6 @@ export function SearchChat() {
return;
}
-
const userMessage = {
id: generateId(),
role: "user" as const,
@@ -621,8 +628,6 @@ export function SearchChat() {
});
console.log("openai", settings.openaiApiKey, settings.aiUrl);
-
-
const model = settings.aiModel;
const customPrompt = settings.customPrompt || "";
@@ -732,24 +737,26 @@ export function SearchChat() {
setResults([]);
setSimilarityThreshold(1); // Reset similarity threshold to 1
-
try {
const searchParams = {
q: query || undefined,
contentType: overrides.contentType || contentType,
limit: overrides.limit || limit,
offset: newOffset,
- startTime: overrides.startDate?.toISOString() || startDate.toISOString(),
+ startTime:
+ overrides.startDate?.toISOString() || startDate.toISOString(),
endTime: endDate.toISOString(),
appName: overrides.appName || appName || undefined,
windowName: overrides.windowName || windowName || undefined,
includeFrames: includeFrames,
minLength: overrides.minLength || minLength,
maxLength: maxLength,
- speakerIds: Object.values(selectedSpeakers).map((speaker) => speaker.id)
+ speakerIds: Object.values(selectedSpeakers).map(
+ (speaker) => speaker.id
+ ),
};
- const response = await queryScreenpipe(searchParams);
+ const response = await pipe.queryScreenpipe(searchParams);
// Add debug logging
console.log("search response:", response);
@@ -911,7 +918,10 @@ export function SearchChat() {
<Badge
className="text-xs cursor-pointer"
onClick={() =>
- handleBadgeClick(item.content.windowName, "window")
+ handleBadgeClick(
+ item.content.windowName,
+ "window"
+ )
}
>
{item.content.windowName}
@@ -1023,13 +1033,13 @@ export function SearchChat() {
</Badge>
</div>
)}
- {'tags' in item.content && item.content.tags && (
+ {"tags" in item.content &&
+ item.content.tags &&
item.content.tags.map((tag, index) => (
<Badge key={index} className="text-xs">
{tag}
</Badge>
- ))
- )}
+ ))}
</div>
</CardContent>
</Card>
diff --git a/pipes/search/src/lib/actions/settings-actions.ts b/pipes/search/src/lib/actions/settings-actions.ts
deleted file mode 100644
index eda613e15..000000000
--- a/pipes/search/src/lib/actions/settings-actions.ts
+++ /dev/null
@@ -1,107 +0,0 @@
-"use server";
-
-import type { Settings } from "@screenpipe/js";
-const { pipe } = await import("@screenpipe/js");
-
-export async function getSettings(): Promise<Settings> {
- // Create a new plain object with the default settings
- const defaultSettings: Settings = {
- openaiApiKey: "",
- deepgramApiKey: "",
- aiModel: "gpt-4",
- aiUrl: "https://api.openai.com/v1",
- customPrompt: "",
- port: 3030,
- dataDir: "default",
- disableAudio: false,
- ignoredWindows: [],
- includedWindows: [],
- aiProviderType: "openai",
- embeddedLLM: {
- enabled: false,
- model: "llama3.2:1b-instruct-q4_K_M",
- port: 11438,
- },
- enableFrameCache: true,
- enableUiMonitoring: false,
- aiMaxContextChars: 128000,
- };
- try {
- const settingsManager = pipe.settings;
- if (!settingsManager) {
- throw new Error("settingsManager not found");
- }
- const rawSettings = await settingsManager.getAll();
-
- // Deep clone function that ensures plain objects
- function deepClone<T>(obj: T): T {
- if (obj === null || typeof obj !== "object") {
- return obj;
- }
-
- if (Array.isArray(obj)) {
- return obj.map(deepClone) as any;
- }
-
- const plainObj = Object.create(null);
- Object.setPrototypeOf(plainObj, Object.prototype);
-
- for (const [key, value] of Object.entries(obj)) {
- plainObj[key] = deepClone(value);
- }
-
- return plainObj as T;
- }
-
- // Create a completely new plain object
- const sanitizedSettings = deepClone({
- ...defaultSettings,
- ...rawSettings,
- });
-
- return sanitizedSettings;
- } catch (error) {
- console.error("failed to get settings:", error);
- // Return a new plain object with default settings on error
- return { ...defaultSettings };
- }
-}
-
-export async function updateSettingServer<T extends keyof Settings>(
- key: T,
- value: Settings[T]
-): Promise<void> {
- const settingsManager = pipe.settings;
- if (!settingsManager) {
- throw new Error("settingsManager not found");
- }
- // Ensure the value is serializable
- const serializedValue = JSON.parse(JSON.stringify(value));
- await settingsManager.set(key, serializedValue);
-}
-
-export async function updateSettingsServer(
- newSettings: Partial<Settings>
-): Promise<void> {
- const settingsManager = pipe.settings;
- if (!settingsManager) {
- throw new Error("settingsManager not found");
- }
- // Ensure the settings are serializable
- const serializedSettings = JSON.parse(JSON.stringify(newSettings));
- await settingsManager.update(serializedSettings);
-}
-
-export async function resetSettingsServer(
- settingKey?: keyof Settings
-): Promise<void> {
- const settingsManager = pipe.settings;
- if (!settingsManager) {
- throw new Error("settingsManager not found");
- }
- if (settingKey) {
- await settingsManager.resetKey(settingKey);
- } else {
- await settingsManager.reset();
- }
-}
diff --git a/pipes/search/src/lib/hooks/use-settings.tsx b/pipes/search/src/lib/hooks/use-settings.tsx
index 4d02b854f..f949d6458 100644
--- a/pipes/search/src/lib/hooks/use-settings.tsx
+++ b/pipes/search/src/lib/hooks/use-settings.tsx
@@ -1,11 +1,10 @@
-'use client';
+"use client";
-// import { type Settings } from '@screenpipe/js';
-import { useState, useEffect } from 'react';
+import { useState, useEffect } from "react";
+import type { Settings } from "@screenpipe/js";
export function useSettings() {
- // Create a plain default settings object
- const defaultSettings: any = {
+ const defaultSettings: Settings = {
openaiApiKey: "",
deepgramApiKey: "",
aiModel: "gpt-4",
@@ -27,7 +26,7 @@ export function useSettings() {
aiMaxContextChars: 128000,
};
- const [settings, setSettings] = useState<any>(defaultSettings);
+ const [settings, setSettings] = useState<Settings>(defaultSettings);
const [loading, setLoading] = useState(false);
const [error, setError] = useState<Error | null>(null);
@@ -35,10 +34,9 @@ export function useSettings() {
const loadSettings = async () => {
setLoading(true);
try {
- // when you uncomment the getSettings function, use this:
- // const data = await getSettings();
- // setSettings({ ...defaultSettings, ...data });
- setSettings(JSON.parse(JSON.stringify(defaultSettings)));
+ const response = await fetch("/api/settings");
+ const data = await response.json();
+ setSettings({ ...defaultSettings, ...data });
} catch (err) {
setError(err as Error);
} finally {
@@ -48,46 +46,58 @@ export function useSettings() {
loadSettings();
}, []);
- // const updateSetting = async <T extends keyof Settings>(key: T, value: Settings[T]) => {
- // try {
- // // when you uncomment updateSettingServer, use this:
- // // await updateSettingServer(key, value);
- // setSettings(prev => ({ ...prev, [key]: value }));
- // } catch (err) {
- // setError(err as Error);
- // }
- // };
+ const updateSetting = async <T extends keyof Settings>(
+ key: T,
+ value: Settings[T]
+ ) => {
+ try {
+ await fetch("/api/settings", {
+ method: "PUT",
+ body: JSON.stringify({ key, value }),
+ });
+ setSettings((prev) => ({ ...prev, [key]: value }));
+ } catch (err) {
+ setError(err as Error);
+ }
+ };
- // const updateSettings = async (newSettings: Partial<Settings>) => {
- // try {
- // // when you uncomment updateSettingsServer, use this:
- // // await updateSettingsServer(newSettings);
- // setSettings(prev => ({ ...prev, ...newSettings }));
- // } catch (err) {
- // setError(err as Error);
- // }
- // };
+ const updateSettings = async (newSettings: Partial<Settings>) => {
+ try {
+ await fetch("/api/settings", {
+ method: "PUT",
+ body: JSON.stringify({ value: newSettings, isPartialUpdate: true }),
+ });
+ setSettings((prev) => ({ ...prev, ...newSettings }));
+ } catch (err) {
+ setError(err as Error);
+ }
+ };
- // const resetSettings = async (settingKey?: keyof Settings) => {
- // try {
- // // when you uncomment resetSettingsServer, use this:
- // // await resetSettingsServer(settingKey);
- // if (settingKey) {
- // setSettings(prev => ({ ...prev, [settingKey]: defaultSettings[settingKey] }));
- // } else {
- // setSettings(defaultSettings);
- // }
- // } catch (err) {
- // setError(err as Error);
- // }
- // };
+ const resetSettings = async (settingKey?: keyof Settings) => {
+ try {
+ await fetch("/api/settings", {
+ method: "PUT",
+ body: JSON.stringify({ reset: true, key: settingKey }),
+ });
+ if (settingKey) {
+ setSettings((prev) => ({
+ ...prev,
+ [settingKey]: defaultSettings[settingKey],
+ }));
+ } else {
+ setSettings(defaultSettings);
+ }
+ } catch (err) {
+ setError(err as Error);
+ }
+ };
return {
settings,
loading,
error,
- // updateSetting,
- // updateSettings,
- // resetSettings,
+ updateSetting,
+ updateSettings,
+ resetSettings,
};
}
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lock
index 8778a2d67..28b8f9870 100755
--- a/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -4966,7 +4966,7 @@ dependencies = [
[[package]]
name = "screenpipe-app"
-version = "0.17.0"
+version = "0.17.1"
dependencies = [
"anyhow",
"axum",
diff --git a/screenpipe-app-tauri/src-tauri/capabilities/main.json b/screenpipe-app-tauri/src-tauri/capabilities/main.json
index fdb108306..b59ed6ee3 100644
--- a/screenpipe-app-tauri/src-tauri/capabilities/main.json
+++ b/screenpipe-app-tauri/src-tauri/capabilities/main.json
@@ -3,11 +3,7 @@
"description": "permissions that were migrated from v1",
"local": true,
"windows": [
- "main",
- "timeline",
- "search",
- "meetings",
- "identify-speakers"
+ "*"
],
"permissions": [
"core:event:allow-listen",
@@ -345,11 +341,27 @@
"allow": [
{
"url": "http://**/*",
- "methods": ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]
+ "methods": [
+ "GET",
+ "POST",
+ "PUT",
+ "DELETE",
+ "PATCH",
+ "HEAD",
+ "OPTIONS"
+ ]
},
{
"url": "https://**/*",
- "methods": ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]
+ "methods": [
+ "GET",
+ "POST",
+ "PUT",
+ "DELETE",
+ "PATCH",
+ "HEAD",
+ "OPTIONS"
+ ]
}
]
}
diff --git a/screenpipe-app-tauri/src-tauri/gen/schemas/capabilities.json b/screenpipe-app-tauri/src-tauri/gen/schemas/capabilities.json
index 2abfa1310..6eebcc5f1 100644
--- a/screenpipe-app-tauri/src-tauri/gen/schemas/capabilities.json
+++ b/screenpipe-app-tauri/src-tauri/gen/schemas/capabilities.json
@@ -1 +1 @@
-{"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main","timeline","search","meetings","identify-speakers"],"permissions":["core:event:allow-listen","core:event:default","core:app:allow-version","process:allow-restart","process:allow-exit","notification:default","core:resources:default","core:menu:default","core:tray:default","shell:default","store:default","store:allow-create-store","store:allow-get","store:allow-set","store:allow-save","store:allow-load","shell:allow-open","fs:allow-watch","fs:allow-open","fs:default","fs:allow-read-file","fs:allow-read-dir","fs:allow-read","fs:allow-write-file","fs:read-dirs","fs:allow-copy-file","fs:allow-exists","fs:allow-read-text-file","fs:allow-create","fs:allow-mkdir","fs:allow-remove","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-unregister","global-shortcut:allow-unregister-all","global-shortcut:default",{"identifier":"fs:scope","allow":[{"path":"$XDG_DATA_HOME","requireLiteralLeadingDot":false},{"path":"$XDG_DATA_HOME/**","requireLiteralLeadingDot":false},{"path":"$LOCALAPPDATA/*","requireLiteralLeadingDot":false},{"path":"$LOCALAPPDATA/**","requireLiteralLeadingDot":false},{"path":"$APPLOCALDATA/*","requireLiteralLeadingDot":false},{"path":"$APPLOCALDATA/**","requireLiteralLeadingDot":false},{"path":"$APPDATA/*","requireLiteralLeadingDot":false},{"path":"$APPDATA/**","requireLiteralLeadingDot":false},{"path":"$APPCONFIG/*","requireLiteralLeadingDot":false},{"path":"$RESOURCE/*","requireLiteralLeadingDot":false},{"path":"$RESOURCE/.screenpipe/*","requireLiteralLeadingDot":false},{"path":"$HOME/*","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/*","requireLiteralLeadingDot":false},{"path":"$APP/*","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/data/**","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/pipes/**","requireLiteralLeadingDot":false}]},{"identifier":"shell:allow-execute","allow":[{"args":["-c",{"validator":"\\S+"}],"cmd":"sh","name":"exec-sh","sidecar":false}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","purge","-y"],"cmd":"screenpipe","name":"screenpipe","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["setup"],"cmd":"screenpipe","name":"screenpipe","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["migrate"],"cmd":"screenpipe","name":"screenpipe","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["serve"],"cmd":"ollama","name":"ollama","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["run",{"validator":"\\S*"}],"cmd":"ollama","name":"ollama-run","sidecar":true}]},"cli:default","shell:default","shell:allow-spawn","dialog:default","updater:default","os:default","os:allow-arch","os:allow-hostname","os:allow-os-type","core:path:default","process:default","store:default","core:webview:allow-internal-toggle-devtools",{"identifier":"shell:allow-execute","allow":[{"args":["pipe","list","--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-list","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","download",{"validator":"\\S+"},"--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-download","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","enable",{"validator":"\\S+"}],"cmd":"screenpipe","name":"screenpipe-pipe-enable","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","disable",{"validator":"\\S+"}],"cmd":"screenpipe","name":"screenpipe-pipe-disable","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","update",{"validator":"\\S+"},{"validator":"\\{.*\\}"}],"cmd":"screenpipe","name":"screenpipe-pipe-update","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","delete",{"validator":"\\S+"},"--yes"],"cmd":"screenpipe","name":"screenpipe-pipe-delete","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","info",{"validator":"\\S+"},"--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-info","sidecar":true}]},{"identifier":"http:default","allow":[{"methods":["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"],"url":"http://**/*"},{"methods":["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"],"url":"https://**/*"}]}]}}
\ No newline at end of file
+{"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["*"],"permissions":["core:event:allow-listen","core:event:default","core:app:allow-version","process:allow-restart","process:allow-exit","notification:default","core:resources:default","core:menu:default","core:tray:default","shell:default","store:default","store:allow-create-store","store:allow-get","store:allow-set","store:allow-save","store:allow-load","shell:allow-open","fs:allow-watch","fs:allow-open","fs:default","fs:allow-read-file","fs:allow-read-dir","fs:allow-read","fs:allow-write-file","fs:read-dirs","fs:allow-copy-file","fs:allow-exists","fs:allow-read-text-file","fs:allow-create","fs:allow-mkdir","fs:allow-remove","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-unregister","global-shortcut:allow-unregister-all","global-shortcut:default",{"identifier":"fs:scope","allow":[{"path":"$XDG_DATA_HOME","requireLiteralLeadingDot":false},{"path":"$XDG_DATA_HOME/**","requireLiteralLeadingDot":false},{"path":"$LOCALAPPDATA/*","requireLiteralLeadingDot":false},{"path":"$LOCALAPPDATA/**","requireLiteralLeadingDot":false},{"path":"$APPLOCALDATA/*","requireLiteralLeadingDot":false},{"path":"$APPLOCALDATA/**","requireLiteralLeadingDot":false},{"path":"$APPDATA/*","requireLiteralLeadingDot":false},{"path":"$APPDATA/**","requireLiteralLeadingDot":false},{"path":"$APPCONFIG/*","requireLiteralLeadingDot":false},{"path":"$RESOURCE/*","requireLiteralLeadingDot":false},{"path":"$RESOURCE/.screenpipe/*","requireLiteralLeadingDot":false},{"path":"$HOME/*","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/*","requireLiteralLeadingDot":false},{"path":"$APP/*","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/data/**","requireLiteralLeadingDot":false},{"path":"$HOME/.screenpipe/pipes/**","requireLiteralLeadingDot":false}]},{"identifier":"shell:allow-execute","allow":[{"args":["-c",{"validator":"\\S+"}],"cmd":"sh","name":"exec-sh","sidecar":false}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","purge","-y"],"cmd":"screenpipe","name":"screenpipe","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["setup"],"cmd":"screenpipe","name":"screenpipe","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["migrate"],"cmd":"screenpipe","name":"screenpipe","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["serve"],"cmd":"ollama","name":"ollama","sidecar":true}]},{"identifier":"shell:allow-spawn","allow":[{"args":["run",{"validator":"\\S*"}],"cmd":"ollama","name":"ollama-run","sidecar":true}]},"cli:default","shell:default","shell:allow-spawn","dialog:default","updater:default","os:default","os:allow-arch","os:allow-hostname","os:allow-os-type","core:path:default","process:default","store:default","core:webview:allow-internal-toggle-devtools",{"identifier":"shell:allow-execute","allow":[{"args":["pipe","list","--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-list","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","download",{"validator":"\\S+"},"--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-download","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","enable",{"validator":"\\S+"}],"cmd":"screenpipe","name":"screenpipe-pipe-enable","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","disable",{"validator":"\\S+"}],"cmd":"screenpipe","name":"screenpipe-pipe-disable","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","update",{"validator":"\\S+"},{"validator":"\\{.*\\}"}],"cmd":"screenpipe","name":"screenpipe-pipe-update","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","delete",{"validator":"\\S+"},"--yes"],"cmd":"screenpipe","name":"screenpipe-pipe-delete","sidecar":true}]},{"identifier":"shell:allow-execute","allow":[{"args":["pipe","info",{"validator":"\\S+"},"--output","json"],"cmd":"screenpipe","name":"screenpipe-pipe-info","sidecar":true}]},{"identifier":"http:default","allow":[{"methods":["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"],"url":"http://**/*"},{"methods":["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"],"url":"https://**/*"}]}]}}
\ No newline at end of file
diff --git a/screenpipe-app-tauri/src-tauri/src/commands.rs b/screenpipe-app-tauri/src-tauri/src/commands.rs
index 2f2e5cef9..bd4b7c9d8 100644
--- a/screenpipe-app-tauri/src-tauri/src/commands.rs
+++ b/screenpipe-app-tauri/src-tauri/src/commands.rs
@@ -333,9 +333,18 @@ pub fn show_search(app_handle: tauri::AppHandle<tauri::Wry>) {
#[tauri::command]
pub async fn open_pipe_window(app_handle: tauri::AppHandle<tauri::Wry>, port: u16, title: String) -> Result<(), String> {
+ let window_label = format!("pipe-{}", port);
+
+ // Close existing window if it exists
+ if let Some(existing_window) = app_handle.get_webview_window(&window_label) {
+ let _ = existing_window.close();
+ // Give it a moment to properly close
+ tokio::time::sleep(tokio::time::Duration::from_millis(100)).await;
+ }
+
let _window = tauri::WebviewWindowBuilder::new(
&app_handle,
- format!("pipe-{}", port),
+ window_label,
tauri::WebviewUrl::External(format!("http://localhost:{}", port).parse().unwrap())
)
.title(title)
diff --git a/screenpipe-js/browser.ts b/screenpipe-js/browser.ts
new file mode 100644
index 000000000..956c72147
--- /dev/null
+++ b/screenpipe-js/browser.ts
@@ -0,0 +1,108 @@
+// browser.ts
+import type {
+ NotificationOptions,
+ ScreenpipeQueryParams,
+ ScreenpipeResponse,
+ InputAction,
+ InputControlResponse,
+} from "./types";
+
+import { toSnakeCase, convertToCamelCase } from "./next";
+
+async function sendInputControl(action: InputAction): Promise<boolean> {
+ const apiUrl = process.env.SCREENPIPE_SERVER_URL || "http://localhost:3030";
+ try {
+ const response = await fetch(`${apiUrl}/experimental/input_control`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ action }),
+ });
+ if (!response.ok) {
+ throw new Error(`http error! status: ${response.status}`);
+ }
+ const data: InputControlResponse = await response.json();
+ return data.success;
+ } catch (error) {
+ console.error("failed to control input:", error);
+ return false;
+ }
+}
+
+// Browser-only implementations
+export const pipe = {
+ async sendDesktopNotification(
+ options: NotificationOptions
+ ): Promise<boolean> {
+ const notificationApiUrl = "http://localhost:11435";
+ try {
+ await fetch(`${notificationApiUrl}/notify`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify(options),
+ });
+ return true;
+ } catch (error) {
+ console.error("failed to send notification:", error);
+ return false;
+ }
+ },
+
+ async queryScreenpipe(
+ params: ScreenpipeQueryParams
+ ): Promise<ScreenpipeResponse | null> {
+ const queryParams = new URLSearchParams();
+ Object.entries(params).forEach(([key, value]) => {
+ if (value !== undefined && value !== "") {
+ if (key === "speakerIds" && Array.isArray(value)) {
+ if (value.length > 0) {
+ queryParams.append(toSnakeCase(key), value.join(","));
+ }
+ } else {
+ const snakeKey = toSnakeCase(key);
+ queryParams.append(snakeKey, value!.toString());
+ }
+ }
+ });
+
+ const url = `http://localhost:3030/search?${queryParams}`;
+ try {
+ const response = await fetch(url);
+ if (!response.ok) {
+ const errorText = await response.text();
+ let errorJson;
+ try {
+ errorJson = JSON.parse(errorText);
+ console.error("screenpipe api error:", {
+ status: response.status,
+ error: errorJson,
+ });
+ } catch {
+ console.error("screenpipe api error:", {
+ status: response.status,
+ error: errorText,
+ });
+ }
+ throw new Error(`http error! status: ${response.status}`);
+ }
+ const data = await response.json();
+ return convertToCamelCase(data) as ScreenpipeResponse;
+ } catch (error) {
+ console.error("error querying screenpipe:", error);
+ return null;
+ }
+ },
+
+ input: {
+ type: (text: string) => sendInputControl({ type: "WriteText", data: text }),
+ press: (key: string) => sendInputControl({ type: "KeyPress", data: key }),
+ moveMouse: (x: number, y: number) =>
+ sendInputControl({ type: "MouseMove", data: { x, y } }),
+ click: (button: "left" | "right" | "middle") =>
+ sendInputControl({ type: "MouseClick", data: button }),
+ },
+};
+
+// Export individual functions for more granular usage
+export const sendDesktopNotification = pipe.sendDesktopNotification;
+export const queryScreenpipe = pipe.queryScreenpipe;
+export const input = pipe.input;
diff --git a/screenpipe-js/index.d.ts b/screenpipe-js/index.d.ts
deleted file mode 100644
index 290a5e396..000000000
--- a/screenpipe-js/index.d.ts
+++ /dev/null
@@ -1,205 +0,0 @@
-// @screenpipe/js/index.d.ts
-
-declare module '@screenpipe/js' {
- // Core types
- export interface PipeConfig {
- [key: string]: any;
- }
-
- export interface NotificationOptions {
- title: string;
- body: string;
- actions?: NotificationAction[];
- timeout?: number;
- persistent?: boolean;
- }
-
- export interface NotificationAction {
- id: string;
- label: string;
- callback?: () => Promise<void>;
- }
-
- export type ContentType =
- | "all"
- | "ocr"
- | "audio"
- | "ui"
- | "audio+ui"
- | "ocr+ui"
- | "audio+ocr";
-
- // Query and Response types
- export interface ScreenpipeQueryParams {
- q?: string;
- contentType?: ContentType;
- limit?: number;
- offset?: number;
- startTime?: string;
- endTime?: string;
- appName?: string;
- windowName?: string;
- includeFrames?: boolean;
- minLength?: number;
- maxLength?: number;
- speakerIds?: number[];
- }
-
- export interface OCRContent {
- frameId: number;
- text: string;
- timestamp: string;
- filePath: string;
- offsetIndex: number;
- appName: string;
- windowName: string;
- tags: string[];
- frame?: string;
- }
-
- export interface AudioContent {
- chunkId: number;
- transcription: string;
- timestamp: string;
- filePath: string;
- offsetIndex: number;
- tags: string[];
- deviceName: string;
- deviceType: string;
- speaker?: Speaker;
- }
-
- export interface UiContent {
- id: number;
- text: string;
- timestamp: string;
- appName: string;
- windowName: string;
- initialTraversalAt?: string;
- filePath: string;
- offsetIndex: number;
- }
-
- export interface Speaker {
- id: number;
- name?: string;
- metadata?: string;
- }
-
- export type ContentItem =
- | { type: "OCR"; content: OCRContent }
- | { type: "Audio"; content: AudioContent }
- | { type: "UI"; content: UiContent };
-
- export interface PaginationInfo {
- limit: number;
- offset: number;
- total: number;
- }
-
- export interface ScreenpipeResponse {
- data: ContentItem[];
- pagination: PaginationInfo;
- }
-
- // Settings types
- export type VadSensitivity = "low" | "medium" | "high";
-
- export type AIProviderType =
- | "native-ollama"
- | "openai"
- | "custom"
- | "embedded"
- | "screenpipe-cloud";
-
- export interface EmbeddedLLMConfig {
- enabled: boolean;
- model: string;
- port: number;
- }
-
- export interface Settings {
- openaiApiKey: string;
- deepgramApiKey: string;
- aiModel: string;
- aiUrl: string;
- customPrompt: string;
- port: number;
- dataDir: string;
- disableAudio: boolean;
- ignoredWindows: string[];
- includedWindows: string[];
- aiProviderType: AIProviderType;
- embeddedLLM: EmbeddedLLMConfig;
- enableFrameCache: boolean;
- enableUiMonitoring: boolean;
- aiMaxContextChars: number;
- }
-
- // Inbox types
- export interface InboxMessage {
- title: string;
- body: string;
- actions?: InboxMessageAction[];
- }
-
- export interface InboxMessageAction {
- label: string;
- action: string;
- callback: () => Promise<void>;
- }
-
- // Input control types
- export type InputAction =
- | { type: "WriteText"; data: string }
- | { type: "KeyPress"; data: string }
- | { type: "MouseMove"; data: { x: number; y: number } }
- | { type: "MouseClick"; data: "left" | "right" | "middle" };
-
- // Settings Manager class
- export class SettingsManager {
- get<K extends keyof Settings>(key: K): Promise<Settings[K]>;
- set<K extends keyof Settings>(key: K, value: Settings[K]): Promise<void>;
- getAll(): Promise<Settings>;
- update(newSettings: Partial<Settings>): Promise<void>;
- reset(): Promise<void>;
- resetKey<K extends keyof Settings>(key: K): Promise<void>;
- }
-
- // Inbox Manager class
- export class InboxManager {
- send(message: InboxMessage): Promise<boolean>;
- }
-
- // Main API object
- export const pipe: {
- sendDesktopNotification: (options: NotificationOptions) => Promise<boolean>;
- loadPipeConfig: () => PipeConfig;
- queryScreenpipe: (params: ScreenpipeQueryParams) => Promise<ScreenpipeResponse | null>;
- inbox: InboxManager;
- scheduler: {
- task: (name: string) => {
- every: (interval: string | number) => {
- at: (time: string) => {
- do: (handler: () => Promise<void>) => void;
- };
- do: (handler: () => Promise<void>) => void;
- };
- };
- start: () => void;
- stop: () => void;
- };
- input: {
- type: (text: string) => Promise<boolean>;
- press: (key: string) => Promise<boolean>;
- moveMouse: (x: number, y: number) => Promise<boolean>;
- click: (button: "left" | "right" | "middle") => Promise<boolean>;
- };
- settings: SettingsManager;
- };
-
- // Main functions
- export function sendDesktopNotification(options: NotificationOptions): Promise<boolean>;
- export function loadPipeConfig(): PipeConfig;
- export function queryScreenpipe(params: ScreenpipeQueryParams): Promise<ScreenpipeResponse | null>;
-}
diff --git a/screenpipe-js/main.ts b/screenpipe-js/main.ts
index 34f096c5e..f82954563 100644
--- a/screenpipe-js/main.ts
+++ b/screenpipe-js/main.ts
@@ -1,760 +1,12 @@
-// Environment detection
-const isNode = typeof process !== 'undefined' &&
- process.versions != null &&
- process.versions.node != null;
+// main.ts - Universal entry point
+export * from "./types";
+export { toCamelCase, toSnakeCase, convertToCamelCase } from "./next";
+// Browser-only exports
+export { sendDesktopNotification, queryScreenpipe, input } from "./browser";
-function assertNode(functionName: string) {
- if (!isNode) {
- throw new Error(`${functionName} is only available in Node.js environment`);
- }
-}
+// Export browser pipe as default
+export { pipe as default } from "./browser";
-// create a helper for dynamic imports
-async function requireNodeModule(moduleName: string) {
- if (!isNode) return null;
- try {
- return await import(moduleName);
- } catch (e) {
- console.error(`failed to import ${moduleName}:`, e);
- return null;
- }
-}
-
-// Type definitions
-export interface PipeConfig {
- [key: string]: any;
-}
-
-export interface NotificationOptions {
- title: string;
- body: string;
- actions?: NotificationAction[];
- timeout?: number; // in milliseconds
- persistent?: boolean;
-}
-
-/**
- * Types of content that can be queried in Screenpipe.
- */
-export type ContentType =
- | "all"
- | "ocr"
- | "audio"
- | "ui"
- | "audio+ui"
- | "ocr+ui"
- | "audio+ocr";
-
-/**
- * Parameters for querying Screenpipe.
- */
-export interface ScreenpipeQueryParams {
- q?: string;
- contentType?: ContentType;
- limit?: number;
- offset?: number;
- startTime?: string;
- endTime?: string;
- appName?: string;
- windowName?: string;
- includeFrames?: boolean;
- minLength?: number;
- maxLength?: number;
- speakerIds?: number[];
-}
-
-/**
- * Structure of OCR (Optical Character Recognition) content.
- */
-export interface OCRContent {
- frameId: number;
- text: string;
- timestamp: string;
- filePath: string;
- offsetIndex: number;
- appName: string;
- windowName: string;
- tags: string[];
- frame?: string;
-}
-
-/**
- * Structure of audio content.
- */
-export interface AudioContent {
- chunkId: number;
- transcription: string;
- timestamp: string;
- filePath: string;
- offsetIndex: number;
- tags: string[];
- deviceName: string;
- deviceType: string;
- speaker?: Speaker;
-}
-
-
-/**
- * Structure of UI content.
- */
-export interface UiContent {
- id: number;
- text: string;
- timestamp: string;
- appName: string;
- windowName: string;
- initialTraversalAt?: string;
- filePath: string;
- offsetIndex: number;
-}
-
-/**
- * Speaker information
- */
-export interface Speaker {
- id: number;
- name?: string;
- metadata?: string;
-}
-
-/**
- * Union type for different types of content items.
- */
-export type ContentItem =
- | { type: "OCR"; content: OCRContent }
- | { type: "Audio"; content: AudioContent }
- | { type: "UI"; content: UiContent };
-
-/**
- * Pagination information for search results.
- */
-export interface PaginationInfo {
- limit: number;
- offset: number;
- total: number;
-}
-
-/**
- * Structure of the response from a Screenpipe query.
- */
-export interface ScreenpipeResponse {
- data: ContentItem[];
- pagination: PaginationInfo;
-}
-
-/**
- * Parsed config
- */
-export interface ParsedConfig<T = unknown> {
- fields: {
- name: string;
- value?: T;
- default?: T;
- }[];
-}
-
-// Types from the original settings
-export type VadSensitivity = "low" | "medium" | "high";
-export type AIProviderType =
- | "native-ollama"
- | "openai"
- | "custom"
- | "embedded"
- | "screenpipe-cloud";
-
-export interface EmbeddedLLMConfig {
- enabled: boolean;
- model: string;
- port: number;
-}
-
-export interface Settings {
- openaiApiKey: string;
- deepgramApiKey: string;
- aiModel: string;
- aiUrl: string;
- customPrompt: string;
- port: number;
- dataDir: string;
- disableAudio: boolean;
- ignoredWindows: string[];
- includedWindows: string[];
- aiProviderType: AIProviderType;
- embeddedLLM: EmbeddedLLMConfig;
- enableFrameCache: boolean;
- enableUiMonitoring: boolean;
- aiMaxContextChars: number;
-}
-
-const DEFAULT_SETTINGS: Settings = {
- openaiApiKey: "",
- deepgramApiKey: "",
- aiModel: "gpt-4",
- aiUrl: "https://api.openai.com/v1",
- customPrompt: `Rules:
-- You can analyze/view/show/access videos to the user by putting .mp4 files in a code block (we'll render it) like this: \`/users/video.mp4\`, use the exact, absolute, file path from file_path property
-- Do not try to embed video in links (e.g. [](.mp4) or https://.mp4) instead put the file_path in a code block using backticks
-- Do not put video in multiline code block it will not render the video (e.g. \`\`\`bash\n.mp4\`\`\` IS WRONG) instead using inline code block with single backtick
-- Always answer my question/intent, do not make up things`,
- port: 3030,
- dataDir: "default",
- disableAudio: false,
- ignoredWindows: [],
- includedWindows: [],
- aiProviderType: "openai",
- embeddedLLM: {
- enabled: false,
- model: "llama3.2:1b-instruct-q4_K_M",
- port: 11438,
- },
- enableFrameCache: true,
- enableUiMonitoring: false,
- aiMaxContextChars: 128000,
-};
-
-/**
- * Settings Manager for Screenpipe configuration.
- * Works in: Node.js only
- */
-class SettingsManager {
- private settings: Settings;
- private storePath: string;
- private initialized: boolean = false;
-
- constructor() {
- assertNode('SettingsManager');
- this.settings = DEFAULT_SETTINGS;
- this.storePath = ''; // will be set in init()
- }
-
- private async getStorePath(): Promise<string> {
- const os = await requireNodeModule('os');
- const path = await requireNodeModule('path');
- if (!os || !path) throw new Error('failed to load required modules');
-
- const platform = process.platform;
- const home = os.homedir();
-
- switch (platform) {
- case "darwin":
- return path.join(home, "Library", "Application Support", "screenpipe", "store.bin");
- case "linux":
- const xdgData = process.env.XDG_DATA_HOME || path.join(home, ".local", "share");
- return path.join(xdgData, "screenpipe", "store.bin");
- case "win32":
- return path.join(
- process.env.LOCALAPPDATA || path.join(home, "AppData", "Local"),
- "screenpipe",
- "store.bin"
- );
- default:
- throw new Error(`unsupported platform: ${platform}`);
- }
- }
-
- async init(): Promise<void> {
- if (this.initialized) return;
-
- const fs = await requireNodeModule('fs/promises');
- const path = await requireNodeModule('path');
- if (!fs || !path) throw new Error('failed to load required modules');
-
- this.storePath = await this.getStorePath();
-
- try {
- await fs.mkdir(path.dirname(this.storePath), { recursive: true });
- const data = await fs.readFile(this.storePath);
- this.settings = { ...DEFAULT_SETTINGS, ...JSON.parse(data.toString()) };
- this.initialized = true;
- } catch (error) {
- if ((error as NodeJS.ErrnoException).code === "ENOENT") {
- await this.save();
- this.initialized = true;
- } else {
- throw error;
- }
- }
- }
-
- async save(): Promise<void> {
- const fs = await requireNodeModule('fs/promises');
- const path = await requireNodeModule('path');
- await fs.mkdir(path.dirname(this.storePath), { recursive: true });
- await fs.writeFile(this.storePath, JSON.stringify(this.settings, null, 2));
- }
-
- async get<K extends keyof Settings>(key: K): Promise<Settings[K]> {
- if (!this.initialized) await this.init();
- return this.settings[key];
- }
-
- async set<K extends keyof Settings>(
- key: K,
- value: Settings[K]
- ): Promise<void> {
- if (!this.initialized) await this.init();
- this.settings[key] = value;
- await this.save();
- }
-
- async getAll(): Promise<Settings> {
- if (!this.initialized) await this.init();
- return { ...this.settings };
- }
-
- async update(newSettings: Partial<Settings>): Promise<void> {
- if (!this.initialized) await this.init();
- this.settings = { ...this.settings, ...newSettings };
- await this.save();
- }
-
- async reset(): Promise<void> {
- this.settings = { ...DEFAULT_SETTINGS };
- await this.save();
- }
-
- async resetKey<K extends keyof Settings>(key: K): Promise<void> {
- if (!this.initialized) await this.init();
- this.settings[key] = DEFAULT_SETTINGS[key];
- await this.save();
- }
-}
-
-/**
- * Utility function to convert snake_case to camelCase
- */
-function toCamelCase(str: string): string {
- return str.replace(/([-_][a-z])/g, (group) =>
- group.toUpperCase().replace("-", "").replace("_", "")
- );
-}
-
-/**
- * Function to recursively convert object keys from snake_case to camelCase
- */
-function convertToCamelCase(obj: any): any {
- if (Array.isArray(obj)) {
- return obj.map(convertToCamelCase);
- } else if (obj !== null && typeof obj === "object") {
- return Object.keys(obj).reduce((result, key) => {
- const camelKey = toCamelCase(key);
- result[camelKey] = convertToCamelCase(obj[key]);
- return result;
- }, {} as any);
- }
- return obj;
-}
-
-/**
- * Function to convert camelCase to snake_case
- */
-function toSnakeCase(str: string): string {
- return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
-}
-
-/**
- * Send a desktop notification to the user.
- * Works in: Both Browser and Node.js
- *
- * @example
- * ```typescript
- * pipe.sendDesktopNotification({ title: "Task Completed", body: "Your task has been completed." });
- * ```
- */
-export async function sendDesktopNotification(
- options: NotificationOptions
-): Promise<boolean> {
- const notificationApiUrl = process.env.SCREENPIPE_SERVER_URL || "http://localhost:11435";
- try {
- await fetch(`${notificationApiUrl}/notify`, {
- method: "POST",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify(options),
- });
- return true;
- } catch (error) {
- console.error("Failed to send notification:", error);
- return false;
- }
-}
-
-/**
- * Load the pipe configuration that can be set through the screenpipe app or the pipe.json file.
- * Works in: Node.js only
- *
- * @example
- * ```typescript
- * pipe.loadPipeConfig();
- * ```
- */
-export function loadPipeConfig(): PipeConfig {
- assertNode('loadPipeConfig');
- try {
- const fs = require('fs');
- const path = require('path');
- const baseDir = process.env.SCREENPIPE_DIR || process.cwd();
- const pipeId = process.env.PIPE_ID || path.basename(process.cwd());
- const configPath = `${baseDir}/pipes/${pipeId}/pipe.json`;
-
- const configContent = fs.readFileSync(configPath, "utf8");
- const parsedConfig: ParsedConfig = JSON.parse(configContent);
- const config: PipeConfig = {};
- parsedConfig.fields.forEach((field) => {
- config[field.name] = field.value !== undefined ? field.value : field.default;
- });
- return config;
- } catch (error) {
- console.error("Error loading pipe.json:", error);
- return {};
- }
-}
-
-/**
- * Query the screenpipe API.
- * Works in: Both Browser and Node.js
- *
- * @example
- * ```typescript
- * pipe.queryScreenpipe({ q: "squirrel", contentType: "ocr", limit: 10 });
- * ```
- */
-export async function queryScreenpipe(
- params: ScreenpipeQueryParams
-): Promise<ScreenpipeResponse | null> {
- const queryParams = new URLSearchParams();
- Object.entries(params).forEach(([key, value]) => {
- if (value !== undefined && value !== '') {
- if (key === 'speakerIds' && Array.isArray(value)) {
- if (value.length > 0) {
- queryParams.append(toSnakeCase(key), value.join(','));
- }
- } else {
- const snakeKey = toSnakeCase(key);
- queryParams.append(snakeKey, value.toString());
- }
- }
- });
-
- const url = `http://localhost:3030/search?${queryParams}`;
- try {
- const response = await fetch(url);
- if (!response.ok) {
- const errorText = await response.text();
- let errorJson;
- try {
- errorJson = JSON.parse(errorText);
- console.error("screenpipe api error:", {
- status: response.status,
- error: errorJson,
- });
- } catch {
- console.error("screenpipe api error:", {
- status: response.status,
- error: errorText,
- });
- }
- throw new Error(`http error! status: ${response.status}`);
- }
- const data = await response.json();
- return convertToCamelCase(data) as ScreenpipeResponse;
- } catch (error) {
- console.error("error querying screenpipe:", error);
- return null;
- }
-}
-
-export interface InboxMessage {
- title: string;
- body: string;
- actions?: InboxMessageAction[];
-}
-
-export interface InboxMessageAction {
- label: string;
- action: string;
- callback: () => Promise<void>;
-}
-
-type ScheduledTask = any;
-
-class Task {
- private _name: string;
- private _interval: string | number;
- private _time: string | null = null;
- private _handler: (() => Promise<void>) | null = null;
- private _cronTask: ScheduledTask | null = null;
-
- constructor(name: string) {
- assertNode('Task');
- this._name = name;
- this._interval = 0;
- }
-
- every(interval: string | number): Task {
- this._interval = interval;
- return this;
- }
-
- at(time: string): Task {
- this._time = time;
- return this;
- }
-
- do(handler: () => Promise<void>): Task {
- this._handler = handler;
- return this;
- }
-
- async schedule(): Promise<void> {
- if (!this._handler) {
- throw new Error(`No handler defined for task: ${this._name}`);
- }
-
- assertNode('Task.schedule');
- const cron = await requireNodeModule('node-cron');
- const cronExpression = this.toCronExpression();
-
- this._cronTask = cron.schedule(cronExpression, this._handler, {
- name: this._name,
- });
- }
-
- stop(): void {
- assertNode('Task.stop');
- return this._cronTask?.stop();
- }
-
- private toCronExpression(): string {
- if (typeof this._interval === "number") {
- const minutes = Math.floor(this._interval / 60000);
- return `*/${minutes} * * * *`;
- }
-
- const [value, unit] = this._interval.split(" ");
- switch (unit) {
- case "second":
- case "seconds":
- return `*/${value} * * * * *`;
- case "minute":
- case "minutes":
- return `*/${value} * * * *`;
- case "hour":
- case "hours":
- return `0 */${value} * * *`;
- case "day":
- case "days":
- return `0 0 */${value} * *`;
- default:
- throw new Error(`Unsupported interval unit: ${unit}`);
- }
- }
-}
-
-/**
- * Scheduler for running tasks at specific times or intervals.
- * Works in: Node.js only
- *
- * @example
- * ```typescript
- * pipe.scheduler.task("dailyReport")
- * .every("1 day")
- * .at("00:00")
- * .do(async () => {
- * console.log("running daily report");
- * });
- *
- * pipe.scheduler.task("everyFiveMinutes")
- * .every("5 minutes")
- * .do(async () => {
- * console.log("running task every 5 minutes");
- * });
- *
- * pipe.scheduler.start();
- * ```
- */
-class Scheduler {
- private tasks: Task[] = [];
-
- constructor() {
- assertNode('Scheduler');
- }
-
- task(name: string): Task {
- const task = new Task(name);
- this.tasks.push(task);
- return task;
- }
-
- start() {
- this.tasks.forEach((task) => task.schedule());
- }
-
- async stop(): Promise<void> {
- assertNode('Scheduler.stop');
- if (isNode) {
- const cron = await requireNodeModule('node-cron');
- cron.getTasks().forEach((task: any) => task.stop());
- }
- this.tasks = [];
- }
-}
-
-export type InputAction =
- | { type: "WriteText"; data: string }
- | { type: "KeyPress"; data: string }
- | { type: "MouseMove"; data: { x: number; y: number } }
- | { type: "MouseClick"; data: "left" | "right" | "middle" };
-
-interface InputControlResponse {
- success: boolean;
-}
-
-// Add this type for action responses
-interface ActionResponse {
- action: string;
-}
-
-// Keep track of action callbacks
-const actionCallbacks = new Map<string, () => Promise<void>>();
-
-// Add this function to find an available port
-async function getAvailablePort(): Promise<number> {
- return new Promise((resolve, reject) => {
- const server = require("net").createServer();
- server.unref();
- server.on("error", reject);
- server.listen(0, () => {
- const port = server.address().port;
- server.close(() => resolve(port));
- });
- });
-}
-
-export class InboxManager {
- private actionServerPort?: number;
- private actionServerProcess?: any;
-
- async send(message: InboxMessage): Promise<boolean> {
- if (!this.actionServerPort) {
- this.actionServerPort = await getAvailablePort();
- // spawn the server as a separate process
- if (isNode) {
- const { fork } = await requireNodeModule('child_process');
- this.actionServerProcess = fork('./inbox-server.js', [this.actionServerPort.toString()]);
- }
- }
-
- // Generate unique IDs for actions and store their callbacks
- if (message.actions) {
- if (!isNode) {
- console.warn('inbox actions are currently not supported in browser');
- return false;
- }
- message.actions = message.actions.map((action) => {
- const actionId = crypto.randomUUID();
- return {
- label: action.label,
- action: actionId,
- port: this.actionServerPort,
- callback: action.callback,
- };
- });
- }
-
- try {
- const response = await fetch("http://localhost:11435/inbox", {
- method: "POST",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify({
- ...message,
- type: "inbox",
- actionServerPort: this.actionServerPort,
- }),
- });
-
- return response.ok;
- } catch (error) {
- console.error("failed to send inbox message:", error);
- return false;
- }
- }
-}
-
-/**
- * Input control methods for simulating user input.
- * Works in: Both Browser and Node.js
- *
- * @example
- * ```typescript
- * // Type text
- * pipe.input.type("Hello, Screenpipe!");
- *
- * // Press a key
- * pipe.input.press("enter");
- *
- * // Move mouse
- * pipe.input.moveMouse(100, 200);
- *
- * // Click
- * pipe.input.click("left");
- * ```
- */
-const input = {
- // ... existing implementation
-}
-
-/**
- * Main Screenpipe API object.
- * Different methods work in different environments as documented above.
- *
- * @example
- * ```typescript
- * // Works in both Browser and Node.js
- * await pipe.sendDesktopNotification({ title: "Hello", body: "World" });
- *
- * // Works only in Node.js
- * const config = pipe.loadPipeConfig();
- * ```
- */
-export const pipe = {
- sendDesktopNotification,
- loadPipeConfig,
- queryScreenpipe,
- inbox: new InboxManager(),
- scheduler: isNode ? new Scheduler() : undefined,
- input: {
- type: (text: string) => sendInputControl({ type: "WriteText", data: text }),
- press: (key: string) => sendInputControl({ type: "KeyPress", data: key }),
- moveMouse: (x: number, y: number) =>
- sendInputControl({ type: "MouseMove", data: { x, y } }),
- click: (button: "left" | "right" | "middle") =>
- sendInputControl({ type: "MouseClick", data: button }),
- },
- settings: isNode ? new SettingsManager() : undefined,
-};
-
-async function sendInputControl(action: InputAction): Promise<boolean> {
- const apiUrl = process.env.SCREENPIPE_SERVER_URL || "http://localhost:3030";
- try {
- const response = await fetch(`${apiUrl}/experimental/input_control`, {
- method: "POST",
- headers: { "Content-Type": "application/json" },
- body: JSON.stringify({ action }),
- });
- if (!response.ok) {
- throw new Error(`HTTP error! status: ${response.status}`);
- }
- const data: InputControlResponse = await response.json();
- return data.success;
- } catch (error) {
- console.error("failed to control input:", error);
- return false;
- }
-}
-
-export interface NotificationAction {
- id: string;
- label: string;
- callback?: () => Promise<void>;
-}
+// Note: Node-specific functionality is not exported in browser bundle
+// It will be handled by the package.json "exports" field
diff --git a/screenpipe-js/next.ts b/screenpipe-js/next.ts
new file mode 100644
index 000000000..78ccc0834
--- /dev/null
+++ b/screenpipe-js/next.ts
@@ -0,0 +1,27 @@
+// next.ts
+// Types and utilities shared between browser and Node environments
+export * from "./types";
+
+// Helper functions that work in both environments
+export function toCamelCase(str: string): string {
+ return str.replace(/([-_][a-z])/g, (group) =>
+ group.toUpperCase().replace("-", "").replace("_", "")
+ );
+}
+
+export function toSnakeCase(str: string): string {
+ return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
+}
+
+export function convertToCamelCase(obj: any): any {
+ if (Array.isArray(obj)) {
+ return obj.map(convertToCamelCase);
+ } else if (obj !== null && typeof obj === "object") {
+ return Object.keys(obj).reduce((result, key) => {
+ const camelKey = toCamelCase(key);
+ result[camelKey] = convertToCamelCase(obj[key]);
+ return result;
+ }, {} as any);
+ }
+ return obj;
+}
diff --git a/screenpipe-js/node.ts b/screenpipe-js/node.ts
new file mode 100644
index 000000000..566cc8620
--- /dev/null
+++ b/screenpipe-js/node.ts
@@ -0,0 +1,350 @@
+// node.ts
+import fs from "fs/promises";
+import path from "path";
+import os from "os";
+import type { Settings, PipeConfig, ParsedConfig, InboxMessage } from "./types";
+import { AddressInfo, createServer } from "net";
+
+// Environment detection
+const isNode =
+ typeof process !== "undefined" &&
+ process.versions != null &&
+ process.versions.node != null;
+
+function assertNode(functionName: string) {
+ if (!isNode) {
+ throw new Error(`${functionName} is only available in Node.js environment`);
+ }
+}
+
+// Helper for dynamic imports
+async function requireNodeModule(moduleName: string) {
+ if (!isNode) return null;
+ try {
+ return await import(moduleName);
+ } catch (e) {
+ console.error(`failed to import ${moduleName}:`, e);
+ return null;
+ }
+}
+
+const DEFAULT_SETTINGS: Settings = {
+ openaiApiKey: "",
+ deepgramApiKey: "",
+ aiModel: "gpt-4",
+ aiUrl: "https://api.openai.com/v1",
+ customPrompt: `Rules:
+- You can analyze/view/show/access videos to the user by putting .mp4 files in a code block (we'll render it) like this: \`/users/video.mp4\`, use the exact, absolute, file path from file_path property
+- Do not try to embed video in links (e.g. [](.mp4) or https://.mp4) instead put the file_path in a code block using backticks
+- Do not put video in multiline code block it will not render the video (e.g. \`\`\`bash\n.mp4\`\`\` IS WRONG) instead using inline code block with single backtick
+- Always answer my question/intent, do not make up things`,
+ port: 3030,
+ dataDir: "default",
+ disableAudio: false,
+ ignoredWindows: [],
+ includedWindows: [],
+ aiProviderType: "openai",
+ embeddedLLM: {
+ enabled: false,
+ model: "llama3.2:1b-instruct-q4_K_M",
+ port: 11438,
+ },
+ enableFrameCache: true,
+ enableUiMonitoring: false,
+ aiMaxContextChars: 128000,
+};
+
+class SettingsManager {
+ private settings: Settings;
+ private storePath: string;
+ private initialized: boolean = false;
+
+ constructor() {
+ assertNode("SettingsManager");
+ this.settings = DEFAULT_SETTINGS;
+ this.storePath = ""; // will be set in init()
+ }
+
+ private async getStorePath(): Promise<string> {
+ const platform = process.platform;
+ const home = os.homedir();
+
+ switch (platform) {
+ case "darwin":
+ return path.join(
+ home,
+ "Library",
+ "Application Support",
+ "screenpipe",
+ "store.bin"
+ );
+ case "linux":
+ const xdgData =
+ process.env.XDG_DATA_HOME || path.join(home, ".local", "share");
+ return path.join(xdgData, "screenpipe", "store.bin");
+ case "win32":
+ return path.join(
+ process.env.LOCALAPPDATA || path.join(home, "AppData", "Local"),
+ "screenpipe",
+ "store.bin"
+ );
+ default:
+ throw new Error(`unsupported platform: ${platform}`);
+ }
+ }
+
+ async init(): Promise<void> {
+ if (this.initialized) return;
+
+ if (!fs || !path) throw new Error("failed to load required modules");
+
+ this.storePath = await this.getStorePath();
+
+ try {
+ await fs.mkdir(path.dirname(this.storePath), { recursive: true });
+ const data = await fs.readFile(this.storePath);
+ this.settings = { ...DEFAULT_SETTINGS, ...JSON.parse(data.toString()) };
+ this.initialized = true;
+ } catch (error) {
+ if ((error as { code?: string }).code === "ENOENT") {
+ await this.save();
+ this.initialized = true;
+ } else {
+ throw error;
+ }
+ }
+ }
+
+ async save(): Promise<void> {
+ await fs.mkdir(path.dirname(this.storePath), { recursive: true });
+ await fs.writeFile(this.storePath, JSON.stringify(this.settings, null, 2));
+ }
+
+ async get<K extends keyof Settings>(key: K): Promise<Settings[K]> {
+ if (!this.initialized) await this.init();
+ return this.settings[key];
+ }
+
+ async set<K extends keyof Settings>(
+ key: K,
+ value: Settings[K]
+ ): Promise<void> {
+ if (!this.initialized) await this.init();
+ this.settings[key] = value;
+ await this.save();
+ }
+
+ async getAll(): Promise<Settings> {
+ if (!this.initialized) await this.init();
+ return { ...this.settings };
+ }
+
+ async update(newSettings: Partial<Settings>): Promise<void> {
+ if (!this.initialized) await this.init();
+ this.settings = { ...this.settings, ...newSettings };
+ await this.save();
+ }
+
+ async reset(): Promise<void> {
+ this.settings = { ...DEFAULT_SETTINGS };
+ await this.save();
+ }
+
+ async resetKey<K extends keyof Settings>(key: K): Promise<void> {
+ if (!this.initialized) await this.init();
+ this.settings[key] = DEFAULT_SETTINGS[key];
+ await this.save();
+ }
+}
+
+class Task {
+ private _name: string;
+ private _interval: string | number;
+ private _time: string | null = null;
+ private _handler: (() => Promise<void>) | null = null;
+ private _cronTask: any | null = null;
+
+ constructor(name: string) {
+ assertNode("Task");
+ this._name = name;
+ this._interval = 0;
+ }
+
+ every(interval: string | number): Task {
+ this._interval = interval;
+ return this;
+ }
+
+ at(time: string): Task {
+ this._time = time;
+ return this;
+ }
+
+ do(handler: () => Promise<void>): Task {
+ this._handler = handler;
+ return this;
+ }
+
+ async schedule(): Promise<void> {
+ if (!this._handler) {
+ throw new Error(`No handler defined for task: ${this._name}`);
+ }
+
+ assertNode("Task.schedule");
+ const cron = await requireNodeModule("node-cron");
+ const cronExpression = this.toCronExpression();
+
+ this._cronTask = cron.schedule(cronExpression, this._handler, {
+ name: this._name,
+ });
+ }
+
+ stop(): void {
+ assertNode("Task.stop");
+ return this._cronTask?.stop();
+ }
+
+ private toCronExpression(): string {
+ if (typeof this._interval === "number") {
+ const minutes = Math.floor(this._interval / 60000);
+ return `*/${minutes} * * * *`;
+ }
+
+ const [value, unit] = this._interval.split(" ");
+ switch (unit) {
+ case "second":
+ case "seconds":
+ return `*/${value} * * * * *`;
+ case "minute":
+ case "minutes":
+ return `*/${value} * * * *`;
+ case "hour":
+ case "hours":
+ return `0 */${value} * * *`;
+ case "day":
+ case "days":
+ return `0 0 */${value} * *`;
+ default:
+ throw new Error(`Unsupported interval unit: ${unit}`);
+ }
+ }
+}
+
+class Scheduler {
+ private tasks: Task[] = [];
+
+ constructor() {
+ assertNode("Scheduler");
+ }
+
+ task(name: string): Task {
+ const task = new Task(name);
+ this.tasks.push(task);
+ return task;
+ }
+
+ start() {
+ this.tasks.forEach((task) => task.schedule());
+ }
+
+ async stop(): Promise<void> {
+ assertNode("Scheduler.stop");
+ if (isNode) {
+ const cron = await requireNodeModule("node-cron");
+ cron.getTasks().forEach((task: any) => task.stop());
+ }
+ this.tasks = [];
+ }
+}
+
+class InboxManager {
+ private actionServerPort?: number;
+ private actionServerProcess?: any;
+
+ async send(message: InboxMessage): Promise<boolean> {
+ if (!this.actionServerPort) {
+ this.actionServerPort = await getAvailablePort();
+ if (isNode) {
+ const { fork } = await requireNodeModule("child_process");
+ this.actionServerProcess = fork("./inbox-server.js", [
+ this.actionServerPort.toString(),
+ ]);
+ }
+ }
+
+ if (message.actions) {
+ if (!isNode) {
+ console.warn("inbox actions are currently not supported in browser");
+ return false;
+ }
+ message.actions = message.actions.map((action) => {
+ const actionId = crypto.randomUUID();
+ return {
+ label: action.label,
+ action: actionId,
+ port: this.actionServerPort,
+ callback: action.callback,
+ };
+ });
+ }
+
+ try {
+ const response = await fetch("http://localhost:11435/inbox", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({
+ ...message,
+ type: "inbox",
+ actionServerPort: this.actionServerPort,
+ }),
+ });
+
+ return response.ok;
+ } catch (error) {
+ console.error("failed to send inbox message:", error);
+ return false;
+ }
+ }
+}
+
+async function getAvailablePort(): Promise<number> {
+ return new Promise((resolve, reject) => {
+ const server = createServer();
+ server.unref();
+ server.on("error", reject);
+ server.listen(0, () => {
+ const port = (server.address() as AddressInfo).port;
+ server.close(() => resolve(port));
+ });
+ });
+}
+
+// Re-export browser functionality
+export * from "./browser";
+
+// Node-specific pipe implementation
+export const pipe = {
+ ...require("./browser").pipe,
+ settings: new SettingsManager(),
+ scheduler: new Scheduler(),
+ inbox: new InboxManager(),
+ async loadPipeConfig(): Promise<PipeConfig> {
+ try {
+ const baseDir = process.env.SCREENPIPE_DIR || process.cwd();
+ const pipeId = process.env.PIPE_ID || path.basename(process.cwd());
+ const configPath = `${baseDir}/pipes/${pipeId}/pipe.json`;
+
+ const configContent = await fs.readFile(configPath, "utf8");
+ const parsedConfig: ParsedConfig = JSON.parse(configContent);
+ const config: PipeConfig = {};
+ parsedConfig.fields.forEach((field) => {
+ config[field.name] =
+ field.value !== undefined ? field.value : field.default;
+ });
+ return config;
+ } catch (error) {
+ console.error("error loading pipe.json:", error);
+ return {};
+ }
+ },
+};
diff --git a/screenpipe-js/package-lock.json b/screenpipe-js/package-lock.json
new file mode 100644
index 000000000..55e654650
--- /dev/null
+++ b/screenpipe-js/package-lock.json
@@ -0,0 +1,1835 @@
+{
+ "name": "@screenpipe/js",
+ "version": "0.1.10-beta.12",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "@screenpipe/js",
+ "version": "0.1.10-beta.12",
+ "dependencies": {
+ "@scarf/scarf": "^1.4.0",
+ "@types/express": "^5.0.0",
+ "@types/node-cron": "^3.0.11",
+ "cron-parser": "^4.9.0",
+ "express": "^4.21.1",
+ "node-cron": "^3.0.3"
+ },
+ "devDependencies": {
+ "@types/node": "^22.10.2",
+ "bun-types": "latest",
+ "tsup": "^8.0.0"
+ },
+ "peerDependencies": {
+ "typescript": "^5.0.0"
+ }
+ },
+ "node_modules/@esbuild/darwin-arm64": {
+ "version": "0.24.0",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@isaacs/cliui": {
+ "version": "8.0.2",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "string-width": "^5.1.2",
+ "string-width-cjs": "npm:string-width@^4.2.0",
+ "strip-ansi": "^7.0.1",
+ "strip-ansi-cjs": "npm:strip-ansi@^6.0.1",
+ "wrap-ansi": "^8.1.0",
+ "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@jridgewell/gen-mapping": {
+ "version": "0.3.8",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/set-array": "^1.2.1",
+ "@jridgewell/sourcemap-codec": "^1.4.10",
+ "@jridgewell/trace-mapping": "^0.3.24"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@jridgewell/resolve-uri": {
+ "version": "3.1.2",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@jridgewell/set-array": {
+ "version": "1.2.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@jridgewell/sourcemap-codec": {
+ "version": "1.5.0",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@jridgewell/trace-mapping": {
+ "version": "0.3.25",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/resolve-uri": "^3.1.0",
+ "@jridgewell/sourcemap-codec": "^1.4.14"
+ }
+ },
+ "node_modules/@pkgjs/parseargs": {
+ "version": "0.11.0",
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "engines": {
+ "node": ">=14"
+ }
+ },
+ "node_modules/@rollup/rollup-darwin-arm64": {
+ "version": "4.28.1",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@scarf/scarf": {
+ "version": "1.4.0",
+ "hasInstallScript": true,
+ "license": "Apache-2.0"
+ },
+ "node_modules/@types/body-parser": {
+ "version": "1.19.5",
+ "license": "MIT",
+ "dependencies": {
+ "@types/connect": "*",
+ "@types/node": "*"
+ }
+ },
+ "node_modules/@types/connect": {
+ "version": "3.4.38",
+ "license": "MIT",
+ "dependencies": {
+ "@types/node": "*"
+ }
+ },
+ "node_modules/@types/estree": {
+ "version": "1.0.6",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/express": {
+ "version": "5.0.0",
+ "license": "MIT",
+ "dependencies": {
+ "@types/body-parser": "*",
+ "@types/express-serve-static-core": "^5.0.0",
+ "@types/qs": "*",
+ "@types/serve-static": "*"
+ }
+ },
+ "node_modules/@types/express-serve-static-core": {
+ "version": "5.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "@types/node": "*",
+ "@types/qs": "*",
+ "@types/range-parser": "*",
+ "@types/send": "*"
+ }
+ },
+ "node_modules/@types/http-errors": {
+ "version": "2.0.4",
+ "license": "MIT"
+ },
+ "node_modules/@types/mime": {
+ "version": "1.3.5",
+ "license": "MIT"
+ },
+ "node_modules/@types/node": {
+ "version": "22.10.2",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.2.tgz",
+ "integrity": "sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==",
+ "dependencies": {
+ "undici-types": "~6.20.0"
+ }
+ },
+ "node_modules/@types/node-cron": {
+ "version": "3.0.11",
+ "license": "MIT"
+ },
+ "node_modules/@types/qs": {
+ "version": "6.9.17",
+ "license": "MIT"
+ },
+ "node_modules/@types/range-parser": {
+ "version": "1.2.7",
+ "license": "MIT"
+ },
+ "node_modules/@types/send": {
+ "version": "0.17.4",
+ "license": "MIT",
+ "dependencies": {
+ "@types/mime": "^1",
+ "@types/node": "*"
+ }
+ },
+ "node_modules/@types/serve-static": {
+ "version": "1.15.7",
+ "license": "MIT",
+ "dependencies": {
+ "@types/http-errors": "*",
+ "@types/node": "*",
+ "@types/send": "*"
+ }
+ },
+ "node_modules/@types/ws": {
+ "version": "8.5.12",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/node": "*"
+ }
+ },
+ "node_modules/accepts": {
+ "version": "1.3.8",
+ "license": "MIT",
+ "dependencies": {
+ "mime-types": "~2.1.34",
+ "negotiator": "0.6.3"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/ansi-regex": {
+ "version": "6.1.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-regex?sponsor=1"
+ }
+ },
+ "node_modules/ansi-styles": {
+ "version": "6.2.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/any-promise": {
+ "version": "1.3.0",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/array-flatten": {
+ "version": "1.1.1",
+ "license": "MIT"
+ },
+ "node_modules/balanced-match": {
+ "version": "1.0.2",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/body-parser": {
+ "version": "1.20.3",
+ "license": "MIT",
+ "dependencies": {
+ "bytes": "3.1.2",
+ "content-type": "~1.0.5",
+ "debug": "2.6.9",
+ "depd": "2.0.0",
+ "destroy": "1.2.0",
+ "http-errors": "2.0.0",
+ "iconv-lite": "0.4.24",
+ "on-finished": "2.4.1",
+ "qs": "6.13.0",
+ "raw-body": "2.5.2",
+ "type-is": "~1.6.18",
+ "unpipe": "1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8",
+ "npm": "1.2.8000 || >= 1.4.16"
+ }
+ },
+ "node_modules/body-parser/node_modules/debug": {
+ "version": "2.6.9",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "2.0.0"
+ }
+ },
+ "node_modules/body-parser/node_modules/debug/node_modules/ms": {
+ "version": "2.0.0",
+ "license": "MIT"
+ },
+ "node_modules/brace-expansion": {
+ "version": "2.0.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^1.0.0"
+ }
+ },
+ "node_modules/bun-types": {
+ "version": "1.1.38",
+ "resolved": "https://registry.npmjs.org/bun-types/-/bun-types-1.1.38.tgz",
+ "integrity": "sha512-iglB2t9z1Hc6DIuwwscwWj/csx22QlCZ96QbcqQfiy1wmuZ38srQLI/fDVkFHAo2+KL7aJZGVWF+nAWrR6Njig==",
+ "dev": true,
+ "dependencies": {
+ "@types/node": "~20.12.8",
+ "@types/ws": "~8.5.10"
+ }
+ },
+ "node_modules/bun-types/node_modules/@types/node": {
+ "version": "20.12.14",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "undici-types": "~5.26.4"
+ }
+ },
+ "node_modules/bun-types/node_modules/@types/node/node_modules/undici-types": {
+ "version": "5.26.5",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/bundle-require": {
+ "version": "5.0.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "load-tsconfig": "^0.2.3"
+ },
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ },
+ "peerDependencies": {
+ "esbuild": ">=0.18"
+ }
+ },
+ "node_modules/bytes": {
+ "version": "3.1.2",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/cac": {
+ "version": "6.7.14",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/call-bind": {
+ "version": "1.0.7",
+ "license": "MIT",
+ "dependencies": {
+ "es-define-property": "^1.0.0",
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2",
+ "get-intrinsic": "^1.2.4",
+ "set-function-length": "^1.2.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/chokidar": {
+ "version": "4.0.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "readdirp": "^4.0.1"
+ },
+ "engines": {
+ "node": ">= 14.16.0"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/color-convert": {
+ "version": "2.0.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-name": "~1.1.4"
+ },
+ "engines": {
+ "node": ">=7.0.0"
+ }
+ },
+ "node_modules/color-name": {
+ "version": "1.1.4",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/commander": {
+ "version": "4.1.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/consola": {
+ "version": "3.2.3",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^14.18.0 || >=16.10.0"
+ }
+ },
+ "node_modules/content-disposition": {
+ "version": "0.5.4",
+ "license": "MIT",
+ "dependencies": {
+ "safe-buffer": "5.2.1"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/content-type": {
+ "version": "1.0.5",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/cookie": {
+ "version": "0.7.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/cookie-signature": {
+ "version": "1.0.6",
+ "license": "MIT"
+ },
+ "node_modules/cron-parser": {
+ "version": "4.9.0",
+ "license": "MIT",
+ "dependencies": {
+ "luxon": "^3.2.1"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ }
+ },
+ "node_modules/cross-spawn": {
+ "version": "7.0.6",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "path-key": "^3.1.0",
+ "shebang-command": "^2.0.0",
+ "which": "^2.0.1"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/debug": {
+ "version": "4.4.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/define-data-property": {
+ "version": "1.1.4",
+ "license": "MIT",
+ "dependencies": {
+ "es-define-property": "^1.0.0",
+ "es-errors": "^1.3.0",
+ "gopd": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/depd": {
+ "version": "2.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/destroy": {
+ "version": "1.2.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8",
+ "npm": "1.2.8000 || >= 1.4.16"
+ }
+ },
+ "node_modules/eastasianwidth": {
+ "version": "0.2.0",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/ee-first": {
+ "version": "1.1.1",
+ "license": "MIT"
+ },
+ "node_modules/emoji-regex": {
+ "version": "9.2.2",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/encodeurl": {
+ "version": "2.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/es-define-property": {
+ "version": "1.0.0",
+ "license": "MIT",
+ "dependencies": {
+ "get-intrinsic": "^1.2.4"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-errors": {
+ "version": "1.3.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/esbuild": {
+ "version": "0.24.0",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "bin": {
+ "esbuild": "bin/esbuild"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "optionalDependencies": {
+ "@esbuild/aix-ppc64": "0.24.0",
+ "@esbuild/android-arm": "0.24.0",
+ "@esbuild/android-arm64": "0.24.0",
+ "@esbuild/android-x64": "0.24.0",
+ "@esbuild/darwin-arm64": "0.24.0",
+ "@esbuild/darwin-x64": "0.24.0",
+ "@esbuild/freebsd-arm64": "0.24.0",
+ "@esbuild/freebsd-x64": "0.24.0",
+ "@esbuild/linux-arm": "0.24.0",
+ "@esbuild/linux-arm64": "0.24.0",
+ "@esbuild/linux-ia32": "0.24.0",
+ "@esbuild/linux-loong64": "0.24.0",
+ "@esbuild/linux-mips64el": "0.24.0",
+ "@esbuild/linux-ppc64": "0.24.0",
+ "@esbuild/linux-riscv64": "0.24.0",
+ "@esbuild/linux-s390x": "0.24.0",
+ "@esbuild/linux-x64": "0.24.0",
+ "@esbuild/netbsd-x64": "0.24.0",
+ "@esbuild/openbsd-arm64": "0.24.0",
+ "@esbuild/openbsd-x64": "0.24.0",
+ "@esbuild/sunos-x64": "0.24.0",
+ "@esbuild/win32-arm64": "0.24.0",
+ "@esbuild/win32-ia32": "0.24.0",
+ "@esbuild/win32-x64": "0.24.0"
+ }
+ },
+ "node_modules/escape-html": {
+ "version": "1.0.3",
+ "license": "MIT"
+ },
+ "node_modules/etag": {
+ "version": "1.8.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/express": {
+ "version": "4.21.1",
+ "license": "MIT",
+ "dependencies": {
+ "accepts": "~1.3.8",
+ "array-flatten": "1.1.1",
+ "body-parser": "1.20.3",
+ "content-disposition": "0.5.4",
+ "content-type": "~1.0.4",
+ "cookie": "0.7.1",
+ "cookie-signature": "1.0.6",
+ "debug": "2.6.9",
+ "depd": "2.0.0",
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "etag": "~1.8.1",
+ "finalhandler": "1.3.1",
+ "fresh": "0.5.2",
+ "http-errors": "2.0.0",
+ "merge-descriptors": "1.0.3",
+ "methods": "~1.1.2",
+ "on-finished": "2.4.1",
+ "parseurl": "~1.3.3",
+ "path-to-regexp": "0.1.10",
+ "proxy-addr": "~2.0.7",
+ "qs": "6.13.0",
+ "range-parser": "~1.2.1",
+ "safe-buffer": "5.2.1",
+ "send": "0.19.0",
+ "serve-static": "1.16.2",
+ "setprototypeof": "1.2.0",
+ "statuses": "2.0.1",
+ "type-is": "~1.6.18",
+ "utils-merge": "1.0.1",
+ "vary": "~1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.10.0"
+ }
+ },
+ "node_modules/express/node_modules/debug": {
+ "version": "2.6.9",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "2.0.0"
+ }
+ },
+ "node_modules/express/node_modules/debug/node_modules/ms": {
+ "version": "2.0.0",
+ "license": "MIT"
+ },
+ "node_modules/fdir": {
+ "version": "6.4.2",
+ "dev": true,
+ "license": "MIT",
+ "peerDependencies": {
+ "picomatch": "^3 || ^4"
+ },
+ "peerDependenciesMeta": {
+ "picomatch": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/finalhandler": {
+ "version": "1.3.1",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "2.6.9",
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "on-finished": "2.4.1",
+ "parseurl": "~1.3.3",
+ "statuses": "2.0.1",
+ "unpipe": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/finalhandler/node_modules/debug": {
+ "version": "2.6.9",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "2.0.0"
+ }
+ },
+ "node_modules/finalhandler/node_modules/debug/node_modules/ms": {
+ "version": "2.0.0",
+ "license": "MIT"
+ },
+ "node_modules/foreground-child": {
+ "version": "3.3.0",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "cross-spawn": "^7.0.0",
+ "signal-exit": "^4.0.1"
+ },
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/forwarded": {
+ "version": "0.2.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/fresh": {
+ "version": "0.5.2",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.3",
+ "dev": 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",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/get-intrinsic": {
+ "version": "1.2.4",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2",
+ "has-proto": "^1.0.1",
+ "has-symbols": "^1.0.3",
+ "hasown": "^2.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/glob": {
+ "version": "10.4.5",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "foreground-child": "^3.1.0",
+ "jackspeak": "^3.1.2",
+ "minimatch": "^9.0.4",
+ "minipass": "^7.1.2",
+ "package-json-from-dist": "^1.0.0",
+ "path-scurry": "^1.11.1"
+ },
+ "bin": {
+ "glob": "dist/esm/bin.mjs"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/gopd": {
+ "version": "1.0.1",
+ "license": "MIT",
+ "dependencies": {
+ "get-intrinsic": "^1.1.3"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/has-property-descriptors": {
+ "version": "1.0.2",
+ "license": "MIT",
+ "dependencies": {
+ "es-define-property": "^1.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/has-proto": {
+ "version": "1.0.3",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/has-symbols": {
+ "version": "1.0.3",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/hasown": {
+ "version": "2.0.2",
+ "license": "MIT",
+ "dependencies": {
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/http-errors": {
+ "version": "2.0.0",
+ "license": "MIT",
+ "dependencies": {
+ "depd": "2.0.0",
+ "inherits": "2.0.4",
+ "setprototypeof": "1.2.0",
+ "statuses": "2.0.1",
+ "toidentifier": "1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/iconv-lite": {
+ "version": "0.4.24",
+ "license": "MIT",
+ "dependencies": {
+ "safer-buffer": ">= 2.1.2 < 3"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/inherits": {
+ "version": "2.0.4",
+ "license": "ISC"
+ },
+ "node_modules/ipaddr.js": {
+ "version": "1.9.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/isexe": {
+ "version": "2.0.0",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/jackspeak": {
+ "version": "3.4.3",
+ "dev": true,
+ "license": "BlueOak-1.0.0",
+ "dependencies": {
+ "@isaacs/cliui": "^8.0.2"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ },
+ "optionalDependencies": {
+ "@pkgjs/parseargs": "^0.11.0"
+ }
+ },
+ "node_modules/joycon": {
+ "version": "3.1.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/lilconfig": {
+ "version": "3.1.3",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/antonk52"
+ }
+ },
+ "node_modules/lines-and-columns": {
+ "version": "1.2.4",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/load-tsconfig": {
+ "version": "0.2.5",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ }
+ },
+ "node_modules/lodash.sortby": {
+ "version": "4.7.0",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/lru-cache": {
+ "version": "10.4.3",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/luxon": {
+ "version": "3.5.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/media-typer": {
+ "version": "0.3.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/merge-descriptors": {
+ "version": "1.0.3",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/methods": {
+ "version": "1.1.2",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime": {
+ "version": "1.6.0",
+ "license": "MIT",
+ "bin": {
+ "mime": "cli.js"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/mime-db": {
+ "version": "1.52.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime-types": {
+ "version": "2.1.35",
+ "license": "MIT",
+ "dependencies": {
+ "mime-db": "1.52.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/minimatch": {
+ "version": "9.0.5",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "brace-expansion": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=16 || 14 >=14.17"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/minipass": {
+ "version": "7.1.2",
+ "dev": true,
+ "license": "ISC",
+ "engines": {
+ "node": ">=16 || 14 >=14.17"
+ }
+ },
+ "node_modules/ms": {
+ "version": "2.1.3",
+ "license": "MIT"
+ },
+ "node_modules/mz": {
+ "version": "2.7.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "any-promise": "^1.0.0",
+ "object-assign": "^4.0.1",
+ "thenify-all": "^1.0.0"
+ }
+ },
+ "node_modules/negotiator": {
+ "version": "0.6.3",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/node-cron": {
+ "version": "3.0.3",
+ "license": "ISC",
+ "dependencies": {
+ "uuid": "8.3.2"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/object-assign": {
+ "version": "4.1.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/object-inspect": {
+ "version": "1.13.3",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/on-finished": {
+ "version": "2.4.1",
+ "license": "MIT",
+ "dependencies": {
+ "ee-first": "1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/package-json-from-dist": {
+ "version": "1.0.1",
+ "dev": true,
+ "license": "BlueOak-1.0.0"
+ },
+ "node_modules/parseurl": {
+ "version": "1.3.3",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/path-key": {
+ "version": "3.1.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/path-scurry": {
+ "version": "1.11.1",
+ "dev": true,
+ "license": "BlueOak-1.0.0",
+ "dependencies": {
+ "lru-cache": "^10.2.0",
+ "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
+ },
+ "engines": {
+ "node": ">=16 || 14 >=14.18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/path-to-regexp": {
+ "version": "0.1.10",
+ "license": "MIT"
+ },
+ "node_modules/picocolors": {
+ "version": "1.1.1",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/picomatch": {
+ "version": "4.0.2",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/pirates": {
+ "version": "4.0.6",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/postcss-load-config": {
+ "version": "6.0.1",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "lilconfig": "^3.1.1"
+ },
+ "engines": {
+ "node": ">= 18"
+ },
+ "peerDependencies": {
+ "jiti": ">=1.21.0",
+ "postcss": ">=8.0.9",
+ "tsx": "^4.8.1",
+ "yaml": "^2.4.2"
+ },
+ "peerDependenciesMeta": {
+ "jiti": {
+ "optional": true
+ },
+ "postcss": {
+ "optional": true
+ },
+ "tsx": {
+ "optional": true
+ },
+ "yaml": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/proxy-addr": {
+ "version": "2.0.7",
+ "license": "MIT",
+ "dependencies": {
+ "forwarded": "0.2.0",
+ "ipaddr.js": "1.9.1"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/punycode": {
+ "version": "2.3.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/qs": {
+ "version": "6.13.0",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "side-channel": "^1.0.6"
+ },
+ "engines": {
+ "node": ">=0.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/range-parser": {
+ "version": "1.2.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/raw-body": {
+ "version": "2.5.2",
+ "license": "MIT",
+ "dependencies": {
+ "bytes": "3.1.2",
+ "http-errors": "2.0.0",
+ "iconv-lite": "0.4.24",
+ "unpipe": "1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/readdirp": {
+ "version": "4.0.2",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 14.16.0"
+ },
+ "funding": {
+ "type": "individual",
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/resolve-from": {
+ "version": "5.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/rollup": {
+ "version": "4.28.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/estree": "1.0.6"
+ },
+ "bin": {
+ "rollup": "dist/bin/rollup"
+ },
+ "engines": {
+ "node": ">=18.0.0",
+ "npm": ">=8.0.0"
+ },
+ "optionalDependencies": {
+ "@rollup/rollup-android-arm-eabi": "4.28.1",
+ "@rollup/rollup-android-arm64": "4.28.1",
+ "@rollup/rollup-darwin-arm64": "4.28.1",
+ "@rollup/rollup-darwin-x64": "4.28.1",
+ "@rollup/rollup-freebsd-arm64": "4.28.1",
+ "@rollup/rollup-freebsd-x64": "4.28.1",
+ "@rollup/rollup-linux-arm-gnueabihf": "4.28.1",
+ "@rollup/rollup-linux-arm-musleabihf": "4.28.1",
+ "@rollup/rollup-linux-arm64-gnu": "4.28.1",
+ "@rollup/rollup-linux-arm64-musl": "4.28.1",
+ "@rollup/rollup-linux-loongarch64-gnu": "4.28.1",
+ "@rollup/rollup-linux-powerpc64le-gnu": "4.28.1",
+ "@rollup/rollup-linux-riscv64-gnu": "4.28.1",
+ "@rollup/rollup-linux-s390x-gnu": "4.28.1",
+ "@rollup/rollup-linux-x64-gnu": "4.28.1",
+ "@rollup/rollup-linux-x64-musl": "4.28.1",
+ "@rollup/rollup-win32-arm64-msvc": "4.28.1",
+ "@rollup/rollup-win32-ia32-msvc": "4.28.1",
+ "@rollup/rollup-win32-x64-msvc": "4.28.1",
+ "fsevents": "~2.3.2"
+ }
+ },
+ "node_modules/safe-buffer": {
+ "version": "5.2.1",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/safer-buffer": {
+ "version": "2.1.2",
+ "license": "MIT"
+ },
+ "node_modules/send": {
+ "version": "0.19.0",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "2.6.9",
+ "depd": "2.0.0",
+ "destroy": "1.2.0",
+ "encodeurl": "~1.0.2",
+ "escape-html": "~1.0.3",
+ "etag": "~1.8.1",
+ "fresh": "0.5.2",
+ "http-errors": "2.0.0",
+ "mime": "1.6.0",
+ "ms": "2.1.3",
+ "on-finished": "2.4.1",
+ "range-parser": "~1.2.1",
+ "statuses": "2.0.1"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/send/node_modules/debug": {
+ "version": "2.6.9",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "2.0.0"
+ }
+ },
+ "node_modules/send/node_modules/debug/node_modules/ms": {
+ "version": "2.0.0",
+ "license": "MIT"
+ },
+ "node_modules/send/node_modules/encodeurl": {
+ "version": "1.0.2",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/serve-static": {
+ "version": "1.16.2",
+ "license": "MIT",
+ "dependencies": {
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "parseurl": "~1.3.3",
+ "send": "0.19.0"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/set-function-length": {
+ "version": "1.2.2",
+ "license": "MIT",
+ "dependencies": {
+ "define-data-property": "^1.1.4",
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2",
+ "get-intrinsic": "^1.2.4",
+ "gopd": "^1.0.1",
+ "has-property-descriptors": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/setprototypeof": {
+ "version": "1.2.0",
+ "license": "ISC"
+ },
+ "node_modules/shebang-command": {
+ "version": "2.0.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "shebang-regex": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/shebang-regex": {
+ "version": "3.0.0",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/side-channel": {
+ "version": "1.0.6",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind": "^1.0.7",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.4",
+ "object-inspect": "^1.13.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/signal-exit": {
+ "version": "4.1.0",
+ "dev": true,
+ "license": "ISC",
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/source-map": {
+ "version": "0.8.0-beta.0",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "whatwg-url": "^7.0.0"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/statuses": {
+ "version": "2.0.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/string-width": {
+ "version": "5.1.2",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "eastasianwidth": "^0.2.0",
+ "emoji-regex": "^9.2.2",
+ "strip-ansi": "^7.0.1"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/string-width-cjs": {
+ "name": "string-width",
+ "version": "4.2.3",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/string-width-cjs/node_modules/emoji-regex": {
+ "version": "8.0.0",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/string-width-cjs/node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/string-width-cjs/node_modules/strip-ansi/node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/strip-ansi": {
+ "version": "7.1.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/strip-ansi?sponsor=1"
+ }
+ },
+ "node_modules/strip-ansi-cjs": {
+ "name": "strip-ansi",
+ "version": "6.0.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/strip-ansi-cjs/node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/sucrase": {
+ "version": "3.35.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/gen-mapping": "^0.3.2",
+ "commander": "^4.0.0",
+ "glob": "^10.3.10",
+ "lines-and-columns": "^1.1.6",
+ "mz": "^2.7.0",
+ "pirates": "^4.0.1",
+ "ts-interface-checker": "^0.1.9"
+ },
+ "bin": {
+ "sucrase": "bin/sucrase",
+ "sucrase-node": "bin/sucrase-node"
+ },
+ "engines": {
+ "node": ">=16 || 14 >=14.17"
+ }
+ },
+ "node_modules/thenify": {
+ "version": "3.3.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "any-promise": "^1.0.0"
+ }
+ },
+ "node_modules/thenify-all": {
+ "version": "1.6.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "thenify": ">= 3.1.0 < 4"
+ },
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
+ "node_modules/tinyexec": {
+ "version": "0.3.1",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/tinyglobby": {
+ "version": "0.2.10",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "fdir": "^6.4.2",
+ "picomatch": "^4.0.2"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ }
+ },
+ "node_modules/toidentifier": {
+ "version": "1.0.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.6"
+ }
+ },
+ "node_modules/tr46": {
+ "version": "1.0.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "punycode": "^2.1.0"
+ }
+ },
+ "node_modules/tree-kill": {
+ "version": "1.2.2",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "tree-kill": "cli.js"
+ }
+ },
+ "node_modules/ts-interface-checker": {
+ "version": "0.1.13",
+ "dev": true,
+ "license": "Apache-2.0"
+ },
+ "node_modules/tsup": {
+ "version": "8.3.5",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "bundle-require": "^5.0.0",
+ "cac": "^6.7.14",
+ "chokidar": "^4.0.1",
+ "consola": "^3.2.3",
+ "debug": "^4.3.7",
+ "esbuild": "^0.24.0",
+ "joycon": "^3.1.1",
+ "picocolors": "^1.1.1",
+ "postcss-load-config": "^6.0.1",
+ "resolve-from": "^5.0.0",
+ "rollup": "^4.24.0",
+ "source-map": "0.8.0-beta.0",
+ "sucrase": "^3.35.0",
+ "tinyexec": "^0.3.1",
+ "tinyglobby": "^0.2.9",
+ "tree-kill": "^1.2.2"
+ },
+ "bin": {
+ "tsup": "dist/cli-default.js",
+ "tsup-node": "dist/cli-node.js"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "@microsoft/api-extractor": "^7.36.0",
+ "@swc/core": "^1",
+ "postcss": "^8.4.12",
+ "typescript": ">=4.5.0"
+ },
+ "peerDependenciesMeta": {
+ "@microsoft/api-extractor": {
+ "optional": true
+ },
+ "@swc/core": {
+ "optional": true
+ },
+ "postcss": {
+ "optional": true
+ },
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/type-is": {
+ "version": "1.6.18",
+ "license": "MIT",
+ "dependencies": {
+ "media-typer": "0.3.0",
+ "mime-types": "~2.1.24"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/typescript": {
+ "version": "5.6.3",
+ "license": "Apache-2.0",
+ "peer": true,
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=14.17"
+ }
+ },
+ "node_modules/undici-types": {
+ "version": "6.20.0",
+ "license": "MIT"
+ },
+ "node_modules/unpipe": {
+ "version": "1.0.0",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/utils-merge": {
+ "version": "1.0.1",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4.0"
+ }
+ },
+ "node_modules/uuid": {
+ "version": "8.3.2",
+ "license": "MIT",
+ "bin": {
+ "uuid": "dist/bin/uuid"
+ }
+ },
+ "node_modules/vary": {
+ "version": "1.1.2",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/webidl-conversions": {
+ "version": "4.0.2",
+ "dev": true,
+ "license": "BSD-2-Clause"
+ },
+ "node_modules/whatwg-url": {
+ "version": "7.1.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "lodash.sortby": "^4.7.0",
+ "tr46": "^1.0.1",
+ "webidl-conversions": "^4.0.2"
+ }
+ },
+ "node_modules/which": {
+ "version": "2.0.2",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "isexe": "^2.0.0"
+ },
+ "bin": {
+ "node-which": "bin/node-which"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/wrap-ansi": {
+ "version": "8.1.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^6.1.0",
+ "string-width": "^5.0.1",
+ "strip-ansi": "^7.0.1"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+ }
+ },
+ "node_modules/wrap-ansi-cjs": {
+ "name": "wrap-ansi",
+ "version": "7.0.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+ }
+ },
+ "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/wrap-ansi-cjs/node_modules/string-width": {
+ "version": "4.2.3",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/wrap-ansi-cjs/node_modules/string-width/node_modules/emoji-regex": {
+ "version": "8.0.0",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/wrap-ansi-cjs/node_modules/strip-ansi/node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ }
+ }
+}
diff --git a/screenpipe-js/package.json b/screenpipe-js/package.json
index 9fe374b59..7f18d4e6f 100644
--- a/screenpipe-js/package.json
+++ b/screenpipe-js/package.json
@@ -1,30 +1,31 @@
{
"name": "@screenpipe/js",
- "version": "0.1.10-beta.11",
+ "version": "0.1.10-beta.18",
"type": "module",
"main": "./dist/main.cjs",
"module": "./dist/main.js",
"types": "./dist/main.d.ts",
"files": [
- "dist",
- "index.d.ts"
+ "dist"
],
"exports": {
".": {
"types": "./dist/main.d.ts",
+ "browser": "./dist/browser.js",
+ "node": "./dist/node.js",
"import": "./dist/main.js",
"require": "./dist/main.cjs",
- "default": "./dist/main.js"
+ "default": "./dist/browser.js"
}
},
"scripts": {
- "build": "tsup main.ts --format esm,cjs --dts --clean",
+ "build": "tsup main.ts browser.ts node.ts next.ts types.ts --format esm,cjs --dts --clean",
"test": "bun test",
"prepublishOnly": "npm run build"
},
"devDependencies": {
- "bun-types": "latest",
"@types/node": "^22.10.2",
+ "bun-types": "latest",
"tsup": "^8.0.0"
},
"dependencies": {
diff --git a/screenpipe-js/tsconfig.json b/screenpipe-js/tsconfig.json
index ab9b0a034..b4d03ed08 100644
--- a/screenpipe-js/tsconfig.json
+++ b/screenpipe-js/tsconfig.json
@@ -4,7 +4,8 @@
"module": "ESNext",
"moduleResolution": "bundler",
"types": [
- "bun-types"
+ "bun-types",
+ "node"
],
"esModuleInterop": true,
"skipLibCheck": true,
@@ -14,11 +15,12 @@
"outDir": "dist"
},
"include": [
- "src/**/*",
+ "*.ts",
"index.d.ts"
],
"exclude": [
"node_modules",
- "dist"
+ "dist",
+ "create-pipe"
]
}
diff --git a/screenpipe-js/types.ts b/screenpipe-js/types.ts
new file mode 100644
index 000000000..bbc804565
--- /dev/null
+++ b/screenpipe-js/types.ts
@@ -0,0 +1,210 @@
+// types.ts
+
+/**
+ * Types of content that can be queried in Screenpipe.
+ */
+export type ContentType =
+ | "all"
+ | "ocr"
+ | "audio"
+ | "ui"
+ | "audio+ui"
+ | "ocr+ui"
+ | "audio+ocr";
+
+/**
+ * Parameters for querying Screenpipe.
+ */
+export interface ScreenpipeQueryParams {
+ q?: string;
+ contentType?: ContentType;
+ limit?: number;
+ offset?: number;
+ startTime?: string;
+ endTime?: string;
+ appName?: string;
+ windowName?: string;
+ includeFrames?: boolean;
+ minLength?: number;
+ maxLength?: number;
+ speakerIds?: number[];
+}
+
+/**
+ * Structure of OCR (Optical Character Recognition) content.
+ */
+export interface OCRContent {
+ frameId: number;
+ text: string;
+ timestamp: string;
+ filePath: string;
+ offsetIndex: number;
+ appName: string;
+ windowName: string;
+ tags: string[];
+ frame?: string;
+}
+
+/**
+ * Structure of audio content.
+ */
+export interface AudioContent {
+ chunkId: number;
+ transcription: string;
+ timestamp: string;
+ filePath: string;
+ offsetIndex: number;
+ tags: string[];
+ deviceName: string;
+ deviceType: string;
+ speaker?: Speaker;
+}
+
+/**
+ * Structure of UI content.
+ */
+export interface UiContent {
+ id: number;
+ text: string;
+ timestamp: string;
+ appName: string;
+ windowName: string;
+ initialTraversalAt?: string;
+ filePath: string;
+ offsetIndex: number;
+}
+
+/**
+ * Speaker information
+ */
+export interface Speaker {
+ id: number;
+ name?: string;
+ metadata?: string;
+}
+
+/**
+ * Union type for different types of content items.
+ */
+export type ContentItem =
+ | { type: "OCR"; content: OCRContent }
+ | { type: "Audio"; content: AudioContent }
+ | { type: "UI"; content: UiContent };
+
+/**
+ * Pagination information for search results.
+ */
+export interface PaginationInfo {
+ limit: number;
+ offset: number;
+ total: number;
+}
+
+/**
+ * Structure of the response from a Screenpipe query.
+ */
+export interface ScreenpipeResponse {
+ data: ContentItem[];
+ pagination: PaginationInfo;
+}
+
+/**
+ * Input control action types
+ */
+export type InputAction =
+ | { type: "WriteText"; data: string }
+ | { type: "KeyPress"; data: string }
+ | { type: "MouseMove"; data: { x: number; y: number } }
+ | { type: "MouseClick"; data: "left" | "right" | "middle" };
+
+/**
+ * Response from input control operations
+ */
+export interface InputControlResponse {
+ success: boolean;
+}
+
+/**
+ * Notification options
+ */
+export interface NotificationOptions {
+ title: string;
+ body: string;
+ actions?: NotificationAction[];
+ timeout?: number;
+ persistent?: boolean;
+}
+
+export interface NotificationAction {
+ id: string;
+ label: string;
+ callback?: () => Promise<void>;
+}
+
+/**
+ * Inbox message structure
+ */
+export interface InboxMessage {
+ title: string;
+ body: string;
+ actions?: InboxMessageAction[];
+}
+
+export interface InboxMessageAction {
+ label: string;
+ action: string;
+ callback: () => Promise<void>;
+}
+
+export interface ActionResponse {
+ action: string;
+}
+
+/**
+ * Settings types
+ */
+export type AIProviderType =
+ | "native-ollama"
+ | "openai"
+ | "custom"
+ | "embedded"
+ | "screenpipe-cloud";
+
+export interface EmbeddedLLMConfig {
+ enabled: boolean;
+ model: string;
+ port: number;
+}
+
+export interface Settings {
+ openaiApiKey: string;
+ deepgramApiKey: string;
+ aiModel: string;
+ aiUrl: string;
+ customPrompt: string;
+ port: number;
+ dataDir: string;
+ disableAudio: boolean;
+ ignoredWindows: string[];
+ includedWindows: string[];
+ aiProviderType: AIProviderType;
+ embeddedLLM: EmbeddedLLMConfig;
+ enableFrameCache: boolean;
+ enableUiMonitoring: boolean;
+ aiMaxContextChars: number;
+}
+
+/**
+ * Pipe configuration types
+ */
+export interface PipeConfig {
+ [key: string]: any;
+}
+
+export interface ParsedConfig<T = unknown> {
+ fields: {
+ name: string;
+ value?: T;
+ default?: T;
+ }[];
+}