fix(desktop): request Apple Events permission upfront to prevent repeated macOS prompts

Merged
KI
8mo ago
+72-0

Summary

  • macOS repeatedly shows "Superset would like to access data from other apps" when terminal commands interact with other apps (e.g. osascript, open)
  • The app lacked the com.apple.security.automation.apple-events entitlement and NSAppleEventsUsageDescription, so macOS couldn't grant persistent permission
  • Now requests the permission once at app startup so users aren't interrupted mid-session

Changes

  • src/resources/build/entitlements.mac.plist — New main app entitlements with Apple Events permission
  • src/resources/build/entitlements.mac.inherit.plist — New child process entitlements (inherited by node-pty terminal processes)
  • electron-builder.ts — Reference entitlements files + add NSAppleEventsUsageDescription to extendInfo
  • electron-builder.canary.ts — Spread baseConfig.mac?.extendInfo so canary builds inherit permission descriptions
  • src/main/lib/apple-events-permission.ts — Proactively trigger the Automation permission prompt at startup (same pattern as requestLocalNetworkAccess)
  • src/main/index.ts — Call requestAppleEventsAccess() at app ready

Test Plan

  • Build the desktop app and launch it on macOS
  • Verify the Apple Events permission dialog appears once at startup
  • After granting, run terminal commands that interact with other apps (e.g. osascript -e 'tell application "Finder" to activate')
  • Verify no further "access data from other apps" dialogs appear
  • Verify canary build also has the permission descriptions in Info.plist

Summary by CodeRabbit

  • New Features
    • Added a macOS Apple Events permission prompt at app startup so users can authorize automation/Apple Events access.
    • Updated macOS entitlements to enable required runtime capabilities (JIT, unsigned memory, library-validation adjustments, Apple Events automation).
    • Improved Canary build behavior to merge and inherit base macOS configuration settings for consistent mac builds.