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

feat: beta double slash screenpipe action (#498)

Matthew Diakonov87be76d5609d
diff --git a/Cargo.toml b/Cargo.toml
index 8fa7fce63..ac1c44685 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,6 +5,7 @@ members = [
"screenpipe-audio",
"screenpipe-server",
"screenpipe-integrations",
+ "screenpipe-actions",
]
exclude = [
"screenpipe-app-tauri/src-tauri",
diff --git a/content/docs/next.config.mjs b/content/docs/next.config.mjs
index 90bfa85eb..2598c7cd7 100644
--- a/content/docs/next.config.mjs
+++ b/content/docs/next.config.mjs
@@ -1,6 +1,16 @@
import nextra from 'nextra';
import withMDX from '@next/mdx';
+const ContentSecurityPolicy = `
+ default-src 'self';
+ script-src 'self' 'unsafe-inline' 'unsafe-eval' https://entelligence.ai https://d345f39z3arwqc.cloudfront.net;
+ style-src 'self' 'unsafe-inline';
+ img-src * blob: data:;
+ media-src 'none';
+ connect-src *;
+ frame-src *;
+`;
+
const config = withMDX({
extension: /\.mdx?$/,
});
@@ -16,6 +26,19 @@ const nextConfig = {
...config,
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'md', 'mdx'],
reactStrictMode: true,
+ async headers() {
+ return [
+ {
+ source: '/(.*)',
+ headers: [
+ {
+ key: 'Content-Security-Policy',
+ value: ContentSecurityPolicy.replace(/\n/g, ''),
+ },
+ ],
+ },
+ ];
+ },
...withNextra(),
};
diff --git a/content/docs/pages/_document.tsx b/content/docs/pages/_document.tsx
index 628a7334c..d428366d5 100644
--- a/content/docs/pages/_document.tsx
+++ b/content/docs/pages/_document.tsx
@@ -1,12 +1,33 @@
import { Html, Head, Main, NextScript } from "next/document";
+import Script from "next/script";
export default function Document() {
return (
<Html lang="en">
- <Head />
+ <Head>
+ <Script
+ src="https://d345f39z3arwqc.cloudfront.net/entelligence-chat.js"
+ strategy="beforeInteractive"
+ type="module"
+ />
+ </Head>
<body className="antialiased">
<Main />
<NextScript />
+ <Script id="entelligence-init" strategy="afterInteractive">
+ {`
+ if (window.EntelligenceChat) {
+ window.EntelligenceChat.init({
+ analyticsData: {
+ repoName: "screenpipe",
+ organization: "mediar-ai",
+ apiKey: "fdANNfYgwriDY0iADKXzgrJdNIilNdYLvWlWtvMJCoQ",
+ theme: "dark"
+ }
+ });
+ }
+ `}
+ </Script>
</body>
</Html>
);
diff --git a/content/docs/styles/globals.css b/content/docs/styles/globals.css
index 31a51c024..55c8da6fa 100644
--- a/content/docs/styles/globals.css
+++ b/content/docs/styles/globals.css
@@ -5,12 +5,14 @@
:root {
--background: #ffffff;
--foreground: #171717;
+ --invert-logo: 1;
}
@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;
+ --invert-logo: 0;
}
}
@@ -79,6 +81,7 @@ body {
--chart-3: 30 80% 55%;
--chart-4: 280 65% 60%;
--chart-5: 340 75% 55%;
+ --invert-logo: 0;
}
}
diff --git a/screenpipe-actions/Cargo.toml b/screenpipe-actions/Cargo.toml
new file mode 100644
index 000000000..00a91b523
--- /dev/null
+++ b/screenpipe-actions/Cargo.toml
@@ -0,0 +1,36 @@
+[package]
+name = "screenpipe-actions"
+version.workspace = true
+authors.workspace = true
+description.workspace = true
+repository.workspace = true
+license.workspace = true
+edition.workspace = true
+
+[lib]
+name = "screenpipe_actions"
+path = "src/lib.rs"
+
+[[bin]]
+name = "screenpipe-actions"
+path = "src/main.rs"
+
+[dependencies]
+anyhow = "1.0"
+reqwest = { version = "0.11", features = ["json"] }
+serde_json = "1.0"
+xcap = "0.0.13"
+base64 = "0.21" # Add this line
+image = "0.25" # Add this line
+tokio = { version = "1.26", features = ["full"] }
+rdev = "0.5.3"
+enigo = "0.1.3"
+chrono = "0.4"
+tempfile = "3.2"
+url = "2.4.0"
+once_cell = "1.18.0"
+serde = { version = "1.0", features = ["derive"] }
+log = "0.4"
+env_logger = "0.10"
+tracing = { workspace = true }
+tracing-subscriber = { workspace = true }
\ No newline at end of file
diff --git a/screenpipe-actions/ai-proxy/.editorconfig b/screenpipe-actions/ai-proxy/.editorconfig
new file mode 100644
index 000000000..a727df347
--- /dev/null
+++ b/screenpipe-actions/ai-proxy/.editorconfig
@@ -0,0 +1,12 @@
+# http://editorconfig.org
+root = true
+
+[*]
+indent_style = tab
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.yml]
+indent_style = space
diff --git a/screenpipe-actions/ai-proxy/.gitignore b/screenpipe-actions/ai-proxy/.gitignore
new file mode 100644
index 000000000..3b0fe33c4
--- /dev/null
+++ b/screenpipe-actions/ai-proxy/.gitignore
@@ -0,0 +1,172 @@
+# Logs
+
+logs
+_.log
+npm-debug.log_
+yarn-debug.log*
+yarn-error.log*
+lerna-debug.log*
+.pnpm-debug.log*
+
+# Diagnostic reports (https://nodejs.org/api/report.html)
+
+report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
+
+# Runtime data
+
+pids
+_.pid
+_.seed
+\*.pid.lock
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+
+lib-cov
+
+# Coverage directory used by tools like istanbul
+
+coverage
+\*.lcov
+
+# nyc test coverage
+
+.nyc_output
+
+# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
+
+.grunt
+
+# Bower dependency directory (https://bower.io/)
+
+bower_components
+
+# node-waf configuration
+
+.lock-wscript
+
+# Compiled binary addons (https://nodejs.org/api/addons.html)
+
+build/Release
+
+# Dependency directories
+
+node_modules/
+jspm_packages/
+
+# Snowpack dependency directory (https://snowpack.dev/)
+
+web_modules/
+
+# TypeScript cache
+
+\*.tsbuildinfo
+
+# Optional npm cache directory
+
+.npm
+
+# Optional eslint cache
+
+.eslintcache
+
+# Optional stylelint cache
+
+.stylelintcache
+
+# Microbundle cache
+
+.rpt2_cache/
+.rts2_cache_cjs/
+.rts2_cache_es/
+.rts2_cache_umd/
+
+# Optional REPL history
+
+.node_repl_history
+
+# Output of 'npm pack'
+
+\*.tgz
+
+# Yarn Integrity file
+
+.yarn-integrity
+
+# dotenv environment variable files
+
+.env
+.env.development.local
+.env.test.local
+.env.production.local
+.env.local
+
+# parcel-bundler cache (https://parceljs.org/)
+
+.cache
+.parcel-cache
+
+# Next.js build output
+
+.next
+out
+
+# Nuxt.js build / generate output
+
+.nuxt
+dist
+
+# Gatsby files
+
+.cache/
+
+# Comment in the public line in if your project uses Gatsby and not Next.js
+
+# https://nextjs.org/blog/next-9-1#public-directory-support
+
+# public
+
+# vuepress build output
+
+.vuepress/dist
+
+# vuepress v2.x temp and cache directory
+
+.temp
+.cache
+
+# Docusaurus cache and generated files
+
+.docusaurus
+
+# Serverless directories
+
+.serverless/
+
+# FuseBox cache
+
+.fusebox/
+
+# DynamoDB Local files
+
+.dynamodb/
+
+# TernJS port file
+
+.tern-port
+
+# Stores VSCode versions used for testing VSCode extensions
+
+.vscode-test
+
+# yarn v2
+
+.yarn/cache
+.yarn/unplugged
+.yarn/build-state.yml
+.yarn/install-state.gz
+.pnp.\*
+
+# wrangler project
+
+.dev.vars
+.wrangler/
diff --git a/screenpipe-actions/ai-proxy/.prettierrc b/screenpipe-actions/ai-proxy/.prettierrc
new file mode 100644
index 000000000..5c7b5d3c7
--- /dev/null
+++ b/screenpipe-actions/ai-proxy/.prettierrc
@@ -0,0 +1,6 @@
+{
+ "printWidth": 140,
+ "singleQuote": true,
+ "semi": true,
+ "useTabs": true
+}
diff --git a/screenpipe-actions/ai-proxy/package-lock.json b/screenpipe-actions/ai-proxy/package-lock.json
new file mode 100644
index 000000000..a1825d014
--- /dev/null
+++ b/screenpipe-actions/ai-proxy/package-lock.json
@@ -0,0 +1,1476 @@
+{
+ "name": "ai-proxy",
+ "version": "0.0.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "ai-proxy",
+ "version": "0.0.0",
+ "dependencies": {
+ "langfuse-node": "^3.27.0"
+ },
+ "devDependencies": {
+ "@cloudflare/workers-types": "^4.20241011.0",
+ "@types/node": "^22.7.5",
+ "typescript": "^5.5.2",
+ "wrangler": "^3.60.3"
+ }
+ },
+ "node_modules/@cloudflare/kv-asset-handler": {
+ "version": "0.3.4",
+ "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.3.4.tgz",
+ "integrity": "sha512-YLPHc8yASwjNkmcDMQMY35yiWjoKAKnhUbPRszBRS0YgH+IXtsMp61j+yTcnCE3oO2DgP0U3iejLC8FTtKDC8Q==",
+ "dev": true,
+ "dependencies": {
+ "mime": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=16.13"
+ }
+ },
+ "node_modules/@cloudflare/workerd-darwin-64": {
+ "version": "1.20241004.0",
+ "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20241004.0.tgz",
+ "integrity": "sha512-c2afR486NXDRcPm7RaTSRDnffFklPCXde/IeNVhEhBJ8O+pQhBOdDcGIy8zXPwMu0CYga0iHNZmpbsl+ZcHttA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/@cloudflare/workerd-darwin-arm64": {
+ "version": "1.20241004.0",
+ "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20241004.0.tgz",
+ "integrity": "sha512-siD9fexv5lr2IpBczWV7OPgJvHj8/fJUrRAYCMcBURkfiwssK91coQeZlN1NdQ85aYELVgxDFoG+p86OS+ZzLw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/@cloudflare/workerd-linux-64": {
+ "version": "1.20241004.0",
+ "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20241004.0.tgz",
+ "integrity": "sha512-EtKGXO5fzRgX6UhDDLhjjEsB1QtliHb12zavZ/S0C8hKPz76II7MQ3Lls9kfB62fbdMP8L6vcqWPObEUcw6GSw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/@cloudflare/workerd-linux-arm64": {
+ "version": "1.20241004.0",
+ "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20241004.0.tgz",
+ "integrity": "sha512-XO7VBE1YaFf/o9tKO1PqDqaxkU2eAR2DLX7R0+R8p+q92sUDXyoxo48T3yJDfxWndnKJ6hSJfvKanw3Mq9Tisw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/@cloudflare/workerd-windows-64": {
+ "version": "1.20241004.0",
+ "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20241004.0.tgz",
+ "integrity": "sha512-o+TmCYGq58jNUDbG73xOvd648XvJ2TicI++2BBoySklJXG6f4But5AwA8TxQgmeujR3vpBjPZKexEzcZSUOTtA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/@cloudflare/workers-shared": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/@cloudflare/workers-shared/-/workers-shared-0.6.0.tgz",
+ "integrity": "sha512-rfUCvb3hx4AsvdUZsxgk9lmgEnQehqV3jdtXLP/Xr0+P56n11T/0nXNMzmn7Nnv+IJFOV6X9NmFhuMz4sBPw7w==",
+ "dev": true,
+ "dependencies": {
+ "mime": "^3.0.0",
+ "zod": "^3.22.3"
+ },
+ "engines": {
+ "node": ">=16.7.0"
+ }
+ },
+ "node_modules/@cloudflare/workers-types": {
+ "version": "4.20241011.0",
+ "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20241011.0.tgz",
+ "integrity": "sha512-emwBnuFB/2lS1z6NXAeBqrSL8Xwnr7YpgdLuchOmgu/igqBsLLNPBb4Qmgh3neFWUe9wbzQyx030836YF3c3Xw==",
+ "dev": true
+ },
+ "node_modules/@cspotcode/source-map-support": {
+ "version": "0.8.1",
+ "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
+ "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
+ "dev": true,
+ "dependencies": {
+ "@jridgewell/trace-mapping": "0.3.9"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild-plugins/node-globals-polyfill": {
+ "version": "0.2.3",
+ "resolved": "https://registry.npmjs.org/@esbuild-plugins/node-globals-polyfill/-/node-globals-polyfill-0.2.3.tgz",
+ "integrity": "sha512-r3MIryXDeXDOZh7ih1l/yE9ZLORCd5e8vWg02azWRGj5SPTuoh69A2AIyn0Z31V/kHBfZ4HgWJ+OK3GTTwLmnw==",
+ "dev": true,
+ "peerDependencies": {
+ "esbuild": "*"
+ }
+ },
+ "node_modules/@esbuild-plugins/node-modules-polyfill": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/@esbuild-plugins/node-modules-polyfill/-/node-modules-polyfill-0.2.2.tgz",
+ "integrity": "sha512-LXV7QsWJxRuMYvKbiznh+U1ilIop3g2TeKRzUxOG5X3YITc8JyyTa90BmLwqqv0YnX4v32CSlG+vsziZp9dMvA==",
+ "dev": true,
+ "dependencies": {
+ "escape-string-regexp": "^4.0.0",
+ "rollup-plugin-node-polyfills": "^0.2.1"
+ },
+ "peerDependencies": {
+ "esbuild": "*"
+ }
+ },
+ "node_modules/@esbuild/android-arm": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.19.tgz",
+ "integrity": "sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/android-arm64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz",
+ "integrity": "sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/android-x64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.19.tgz",
+ "integrity": "sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/darwin-arm64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz",
+ "integrity": "sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/darwin-x64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz",
+ "integrity": "sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/freebsd-arm64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz",
+ "integrity": "sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/freebsd-x64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz",
+ "integrity": "sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/linux-arm": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz",
+ "integrity": "sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/linux-arm64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz",
+ "integrity": "sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/linux-ia32": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz",
+ "integrity": "sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/linux-loong64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz",
+ "integrity": "sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/linux-mips64el": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz",
+ "integrity": "sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==",
+ "cpu": [
+ "mips64el"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/linux-ppc64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz",
+ "integrity": "sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/linux-riscv64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz",
+ "integrity": "sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/linux-s390x": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz",
+ "integrity": "sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/linux-x64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz",
+ "integrity": "sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/netbsd-x64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz",
+ "integrity": "sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/openbsd-x64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz",
+ "integrity": "sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/sunos-x64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz",
+ "integrity": "sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "sunos"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/win32-arm64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz",
+ "integrity": "sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/win32-ia32": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz",
+ "integrity": "sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/win32-x64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz",
+ "integrity": "sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@fastify/busboy": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz",
+ "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==",
+ "dev": true,
+ "engines": {
+ "node": ">=14"
+ }
+ },
+ "node_modules/@jridgewell/resolve-uri": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
+ "dev": true,
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@jridgewell/sourcemap-codec": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz",
+ "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==",
+ "dev": true
+ },
+ "node_modules/@jridgewell/trace-mapping": {
+ "version": "0.3.9",
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
+ "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
+ "dev": true,
+ "dependencies": {
+ "@jridgewell/resolve-uri": "^3.0.3",
+ "@jridgewell/sourcemap-codec": "^1.4.10"
+ }
+ },
+ "node_modules/@types/node": {
+ "version": "22.7.5",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.5.tgz",
+ "integrity": "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==",
+ "dev": true,
+ "dependencies": {
+ "undici-types": "~6.19.2"
+ }
+ },
+ "node_modules/@types/node-forge": {
+ "version": "1.3.11",
+ "resolved": "https://registry.npmjs.org/@types/node-forge/-/node-forge-1.3.11.tgz",
+ "integrity": "sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==",
+ "dev": true,
+ "dependencies": {
+ "@types/node": "*"
+ }
+ },
+ "node_modules/acorn": {
+ "version": "8.12.1",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz",
+ "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==",
+ "dev": true,
+ "bin": {
+ "acorn": "bin/acorn"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/acorn-walk": {
+ "version": "8.3.4",
+ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz",
+ "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==",
+ "dev": true,
+ "dependencies": {
+ "acorn": "^8.11.0"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/anymatch": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
+ "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
+ "dev": true,
+ "dependencies": {
+ "normalize-path": "^3.0.0",
+ "picomatch": "^2.0.4"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/as-table": {
+ "version": "1.0.55",
+ "resolved": "https://registry.npmjs.org/as-table/-/as-table-1.0.55.tgz",
+ "integrity": "sha512-xvsWESUJn0JN421Xb9MQw6AsMHRCUknCe0Wjlxvjud80mU4E6hQf1A6NzQKcYNmYw62MfzEtXc+badstZP3JpQ==",
+ "dev": true,
+ "dependencies": {
+ "printable-characters": "^1.0.42"
+ }
+ },
+ "node_modules/asynckit": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
+ },
+ "node_modules/axios": {
+ "version": "1.7.7",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz",
+ "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==",
+ "dependencies": {
+ "follow-redirects": "^1.15.6",
+ "form-data": "^4.0.0",
+ "proxy-from-env": "^1.1.0"
+ }
+ },
+ "node_modules/binary-extensions": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
+ "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",
+ "dev": true,
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/blake3-wasm": {
+ "version": "2.1.5",
+ "resolved": "https://registry.npmjs.org/blake3-wasm/-/blake3-wasm-2.1.5.tgz",
+ "integrity": "sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==",
+ "dev": true
+ },
+ "node_modules/braces": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
+ "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
+ "dev": true,
+ "dependencies": {
+ "fill-range": "^7.1.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/capnp-ts": {
+ "version": "0.7.0",
+ "resolved": "https://registry.npmjs.org/capnp-ts/-/capnp-ts-0.7.0.tgz",
+ "integrity": "sha512-XKxXAC3HVPv7r674zP0VC3RTXz+/JKhfyw94ljvF80yynK6VkTnqE3jMuN8b3dUVmmc43TjyxjW4KTsmB3c86g==",
+ "dev": true,
+ "dependencies": {
+ "debug": "^4.3.1",
+ "tslib": "^2.2.0"
+ }
+ },
+ "node_modules/chokidar": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
+ "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
+ "dev": true,
+ "dependencies": {
+ "anymatch": "~3.1.2",
+ "braces": "~3.0.2",
+ "glob-parent": "~5.1.2",
+ "is-binary-path": "~2.1.0",
+ "is-glob": "~4.0.1",
+ "normalize-path": "~3.0.0",
+ "readdirp": "~3.6.0"
+ },
+ "engines": {
+ "node": ">= 8.10.0"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.2"
+ }
+ },
+ "node_modules/combined-stream": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+ "dependencies": {
+ "delayed-stream": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/cookie": {
+ "version": "0.7.2",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
+ "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/data-uri-to-buffer": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-2.0.2.tgz",
+ "integrity": "sha512-ND9qDTLc6diwj+Xe5cdAgVTbLVdXbtxTJRXRhli8Mowuaan+0EJOtdqJ0QCHNSSPyoXGx9HX2/VMnKeC34AChA==",
+ "dev": true
+ },
+ "node_modules/debug": {
+ "version": "4.3.7",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
+ "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
+ "dev": true,
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/defu": {
+ "version": "6.1.4",
+ "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz",
+ "integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==",
+ "dev": true
+ },
+ "node_modules/delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/esbuild": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz",
+ "integrity": "sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "bin": {
+ "esbuild": "bin/esbuild"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "optionalDependencies": {
+ "@esbuild/android-arm": "0.17.19",
+ "@esbuild/android-arm64": "0.17.19",
+ "@esbuild/android-x64": "0.17.19",
+ "@esbuild/darwin-arm64": "0.17.19",
+ "@esbuild/darwin-x64": "0.17.19",
+ "@esbuild/freebsd-arm64": "0.17.19",
+ "@esbuild/freebsd-x64": "0.17.19",
+ "@esbuild/linux-arm": "0.17.19",
+ "@esbuild/linux-arm64": "0.17.19",
+ "@esbuild/linux-ia32": "0.17.19",
+ "@esbuild/linux-loong64": "0.17.19",
+ "@esbuild/linux-mips64el": "0.17.19",
+ "@esbuild/linux-ppc64": "0.17.19",
+ "@esbuild/linux-riscv64": "0.17.19",
+ "@esbuild/linux-s390x": "0.17.19",
+ "@esbuild/linux-x64": "0.17.19",
+ "@esbuild/netbsd-x64": "0.17.19",
+ "@esbuild/openbsd-x64": "0.17.19",
+ "@esbuild/sunos-x64": "0.17.19",
+ "@esbuild/win32-arm64": "0.17.19",
+ "@esbuild/win32-ia32": "0.17.19",
+ "@esbuild/win32-x64": "0.17.19"
+ }
+ },
+ "node_modules/escape-string-regexp": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
+ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/estree-walker": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz",
+ "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==",
+ "dev": true
+ },
+ "node_modules/exit-hook": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-2.2.1.tgz",
+ "integrity": "sha512-eNTPlAD67BmP31LDINZ3U7HSF8l57TxOY2PmBJ1shpCvpnxBF93mWCE8YHBnXs8qiUZJc9WDcWIeC3a2HIAMfw==",
+ "dev": true,
+ "engines": {
+ "node": ">=6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/fill-range": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
+ "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
+ "dev": true,
+ "dependencies": {
+ "to-regex-range": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/follow-redirects": {
+ "version": "1.15.9",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
+ "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==",
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/RubenVerborgh"
+ }
+ ],
+ "engines": {
+ "node": ">=4.0"
+ },
+ "peerDependenciesMeta": {
+ "debug": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/form-data": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz",
+ "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==",
+ "dependencies": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.8",
+ "mime-types": "^2.1.12"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/function-bind": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
+ "dev": true,
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/get-source": {
+ "version": "2.0.12",
+ "resolved": "https://registry.npmjs.org/get-source/-/get-source-2.0.12.tgz",
+ "integrity": "sha512-X5+4+iD+HoSeEED+uwrQ07BOQr0kEDFMVqqpBuI+RaZBpBpHCuXxo70bjar6f0b0u/DQJsJ7ssurpP0V60Az+w==",
+ "dev": true,
+ "dependencies": {
+ "data-uri-to-buffer": "^2.0.0",
+ "source-map": "^0.6.1"
+ }
+ },
+ "node_modules/glob-parent": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+ "dev": true,
+ "dependencies": {
+ "is-glob": "^4.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/glob-to-regexp": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz",
+ "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==",
+ "dev": true
+ },
+ "node_modules/hasown": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
+ "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
+ "dev": true,
+ "dependencies": {
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/is-binary-path": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
+ "dev": true,
+ "dependencies": {
+ "binary-extensions": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/is-core-module": {
+ "version": "2.15.1",
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz",
+ "integrity": "sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==",
+ "dev": true,
+ "dependencies": {
+ "hasown": "^2.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-glob": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
+ "dev": true,
+ "dependencies": {
+ "is-extglob": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.12.0"
+ }
+ },
+ "node_modules/langfuse-core": {
+ "version": "3.27.0",
+ "resolved": "https://registry.npmjs.org/langfuse-core/-/langfuse-core-3.27.0.tgz",
+ "integrity": "sha512-0GSQFMpQ4lFFIBIO3+7qyOHTnIXRuU93zbXxw8RvSv4kadhOjTLsxAhSs2y7kK3bpFkPHVBiQAp4Doo/FZjXtA==",
+ "dependencies": {
+ "mustache": "^4.2.0"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/langfuse-node": {
+ "version": "3.27.0",
+ "resolved": "https://registry.npmjs.org/langfuse-node/-/langfuse-node-3.27.0.tgz",
+ "integrity": "sha512-TWUxlChV7tcykHQ2DdxxzE+IUO+am/X9fX9BqqJ0whjKCDHLXVplQEJHd5zlTRSBHObB687iI/6VvKFc8rD8jQ==",
+ "dependencies": {
+ "axios": "^1.7.4",
+ "langfuse-core": "^3.27.0"
+ },
+ "engines": {
+ "node": ">=18.0.0"
+ }
+ },
+ "node_modules/magic-string": {
+ "version": "0.25.9",
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz",
+ "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==",
+ "dev": true,
+ "dependencies": {
+ "sourcemap-codec": "^1.4.8"
+ }
+ },
+ "node_modules/mime": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz",
+ "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==",
+ "dev": true,
+ "bin": {
+ "mime": "cli.js"
+ },
+ "engines": {
+ "node": ">=10.0.0"
+ }
+ },
+ "node_modules/mime-db": {
+ "version": "1.52.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime-types": {
+ "version": "2.1.35",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+ "dependencies": {
+ "mime-db": "1.52.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/miniflare": {
+ "version": "3.20241004.0",
+ "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20241004.0.tgz",
+ "integrity": "sha512-QSSmCR2V1AJnnpYwlyLXobKLSGiY1FlAiZYULMdGgOUThV7HJeSysDxsmPmrH+D4GQbmUERnmDdB6M6Rrz7uPg==",
+ "dev": true,
+ "dependencies": {
+ "@cspotcode/source-map-support": "0.8.1",
+ "acorn": "^8.8.0",
+ "acorn-walk": "^8.2.0",
+ "capnp-ts": "^0.7.0",
+ "exit-hook": "^2.2.1",
+ "glob-to-regexp": "^0.4.1",
+ "stoppable": "^1.1.0",
+ "undici": "^5.28.4",
+ "workerd": "1.20241004.0",
+ "ws": "^8.17.1",
+ "youch": "^3.2.2",
+ "zod": "^3.22.3"
+ },
+ "bin": {
+ "miniflare": "bootstrap.js"
+ },
+ "engines": {
+ "node": ">=16.13"
+ }
+ },
+ "node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true
+ },
+ "node_modules/mustache": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz",
+ "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==",
+ "bin": {
+ "mustache": "bin/mustache"
+ }
+ },
+ "node_modules/nanoid": {
+ "version": "3.3.7",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
+ "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "bin": {
+ "nanoid": "bin/nanoid.cjs"
+ },
+ "engines": {
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
+ }
+ },
+ "node_modules/node-forge": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz",
+ "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==",
+ "dev": true,
+ "engines": {
+ "node": ">= 6.13.0"
+ }
+ },
+ "node_modules/normalize-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/ohash": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/ohash/-/ohash-1.1.4.tgz",
+ "integrity": "sha512-FlDryZAahJmEF3VR3w1KogSEdWX3WhA5GPakFx4J81kEAiHyLMpdLLElS8n8dfNadMgAne/MywcvmogzscVt4g==",
+ "dev": true
+ },
+ "node_modules/path-parse": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
+ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
+ "dev": true
+ },
+ "node_modules/path-to-regexp": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz",
+ "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==",
+ "dev": true
+ },
+ "node_modules/pathe": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz",
+ "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==",
+ "dev": true
+ },
+ "node_modules/picomatch": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
+ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
+ "dev": true,
+ "engines": {
+ "node": ">=8.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/printable-characters": {
+ "version": "1.0.42",
+ "resolved": "https://registry.npmjs.org/printable-characters/-/printable-characters-1.0.42.tgz",
+ "integrity": "sha512-dKp+C4iXWK4vVYZmYSd0KBH5F/h1HoZRsbJ82AVKRO3PEo8L4lBS/vLwhVtpwwuYcoIsVY+1JYKR268yn480uQ==",
+ "dev": true
+ },
+ "node_modules/proxy-from-env": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
+ },
+ "node_modules/readdirp": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
+ "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
+ "dev": true,
+ "dependencies": {
+ "picomatch": "^2.2.1"
+ },
+ "engines": {
+ "node": ">=8.10.0"
+ }
+ },
+ "node_modules/resolve": {
+ "version": "1.22.8",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
+ "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==",
+ "dev": true,
+ "dependencies": {
+ "is-core-module": "^2.13.0",
+ "path-parse": "^1.0.7",
+ "supports-preserve-symlinks-flag": "^1.0.0"
+ },
+ "bin": {
+ "resolve": "bin/resolve"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/resolve.exports": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz",
+ "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==",
+ "dev": true,
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/rollup-plugin-inject": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/rollup-plugin-inject/-/rollup-plugin-inject-3.0.2.tgz",
+ "integrity": "sha512-ptg9PQwzs3orn4jkgXJ74bfs5vYz1NCZlSQMBUA0wKcGp5i5pA1AO3fOUEte8enhGUC+iapTCzEWw2jEFFUO/w==",
+ "deprecated": "This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.",
+ "dev": true,
+ "dependencies": {
+ "estree-walker": "^0.6.1",
+ "magic-string": "^0.25.3",
+ "rollup-pluginutils": "^2.8.1"
+ }
+ },
+ "node_modules/rollup-plugin-node-polyfills": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/rollup-plugin-node-polyfills/-/rollup-plugin-node-polyfills-0.2.1.tgz",
+ "integrity": "sha512-4kCrKPTJ6sK4/gLL/U5QzVT8cxJcofO0OU74tnB19F40cmuAKSzH5/siithxlofFEjwvw1YAhPmbvGNA6jEroA==",
+ "dev": true,
+ "dependencies": {
+ "rollup-plugin-inject": "^3.0.0"
+ }
+ },
+ "node_modules/rollup-pluginutils": {
+ "version": "2.8.2",
+ "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz",
+ "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==",
+ "dev": true,
+ "dependencies": {
+ "estree-walker": "^0.6.1"
+ }
+ },
+ "node_modules/selfsigned": {
+ "version": "2.4.1",
+ "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-2.4.1.tgz",
+ "integrity": "sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q==",
+ "dev": true,
+ "dependencies": {
+ "@types/node-forge": "^1.3.0",
+ "node-forge": "^1"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/sourcemap-codec": {
+ "version": "1.4.8",
+ "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz",
+ "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==",
+ "deprecated": "Please use @jridgewell/sourcemap-codec instead",
+ "dev": true
+ },
+ "node_modules/stacktracey": {
+ "version": "2.1.8",
+ "resolved": "https://registry.npmjs.org/stacktracey/-/stacktracey-2.1.8.tgz",
+ "integrity": "sha512-Kpij9riA+UNg7TnphqjH7/CzctQ/owJGNbFkfEeve4Z4uxT5+JapVLFXcsurIfN34gnTWZNJ/f7NMG0E8JDzTw==",
+ "dev": true,
+ "dependencies": {
+ "as-table": "^1.0.36",
+ "get-source": "^2.0.12"
+ }
+ },
+ "node_modules/stoppable": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz",
+ "integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==",
+ "dev": true,
+ "engines": {
+ "node": ">=4",
+ "npm": ">=6"
+ }
+ },
+ "node_modules/supports-preserve-symlinks-flag": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
+ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "dependencies": {
+ "is-number": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=8.0"
+ }
+ },
+ "node_modules/tslib": {
+ "version": "2.7.0",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz",
+ "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==",
+ "dev": true
+ },
+ "node_modules/typescript": {
+ "version": "5.6.3",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz",
+ "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==",
+ "dev": true,
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=14.17"
+ }
+ },
+ "node_modules/ufo": {
+ "version": "1.5.4",
+ "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.4.tgz",
+ "integrity": "sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==",
+ "dev": true
+ },
+ "node_modules/undici": {
+ "version": "5.28.4",
+ "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz",
+ "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==",
+ "dev": true,
+ "dependencies": {
+ "@fastify/busboy": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=14.0"
+ }
+ },
+ "node_modules/undici-types": {
+ "version": "6.19.8",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
+ "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
+ "dev": true
+ },
+ "node_modules/unenv": {
+ "name": "unenv-nightly",
+ "version": "2.0.0-20241009-125958-e8ea22f",
+ "resolved": "https://registry.npmjs.org/unenv-nightly/-/unenv-nightly-2.0.0-20241009-125958-e8ea22f.tgz",
+ "integrity": "sha512-hRxmKz1iSVRmuFx/vBdPsx7rX4o7Cas9vdjDNeUeWpQTK2LzU3Xy3Jz0zbo7MJX0bpqo/LEFCA+GPwsbl6zKEQ==",
+ "dev": true,
+ "dependencies": {
+ "defu": "^6.1.4",
+ "ohash": "^1.1.4",
+ "pathe": "^1.1.2",
+ "ufo": "^1.5.4"
+ }
+ },
+ "node_modules/workerd": {
+ "version": "1.20241004.0",
+ "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20241004.0.tgz",
+ "integrity": "sha512-TCFJ7Zw7svR3adg1fnlPWj/yXhjBnQloLEIJqdu57hli/GsgwlbomwrbM3mdMgbS+K9zYeaYqknXiBN0EXk3QQ==",
+ "dev": true,
+ "hasInstallScript": true,
+ "bin": {
+ "workerd": "bin/workerd"
+ },
+ "engines": {
+ "node": ">=16"
+ },
+ "optionalDependencies": {
+ "@cloudflare/workerd-darwin-64": "1.20241004.0",
+ "@cloudflare/workerd-darwin-arm64": "1.20241004.0",
+ "@cloudflare/workerd-linux-64": "1.20241004.0",
+ "@cloudflare/workerd-linux-arm64": "1.20241004.0",
+ "@cloudflare/workerd-windows-64": "1.20241004.0"
+ }
+ },
+ "node_modules/wrangler": {
+ "version": "3.80.4",
+ "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.80.4.tgz",
+ "integrity": "sha512-DyNvShtVH3k7ZyBndlIiwyRDXqtHr3g01hxwn4FfwKlAaT6EL0wb3KL3UGbsdpeM/xbJiUQxFQ4WuFBWgZS18Q==",
+ "dev": true,
+ "dependencies": {
+ "@cloudflare/kv-asset-handler": "0.3.4",
+ "@cloudflare/workers-shared": "0.6.0",
+ "@esbuild-plugins/node-globals-polyfill": "^0.2.3",
+ "@esbuild-plugins/node-modules-polyfill": "^0.2.2",
+ "blake3-wasm": "^2.1.5",
+ "chokidar": "^3.5.3",
+ "esbuild": "0.17.19",
+ "miniflare": "3.20241004.0",
+ "nanoid": "^3.3.3",
+ "path-to-regexp": "^6.3.0",
+ "resolve": "^1.22.8",
+ "resolve.exports": "^2.0.2",
+ "selfsigned": "^2.0.1",
+ "source-map": "^0.6.1",
+ "unenv": "npm:[email protected]",
+ "workerd": "1.20241004.0",
+ "xxhash-wasm": "^1.0.1"
+ },
+ "bin": {
+ "wrangler": "bin/wrangler.js",
+ "wrangler2": "bin/wrangler.js"
+ },
+ "engines": {
+ "node": ">=16.17.0"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.2"
+ },
+ "peerDependencies": {
+ "@cloudflare/workers-types": "^4.20241004.0"
+ },
+ "peerDependenciesMeta": {
+ "@cloudflare/workers-types": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/ws": {
+ "version": "8.18.0",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz",
+ "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==",
+ "dev": true,
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "peerDependencies": {
+ "bufferutil": "^4.0.1",
+ "utf-8-validate": ">=5.0.2"
+ },
+ "peerDependenciesMeta": {
+ "bufferutil": {
+ "optional": true
+ },
+ "utf-8-validate": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/xxhash-wasm": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.0.2.tgz",
+ "integrity": "sha512-ibF0Or+FivM9lNrg+HGJfVX8WJqgo+kCLDc4vx6xMeTce7Aj+DLttKbxxRR/gNLSAelRc1omAPlJ77N/Jem07A==",
+ "dev": true
+ },
+ "node_modules/youch": {
+ "version": "3.3.4",
+ "resolved": "https://registry.npmjs.org/youch/-/youch-3.3.4.tgz",
+ "integrity": "sha512-UeVBXie8cA35DS6+nBkls68xaBBXCye0CNznrhszZjTbRVnJKQuNsyLKBTTL4ln1o1rh2PKtv35twV7irj5SEg==",
+ "dev": true,
+ "dependencies": {
+ "cookie": "^0.7.1",
+ "mustache": "^4.2.0",
+ "stacktracey": "^2.1.8"
+ }
+ },
+ "node_modules/zod": {
+ "version": "3.23.8",
+ "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz",
+ "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==",
+ "dev": true,
+ "funding": {
+ "url": "https://github.com/sponsors/colinhacks"
+ }
+ }
+ }
+}
diff --git a/screenpipe-actions/ai-proxy/package.json b/screenpipe-actions/ai-proxy/package.json
new file mode 100644
index 000000000..1c585ac13
--- /dev/null
+++ b/screenpipe-actions/ai-proxy/package.json
@@ -0,0 +1,20 @@
+{
+ "name": "ai-proxy",
+ "version": "0.0.0",
+ "private": true,
+ "scripts": {
+ "deploy": "wrangler deploy",
+ "dev": "wrangler dev",
+ "start": "wrangler dev",
+ "cf-typegen": "wrangler types"
+ },
+ "devDependencies": {
+ "@cloudflare/workers-types": "^4.20241011.0",
+ "@types/node": "^22.7.5",
+ "typescript": "^5.5.2",
+ "wrangler": "^3.60.3"
+ },
+ "dependencies": {
+ "langfuse-node": "^3.27.0"
+ }
+}
diff --git a/screenpipe-actions/ai-proxy/src/index.ts b/screenpipe-actions/ai-proxy/src/index.ts
new file mode 100644
index 000000000..c0be8f291
--- /dev/null
+++ b/screenpipe-actions/ai-proxy/src/index.ts
@@ -0,0 +1,154 @@
+// import { DurableObject } from "cloudflare:workers";
+import { Env } from './types'
+import { Langfuse } from "langfuse-node";
+
+/**
+ * Welcome to Cloudflare Workers! This is your first Durable Objects application.
+ *
+ * - Run `npm run dev` in your terminal to start a development server
+ * - Open a browser tab at http://localhost:8787/ to see your Durable Object in action
+ * - Run `npm run deploy` to publish your application
+ *
+ * Bind resources to your worker in `wrangler.toml`. After adding bindings, a type definition for the
+ * `Env` object can be regenerated with `npm run cf-typegen`.
+ *
+ * Learn more at https://developers.cloudflare.com/durable-objects
+ */
+
+/** A Durable Object's behavior is defined in an exported Javascript class */
+// export class MyDurableObject extends DurableObject {
+// /**
+// * The constructor is invoked once upon creation of the Durable Object, i.e. the first call to
+// * `DurableObjectStub::get` for a given identifier (no-op constructors can be omitted)
+// *
+// * @param ctx - The interface for interacting with Durable Object state
+// * @param env - The interface to reference bindings declared in wrangler.toml
+// */
+// constructor(ctx: DurableObjectState, env: Env) {
+// super(ctx, env);
+// }
+
+// /**
+// * The Durable Object exposes an RPC method sayHello which will be invoked when when a Durable
+// * Object instance receives a request from a Worker via the same method invocation on the stub
+// *
+// * @param name - The name provided to a Durable Object instance from a Worker
+// * @returns The greeting to be sent back to the Worker
+// */
+// async sayHello(name: string): Promise<string> {
+// return `Hello, ${name}!`;
+// }
+// }
+
+async function callAI(body: any, env: Env, langfuse: Langfuse): Promise<Response> {
+ const trace = langfuse.trace({
+ id: "ai_call_" + Date.now(),
+ name: "ai_call",
+ metadata: { expectJson: body.response_format?.type === "json_object" }
+ });
+
+ const generation = trace.generation({
+ name: "openai_completion",
+ startTime: new Date(),
+ model: body.model,
+ modelParameters: {
+ temperature: body.temperature,
+ expectJson: body.response_format?.type === "json_object"
+ },
+ input: body.messages,
+ output: null
+ });
+
+ try {
+ const response = await fetch("https://api.openai.com/v1/chat/completions", {
+ method: "POST",
+ headers: {
+ "Authorization": `Bearer ${env.OPENAI_API_KEY}`,
+ "Content-Type": "application/json"
+ },
+ body: JSON.stringify(body)
+ });
+
+ const data = await response.json();
+
+ if (data.error) {
+ generation.end({
+ completionStartTime: new Date(),
+ completion: data.error.message,
+ endTime: new Date(),
+ status: "error"
+ });
+ return new Response(JSON.stringify(data), { status: 400 });
+ }
+
+ generation.end({
+ completionStartTime: new Date(),
+ output: data.choices[0]?.message?.content,
+ endTime: new Date(),
+ status: "success"
+ });
+
+ return new Response(JSON.stringify(data), {
+ headers: { "Content-Type": "application/json" }
+ });
+ } catch (error) {
+ generation.end({
+ completionStartTime: new Date(),
+ completion: error.message,
+ endTime: new Date(),
+ status: "error"
+ });
+ throw error;
+ }
+}
+
+export default {
+ /**
+ * This is the standard fetch handler for a Cloudflare Worker
+ *
+ * @param request - The request submitted to the Worker from the client
+ * @param env - The interface to reference bindings declared in wrangler.toml
+ * @param ctx - The execution context of the Worker
+ * @returns The response to be sent back to the client
+ */
+ async fetch(request: Request, env: Env): Promise<Response> {
+ const langfuse = new Langfuse({
+ publicKey: env.LANGFUSE_PUBLIC_KEY,
+ secretKey: env.LANGFUSE_SECRET_KEY,
+ baseUrl: "https://us.cloud.langfuse.com"
+ });
+
+ langfuse.debug();
+ langfuse.on("error", (error) => {
+ console.error("langfuse error:", error);
+ });
+
+ try {
+ const url = new URL(request.url);
+ const path = url.pathname;
+
+ if (path === '/test') {
+ return new Response('ai proxy is working!', { status: 200 });
+ }
+
+ if (path === '/v1/chat/completions' && request.method === 'POST') {
+ const body = await request.json();
+ return await callAI(body, env, langfuse);
+ }
+
+ return new Response("not found", { status: 404 });
+ } catch (error) {
+ console.error("error in fetch:", error);
+ return new Response("an error occurred", { status: 500 });
+ } finally {
+ await langfuse.shutdownAsync();
+ }
+ }
+} satisfies ExportedHandler<Env>;
+
+interface Env {
+ OPENAI_API_KEY: string;
+ LANGFUSE_PUBLIC_KEY: string;
+ LANGFUSE_SECRET_KEY: string;
+ ANTHROPIC_API_KEY: string;
+}
diff --git a/screenpipe-actions/ai-proxy/tsconfig.json b/screenpipe-actions/ai-proxy/tsconfig.json
new file mode 100644
index 000000000..ac1a578ef
--- /dev/null
+++ b/screenpipe-actions/ai-proxy/tsconfig.json
@@ -0,0 +1,103 @@
+{
+ "compilerOptions": {
+ /* Visit https://aka.ms/tsconfig.json to read more about this file */
+
+ /* Projects */
+ // "incremental": true, /* Enable incremental compilation */
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
+ // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
+
+ /* Language and Environment */
+ "target": "es2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
+ "lib": ["es2021"] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
+ "jsx": "react-jsx" /* Specify what JSX code is generated. */,
+ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
+ // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
+
+ /* Modules */
+ "module": "es2022" /* Specify what module code is generated. */,
+ // "rootDir": "./", /* Specify the root folder within your source files. */
+ "moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
+ // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
+ "types": [
+ "@cloudflare/workers-types/2023-07-01"
+ ] /* Specify type package names to be included without being referenced in a source file. */,
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
+ "resolveJsonModule": true /* Enable importing .json files */,
+ // "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
+
+ /* JavaScript Support */
+ "allowJs": true /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */,
+ "checkJs": false /* Enable error reporting in type-checked JavaScript files. */,
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
+
+ /* Emit */
+ // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
+ // "outDir": "./", /* Specify an output folder for all emitted files. */
+ // "removeComments": true, /* Disable emitting comments. */
+ "noEmit": true /* Disable emitting files from a compilation. */,
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
+ // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
+ // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
+
+ /* Interop Constraints */
+ "isolatedModules": true /* Ensure that each file can be safely transpiled without relying on other imports. */,
+ "allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */,
+ // "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */,
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
+ "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
+
+ /* Type Checking */
+ "strict": true /* Enable all strict type-checking options. */,
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
+ // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
+ // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
+ // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
+ // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
+ // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
+ // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
+
+ /* Completeness */
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
+ }
+}
diff --git a/screenpipe-actions/ai-proxy/worker-configuration.d.ts b/screenpipe-actions/ai-proxy/worker-configuration.d.ts
new file mode 100644
index 000000000..4c0ab5ed2
--- /dev/null
+++ b/screenpipe-actions/ai-proxy/worker-configuration.d.ts
@@ -0,0 +1,5 @@
+// Generated by Wrangler by running `wrangler types`
+
+interface Env {
+ MY_DURABLE_OBJECT: DurableObjectNamespace<import("./src/index").MyDurableObject>;
+}
diff --git a/screenpipe-actions/ai-proxy/wrangler.toml b/screenpipe-actions/ai-proxy/wrangler.toml
new file mode 100644
index 000000000..f933bd64c
--- /dev/null
+++ b/screenpipe-actions/ai-proxy/wrangler.toml
@@ -0,0 +1,113 @@
+#:schema node_modules/wrangler/config-schema.json
+name = "ai-proxy"
+main = "src/index.ts"
+compatibility_date = "2024-10-11"
+
+# Workers Logs
+# Docs: https://developers.cloudflare.com/workers/observability/logs/workers-logs/
+# Configuration: https://developers.cloudflare.com/workers/observability/logs/workers-logs/#enable-workers-logs
+# [observability]
+# enabled = true
+
+# Automatically place your workloads in an optimal location to minimize latency.
+# If you are running back-end logic in a Worker, running it closer to your back-end infrastructure
+# rather than the end user may result in better performance.
+# Docs: https://developers.cloudflare.com/workers/configuration/smart-placement/#smart-placement
+# [placement]
+# mode = "smart"
+
+# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
+# Docs:
+# - https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
+# Note: Use secrets to store sensitive data.
+# - https://developers.cloudflare.com/workers/configuration/secrets/
+[vars]
+# add any non-secret environment variables here
+
+# Bind the Workers AI model catalog. Run machine learning models, powered by serverless GPUs, on Cloudflare’s global network
+# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#workers-ai
+# [ai]
+# binding = "AI"
+
+# Bind an Analytics Engine dataset. Use Analytics Engine to write analytics within your Pages Function.
+# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#analytics-engine-datasets
+# [[analytics_engine_datasets]]
+# binding = "MY_DATASET"
+
+# Bind a headless browser instance running on Cloudflare's global network.
+# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#browser-rendering
+# [browser]
+# binding = "MY_BROWSER"
+
+# Bind a D1 database. D1 is Cloudflare’s native serverless SQL database.
+# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#d1-databases
+# [[d1_databases]]
+# binding = "MY_DB"
+# database_name = "my-database"
+# database_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
+
+# Bind a dispatch namespace. Use Workers for Platforms to deploy serverless functions programmatically on behalf of your customers.
+# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#dispatch-namespace-bindings-workers-for-platforms
+# [[dispatch_namespaces]]
+# binding = "MY_DISPATCHER"
+# namespace = "my-namespace"
+
+# Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
+# Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
+# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
+# [[durable_objects.bindings]]
+# name = "MY_DURABLE_OBJECT"
+# class_name = "MyDurableObject"
+
+# Durable Object migrations.
+# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#migrations
+# [[migrations]]
+# tag = "v1"
+# new_classes = ["MyDurableObject"]
+
+# Bind a Hyperdrive configuration. Use to accelerate access to your existing databases from Cloudflare Workers.
+# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#hyperdrive
+# [[hyperdrive]]
+# binding = "MY_HYPERDRIVE"
+# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
+
+# Bind a KV Namespace. Use KV as persistent storage for small key-value pairs.
+# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#kv-namespaces
+# [[kv_namespaces]]
+# binding = "MY_KV_NAMESPACE"
+# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
+
+# Bind an mTLS certificate. Use to present a client certificate when communicating with another service.
+# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#mtls-certificates
+# [[mtls_certificates]]
+# binding = "MY_CERTIFICATE"
+# certificate_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
+
+# Bind a Queue producer. Use this binding to schedule an arbitrary task that may be processed later by a Queue consumer.
+# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#queues
+# [[queues.producers]]
+# binding = "MY_QUEUE"
+# queue = "my-queue"
+
+# Bind a Queue consumer. Queue Consumers can retrieve tasks scheduled by Producers to act on them.
+# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#queues
+# [[queues.consumers]]
+# queue = "my-queue"
+
+# Bind an R2 Bucket. Use R2 to store arbitrarily large blobs of data, such as files.
+# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#r2-buckets
+# [[r2_buckets]]
+# binding = "MY_BUCKET"
+# bucket_name = "my-bucket"
+
+# Bind another Worker service. Use this binding to call another Worker without network overhead.
+# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings
+# [[services]]
+# binding = "MY_SERVICE"
+# service = "my-service"
+
+# Bind a Vectorize index. Use to store and query vector embeddings for semantic search, classification and other vector search use-cases.
+# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#vectorize-indexes
+# [[vectorize]]
+# binding = "MY_INDEX"
+# index_name = "my-index"
diff --git a/screenpipe-actions/src/call_ai.rs b/screenpipe-actions/src/call_ai.rs
new file mode 100644
index 000000000..7aceed8d7
--- /dev/null
+++ b/screenpipe-actions/src/call_ai.rs
@@ -0,0 +1,258 @@
+use anyhow::{Result, Context};
+use reqwest::Client;
+use serde_json::{json, Value};
+// use base64::{engine::general_purpose, Engine as _};
+// use image::{DynamicImage, ImageFormat};
+// use std::io::Cursor;
+
+pub async fn call_ai(prompt: String, context: String, expect_json: bool) -> Result<String> {
+ let client = Client::new();
+
+ let messages = vec![
+ json!({
+ "role": "system",
+ "content": context
+ }),
+ json!({
+ "role": "user",
+ "content": prompt
+ })
+ ];
+
+ let mut body = json!({
+ "model": "gpt-4o",
+ "messages": messages,
+ "temperature": 0.2
+ });
+
+ if expect_json {
+ body["response_format"] = json!({"type": "json_object"});
+ }
+
+ let response: Value = client.post("https://ai-proxy.i-f9f.workers.dev/v1/chat/completions")
+ .json(&body)
+ .send()
+ .await?
+ .json()
+ .await?;
+
+ // Log the entire response for debugging
+ // println!("raw api response: {}", serde_json::to_string_pretty(&response)?);
+
+ if response.get("error").is_some() {
+ // If there's an error, return it as a string
+ let error_message = response["error"]["message"]
+ .as_str()
+ .unwrap_or("Unknown error")
+ .to_string();
+ return Err(anyhow::anyhow!(error_message));
+ }
+
+ let content = response["choices"]
+ .get(0)
+ .and_then(|choice| choice["message"]["content"].as_str())
+ .context("failed to extract content from response")?
+ .to_string();
+
+ if expect_json {
+ let json_value: Value = serde_json::from_str(&content)
+ .context("response content is not valid JSON")?;
+
+ if let Some(array) = json_value["response"].as_array() {
+ // If "response" is an array, join its elements with newlines
+ Ok(array.iter()
+ .filter_map(|v| v.as_str())
+ .collect::<Vec<_>>()
+ .join("\n"))
+ } else if let Some(response_str) = json_value["response"].as_str() {
+ // If "response" is a string, return it directly
+ Ok(response_str.to_string())
+ } else {
+ // If "response" is neither an array nor a string, return the whole JSON
+ Ok(content)
+ }
+ } else {
+ Ok(content)
+ }
+}
+
+// Commented out unused enum and functions
+// pub enum AIProvider {
+// OpenAI,
+// Claude,
+// }
+
+// pub async fn call_ai_with_screenshot(provider: AIProvider, prompt: String, expect_json: bool, screenshot: DynamicImage) -> Result<String> {
+// match provider {
+// AIProvider::OpenAI => call_openai_with_screenshot(prompt, expect_json, screenshot).await,
+// AIProvider::Claude => call_claude_with_screenshot(prompt, expect_json, screenshot).await,
+// }
+// }
+
+// pub async fn call_openai_with_screenshot(prompt: String, expect_json: bool, screenshot: DynamicImage) -> Result<String> {
+// dotenv().ok(); // Load .env file
+// let api_key = std::env::var("OPENAI_API_KEY").expect("OPENAI_API_KEY not set");
+
+// let client = Client::new();
+
+// // Convert image to base64
+// let mut image_buffer = Vec::new();
+// screenshot.write_to(&mut Cursor::new(&mut image_buffer), ImageFormat::Png)
+// .context("failed to write image to buffer")?;
+// let base64_image = general_purpose::STANDARD.encode(&image_buffer);
+
+// let messages = vec![
+// json!({
+// "role": "user",
+// "content": [
+// {
+// "type": "text",
+// "text": prompt
+// },
+// {
+// "type": "image_url",
+// "image_url": {
+// "url": format!("data:image/png;base64,{}", base64_image)
+// }
+// }
+// ]
+// })
+// ];
+
+// let mut body = json!({
+// "model": "gpt-4o",
+// "messages": messages,
+// "temperature": 0.2
+// });
+
+// if expect_json {
+// body["response_format"] = json!({"type": "json_object"});
+// }
+
+// let response: Value = client.post("https://api.openai.com/v1/chat/completions")
+// .header("Authorization", format!("Bearer {}", api_key))
+// .json(&body)
+// .send()
+// .await?
+// .json()
+// .await?;
+
+// // Log the entire response for debugging
+// // println!("raw api response: {}", serde_json::to_string_pretty(&response)?);
+
+// if response.get("error").is_some() {
+// let error_message = response["error"]["message"]
+// .as_str()
+// .unwrap_or("unknown error")
+// .to_string();
+// return Err(anyhow::anyhow!(error_message));
+// }
+
+// let choice = response["choices"]
+// .get(0)
+// .ok_or_else(|| anyhow::anyhow!("no choices in response"))?;
+
+// if let Some(refusal) = choice["message"]["refusal"].as_str() {
+// return Ok(refusal.to_string());
+// }
+
+// let content = choice["message"]["content"]
+// .as_str()
+// .context("failed to extract content from response")?
+// .to_string();
+
+// if expect_json {
+// serde_json::from_str::<Value>(&content)
+// .context("response content is not valid JSON")?;
+// }
+
+// Ok(content)
+// }
+
+// pub async fn call_claude_with_screenshot(prompt: String, expect_json: bool, screenshot: DynamicImage) -> Result<String> {
+// dotenv().ok(); // load .env file
+// let api_key = std::env::var("ANTHROPIC_API_KEY").context("ANTHROPIC_API_KEY not set")?;
+
+// let client = Client::new();
+
+// // Convert image to base64
+// let mut image_buffer = Vec::new();
+// screenshot.write_to(&mut Cursor::new(&mut image_buffer), ImageFormat::Png)
+// .context("failed to write image to buffer")?;
+// let base64_image = general_purpose::STANDARD.encode(&image_buffer);
+
+// let system_message = if expect_json {
+// "You must respond in valid JSON format. Always wrap your response in a JSON object with a 'response' key."
+// } else {
+// ""
+// };
+
+// let user_message = if expect_json {
+// format!("{}\nRemember to format your entire response as a JSON object with a 'response' key.", prompt)
+// } else {
+// prompt
+// };
+
+// let body = json!({
+// "model": "claude-3-5-sonnet-20240620",
+// "max_tokens": 1024,
+// "temperature": 0.2,
+// "system": system_message,
+// "messages": [
+// {
+// "role": "user",
+// "content": [
+// {
+// "type": "image",
+// "source": {
+// "type": "base64",
+// "media_type": "image/png",
+// "data": base64_image
+// }
+// },
+// {
+// "type": "text",
+// "text": user_message
+// }
+// ]
+// }
+// ]
+// });
+
+// let response: Value = client.post("https://api.anthropic.com/v1/messages")
+// .header("x-api-key", &api_key)
+// .header("anthropic-version", "2023-06-01")
+// .header("content-type", "application/json")
+// .json(&body)
+// .send()
+// .await?
+// .json()
+// .await?;
+
+// // log the entire response for debugging
+// println!("raw api response: {}", serde_json::to_string_pretty(&response)?);
+
+// if response.get("error").is_some() {
+// let error_message = response["error"]["message"]
+// .as_str()
+// .unwrap_or("unknown error")
+// .to_string();
+// return Err(anyhow::anyhow!(error_message));
+// }
+
+// let content = response["content"]
+// .get(0)
+// .and_then(|content| content["text"].as_str())
+// .context("failed to extract content from response")?;
+
+// if expect_json {
+// // Validate that the content is valid JSON
+// serde_json::from_str::<Value>(content)
+// .context("response content is not valid JSON")?;
+
+// // Return the full JSON string
+// Ok(content.to_string())
+// } else {
+// Ok(content.to_string())
+// }
+// }
diff --git a/screenpipe-actions/src/lib.rs b/screenpipe-actions/src/lib.rs
new file mode 100644
index 000000000..c2cec5ccf
--- /dev/null
+++ b/screenpipe-actions/src/lib.rs
@@ -0,0 +1,16 @@
+mod monitor_keystroke_commands;
+mod call_ai;
+mod type_and_animate;
+mod screenshot;
+mod run; // This now refers to the renamed run.rs file
+
+pub use monitor_keystroke_commands::{run_keystroke_monitor, KeystrokeCommand};
+pub use call_ai::call_ai;
+pub use type_and_animate::{type_slowly, delete_characters};
+pub use run::run; // Export the run function from the run module
+
+// Remove this line
+// mod main;
+
+// Remove this line if the function doesn't exist
+// pub use screenshot::capture_main_window_screenshot;
diff --git a/screenpipe-actions/src/main.rs b/screenpipe-actions/src/main.rs
new file mode 100644
index 000000000..411757c97
--- /dev/null
+++ b/screenpipe-actions/src/main.rs
@@ -0,0 +1,11 @@
+use screenpipe_actions::run;
+use tracing::Level;
+
+fn main() -> anyhow::Result<()> {
+ // try to enable tracing subscriber if not already running
+ let subscriber = tracing_subscriber::fmt::Subscriber::builder()
+ .with_max_level(Level::INFO)
+ .finish();
+ tracing::subscriber::set_global_default(subscriber).unwrap();
+ tokio::runtime::Runtime::new()?.block_on(run())
+}
diff --git a/screenpipe-actions/src/monitor_keystroke_commands.rs b/screenpipe-actions/src/monitor_keystroke_commands.rs
new file mode 100644
index 000000000..90865c8b5
--- /dev/null
+++ b/screenpipe-actions/src/monitor_keystroke_commands.rs
@@ -0,0 +1,85 @@
+use rdev::{listen, Event, EventType, Key};
+use std::sync::Arc;
+use tokio::sync::mpsc;
+use tokio::sync::Mutex;
+use tracing::error;
+
+pub enum KeystrokeCommand {
+ DoubleSlash,
+ // Add other commands as needed
+}
+
+#[allow(dead_code)]
+pub struct KeystrokeMonitor {
+ tx: mpsc::Sender<KeystrokeCommand>,
+ last_slash: Arc<Mutex<Option<std::time::Instant>>>,
+}
+
+impl KeystrokeMonitor {
+ #[allow(dead_code)]
+ pub fn new(tx: mpsc::Sender<KeystrokeCommand>) -> Self {
+ KeystrokeMonitor {
+ tx,
+ last_slash: Arc::new(Mutex::new(None)),
+ }
+ }
+
+ #[allow(dead_code)]
+ pub async fn start_monitoring(&self) -> anyhow::Result<()> {
+ let tx = self.tx.clone();
+ let last_slash = self.last_slash.clone();
+
+ tokio::task::spawn_blocking(move || {
+ if let Err(error) = listen(move |event| {
+ let _ = handle_event(event, &tx, &last_slash);
+ }) {
+ error!("error: {:?}", error)
+ }
+ });
+
+ Ok(())
+ }
+}
+
+#[allow(dead_code)]
+fn handle_event(
+ event: Event,
+ tx: &mpsc::Sender<KeystrokeCommand>,
+ last_slash: &Arc<Mutex<Option<std::time::Instant>>>,
+) -> anyhow::Result<()> {
+ static mut SHIFT_PRESSED: bool = false;
+
+ match event.event_type {
+ EventType::KeyPress(key) => {
+ if key == Key::ShiftLeft || key == Key::ShiftRight {
+ unsafe { SHIFT_PRESSED = true; }
+ } else if key == Key::Slash || (unsafe { SHIFT_PRESSED } && key == Key::Num7) {
+ // Monitoring for slash (/) or Shift+7 combination
+ let mut last_slash_guard = last_slash.blocking_lock();
+ let now = std::time::Instant::now();
+ if let Some(last) = *last_slash_guard {
+ if now.duration_since(last).as_millis() < 500 {
+ tx.blocking_send(KeystrokeCommand::DoubleSlash)?;
+ *last_slash_guard = None;
+ return Ok(());
+ }
+ }
+ *last_slash_guard = Some(now);
+ }
+ },
+ EventType::KeyRelease(key) => {
+ if key == Key::ShiftLeft || key == Key::ShiftRight {
+ unsafe { SHIFT_PRESSED = false; }
+ }
+ },
+ _ => {}
+ }
+ Ok(())
+}
+
+#[allow(dead_code)]
+pub async fn run_keystroke_monitor(tx: mpsc::Sender<KeystrokeCommand>) -> anyhow::Result<()> {
+ let monitor = KeystrokeMonitor::new(tx);
+ monitor.start_monitoring().await?;
+ Ok(())
+}
diff --git a/screenpipe-actions/src/print_all_attributes.swift b/screenpipe-actions/src/print_all_attributes.swift
new file mode 100644
index 000000000..4b753e020
--- /dev/null
+++ b/screenpipe-actions/src/print_all_attributes.swift
@@ -0,0 +1,169 @@
+import Cocoa
+import ApplicationServices
+import Foundation
+
+class QueueElement {
+ let element: AXUIElement
+ let depth: Int
+
+ init(_ element: AXUIElement, depth: Int) {
+ self.element = element
+ self.depth = depth
+ }
+}
+
+func printAllAttributeValues(_ startElement: AXUIElement) {
+ var elements: [(CGPoint, CGSize, String)] = []
+ var visitedElements = Set<AXUIElement>()
+ let unwantedValues = ["0", "", "", "3", ""]
+ let unwantedLabels = [
+ "window", "application", "group", "button", "image", "text",
+ "pop up button", "region", "notifications", "table", "column",
+ "html content"
+ ]
+
+ func traverseHierarchy(_ element: AXUIElement, depth: Int) {
+ guard !visitedElements.contains(element) else { return }
+ visitedElements.insert(element)
+
+ var attributeNames: CFArray?
+ let result = AXUIElementCopyAttributeNames(element, &attributeNames)
+
+ guard result == .success, let attributes = attributeNames as? [String] else { return }
+
+ var position: CGPoint = .zero
+ var size: CGSize = .zero
+
+ // Get position
+ if let positionValue = getAttributeValue(element, forAttribute: kAXPositionAttribute) as! AXValue?,
+ AXValueGetType(positionValue) == .cgPoint {
+ AXValueGetValue(positionValue, .cgPoint, &position)
+ }
+
+ // Get size
+ if let sizeValue = getAttributeValue(element, forAttribute: kAXSizeAttribute) as! AXValue?,
+ AXValueGetType(sizeValue) == .cgSize {
+ AXValueGetValue(sizeValue, .cgSize, &size)
+ }
+
+ for attr in attributes {
+ if ["AXDescription", "AXValue", "AXLabel", "AXRoleDescription", "AXHelp"].contains(attr) {
+ if let value = getAttributeValue(element, forAttribute: attr) {
+ let valueStr = describeValue(value)
+ if !valueStr.isEmpty && !unwantedValues.contains(valueStr) && valueStr.count > 1 &&
+ !unwantedLabels.contains(valueStr.lowercased()) {
+ elements.append((position, size, valueStr))
+ }
+ }
+ }
+
+ // Traverse child elements
+ if let childrenValue = getAttributeValue(element, forAttribute: attr) {
+ if let elementArray = childrenValue as? [AXUIElement] {
+ for childElement in elementArray {
+ traverseHierarchy(childElement, depth: depth + 1)
+ }
+ } else if let childElement = childrenValue as! AXUIElement? {
+ traverseHierarchy(childElement, depth: depth + 1)
+ }
+ }
+ }
+ }
+
+ traverseHierarchy(startElement, depth: 0)
+
+ // Sort elements from top to bottom, then left to right
+ elements.sort { (a, b) in
+ if a.0.y != b.0.y {
+ return a.0.y < b.0.y
+ } else {
+ return a.0.x < b.0.x
+ }
+ }
+
+ // Deduplicate and print sorted elements to stdout, excluding coordinates
+ var uniqueValues = Set<String>()
+ for (_, _, valueStr) in elements {
+ if uniqueValues.insert(valueStr).inserted {
+ print(valueStr)
+ }
+ }
+}
+
+func formatCoordinates(_ position: CGPoint, _ size: CGSize) -> String {
+ return String(format: "(x:%.0f,y:%.0f,w:%.0f,h:%.0f)", position.x, position.y, size.width, size.height)
+}
+
+func describeValue(_ value: AnyObject?) -> String {
+ switch value {
+ case let string as String:
+ return string
+ case let number as NSNumber:
+ return number.stringValue
+ case let point as NSPoint:
+ return "(\(point.x), \(point.y))"
+ case let size as NSSize:
+ return "w=\(size.width) h=\(size.height)"
+ case let rect as NSRect:
+ return "x=\(rect.origin.x) y=\(rect.origin.y) w=\(rect.size.width) h=\(rect.size.height)"
+ case let range as NSRange:
+ return "loc=\(range.location) len=\(range.length)"
+ case let url as URL:
+ return url.absoluteString
+ case let array as [AnyObject]:
+ return array.isEmpty ? "Empty array" : "Array with \(array.count) elements"
+ case let axValue as AXValue:
+ return describeAXValue(axValue)
+ case is AXUIElement:
+ return "AXUIElement"
+ case .none:
+ return "None"
+ default:
+ return String(describing: value)
+ }
+}
+
+func describeAXValue(_ axValue: AXValue) -> String {
+ let type = AXValueGetType(axValue)
+ switch type {
+ case .cgPoint:
+ var point = CGPoint.zero
+ AXValueGetValue(axValue, .cgPoint, &point)
+ return "(\(point.x), \(point.y))"
+ case .cgSize:
+ var size = CGSize.zero
+ AXValueGetValue(axValue, .cgSize, &size)
+ return "w=\(size.width) h=\(size.height)"
+ case .cgRect:
+ var rect = CGRect.zero
+ AXValueGetValue(axValue, .cgRect, &rect)
+ return "x=\(rect.origin.x) y=\(rect.origin.y) w=\(rect.size.width) h=\(rect.size.height)"
+ case .cfRange:
+ var range = CFRange(location: 0, length: 0)
+ AXValueGetValue(axValue, .cfRange, &range)
+ return "loc=\(range.location) len=\(range.length)"
+ default:
+ return "Unknown AXValue type"
+ }
+}
+
+func getAttributeValue(_ element: AXUIElement, forAttribute attr: String) -> AnyObject? {
+ var value: AnyObject?
+ let result = AXUIElementCopyAttributeValue(element, attr as CFString, &value)
+ return result == .success ? value : nil
+}
+
+func printAllAttributeValuesForCurrentApp() {
+ guard let app = NSWorkspace.shared.frontmostApplication else {
+ return
+ }
+
+ let pid = app.processIdentifier
+ let axApp = AXUIElementCreateApplication(pid)
+
+ print("attribute values for \(app.localizedName ?? "unknown app"):")
+ printAllAttributeValues(axApp)
+}
+
+// usage
+printAllAttributeValuesForCurrentApp()
diff --git a/screenpipe-actions/src/run.rs b/screenpipe-actions/src/run.rs
new file mode 100644
index 000000000..0e28db3a0
--- /dev/null
+++ b/screenpipe-actions/src/run.rs
@@ -0,0 +1,254 @@
+use crate::type_and_animate::{delete_characters, type_slowly, EnigoCommand};
+use crate::{call_ai, run_keystroke_monitor, KeystrokeCommand};
+use reqwest;
+use tempfile::NamedTempFile;
+use tokio::process::Command;
+use tokio::sync::mpsc;
+use tokio::task;
+use tokio::time::Instant;
+use tracing::{error, info};
+use std::string::ToString;
+
+pub async fn run() -> anyhow::Result<()> {
+ info!("starting keystroke monitor. press '//' to print attributes for the current app and call openai.");
+ let (tx, mut rx) = mpsc::channel(100);
+
+ let (_enigo_tx, mut enigo_rx) = mpsc::channel(100);
+
+ // Spawn the Enigo handler thread
+ task::spawn_blocking(move || {
+ use enigo::KeyboardControllable;
+ let mut enigo = enigo::Enigo::new();
+ while let Some(command) = enigo_rx.blocking_recv() {
+ match command {
+ EnigoCommand::TypeCharacter(c) => {
+ enigo.key_click(enigo::Key::Layout(c));
+ }
+ EnigoCommand::TypeString(s) => {
+ enigo.key_sequence(&s);
+ }
+ EnigoCommand::DeleteCharacter => {
+ enigo.key_click(enigo::Key::Backspace);
+ }
+ EnigoCommand::Shutdown => {
+ println!("Shutting down Enigo thread.");
+ break;
+ }
+ }
+ }
+ });
+
+ // Spawn the keystroke monitor
+ let tx_clone = tx.clone();
+ task::spawn(async move {
+ if let Err(e) = run_keystroke_monitor(tx_clone).await {
+ eprintln!("Error in keystroke monitoring: {:?}", e);
+ }
+ });
+
+ while let Some(command) = rx.recv().await {
+ match command {
+ KeystrokeCommand::DoubleSlash => {
+ info!("double slash detected. calling ai...");
+
+ type_slowly("thinking".to_string()).await?;
+ let swift_output = run_swift_script().await?;
+
+ // Use swift_output directly here
+ // For example, pass it to the LLM or process it further
+
+ info!("swift output: {}", swift_output);
+
+ let prompt = format!(
+ r#"Based on the following Swift output,
+ you need to continue where the "//" is.
+ Output your response in JSON format as follows:
+ {{
+ "response": "Your response text here"
+ }}
+ The response should match the length, tone, and style of the message/prompt we are responding to.
+ It should not look like it was written by AI.
+ You are responding on behalf of the user, try to understand what is actually happening.
+ We also provide you with detailed print out of the entire desktop content for your reference below:
+ "{}"
+ "#,
+ swift_output
+ );
+
+ let start = Instant::now();
+ match call_ai(prompt, String::new(), true).await {
+ Ok(response) => {
+ let duration = start.elapsed();
+ info!("{:.1?} - first call_ai", duration);
+ delete_characters("thinking".len()).await?;
+ delete_characters(2).await?; // Delete the double slash
+ info!("ai response: {}", response);
+ type_slowly("[GENERIC_RESPONSE]".to_string()).await?;
+ type_slowly("\n".to_string()).await?;
+ type_slowly(response).await?;
+ }
+ Err(e) => {
+ let duration = start.elapsed();
+ error!("{:.1?} - failed first call_ai", duration);
+ delete_characters("thinking".len()).await?;
+ error!("failed to get response from ai: {}", e);
+ continue; // skip the rest of the loop iteration
+ }
+ }
+ type_slowly("\n".to_string()).await?;
+ type_slowly("\n".to_string()).await?;
+ type_slowly("[RESPONSE_WITH_CONTEXT]".to_string()).await?;
+
+ let context = format!("Swift output: {}", swift_output);
+ let prompt = r#"Based on the following Swift output, find double slash '//' to see where users curor is,
+ Now, provide 3 search queries to find relevant context in user files to continue the conversation. follow these guidelines:
+
+ 1. focus on specificity, avoid generic words
+ 2. use noun phrases, target key concepts
+ 3. employ technical terms when appropriate
+ 4. consider synonyms and related concepts
+ 5. utilize proper nouns (names, places, products)
+ 6. incorporate timeframes if relevant
+ 7. prioritize unusual or unique words
+ 8. consider file types if applicable
+
+ return a json object with an array of 3 queries, each query should be one to three words max. format:
+ {
+ "response": [
+ "query1",
+ "query2",
+ "query3"
+ ]
+ }"#.to_string();
+
+ let start = Instant::now();
+ match call_ai(prompt, context, true).await {
+ Ok(response) => {
+ let duration = start.elapsed();
+ info!("{:.1?} - second call_ai", duration);
+ // println!("ai response: {}", response);
+
+ // Split the response by newlines to get individual queries
+ let queries: Vec<String> = response
+ .split('\n')
+ .map(|s| s.trim().to_string())
+ .filter(|s| !s.is_empty())
+ .collect();
+
+ let mut search_results = Vec::new();
+
+ for query in &queries {
+ match search_localhost(query).await {
+ // used to be &query
+ Ok(search_result) => {
+ let truncated_result =
+ search_result.chars().take(100).collect::<String>();
+ let capitalized_query = query.to_uppercase();
+ type_slowly(format!("[{}] ", capitalized_query)).await?;
+ info!("search result for '{}': {}", query, truncated_result);
+ search_results.push(search_result);
+ }
+ Err(e) => {
+ error!("error searching localhost for '{}': {:?}", query, e)
+ }
+ }
+ }
+
+ type_slowly("\n".to_string()).await?;
+ type_slowly("analyzing".to_string()).await?;
+
+ // Final LLM call
+ let final_prompt = r#"Based on the desktop text and search results of my computer, draft a concise response.
+ Provide the most relevant message
+ Also provide who your message is addressed to ("TO_YOU" or "ON_YOUR_BEHALF")
+ You might be writing: a response, a follow-up, a suggestion, a clarification, or you might be puzzled
+ Output your response in JSON format as follows:
+ {
+ "response": "[ADDRESSED TO] Your response text here"
+ }
+ Ensure the response matches the length and tone of the message we are responding to.
+ Make the response concise and to the point.
+ The response should be casual, social media style.
+ It should not look like it was written by AI.
+ "#.to_string();
+ let final_context = format!(
+ "swift output: {}\nfirst llm response: {}\nsearch results: {}",
+ swift_output,
+ response,
+ search_results.join("\n")
+ );
+
+ let start = Instant::now();
+ match call_ai(final_prompt, final_context, true).await {
+ Ok(final_response) => {
+ let duration = start.elapsed();
+ info!("{:.1?} - final call_ai", duration);
+ delete_characters("analyzing".len()).await?;
+ info!("<<<llm final response>>>: {}", final_response);
+ type_slowly(final_response).await?;
+ }
+ Err(e) => {
+ error!("error in final openai call: {:?}", e);
+ continue;
+ }
+ }
+ }
+ Err(e) => {
+ error!("error in second openai call: {}", e);
+ continue;
+ }
+ }
+ }
+ }
+ }
+ Ok(())
+}
+
+async fn run_swift_script() -> anyhow::Result<String> {
+ let start = Instant::now();
+
+ let script_content = include_str!("print_all_attributes.swift");
+ let temp_file = NamedTempFile::new()?;
+ tokio::fs::write(temp_file.path(), script_content).await?;
+
+ info!("running swift script");
+ let output = Command::new("swift").arg(temp_file.path()).output().await?;
+
+ let duration = start.elapsed();
+ info!("{:.1?} - run_swift_script", duration);
+
+ let stdout = String::from_utf8_lossy(&output.stdout);
+ let stderr = String::from_utf8_lossy(&output.stderr);
+
+ info!("debug: swift stdout length: {}", stdout.len());
+ info!("debug: swift stderr length: {}", stderr.len());
+
+ if !output.status.success() {
+ info!(
+ "debug: swift script failed with status: {:?}",
+ output.status
+ );
+ anyhow::bail!("swift script failed: {}", stderr);
+ }
+
+ if stdout.is_empty() {
+ info!("debug: swift stdout is empty, returning stderr");
+ Ok(stderr.into_owned())
+ } else {
+ info!("debug: returning swift stdout");
+ Ok(stdout.into_owned())
+ }
+}
+
+async fn search_localhost(query: &str) -> anyhow::Result<String> {
+ let start = Instant::now();
+ let client = reqwest::Client::new();
+ let url = format!(
+ "http://localhost:3030/search?q={}&content_type=all&limit=5&offset=0",
+ query
+ );
+ let response = client.get(&url).send().await?.text().await?;
+ let duration = start.elapsed();
+ info!("{:.1?} - search_localhost for '{}'", duration, query);
+ Ok(response)
+}
diff --git a/screenpipe-actions/src/screenshot.rs b/screenpipe-actions/src/screenshot.rs
new file mode 100644
index 000000000..3510f1a18
--- /dev/null
+++ b/screenpipe-actions/src/screenshot.rs
@@ -0,0 +1,18 @@
+// use anyhow::Result;
+// use image::DynamicImage;
+// use screenshots::Screen;
+
+// Commented out unused function
+// pub fn capture_main_window_screenshot() -> Result<DynamicImage> {
+// // ... existing code ...
+// }
+
+// Commented out unused function
+// fn is_valid_window(window: &Window) -> bool {
+// let title = window.title().unwrap_or_default();
+// let class = window.class().unwrap_or_default();
+//
+// !title.is_empty() && !class.is_empty() && title != "Desktop" && class != "Desktop"
+// }
+
+// If there are any other functions or code in this file, keep them as is
diff --git a/screenpipe-actions/src/type_and_animate.rs b/screenpipe-actions/src/type_and_animate.rs
new file mode 100644
index 000000000..a15f0bfe7
--- /dev/null
+++ b/screenpipe-actions/src/type_and_animate.rs
@@ -0,0 +1,68 @@
+use anyhow::Result;
+use tokio::time::{sleep, Duration};
+use std::cell::RefCell;
+use enigo::{Enigo, Key, KeyboardControllable};
+use serde::Serialize;
+
+#[allow(dead_code)]
+#[derive(Debug)]
+pub enum EnigoCommand {
+ TypeCharacter(char),
+ TypeString(String),
+ DeleteCharacter,
+ Shutdown,
+}
+
+#[derive(Debug, Serialize)]
+pub struct EnigoResponse {
+ pub success: bool,
+ pub message: Option<String>,
+}
+
+thread_local! {
+ static ENIGO: RefCell<Option<Enigo>> = RefCell::new(None);
+}
+
+fn with_enigo<F, R>(f: F) -> R
+where
+ F: FnOnce(&mut Enigo) -> R,
+{
+ ENIGO.with(|cell| {
+ let mut enigo = cell.borrow_mut();
+ if enigo.is_none() {
+ *enigo = Some(Enigo::new());
+ }
+ f(enigo.as_mut().unwrap())
+ })
+}
+
+pub async fn delete_characters(count: usize) -> Result<()> {
+ tokio::task::spawn_blocking(move || {
+ with_enigo(|enigo| {
+ enigo.key_sequence(&"\u{8}".repeat(count));
+ });
+ })
+ .await?;
+ Ok(())
+}
+
+pub async fn type_slowly(text: String) -> Result<()> {
+ let text_len = text.len();
+ tokio::task::spawn_blocking(move || {
+ with_enigo(|enigo| {
+ for line in text.split('\n') {
+ if !line.is_empty() {
+ enigo.key_sequence(line);
+ }
+ if text.contains('\n') {
+ enigo.key_down(Key::Shift);
+ enigo.key_click(Key::Return);
+ enigo.key_up(Key::Shift);
+ }
+ }
+ });
+ })
+ .await?;
+ sleep(Duration::from_millis(text_len as u64)).await;
+ Ok(())
+}
diff --git a/screenpipe-core/Cargo.toml b/screenpipe-core/Cargo.toml
index dbe2080c6..3c7ef9ca6 100644
--- a/screenpipe-core/Cargo.toml
+++ b/screenpipe-core/Cargo.toml
@@ -18,6 +18,7 @@ candle-nn = { workspace = true, optional = true }
candle-transformers = { workspace = true, optional = true }
tokenizers = { workspace = true, optional = true }
hf-hub = { workspace = true, features = ["tokio"], optional = true }
+screenpipe-actions = { path = "../screenpipe-actions", optional = true }
# pipes
reqwest = { workspace = true }
@@ -42,6 +43,7 @@ security = ["dep:regex", "dep:lazy_static"]
metal = ["candle/metal", "candle-nn/metal", "candle-transformers/metal"]
cuda = ["candle/cuda", "candle-nn/cuda", "candle-transformers/cuda"]
mkl = ["candle/mkl", "candle-nn/mkl", "candle-transformers/mkl"]
+beta = ["dep:screenpipe-actions"]
[build-dependencies]
# Move this under the same feature flag
diff --git a/screenpipe-core/src/actions.rs b/screenpipe-core/src/actions.rs
new file mode 100644
index 000000000..006cfe9d3
--- /dev/null
+++ b/screenpipe-core/src/actions.rs
@@ -0,0 +1 @@
+pub use screenpipe_actions::run;
diff --git a/screenpipe-server/Cargo.toml b/screenpipe-server/Cargo.toml
index 03c89f8f3..94f4bb96c 100644
--- a/screenpipe-server/Cargo.toml
+++ b/screenpipe-server/Cargo.toml
@@ -16,6 +16,7 @@ serde_json = "1.0"
screenpipe-vision = { path = "../screenpipe-vision" }
screenpipe-audio = { path = "../screenpipe-audio" }
screenpipe-core = { path = "../screenpipe-core", features = ["security"] }
+screenpipe-actions = { path = "../screenpipe-actions" }
# Image processing
image = { workspace = true }
@@ -53,7 +54,7 @@ tracing = { workspace = true }
tracing-subscriber = { workspace = true }
tracing-appender = { workspace = true }
# Cli ! shouldn't be required if using as lib
-clap = { version = "4.3", features = ["derive"] }
+clap = { version = "4.3", features = ["derive", "env"] }
# Memory watchdog
sysinfo = "0.29.0"
@@ -116,7 +117,7 @@ metal = ["candle/metal", "candle-nn/metal", "candle-transformers/metal"]
cuda = ["candle/cuda", "candle-nn/cuda", "candle-transformers/cuda"]
pipes = ["screenpipe-core/pipes", "tempfile", "url"]
llm = ["screenpipe-core/llm"]
-
+beta = ["screenpipe-core/beta"]
[[bin]]
name = "screenpipe"
diff --git a/screenpipe-server/src/bin/screenpipe-server.rs b/screenpipe-server/src/bin/screenpipe-server.rs
index 3555f5f3a..0c95cc23d 100644
--- a/screenpipe-server/src/bin/screenpipe-server.rs
+++ b/screenpipe-server/src/bin/screenpipe-server.rs
@@ -1,7 +1,6 @@
use std::{
- collections::HashMap, fs, io, net::SocketAddr, ops::Deref, path::PathBuf, sync::{atomic::AtomicBool, Arc}, time::Duration, env
+ collections::HashMap, fs, io, net::SocketAddr, ops::Deref, path::PathBuf, sync::{atomic::AtomicBool, Arc}, time::Duration, env, io::Write
};
-use std::io::Write;
use clap::Parser;
#[allow(unused_imports)]
@@ -106,8 +105,10 @@ fn setup_logging(local_data_dir: &PathBuf, cli: &Cli) -> anyhow::Result<WorkerGu
#[tokio::main]
async fn main() -> anyhow::Result<()> {
+
debug!("starting screenpipe server");
let cli = Cli::parse();
+
let local_data_dir = get_base_dir(&cli.data_dir)?;
let local_data_dir_clone = local_data_dir.clone();
@@ -392,7 +393,7 @@ async fn main() -> anyhow::Result<()> {
"open source | runs locally | developer friendly".bright_green()
);
- println!("┌─────────────────────┬────────────────────────────────────┐");
+ println!("┌─────────────────────┬──────────────���─────���───────────────┐");
println!("│ setting │ value │");
println!("├─────────────────────┼────────────────────────────────────┤");
println!("│ fps │ {:<34} │", cli.fps);
@@ -633,6 +634,20 @@ async fn main() -> anyhow::Result<()> {
let ctrl_c_future = signal::ctrl_c();
pin_mut!(ctrl_c_future);
+ #[cfg(feature = "beta")]
+ {
+ use screenpipe_actions::run; // Ensure this import is present
+
+ info!("beta feature enabled, starting screenpipe actions");
+
+ // Spawn the run function in a blocking task to avoid affecting the async runtime
+ tokio::spawn(async {
+ if let Err(e) = run().await {
+ eprintln!("Error running screenpipe actions: {}", e);
+ }
+ });
+ }
+
tokio::select! {
_ = handle => info!("recording completed"),
result = &mut server_future => {