YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
feat: add Arc browser automation permission to onboarding, recovery, and tray
Louis Beaumont5a0e0d297f4a
diff --git a/apps/screenpipe-app-tauri/app/permission-recovery/page.tsx b/apps/screenpipe-app-tauri/app/permission-recovery/page.tsxindex e90702c24..10300f582 100644--- a/apps/screenpipe-app-tauri/app/permission-recovery/page.tsx+++ b/apps/screenpipe-app-tauri/app/permission-recovery/page.tsx@@ -1,7 +1,7 @@"use client";import React, { useState, useEffect, useCallback, useRef } from "react";-import { Monitor, Mic, Keyboard, Check, AlertTriangle, RefreshCw, ExternalLink, X } from "lucide-react";+import { Monitor, Mic, Keyboard, Globe, Check, AlertTriangle, RefreshCw, ExternalLink, X } from "lucide-react";import { Button } from "@/components/ui/button";import { commands, type OSPermission } from "@/lib/utils/tauri";import { motion, AnimatePresence } from "framer-motion";@@ -55,6 +55,8 @@ function PermissionRow({ icon, label, description, status, onFix, isAnyFixing }:export default function PermissionRecoveryPage() {const [permissions, setPermissions] = useState<Record<string, string> | null>(null);+ const [arcInstalled, setArcInstalled] = useState(false);+ const [arcAutomationOk, setArcAutomationOk] = useState(false);const { isMac: isMacOS } = usePlatform();@@ -63,6 +65,14 @@ export default function PermissionRecoveryPage() {try {const perms = await commands.doPermissionsCheck(false);setPermissions(perms);++ const installed = await commands.checkArcInstalled().catch(() => false);+ setArcInstalled(installed);+ if (installed) {+ const granted = await commands.checkArcAutomationPermission().catch(() => false);+ setArcAutomationOk(granted);+ }+return perms;} catch (error) {console.error("Failed to check permissions:", error);@@ -233,6 +243,21 @@ export default function PermissionRecoveryPage() {isAnyFixing={false}/>)}++ {isMacOS && arcInstalled && (+ <PermissionRow+ icon={<Globe className="w-5 h-5" strokeWidth={1.5} />}+ label="browser url capture (arc)"+ description="capture which page you're viewing"+ status={arcAutomationOk ? "granted" : permissions === null ? "checking" : "denied"}+ onFix={async () => {+ posthog.capture("permission_recovery_arc_automation");+ const granted = await commands.requestArcAutomationPermission();+ if (granted) setArcAutomationOk(true);+ }}+ isAnyFixing={false}+ />+ )}</div><div className="text-center space-y-3">diff --git a/apps/screenpipe-app-tauri/lib/utils/tauri.ts b/apps/screenpipe-app-tauri/lib/utils/tauri.tsindex 48994859c..032d239a0 100644--- a/apps/screenpipe-app-tauri/lib/utils/tauri.ts+++ b/apps/screenpipe-app-tauri/lib/utils/tauri.ts@@ -46,6 +46,13 @@ async checkAccessibilityPermissionCmd() : Promise<OSPermissionStatus> {async checkArcInstalled() : Promise<boolean> {return await TAURI_INVOKE("check_arc_installed");},+/**+ * Check if Automation permission for Arc is already granted (without triggering a prompt).+ * Queries the user TCC database for an AppleEvents entry from our bundle to Arc.+ */+async checkArcAutomationPermission() : Promise<boolean> {+ return await TAURI_INVOKE("check_arc_automation_permission");+},/*** Request macOS Automation permission for Arc browser by running a harmless AppleScript.* This triggers the "screenpipe wants to control Arc" system prompt if not already granted.diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rsindex 85be54931..2bfb0815d 100755--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs@@ -1130,6 +1130,7 @@ async fn main() {permissions::check_microphone_permission,permissions::check_accessibility_permission_cmd,permissions::check_arc_installed,+ permissions::check_arc_automation_permission,permissions::request_arc_automation_permission,// Commands from main.rsget_env,@@ -1344,6 +1345,7 @@ async fn main() {permissions::reset_and_request_permission,permissions::get_missing_permissions,permissions::check_arc_installed,+ permissions::check_arc_automation_permission,permissions::request_arc_automation_permission,set_tray_unhealth_icon,set_tray_health_icon,diff --git a/apps/screenpipe-app-tauri/src-tauri/src/permissions.rs b/apps/screenpipe-app-tauri/src-tauri/src/permissions.rsindex d6cdd6f68..32f9bdfbb 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/permissions.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/permissions.rs@@ -373,6 +373,56 @@ pub fn check_arc_installed() -> bool {}}+/// Check if Automation permission for Arc is already granted (without triggering a prompt).+/// Queries the user TCC database for an AppleEvents entry from our bundle to Arc.+#[tauri::command(async)]+#[specta::specta]+pub fn check_arc_automation_permission(app: tauri::AppHandle) -> bool {+ #[cfg(target_os = "macos")]+ {+ use std::process::Command;++ let bundle_id = app.config().identifier.as_str().to_string();+ let arc_bundle = "company.thebrowser.Browser";++ let home = match std::env::var("HOME") {+ Ok(h) => h,+ Err(_) => return false,+ };+ let tcc_db = format!(+ "{}/Library/Application Support/com.apple.TCC/TCC.db",+ home+ );++ match Command::new("sqlite3")+ .args([+ &tcc_db,+ &format!(+ "SELECT auth_value FROM access WHERE service='kTCCServiceAppleEvents' AND client='{}' AND indirect_object_identifier='{}' LIMIT 1;",+ bundle_id, arc_bundle+ ),+ ])+ .output()+ {+ Ok(output) => {+ let stdout = String::from_utf8_lossy(&output.stdout).trim().to_string();+ // auth_value 2 = granted+ stdout == "2"+ }+ Err(e) => {+ warn!("failed to query TCC.db for arc automation: {}", e);+ false+ }+ }+ }++ #[cfg(not(target_os = "macos"))]+ {+ let _ = app;+ false+ }+}+/// Request macOS Automation permission for Arc browser by running a harmless AppleScript./// This triggers the "screenpipe wants to control Arc" system prompt if not already granted./// Returns true if the command succeeded (permission granted), false otherwise.diff --git a/apps/screenpipe-app-tauri/src-tauri/src/tray.rs b/apps/screenpipe-app-tauri/src-tauri/src/tray.rsindex f2b67561e..fa8479375 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/tray.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/tray.rs@@ -379,6 +379,7 @@ fn create_dynamic_menu(// Help and quitmenu_builder = menu_builder.item(&PredefinedMenuItem::separator(app)?)+ .item(&MenuItemBuilder::with_id("check_permissions", "Check permissions").build(app)?).item(&MenuItemBuilder::with_id("feedback", "Send feedback").build(app)?).item(&MenuItemBuilder::with_id("book_call", "Book a call with founder").build(app)?).item(&MenuItemBuilder::with_id("onboarding", "Onboarding").build(app)?)@@ -443,6 +444,12 @@ fn handle_menu_event(app_handle: &AppHandle, event: tauri::menu::MenuEvent) {let _ = ShowRewindWindow::PermissionRecovery.show(&app);});}+ "check_permissions" => {+ let app = app_handle.clone();+ let _ = app_handle.run_on_main_thread(move || {+ let _ = ShowRewindWindow::PermissionRecovery.show(&app);+ });+ }"releases" => {let app = app_handle.clone();let _ = app_handle.run_on_main_thread(move || {