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

Bump app to v2.0.102 release-app

Louis Beaumont11b50132ebab
diff --git a/.github/workflows/release-app-beta.yml b/.github/workflows/release-app-beta.yml
index 380b1b546..49e4956a8 100644
--- a/.github/workflows/release-app-beta.yml
+++ b/.github/workflows/release-app-beta.yml
@@ -169,10 +169,12 @@ jobs:
if [[ "${{ matrix.os_type }}" == "macos" ]]; then
export PKG_CONFIG_PATH="/usr/local/opt/ffmpeg/lib/pkgconfig:$PKG_CONFIG_PATH"
export PKG_CONFIG_ALLOW_CROSS=1
- # Fix i8mm build error - use apple-m1 target to ensure M1 compatibility
+ # Fix i8mm build error - force M1 compatible architecture
+ # GGML_NO_NATIVE prevents whisper.cpp from using native CPU detection
if [[ "${{ matrix.target }}" == "aarch64-apple-darwin" ]]; then
export CFLAGS="-mcpu=apple-m1"
export CXXFLAGS="-mcpu=apple-m1"
+ export GGML_NO_NATIVE=1
fi
fi
cargo build --release -p screenpipe-server ${{ matrix.args }}
@@ -205,8 +207,10 @@ jobs:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
CI: true
# Fix i8mm - use apple-m1 target for M1 compatibility
+ # GGML_NO_NATIVE prevents whisper.cpp from using native CPU detection
CFLAGS: ${{ matrix.target == 'aarch64-apple-darwin' && '-mcpu=apple-m1' || '' }}
CXXFLAGS: ${{ matrix.target == 'aarch64-apple-darwin' && '-mcpu=apple-m1' || '' }}
+ GGML_NO_NATIVE: ${{ matrix.target == 'aarch64-apple-darwin' && '1' || '' }}
with:
args: ${{ matrix.tauri-args }}
projectPath: "./screenpipe-app-tauri"
diff --git a/.github/workflows/release-app.yml b/.github/workflows/release-app.yml
index f08a46670..2d7e554d2 100644
--- a/.github/workflows/release-app.yml
+++ b/.github/workflows/release-app.yml
@@ -433,12 +433,15 @@ jobs:
if [[ "${{ matrix.os_type }}" == "macos" ]]; then
export PKG_CONFIG_PATH="/usr/local/opt/ffmpeg/lib/pkgconfig:$PKG_CONFIG_PATH"
export PKG_CONFIG_ALLOW_CROSS=1
- # Fix i8mm build error - use apple-m1 target to ensure M1 compatibility
+ # Fix i8mm build error - force M1 compatible architecture
# M1 = armv8.4-a (no i8mm), M2+ = armv8.5-a+ (has i8mm)
+ # CMAKE_OSX_ARCHITECTURES prevents whisper.cpp CMake from auto-detecting and using native CPU features
# See: https://github.com/ggml-org/whisper.cpp/issues/3427
if [[ "${{ matrix.target }}" == "aarch64-apple-darwin" ]]; then
export CFLAGS="-mcpu=apple-m1"
export CXXFLAGS="-mcpu=apple-m1"
+ export CMAKE_APPLE_SILICON_PROCESSOR="arm64"
+ export GGML_NO_NATIVE=1
fi
fi
cargo build --release -p screenpipe-server ${{ matrix.args }}
@@ -536,11 +539,14 @@ jobs:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
# https://tauri.app/v1/guides/distribution/sign-macos
CI: true
- # Fix i8mm build error - use apple-m1 target to ensure M1 compatibility
+ # Fix i8mm build error - force M1 compatible architecture
# M1 = armv8.4-a (no i8mm), M2+ = armv8.5-a+ (has i8mm)
+ # GGML_NO_NATIVE prevents whisper.cpp from using native CPU detection
# See: https://github.com/ggml-org/whisper.cpp/issues/3427
CFLAGS: ${{ matrix.target == 'aarch64-apple-darwin' && '-mcpu=apple-m1' || '' }}
CXXFLAGS: ${{ matrix.target == 'aarch64-apple-darwin' && '-mcpu=apple-m1' || '' }}
+ GGML_NO_NATIVE: ${{ matrix.target == 'aarch64-apple-darwin' && '1' || '' }}
+ CMAKE_APPLE_SILICON_PROCESSOR: ${{ matrix.target == 'aarch64-apple-darwin' && 'arm64' || '' }}
# Optimize for build speed on Windows
CARGO_PROFILE_RELEASE_LTO: ${{ matrix.os_type == 'windows' && 'thin' || 'false' }}
CARGO_PROFILE_RELEASE_OPT_LEVEL: ${{ matrix.os_type == 'windows' && '2' || '3' }}
diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml
index dc02d507f..98be46b24 100644
--- a/.github/workflows/release-cli.yml
+++ b/.github/workflows/release-cli.yml
@@ -73,12 +73,14 @@ jobs:
export PKG_CONFIG_PATH="/usr/local/opt/ffmpeg/lib/pkgconfig:$PKG_CONFIG_PATH"
export PKG_CONFIG_ALLOW_CROSS=1
export RUSTFLAGS="-C link-arg=-Wl,-rpath,@executable_path/../lib -C link-arg=-Wl,-rpath,@loader_path/../lib"
- # Fix i8mm build error - use apple-m1 target to ensure M1 compatibility
+ # Fix i8mm build error - force M1 compatible architecture
# M1 = armv8.4-a (no i8mm), M2+ = armv8.5-a+ (has i8mm)
+ # GGML_NO_NATIVE prevents whisper.cpp from using native CPU detection
# See: https://github.com/ggml-org/whisper.cpp/issues/3427
if [[ "${{ matrix.target }}" == "aarch64-apple-darwin" ]]; then
export CFLAGS="-mcpu=apple-m1"
export CXXFLAGS="-mcpu=apple-m1"
+ export GGML_NO_NATIVE=1
fi
cargo build --release --features metal --target ${{ matrix.target }}
diff --git a/screenpipe-app-tauri/app/permission-recovery/page.tsx b/screenpipe-app-tauri/app/permission-recovery/page.tsx
new file mode 100644
index 000000000..cc5d3268e
--- /dev/null
+++ b/screenpipe-app-tauri/app/permission-recovery/page.tsx
@@ -0,0 +1,297 @@
+"use client";
+
+import React, { useState, useEffect, useCallback } from "react";
+import { Monitor, Mic, Keyboard, Check, AlertTriangle, RefreshCw, ExternalLink, X } from "lucide-react";
+import { Button } from "@/components/ui/button";
+import { commands, type OSPermission, type OSPermissionsCheck } from "@/lib/utils/tauri";
+import { motion, AnimatePresence } from "framer-motion";
+import { usePlatform } from "@/lib/hooks/use-platform";
+import posthog from "posthog-js";
+
+type PermissionState = "checking" | "fixing" | "success" | "idle";
+
+interface PermissionRowProps {
+ icon: React.ReactNode;
+ label: string;
+ description: string;
+ status: "granted" | "denied" | "checking";
+ onFix: () => void;
+ onReset: () => void;
+ isFixing: boolean;
+}
+
+function PermissionRow({ icon, label, description, status, onFix, onReset, isFixing }: PermissionRowProps) {
+ return (
+ <div className="flex items-center justify-between p-4 border border-border rounded-lg bg-card">
+ <div className="flex items-center space-x-3">
+ <div className="text-muted-foreground">{icon}</div>
+ <div>
+ <span className="font-mono text-sm block">{label}</span>
+ <span className="font-mono text-xs text-muted-foreground">{description}</span>
+ </div>
+ </div>
+ <div className="flex items-center space-x-2">
+ {status === "checking" ? (
+ <RefreshCw className="w-4 h-4 animate-spin text-muted-foreground" />
+ ) : status === "granted" ? (
+ <div className="flex items-center space-x-1 text-green-500">
+ <Check className="w-4 h-4" strokeWidth={2} />
+ <span className="font-mono text-xs">ok</span>
+ </div>
+ ) : (
+ <div className="flex items-center space-x-2">
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={onReset}
+ disabled={isFixing}
+ className="font-mono text-xs"
+ >
+ {isFixing ? (
+ <>
+ <RefreshCw className="w-3 h-3 mr-1 animate-spin" />
+ fixing...
+ </>
+ ) : (
+ <>
+ <RefreshCw className="w-3 h-3 mr-1" />
+ reset & fix
+ </>
+ )}
+ </Button>
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={onFix}
+ disabled={isFixing}
+ className="font-mono text-xs"
+ >
+ <ExternalLink className="w-3 h-3 mr-1" />
+ manual
+ </Button>
+ </div>
+ )}
+ </div>
+ </div>
+ );
+}
+
+export default function PermissionRecoveryPage() {
+ const [permissions, setPermissions] = useState<OSPermissionsCheck | null>(null);
+ const [fixingPermission, setFixingPermission] = useState<OSPermission | null>(null);
+ const [justFixed, setJustFixed] = useState<Set<string>>(new Set());
+ const { isMac: isMacOS } = usePlatform();
+
+ // Check permissions
+ const checkPermissions = useCallback(async () => {
+ try {
+ const perms = await commands.doPermissionsCheck(false);
+ setPermissions(perms);
+ return perms;
+ } catch (error) {
+ console.error("Failed to check permissions:", error);
+ return null;
+ }
+ }, []);
+
+ // Initial check and polling
+ useEffect(() => {
+ checkPermissions();
+
+ // Poll every 500ms while window is open
+ const interval = setInterval(checkPermissions, 500);
+ return () => clearInterval(interval);
+ }, [checkPermissions]);
+
+ // Track when permission is fixed
+ useEffect(() => {
+ if (!permissions) return;
+
+ const screenOk = permissions.screenRecording === "granted" || permissions.screenRecording === "notNeeded";
+ const micOk = permissions.microphone === "granted" || permissions.microphone === "notNeeded";
+ const accessibilityOk = permissions.accessibility === "granted" || permissions.accessibility === "notNeeded";
+
+ // Add to justFixed set when permission becomes granted
+ const newJustFixed = new Set(justFixed);
+ if (screenOk && fixingPermission === "screenRecording") {
+ newJustFixed.add("screenRecording");
+ setFixingPermission(null);
+ }
+ if (micOk && fixingPermission === "microphone") {
+ newJustFixed.add("microphone");
+ setFixingPermission(null);
+ }
+ if (accessibilityOk && fixingPermission === "accessibility") {
+ newJustFixed.add("accessibility");
+ setFixingPermission(null);
+ }
+
+ if (newJustFixed.size !== justFixed.size) {
+ setJustFixed(newJustFixed);
+ }
+
+ // Close window if all critical permissions are granted
+ if (screenOk && micOk) {
+ // Wait a moment to show success state
+ setTimeout(async () => {
+ try {
+ await commands.closeWindow("PermissionRecovery");
+ } catch (error) {
+ console.error("Failed to close window:", error);
+ }
+ }, 1500);
+ }
+ }, [permissions, fixingPermission, justFixed]);
+
+ // Open system settings for a permission
+ const openSettings = async (permission: OSPermission) => {
+ posthog.capture("permission_recovery_manual_fix", { permission });
+ try {
+ await commands.openPermissionSettings(permission);
+ } catch (error) {
+ console.error("Failed to open settings:", error);
+ }
+ };
+
+ // Reset and re-request a permission
+ const resetAndFix = async (permission: OSPermission) => {
+ posthog.capture("permission_recovery_reset_fix", { permission });
+ setFixingPermission(permission);
+ try {
+ await commands.resetAndRequestPermission(permission);
+ // The polling will detect when it's fixed
+ } catch (error) {
+ console.error("Failed to reset permission:", error);
+ setFixingPermission(null);
+ }
+ };
+
+ // Close the window
+ const closeWindow = async () => {
+ try {
+ await commands.closeWindow("PermissionRecovery");
+ } catch (error) {
+ console.error("Failed to close window:", error);
+ }
+ };
+
+ const screenStatus = permissions?.screenRecording === "granted" || permissions?.screenRecording === "notNeeded"
+ ? "granted"
+ : permissions === null ? "checking" : "denied";
+ const micStatus = permissions?.microphone === "granted" || permissions?.microphone === "notNeeded"
+ ? "granted"
+ : permissions === null ? "checking" : "denied";
+ const accessibilityStatus = permissions?.accessibility === "granted" || permissions?.accessibility === "notNeeded"
+ ? "granted"
+ : permissions === null ? "checking" : "denied";
+
+ const allCriticalOk = screenStatus === "granted" && micStatus === "granted";
+
+ return (
+ <div className="flex flex-col w-full h-screen overflow-hidden bg-background">
+ {/* Header with drag region and close button */}
+ <div className="w-full bg-background p-4 flex items-center justify-between" data-tauri-drag-region>
+ <div className="w-8" /> {/* Spacer */}
+ <div className="flex items-center space-x-2">
+ <AlertTriangle className="w-4 h-4 text-yellow-500" />
+ <span className="font-mono text-sm">fix permissions</span>
+ </div>
+ <button
+ onClick={closeWindow}
+ className="p-1 rounded hover:bg-muted transition-colors"
+ >
+ <X className="w-4 h-4 text-muted-foreground" />
+ </button>
+ </div>
+
+ {/* Main content */}
+ <div className="flex-1 flex flex-col items-center justify-center p-6 space-y-6">
+ <AnimatePresence mode="wait">
+ {allCriticalOk ? (
+ <motion.div
+ key="success"
+ initial={{ opacity: 0, scale: 0.95 }}
+ animate={{ opacity: 1, scale: 1 }}
+ exit={{ opacity: 0 }}
+ className="text-center space-y-4"
+ >
+ <div className="w-12 h-12 rounded-full bg-green-500/10 flex items-center justify-center mx-auto">
+ <Check className="w-6 h-6 text-green-500" />
+ </div>
+ <div>
+ <h2 className="font-mono text-lg">all fixed!</h2>
+ <p className="font-mono text-xs text-muted-foreground">
+ recording will resume automatically
+ </p>
+ </div>
+ </motion.div>
+ ) : (
+ <motion.div
+ key="fix"
+ initial={{ opacity: 0 }}
+ animate={{ opacity: 1 }}
+ exit={{ opacity: 0 }}
+ className="w-full max-w-md space-y-6"
+ >
+ <div className="text-center space-y-2">
+ <h2 className="font-mono text-lg">recording paused</h2>
+ <p className="font-mono text-xs text-muted-foreground">
+ some permissions were revoked. this can happen after macos updates.
+ </p>
+ </div>
+
+ <div className="space-y-3">
+ <PermissionRow
+ icon={<Monitor className="w-5 h-5" strokeWidth={1.5} />}
+ label="screen recording"
+ description="capture what's on screen"
+ status={screenStatus}
+ onFix={() => openSettings("screenRecording")}
+ onReset={() => resetAndFix("screenRecording")}
+ isFixing={fixingPermission === "screenRecording"}
+ />
+
+ <PermissionRow
+ icon={<Mic className="w-5 h-5" strokeWidth={1.5} />}
+ label="microphone"
+ description="transcribe speech"
+ status={micStatus}
+ onFix={() => openSettings("microphone")}
+ onReset={() => resetAndFix("microphone")}
+ isFixing={fixingPermission === "microphone"}
+ />
+
+ {isMacOS && (
+ <PermissionRow
+ icon={<Keyboard className="w-5 h-5" strokeWidth={1.5} />}
+ label="accessibility"
+ description="keyboard shortcuts"
+ status={accessibilityStatus}
+ onFix={() => openSettings("accessibility")}
+ onReset={() => resetAndFix("accessibility")}
+ isFixing={fixingPermission === "accessibility"}
+ />
+ )}
+ </div>
+
+ <div className="text-center space-y-3">
+ <p className="font-mono text-xs text-muted-foreground">
+ tip: &quot;reset &amp; fix&quot; removes and re-requests the permission automatically.
+ <br />
+ if that doesn&apos;t work, use &quot;manual&quot; to toggle it in system settings.
+ </p>
+
+ <button
+ onClick={closeWindow}
+ className="font-mono text-xs text-muted-foreground hover:text-foreground transition-colors"
+ >
+ remind me later
+ </button>
+ </div>
+ </motion.div>
+ )}
+ </AnimatePresence>
+ </div>
+ </div>
+ );
+}
diff --git a/screenpipe-app-tauri/app/providers.tsx b/screenpipe-app-tauri/app/providers.tsx
index 6587aeeb5..9ef21e917 100644
--- a/screenpipe-app-tauri/app/providers.tsx
+++ b/screenpipe-app-tauri/app/providers.tsx
@@ -6,6 +6,7 @@ import { useEffect } from "react";
import { ChangelogDialogProvider } from "@/lib/hooks/use-changelog-dialog";
import { SettingsProvider } from "@/lib/hooks/use-settings";
import { ThemeProvider } from "@/components/theme-provider";
+import { PermissionMonitorProvider } from "@/lib/hooks/use-permission-monitor";
import { forwardRef } from "react";
import { NuqsAdapter } from "nuqs/adapters/next/app";
@@ -30,7 +31,9 @@ export const Providers = forwardRef<
<ThemeProvider defaultTheme="light" storageKey="screenpipe-ui-theme">
<SettingsProvider>
<ChangelogDialogProvider>
- <PostHogProvider client={posthog}>{children}</PostHogProvider>
+ <PermissionMonitorProvider>
+ <PostHogProvider client={posthog}>{children}</PostHogProvider>
+ </PermissionMonitorProvider>
</ChangelogDialogProvider>
</SettingsProvider>
</ThemeProvider>
diff --git a/screenpipe-app-tauri/components/settings/general-settings.tsx b/screenpipe-app-tauri/components/settings/general-settings.tsx
index 67c1c2724..fc159deb1 100644
--- a/screenpipe-app-tauri/components/settings/general-settings.tsx
+++ b/screenpipe-app-tauri/components/settings/general-settings.tsx
@@ -11,14 +11,14 @@ import { UpdateChannel } from "@/lib/hooks/use-settings";
import { checkForAppUpdates } from "@/components/updater";
import { useToast } from "@/components/ui/use-toast";
import { Button } from "@/components/ui/button";
-import { SettingsStore } from "@/lib/utils/tauri";
+import { Settings } from "@/lib/hooks/use-settings";
export default function GeneralSettings() {
const { settings, updateSettings } = useSettings();
const { theme, setTheme } = useTheme();
const { toast } = useToast();
-
- const handleSettingsChange = (newSettings: Partial<SettingsStore>) => {
+
+ const handleSettingsChange = (newSettings: Partial<Settings>) => {
if (settings) {
updateSettings(newSettings);
}
diff --git a/screenpipe-app-tauri/components/updater.tsx b/screenpipe-app-tauri/components/updater.tsx
index 82bf111e6..dc14f672d 100644
--- a/screenpipe-app-tauri/components/updater.tsx
+++ b/screenpipe-app-tauri/components/updater.tsx
@@ -25,9 +25,10 @@ export async function checkForAppUpdates({
const target = os === "macos" ? "darwin" : os;
const endpoint = `${baseEndpoint}/${target}-${cpuArch}/{{current_version}}`;
+ // @ts-ignore - endpoints option may not be in type definitions but is supported
const update = await check({
endpoints: [endpoint],
- });
+ } as any);
if (update?.available) {
const channelLabel = channel === "beta" ? " (Beta)" : "";
diff --git a/screenpipe-app-tauri/lib/hooks/use-permission-monitor.tsx b/screenpipe-app-tauri/lib/hooks/use-permission-monitor.tsx
new file mode 100644
index 000000000..1aaa8142e
--- /dev/null
+++ b/screenpipe-app-tauri/lib/hooks/use-permission-monitor.tsx
@@ -0,0 +1,64 @@
+"use client";
+
+import { useEffect, useRef } from "react";
+import { listen } from "@tauri-apps/api/event";
+import { commands } from "@/lib/utils/tauri";
+import posthog from "posthog-js";
+
+interface PermissionLostPayload {
+ screen_recording: boolean;
+ microphone: boolean;
+}
+
+/**
+ * Hook that listens for permission-lost events from the Rust backend
+ * and automatically shows the permission recovery window
+ */
+export function usePermissionMonitor() {
+ const hasShownRef = useRef(false);
+
+ useEffect(() => {
+ // Only run on client side
+ if (typeof window === "undefined") return;
+
+ const unlisten = listen<PermissionLostPayload>("permission-lost", async (event) => {
+ const { screen_recording, microphone } = event.payload;
+
+ // Don't show multiple times in quick succession
+ if (hasShownRef.current) return;
+ hasShownRef.current = true;
+
+ console.log("Permission lost detected:", { screen_recording, microphone });
+
+ // Track the event
+ posthog.capture("permission_lost", {
+ screen_recording_lost: screen_recording,
+ microphone_lost: microphone,
+ });
+
+ // Show the permission recovery window
+ try {
+ await commands.showPermissionRecoveryWindow();
+ } catch (error) {
+ console.error("Failed to show permission recovery window:", error);
+ }
+
+ // Reset after a delay to allow showing again later
+ setTimeout(() => {
+ hasShownRef.current = false;
+ }, 60000); // 1 minute cooldown
+ });
+
+ return () => {
+ unlisten.then((fn) => fn());
+ };
+ }, []);
+}
+
+/**
+ * Provider component that sets up the permission monitor
+ */
+export function PermissionMonitorProvider({ children }: { children: React.ReactNode }) {
+ usePermissionMonitor();
+ return <>{children}</>;
+}
diff --git a/screenpipe-app-tauri/lib/utils/tauri.ts b/screenpipe-app-tauri/lib/utils/tauri.ts
index dca88e331..0970b1961 100644
--- a/screenpipe-app-tauri/lib/utils/tauri.ts
+++ b/screenpipe-app-tauri/lib/utils/tauri.ts
@@ -28,6 +28,35 @@ async checkMicrophonePermission() : Promise<OSPermissionStatus> {
async checkAccessibilityPermissionCmd() : Promise<OSPermissionStatus> {
return await TAURI_INVOKE("check_accessibility_permission_cmd");
},
+/**
+ * Reset a permission using tccutil and re-request it
+ * This removes the app from the TCC database and triggers a fresh permission request
+ */
+async resetAndRequestPermission(permission: OSPermission) : Promise<Result<null, string>> {
+ try {
+ return { status: "ok", data: await TAURI_INVOKE("reset_and_request_permission", { permission }) };
+} catch (e) {
+ if(e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+}
+},
+/**
+ * Get list of missing permissions
+ */
+async getMissingPermissions() : Promise<OSPermission[]> {
+ return await TAURI_INVOKE("get_missing_permissions");
+},
+/**
+ * Show the permission recovery window
+ */
+async showPermissionRecoveryWindow() : Promise<Result<null, string>> {
+ try {
+ return { status: "ok", data: await TAURI_INVOKE("show_permission_recovery_window") };
+} catch (e) {
+ if(e instanceof Error) throw e;
+ else return { status: "error", error: e as any };
+}
+},
async getEnv(name: string) : Promise<string> {
return await TAURI_INVOKE("get_env", { name });
},
@@ -257,7 +286,7 @@ analyticsId: string; devMode: boolean; audioTranscriptionEngine: string; ocrEngi
* Unique device ID for AI usage tracking (generated on first launch)
*/
deviceId?: string }
-export type ShowRewindWindow = "Main" | { Settings: { page: string | null } } | { Search: { query: string | null } } | "Onboarding" | "Chat"
+export type ShowRewindWindow = "Main" | { Settings: { page: string | null } } | { Search: { query: string | null } } | "Onboarding" | "Chat" | "PermissionRecovery"
export type User = { id: string | null; name: string | null; email: string | null; image: string | null; token: string | null; clerk_id: string | null; api_key: string | null; credits: Credits | null; stripe_connected: boolean | null; stripe_account_status: string | null; github_username: string | null; bio: string | null; website: string | null; contact: string | null; cloud_subscribed: boolean | null }
/** tauri-specta globals **/
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lock
index a3a833d28..9a22ccc37 100755
--- a/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -5629,7 +5629,7 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "screenpipe-app"
-version = "2.0.99"
+version = "2.0.100"
dependencies = [
"anyhow",
"async-stream",
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index bc464e76b..8ef0e1c1a 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "2.0.101"
+version = "2.0.102"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/screenpipe-app-tauri/src-tauri/src/commands.rs b/screenpipe-app-tauri/src-tauri/src/commands.rs
index 0d323a2df..97924ba6e 100644
--- a/screenpipe-app-tauri/src-tauri/src/commands.rs
+++ b/screenpipe-app-tauri/src-tauri/src/commands.rs
@@ -311,6 +311,16 @@ pub async fn close_window(
Ok(())
}
+// Permission recovery command
+#[tauri::command]
+#[specta::specta]
+pub async fn show_permission_recovery_window(app_handle: tauri::AppHandle) -> Result<(), String> {
+ ShowRewindWindow::PermissionRecovery
+ .show(&app_handle)
+ .map_err(|e| e.to_string())?;
+ Ok(())
+}
+
// Onboarding commands
#[tauri::command]
#[specta::specta]
diff --git a/screenpipe-app-tauri/src-tauri/src/main.rs b/screenpipe-app-tauri/src-tauri/src/main.rs
index d7faac0b2..42f57301b 100755
--- a/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -805,6 +805,8 @@ async fn main() {
permissions::do_permissions_check,
permissions::check_microphone_permission,
permissions::check_accessibility_permission_cmd,
+ permissions::reset_and_request_permission,
+ permissions::get_missing_permissions,
set_tray_unhealth_icon,
set_tray_health_icon,
commands::update_show_screenpipe_shortcut,
@@ -813,6 +815,8 @@ async fn main() {
commands::show_window,
commands::close_window,
commands::set_window_size,
+ // Permission recovery commands
+ commands::show_permission_recovery_window,
// Onboarding commands
commands::get_onboarding_status,
commands::complete_onboarding,
@@ -1087,6 +1091,12 @@ async fn main() {
}
});
+ // Start permission monitor (polls permissions and emits events when lost)
+ let app_handle_clone = app_handle.clone();
+ tauri::async_runtime::spawn(async move {
+ permissions::start_permission_monitor(app_handle_clone).await;
+ });
+
#[cfg(target_os = "macos")]
app.set_activation_policy(tauri::ActivationPolicy::Regular);
diff --git a/screenpipe-app-tauri/src-tauri/src/permissions.rs b/screenpipe-app-tauri/src-tauri/src/permissions.rs
index 64f790f62..4dcf7f1ce 100644
--- a/screenpipe-app-tauri/src-tauri/src/permissions.rs
+++ b/screenpipe-app-tauri/src-tauri/src/permissions.rs
@@ -1,7 +1,8 @@
use serde::{Deserialize, Serialize};
use specta::Type;
+use tracing::{info, warn, error};
-#[derive(Serialize, Deserialize, Type)]
+#[derive(Serialize, Deserialize, Type, Clone)]
#[serde(rename_all = "camelCase")]
pub enum OSPermission {
ScreenRecording,
@@ -205,6 +206,83 @@ pub fn check_accessibility_permission_cmd() -> OSPermissionStatus {
}
}
+/// Reset a permission using tccutil and re-request it
+/// This removes the app from the TCC database and triggers a fresh permission request
+#[tauri::command(async)]
+#[specta::specta]
+pub async fn reset_and_request_permission(permission: OSPermission) -> Result<(), String> {
+ #[cfg(target_os = "macos")]
+ {
+ use std::process::Command;
+ use tokio::time::{sleep, Duration};
+
+ let service = match &permission {
+ OSPermission::ScreenRecording => "ScreenCapture",
+ OSPermission::Microphone => "Microphone",
+ OSPermission::Accessibility => "Accessibility",
+ };
+
+ info!("resetting permission for service: {}", service);
+
+ // Reset permission using tccutil
+ // Note: tccutil reset removes the app from the permission list entirely
+ let output = Command::new("tccutil")
+ .args(["reset", service])
+ .output()
+ .map_err(|e| format!("failed to run tccutil: {}", e))?;
+
+ if !output.status.success() {
+ let stderr = String::from_utf8_lossy(&output.stderr);
+ warn!("tccutil reset returned non-zero: {}", stderr);
+ // Don't fail - tccutil might return non-zero even when it works
+ }
+
+ info!("tccutil reset completed, waiting before re-request");
+
+ // Wait for TCC database to update
+ sleep(Duration::from_millis(500)).await;
+
+ // Re-request the permission
+ request_permission(permission).await;
+
+ Ok(())
+ }
+
+ #[cfg(not(target_os = "macos"))]
+ {
+ let _ = permission;
+ Ok(())
+ }
+}
+
+/// Check all permissions and return which ones are missing
+#[tauri::command(async)]
+#[specta::specta]
+pub fn get_missing_permissions() -> Vec<OSPermission> {
+ #[cfg(target_os = "macos")]
+ {
+ let mut missing = Vec::new();
+ let check = do_permissions_check(false);
+
+ if !check.screen_recording.permitted() {
+ missing.push(OSPermission::ScreenRecording);
+ }
+ if !check.microphone.permitted() {
+ missing.push(OSPermission::Microphone);
+ }
+ if !check.accessibility.permitted() {
+ missing.push(OSPermission::Accessibility);
+ }
+
+ missing
+ }
+
+ #[cfg(not(target_os = "macos"))]
+ {
+ Vec::new()
+ }
+}
+
#[tauri::command(async)]
#[specta::specta]
pub fn do_permissions_check(initial_check: bool) -> OSPermissionsCheck {
@@ -250,3 +328,55 @@ pub fn do_permissions_check(initial_check: bool) -> OSPermissionsCheck {
}
}
}
+
+/// Start background permission monitor that checks permissions periodically
+/// and emits an event when any critical permission is lost
+#[cfg(target_os = "macos")]
+pub async fn start_permission_monitor(app: tauri::AppHandle) {
+ use tokio::time::{interval, Duration};
+ use tauri::Emitter;
+
+ // Wait a bit before starting to monitor (let the app initialize)
+ tokio::time::sleep(Duration::from_secs(10)).await;
+
+ let mut check_interval = interval(Duration::from_secs(30));
+ let mut last_screen_ok = true;
+ let mut last_mic_ok = true;
+
+ info!("permission monitor started");
+
+ loop {
+ check_interval.tick().await;
+
+ let perms = do_permissions_check(false);
+ let screen_ok = perms.screen_recording.permitted();
+ let mic_ok = perms.microphone.permitted();
+
+ // Check if any critical permission was lost (was OK, now not OK)
+ let screen_lost = last_screen_ok && !screen_ok;
+ let mic_lost = last_mic_ok && !mic_ok;
+
+ if screen_lost || mic_lost {
+ warn!(
+ "permission lost - screen: {} -> {}, mic: {} -> {}",
+ last_screen_ok, screen_ok, last_mic_ok, mic_ok
+ );
+
+ // Emit event to frontend
+ if let Err(e) = app.emit("permission-lost", serde_json::json!({
+ "screen_recording": !screen_ok,
+ "microphone": !mic_ok,
+ })) {
+ error!("failed to emit permission-lost event: {}", e);
+ }
+ }
+
+ last_screen_ok = screen_ok;
+ last_mic_ok = mic_ok;
+ }
+}
+
+#[cfg(not(target_os = "macos"))]
+pub async fn start_permission_monitor(_app: tauri::AppHandle) {
+ // No-op on non-macOS platforms
+}
diff --git a/screenpipe-app-tauri/src-tauri/src/window_api.rs b/screenpipe-app-tauri/src-tauri/src/window_api.rs
index 38a14e8f9..980f389fe 100644
--- a/screenpipe-app-tauri/src-tauri/src/window_api.rs
+++ b/screenpipe-app-tauri/src-tauri/src/window_api.rs
@@ -143,6 +143,7 @@ pub enum RewindWindowId {
Search,
Onboarding,
Chat,
+ PermissionRecovery,
}
impl FromStr for RewindWindowId {
@@ -155,6 +156,7 @@ impl FromStr for RewindWindowId {
"search" => Ok(RewindWindowId::Search),
"onboarding" => Ok(RewindWindowId::Onboarding),
"chat" => Ok(RewindWindowId::Chat),
+ "permission-recovery" => Ok(RewindWindowId::PermissionRecovery),
_ => Ok(RewindWindowId::Main),
}
}
@@ -168,6 +170,7 @@ impl std::fmt::Display for RewindWindowId {
RewindWindowId::Search => write!(f, "search"),
RewindWindowId::Onboarding => write!(f, "onboarding"),
RewindWindowId::Chat => write!(f, "chat"),
+ RewindWindowId::PermissionRecovery => write!(f, "permission-recovery"),
}
}
}
@@ -180,6 +183,7 @@ impl RewindWindowId {
RewindWindowId::Search => "search",
RewindWindowId::Onboarding => "onboarding",
RewindWindowId::Chat => "chat",
+ RewindWindowId::PermissionRecovery => "permission-recovery",
}
}
@@ -190,6 +194,7 @@ impl RewindWindowId {
RewindWindowId::Search => "search",
RewindWindowId::Onboarding => "onboarding",
RewindWindowId::Chat => "ai chat",
+ RewindWindowId::PermissionRecovery => "fix permissions",
}
}
@@ -200,6 +205,7 @@ impl RewindWindowId {
RewindWindowId::Search => (1200.0, 850.0),
RewindWindowId::Onboarding => (900.0, 800.0),
RewindWindowId::Chat => (500.0, 600.0),
+ RewindWindowId::PermissionRecovery => (500.0, 400.0),
})
}
@@ -216,6 +222,7 @@ pub enum ShowRewindWindow {
Search { query: Option<String> },
Onboarding,
Chat,
+ PermissionRecovery,
}
impl ShowRewindWindow {
@@ -262,6 +269,7 @@ impl ShowRewindWindow {
ShowRewindWindow::Search { query: _ } => RewindWindowId::Search,
ShowRewindWindow::Onboarding => RewindWindowId::Onboarding,
ShowRewindWindow::Chat => RewindWindowId::Chat,
+ ShowRewindWindow::PermissionRecovery => RewindWindowId::PermissionRecovery,
}
}
@@ -272,6 +280,7 @@ impl ShowRewindWindow {
ShowRewindWindow::Search { query } => Some(query.clone().unwrap_or_default().to_string()),
ShowRewindWindow::Onboarding => None,
ShowRewindWindow::Chat => None,
+ ShowRewindWindow::PermissionRecovery => None,
}
}
@@ -660,6 +669,19 @@ impl ShowRewindWindow {
let window = builder.build()?;
window
}
+ ShowRewindWindow::PermissionRecovery => {
+ let builder = self.window_builder(app, "/permission-recovery")
+ .inner_size(500.0, 450.0)
+ .min_inner_size(450.0, 400.0)
+ .resizable(false)
+ .focused(true)
+ .always_on_top(true)
+ .center();
+ #[cfg(target_os = "macos")]
+ let builder = builder.hidden_title(true);
+ let window = builder.build()?;
+ window
+ }
};