screenpipe 0.3.139

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execFileSync, execSync } = require("child_process");
4
+ const { join, dirname } = require("path");
5
+ const { existsSync, chmodSync } = require("fs");
6
+
7
+ const PLATFORMS = {
8
+ "darwin-arm64": "@screenpipe/cli-darwin-arm64",
9
+ "darwin-x64": "@screenpipe/cli-darwin-x64",
10
+ "linux-x64": "@screenpipe/cli-linux-x64",
11
+ "win32-x64": "@screenpipe/cli-win32-x64",
12
+ };
13
+
14
+ const key = `${process.platform}-${process.arch}`;
15
+ const pkg = PLATFORMS[key];
16
+
17
+ if (!pkg) {
18
+ console.error(`screenpipe: unsupported platform ${key}`);
19
+ console.error(`supported: ${Object.keys(PLATFORMS).join(", ")}`);
20
+ process.exit(1);
21
+ }
22
+
23
+ let binPath;
24
+ try {
25
+ const pkgPath = require.resolve(`${pkg}/package.json`);
26
+ const ext = process.platform === "win32" ? ".exe" : "";
27
+ binPath = join(dirname(pkgPath), "bin", `screenpipe${ext}`);
28
+ } catch {
29
+ console.error(`screenpipe: platform package ${pkg} not installed`);
30
+ console.error(`run: npm install screenpipe (or: bun install screenpipe)`);
31
+ process.exit(1);
32
+ }
33
+
34
+ if (!existsSync(binPath)) {
35
+ console.error(`screenpipe: binary not found at ${binPath}`);
36
+ console.error(`the platform package may be corrupted. try reinstalling.`);
37
+ process.exit(1);
38
+ }
39
+
40
+ // macOS: remove quarantine attribute (Gatekeeper) and ensure executable
41
+ if (process.platform === "darwin") {
42
+ try {
43
+ execSync(`xattr -d com.apple.quarantine "${binPath}" 2>/dev/null || true`);
44
+ } catch {}
45
+ try {
46
+ chmodSync(binPath, 0o755);
47
+ } catch {}
48
+ }
49
+
50
+ // Linux: ensure executable
51
+ if (process.platform === "linux") {
52
+ try {
53
+ chmodSync(binPath, 0o755);
54
+ } catch {}
55
+ }
56
+
57
+ try {
58
+ execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
59
+ } catch (e) {
60
+ if (e.status !== undefined) {
61
+ process.exit(e.status);
62
+ }
63
+
64
+ // Helpful error messages for common failures
65
+ const msg = (e.message || "").toLowerCase();
66
+ if (process.platform === "darwin" && msg.includes("eperm")) {
67
+ console.error(`\nscreenpipe: macOS blocked the binary.`);
68
+ console.error(`go to System Settings > Privacy & Security and allow screenpipe.`);
69
+ console.error(`or run: xattr -d com.apple.quarantine "${binPath}"`);
70
+ } else if (process.platform === "linux" && msg.includes("enoent")) {
71
+ console.error(`\nscreenpipe: missing system libraries.`);
72
+ console.error(`try: sudo apt install libasound2-dev ffmpeg (ubuntu/debian)`);
73
+ console.error(` sudo dnf install alsa-lib ffmpeg (fedora)`);
74
+ } else if (process.platform === "win32" && msg.includes("onnxruntime")) {
75
+ console.error(`\nscreenpipe: missing onnxruntime.dll`);
76
+ console.error(`check that it's alongside screenpipe.exe in the package.`);
77
+ }
78
+
79
+ process.exit(e.status || 1);
80
+ }
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "screenpipe",
3
+ "version": "0.3.139",
4
+ "description": "screenpipe CLI — AI that knows everything you've seen, said, or heard",
5
+ "bin": {
6
+ "screenpipe": "bin/screenpipe.js"
7
+ },
8
+ "scripts": {
9
+ "postinstall": "sh scripts/postinstall.sh || true"
10
+ },
11
+ "optionalDependencies": {
12
+ "@screenpipe/cli-darwin-arm64": "0.3.139",
13
+ "@screenpipe/cli-darwin-x64": "0.3.139",
14
+ "@screenpipe/cli-linux-x64": "0.3.139",
15
+ "@screenpipe/cli-win32-x64": "0.3.139"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/screenpipe/screenpipe"
20
+ },
21
+ "license": "MIT",
22
+ "keywords": [
23
+ "screenpipe",
24
+ "screen-recording",
25
+ "ai",
26
+ "memory",
27
+ "cli"
28
+ ]
29
+ }
@@ -0,0 +1,114 @@
1
+ #!/bin/sh
2
+ # postinstall script — ensures runtime dependencies are present
3
+ # Runs automatically after `npm install screenpipe` or `bunx screenpipe`
4
+
5
+ set -e
6
+
7
+ check_ffmpeg() {
8
+ if command -v ffmpeg >/dev/null 2>&1; then
9
+ return 0
10
+ fi
11
+ return 1
12
+ }
13
+
14
+ install_ffmpeg_macos() {
15
+ arch=$(uname -m)
16
+ if [ "$arch" = "arm64" ]; then
17
+ FFMPEG_URL="https://ffmpeg.martin-riedl.de/redirect/latest/macos/arm64/release/ffmpeg.zip"
18
+ else
19
+ FFMPEG_URL="https://ffmpeg.martin-riedl.de/redirect/latest/macos/amd64/release/ffmpeg.zip"
20
+ fi
21
+
22
+ echo "screenpipe: downloading ffmpeg..."
23
+ TMP_DIR=$(mktemp -d)
24
+ if curl -sL "$FFMPEG_URL" -o "$TMP_DIR/ffmpeg.zip"; then
25
+ cd "$TMP_DIR"
26
+ unzip -q ffmpeg.zip
27
+ mkdir -p "$HOME/.local/bin"
28
+ mv ffmpeg "$HOME/.local/bin/"
29
+ chmod +x "$HOME/.local/bin/ffmpeg"
30
+ xattr -d com.apple.quarantine "$HOME/.local/bin/ffmpeg" 2>/dev/null || true
31
+ cd - >/dev/null
32
+ rm -rf "$TMP_DIR"
33
+ echo "screenpipe: ffmpeg installed to ~/.local/bin/ffmpeg"
34
+ else
35
+ echo "screenpipe: warning: failed to download ffmpeg"
36
+ echo "screenpipe: install it manually: brew install ffmpeg"
37
+ fi
38
+ }
39
+
40
+ install_ffmpeg_linux() {
41
+ if command -v apt-get >/dev/null 2>&1; then
42
+ echo "screenpipe: installing ffmpeg via apt..."
43
+ sudo apt-get install -qq -y ffmpeg 2>/dev/null || echo "screenpipe: warning: failed to install ffmpeg (try: sudo apt install ffmpeg)"
44
+ elif command -v dnf >/dev/null 2>&1; then
45
+ echo "screenpipe: installing ffmpeg via dnf..."
46
+ sudo dnf install -q -y ffmpeg 2>/dev/null || echo "screenpipe: warning: failed to install ffmpeg (try: sudo dnf install ffmpeg)"
47
+ elif command -v pacman >/dev/null 2>&1; then
48
+ echo "screenpipe: installing ffmpeg via pacman..."
49
+ sudo pacman -S --noconfirm --quiet ffmpeg 2>/dev/null || echo "screenpipe: warning: failed to install ffmpeg (try: sudo pacman -S ffmpeg)"
50
+ else
51
+ echo "screenpipe: warning: ffmpeg not found. install it manually."
52
+ fi
53
+ }
54
+
55
+ install_linux_deps() {
56
+ # Check for libasound
57
+ if ! ldconfig -p 2>/dev/null | grep -q "libasound.so.2"; then
58
+ if command -v apt-get >/dev/null 2>&1; then
59
+ echo "screenpipe: installing libasound2-dev..."
60
+ sudo apt-get install -qq -y libasound2-dev 2>/dev/null || true
61
+ elif command -v dnf >/dev/null 2>&1; then
62
+ sudo dnf install -q -y alsa-lib 2>/dev/null || true
63
+ elif command -v pacman >/dev/null 2>&1; then
64
+ sudo pacman -S --noconfirm --quiet alsa-lib 2>/dev/null || true
65
+ fi
66
+ fi
67
+ }
68
+
69
+ # Remove macOS quarantine from the binary
70
+ remove_quarantine() {
71
+ if [ "$(uname)" = "Darwin" ]; then
72
+ # Find the platform package binary
73
+ SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
74
+ PKG_DIR=$(dirname "$SCRIPT_DIR")
75
+ NODE_MODULES=$(dirname "$PKG_DIR")
76
+ for pkg in "@screenpipe/cli-darwin-arm64" "@screenpipe/cli-darwin-x64"; do
77
+ BIN="$NODE_MODULES/$pkg/bin/screenpipe"
78
+ if [ -f "$BIN" ]; then
79
+ xattr -d com.apple.quarantine "$BIN" 2>/dev/null || true
80
+ fi
81
+ done
82
+ fi
83
+ }
84
+
85
+ # Main
86
+ OS=$(uname -s | tr '[:upper:]' '[:lower:]')
87
+
88
+ if ! check_ffmpeg; then
89
+ case "$OS" in
90
+ darwin) install_ffmpeg_macos ;;
91
+ linux) install_ffmpeg_linux ;;
92
+ esac
93
+ fi
94
+
95
+ if [ "$OS" = "linux" ]; then
96
+ install_linux_deps
97
+ fi
98
+
99
+ remove_quarantine
100
+
101
+ # PostHog install tracking (non-blocking)
102
+ curl -sL -X POST https://eu.i.posthog.com/capture/ \
103
+ -H "Content-Type: application/json" \
104
+ -d '{
105
+ "api_key": "phc_Bt8GoTBPgkCpDrbaIZzJIEYt0CrJjhBiuLaBck1clce",
106
+ "event": "cli_install_npm",
107
+ "properties": {
108
+ "distinct_id": "'$(hostname)'",
109
+ "os": "'$OS'",
110
+ "arch": "'$(uname -m)'"
111
+ }
112
+ }' >/dev/null 2>&1 || true
113
+
114
+ echo "screenpipe: ready! run: screenpipe status"