@elizaos/app-core 2.0.0-beta.3 → 2.0.11-beta.6
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.
- package/agent-bridge.d.ts +27 -0
- package/agent-bridge.d.ts.map +1 -0
- package/agent-bridge.js +26 -0
- package/api/__tests__/sandbox-test-helpers.js +1 -1
- package/api/auth/audit.js +1 -1
- package/api/auth/auth-context.js +1 -1
- package/api/auth/bootstrap-token.js +2 -2
- package/api/auth/index.d.ts +9 -10
- package/api/auth/index.d.ts.map +1 -1
- package/api/auth/index.js +9 -10
- package/api/auth/passwords.js +2 -2
- package/api/auth/sensitive-rate-limit.d.ts +1 -4
- package/api/auth/sensitive-rate-limit.d.ts.map +1 -1
- package/api/auth/sensitive-rate-limit.js +6 -6
- package/api/auth/sessions.js +2 -2
- package/api/auth-bootstrap-routes.d.ts +6 -13
- package/api/auth-bootstrap-routes.d.ts.map +1 -1
- package/api/auth-bootstrap-routes.js +14 -27
- package/api/auth-pairing-routes.d.ts +17 -0
- package/api/auth-pairing-routes.d.ts.map +1 -0
- package/api/auth-pairing-routes.js +300 -0
- package/api/auth-session-routes.d.ts.map +1 -1
- package/api/auth-session-routes.js +36 -15
- package/api/auth.d.ts +12 -19
- package/api/auth.d.ts.map +1 -1
- package/api/auth.js +32 -27
- package/api/automations-compat-routes.d.ts.map +1 -1
- package/api/automations-compat-routes.js +5 -5
- package/api/background-tasks-routes.d.ts +4 -0
- package/api/background-tasks-routes.d.ts.map +1 -0
- package/api/background-tasks-routes.js +63 -0
- package/api/catalog-routes.js +3 -3
- package/api/cloud-pair-route.d.ts +26 -0
- package/api/cloud-pair-route.d.ts.map +1 -0
- package/api/cloud-pair-route.js +222 -0
- package/api/cloud-voice-routes.d.ts +52 -0
- package/api/cloud-voice-routes.d.ts.map +1 -0
- package/api/cloud-voice-routes.js +50 -0
- package/api/compat-route-shared.d.ts +2 -2
- package/api/compat-route-shared.d.ts.map +1 -1
- package/api/compat-route-shared.js +11 -7
- package/api/credential-resolver.d.ts +2 -2
- package/api/credential-resolver.d.ts.map +1 -1
- package/api/credential-resolver.js +8 -2
- package/api/database-rows-compat-routes.d.ts.map +1 -1
- package/api/database-rows-compat-routes.js +69 -31
- package/api/dev-boot-history.d.ts +26 -0
- package/api/dev-boot-history.d.ts.map +1 -0
- package/api/dev-boot-history.js +69 -0
- package/api/dev-compat-routes.d.ts +5 -0
- package/api/dev-compat-routes.d.ts.map +1 -1
- package/api/dev-compat-routes.js +127 -4
- package/api/dev-console-log.d.ts +2 -2
- package/api/dev-console-log.d.ts.map +1 -1
- package/api/dev-console-log.js +8 -5
- package/api/dev-route-catalog.d.ts +58 -0
- package/api/dev-route-catalog.d.ts.map +1 -0
- package/api/dev-route-catalog.js +447 -0
- package/api/dev-stack.d.ts.map +1 -1
- package/api/dev-stack.js +6 -9
- package/api/first-run-routes.d.ts +4 -0
- package/api/first-run-routes.d.ts.map +1 -0
- package/api/first-run-routes.js +208 -0
- package/api/first-run-tts-route.d.ts +19 -0
- package/api/first-run-tts-route.d.ts.map +1 -0
- package/api/first-run-tts-route.js +59 -0
- package/api/internal-routes.d.ts +23 -0
- package/api/internal-routes.d.ts.map +1 -0
- package/api/internal-routes.js +203 -0
- package/api/ios-local-agent-transport.d.ts +36 -0
- package/api/ios-local-agent-transport.d.ts.map +1 -0
- package/api/ios-local-agent-transport.js +566 -0
- package/api/onboarding-voice-lines.d.ts +23 -0
- package/api/onboarding-voice-lines.d.ts.map +1 -0
- package/api/onboarding-voice-lines.js +8 -0
- package/api/perf-instrument.d.ts +43 -0
- package/api/perf-instrument.d.ts.map +1 -0
- package/api/perf-instrument.js +113 -0
- package/api/response.d.ts.map +1 -1
- package/api/response.js +14 -14
- package/api/runtime-mode-routes.d.ts.map +1 -1
- package/api/runtime-mode-routes.js +2 -2
- package/api/secrets-inventory-routes.js +2 -2
- package/api/secrets-manager-routes.d.ts +1 -1
- package/api/secrets-manager-routes.d.ts.map +1 -1
- package/api/secrets-manager-routes.js +9 -10
- package/api/sensitive-request-routes.js +5 -5
- package/api/server-cors.d.ts.map +1 -1
- package/api/server-cors.js +13 -2
- package/api/server-first-run-helpers.d.ts +26 -0
- package/api/server-first-run-helpers.d.ts.map +1 -0
- package/api/server-first-run-helpers.js +271 -0
- package/api/server-security.js +1 -1
- package/api/server-startup.d.ts.map +1 -1
- package/api/server-startup.js +3 -4
- package/api/server-wallet-trade.js +1 -1
- package/api/server.d.ts +4 -4
- package/api/server.d.ts.map +1 -1
- package/api/server.js +222 -88
- package/api/setup-contract.d.ts +63 -0
- package/api/setup-contract.d.ts.map +1 -0
- package/api/setup-contract.js +39 -0
- package/api/training-benchmarks.d.ts +97 -0
- package/api/training-benchmarks.d.ts.map +1 -0
- package/api/training-benchmarks.js +307 -0
- package/api/workbench-compat-routes.js +2 -2
- package/benchmark/cerebras-autowire.d.ts +28 -0
- package/benchmark/cerebras-autowire.d.ts.map +1 -0
- package/benchmark/cerebras-autowire.js +62 -0
- package/benchmark/lifeops-bench-handler.d.ts +36 -0
- package/benchmark/lifeops-bench-handler.d.ts.map +1 -1
- package/benchmark/lifeops-bench-handler.js +63 -1
- package/benchmark/lifeops-fake-backend.d.ts +39 -0
- package/benchmark/lifeops-fake-backend.d.ts.map +1 -1
- package/benchmark/lifeops-fake-backend.js +993 -21
- package/benchmark/mock-plugin.d.ts.map +1 -1
- package/benchmark/mock-plugin.js +0 -24
- package/benchmark/plugin.d.ts +2 -1
- package/benchmark/plugin.d.ts.map +1 -1
- package/benchmark/plugin.js +989 -68
- package/benchmark/replay-capture.d.ts +2 -2
- package/benchmark/replay-capture.d.ts.map +1 -1
- package/benchmark/replay-capture.js +3 -3
- package/benchmark/server-utils.d.ts +162 -9
- package/benchmark/server-utils.d.ts.map +1 -1
- package/benchmark/server-utils.js +625 -62
- package/benchmark/server.d.ts.map +1 -1
- package/benchmark/server.js +1962 -118
- package/boot-profile.d.ts +3 -0
- package/boot-profile.d.ts.map +1 -0
- package/boot-profile.js +30 -0
- package/browser.d.ts +23 -1
- package/browser.d.ts.map +1 -1
- package/browser.js +20 -1
- package/cli/argv.js +1 -1
- package/cli/banner.js +1 -1
- package/cli/command-format.js +2 -2
- package/cli/doctor/checks.d.ts.map +1 -1
- package/cli/doctor/checks.js +6 -6
- package/cli/plugins-cli.d.ts.map +1 -1
- package/cli/plugins-cli.js +77 -32
- package/cli/profile.d.ts.map +1 -1
- package/cli/profile.js +5 -4
- package/cli/program/build-program.js +4 -4
- package/cli/program/command-registry.d.ts.map +1 -1
- package/cli/program/command-registry.js +13 -11
- package/cli/program/help.js +5 -5
- package/cli/program/preaction.js +5 -5
- package/cli/program/register.auth.d.ts.map +1 -1
- package/cli/program/register.auth.js +6 -12
- package/cli/program/register.capability-router.d.ts +29 -0
- package/cli/program/register.capability-router.d.ts.map +1 -0
- package/cli/program/register.capability-router.js +568 -0
- package/cli/program/register.config.js +1 -1
- package/cli/program/register.configure.d.ts.map +1 -1
- package/cli/program/register.configure.js +1 -1
- package/cli/program/register.dashboard.d.ts.map +1 -1
- package/cli/program/register.dashboard.js +6 -7
- package/cli/program/register.db.d.ts.map +1 -1
- package/cli/program/register.db.js +3 -4
- package/cli/program/register.doctor.js +7 -7
- package/cli/program/register.setup.d.ts.map +1 -1
- package/cli/program/register.setup.js +14 -10
- package/cli/program/register.start.d.ts.map +1 -1
- package/cli/program/register.start.js +5 -3
- package/cli/program/register.subclis.js +3 -3
- package/cli/program/register.update.d.ts +6 -0
- package/cli/program/register.update.d.ts.map +1 -1
- package/cli/program/register.update.js +58 -6
- package/cli/program.js +1 -1
- package/cli/run-main.js +4 -4
- package/config/app-config.d.ts +2 -0
- package/config/app-config.d.ts.map +1 -0
- package/config/app-config.js +1 -0
- package/connectors/capacitor-jsc.d.ts.map +1 -1
- package/connectors/capacitor-jsc.js +16 -10
- package/connectors/capacitor-quickjs.d.ts.map +1 -1
- package/connectors/capacitor-quickjs.js +18 -13
- package/connectors/capacitor-sqlite.d.ts.map +1 -1
- package/connectors/capacitor-sqlite.js +27 -12
- package/dispatch/approval-queue.d.ts +37 -0
- package/dispatch/approval-queue.d.ts.map +1 -0
- package/dispatch/approval-queue.js +25 -0
- package/dispatch/channel-registry.d.ts +30 -0
- package/dispatch/channel-registry.d.ts.map +1 -0
- package/dispatch/channel-registry.js +22 -0
- package/dispatch/connector-registry.d.ts +39 -0
- package/dispatch/connector-registry.d.ts.map +1 -0
- package/dispatch/connector-registry.js +24 -0
- package/dispatch/index.d.ts +14 -0
- package/dispatch/index.d.ts.map +1 -0
- package/dispatch/index.js +13 -0
- package/dispatch/send-policy.d.ts +36 -0
- package/dispatch/send-policy.d.ts.map +1 -0
- package/dispatch/send-policy.js +16 -0
- package/entry.js +28 -11
- package/first-run/first-run-config.d.ts +55 -0
- package/first-run/first-run-config.d.ts.map +1 -0
- package/first-run/first-run-config.js +178 -0
- package/first-run/runtime-target.d.ts +4 -0
- package/first-run/runtime-target.d.ts.map +1 -0
- package/first-run/runtime-target.js +13 -0
- package/index.d.ts +16 -3
- package/index.d.ts.map +1 -1
- package/index.js +57 -33
- package/package.json +159 -50
- package/packaging/debian/apt-repo-config/README.md +18 -0
- package/packaging/debian/apt-repo-config/conf/distributions +11 -0
- package/packaging/flatpak/README.md +26 -16
- package/packaging/flatpak/ai.elizaos.App.metainfo.xml +17 -12
- package/packaging/flatpak/ai.elizaos.App.store.yml +5 -5
- package/packaging/flatpak/ai.elizaos.App.yml +10 -24
- package/packaging/flatpak/elizaos-app-wrapper.store.sh +2 -2
- package/packaging/flatpak/generate-sources.sh +74 -0
- package/packaging/flatpak/node-sources.json +7930 -0
- package/packaging/inno/build-inno.ps1 +34 -9
- package/packaging/msix/AppxManifest.store.xml +1 -1
- package/packaging/msix/README.md +39 -19
- package/packaging/msix/build-msix.ps1 +44 -14
- package/packaging/snap/snapcraft.yaml +22 -21
- package/packaging/test-packaging.sh +2 -2
- package/permissions/types.d.ts +1 -1
- package/permissions/types.js +1 -1
- package/platform/elizaos-agent-browser-stub.d.ts +144 -0
- package/platform/elizaos-agent-browser-stub.d.ts.map +1 -0
- package/platform/elizaos-agent-browser-stub.js +158 -0
- package/platform/elizaos-plugin-elizacloud-browser-stub.d.ts +34 -0
- package/platform/elizaos-plugin-elizacloud-browser-stub.d.ts.map +1 -0
- package/platform/elizaos-plugin-elizacloud-browser-stub.js +51 -0
- package/platform/empty-node-module.d.ts +148 -0
- package/platform/empty-node-module.d.ts.map +1 -1
- package/platform/empty-node-module.js +140 -3
- package/platform/ios-runtime-backends.d.ts +83 -0
- package/platform/ios-runtime-backends.d.ts.map +1 -0
- package/platform/ios-runtime-backends.js +133 -0
- package/platform/ios-runtime-bridge.d.ts +15 -0
- package/platform/ios-runtime-bridge.d.ts.map +1 -0
- package/platform/ios-runtime-bridge.js +527 -0
- package/platform/native-library-policy.d.ts +23 -0
- package/platform/native-library-policy.d.ts.map +1 -0
- package/platform/native-library-policy.js +112 -0
- package/platform/native-plugin-entrypoints.d.ts +19 -0
- package/platform/native-plugin-entrypoints.d.ts.map +1 -0
- package/platform/native-plugin-entrypoints.js +29 -0
- package/platforms/android/README.md +68 -10
- package/platforms/android/app/build.gradle +268 -3
- package/platforms/android/app/capacitor.build.gradle +18 -1
- package/platforms/android/app/proguard-rules.pro +17 -2
- package/platforms/android/app/src/androidTest/java/ai/elizaos/app/ElizaOsInstrumentedTest.java +1 -1
- package/platforms/android/app/src/main/AndroidManifest.xml +334 -17
- package/platforms/android/app/src/main/assets/runners/eliza-tasks.js +177 -0
- package/platforms/android/app/src/main/elizavoice-jni/CMakeLists.txt +100 -0
- package/platforms/android/app/src/main/elizavoice-jni/elizavoice-jni.cpp +1349 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/AgentPlugin.java +111 -171
- package/platforms/android/app/src/main/java/ai/elizaos/app/AndroidVirtualizationBridge.java +284 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/BatteryOptimizationPlugin.java +95 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaAccessibilityService.java +55 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaAgentService.java +1198 -141
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaAndroidSystemBridge.java +83 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaAssistActivity.java +50 -1
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaBootReceiver.java +90 -8
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaBrowserActivity.java +2 -2
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaCalendarActivity.java +1 -1
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaCameraActivity.java +1 -1
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaClockActivity.java +2 -2
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaContactsActivity.java +1 -1
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaDialActivity.java +1 -1
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaInCallService.java +1 -1
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaMmsReceiver.java +1 -1
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaNativeBridge.java +22 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaNotificationListenerService.java +45 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaQuickActionsWidgetProvider.java +68 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaShareActivity.java +132 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaSmsComposeActivity.java +1 -1
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaSmsGatewayService.java +268 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaSmsReceiver.java +12 -1
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaTasksWorker.java +194 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaVoiceCaptureService.java +198 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaVoiceNative.java +205 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaVoicePlugin.java +498 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaVoiceTileService.java +39 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/ElizaWorkScheduler.java +60 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/GatewayConnectionService.java +53 -19
- package/platforms/android/app/src/main/java/ai/elizaos/app/MainActivity.java +160 -33
- package/platforms/android/app/src/main/java/ai/elizaos/app/ResourceProbePlugin.java +169 -0
- package/platforms/android/app/src/main/java/ai/elizaos/app/VoiceCapturePlugin.java +119 -0
- package/platforms/android/app/src/main/res/drawable/eliza_widget_background.xml +10 -0
- package/platforms/android/app/src/main/res/drawable/eliza_widget_button_background.xml +13 -0
- package/platforms/android/app/src/main/res/drawable/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-land-hdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-land-mdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-land-xhdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-land-xxhdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-land-xxxhdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-port-hdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-port-mdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-port-xhdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-port-xxhdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/drawable-port-xxxhdpi/splash.png +0 -0
- package/platforms/android/app/src/main/res/layout/eliza_quick_actions_widget.xml +86 -0
- package/platforms/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +2 -1
- package/platforms/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +2 -1
- package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png +0 -0
- package/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/platforms/android/app/src/main/res/values/android_app_actions.xml +48 -0
- package/platforms/android/app/src/main/res/values/colors.xml +8 -0
- package/platforms/android/app/src/main/res/values/ic_launcher_background.xml +2 -2
- package/platforms/android/app/src/main/res/values/strings.xml +2 -2
- package/platforms/android/app/src/main/res/values/styles.xml +25 -1
- package/platforms/android/app/src/main/res/xml/eliza_accessibility_service.xml +9 -0
- package/platforms/android/app/src/main/res/xml/eliza_quick_actions_widget.xml +13 -0
- package/platforms/android/app/src/main/res/xml/shortcuts.xml +121 -0
- package/platforms/android/build.gradle +2 -2
- package/platforms/android/capacitor-cordova-android-plugins/build.gradle +9 -3
- package/platforms/android/capacitor-cordova-android-plugins/cordova.variables.gradle +6 -2
- package/platforms/android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml +7 -2
- package/platforms/android/capacitor-cordova-android-plugins/src/main/java/.gitkeep +0 -1
- package/platforms/android/capacitor.settings.gradle +66 -16
- package/platforms/android/gradle.properties +1 -0
- package/platforms/android/update-manifest/generate-manifest.mjs +97 -0
- package/platforms/android/update-manifest/schema.json +26 -0
- package/platforms/apple-store-entitlements.reviewed.json +155 -0
- package/platforms/electrobun/.generated/brand-config.json +3 -2
- package/platforms/electrobun/LICENSE +21 -0
- package/platforms/electrobun/README.md +15 -1
- package/platforms/electrobun/assets/appIcon.icns +0 -0
- package/platforms/electrobun/assets/appIcon.ico +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_128x128.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_128x128@2x.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_16x16.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_16x16@2x.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_256x256.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_256x256@2x.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_32x32.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_32x32@2x.png +0 -0
- package/platforms/electrobun/assets/appIcon.iconset/icon_512x512.png +0 -0
- package/platforms/electrobun/assets/brand-config.json +6 -6
- package/platforms/electrobun/biome.json +9 -9
- package/platforms/electrobun/docs/capability-collapse-matrix.json +318 -0
- package/platforms/electrobun/docs/capability-collapse-matrix.md +129 -0
- package/platforms/electrobun/docs/capability-routing.md +86 -0
- package/platforms/electrobun/docs/convergence-audit.json +3505 -0
- package/platforms/electrobun/docs/convergence-audit.md +694 -0
- package/platforms/electrobun/docs/database-boot-policy.md +90 -0
- package/platforms/electrobun/docs/riscv64-port.md +175 -0
- package/platforms/electrobun/docs/startup-first-run-cleanup.md +18 -0
- package/platforms/electrobun/docs/trace-first-annotations.md +52 -0
- package/platforms/electrobun/docs/ui-boundary-audit.json +580 -0
- package/platforms/electrobun/docs/ui-boundary-audit.md +257 -0
- package/platforms/electrobun/electrobun.config.ts +592 -364
- package/platforms/electrobun/entitlements/JUSTIFICATIONS.md +141 -0
- package/platforms/electrobun/entitlements/README.md +34 -6
- package/platforms/electrobun/entitlements/mas-bun.entitlements +15 -0
- package/platforms/electrobun/entitlements/mas.entitlements +6 -4
- package/platforms/electrobun/native/macos/window-effects.mm +1522 -0
- package/platforms/electrobun/package.json +18 -12
- package/platforms/electrobun/remotes/fs/README.md +70 -0
- package/platforms/electrobun/remotes/fs/electrobun.config.ts +38 -0
- package/platforms/electrobun/remotes/fs/package.json +12 -0
- package/platforms/electrobun/remotes/fs/plugin.json +25 -0
- package/platforms/electrobun/remotes/fs/src/bun/errors.ts +57 -0
- package/platforms/electrobun/remotes/fs/src/bun/file-limits.ts +50 -0
- package/platforms/electrobun/remotes/fs/src/bun/fs-service.ts +389 -0
- package/platforms/electrobun/remotes/fs/src/bun/path-guard.ts +270 -0
- package/platforms/electrobun/remotes/fs/src/bun/protocol.ts +149 -0
- package/platforms/electrobun/remotes/fs/src/bun/worker.ts +174 -0
- package/platforms/electrobun/remotes/fs/src/dev/phase5-smoke.ts +171 -0
- package/platforms/electrobun/remotes/fs/src/web/index.html +8 -0
- package/platforms/electrobun/remotes/git/README.md +75 -0
- package/platforms/electrobun/remotes/git/electrobun.config.ts +44 -0
- package/platforms/electrobun/remotes/git/package.json +12 -0
- package/platforms/electrobun/remotes/git/plugin.json +31 -0
- package/platforms/electrobun/remotes/git/src/bun/errors.ts +69 -0
- package/platforms/electrobun/remotes/git/src/bun/git-command.ts +156 -0
- package/platforms/electrobun/remotes/git/src/bun/git-service.ts +446 -0
- package/platforms/electrobun/remotes/git/src/bun/operation-history.ts +124 -0
- package/platforms/electrobun/remotes/git/src/bun/protocol.ts +252 -0
- package/platforms/electrobun/remotes/git/src/bun/worker.ts +316 -0
- package/platforms/electrobun/remotes/git/src/dev/phase7-smoke.ts +141 -0
- package/platforms/electrobun/remotes/git/src/web/index.html +8 -0
- package/platforms/electrobun/remotes/local-model/README.md +138 -0
- package/platforms/electrobun/remotes/local-model/electrobun.config.ts +46 -0
- package/platforms/electrobun/remotes/local-model/package.json +12 -0
- package/platforms/electrobun/remotes/local-model/plugin.json +33 -0
- package/platforms/electrobun/remotes/local-model/src/bun/download-state.ts +115 -0
- package/platforms/electrobun/remotes/local-model/src/bun/eliza1-catalog.ts +425 -0
- package/platforms/electrobun/remotes/local-model/src/bun/errors.ts +74 -0
- package/platforms/electrobun/remotes/local-model/src/bun/hf-eliza1-client.ts +169 -0
- package/platforms/electrobun/remotes/local-model/src/bun/local-inference-api-client.ts +245 -0
- package/platforms/electrobun/remotes/local-model/src/bun/model-service.ts +490 -0
- package/platforms/electrobun/remotes/local-model/src/bun/protocol.ts +301 -0
- package/platforms/electrobun/remotes/local-model/src/bun/worker.ts +248 -0
- package/platforms/electrobun/remotes/local-model/src/dev/phase8-smoke.ts +117 -0
- package/platforms/electrobun/remotes/local-model/src/web/index.html +13 -0
- package/platforms/electrobun/remotes/pty/README.md +65 -0
- package/platforms/electrobun/remotes/pty/electrobun.config.ts +47 -0
- package/platforms/electrobun/remotes/pty/package.json +12 -0
- package/platforms/electrobun/remotes/pty/plugin.json +34 -0
- package/platforms/electrobun/remotes/pty/src/bun/errors.ts +57 -0
- package/platforms/electrobun/remotes/pty/src/bun/output-buffer.ts +127 -0
- package/platforms/electrobun/remotes/pty/src/bun/protocol.ts +192 -0
- package/platforms/electrobun/remotes/pty/src/bun/pty-service.ts +562 -0
- package/platforms/electrobun/remotes/pty/src/bun/worker.ts +218 -0
- package/platforms/electrobun/remotes/pty/src/dev/phase6-smoke.ts +127 -0
- package/platforms/electrobun/remotes/pty/src/web/index.html +8 -0
- package/platforms/electrobun/remotes/runtime/README.md +370 -0
- package/platforms/electrobun/remotes/runtime/electrobun.config.ts +48 -0
- package/platforms/electrobun/remotes/runtime/package.json +14 -0
- package/platforms/electrobun/remotes/runtime/plugin.json +30 -0
- package/platforms/electrobun/remotes/runtime/src/bun/api-client.ts +620 -0
- package/platforms/electrobun/remotes/runtime/src/bun/errors.ts +45 -0
- package/platforms/electrobun/remotes/runtime/src/bun/log-buffer.ts +33 -0
- package/platforms/electrobun/remotes/runtime/src/bun/protocol.ts +366 -0
- package/platforms/electrobun/remotes/runtime/src/bun/route-discovery.ts +419 -0
- package/platforms/electrobun/remotes/runtime/src/bun/runtime-manager.ts +423 -0
- package/platforms/electrobun/remotes/runtime/src/bun/sse-parser.ts +99 -0
- package/platforms/electrobun/remotes/runtime/src/bun/stream-manager.ts +887 -0
- package/platforms/electrobun/remotes/runtime/src/bun/worker.ts +1231 -0
- package/platforms/electrobun/remotes/runtime/src/dev/phase1-smoke.ts +34 -0
- package/platforms/electrobun/remotes/runtime/src/dev/phase2-smoke.ts +86 -0
- package/platforms/electrobun/remotes/runtime/src/dev/phase3-smoke.ts +141 -0
- package/platforms/electrobun/remotes/runtime/src/web/index.css +187 -0
- package/platforms/electrobun/remotes/runtime/src/web/index.html +76 -0
- package/platforms/electrobun/remotes/runtime/src/web/index.ts +192 -0
- package/platforms/electrobun/remotes/surface/README.md +201 -0
- package/platforms/electrobun/remotes/surface/electrobun.config.ts +38 -0
- package/platforms/electrobun/remotes/surface/package.json +12 -0
- package/platforms/electrobun/remotes/surface/plugin.json +28 -0
- package/platforms/electrobun/remotes/surface/src/bun/worker.ts +132 -0
- package/platforms/electrobun/remotes/surface/src/dev/phase4-smoke.ts +566 -0
- package/platforms/electrobun/remotes/surface/src/protocol/event-types.ts +84 -0
- package/platforms/electrobun/remotes/surface/src/protocol/runtime-client.ts +673 -0
- package/platforms/electrobun/remotes/surface/src/web/app.ts +595 -0
- package/platforms/electrobun/remotes/surface/src/web/index.css +460 -0
- package/platforms/electrobun/remotes/surface/src/web/index.html +466 -0
- package/platforms/electrobun/remotes/surface/src/web/index.ts +5 -0
- package/platforms/electrobun/remotes/surface/src/web/render.ts +455 -0
- package/platforms/electrobun/remotes/surface/src/web/state.ts +427 -0
- package/platforms/electrobun/scripts/build-macos-effects.sh +4 -0
- package/platforms/electrobun/scripts/ensure-build-folder.ts +28 -0
- package/platforms/electrobun/scripts/ensure-whisper-gguf.sh +55 -0
- package/platforms/electrobun/scripts/ensure-whisper-model.sh +22 -80
- package/platforms/electrobun/scripts/generate-convergence-audit.ts +1203 -0
- package/platforms/electrobun/scripts/local-adhoc-sign-macos.ts +159 -159
- package/platforms/electrobun/scripts/postwrap-diagnostics.ts +424 -339
- package/platforms/electrobun/scripts/postwrap-sign-runtime-macos.ts +302 -271
- package/platforms/electrobun/scripts/smoke-test-windows.ps1 +17 -16
- package/platforms/electrobun/scripts/smoke-test.sh +5 -7
- package/platforms/electrobun/scripts/sync-web-assets.mjs +13 -13
- package/platforms/electrobun/scripts/verify-rpc-handlers.ts +109 -110
- package/platforms/electrobun/scripts/verify-windows-installer-proof.ps1 +3 -8
- package/platforms/electrobun/src/__stubs__/bun-ffi.ts +31 -31
- package/platforms/electrobun/src/__stubs__/electrobun-bun.ts +1 -1
- package/platforms/electrobun/src/agent-ready-state.ts +8 -8
- package/platforms/electrobun/src/agent-reset-from-main.test.ts +162 -0
- package/platforms/electrobun/src/agent-reset-from-main.ts +62 -62
- package/platforms/electrobun/src/agent-status-rpc.test.ts +95 -0
- package/platforms/electrobun/src/agent-status-rpc.ts +156 -0
- package/platforms/electrobun/src/api-base.test.ts +247 -0
- package/platforms/electrobun/src/api-base.ts +202 -93
- package/platforms/electrobun/src/application-menu-action-registry.ts +9 -9
- package/platforms/electrobun/src/application-menu.ts +348 -348
- package/platforms/electrobun/src/background-notice.ts +36 -36
- package/platforms/electrobun/src/boot-progress.test.ts +188 -0
- package/platforms/electrobun/src/boot-progress.ts +111 -0
- package/platforms/electrobun/src/brand-config.test.ts +39 -0
- package/platforms/electrobun/src/brand-config.ts +141 -129
- package/platforms/electrobun/src/bridge/browser-tabs-renderer-registry.ts +28 -28
- package/platforms/electrobun/src/bridge/electrobun-boot-config.ts +42 -0
- package/platforms/electrobun/src/bridge/electrobun-crypto-ready.ts +120 -0
- package/platforms/electrobun/src/bridge/electrobun-direct-rpc.ts +342 -357
- package/platforms/electrobun/src/bridge/electrobun-stub.ts +13 -13
- package/platforms/electrobun/src/browser-workspace-bridge-server.ts +285 -243
- package/platforms/electrobun/src/cloud-auth-window.ts +136 -136
- package/platforms/electrobun/src/cloud-disconnect-from-main.ts +90 -90
- package/platforms/electrobun/src/config-and-auth-rpc.test.ts +256 -0
- package/platforms/electrobun/src/config-and-auth-rpc.ts +302 -0
- package/platforms/electrobun/src/conversations-and-character-rpc.test.ts +185 -0
- package/platforms/electrobun/src/conversations-and-character-rpc.ts +131 -0
- package/platforms/electrobun/src/dashboard-rpc.test.ts +200 -0
- package/platforms/electrobun/src/dashboard-rpc.ts +344 -0
- package/platforms/electrobun/src/database/database-lock.ts +141 -0
- package/platforms/electrobun/src/database/database-mode.ts +149 -0
- package/platforms/electrobun/src/database/database-recovery.ts +72 -0
- package/platforms/electrobun/src/database/database-snapshot.ts +190 -0
- package/platforms/electrobun/src/database/database.test.ts +196 -0
- package/platforms/electrobun/src/database/index.ts +5 -0
- package/platforms/electrobun/src/database/pglite-paths.ts +100 -0
- package/platforms/electrobun/src/desktop-deep-link-events.test.ts +30 -0
- package/platforms/electrobun/src/desktop-deep-link-events.ts +17 -0
- package/platforms/electrobun/src/desktop-http-request.test.ts +73 -73
- package/platforms/electrobun/src/desktop-http-request.ts +85 -85
- package/platforms/electrobun/src/desktop-pill-config.test.ts +27 -0
- package/platforms/electrobun/src/desktop-pill-config.ts +40 -0
- package/platforms/electrobun/src/desktop-test-bridge-server.ts +204 -204
- package/platforms/electrobun/src/desktop-tray-config.test.ts +87 -0
- package/platforms/electrobun/src/desktop-tray-config.ts +84 -0
- package/platforms/electrobun/src/devtools-layout.ts +41 -41
- package/platforms/electrobun/src/diagnostic-format.test.ts +71 -0
- package/platforms/electrobun/src/diagnostic-format.ts +75 -36
- package/platforms/electrobun/src/dynamic-view-rpc-schema.test.ts +37 -0
- package/platforms/electrobun/src/dynamic-views/README.md +44 -0
- package/platforms/electrobun/src/dynamic-views/demo/agent-run-trace.html +135 -0
- package/platforms/electrobun/src/dynamic-views/errors.ts +29 -0
- package/platforms/electrobun/src/dynamic-views/host.test.ts +353 -0
- package/platforms/electrobun/src/dynamic-views/host.ts +332 -0
- package/platforms/electrobun/src/dynamic-views/index.ts +57 -0
- package/platforms/electrobun/src/dynamic-views/kiosk-canvas.ts +89 -0
- package/platforms/electrobun/src/dynamic-views/registry.test.ts +139 -0
- package/platforms/electrobun/src/dynamic-views/registry.ts +196 -0
- package/platforms/electrobun/src/dynamic-views/session-manager.test.ts +355 -0
- package/platforms/electrobun/src/dynamic-views/session-manager.ts +348 -0
- package/platforms/electrobun/src/dynamic-views/types.ts +105 -0
- package/platforms/electrobun/src/electrobun-boot-config.test.ts +50 -0
- package/platforms/electrobun/src/electrobun-config.test.ts +62 -0
- package/platforms/electrobun/src/electrobun-crypto-ready.test.ts +65 -0
- package/platforms/electrobun/src/electrobun-window-options.ts +25 -0
- package/platforms/electrobun/src/extension-rpc.test.ts +88 -0
- package/platforms/electrobun/src/extension-rpc.ts +102 -0
- package/platforms/electrobun/src/fatal-shutdown.test.ts +10 -10
- package/platforms/electrobun/src/fatal-shutdown.ts +1 -1
- package/platforms/electrobun/src/first-party-remotes.test.ts +169 -0
- package/platforms/electrobun/src/first-party-remotes.ts +297 -0
- package/platforms/electrobun/src/first-run-rpc.test.ts +192 -0
- package/platforms/electrobun/src/first-run-rpc.ts +146 -0
- package/platforms/electrobun/src/floating-chat-window.ts +181 -181
- package/platforms/electrobun/src/inbox-rpc.test.ts +123 -0
- package/platforms/electrobun/src/inbox-rpc.ts +158 -0
- package/platforms/electrobun/src/index.ts +2555 -2096
- package/platforms/electrobun/src/kiosk-mode.ts +50 -0
- package/platforms/electrobun/src/launch/index.ts +4 -0
- package/platforms/electrobun/src/launch/launch-dynamic-view.ts +37 -0
- package/platforms/electrobun/src/launch/launch-orchestrator.test.ts +224 -0
- package/platforms/electrobun/src/launch/launch-orchestrator.ts +456 -0
- package/platforms/electrobun/src/launch/launch-store.test.ts +97 -0
- package/platforms/electrobun/src/launch/launch-store.ts +134 -0
- package/platforms/electrobun/src/launch/types.ts +103 -0
- package/platforms/electrobun/src/launch/views/launch-diagnostics.html +205 -0
- package/platforms/electrobun/src/lifecycle/agent-ready-publish.test.ts +50 -0
- package/platforms/electrobun/src/lifecycle/agent-ready-publish.ts +27 -0
- package/platforms/electrobun/src/lifecycle/api-base-owner.ts +42 -31
- package/platforms/electrobun/src/lifecycle/desktop-session-prime.ts +44 -44
- package/platforms/electrobun/src/logger.ts +14 -14
- package/platforms/electrobun/src/main-window-runtime.ts +83 -83
- package/platforms/electrobun/src/main-window-session.test.ts +109 -0
- package/platforms/electrobun/src/main-window-session.ts +87 -51
- package/platforms/electrobun/src/menu-reset-from-main.ts +158 -158
- package/platforms/electrobun/src/native/agent-env.test.ts +52 -0
- package/platforms/electrobun/src/native/agent-runtime-layout.test.ts +42 -0
- package/platforms/electrobun/src/native/agent-state-dir.test.ts +91 -0
- package/platforms/electrobun/src/native/agent.ts +2122 -1682
- package/platforms/electrobun/src/native/auth-bridge.test.ts +67 -0
- package/platforms/electrobun/src/native/auth-bridge.ts +464 -360
- package/platforms/electrobun/src/native/browser-workspace.ts +723 -471
- package/platforms/electrobun/src/native/camera.ts +50 -50
- package/platforms/electrobun/src/native/canvas.ts +444 -445
- package/platforms/electrobun/src/native/credentials.ts +673 -616
- package/platforms/electrobun/src/native/desktop-window.test.ts +300 -0
- package/platforms/electrobun/src/native/desktop.ts +2196 -2156
- package/platforms/electrobun/src/native/editor-bridge.ts +201 -201
- package/platforms/electrobun/src/native/file-watcher.ts +154 -154
- package/platforms/electrobun/src/native/gateway.ts +179 -180
- package/platforms/electrobun/src/native/gpu-window.ts +256 -256
- package/platforms/electrobun/src/native/index.ts +76 -74
- package/platforms/electrobun/src/native/location.test.ts +44 -0
- package/platforms/electrobun/src/native/location.ts +90 -80
- package/platforms/electrobun/src/native/loopback-port.ts +60 -60
- package/platforms/electrobun/src/native/mac-window-effects.ts +166 -104
- package/platforms/electrobun/src/native/music-player.ts +38 -38
- package/platforms/electrobun/src/native/permissions-shared.ts +249 -150
- package/platforms/electrobun/src/native/permissions.ts +301 -208
- package/platforms/electrobun/src/native/power-state.ts +129 -129
- package/platforms/electrobun/src/native/remote-plugin-host.test.ts +1394 -0
- package/platforms/electrobun/src/native/remote-plugin-host.ts +1531 -0
- package/platforms/electrobun/src/native/screencapture.ts +667 -573
- package/platforms/electrobun/src/native/steward.ts +207 -204
- package/platforms/electrobun/src/native/swabble.ts +68 -324
- package/platforms/electrobun/src/native/talkmode.ts +253 -422
- package/platforms/electrobun/src/native/webgpu-browser-support.test.ts +18 -0
- package/platforms/electrobun/src/native/webgpu-browser-support.ts +165 -147
- package/platforms/electrobun/src/native/whisper-env.test.ts +71 -0
- package/platforms/electrobun/src/native/whisper-env.ts +68 -0
- package/platforms/electrobun/src/native-onboarding.ts +270 -0
- package/platforms/electrobun/src/onboarding-overlay-window.ts +141 -0
- package/platforms/electrobun/src/persisted-deployment.ts +91 -0
- package/platforms/electrobun/src/pill-window.test.ts +91 -0
- package/platforms/electrobun/src/pill-window.ts +99 -0
- package/platforms/electrobun/src/preload-validation.ts +44 -44
- package/platforms/electrobun/src/preload.js +1 -1
- package/platforms/electrobun/src/print-electrobun-dev-settings-banner.ts +120 -120
- package/platforms/electrobun/src/renderer-api-proxy.test.ts +73 -0
- package/platforms/electrobun/src/renderer-api-proxy.ts +86 -0
- package/platforms/electrobun/src/renderer-static.test.ts +53 -0
- package/platforms/electrobun/src/renderer-static.ts +144 -57
- package/platforms/electrobun/src/rpc-handler-slices.ts +121 -0
- package/platforms/electrobun/src/rpc-handlers.test.ts +267 -0
- package/platforms/electrobun/src/rpc-handlers.ts +1306 -913
- package/platforms/electrobun/src/rpc-parse-utils.ts +57 -0
- package/platforms/electrobun/src/rpc-port-resolver.test.ts +45 -0
- package/platforms/electrobun/src/rpc-port-resolver.ts +31 -0
- package/platforms/electrobun/src/rpc-schema.ts +2556 -1619
- package/platforms/electrobun/src/runtime-layout.ts +105 -105
- package/platforms/electrobun/src/runtime-permissions.ts +95 -95
- package/platforms/electrobun/src/runtime-rpc.test.ts +126 -0
- package/platforms/electrobun/src/runtime-rpc.ts +237 -0
- package/platforms/electrobun/src/screenshot-dev-server.ts +87 -87
- package/platforms/electrobun/src/settings-mutations-rpc.test.ts +193 -0
- package/platforms/electrobun/src/settings-mutations-rpc.ts +220 -0
- package/platforms/electrobun/src/startup-trace.ts +274 -270
- package/platforms/electrobun/src/subscription-rpc.test.ts +89 -0
- package/platforms/electrobun/src/subscription-rpc.ts +192 -0
- package/platforms/electrobun/src/surface-windows.test.ts +355 -0
- package/platforms/electrobun/src/surface-windows.ts +410 -410
- package/platforms/electrobun/src/trace/README.md +73 -0
- package/platforms/electrobun/src/trace/errors.ts +21 -0
- package/platforms/electrobun/src/trace/index.ts +40 -0
- package/platforms/electrobun/src/trace/trace-dynamic-view.ts +40 -0
- package/platforms/electrobun/src/trace/trace-host-requests.ts +473 -0
- package/platforms/electrobun/src/trace/trace-service.test.ts +186 -0
- package/platforms/electrobun/src/trace/trace-service.ts +324 -0
- package/platforms/electrobun/src/trace/trace-store.test.ts +141 -0
- package/platforms/electrobun/src/trace/trace-store.ts +551 -0
- package/platforms/electrobun/src/trace/types.ts +250 -0
- package/platforms/electrobun/src/trace/views/agent-run-trace.html +311 -0
- package/platforms/electrobun/src/types/web-speech.d.ts +28 -28
- package/platforms/electrobun/src/types.ts +5 -5
- package/platforms/electrobun/src/update-availability.test.ts +72 -0
- package/platforms/electrobun/src/update-availability.ts +90 -0
- package/platforms/electrobun/src/update-rpc.test.ts +83 -0
- package/platforms/electrobun/src/update-rpc.ts +123 -0
- package/platforms/electrobun/src/voice/README.md +184 -0
- package/platforms/electrobun/src/voice/errors.ts +42 -0
- package/platforms/electrobun/src/voice/index.ts +78 -0
- package/platforms/electrobun/src/voice/types.ts +316 -0
- package/platforms/electrobun/src/voice/voice-host-requests.ts +259 -0
- package/platforms/electrobun/src/voice/voice-latency-budget.test.ts +66 -0
- package/platforms/electrobun/src/voice/voice-latency-budget.ts +243 -0
- package/platforms/electrobun/src/voice/voice-live-validation.test.ts +352 -0
- package/platforms/electrobun/src/voice/voice-live-validation.ts +838 -0
- package/platforms/electrobun/src/voice/voice-pipeline.ts +250 -0
- package/platforms/electrobun/src/voice/voice-playback-adapter.ts +31 -0
- package/platforms/electrobun/src/voice/voice-runtime-adapter.test.ts +213 -0
- package/platforms/electrobun/src/voice/voice-runtime-adapter.ts +686 -0
- package/platforms/electrobun/src/voice/voice-service.test.ts +561 -0
- package/platforms/electrobun/src/voice/voice-service.ts +1027 -0
- package/platforms/electrobun/src/voice/voice-stream-coordinator.test.ts +115 -0
- package/platforms/electrobun/src/voice/voice-stream-coordinator.ts +270 -0
- package/platforms/electrobun/src/voice/voice-trace.ts +97 -0
- package/platforms/electrobun/src/voice/voice-tts-chunker.test.ts +91 -0
- package/platforms/electrobun/src/voice/voice-tts-chunker.ts +194 -0
- package/platforms/electrobun/src/windows-cef-profile.ts +88 -88
- package/platforms/electrobun/tsconfig.json +73 -13
- package/platforms/electrobun/update-channels.json +22 -0
- package/platforms/electrobun/vitest.electrobun.config.ts +72 -42
- package/platforms/ios/App/App/App.entitlements +4 -0
- package/platforms/ios/App/App/AppDelegate.swift +80 -18
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ios-marketing-1024.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-20x20@1x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-20x20@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-29x29@1x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-29x29@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-40x40@1x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-40x40@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-76x76@1x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-76x76@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-ipad-83_5x83_5@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-20x20@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-20x20@3x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-29x29@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-29x29@3x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-40x40@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-40x40@3x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-60x60@2x.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-iphone-60x60@3x.png +0 -0
- package/platforms/ios/App/App/Base.lproj/LaunchScreen.storyboard +1 -4
- package/platforms/ios/App/App/ComputerUseBridge.swift +589 -0
- package/platforms/ios/App/App/DeviceActivityMonitorExtension/DeviceActivityMonitorExtension.entitlements +12 -0
- package/platforms/ios/App/App/DeviceActivityMonitorExtension/DeviceActivityMonitorExtension.swift +34 -0
- package/platforms/ios/App/App/DeviceActivityMonitorExtension/Info.plist +29 -0
- package/platforms/ios/App/App/DeviceActivityReportExtension/DeviceActivityReportExtension.entitlements +12 -0
- package/platforms/ios/App/App/DeviceActivityReportExtension/DeviceActivityReportExtension.swift +53 -0
- package/platforms/ios/App/App/DeviceActivityReportExtension/Info.plist +27 -0
- package/platforms/ios/App/App/ElizaAppIntents.swift +183 -0
- package/platforms/ios/App/App/ElizaIntentPlugin.swift +342 -5
- package/platforms/ios/App/App/Info.plist +17 -1
- package/platforms/ios/App/App/runners/eliza-tasks.js +177 -0
- package/platforms/ios/App/App.xcodeproj/project.pbxproj +262 -6
- package/platforms/ios/App/BroadcastExtension/SampleHandler.swift +100 -0
- package/platforms/ios/App/Podfile +5 -0
- package/platforms/ios/App/Podfile.lock +83 -59
- package/register-runtime-hooks.js +11 -5
- package/registry/app-registry.d.ts +14 -0
- package/registry/app-registry.d.ts.map +1 -0
- package/registry/app-registry.js +29 -0
- package/registry/entries/apps/app-polymarket.json +31 -0
- package/registry/entries/apps/clawville.json +27 -0
- package/registry/entries/apps/companion.json +28 -0
- package/registry/entries/apps/database-viewer.json +27 -0
- package/registry/entries/apps/defense-of-the-agents.json +27 -0
- package/registry/entries/apps/documents.json +30 -0
- package/registry/entries/apps/feed.json +27 -0
- package/registry/entries/apps/hyperliquid.json +31 -0
- package/registry/entries/apps/log-viewer.json +27 -0
- package/registry/entries/apps/memory-viewer.json +27 -0
- package/registry/entries/apps/model-tester.json +31 -0
- package/registry/entries/apps/plugin-viewer.json +27 -0
- package/registry/entries/apps/relationship-viewer.json +27 -0
- package/registry/entries/apps/runtime-debugger.json +27 -0
- package/registry/entries/apps/shopify.json +31 -0
- package/registry/entries/apps/skills-viewer.json +27 -0
- package/registry/entries/apps/steward.json +31 -0
- package/registry/entries/apps/training.json +54 -0
- package/registry/entries/apps/trajectory-viewer.json +27 -0
- package/registry/entries/apps/vincent.json +31 -0
- package/registry/entries/connectors/bluebubbles.json +99 -0
- package/registry/entries/connectors/bluesky.json +173 -0
- package/registry/entries/connectors/discord.json +119 -0
- package/registry/entries/connectors/farcaster.json +174 -0
- package/registry/entries/connectors/feishu.json +79 -0
- package/registry/entries/connectors/google-chat.json +120 -0
- package/registry/entries/connectors/google.json +82 -0
- package/registry/entries/connectors/imessage.json +96 -0
- package/registry/entries/connectors/instagram.json +64 -0
- package/registry/entries/connectors/line.json +86 -0
- package/registry/entries/connectors/matrix.json +94 -0
- package/registry/entries/connectors/mattermost.json +110 -0
- package/registry/entries/connectors/msteams.json +104 -0
- package/registry/entries/connectors/nextcloud-talk.json +104 -0
- package/registry/entries/connectors/nostr.json +70 -0
- package/registry/entries/connectors/signal.json +81 -0
- package/registry/entries/connectors/slack.json +102 -0
- package/registry/entries/connectors/telegram.json +71 -0
- package/registry/entries/connectors/tlon.json +94 -0
- package/registry/entries/connectors/twitch.json +110 -0
- package/registry/entries/connectors/whatsapp.json +113 -0
- package/registry/entries/connectors/x.json +231 -0
- package/registry/entries/connectors/zalo.json +112 -0
- package/registry/entries/connectors/zalouser.json +122 -0
- package/registry/entries/plugins/agent-orchestrator.json +33 -0
- package/registry/entries/plugins/agent-skills.json +72 -0
- package/registry/entries/plugins/anthropic.json +73 -0
- package/registry/entries/plugins/app-control.json +23 -0
- package/registry/entries/plugins/auto-trader.json +203 -0
- package/registry/entries/plugins/background-runner.json +26 -0
- package/registry/entries/plugins/blooio.json +102 -0
- package/registry/entries/plugins/browser.json +75 -0
- package/registry/entries/plugins/cli.json +40 -0
- package/registry/entries/plugins/clipboard.json +44 -0
- package/registry/entries/plugins/coding-tools.json +71 -0
- package/registry/entries/plugins/commands.json +63 -0
- package/registry/entries/plugins/computeruse.json +74 -0
- package/registry/entries/plugins/copilot-proxy.json +93 -0
- package/registry/entries/plugins/directives.json +63 -0
- package/registry/entries/plugins/edge-tts.json +97 -0
- package/registry/entries/plugins/elevenlabs.json +169 -0
- package/registry/entries/plugins/elizacloud.json +208 -0
- package/registry/entries/plugins/evm.json +134 -0
- package/registry/entries/plugins/experience.json +34 -0
- package/registry/entries/plugins/facewear.json +131 -0
- package/registry/entries/plugins/form.json +26 -0
- package/registry/entries/plugins/github.json +93 -0
- package/registry/entries/plugins/gmail-watch.json +25 -0
- package/registry/entries/plugins/goals.json +77 -0
- package/registry/entries/plugins/google-genai.json +106 -0
- package/registry/entries/plugins/groq.json +93 -0
- package/registry/entries/plugins/hedera.json +48 -0
- package/registry/entries/plugins/inmemorydb.json +25 -0
- package/registry/entries/plugins/linear.json +51 -0
- package/registry/entries/plugins/local-inference.json +142 -0
- package/registry/entries/plugins/local-storage.json +36 -0
- package/registry/entries/plugins/localdb.json +25 -0
- package/registry/entries/plugins/mcp.json +44 -0
- package/registry/entries/plugins/memory.json +124 -0
- package/registry/entries/plugins/minecraft.json +79 -0
- package/registry/entries/plugins/moltbook.json +83 -0
- package/registry/entries/plugins/music.json +155 -0
- package/registry/entries/plugins/mysticism.json +48 -0
- package/registry/entries/plugins/nearai.json +82 -0
- package/registry/entries/plugins/ngrok.json +69 -0
- package/registry/entries/plugins/ollama.json +96 -0
- package/registry/entries/plugins/openai.json +189 -0
- package/registry/entries/plugins/openrouter.json +188 -0
- package/registry/entries/plugins/pdf.json +26 -0
- package/registry/entries/plugins/plugin-manager.json +23 -0
- package/registry/entries/plugins/prose.json +48 -0
- package/registry/entries/plugins/rlm.json +26 -0
- package/registry/entries/plugins/roblox.json +88 -0
- package/registry/entries/plugins/rss.json +64 -0
- package/registry/entries/plugins/s3-storage.json +91 -0
- package/registry/entries/plugins/scheduling.json +35 -0
- package/registry/entries/plugins/shell.json +94 -0
- package/registry/entries/plugins/social-alpha.json +72 -0
- package/registry/entries/plugins/tailscale.json +81 -0
- package/registry/entries/plugins/tee.json +53 -0
- package/registry/entries/plugins/todos.json +26 -0
- package/registry/entries/plugins/trajectory-logger.json +33 -0
- package/registry/entries/plugins/trust.json +39 -0
- package/registry/entries/plugins/tts.json +71 -0
- package/registry/entries/plugins/tunnel.json +45 -0
- package/registry/entries/plugins/twilio.json +168 -0
- package/registry/entries/plugins/vercel-ai-gateway.json +128 -0
- package/registry/entries/plugins/video.json +23 -0
- package/registry/entries/plugins/vision.json +43 -0
- package/registry/entries/plugins/webhooks.json +23 -0
- package/registry/entries/plugins/workflow.json +25 -0
- package/registry/entries/plugins/xai.json +75 -0
- package/registry/index.d.ts +2 -1
- package/registry/index.d.ts.map +1 -1
- package/registry/index.js +46 -12
- package/registry/loader.d.ts +2 -1
- package/registry/loader.d.ts.map +1 -1
- package/registry/loader.js +49 -2
- package/registry/schema.d.ts +244 -34
- package/registry/schema.d.ts.map +1 -1
- package/registry/schema.js +36 -0
- package/runtime/android-avf-microdroid-bridge.d.ts +29 -0
- package/runtime/android-avf-microdroid-bridge.d.ts.map +1 -0
- package/runtime/android-avf-microdroid-bridge.js +149 -0
- package/runtime/api-dev-settings-banner.d.ts.map +1 -1
- package/runtime/api-dev-settings-banner.js +5 -13
- package/runtime/app-core-runtime-hooks.d.ts +21 -0
- package/runtime/app-core-runtime-hooks.d.ts.map +1 -0
- package/runtime/app-core-runtime-hooks.js +10 -0
- package/runtime/autonomy-policy.d.ts +2 -0
- package/runtime/autonomy-policy.d.ts.map +1 -0
- package/runtime/autonomy-policy.js +4 -0
- package/runtime/desktop/AppWindowRenderer.d.ts +17 -0
- package/runtime/desktop/AppWindowRenderer.d.ts.map +1 -0
- package/runtime/desktop/AppWindowRenderer.js +360 -0
- package/runtime/desktop/DesktopSurfaceNavigationRuntime.d.ts +2 -0
- package/runtime/desktop/DesktopSurfaceNavigationRuntime.d.ts.map +1 -0
- package/runtime/desktop/DesktopSurfaceNavigationRuntime.js +41 -0
- package/runtime/desktop/DesktopTrayRuntime.d.ts +2 -0
- package/runtime/desktop/DesktopTrayRuntime.d.ts.map +1 -0
- package/runtime/desktop/DesktopTrayRuntime.js +174 -0
- package/runtime/desktop/DetachedShellRoot.d.ts +10 -0
- package/runtime/desktop/DetachedShellRoot.d.ts.map +1 -0
- package/runtime/desktop/DetachedShellRoot.js +111 -0
- package/runtime/desktop/index.d.ts +6 -0
- package/runtime/desktop/index.d.ts.map +1 -0
- package/runtime/desktop/index.js +5 -0
- package/runtime/desktop/tray-menu.d.ts +20 -0
- package/runtime/desktop/tray-menu.d.ts.map +1 -0
- package/runtime/desktop/tray-menu.js +143 -0
- package/runtime/dev-server.d.ts +1 -1
- package/runtime/dev-server.d.ts.map +1 -1
- package/runtime/dev-server.js +93 -17
- package/runtime/eliza.d.ts +75 -1
- package/runtime/eliza.d.ts.map +1 -1
- package/runtime/eliza.js +596 -122
- package/runtime/ensure-text-to-speech-handler.d.ts.map +1 -1
- package/runtime/ensure-text-to-speech-handler.js +10 -3
- package/runtime/mobile-safe-runtime.d.ts +181 -2
- package/runtime/mobile-safe-runtime.d.ts.map +1 -1
- package/runtime/mobile-safe-runtime.js +1019 -12
- package/runtime/mode/remote-forwarder.d.ts.map +1 -1
- package/runtime/mode/remote-forwarder.js +2 -2
- package/runtime/mode/route-mode-guard.d.ts +1 -2
- package/runtime/mode/route-mode-guard.d.ts.map +1 -1
- package/runtime/mode/route-mode-guard.js +4 -5
- package/runtime/mode/route-mode-matrix.d.ts.map +1 -1
- package/runtime/mode/route-mode-matrix.js +14 -1
- package/runtime/mode/runtime-mode.d.ts +1 -1
- package/runtime/mode/runtime-mode.js +1 -1
- package/runtime/runtime-bootstrap-policy.d.ts.map +1 -1
- package/runtime/runtime-bootstrap-policy.js +14 -2
- package/runtime/telegram-standalone-handler.d.ts.map +1 -1
- package/runtime/telegram-standalone-handler.js +10 -9
- package/runtime/tts-cache-wiring.d.ts +29 -0
- package/runtime/tts-cache-wiring.d.ts.map +1 -0
- package/runtime/tts-cache-wiring.js +114 -0
- package/runtime/voice-warmup.d.ts +81 -0
- package/runtime/voice-warmup.d.ts.map +1 -0
- package/runtime/voice-warmup.js +111 -0
- package/scripts/android-sms-gateway-template.test.mjs +1014 -0
- package/scripts/aosp/README.md +19 -15
- package/scripts/aosp/compile-libllama.mjs +1344 -248
- package/scripts/aosp/compile-shim.mjs +47 -18
- package/scripts/aosp/deploy-pixel.mjs +405 -0
- package/scripts/aosp/lib/load-variant-config.mjs +3 -3
- package/scripts/aosp/llama-cpp-patches/README.md +8 -8
- package/scripts/aosp/llama-cpp-patches/apply-patches.mjs +23 -6
- package/scripts/aosp/llama-cpp-patches/polarquant/README.md +37 -0
- package/scripts/aosp/llama-cpp-patches/qjl/README.md +37 -0
- package/scripts/aosp/seccomp-shim/sigsys-handler-arm64.c +169 -0
- package/scripts/aosp/seccomp-shim/sigsys-handler-riscv64.c +217 -0
- package/scripts/aosp/smoke-cuttlefish.mjs +34 -4
- package/scripts/aosp/stage-default-models.mjs +18 -18
- package/scripts/aosp/variant-config-schema.ts +2 -2
- package/scripts/assert-required-bundled-packages.test.ts +534 -0
- package/scripts/audit-apple-store-sandbox.mjs +146 -0
- package/scripts/audit-live-test-surface.mjs +5 -2
- package/scripts/build-capacitor-app.mjs +21 -0
- package/scripts/build-flatpak.mjs +5 -5
- package/scripts/build-helpers/arm64-simd.mjs +72 -0
- package/scripts/build-helpers/omnivoice-merged.mjs +87 -0
- package/scripts/build-helpers/verify-fused-symbols.mjs +567 -0
- package/scripts/build-image.sh +1 -1
- package/scripts/build-llama-cpp-mtp.mjs +487 -0
- package/scripts/build-native-plugins.mjs +230 -18
- package/scripts/build-patched-electrobun-cli.mjs +68 -10
- package/scripts/build-win.mjs +1 -1
- package/scripts/bun-riscv64/Dockerfile +418 -0
- package/scripts/bun-riscv64/README.md +316 -0
- package/scripts/bun-riscv64/build.sh +469 -0
- package/scripts/bun-riscv64/bun-patches/0001-config-add-riscv64-arch.patch +74 -0
- package/scripts/bun-riscv64/bun-patches/0002-flags-add-riscv64-march-mabi.patch +16 -0
- package/scripts/bun-riscv64/bun-patches/0003-zig-add-riscv64-target-triple-and-cpu.patch +26 -0
- package/scripts/bun-riscv64/bun-patches/0004-webkit-force-local-mode-on-riscv64.patch +33 -0
- package/scripts/bun-riscv64/bun-patches/0005-tinycc-disable-on-riscv64.patch +16 -0
- package/scripts/bun-riscv64/bun-patches/0006-build-add-riscv64-cli-validation.patch +15 -0
- package/scripts/bun-riscv64/bun-patches/0007-deps-per-dep-riscv64-checks.patch +24 -0
- package/scripts/bun-riscv64/bun-patches/0008-source-stabilize-riscv64-musl-build.patch +226 -0
- package/scripts/bun-riscv64/bun-patches/0009-disable-wasm-streaming-hooks-for-c-loop.patch +162 -0
- package/scripts/bun-riscv64/bun-patches/0010-disable-inspector-profiler-for-riscv64-c-loop.patch +80 -0
- package/scripts/bun-riscv64/bun-patches/0011-process-arch-add-riscv64.patch +23 -0
- package/scripts/bun-riscv64/bun-patches/0012-cpu-features-add-riscv64-fallback.patch +13 -0
- package/scripts/bun-riscv64/bun-patches/0013-disable-console-inspector-hooks-for-riscv64-c-loop.patch +43 -0
- package/scripts/bun-riscv64/bun-patches/0014-disable-custom-inspector-dispatchers-on-riscv64.patch +127 -0
- package/scripts/bun-riscv64/bun-patches/0015-disable-jsc-profiler-builtins-on-riscv64.patch +75 -0
- package/scripts/bun-riscv64/bun-patches/0016-node-vm-disable-jit-cached-data-on-riscv64-c-loop.patch +96 -0
- package/scripts/bun-riscv64/bun-patches/0017-disable-performance-domjit-signature-on-riscv64-c-loop.patch +34 -0
- package/scripts/bun-riscv64/bun-patches/0018-fix-serialized-script-identifier-big-endian-path.patch +19 -0
- package/scripts/bun-riscv64/bun-patches/0019-add-wtf-timer-fire-bridge-for-c-loop.patch +24 -0
- package/scripts/bun-riscv64/bun-patches/0020-run-riscv64-smoke-test-under-qemu.patch +13 -0
- package/scripts/bun-riscv64/bun-patches/0021-fix-riscv64-linux-open-flags.patch +25 -0
- package/scripts/bun-riscv64/bun-patches/0022-zlib-riscv64-generic-kernels.patch +25 -0
- package/scripts/bun-riscv64/bun-patches/README.md +127 -0
- package/scripts/bun-riscv64/bun-version.json +202 -0
- package/scripts/bun-riscv64/run-build.sh +162 -0
- package/scripts/bun-riscv64/rust-core/0001-riscv64-rust-core-port.patch +868 -0
- package/scripts/bun-riscv64/rust-core/0002-second-wave-riscv64-source-gaps.patch +130 -0
- package/scripts/bun-riscv64/rust-core/0003-third-wave-riscv64-crash-handler-gaps.patch +78 -0
- package/scripts/bun-riscv64/rust-core/0004-rust-target-cpu-riscv64.patch +39 -0
- package/scripts/bun-riscv64/rust-core/0005-fifth-wave-riscv64-source-gaps.patch +96 -0
- package/scripts/bun-riscv64/rust-core/0006-cpp-wasm-and-inspector-guards-riscv64.patch +91 -0
- package/scripts/bun-riscv64/rust-core/0007-bun-alloc-max-align-t-riscv64.patch +36 -0
- package/scripts/bun-riscv64/rust-core/0008-workspace-lints-warn-not-deny-riscv64.patch +75 -0
- package/scripts/bun-riscv64/rust-core/0009-zigglobalobject-wasm-streaming-guards-riscv64.patch +109 -0
- package/scripts/bun-riscv64/rust-core/0010-tcc-externs-stub-on-riscv64.patch +62 -0
- package/scripts/bun-riscv64/rust-core/0011-clippy-ptr-cast-lints-warn-riscv64.patch +61 -0
- package/scripts/bun-riscv64/rust-core/README.md +80 -0
- package/scripts/bun-riscv64/rust-core/webkit-patches/0003-disable-dfg-ftl-on-riscv64.patch +60 -0
- package/scripts/bun-riscv64/rust-core/webkit-patches/0004-riscv64-do-not-force-wasm-in-c-loop.patch +31 -0
- package/scripts/bun-riscv64/rust-core/webkit-patches/0005-domjit-effect-allow-no-dfg-c-loop.patch +40 -0
- package/scripts/bun-riscv64/rust-core/webkit-patches/0006-disable-usewasm-when-webassembly-compiled-out.patch +33 -0
- package/scripts/bun-riscv64/rust-core/webkit-patches/0007-restore-dropped-includes-and-llint-fwd-decl.patch +31 -0
- package/scripts/bun-riscv64/validate.sh +264 -0
- package/scripts/bun-riscv64/webkit-patches/0001-cherry-pick-llint-riscv64.recipe +155 -0
- package/scripts/bun-riscv64/webkit-patches/0002-cherry-pick-baseline-jit-riscv64.recipe +40 -0
- package/scripts/bun-riscv64/webkit-patches/0003-disable-dfg-ftl-on-riscv64.patch +60 -0
- package/scripts/bun-riscv64/webkit-patches/0004-riscv64-do-not-force-wasm-in-c-loop.patch +31 -0
- package/scripts/bun-riscv64/webkit-patches/0005-domjit-effect-allow-no-dfg-c-loop.patch +40 -0
- package/scripts/bun-riscv64/webkit-patches/0006-disable-usewasm-when-webassembly-compiled-out.patch +33 -0
- package/scripts/bun-riscv64/webkit-patches/0007-restore-dropped-includes-and-llint-fwd-decl.patch +72 -0
- package/scripts/bun-riscv64/webkit-patches/README.md +146 -0
- package/scripts/check-homepage-public-readiness.mjs +353 -0
- package/scripts/check-homepage-release-data.mjs +110 -0
- package/scripts/check-i18n.mjs +2 -1
- package/scripts/check-real-local-chat.ts +147 -0
- package/scripts/check-real-local-provisioning.ts +104 -0
- package/scripts/check-real-local-reset.ts +249 -0
- package/scripts/check-sms-gateway-completion-audit.mjs +428 -0
- package/scripts/check-sms-gateway-readiness.mjs +266 -0
- package/scripts/clean-repo.mjs +5 -5
- package/scripts/codesign-mas.mjs +222 -16
- package/scripts/collect-docker-runtime-deps.mjs +229 -0
- package/scripts/continue-sms-gateway-work.mjs +121 -0
- package/scripts/copy-runtime-node-modules.ts +903 -195
- package/scripts/deploy-cloud-api-production-gateway.mjs +52 -0
- package/scripts/desktop-build.mjs +655 -101
- package/scripts/dev-platform.mjs +346 -102
- package/scripts/dev-startup-smoke.mjs +248 -0
- package/scripts/dev-ui.mjs +418 -176
- package/scripts/disable-local-eliza-workspace.mjs +35 -0
- package/scripts/docker-ci-smoke.sh +298 -96
- package/scripts/docker-entrypoint.sh +62 -1
- package/scripts/docker-entrypoint.test.ts +283 -0
- package/scripts/ensure-avatars.mjs +2 -2
- package/scripts/ensure-electrobun-core.mjs +1 -1
- package/scripts/ensure-generated-core-proto-js.mjs +1 -1
- package/scripts/ensure-type-package-aliases.mjs +62 -5
- package/scripts/ensure-vision-deps.mjs +20 -1
- package/scripts/entry.ts +1 -1
- package/scripts/ffi-stub/Makefile +64 -0
- package/scripts/ffi-stub/README.md +391 -0
- package/scripts/ffi-stub/asr-ffi-smoke.ts +139 -0
- package/scripts/ffi-stub/ffi-stub.c +539 -0
- package/scripts/ffi-stub/ffi.h +538 -0
- package/scripts/ffi-stub/libelizainference_stub.so +0 -0
- package/scripts/ffi-stub/tts-stream-ffi-smoke.ts +349 -0
- package/scripts/generate-first-run-voicelines.mjs +194 -0
- package/scripts/generate-plugin-index.js +4 -3
- package/scripts/generate-static-asset-manifest.mjs +1 -1
- package/scripts/i18n-dynamic-keys.json +5 -5
- package/scripts/init-submodules.mjs +2 -2
- package/scripts/install-android-sms-gateway.md +177 -0
- package/scripts/install-android-sms-gateway.mjs +1088 -0
- package/scripts/ios-xcframework/README.md +74 -72
- package/scripts/ios-xcframework/build-xcframework.mjs +204 -43
- package/scripts/ios-xcframework/run-physical-device-smoke.mjs +1943 -0
- package/scripts/ios-xcframework/runtime-symbol-shim.c +450 -0
- package/scripts/kernel-patches/cpu-polar-kernels.mjs +441 -0
- package/scripts/kernel-patches/cpu-simd-kernels.mjs +253 -0
- package/scripts/kernel-patches/cpu-thread-parallelism.mjs +368 -0
- package/scripts/kernel-patches/cuda-kernels.mjs +117 -0
- package/scripts/kernel-patches/metal-kernels.mjs +1698 -109
- package/scripts/kernel-patches/server-omnivoice-route.mjs +718 -0
- package/scripts/kernel-patches/server-structured-output.mjs +279 -0
- package/scripts/kernel-patches/vulkan-dispatch-log.mjs +166 -0
- package/scripts/kernel-patches/vulkan-dispatch-log.test.mjs +50 -0
- package/scripts/kernel-patches/vulkan-dispatch-patches/01-vulkan-shaders-gen.patch +30 -16
- package/scripts/kernel-patches/vulkan-dispatch-patches/02-ggml-vulkan-pipelines.patch +75 -30
- package/scripts/kernel-patches/vulkan-kernels.mjs +800 -49
- package/scripts/lib/agent-source-watcher.mjs +174 -0
- package/scripts/lib/agent-source-watcher.test.mjs +184 -0
- package/scripts/lib/api-supervisor.mjs +78 -9
- package/scripts/lib/api-supervisor.test.mjs +121 -0
- package/scripts/lib/app-dir.mjs +2 -16
- package/scripts/lib/apple-entitlement-audit.mjs +655 -0
- package/scripts/lib/apple-entitlement-audit.test.mjs +144 -0
- package/scripts/lib/bun-version-guard.mjs +13 -13
- package/scripts/lib/capacitor-plugin-build-needed.mjs +4 -3
- package/scripts/lib/capacitor-plugin-names.mjs +30 -14
- package/scripts/lib/desktop-preflight.mjs +9 -5
- package/scripts/lib/desktop-startup-embedding-warmup-policy.mjs +51 -0
- package/scripts/lib/desktop-startup-embedding-warmup-policy.test.mjs +55 -0
- package/scripts/lib/duet-bridge.d.mts +63 -0
- package/scripts/lib/duet-bridge.mjs +193 -0
- package/scripts/lib/node-path-env.mjs +4 -2
- package/scripts/lib/orchestrator-desktop-dev-banner.mjs +12 -3
- package/scripts/lib/patch-bun-exports.mjs +90 -27
- package/scripts/lib/patch-bun-exports.test.mjs +79 -0
- package/scripts/lib/renderer-build-action.mjs +35 -0
- package/scripts/lib/renderer-build-action.test.mjs +70 -0
- package/scripts/lib/stage-android-agent.mjs +748 -99
- package/scripts/lib/sync-eliza-env-aliases.mjs +3 -25
- package/scripts/lib/ui-smoke-stub-decision.mjs +33 -0
- package/scripts/lib/ui-smoke-stub-decision.test.mjs +46 -0
- package/scripts/lib/vite-renderer-dist-stale.mjs +5 -0
- package/scripts/lib/voice-latency-report.mjs +154 -0
- package/scripts/lifeops-prompt-benchmark.ts +21 -12
- package/scripts/link-docker-local-app-packages.mjs +89 -36
- package/scripts/local-stt-bench.ts +192 -0
- package/scripts/maintain-cloud-api-production-gateway.mjs +54 -0
- package/scripts/mas-smoke.mjs +459 -0
- package/scripts/mas-smoke.test.mjs +220 -0
- package/scripts/mobile-auth-simulator-smoke.mjs +0 -1
- package/scripts/normalize-eliza-capture.ts +97 -0
- package/scripts/omnivoice-fuse/prepare.mjs +2543 -23
- package/scripts/pack-upstreams.mjs +65 -5
- package/scripts/package-electrobun-linux.mjs +303 -0
- package/scripts/patch-deps.mjs +5 -3
- package/scripts/patches/llama-mobile-kokoro-tts.patch +480 -0
- package/scripts/playwright-ui-live-stack.ts +194 -49
- package/scripts/playwright-ui-smoke-api-stub.mjs +3501 -109
- package/scripts/pre-review-local.mjs +2 -2
- package/scripts/prepare-ios-cocoapods.sh +41 -3
- package/scripts/release-check.ts +180 -84
- package/scripts/release-workflow-drift.test.ts +57 -0
- package/scripts/relink-workspace-packages-to-dist.mjs +21 -4
- package/scripts/rt.mjs +16 -1
- package/scripts/run-biome-check.mjs +1 -1
- package/scripts/run-coding-agent-e2e.mjs +3 -3
- package/scripts/run-eliza-app-core-script.mjs +34 -0
- package/scripts/run-local-plugin-live-smoke.mjs +71 -2
- package/scripts/run-mobile-build-android-app-actions.test.mjs +426 -0
- package/scripts/run-mobile-build.mjs +4757 -607
- package/scripts/run-node-runtime.mjs +184 -7
- package/scripts/run-node-runtime.test.mjs +167 -0
- package/scripts/run-node-tsx.mjs +80 -33
- package/scripts/run-node.mjs +41 -1
- package/scripts/run-production-build.mjs +34 -27
- package/scripts/run-release-check.mjs +19 -0
- package/scripts/run-release-contract-suite.mjs +107 -14
- package/scripts/run-ui-smoke-playwright-suite.mjs +0 -2
- package/scripts/runtime-package-manifest.ts +21 -3
- package/scripts/setup-upstreams.mjs +42 -1
- package/scripts/sms-gateway-status.mjs +194 -0
- package/scripts/stage-android-agent.test.mjs +97 -0
- package/scripts/stage-elizavoice-lib.mjs +203 -0
- package/scripts/startup-integration-script-drift.test.ts +82 -4
- package/scripts/streaming-pipeline-bench.ts +543 -0
- package/scripts/sync-homepage-porkbun-dns.mjs +262 -0
- package/scripts/test-sms-gateway-software.mjs +100 -0
- package/scripts/type-audit.mjs +1 -1
- package/scripts/validate-bluebubbles-outbound.mjs +293 -0
- package/scripts/validate-cdn-assets.mjs +15 -7
- package/scripts/validate-regression-matrix.mjs +109 -8
- package/scripts/verify-android-sms-gateway-e2e.mjs +362 -0
- package/scripts/verify-bluebubbles-gateway-e2e.mjs +191 -0
- package/scripts/verify-bluebubbles-inbound-readiness.mjs +88 -0
- package/scripts/verify-cloud-api-production-deploy.mjs +87 -0
- package/scripts/verify-cloud-sms-onboarding-flow.mjs +336 -0
- package/scripts/voice/freeze-voice.mjs +521 -0
- package/scripts/voice-attribution-smoke.ts +538 -0
- package/scripts/voice-create-profile.mjs +379 -0
- package/scripts/voice-duet.mjs +1355 -0
- package/scripts/voice-e2e-hardware.ts +871 -0
- package/scripts/voice-interactive.mjs +1750 -0
- package/scripts/voice-latency-report.mjs +96 -0
- package/scripts/voice-latency-report.test.ts +176 -0
- package/scripts/voice-preset/build-default-voice-preset.mjs +249 -0
- package/scripts/voice-preset/build-onboarding-voice.mjs +281 -0
- package/scripts/watch-sms-gateway-readiness.mjs +303 -0
- package/scripts/write-homepage-release-data.mjs +458 -26
- package/security/agent-vault-id.d.ts +1 -1
- package/security/agent-vault-id.js +1 -1
- package/security/hydrate-wallet-keys-from-platform-store.d.ts.map +1 -1
- package/security/hydrate-wallet-keys-from-platform-store.js +23 -14
- package/security/platform-secure-store-node.d.ts +2 -2
- package/security/platform-secure-store-node.js +3 -3
- package/security/wallet-os-store-actions.d.ts +0 -9
- package/security/wallet-os-store-actions.d.ts.map +1 -1
- package/security/wallet-os-store-actions.js +3 -10
- package/services/account-pool.d.ts +23 -14
- package/services/account-pool.d.ts.map +1 -1
- package/services/account-pool.js +86 -24
- package/services/account-usage.d.ts.map +1 -1
- package/services/account-usage.js +2 -5
- package/services/ambient-audio/consent.d.ts +9 -0
- package/services/ambient-audio/consent.d.ts.map +1 -0
- package/services/ambient-audio/consent.js +28 -0
- package/services/ambient-audio/index.d.ts +7 -0
- package/services/ambient-audio/index.d.ts.map +1 -0
- package/services/ambient-audio/index.js +4 -0
- package/services/ambient-audio/replay-buffer.d.ts +14 -0
- package/services/ambient-audio/replay-buffer.d.ts.map +1 -0
- package/services/ambient-audio/replay-buffer.js +66 -0
- package/services/ambient-audio/response-gate.d.ts +3 -0
- package/services/ambient-audio/response-gate.d.ts.map +1 -0
- package/services/ambient-audio/response-gate.js +33 -0
- package/services/ambient-audio/service.d.ts +22 -0
- package/services/ambient-audio/service.d.ts.map +1 -0
- package/services/ambient-audio/service.js +47 -0
- package/services/ambient-audio/types.d.ts +42 -0
- package/services/ambient-audio/types.d.ts.map +1 -0
- package/services/app-updates/update-policy.d.ts +64 -0
- package/services/app-updates/update-policy.d.ts.map +1 -0
- package/services/app-updates/update-policy.js +228 -0
- package/services/auth-store.d.ts +37 -1
- package/services/auth-store.d.ts.map +1 -1
- package/services/auth-store.js +59 -26
- package/services/cloud-jwks-store.d.ts +3 -3
- package/services/cloud-jwks-store.d.ts.map +1 -1
- package/services/cloud-jwks-store.js +5 -8
- package/services/coding-account-bridge.d.ts +71 -0
- package/services/coding-account-bridge.d.ts.map +1 -0
- package/services/coding-account-bridge.js +267 -0
- package/services/connector-target-catalog.d.ts +10 -3
- package/services/connector-target-catalog.d.ts.map +1 -1
- package/services/connector-target-catalog.js +7 -4
- package/services/credential-tunnel-service.d.ts +66 -0
- package/services/credential-tunnel-service.d.ts.map +1 -0
- package/services/credential-tunnel-service.js +227 -0
- package/services/github-credentials.d.ts +1 -1
- package/services/github-credentials.js +1 -1
- package/services/inference-abort.d.ts +47 -0
- package/services/inference-abort.d.ts.map +1 -0
- package/services/inference-abort.js +76 -0
- package/services/persistence.d.ts +2 -3
- package/services/persistence.d.ts.map +1 -1
- package/services/persistence.js +2 -3
- package/services/phrase-chunked-tts.d.ts +136 -0
- package/services/phrase-chunked-tts.d.ts.map +1 -0
- package/services/phrase-chunked-tts.js +208 -0
- package/services/sandbox-registry.d.ts +78 -0
- package/services/sandbox-registry.d.ts.map +1 -0
- package/services/sandbox-registry.js +323 -0
- package/services/secrets-manager-installer.d.ts +8 -1
- package/services/secrets-manager-installer.d.ts.map +1 -1
- package/services/secrets-manager-installer.js +27 -2
- package/services/sensitive-requests/cloud-link-adapter.d.ts +15 -0
- package/services/sensitive-requests/cloud-link-adapter.d.ts.map +1 -0
- package/services/sensitive-requests/cloud-link-adapter.js +73 -0
- package/services/sensitive-requests/index.d.ts +27 -0
- package/services/sensitive-requests/index.d.ts.map +1 -0
- package/services/sensitive-requests/index.js +51 -0
- package/services/sensitive-requests/instruct-dm-only-adapter.d.ts +14 -0
- package/services/sensitive-requests/instruct-dm-only-adapter.d.ts.map +1 -0
- package/services/sensitive-requests/instruct-dm-only-adapter.js +22 -0
- package/services/sensitive-requests/owner-app-inline-adapter.d.ts +3 -0
- package/services/sensitive-requests/owner-app-inline-adapter.d.ts.map +1 -0
- package/services/sensitive-requests/owner-app-inline-adapter.js +146 -0
- package/services/sensitive-requests/owner-app-oauth-adapter.d.ts +3 -0
- package/services/sensitive-requests/owner-app-oauth-adapter.d.ts.map +1 -0
- package/services/sensitive-requests/owner-app-oauth-adapter.js +156 -0
- package/services/sensitive-requests/public-link-adapter.d.ts +14 -0
- package/services/sensitive-requests/public-link-adapter.d.ts.map +1 -0
- package/services/sensitive-requests/public-link-adapter.js +86 -0
- package/services/sensitive-requests/tunnel-link-adapter.d.ts +17 -0
- package/services/sensitive-requests/tunnel-link-adapter.d.ts.map +1 -0
- package/services/sensitive-requests/tunnel-link-adapter.js +38 -0
- package/services/steward-credentials.d.ts +1 -1
- package/services/steward-credentials.d.ts.map +1 -1
- package/services/steward-credentials.js +10 -6
- package/services/steward-sidecar/health-check.d.ts.map +1 -1
- package/services/steward-sidecar/health-check.js +4 -3
- package/services/steward-sidecar/process-management.d.ts +1 -1
- package/services/steward-sidecar/process-management.d.ts.map +1 -1
- package/services/steward-sidecar/process-management.js +9 -3
- package/services/steward-sidecar/types.d.ts +1 -1
- package/services/steward-sidecar/types.d.ts.map +1 -1
- package/services/steward-sidecar/wallet-setup.d.ts.map +1 -1
- package/services/steward-sidecar/wallet-setup.js +8 -7
- package/services/steward-sidecar.d.ts +2 -2
- package/services/steward-sidecar.d.ts.map +1 -1
- package/services/steward-sidecar.js +27 -19
- package/services/task-host-capabilities.d.ts +60 -0
- package/services/task-host-capabilities.d.ts.map +1 -0
- package/services/task-host-capabilities.js +122 -0
- package/services/tool-call-cache/index.d.ts +2 -2
- package/services/tool-call-cache/index.d.ts.map +1 -1
- package/services/tool-call-cache/index.js +1 -1
- package/services/trigger-event-bridge.js +1 -1
- package/services/tunnel-to-mobile/index.d.ts +2 -0
- package/services/tunnel-to-mobile/index.d.ts.map +1 -0
- package/services/tunnel-to-mobile/index.js +1 -0
- package/services/tunnel-to-mobile/tunnel-to-mobile-client.d.ts +105 -0
- package/services/tunnel-to-mobile/tunnel-to-mobile-client.d.ts.map +1 -0
- package/services/tunnel-to-mobile/tunnel-to-mobile-client.js +190 -0
- package/services/vault-bootstrap.d.ts.map +1 -1
- package/services/vault-bootstrap.js +48 -21
- package/services/vault-mirror.d.ts +1 -1
- package/services/vault-mirror.d.ts.map +1 -1
- package/services/vault-mirror.js +29 -6
- package/services/voice-profiles/diarization-pipeline.d.ts +6 -0
- package/services/voice-profiles/diarization-pipeline.d.ts.map +1 -0
- package/services/voice-profiles/diarization-pipeline.js +20 -0
- package/services/voice-profiles/index.d.ts +12 -0
- package/services/voice-profiles/index.d.ts.map +1 -0
- package/services/voice-profiles/index.js +5 -0
- package/services/voice-profiles/nickname-evaluator.d.ts +14 -0
- package/services/voice-profiles/nickname-evaluator.d.ts.map +1 -0
- package/services/voice-profiles/nickname-evaluator.js +46 -0
- package/services/voice-profiles/owner-confidence.d.ts +10 -0
- package/services/voice-profiles/owner-confidence.d.ts.map +1 -0
- package/services/voice-profiles/owner-confidence.js +38 -0
- package/services/voice-profiles/private-challenge.d.ts +20 -0
- package/services/voice-profiles/private-challenge.d.ts.map +1 -0
- package/services/voice-profiles/private-challenge.js +44 -0
- package/services/voice-profiles/store.d.ts +21 -0
- package/services/voice-profiles/store.d.ts.map +1 -0
- package/services/voice-profiles/store.js +50 -0
- package/services/voice-profiles/types.d.ts +38 -0
- package/services/voice-profiles/types.d.ts.map +1 -0
- package/services/voice-profiles/types.js +1 -0
- package/styles/electrobun-mac-window-drag.css +4 -4
- package/test/helpers/__tests__/live-agent-test.smoke.test.ts +43 -70
- package/test/helpers/browser-mocks.ts +2 -2
- package/test/helpers/conditional-tests.ts +2 -2
- package/test/helpers/i18n.ts +1 -1
- package/test/helpers/live-agent-test.ts +537 -551
- package/test/helpers/live-provider.test.ts +4 -4
- package/test/helpers/live-provider.ts +41 -7
- package/test/helpers/live-runtime-server.ts +4 -4
- package/test/helpers/pglite-runtime.ts +1 -1
- package/test/helpers/real-runtime.ts +54 -15
- package/test/helpers/trajectory-harness.ts +11 -7
- package/test/scripts/start-eliza-live.ts +9 -0
- package/test/scripts/test-parallel.mjs +1 -1
- package/test/scripts/test-root-unit.mjs +6 -7
- package/ui-compat.d.ts +13 -2
- package/ui-compat.d.ts.map +1 -1
- package/ui-compat.js +19 -3
- package/api/auth-pairing-compat-routes.d.ts +0 -17
- package/api/auth-pairing-compat-routes.d.ts.map +0 -1
- package/api/auth-pairing-compat-routes.js +0 -301
- package/api/local-inference-compat-routes.d.ts +0 -16
- package/api/local-inference-compat-routes.d.ts.map +0 -1
- package/api/local-inference-compat-routes.js +0 -617
- package/api/onboarding-compat-routes.d.ts +0 -4
- package/api/onboarding-compat-routes.d.ts.map +0 -1
- package/api/onboarding-compat-routes.js +0 -207
- package/api/plugins-compat-routes.d.ts +0 -103
- package/api/plugins-compat-routes.d.ts.map +0 -1
- package/api/plugins-compat-routes.js +0 -1181
- package/api/server-onboarding-compat.d.ts +0 -31
- package/api/server-onboarding-compat.d.ts.map +0 -1
- package/api/server-onboarding-compat.js +0 -283
- package/benchmark/cua-routes.d.ts +0 -10
- package/benchmark/cua-routes.d.ts.map +0 -1
- package/benchmark/cua-routes.js +0 -179
- package/benchmark/mock-plugin-base.d.ts +0 -9
- package/benchmark/mock-plugin-base.d.ts.map +0 -1
- package/benchmark/mock-plugin-base.js +0 -325
- package/cli/parse-duration.d.ts +0 -5
- package/cli/parse-duration.d.ts.map +0 -1
- package/cli/parse-duration.js +0 -27
- package/patches/llama-cpp-capacitor@0.1.5.patch +0 -2387
- package/platform/agent-browser-stub.d.ts +0 -27
- package/platform/agent-browser-stub.d.ts.map +0 -1
- package/platform/agent-browser-stub.js +0 -16
- package/platforms/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java +0 -26
- package/platforms/android/app/src/main/res/drawable/ic_launcher_background.xml +0 -170
- package/platforms/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +0 -34
- package/platforms/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java +0 -18
- package/platforms/electrobun/assets/appIcon.iconset/icon_512x512@2x.png +0 -0
- package/platforms/electrobun/assets/appIcon.png +0 -0
- package/platforms/electrobun/scripts/build-whisper-universal.sh +0 -137
- package/platforms/electrobun/scripts/build-whisper.sh +0 -95
- package/platforms/electrobun/src/libMacWindowEffects.dylib +0 -0
- package/platforms/electrobun/src/native/whisper.ts +0 -280
- package/platforms/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png +0 -0
- package/platforms/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png +0 -0
- package/registry/generate-apps.d.ts +0 -2
- package/registry/generate-apps.d.ts.map +0 -1
- package/registry/generate-apps.js +0 -338
- package/registry/generate.d.ts +0 -2
- package/registry/generate.d.ts.map +0 -1
- package/registry/generate.js +0 -506
- package/runtime/embedding-manager-support.d.ts +0 -77
- package/runtime/embedding-manager-support.d.ts.map +0 -1
- package/runtime/embedding-manager-support.js +0 -309
- package/runtime/embedding-presets.d.ts +0 -5
- package/runtime/embedding-presets.d.ts.map +0 -1
- package/runtime/embedding-presets.js +0 -47
- package/runtime/embedding-warmup-policy.d.ts +0 -13
- package/runtime/embedding-warmup-policy.d.ts.map +0 -1
- package/runtime/embedding-warmup-policy.js +0 -33
- package/runtime/ensure-local-inference-handler.d.ts +0 -25
- package/runtime/ensure-local-inference-handler.d.ts.map +0 -1
- package/runtime/ensure-local-inference-handler.js +0 -389
- package/runtime/mobile-local-inference-gate.d.ts +0 -21
- package/runtime/mobile-local-inference-gate.d.ts.map +0 -1
- package/runtime/mobile-local-inference-gate.js +0 -24
- package/scripts/aosp/avd-test.mjs +0 -403
- package/scripts/aosp/boot-validate.mjs +0 -536
- package/scripts/aosp/build-aosp.mjs +0 -448
- package/scripts/aosp/build-bootanimation.mjs +0 -178
- package/scripts/aosp/capture-screens.mjs +0 -325
- package/scripts/aosp/e2e-validate.mjs +0 -225
- package/scripts/aosp/lint-init-rc.mjs +0 -258
- package/scripts/aosp/llama-shim/eliza_llama_shim.c +0 -276
- package/scripts/aosp/sim.mjs +0 -277
- package/scripts/aosp/sync-to-aosp.mjs +0 -134
- package/scripts/aosp/validate.mjs +0 -1273
- package/scripts/build-llama-cpp-dflash.mjs +0 -1866
- package/scripts/generate-onboarding-voicelines.mjs +0 -194
- package/scripts/generated/static-asset-manifest.json +0 -4
- package/scripts/normalize-parallax-capture.ts +0 -97
- package/scripts/omnivoice-fuse/Makefile +0 -44
- package/scripts/omnivoice-fuse/README.md +0 -266
- package/scripts/omnivoice-fuse/cmake-graft.mjs +0 -180
- package/scripts/omnivoice-fuse/ffi-stub.c +0 -222
- package/scripts/omnivoice-fuse/ffi.h +0 -158
- package/scripts/omnivoice-fuse/libelizainference_stub.dylib +0 -0
- package/scripts/omnivoice-fuse/verify-symbols.mjs +0 -138
- package/security/cloud-secret-store.d.ts +0 -34
- package/security/cloud-secret-store.d.ts.map +0 -1
- package/security/cloud-secret-store.js +0 -65
- package/security/export-guard.d.ts +0 -34
- package/security/export-guard.d.ts.map +0 -1
- package/security/export-guard.js +0 -127
- package/services/local-inference/__stress__/cache-stress-helpers.d.ts +0 -76
- package/services/local-inference/__stress__/cache-stress-helpers.d.ts.map +0 -1
- package/services/local-inference/__stress__/cache-stress-helpers.js +0 -238
- package/services/local-inference/active-model.d.ts +0 -180
- package/services/local-inference/active-model.d.ts.map +0 -1
- package/services/local-inference/active-model.js +0 -362
- package/services/local-inference/assignments.d.ts +0 -58
- package/services/local-inference/assignments.d.ts.map +0 -1
- package/services/local-inference/assignments.js +0 -179
- package/services/local-inference/backend.d.ts +0 -200
- package/services/local-inference/backend.d.ts.map +0 -1
- package/services/local-inference/backend.js +0 -242
- package/services/local-inference/bundled-models.d.ts +0 -34
- package/services/local-inference/bundled-models.d.ts.map +0 -1
- package/services/local-inference/bundled-models.js +0 -104
- package/services/local-inference/cache-bridge.d.ts +0 -184
- package/services/local-inference/cache-bridge.d.ts.map +0 -1
- package/services/local-inference/cache-bridge.js +0 -333
- package/services/local-inference/catalog.d.ts +0 -57
- package/services/local-inference/catalog.d.ts.map +0 -1
- package/services/local-inference/catalog.js +0 -262
- package/services/local-inference/conversation-registry.d.ts +0 -122
- package/services/local-inference/conversation-registry.d.ts.map +0 -1
- package/services/local-inference/conversation-registry.js +0 -182
- package/services/local-inference/device-bridge.d.ts +0 -139
- package/services/local-inference/device-bridge.d.ts.map +0 -1
- package/services/local-inference/device-bridge.js +0 -774
- package/services/local-inference/dflash-doctor.d.ts +0 -27
- package/services/local-inference/dflash-doctor.d.ts.map +0 -1
- package/services/local-inference/dflash-doctor.js +0 -149
- package/services/local-inference/dflash-server.d.ts +0 -248
- package/services/local-inference/dflash-server.d.ts.map +0 -1
- package/services/local-inference/dflash-server.js +0 -1076
- package/services/local-inference/downloader.d.ts +0 -48
- package/services/local-inference/downloader.d.ts.map +0 -1
- package/services/local-inference/downloader.js +0 -688
- package/services/local-inference/engine.d.ts +0 -282
- package/services/local-inference/engine.d.ts.map +0 -1
- package/services/local-inference/engine.js +0 -743
- package/services/local-inference/external-scanner.d.ts +0 -17
- package/services/local-inference/external-scanner.d.ts.map +0 -1
- package/services/local-inference/external-scanner.js +0 -261
- package/services/local-inference/handler-registry.d.ts +0 -72
- package/services/local-inference/handler-registry.d.ts.map +0 -1
- package/services/local-inference/handler-registry.js +0 -159
- package/services/local-inference/hardware.d.ts +0 -26
- package/services/local-inference/hardware.d.ts.map +0 -1
- package/services/local-inference/hardware.js +0 -139
- package/services/local-inference/hf-search.d.ts +0 -19
- package/services/local-inference/hf-search.d.ts.map +0 -1
- package/services/local-inference/hf-search.js +0 -169
- package/services/local-inference/index.d.ts +0 -10
- package/services/local-inference/index.d.ts.map +0 -1
- package/services/local-inference/index.js +0 -7
- package/services/local-inference/llama-server-metrics.d.ts +0 -108
- package/services/local-inference/llama-server-metrics.d.ts.map +0 -1
- package/services/local-inference/llama-server-metrics.js +0 -175
- package/services/local-inference/manifest/index.d.ts +0 -4
- package/services/local-inference/manifest/index.d.ts.map +0 -1
- package/services/local-inference/manifest/index.js +0 -5
- package/services/local-inference/manifest/schema.d.ts +0 -419
- package/services/local-inference/manifest/schema.d.ts.map +0 -1
- package/services/local-inference/manifest/schema.js +0 -227
- package/services/local-inference/manifest/types.d.ts +0 -23
- package/services/local-inference/manifest/types.d.ts.map +0 -1
- package/services/local-inference/manifest/types.js +0 -5
- package/services/local-inference/manifest/validator.d.ts +0 -43
- package/services/local-inference/manifest/validator.d.ts.map +0 -1
- package/services/local-inference/manifest/validator.js +0 -187
- package/services/local-inference/paths.d.ts +0 -8
- package/services/local-inference/paths.d.ts.map +0 -1
- package/services/local-inference/paths.js +0 -7
- package/services/local-inference/providers.d.ts +0 -61
- package/services/local-inference/providers.d.ts.map +0 -1
- package/services/local-inference/providers.js +0 -334
- package/services/local-inference/ram-budget.d.ts +0 -57
- package/services/local-inference/ram-budget.d.ts.map +0 -1
- package/services/local-inference/ram-budget.js +0 -107
- package/services/local-inference/readiness.d.ts +0 -9
- package/services/local-inference/readiness.d.ts.map +0 -1
- package/services/local-inference/readiness.js +0 -153
- package/services/local-inference/recommendation.d.ts +0 -62
- package/services/local-inference/recommendation.d.ts.map +0 -1
- package/services/local-inference/recommendation.js +0 -309
- package/services/local-inference/registry.d.ts +0 -35
- package/services/local-inference/registry.d.ts.map +0 -1
- package/services/local-inference/registry.js +0 -117
- package/services/local-inference/router-handler.d.ts +0 -51
- package/services/local-inference/router-handler.d.ts.map +0 -1
- package/services/local-inference/router-handler.js +0 -165
- package/services/local-inference/routing-policy.d.ts +0 -55
- package/services/local-inference/routing-policy.d.ts.map +0 -1
- package/services/local-inference/routing-policy.js +0 -195
- package/services/local-inference/routing-preferences.d.ts +0 -8
- package/services/local-inference/routing-preferences.d.ts.map +0 -1
- package/services/local-inference/routing-preferences.js +0 -7
- package/services/local-inference/service.d.ts +0 -88
- package/services/local-inference/service.d.ts.map +0 -1
- package/services/local-inference/service.js +0 -210
- package/services/local-inference/session-pool.d.ts +0 -72
- package/services/local-inference/session-pool.d.ts.map +0 -1
- package/services/local-inference/session-pool.js +0 -125
- package/services/local-inference/types.d.ts +0 -309
- package/services/local-inference/types.d.ts.map +0 -1
- package/services/local-inference/types.js +0 -23
- package/services/local-inference/verify.d.ts +0 -8
- package/services/local-inference/verify.d.ts.map +0 -1
- package/services/local-inference/verify.js +0 -7
- package/services/local-inference/voice/barge-in.d.ts +0 -15
- package/services/local-inference/voice/barge-in.d.ts.map +0 -1
- package/services/local-inference/voice/barge-in.js +0 -20
- package/services/local-inference/voice/engine-bridge.d.ts +0 -256
- package/services/local-inference/voice/engine-bridge.d.ts.map +0 -1
- package/services/local-inference/voice/engine-bridge.js +0 -398
- package/services/local-inference/voice/ffi-bindings.d.ts +0 -114
- package/services/local-inference/voice/ffi-bindings.d.ts.map +0 -1
- package/services/local-inference/voice/ffi-bindings.js +0 -281
- package/services/local-inference/voice/index.d.ts +0 -51
- package/services/local-inference/voice/index.d.ts.map +0 -1
- package/services/local-inference/voice/index.js +0 -50
- package/services/local-inference/voice/lifecycle.d.ts +0 -135
- package/services/local-inference/voice/lifecycle.d.ts.map +0 -1
- package/services/local-inference/voice/lifecycle.js +0 -189
- package/services/local-inference/voice/phoneme-tokenizer.d.ts +0 -58
- package/services/local-inference/voice/phoneme-tokenizer.d.ts.map +0 -1
- package/services/local-inference/voice/phoneme-tokenizer.js +0 -53
- package/services/local-inference/voice/phrase-cache.d.ts +0 -24
- package/services/local-inference/voice/phrase-cache.d.ts.map +0 -1
- package/services/local-inference/voice/phrase-cache.js +0 -32
- package/services/local-inference/voice/phrase-chunker.d.ts +0 -20
- package/services/local-inference/voice/phrase-chunker.d.ts.map +0 -1
- package/services/local-inference/voice/phrase-chunker.js +0 -85
- package/services/local-inference/voice/ring-buffer.d.ts +0 -40
- package/services/local-inference/voice/ring-buffer.d.ts.map +0 -1
- package/services/local-inference/voice/ring-buffer.js +0 -85
- package/services/local-inference/voice/rollback-queue.d.ts +0 -24
- package/services/local-inference/voice/rollback-queue.d.ts.map +0 -1
- package/services/local-inference/voice/rollback-queue.js +0 -49
- package/services/local-inference/voice/scheduler.d.ts +0 -47
- package/services/local-inference/voice/scheduler.d.ts.map +0 -1
- package/services/local-inference/voice/scheduler.js +0 -123
- package/services/local-inference/voice/shared-resources.d.ts +0 -119
- package/services/local-inference/voice/shared-resources.d.ts.map +0 -1
- package/services/local-inference/voice/shared-resources.js +0 -83
- package/services/local-inference/voice/speaker-preset-cache.d.ts +0 -28
- package/services/local-inference/voice/speaker-preset-cache.d.ts.map +0 -1
- package/services/local-inference/voice/speaker-preset-cache.js +0 -44
- package/services/local-inference/voice/types.d.ts +0 -80
- package/services/local-inference/voice/types.d.ts.map +0 -1
- package/services/local-inference/voice/voice-preset-format.d.ts +0 -56
- package/services/local-inference/voice/voice-preset-format.d.ts.map +0 -1
- package/services/local-inference/voice/voice-preset-format.js +0 -184
- package/services/plugin-installer.d.ts +0 -22
- package/services/plugin-installer.d.ts.map +0 -1
- package/services/plugin-installer.js +0 -41
- package/test/scripts/task-agent-live-smoke.ts +0 -1335
- /package/services/{local-inference/voice → ambient-audio}/types.js +0 -0
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
#import <ApplicationServices/ApplicationServices.h>
|
|
3
3
|
#import <AVFoundation/AVFoundation.h>
|
|
4
4
|
#import <Availability.h>
|
|
5
|
+
#import <Contacts/Contacts.h>
|
|
5
6
|
#import <CoreGraphics/CoreGraphics.h>
|
|
7
|
+
#import <CoreLocation/CoreLocation.h>
|
|
8
|
+
#import <EventKit/EventKit.h>
|
|
9
|
+
#import <UserNotifications/UserNotifications.h>
|
|
10
|
+
#include <math.h>
|
|
6
11
|
#include <stdlib.h>
|
|
7
12
|
#include <string.h>
|
|
8
13
|
|
|
@@ -45,6 +50,67 @@ static char *elizaCopyCString(NSString *value) {
|
|
|
45
50
|
return out;
|
|
46
51
|
}
|
|
47
52
|
|
|
53
|
+
static NSString *elizaNSStringFromCString(const char *value) {
|
|
54
|
+
if (value == nullptr) {
|
|
55
|
+
return @"";
|
|
56
|
+
}
|
|
57
|
+
NSString *string = [NSString stringWithUTF8String:value];
|
|
58
|
+
return string == nil ? @"" : string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
static NSDictionary *elizaJsonError(NSString *code, NSString *message) {
|
|
62
|
+
return @{
|
|
63
|
+
@"ok" : @NO,
|
|
64
|
+
@"error" : code == nil ? @"native_error" : code,
|
|
65
|
+
@"message" : message == nil ? @"" : message,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
static NSDictionary *elizaJsonOk(NSDictionary *fields) {
|
|
70
|
+
NSMutableDictionary *out = [NSMutableDictionary dictionaryWithObject:@YES
|
|
71
|
+
forKey:@"ok"];
|
|
72
|
+
if (fields != nil) {
|
|
73
|
+
[out addEntriesFromDictionary:fields];
|
|
74
|
+
}
|
|
75
|
+
return out;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
static char *elizaCopyJson(NSDictionary *object) {
|
|
79
|
+
if (object == nil) {
|
|
80
|
+
return elizaCopyCString(@"{\"ok\":false,\"error\":\"native_error\"}");
|
|
81
|
+
}
|
|
82
|
+
NSError *error = nil;
|
|
83
|
+
NSData *data = [NSJSONSerialization dataWithJSONObject:object
|
|
84
|
+
options:0
|
|
85
|
+
error:&error];
|
|
86
|
+
if (data == nil || error != nil) {
|
|
87
|
+
return elizaCopyCString(@"{\"ok\":false,\"error\":\"native_error\",\"message\":\"Failed to encode native JSON.\"}");
|
|
88
|
+
}
|
|
89
|
+
NSString *json = [[NSString alloc] initWithData:data
|
|
90
|
+
encoding:NSUTF8StringEncoding];
|
|
91
|
+
return elizaCopyCString(json);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
static NSDictionary *elizaParseJsonObject(const char *json) {
|
|
95
|
+
NSString *string = elizaNSStringFromCString(json);
|
|
96
|
+
NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
|
|
97
|
+
if (data == nil) {
|
|
98
|
+
return nil;
|
|
99
|
+
}
|
|
100
|
+
id object = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
|
|
101
|
+
if (![object isKindOfClass:[NSDictionary class]]) {
|
|
102
|
+
return nil;
|
|
103
|
+
}
|
|
104
|
+
return (NSDictionary *)object;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
static NSString *elizaErrorMessage(NSError *error, NSString *fallback) {
|
|
108
|
+
if (error != nil && [[error localizedDescription] length] > 0) {
|
|
109
|
+
return [error localizedDescription];
|
|
110
|
+
}
|
|
111
|
+
return fallback == nil ? @"Native operation failed." : fallback;
|
|
112
|
+
}
|
|
113
|
+
|
|
48
114
|
/** Transparent strip for moving the window. WKWebView does not honor
|
|
49
115
|
* -webkit-app-region reliably on system WebKit; this view is stacked
|
|
50
116
|
* NSWindowAbove the web view so safe empty/title zones hit AppKit first.
|
|
@@ -612,6 +678,1462 @@ extern "C" void requestMicrophonePermission(void) {
|
|
|
612
678
|
}];
|
|
613
679
|
}
|
|
614
680
|
|
|
681
|
+
API_AVAILABLE(macos(10.14))
|
|
682
|
+
static int elizaNotificationAuthorizationStatusToInt(
|
|
683
|
+
UNAuthorizationStatus status) {
|
|
684
|
+
switch (status) {
|
|
685
|
+
case UNAuthorizationStatusAuthorized:
|
|
686
|
+
case UNAuthorizationStatusProvisional:
|
|
687
|
+
return 2;
|
|
688
|
+
case UNAuthorizationStatusDenied:
|
|
689
|
+
return 1;
|
|
690
|
+
case UNAuthorizationStatusNotDetermined:
|
|
691
|
+
return 0;
|
|
692
|
+
}
|
|
693
|
+
return 3;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Check notification authorization without prompting.
|
|
698
|
+
* Returns: 0=not-determined, 1=denied, 2=granted, 3=restricted
|
|
699
|
+
*/
|
|
700
|
+
extern "C" int checkNotificationPermission(void) {
|
|
701
|
+
if (@available(macOS 10.14, *)) {
|
|
702
|
+
__block int result = 0;
|
|
703
|
+
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
|
704
|
+
[[UNUserNotificationCenter currentNotificationCenter]
|
|
705
|
+
getNotificationSettingsWithCompletionHandler:
|
|
706
|
+
^(UNNotificationSettings *settings) {
|
|
707
|
+
result = elizaNotificationAuthorizationStatusToInt(
|
|
708
|
+
[settings authorizationStatus]);
|
|
709
|
+
dispatch_semaphore_signal(semaphore);
|
|
710
|
+
}];
|
|
711
|
+
dispatch_semaphore_wait(
|
|
712
|
+
semaphore,
|
|
713
|
+
dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)));
|
|
714
|
+
return result;
|
|
715
|
+
}
|
|
716
|
+
return 2;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* Request notification authorization, then return the resulting status.
|
|
721
|
+
*/
|
|
722
|
+
extern "C" int requestNotificationPermission(void) {
|
|
723
|
+
if (@available(macOS 10.14, *)) {
|
|
724
|
+
__block int result = 0;
|
|
725
|
+
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
|
726
|
+
UNAuthorizationOptions options =
|
|
727
|
+
UNAuthorizationOptionAlert | UNAuthorizationOptionSound |
|
|
728
|
+
UNAuthorizationOptionBadge;
|
|
729
|
+
[[UNUserNotificationCenter currentNotificationCenter]
|
|
730
|
+
requestAuthorizationWithOptions:options
|
|
731
|
+
completionHandler:^(BOOL granted, NSError *error) {
|
|
732
|
+
if (error != nil) {
|
|
733
|
+
result = 1;
|
|
734
|
+
dispatch_semaphore_signal(semaphore);
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
if (!granted) {
|
|
738
|
+
result = 1;
|
|
739
|
+
dispatch_semaphore_signal(semaphore);
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
[[UNUserNotificationCenter currentNotificationCenter]
|
|
743
|
+
getNotificationSettingsWithCompletionHandler:
|
|
744
|
+
^(UNNotificationSettings *settings) {
|
|
745
|
+
result = elizaNotificationAuthorizationStatusToInt(
|
|
746
|
+
[settings authorizationStatus]);
|
|
747
|
+
dispatch_semaphore_signal(semaphore);
|
|
748
|
+
}];
|
|
749
|
+
}];
|
|
750
|
+
dispatch_semaphore_wait(
|
|
751
|
+
semaphore,
|
|
752
|
+
dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10 * NSEC_PER_SEC)));
|
|
753
|
+
return result;
|
|
754
|
+
}
|
|
755
|
+
return 2;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
// ---------------------------------------------------------------------------
|
|
759
|
+
// Onboarding notification with action buttons
|
|
760
|
+
// ---------------------------------------------------------------------------
|
|
761
|
+
|
|
762
|
+
static NSString *const kElizaOnboardingCategoryId = @"ELIZA_ONBOARDING";
|
|
763
|
+
static NSString *const kElizaOnboardingActionLocalDevice = @"ELIZA_LOCAL_DEVICE";
|
|
764
|
+
static NSString *const kElizaOnboardingActionLocalCloudAI = @"ELIZA_LOCAL_CLOUD_AI";
|
|
765
|
+
static NSString *const kElizaOnboardingActionCloud = @"ELIZA_USE_CLOUD";
|
|
766
|
+
static NSString *const kElizaOnboardingNotifId = @"eliza-onboarding-setup";
|
|
767
|
+
|
|
768
|
+
// 0 = no choice yet
|
|
769
|
+
// 1 = local (all on-device)
|
|
770
|
+
// 2 = local (cloud inference)
|
|
771
|
+
// 3 = eliza cloud
|
|
772
|
+
// 4 = dismissed
|
|
773
|
+
static int elizaOnboardingChoice = 0;
|
|
774
|
+
|
|
775
|
+
/**
|
|
776
|
+
* Delegate that captures action button taps on the onboarding notification.
|
|
777
|
+
* Installed as the UNUserNotificationCenter delegate before posting.
|
|
778
|
+
*/
|
|
779
|
+
API_AVAILABLE(macos(10.14))
|
|
780
|
+
@interface ElizaOnboardingNotificationDelegate
|
|
781
|
+
: NSObject <UNUserNotificationCenterDelegate>
|
|
782
|
+
@end
|
|
783
|
+
|
|
784
|
+
@implementation ElizaOnboardingNotificationDelegate
|
|
785
|
+
|
|
786
|
+
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
|
|
787
|
+
didReceiveNotificationResponse:(UNNotificationResponse *)response
|
|
788
|
+
withCompletionHandler:(void (^)(void))completionHandler {
|
|
789
|
+
NSString *actionId = response.actionIdentifier;
|
|
790
|
+
if ([actionId isEqualToString:kElizaOnboardingActionLocalDevice]) {
|
|
791
|
+
elizaOnboardingChoice = 1;
|
|
792
|
+
} else if ([actionId isEqualToString:kElizaOnboardingActionLocalCloudAI]) {
|
|
793
|
+
elizaOnboardingChoice = 2;
|
|
794
|
+
} else if ([actionId isEqualToString:kElizaOnboardingActionCloud]) {
|
|
795
|
+
elizaOnboardingChoice = 3;
|
|
796
|
+
} else if ([actionId isEqualToString:UNNotificationDefaultActionIdentifier]) {
|
|
797
|
+
// User clicked the notification body itself.
|
|
798
|
+
elizaOnboardingChoice = 0;
|
|
799
|
+
} else if ([actionId isEqualToString:UNNotificationDismissActionIdentifier]) {
|
|
800
|
+
elizaOnboardingChoice = 4;
|
|
801
|
+
}
|
|
802
|
+
completionHandler();
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
// Show notification even when app is in foreground.
|
|
806
|
+
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
|
|
807
|
+
willPresentNotification:(UNNotification *)notification
|
|
808
|
+
withCompletionHandler:
|
|
809
|
+
(void (^)(UNNotificationPresentationOptions))completionHandler {
|
|
810
|
+
if (@available(macOS 11.0, *)) {
|
|
811
|
+
completionHandler(UNNotificationPresentationOptionBanner |
|
|
812
|
+
UNNotificationPresentationOptionSound);
|
|
813
|
+
} else {
|
|
814
|
+
completionHandler(UNNotificationPresentationOptionAlert |
|
|
815
|
+
UNNotificationPresentationOptionSound);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
@end
|
|
820
|
+
|
|
821
|
+
static ElizaOnboardingNotificationDelegate *elizaOnboardingDelegate = nil;
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Post a native macOS notification with three action buttons:
|
|
825
|
+
* "Local (On-Device)" → choice 1 (all-local)
|
|
826
|
+
* "Local (Cloud AI)" → choice 2 (cloud-inference)
|
|
827
|
+
* "Eliza Cloud" → choice 3
|
|
828
|
+
*
|
|
829
|
+
* The user's choice is stored in a static variable readable via
|
|
830
|
+
* elizaOnboardingGetChoice(). Returns true if the notification was posted.
|
|
831
|
+
*/
|
|
832
|
+
extern "C" bool elizaOnboardingNotificationPost(const char *title,
|
|
833
|
+
const char *body) {
|
|
834
|
+
if (@available(macOS 10.14, *)) {
|
|
835
|
+
elizaOnboardingChoice = 0;
|
|
836
|
+
|
|
837
|
+
UNUserNotificationCenter *center =
|
|
838
|
+
[UNUserNotificationCenter currentNotificationCenter];
|
|
839
|
+
|
|
840
|
+
// Install delegate (once).
|
|
841
|
+
if (elizaOnboardingDelegate == nil) {
|
|
842
|
+
elizaOnboardingDelegate =
|
|
843
|
+
[[ElizaOnboardingNotificationDelegate alloc] init];
|
|
844
|
+
}
|
|
845
|
+
[center setDelegate:elizaOnboardingDelegate];
|
|
846
|
+
|
|
847
|
+
// Register category with three actions.
|
|
848
|
+
UNNotificationAction *localDeviceAction = [UNNotificationAction
|
|
849
|
+
actionWithIdentifier:kElizaOnboardingActionLocalDevice
|
|
850
|
+
title:@"Local (On-Device)"
|
|
851
|
+
options:UNNotificationActionOptionForeground];
|
|
852
|
+
UNNotificationAction *localCloudAIAction = [UNNotificationAction
|
|
853
|
+
actionWithIdentifier:kElizaOnboardingActionLocalCloudAI
|
|
854
|
+
title:@"Local (Cloud AI)"
|
|
855
|
+
options:UNNotificationActionOptionForeground];
|
|
856
|
+
UNNotificationAction *cloudAction = [UNNotificationAction
|
|
857
|
+
actionWithIdentifier:kElizaOnboardingActionCloud
|
|
858
|
+
title:@"Eliza Cloud"
|
|
859
|
+
options:UNNotificationActionOptionForeground];
|
|
860
|
+
UNNotificationCategory *category = [UNNotificationCategory
|
|
861
|
+
categoryWithIdentifier:kElizaOnboardingCategoryId
|
|
862
|
+
actions:@[ localDeviceAction, localCloudAIAction, cloudAction ]
|
|
863
|
+
intentIdentifiers:@[]
|
|
864
|
+
options:UNNotificationCategoryOptionCustomDismissAction];
|
|
865
|
+
[center setNotificationCategories:[NSSet setWithObject:category]];
|
|
866
|
+
|
|
867
|
+
// Build content.
|
|
868
|
+
UNMutableNotificationContent *content =
|
|
869
|
+
[[UNMutableNotificationContent alloc] init];
|
|
870
|
+
[content setTitle:elizaNSStringFromCString(title)];
|
|
871
|
+
[content setBody:elizaNSStringFromCString(body)];
|
|
872
|
+
[content setCategoryIdentifier:kElizaOnboardingCategoryId];
|
|
873
|
+
[content setSound:[UNNotificationSound defaultSound]];
|
|
874
|
+
|
|
875
|
+
// Fire immediately (no trigger).
|
|
876
|
+
UNNotificationRequest *request =
|
|
877
|
+
[UNNotificationRequest requestWithIdentifier:kElizaOnboardingNotifId
|
|
878
|
+
content:content
|
|
879
|
+
trigger:nil];
|
|
880
|
+
|
|
881
|
+
__block bool posted = false;
|
|
882
|
+
dispatch_semaphore_t sem = dispatch_semaphore_create(0);
|
|
883
|
+
[center addNotificationRequest:request
|
|
884
|
+
withCompletionHandler:^(NSError *error) {
|
|
885
|
+
posted = (error == nil);
|
|
886
|
+
dispatch_semaphore_signal(sem);
|
|
887
|
+
}];
|
|
888
|
+
dispatch_semaphore_wait(
|
|
889
|
+
sem, dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)));
|
|
890
|
+
return posted;
|
|
891
|
+
}
|
|
892
|
+
return false;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* Read the onboarding notification choice.
|
|
897
|
+
* Returns: 0=pending, 1=local-on-device, 2=local-cloud-ai, 3=eliza-cloud, 4=dismissed.
|
|
898
|
+
*/
|
|
899
|
+
extern "C" int elizaOnboardingGetChoice(void) {
|
|
900
|
+
return elizaOnboardingChoice;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
/**
|
|
904
|
+
* Dismiss the onboarding notification if still showing.
|
|
905
|
+
*/
|
|
906
|
+
extern "C" void elizaOnboardingNotificationDismiss(void) {
|
|
907
|
+
if (@available(macOS 10.14, *)) {
|
|
908
|
+
[[UNUserNotificationCenter currentNotificationCenter]
|
|
909
|
+
removeDeliveredNotificationsWithIdentifiers:
|
|
910
|
+
@[ kElizaOnboardingNotifId ]];
|
|
911
|
+
[[UNUserNotificationCenter currentNotificationCenter]
|
|
912
|
+
removePendingNotificationRequestsWithIdentifiers:
|
|
913
|
+
@[ kElizaOnboardingNotifId ]];
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
|
|
918
|
+
|
|
919
|
+
static int elizaEventKitAuthorizationStatusToInt(EKAuthorizationStatus status) {
|
|
920
|
+
NSInteger raw = (NSInteger)status;
|
|
921
|
+
if (raw == 0) return 0; // not determined
|
|
922
|
+
if (raw == 2) return 1; // denied
|
|
923
|
+
if (raw == 3) return 2; // full access / legacy authorized
|
|
924
|
+
if (raw == 1) return 3; // restricted
|
|
925
|
+
if (raw == 4) return 4; // write-only events: not enough for read/update
|
|
926
|
+
return 3;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
static BOOL elizaEventKitHasFullAccess(EKEntityType entityType) {
|
|
930
|
+
EKAuthorizationStatus status =
|
|
931
|
+
[EKEventStore authorizationStatusForEntityType:entityType];
|
|
932
|
+
return (NSInteger)status == 3;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
static int elizaContactsAuthorizationStatusToInt(CNAuthorizationStatus status) {
|
|
936
|
+
NSInteger raw = (NSInteger)status;
|
|
937
|
+
if (raw == 0) return 0; // not determined
|
|
938
|
+
if (raw == 2) return 1; // denied
|
|
939
|
+
if (raw == 3 || raw == 4) return 2; // authorized or limited
|
|
940
|
+
if (raw == 1) return 3; // restricted
|
|
941
|
+
return 3;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
static BOOL elizaContactsHasAccess(void) {
|
|
945
|
+
CNAuthorizationStatus status =
|
|
946
|
+
[CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts];
|
|
947
|
+
NSInteger raw = (NSInteger)status;
|
|
948
|
+
return raw == 3 || raw == 4;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
static int elizaLocationAuthorizationStatusToInt(CLAuthorizationStatus status) {
|
|
952
|
+
switch (status) {
|
|
953
|
+
case kCLAuthorizationStatusNotDetermined:
|
|
954
|
+
return 0;
|
|
955
|
+
case kCLAuthorizationStatusDenied:
|
|
956
|
+
return 1;
|
|
957
|
+
case kCLAuthorizationStatusAuthorizedAlways:
|
|
958
|
+
return 2;
|
|
959
|
+
case kCLAuthorizationStatusRestricted:
|
|
960
|
+
default:
|
|
961
|
+
return 3;
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
static CLAuthorizationStatus elizaLocationAuthorizationStatus(
|
|
966
|
+
CLLocationManager *manager) {
|
|
967
|
+
if (@available(macOS 11.0, *)) {
|
|
968
|
+
return [manager authorizationStatus];
|
|
969
|
+
}
|
|
970
|
+
#pragma clang diagnostic push
|
|
971
|
+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
972
|
+
return [CLLocationManager authorizationStatus];
|
|
973
|
+
#pragma clang diagnostic pop
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
@interface ElizaLocationAuthorizationDelegate
|
|
977
|
+
: NSObject <CLLocationManagerDelegate>
|
|
978
|
+
@property(nonatomic) dispatch_semaphore_t semaphore;
|
|
979
|
+
@property(nonatomic) BOOL completed;
|
|
980
|
+
@end
|
|
981
|
+
|
|
982
|
+
@implementation ElizaLocationAuthorizationDelegate
|
|
983
|
+
- (void)finish {
|
|
984
|
+
if (self.completed) {
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
self.completed = YES;
|
|
988
|
+
dispatch_semaphore_signal(self.semaphore);
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
- (void)locationManagerDidChangeAuthorization:(CLLocationManager *)manager {
|
|
992
|
+
(void)manager;
|
|
993
|
+
[self finish];
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
- (void)locationManager:(CLLocationManager *)manager
|
|
997
|
+
didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
|
|
998
|
+
(void)manager;
|
|
999
|
+
(void)status;
|
|
1000
|
+
[self finish];
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
- (void)locationManager:(CLLocationManager *)manager
|
|
1004
|
+
didFailWithError:(NSError *)error {
|
|
1005
|
+
(void)manager;
|
|
1006
|
+
(void)error;
|
|
1007
|
+
[self finish];
|
|
1008
|
+
}
|
|
1009
|
+
@end
|
|
1010
|
+
|
|
1011
|
+
extern "C" int checkLocationPermission(void) {
|
|
1012
|
+
if (![CLLocationManager locationServicesEnabled]) {
|
|
1013
|
+
return 3;
|
|
1014
|
+
}
|
|
1015
|
+
CLLocationManager *manager = [[CLLocationManager alloc] init];
|
|
1016
|
+
CLAuthorizationStatus status = elizaLocationAuthorizationStatus(manager);
|
|
1017
|
+
return elizaLocationAuthorizationStatusToInt(status);
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
extern "C" int requestLocationPermission(void) {
|
|
1021
|
+
@autoreleasepool {
|
|
1022
|
+
if (![CLLocationManager locationServicesEnabled]) {
|
|
1023
|
+
return 3;
|
|
1024
|
+
}
|
|
1025
|
+
CLLocationManager *manager = [[CLLocationManager alloc] init];
|
|
1026
|
+
CLAuthorizationStatus status = elizaLocationAuthorizationStatus(manager);
|
|
1027
|
+
if (status != kCLAuthorizationStatusNotDetermined) {
|
|
1028
|
+
return elizaLocationAuthorizationStatusToInt(status);
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
ElizaLocationAuthorizationDelegate *delegate =
|
|
1032
|
+
[[ElizaLocationAuthorizationDelegate alloc] init];
|
|
1033
|
+
delegate.semaphore = dispatch_semaphore_create(0);
|
|
1034
|
+
manager.delegate = delegate;
|
|
1035
|
+
[manager requestWhenInUseAuthorization];
|
|
1036
|
+
dispatch_semaphore_wait(
|
|
1037
|
+
delegate.semaphore,
|
|
1038
|
+
dispatch_time(DISPATCH_TIME_NOW, (int64_t)(120 * NSEC_PER_SEC)));
|
|
1039
|
+
manager.delegate = nil;
|
|
1040
|
+
return checkLocationPermission();
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
extern "C" int checkRemindersPermission(void) {
|
|
1045
|
+
return elizaEventKitAuthorizationStatusToInt(
|
|
1046
|
+
[EKEventStore authorizationStatusForEntityType:EKEntityTypeReminder]);
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
extern "C" int requestRemindersPermission(void) {
|
|
1050
|
+
@autoreleasepool {
|
|
1051
|
+
EKEventStore *store = [[EKEventStore alloc] init];
|
|
1052
|
+
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
|
1053
|
+
if (@available(macOS 14.0, *)) {
|
|
1054
|
+
[store requestFullAccessToRemindersWithCompletion:
|
|
1055
|
+
^(BOOL granted, NSError *error) {
|
|
1056
|
+
(void)granted;
|
|
1057
|
+
(void)error;
|
|
1058
|
+
dispatch_semaphore_signal(semaphore);
|
|
1059
|
+
}];
|
|
1060
|
+
} else {
|
|
1061
|
+
#pragma clang diagnostic push
|
|
1062
|
+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
1063
|
+
[store requestAccessToEntityType:EKEntityTypeReminder
|
|
1064
|
+
completion:^(BOOL granted, NSError *error) {
|
|
1065
|
+
(void)granted;
|
|
1066
|
+
(void)error;
|
|
1067
|
+
dispatch_semaphore_signal(semaphore);
|
|
1068
|
+
}];
|
|
1069
|
+
#pragma clang diagnostic pop
|
|
1070
|
+
}
|
|
1071
|
+
dispatch_semaphore_wait(
|
|
1072
|
+
semaphore,
|
|
1073
|
+
dispatch_time(DISPATCH_TIME_NOW, (int64_t)(120 * NSEC_PER_SEC)));
|
|
1074
|
+
return checkRemindersPermission();
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
extern "C" int checkCalendarPermission(void) {
|
|
1079
|
+
return elizaEventKitAuthorizationStatusToInt(
|
|
1080
|
+
[EKEventStore authorizationStatusForEntityType:EKEntityTypeEvent]);
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
extern "C" int requestCalendarPermission(void) {
|
|
1084
|
+
@autoreleasepool {
|
|
1085
|
+
EKEventStore *store = [[EKEventStore alloc] init];
|
|
1086
|
+
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
|
1087
|
+
if (@available(macOS 14.0, *)) {
|
|
1088
|
+
[store requestFullAccessToEventsWithCompletion:
|
|
1089
|
+
^(BOOL granted, NSError *error) {
|
|
1090
|
+
(void)granted;
|
|
1091
|
+
(void)error;
|
|
1092
|
+
dispatch_semaphore_signal(semaphore);
|
|
1093
|
+
}];
|
|
1094
|
+
} else {
|
|
1095
|
+
#pragma clang diagnostic push
|
|
1096
|
+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
1097
|
+
[store requestAccessToEntityType:EKEntityTypeEvent
|
|
1098
|
+
completion:^(BOOL granted, NSError *error) {
|
|
1099
|
+
(void)granted;
|
|
1100
|
+
(void)error;
|
|
1101
|
+
dispatch_semaphore_signal(semaphore);
|
|
1102
|
+
}];
|
|
1103
|
+
#pragma clang diagnostic pop
|
|
1104
|
+
}
|
|
1105
|
+
dispatch_semaphore_wait(
|
|
1106
|
+
semaphore,
|
|
1107
|
+
dispatch_time(DISPATCH_TIME_NOW, (int64_t)(120 * NSEC_PER_SEC)));
|
|
1108
|
+
return checkCalendarPermission();
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
extern "C" int checkContactsPermission(void) {
|
|
1113
|
+
return elizaContactsAuthorizationStatusToInt(
|
|
1114
|
+
[CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts]);
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
extern "C" int requestContactsPermission(void) {
|
|
1118
|
+
@autoreleasepool {
|
|
1119
|
+
CNContactStore *store = [[CNContactStore alloc] init];
|
|
1120
|
+
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
|
1121
|
+
[store requestAccessForEntityType:CNEntityTypeContacts
|
|
1122
|
+
completionHandler:^(BOOL granted, NSError *error) {
|
|
1123
|
+
(void)granted;
|
|
1124
|
+
(void)error;
|
|
1125
|
+
dispatch_semaphore_signal(semaphore);
|
|
1126
|
+
}];
|
|
1127
|
+
dispatch_semaphore_wait(
|
|
1128
|
+
semaphore,
|
|
1129
|
+
dispatch_time(DISPATCH_TIME_NOW, (int64_t)(120 * NSEC_PER_SEC)));
|
|
1130
|
+
return checkContactsPermission();
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
static void elizaApplyReminderDueDate(EKReminder *reminder,
|
|
1135
|
+
double dueAtSeconds) {
|
|
1136
|
+
if (dueAtSeconds <= 0) {
|
|
1137
|
+
[reminder setDueDateComponents:nil];
|
|
1138
|
+
[reminder setAlarms:@[]];
|
|
1139
|
+
return;
|
|
1140
|
+
}
|
|
1141
|
+
NSDate *dueDate = [NSDate dateWithTimeIntervalSince1970:dueAtSeconds];
|
|
1142
|
+
NSCalendar *calendar = [NSCalendar currentCalendar];
|
|
1143
|
+
NSDateComponents *components =
|
|
1144
|
+
[calendar components:(NSCalendarUnitYear | NSCalendarUnitMonth |
|
|
1145
|
+
NSCalendarUnitDay | NSCalendarUnitHour |
|
|
1146
|
+
NSCalendarUnitMinute | NSCalendarUnitSecond)
|
|
1147
|
+
fromDate:dueDate];
|
|
1148
|
+
[components setTimeZone:[NSTimeZone localTimeZone]];
|
|
1149
|
+
[reminder setDueDateComponents:components];
|
|
1150
|
+
[reminder setAlarms:@[[EKAlarm alarmWithAbsoluteDate:dueDate]]];
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
static EKCalendar *elizaDefaultReminderCalendar(EKEventStore *store) {
|
|
1154
|
+
EKCalendar *calendar = [store defaultCalendarForNewReminders];
|
|
1155
|
+
if (calendar != nil) {
|
|
1156
|
+
return calendar;
|
|
1157
|
+
}
|
|
1158
|
+
NSArray<EKCalendar *> *calendars =
|
|
1159
|
+
[store calendarsForEntityType:EKEntityTypeReminder];
|
|
1160
|
+
return [calendars count] > 0 ? [calendars objectAtIndex:0] : nil;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
extern "C" char *createAppleReminderJson(const char *title,
|
|
1164
|
+
const char *notes,
|
|
1165
|
+
double dueAtSeconds,
|
|
1166
|
+
int priority) {
|
|
1167
|
+
@autoreleasepool {
|
|
1168
|
+
if (!elizaEventKitHasFullAccess(EKEntityTypeReminder)) {
|
|
1169
|
+
return elizaCopyJson(elizaJsonError(
|
|
1170
|
+
@"permission",
|
|
1171
|
+
@"Apple Reminders access has not been granted."));
|
|
1172
|
+
}
|
|
1173
|
+
NSString *titleString = [elizaNSStringFromCString(title)
|
|
1174
|
+
stringByTrimmingCharactersInSet:[NSCharacterSet
|
|
1175
|
+
whitespaceAndNewlineCharacterSet]];
|
|
1176
|
+
if ([titleString length] == 0) {
|
|
1177
|
+
return elizaCopyJson(elizaJsonError(
|
|
1178
|
+
@"native_error", @"Reminder title is required."));
|
|
1179
|
+
}
|
|
1180
|
+
EKEventStore *store = [[EKEventStore alloc] init];
|
|
1181
|
+
EKCalendar *calendar = elizaDefaultReminderCalendar(store);
|
|
1182
|
+
if (calendar == nil) {
|
|
1183
|
+
return elizaCopyJson(elizaJsonError(
|
|
1184
|
+
@"native_error", @"No writable Apple Reminders list is available."));
|
|
1185
|
+
}
|
|
1186
|
+
EKReminder *reminder = [EKReminder reminderWithEventStore:store];
|
|
1187
|
+
[reminder setTitle:titleString];
|
|
1188
|
+
NSString *notesString = elizaNSStringFromCString(notes);
|
|
1189
|
+
[reminder setNotes:[notesString length] > 0 ? notesString : nil];
|
|
1190
|
+
[reminder setCalendar:calendar];
|
|
1191
|
+
[reminder setPriority:priority];
|
|
1192
|
+
elizaApplyReminderDueDate(reminder, dueAtSeconds);
|
|
1193
|
+
|
|
1194
|
+
NSError *error = nil;
|
|
1195
|
+
BOOL ok = [store saveReminder:reminder commit:YES error:&error];
|
|
1196
|
+
if (!ok) {
|
|
1197
|
+
return elizaCopyJson(elizaJsonError(
|
|
1198
|
+
@"native_error",
|
|
1199
|
+
elizaErrorMessage(error, @"Failed to create Apple reminder.")));
|
|
1200
|
+
}
|
|
1201
|
+
NSString *reminderId = [reminder calendarItemIdentifier] ?: @"";
|
|
1202
|
+
return elizaCopyJson(elizaJsonOk(@{@"reminderId" : reminderId}));
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
extern "C" char *updateAppleReminderJson(const char *reminderId,
|
|
1207
|
+
const char *title,
|
|
1208
|
+
const char *notes,
|
|
1209
|
+
double dueAtSeconds,
|
|
1210
|
+
int priority) {
|
|
1211
|
+
@autoreleasepool {
|
|
1212
|
+
if (!elizaEventKitHasFullAccess(EKEntityTypeReminder)) {
|
|
1213
|
+
return elizaCopyJson(elizaJsonError(
|
|
1214
|
+
@"permission",
|
|
1215
|
+
@"Apple Reminders access has not been granted."));
|
|
1216
|
+
}
|
|
1217
|
+
NSString *identifier = [elizaNSStringFromCString(reminderId)
|
|
1218
|
+
stringByTrimmingCharactersInSet:[NSCharacterSet
|
|
1219
|
+
whitespaceAndNewlineCharacterSet]];
|
|
1220
|
+
NSString *titleString = [elizaNSStringFromCString(title)
|
|
1221
|
+
stringByTrimmingCharactersInSet:[NSCharacterSet
|
|
1222
|
+
whitespaceAndNewlineCharacterSet]];
|
|
1223
|
+
if ([identifier length] == 0 || [titleString length] == 0) {
|
|
1224
|
+
return elizaCopyJson(elizaJsonError(
|
|
1225
|
+
@"native_error", @"Reminder id and title are required."));
|
|
1226
|
+
}
|
|
1227
|
+
EKEventStore *store = [[EKEventStore alloc] init];
|
|
1228
|
+
EKCalendarItem *item = [store calendarItemWithIdentifier:identifier];
|
|
1229
|
+
if (item == nil || ![item isKindOfClass:[EKReminder class]]) {
|
|
1230
|
+
return elizaCopyJson(elizaJsonError(
|
|
1231
|
+
@"not_found", @"Apple reminder was not found."));
|
|
1232
|
+
}
|
|
1233
|
+
EKReminder *reminder = (EKReminder *)item;
|
|
1234
|
+
[reminder setTitle:titleString];
|
|
1235
|
+
NSString *notesString = elizaNSStringFromCString(notes);
|
|
1236
|
+
[reminder setNotes:[notesString length] > 0 ? notesString : nil];
|
|
1237
|
+
[reminder setPriority:priority];
|
|
1238
|
+
elizaApplyReminderDueDate(reminder, dueAtSeconds);
|
|
1239
|
+
|
|
1240
|
+
NSError *error = nil;
|
|
1241
|
+
BOOL ok = [store saveReminder:reminder commit:YES error:&error];
|
|
1242
|
+
if (!ok) {
|
|
1243
|
+
return elizaCopyJson(elizaJsonError(
|
|
1244
|
+
@"native_error",
|
|
1245
|
+
elizaErrorMessage(error, @"Failed to update Apple reminder.")));
|
|
1246
|
+
}
|
|
1247
|
+
NSString *nextId = [reminder calendarItemIdentifier] ?: identifier;
|
|
1248
|
+
return elizaCopyJson(elizaJsonOk(@{@"reminderId" : nextId}));
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
extern "C" char *deleteAppleReminderJson(const char *reminderId) {
|
|
1253
|
+
@autoreleasepool {
|
|
1254
|
+
if (!elizaEventKitHasFullAccess(EKEntityTypeReminder)) {
|
|
1255
|
+
return elizaCopyJson(elizaJsonError(
|
|
1256
|
+
@"permission",
|
|
1257
|
+
@"Apple Reminders access has not been granted."));
|
|
1258
|
+
}
|
|
1259
|
+
NSString *identifier = [elizaNSStringFromCString(reminderId)
|
|
1260
|
+
stringByTrimmingCharactersInSet:[NSCharacterSet
|
|
1261
|
+
whitespaceAndNewlineCharacterSet]];
|
|
1262
|
+
if ([identifier length] == 0) {
|
|
1263
|
+
return elizaCopyJson(elizaJsonError(
|
|
1264
|
+
@"native_error", @"Reminder id is required."));
|
|
1265
|
+
}
|
|
1266
|
+
EKEventStore *store = [[EKEventStore alloc] init];
|
|
1267
|
+
EKCalendarItem *item = [store calendarItemWithIdentifier:identifier];
|
|
1268
|
+
if (item == nil || ![item isKindOfClass:[EKReminder class]]) {
|
|
1269
|
+
return elizaCopyJson(elizaJsonError(
|
|
1270
|
+
@"not_found", @"Apple reminder was not found."));
|
|
1271
|
+
}
|
|
1272
|
+
NSError *error = nil;
|
|
1273
|
+
BOOL ok = [store removeReminder:(EKReminder *)item commit:YES error:&error];
|
|
1274
|
+
if (!ok) {
|
|
1275
|
+
return elizaCopyJson(elizaJsonError(
|
|
1276
|
+
@"native_error",
|
|
1277
|
+
elizaErrorMessage(error, @"Failed to delete Apple reminder.")));
|
|
1278
|
+
}
|
|
1279
|
+
return elizaCopyJson(elizaJsonOk(nil));
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
static NSString *elizaPayloadString(NSDictionary *payload, NSString *key);
|
|
1284
|
+
static NSArray *elizaPayloadArray(NSDictionary *payload, NSString *key);
|
|
1285
|
+
|
|
1286
|
+
static NSISO8601DateFormatter *elizaISO8601FormatterWithFractionalSeconds(void) {
|
|
1287
|
+
static NSISO8601DateFormatter *formatter = nil;
|
|
1288
|
+
static dispatch_once_t onceToken;
|
|
1289
|
+
dispatch_once(&onceToken, ^{
|
|
1290
|
+
formatter = [[NSISO8601DateFormatter alloc] init];
|
|
1291
|
+
formatter.formatOptions =
|
|
1292
|
+
NSISO8601DateFormatWithInternetDateTime |
|
|
1293
|
+
NSISO8601DateFormatWithFractionalSeconds;
|
|
1294
|
+
});
|
|
1295
|
+
return formatter;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
static NSISO8601DateFormatter *elizaISO8601FormatterWithoutFractionalSeconds(void) {
|
|
1299
|
+
static NSISO8601DateFormatter *formatter = nil;
|
|
1300
|
+
static dispatch_once_t onceToken;
|
|
1301
|
+
dispatch_once(&onceToken, ^{
|
|
1302
|
+
formatter = [[NSISO8601DateFormatter alloc] init];
|
|
1303
|
+
formatter.formatOptions = NSISO8601DateFormatWithInternetDateTime;
|
|
1304
|
+
});
|
|
1305
|
+
return formatter;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
static NSDate *elizaDateFromISO8601String(NSString *value) {
|
|
1309
|
+
if ([value length] == 0) {
|
|
1310
|
+
return nil;
|
|
1311
|
+
}
|
|
1312
|
+
NSDate *date =
|
|
1313
|
+
[elizaISO8601FormatterWithFractionalSeconds() dateFromString:value];
|
|
1314
|
+
if (date != nil) {
|
|
1315
|
+
return date;
|
|
1316
|
+
}
|
|
1317
|
+
return [elizaISO8601FormatterWithoutFractionalSeconds() dateFromString:value];
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
static NSString *elizaISO8601StringFromDate(NSDate *date) {
|
|
1321
|
+
if (date == nil) {
|
|
1322
|
+
return @"";
|
|
1323
|
+
}
|
|
1324
|
+
return [elizaISO8601FormatterWithFractionalSeconds() stringFromDate:date];
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
static NSString *elizaEventStatusString(EKEventStatus status) {
|
|
1328
|
+
switch (status) {
|
|
1329
|
+
case EKEventStatusNone:
|
|
1330
|
+
return @"none";
|
|
1331
|
+
case EKEventStatusConfirmed:
|
|
1332
|
+
return @"confirmed";
|
|
1333
|
+
case EKEventStatusTentative:
|
|
1334
|
+
return @"tentative";
|
|
1335
|
+
case EKEventStatusCanceled:
|
|
1336
|
+
return @"cancelled";
|
|
1337
|
+
}
|
|
1338
|
+
return @"unknown";
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
static NSString *elizaParticipantStatusString(EKParticipantStatus status) {
|
|
1342
|
+
switch (status) {
|
|
1343
|
+
case EKParticipantStatusUnknown:
|
|
1344
|
+
return @"unknown";
|
|
1345
|
+
case EKParticipantStatusPending:
|
|
1346
|
+
return @"pending";
|
|
1347
|
+
case EKParticipantStatusAccepted:
|
|
1348
|
+
return @"accepted";
|
|
1349
|
+
case EKParticipantStatusDeclined:
|
|
1350
|
+
return @"declined";
|
|
1351
|
+
case EKParticipantStatusTentative:
|
|
1352
|
+
return @"tentative";
|
|
1353
|
+
case EKParticipantStatusDelegated:
|
|
1354
|
+
return @"delegated";
|
|
1355
|
+
case EKParticipantStatusCompleted:
|
|
1356
|
+
return @"completed";
|
|
1357
|
+
case EKParticipantStatusInProcess:
|
|
1358
|
+
return @"in_process";
|
|
1359
|
+
}
|
|
1360
|
+
return @"unknown";
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
static NSString *elizaParticipantEmail(EKParticipant *participant) {
|
|
1364
|
+
NSURL *url = [participant URL];
|
|
1365
|
+
if (url == nil) {
|
|
1366
|
+
return @"";
|
|
1367
|
+
}
|
|
1368
|
+
if ([[[url scheme] lowercaseString] isEqualToString:@"mailto"]) {
|
|
1369
|
+
return [[url resourceSpecifier] stringByRemovingPercentEncoding] ?: @"";
|
|
1370
|
+
}
|
|
1371
|
+
return @"";
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
static NSDictionary *elizaParticipantJson(EKParticipant *participant) {
|
|
1375
|
+
NSString *email = elizaParticipantEmail(participant);
|
|
1376
|
+
return @{
|
|
1377
|
+
@"email" : [email length] > 0 ? email : (id)[NSNull null],
|
|
1378
|
+
@"displayName" : [[participant name] length] > 0
|
|
1379
|
+
? [participant name]
|
|
1380
|
+
: (id)[NSNull null],
|
|
1381
|
+
@"responseStatus" : elizaParticipantStatusString(
|
|
1382
|
+
[participant participantStatus]),
|
|
1383
|
+
@"self" : @([participant isCurrentUser]),
|
|
1384
|
+
@"organizer" : @([participant participantRole] == EKParticipantRoleChair),
|
|
1385
|
+
@"optional" :
|
|
1386
|
+
@([participant participantRole] == EKParticipantRoleOptional),
|
|
1387
|
+
};
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
static NSString *elizaHexColorFromCGColor(CGColorRef colorRef) {
|
|
1391
|
+
if (colorRef == nil) {
|
|
1392
|
+
return nil;
|
|
1393
|
+
}
|
|
1394
|
+
NSColor *color = [NSColor colorWithCGColor:colorRef];
|
|
1395
|
+
NSColor *rgb =
|
|
1396
|
+
[color colorUsingColorSpace:[NSColorSpace sRGBColorSpace]];
|
|
1397
|
+
if (rgb == nil) {
|
|
1398
|
+
return nil;
|
|
1399
|
+
}
|
|
1400
|
+
int r = (int)lrint(MAX(0, MIN(1, [rgb redComponent])) * 255.0);
|
|
1401
|
+
int g = (int)lrint(MAX(0, MIN(1, [rgb greenComponent])) * 255.0);
|
|
1402
|
+
int b = (int)lrint(MAX(0, MIN(1, [rgb blueComponent])) * 255.0);
|
|
1403
|
+
return [NSString stringWithFormat:@"#%02X%02X%02X", r, g, b];
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
static EKCalendar *elizaDefaultEventCalendar(EKEventStore *store) {
|
|
1407
|
+
EKCalendar *calendar = [store defaultCalendarForNewEvents];
|
|
1408
|
+
if (calendar != nil && [calendar allowsContentModifications]) {
|
|
1409
|
+
return calendar;
|
|
1410
|
+
}
|
|
1411
|
+
for (EKCalendar *candidate in [store calendarsForEntityType:EKEntityTypeEvent]) {
|
|
1412
|
+
if ([candidate allowsContentModifications]) {
|
|
1413
|
+
return candidate;
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
return nil;
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
static EKCalendar *elizaEventCalendarForIdentifier(EKEventStore *store,
|
|
1420
|
+
NSString *identifier,
|
|
1421
|
+
BOOL requireWritable) {
|
|
1422
|
+
if ([identifier length] == 0 || [identifier isEqualToString:@"primary"]) {
|
|
1423
|
+
return requireWritable ? elizaDefaultEventCalendar(store)
|
|
1424
|
+
: [store defaultCalendarForNewEvents];
|
|
1425
|
+
}
|
|
1426
|
+
for (EKCalendar *calendar in [store calendarsForEntityType:EKEntityTypeEvent]) {
|
|
1427
|
+
if ([[calendar calendarIdentifier] isEqualToString:identifier]) {
|
|
1428
|
+
if (requireWritable && ![calendar allowsContentModifications]) {
|
|
1429
|
+
return nil;
|
|
1430
|
+
}
|
|
1431
|
+
return calendar;
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
return nil;
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
static NSDictionary *elizaCalendarJson(EKCalendar *calendar,
|
|
1438
|
+
EKCalendar *defaultCalendar) {
|
|
1439
|
+
NSString *color = elizaHexColorFromCGColor([calendar CGColor]);
|
|
1440
|
+
NSString *calendarId = [calendar calendarIdentifier] ?: @"";
|
|
1441
|
+
NSString *defaultId = [defaultCalendar calendarIdentifier] ?: @"";
|
|
1442
|
+
EKSource *source = [calendar source];
|
|
1443
|
+
return @{
|
|
1444
|
+
@"calendarId" : calendarId,
|
|
1445
|
+
@"summary" : [calendar title] ?: @"Calendar",
|
|
1446
|
+
@"description" : [[source title] length] > 0 ? [source title]
|
|
1447
|
+
: (id)[NSNull null],
|
|
1448
|
+
@"primary" : @([calendarId length] > 0 &&
|
|
1449
|
+
[calendarId isEqualToString:defaultId]),
|
|
1450
|
+
@"accessRole" : [calendar allowsContentModifications] ? @"writer"
|
|
1451
|
+
: @"reader",
|
|
1452
|
+
@"backgroundColor" : color ?: (id)[NSNull null],
|
|
1453
|
+
@"foregroundColor" : [NSNull null],
|
|
1454
|
+
@"timeZone" : [[[NSTimeZone localTimeZone] name] length] > 0
|
|
1455
|
+
? [[NSTimeZone localTimeZone] name]
|
|
1456
|
+
: (id)[NSNull null],
|
|
1457
|
+
@"selected" : @YES,
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
static NSDictionary *elizaEventJson(EKEvent *event) {
|
|
1462
|
+
EKCalendar *calendar = [event calendar];
|
|
1463
|
+
NSString *identifier =
|
|
1464
|
+
[event calendarItemIdentifier] ?: [event eventIdentifier] ?: @"";
|
|
1465
|
+
NSMutableArray *attendees = [NSMutableArray array];
|
|
1466
|
+
NSArray<EKParticipant *> *eventAttendees = [event attendees] ?: @[];
|
|
1467
|
+
for (EKParticipant *attendee in eventAttendees) {
|
|
1468
|
+
[attendees addObject:elizaParticipantJson(attendee)];
|
|
1469
|
+
}
|
|
1470
|
+
id organizer = [event organizer] != nil
|
|
1471
|
+
? (id)elizaParticipantJson([event organizer])
|
|
1472
|
+
: (id)[NSNull null];
|
|
1473
|
+
return @{
|
|
1474
|
+
@"id" : identifier,
|
|
1475
|
+
@"externalId" : identifier,
|
|
1476
|
+
@"calendarId" : [calendar calendarIdentifier] ?: @"",
|
|
1477
|
+
@"calendarSummary" : [calendar title] ?: @"",
|
|
1478
|
+
@"title" : [[event title] length] > 0 ? [event title] : @"(untitled)",
|
|
1479
|
+
@"description" : [event notes] ?: @"",
|
|
1480
|
+
@"location" : [event location] ?: @"",
|
|
1481
|
+
@"status" : elizaEventStatusString([event status]),
|
|
1482
|
+
@"startAt" : elizaISO8601StringFromDate([event startDate]),
|
|
1483
|
+
@"endAt" : elizaISO8601StringFromDate([event endDate]),
|
|
1484
|
+
@"isAllDay" : @([event isAllDay]),
|
|
1485
|
+
@"timezone" : [[event timeZone] name] ?: (id)[NSNull null],
|
|
1486
|
+
@"htmlLink" : [NSNull null],
|
|
1487
|
+
@"conferenceLink" : [NSNull null],
|
|
1488
|
+
@"organizer" : organizer,
|
|
1489
|
+
@"attendees" : attendees,
|
|
1490
|
+
};
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
static NSDictionary *elizaAppleCalendarUnsupportedAttendeesError(void) {
|
|
1494
|
+
return elizaJsonError(
|
|
1495
|
+
@"unsupported_feature",
|
|
1496
|
+
@"Apple Calendar does not allow this app to create or edit event invitees through EventKit. Remove attendees or use Google Calendar for invited meetings.");
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
static NSDictionary *elizaApplyEventPayload(EKEvent *event,
|
|
1500
|
+
NSDictionary *payload,
|
|
1501
|
+
EKEventStore *store,
|
|
1502
|
+
BOOL requireTitle,
|
|
1503
|
+
NSError **errorOut) {
|
|
1504
|
+
(void)errorOut;
|
|
1505
|
+
NSArray *attendees = elizaPayloadArray(payload, @"attendees");
|
|
1506
|
+
if ([attendees count] > 0) {
|
|
1507
|
+
return elizaAppleCalendarUnsupportedAttendeesError();
|
|
1508
|
+
}
|
|
1509
|
+
if ([payload objectForKey:@"title"] != nil || requireTitle) {
|
|
1510
|
+
NSString *title = [elizaPayloadString(payload, @"title")
|
|
1511
|
+
stringByTrimmingCharactersInSet:[NSCharacterSet
|
|
1512
|
+
whitespaceAndNewlineCharacterSet]];
|
|
1513
|
+
if ([title length] == 0) {
|
|
1514
|
+
return elizaJsonError(@"native_error", @"Calendar event title is required.");
|
|
1515
|
+
}
|
|
1516
|
+
[event setTitle:title];
|
|
1517
|
+
}
|
|
1518
|
+
if ([payload objectForKey:@"description"] != nil ||
|
|
1519
|
+
[payload objectForKey:@"notes"] != nil) {
|
|
1520
|
+
NSString *notes = elizaPayloadString(
|
|
1521
|
+
payload,
|
|
1522
|
+
[payload objectForKey:@"description"] != nil ? @"description" : @"notes");
|
|
1523
|
+
[event setNotes:[notes length] > 0 ? notes : nil];
|
|
1524
|
+
}
|
|
1525
|
+
if ([payload objectForKey:@"location"] != nil) {
|
|
1526
|
+
NSString *location = elizaPayloadString(payload, @"location");
|
|
1527
|
+
[event setLocation:[location length] > 0 ? location : nil];
|
|
1528
|
+
}
|
|
1529
|
+
if ([payload objectForKey:@"timeZone"] != nil) {
|
|
1530
|
+
NSString *timeZoneName = elizaPayloadString(payload, @"timeZone");
|
|
1531
|
+
NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:timeZoneName];
|
|
1532
|
+
if (timeZone != nil) {
|
|
1533
|
+
[event setTimeZone:timeZone];
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
if ([payload objectForKey:@"calendarId"] != nil) {
|
|
1537
|
+
EKCalendar *calendar = elizaEventCalendarForIdentifier(
|
|
1538
|
+
store,
|
|
1539
|
+
elizaPayloadString(payload, @"calendarId"),
|
|
1540
|
+
YES);
|
|
1541
|
+
if (calendar == nil) {
|
|
1542
|
+
return elizaJsonError(
|
|
1543
|
+
@"native_error",
|
|
1544
|
+
@"The selected Apple Calendar is not writable or was not found.");
|
|
1545
|
+
}
|
|
1546
|
+
[event setCalendar:calendar];
|
|
1547
|
+
}
|
|
1548
|
+
if ([payload objectForKey:@"isAllDay"] != nil) {
|
|
1549
|
+
id raw = [payload objectForKey:@"isAllDay"];
|
|
1550
|
+
if ([raw isKindOfClass:[NSNumber class]]) {
|
|
1551
|
+
[event setAllDay:[(NSNumber *)raw boolValue]];
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
if ([payload objectForKey:@"startAt"] != nil) {
|
|
1555
|
+
NSDate *start = elizaDateFromISO8601String(
|
|
1556
|
+
elizaPayloadString(payload, @"startAt"));
|
|
1557
|
+
if (start == nil) {
|
|
1558
|
+
return elizaJsonError(@"native_error", @"Calendar event startAt is invalid.");
|
|
1559
|
+
}
|
|
1560
|
+
[event setStartDate:start];
|
|
1561
|
+
}
|
|
1562
|
+
if ([payload objectForKey:@"endAt"] != nil) {
|
|
1563
|
+
NSDate *end =
|
|
1564
|
+
elizaDateFromISO8601String(elizaPayloadString(payload, @"endAt"));
|
|
1565
|
+
if (end == nil) {
|
|
1566
|
+
return elizaJsonError(@"native_error", @"Calendar event endAt is invalid.");
|
|
1567
|
+
}
|
|
1568
|
+
[event setEndDate:end];
|
|
1569
|
+
}
|
|
1570
|
+
if ([event startDate] == nil || [event endDate] == nil) {
|
|
1571
|
+
return elizaJsonError(
|
|
1572
|
+
@"native_error",
|
|
1573
|
+
@"Calendar event startAt and endAt are required.");
|
|
1574
|
+
}
|
|
1575
|
+
if ([[event endDate] timeIntervalSinceDate:[event startDate]] <= 0) {
|
|
1576
|
+
return elizaJsonError(
|
|
1577
|
+
@"native_error",
|
|
1578
|
+
@"Calendar event endAt must be later than startAt.");
|
|
1579
|
+
}
|
|
1580
|
+
if ([event calendar] == nil) {
|
|
1581
|
+
EKCalendar *calendar = elizaDefaultEventCalendar(store);
|
|
1582
|
+
if (calendar == nil) {
|
|
1583
|
+
return elizaJsonError(
|
|
1584
|
+
@"native_error",
|
|
1585
|
+
@"No writable Apple Calendar is available.");
|
|
1586
|
+
}
|
|
1587
|
+
[event setCalendar:calendar];
|
|
1588
|
+
}
|
|
1589
|
+
return nil;
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
extern "C" char *listAppleCalendarsJson(void) {
|
|
1593
|
+
@autoreleasepool {
|
|
1594
|
+
if (!elizaEventKitHasFullAccess(EKEntityTypeEvent)) {
|
|
1595
|
+
return elizaCopyJson(elizaJsonError(
|
|
1596
|
+
@"permission", @"Apple Calendar access has not been granted."));
|
|
1597
|
+
}
|
|
1598
|
+
EKEventStore *store = [[EKEventStore alloc] init];
|
|
1599
|
+
EKCalendar *defaultCalendar = [store defaultCalendarForNewEvents];
|
|
1600
|
+
NSMutableArray *calendars = [NSMutableArray array];
|
|
1601
|
+
for (EKCalendar *calendar in [store calendarsForEntityType:EKEntityTypeEvent]) {
|
|
1602
|
+
[calendars addObject:elizaCalendarJson(calendar, defaultCalendar)];
|
|
1603
|
+
}
|
|
1604
|
+
return elizaCopyJson(elizaJsonOk(@{@"calendars" : calendars}));
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
extern "C" char *listAppleCalendarEventsJson(const char *calendarId,
|
|
1609
|
+
double startSeconds,
|
|
1610
|
+
double endSeconds) {
|
|
1611
|
+
@autoreleasepool {
|
|
1612
|
+
if (!elizaEventKitHasFullAccess(EKEntityTypeEvent)) {
|
|
1613
|
+
return elizaCopyJson(elizaJsonError(
|
|
1614
|
+
@"permission", @"Apple Calendar access has not been granted."));
|
|
1615
|
+
}
|
|
1616
|
+
if (endSeconds <= startSeconds) {
|
|
1617
|
+
return elizaCopyJson(elizaJsonError(
|
|
1618
|
+
@"native_error", @"Calendar event window is invalid."));
|
|
1619
|
+
}
|
|
1620
|
+
EKEventStore *store = [[EKEventStore alloc] init];
|
|
1621
|
+
NSString *identifier = [elizaNSStringFromCString(calendarId)
|
|
1622
|
+
stringByTrimmingCharactersInSet:[NSCharacterSet
|
|
1623
|
+
whitespaceAndNewlineCharacterSet]];
|
|
1624
|
+
NSArray<EKCalendar *> *calendars = nil;
|
|
1625
|
+
if ([identifier length] > 0 && ![identifier isEqualToString:@"all"]) {
|
|
1626
|
+
EKCalendar *calendar =
|
|
1627
|
+
elizaEventCalendarForIdentifier(store, identifier, NO);
|
|
1628
|
+
if (calendar == nil) {
|
|
1629
|
+
return elizaCopyJson(elizaJsonError(
|
|
1630
|
+
@"not_found", @"Apple Calendar was not found."));
|
|
1631
|
+
}
|
|
1632
|
+
calendars = @[calendar];
|
|
1633
|
+
}
|
|
1634
|
+
NSDate *start = [NSDate dateWithTimeIntervalSince1970:startSeconds];
|
|
1635
|
+
NSDate *end = [NSDate dateWithTimeIntervalSince1970:endSeconds];
|
|
1636
|
+
NSPredicate *predicate = [store predicateForEventsWithStartDate:start
|
|
1637
|
+
endDate:end
|
|
1638
|
+
calendars:calendars];
|
|
1639
|
+
NSArray<EKEvent *> *events =
|
|
1640
|
+
[[store eventsMatchingPredicate:predicate]
|
|
1641
|
+
sortedArrayUsingComparator:^NSComparisonResult(EKEvent *left,
|
|
1642
|
+
EKEvent *right) {
|
|
1643
|
+
return [[left startDate] compare:[right startDate]];
|
|
1644
|
+
}];
|
|
1645
|
+
NSMutableArray *rows = [NSMutableArray array];
|
|
1646
|
+
for (EKEvent *event in events) {
|
|
1647
|
+
[rows addObject:elizaEventJson(event)];
|
|
1648
|
+
}
|
|
1649
|
+
return elizaCopyJson(elizaJsonOk(@{@"events" : rows}));
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
extern "C" char *createAppleCalendarEventJson(const char *payloadJson) {
|
|
1654
|
+
@autoreleasepool {
|
|
1655
|
+
if (!elizaEventKitHasFullAccess(EKEntityTypeEvent)) {
|
|
1656
|
+
return elizaCopyJson(elizaJsonError(
|
|
1657
|
+
@"permission", @"Apple Calendar access has not been granted."));
|
|
1658
|
+
}
|
|
1659
|
+
NSDictionary *payload = elizaParseJsonObject(payloadJson);
|
|
1660
|
+
if (payload == nil) {
|
|
1661
|
+
return elizaCopyJson(elizaJsonError(
|
|
1662
|
+
@"native_error", @"Invalid calendar event payload."));
|
|
1663
|
+
}
|
|
1664
|
+
EKEventStore *store = [[EKEventStore alloc] init];
|
|
1665
|
+
EKEvent *event = [EKEvent eventWithEventStore:store];
|
|
1666
|
+
NSDictionary *payloadError =
|
|
1667
|
+
elizaApplyEventPayload(event, payload, store, YES, nil);
|
|
1668
|
+
if (payloadError != nil) {
|
|
1669
|
+
return elizaCopyJson(payloadError);
|
|
1670
|
+
}
|
|
1671
|
+
NSError *error = nil;
|
|
1672
|
+
BOOL ok = [store saveEvent:event
|
|
1673
|
+
span:EKSpanThisEvent
|
|
1674
|
+
commit:YES
|
|
1675
|
+
error:&error];
|
|
1676
|
+
if (!ok) {
|
|
1677
|
+
return elizaCopyJson(elizaJsonError(
|
|
1678
|
+
@"native_error",
|
|
1679
|
+
elizaErrorMessage(error, @"Failed to create Apple Calendar event.")));
|
|
1680
|
+
}
|
|
1681
|
+
return elizaCopyJson(elizaJsonOk(@{@"event" : elizaEventJson(event)}));
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
extern "C" char *updateAppleCalendarEventJson(const char *eventId,
|
|
1686
|
+
const char *payloadJson) {
|
|
1687
|
+
@autoreleasepool {
|
|
1688
|
+
if (!elizaEventKitHasFullAccess(EKEntityTypeEvent)) {
|
|
1689
|
+
return elizaCopyJson(elizaJsonError(
|
|
1690
|
+
@"permission", @"Apple Calendar access has not been granted."));
|
|
1691
|
+
}
|
|
1692
|
+
NSString *identifier = [elizaNSStringFromCString(eventId)
|
|
1693
|
+
stringByTrimmingCharactersInSet:[NSCharacterSet
|
|
1694
|
+
whitespaceAndNewlineCharacterSet]];
|
|
1695
|
+
NSDictionary *payload = elizaParseJsonObject(payloadJson);
|
|
1696
|
+
if ([identifier length] == 0 || payload == nil) {
|
|
1697
|
+
return elizaCopyJson(elizaJsonError(
|
|
1698
|
+
@"native_error", @"Calendar event id and payload are required."));
|
|
1699
|
+
}
|
|
1700
|
+
EKEventStore *store = [[EKEventStore alloc] init];
|
|
1701
|
+
EKCalendarItem *item = [store calendarItemWithIdentifier:identifier];
|
|
1702
|
+
if (item == nil || ![item isKindOfClass:[EKEvent class]]) {
|
|
1703
|
+
return elizaCopyJson(elizaJsonError(
|
|
1704
|
+
@"not_found", @"Apple Calendar event was not found."));
|
|
1705
|
+
}
|
|
1706
|
+
EKEvent *event = (EKEvent *)item;
|
|
1707
|
+
if (![[event calendar] allowsContentModifications]) {
|
|
1708
|
+
return elizaCopyJson(elizaJsonError(
|
|
1709
|
+
@"native_error", @"Apple Calendar event is not writable."));
|
|
1710
|
+
}
|
|
1711
|
+
NSDictionary *payloadError =
|
|
1712
|
+
elizaApplyEventPayload(event, payload, store, NO, nil);
|
|
1713
|
+
if (payloadError != nil) {
|
|
1714
|
+
return elizaCopyJson(payloadError);
|
|
1715
|
+
}
|
|
1716
|
+
NSError *error = nil;
|
|
1717
|
+
BOOL ok = [store saveEvent:event
|
|
1718
|
+
span:EKSpanThisEvent
|
|
1719
|
+
commit:YES
|
|
1720
|
+
error:&error];
|
|
1721
|
+
if (!ok) {
|
|
1722
|
+
return elizaCopyJson(elizaJsonError(
|
|
1723
|
+
@"native_error",
|
|
1724
|
+
elizaErrorMessage(error, @"Failed to update Apple Calendar event.")));
|
|
1725
|
+
}
|
|
1726
|
+
return elizaCopyJson(elizaJsonOk(@{@"event" : elizaEventJson(event)}));
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
extern "C" char *deleteAppleCalendarEventJson(const char *eventId) {
|
|
1731
|
+
@autoreleasepool {
|
|
1732
|
+
if (!elizaEventKitHasFullAccess(EKEntityTypeEvent)) {
|
|
1733
|
+
return elizaCopyJson(elizaJsonError(
|
|
1734
|
+
@"permission", @"Apple Calendar access has not been granted."));
|
|
1735
|
+
}
|
|
1736
|
+
NSString *identifier = [elizaNSStringFromCString(eventId)
|
|
1737
|
+
stringByTrimmingCharactersInSet:[NSCharacterSet
|
|
1738
|
+
whitespaceAndNewlineCharacterSet]];
|
|
1739
|
+
if ([identifier length] == 0) {
|
|
1740
|
+
return elizaCopyJson(elizaJsonError(
|
|
1741
|
+
@"native_error", @"Calendar event id is required."));
|
|
1742
|
+
}
|
|
1743
|
+
EKEventStore *store = [[EKEventStore alloc] init];
|
|
1744
|
+
EKCalendarItem *item = [store calendarItemWithIdentifier:identifier];
|
|
1745
|
+
if (item == nil || ![item isKindOfClass:[EKEvent class]]) {
|
|
1746
|
+
return elizaCopyJson(elizaJsonError(
|
|
1747
|
+
@"not_found", @"Apple Calendar event was not found."));
|
|
1748
|
+
}
|
|
1749
|
+
EKEvent *event = (EKEvent *)item;
|
|
1750
|
+
NSError *error = nil;
|
|
1751
|
+
BOOL ok = [store removeEvent:event
|
|
1752
|
+
span:EKSpanThisEvent
|
|
1753
|
+
commit:YES
|
|
1754
|
+
error:&error];
|
|
1755
|
+
if (!ok) {
|
|
1756
|
+
return elizaCopyJson(elizaJsonError(
|
|
1757
|
+
@"native_error",
|
|
1758
|
+
elizaErrorMessage(error, @"Failed to delete Apple Calendar event.")));
|
|
1759
|
+
}
|
|
1760
|
+
return elizaCopyJson(elizaJsonOk(nil));
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
static NSArray<id<CNKeyDescriptor>> *elizaContactKeys(void) {
|
|
1765
|
+
return @[
|
|
1766
|
+
CNContactIdentifierKey,
|
|
1767
|
+
CNContactGivenNameKey,
|
|
1768
|
+
CNContactFamilyNameKey,
|
|
1769
|
+
CNContactPhoneNumbersKey,
|
|
1770
|
+
CNContactEmailAddressesKey,
|
|
1771
|
+
[CNContactFormatter
|
|
1772
|
+
descriptorForRequiredKeysForStyle:CNContactFormatterStyleFullName],
|
|
1773
|
+
];
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
static NSString *elizaContactDisplayName(CNContact *contact) {
|
|
1777
|
+
NSString *name = [CNContactFormatter
|
|
1778
|
+
stringFromContact:contact
|
|
1779
|
+
style:CNContactFormatterStyleFullName];
|
|
1780
|
+
if ([name length] > 0) {
|
|
1781
|
+
return name;
|
|
1782
|
+
}
|
|
1783
|
+
NSString *joined =
|
|
1784
|
+
[[NSString stringWithFormat:@"%@ %@", [contact givenName], [contact familyName]]
|
|
1785
|
+
stringByTrimmingCharactersInSet:[NSCharacterSet
|
|
1786
|
+
whitespaceAndNewlineCharacterSet]];
|
|
1787
|
+
return [joined length] > 0 ? joined : @"";
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
static NSDictionary *elizaPhoneEntry(CNLabeledValue<CNPhoneNumber *> *entry) {
|
|
1791
|
+
return @{
|
|
1792
|
+
@"label" : [entry label] ?: [NSNull null],
|
|
1793
|
+
@"value" : [[entry value] stringValue] ?: @"",
|
|
1794
|
+
};
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
static NSDictionary *elizaEmailEntry(CNLabeledValue<NSString *> *entry) {
|
|
1798
|
+
return @{
|
|
1799
|
+
@"label" : [entry label] ?: [NSNull null],
|
|
1800
|
+
@"value" : [entry value] ?: @"",
|
|
1801
|
+
};
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
static NSDictionary *elizaFullContactJson(CNContact *contact) {
|
|
1805
|
+
NSMutableArray *phones = [NSMutableArray array];
|
|
1806
|
+
for (CNLabeledValue<CNPhoneNumber *> *phone in [contact phoneNumbers]) {
|
|
1807
|
+
[phones addObject:elizaPhoneEntry(phone)];
|
|
1808
|
+
}
|
|
1809
|
+
NSMutableArray *emails = [NSMutableArray array];
|
|
1810
|
+
for (CNLabeledValue<NSString *> *email in [contact emailAddresses]) {
|
|
1811
|
+
[emails addObject:elizaEmailEntry(email)];
|
|
1812
|
+
}
|
|
1813
|
+
return @{
|
|
1814
|
+
@"id" : [contact identifier] ?: @"",
|
|
1815
|
+
@"name" : elizaContactDisplayName(contact),
|
|
1816
|
+
@"firstName" : [[contact givenName] length] > 0
|
|
1817
|
+
? [contact givenName]
|
|
1818
|
+
: (id)[NSNull null],
|
|
1819
|
+
@"lastName" : [[contact familyName] length] > 0
|
|
1820
|
+
? [contact familyName]
|
|
1821
|
+
: (id)[NSNull null],
|
|
1822
|
+
@"phones" : phones,
|
|
1823
|
+
@"emails" : emails,
|
|
1824
|
+
};
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
extern "C" char *loadContactsJson(void) {
|
|
1828
|
+
@autoreleasepool {
|
|
1829
|
+
if (!elizaContactsHasAccess()) {
|
|
1830
|
+
return elizaCopyJson(elizaJsonError(
|
|
1831
|
+
@"permission", @"Apple Contacts access has not been granted."));
|
|
1832
|
+
}
|
|
1833
|
+
CNContactStore *store = [[CNContactStore alloc] init];
|
|
1834
|
+
CNContactFetchRequest *request =
|
|
1835
|
+
[[CNContactFetchRequest alloc] initWithKeysToFetch:elizaContactKeys()];
|
|
1836
|
+
[request setUnifyResults:YES];
|
|
1837
|
+
NSMutableArray *rows = [NSMutableArray array];
|
|
1838
|
+
NSError *error = nil;
|
|
1839
|
+
BOOL ok = [store
|
|
1840
|
+
enumerateContactsWithFetchRequest:request
|
|
1841
|
+
error:&error
|
|
1842
|
+
usingBlock:^(CNContact *contact, BOOL *stop) {
|
|
1843
|
+
(void)stop;
|
|
1844
|
+
NSString *name = elizaContactDisplayName(contact);
|
|
1845
|
+
for (CNLabeledValue<CNPhoneNumber *> *phone in [contact phoneNumbers]) {
|
|
1846
|
+
NSString *value = [[phone value] stringValue] ?: @"";
|
|
1847
|
+
if ([value length] > 0 && [name length] > 0) {
|
|
1848
|
+
[rows addObject:@{
|
|
1849
|
+
@"kind" : @"phone",
|
|
1850
|
+
@"handle" : value,
|
|
1851
|
+
@"name" : name,
|
|
1852
|
+
}];
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
for (CNLabeledValue<NSString *> *email in [contact emailAddresses]) {
|
|
1856
|
+
NSString *value = [email value] ?: @"";
|
|
1857
|
+
if ([value length] > 0 && [name length] > 0) {
|
|
1858
|
+
[rows addObject:@{
|
|
1859
|
+
@"kind" : @"email",
|
|
1860
|
+
@"handle" : value,
|
|
1861
|
+
@"name" : name,
|
|
1862
|
+
}];
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
}];
|
|
1866
|
+
if (!ok) {
|
|
1867
|
+
return elizaCopyJson(elizaJsonError(
|
|
1868
|
+
@"native_error",
|
|
1869
|
+
elizaErrorMessage(error, @"Failed to read Apple Contacts.")));
|
|
1870
|
+
}
|
|
1871
|
+
return elizaCopyJson(elizaJsonOk(@{@"contacts" : rows}));
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
extern "C" char *listAllContactsJson(void) {
|
|
1876
|
+
@autoreleasepool {
|
|
1877
|
+
if (!elizaContactsHasAccess()) {
|
|
1878
|
+
return elizaCopyJson(elizaJsonError(
|
|
1879
|
+
@"permission", @"Apple Contacts access has not been granted."));
|
|
1880
|
+
}
|
|
1881
|
+
CNContactStore *store = [[CNContactStore alloc] init];
|
|
1882
|
+
CNContactFetchRequest *request =
|
|
1883
|
+
[[CNContactFetchRequest alloc] initWithKeysToFetch:elizaContactKeys()];
|
|
1884
|
+
[request setUnifyResults:YES];
|
|
1885
|
+
NSMutableArray *contacts = [NSMutableArray array];
|
|
1886
|
+
NSError *error = nil;
|
|
1887
|
+
BOOL ok = [store
|
|
1888
|
+
enumerateContactsWithFetchRequest:request
|
|
1889
|
+
error:&error
|
|
1890
|
+
usingBlock:^(CNContact *contact, BOOL *stop) {
|
|
1891
|
+
(void)stop;
|
|
1892
|
+
[contacts addObject:elizaFullContactJson(contact)];
|
|
1893
|
+
}];
|
|
1894
|
+
if (!ok) {
|
|
1895
|
+
return elizaCopyJson(elizaJsonError(
|
|
1896
|
+
@"native_error",
|
|
1897
|
+
elizaErrorMessage(error, @"Failed to list Apple Contacts.")));
|
|
1898
|
+
}
|
|
1899
|
+
return elizaCopyJson(elizaJsonOk(@{@"contacts" : contacts}));
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
static NSString *elizaPayloadString(NSDictionary *payload, NSString *key) {
|
|
1904
|
+
id value = [payload objectForKey:key];
|
|
1905
|
+
return [value isKindOfClass:[NSString class]] ? (NSString *)value : @"";
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
static NSArray *elizaPayloadArray(NSDictionary *payload, NSString *key) {
|
|
1909
|
+
id value = [payload objectForKey:key];
|
|
1910
|
+
return [value isKindOfClass:[NSArray class]] ? (NSArray *)value : @[];
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1913
|
+
static CNLabeledValue<CNPhoneNumber *> *elizaPayloadPhone(NSDictionary *entry) {
|
|
1914
|
+
NSString *value = elizaPayloadString(entry, @"value");
|
|
1915
|
+
if ([value length] == 0) {
|
|
1916
|
+
return nil;
|
|
1917
|
+
}
|
|
1918
|
+
NSString *label = elizaPayloadString(entry, @"label");
|
|
1919
|
+
if ([label length] == 0) {
|
|
1920
|
+
label = CNLabelPhoneNumberMobile;
|
|
1921
|
+
}
|
|
1922
|
+
return [CNLabeledValue labeledValueWithLabel:label
|
|
1923
|
+
value:[CNPhoneNumber
|
|
1924
|
+
phoneNumberWithStringValue:value]];
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
static CNLabeledValue<NSString *> *elizaPayloadEmail(NSDictionary *entry) {
|
|
1928
|
+
NSString *value = elizaPayloadString(entry, @"value");
|
|
1929
|
+
if ([value length] == 0) {
|
|
1930
|
+
return nil;
|
|
1931
|
+
}
|
|
1932
|
+
NSString *label = elizaPayloadString(entry, @"label");
|
|
1933
|
+
if ([label length] == 0) {
|
|
1934
|
+
label = CNLabelHome;
|
|
1935
|
+
}
|
|
1936
|
+
return [CNLabeledValue labeledValueWithLabel:label value:value];
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
static void elizaApplyContactPayload(CNMutableContact *contact,
|
|
1940
|
+
NSDictionary *payload) {
|
|
1941
|
+
if ([payload objectForKey:@"firstName"] != nil) {
|
|
1942
|
+
[contact setGivenName:elizaPayloadString(payload, @"firstName")];
|
|
1943
|
+
}
|
|
1944
|
+
if ([payload objectForKey:@"lastName"] != nil) {
|
|
1945
|
+
[contact setFamilyName:elizaPayloadString(payload, @"lastName")];
|
|
1946
|
+
}
|
|
1947
|
+
NSMutableArray<CNLabeledValue<CNPhoneNumber *> *> *phones =
|
|
1948
|
+
[[contact phoneNumbers] mutableCopy];
|
|
1949
|
+
for (id value in elizaPayloadArray(payload, @"removePhones")) {
|
|
1950
|
+
if (![value isKindOfClass:[NSString class]]) {
|
|
1951
|
+
continue;
|
|
1952
|
+
}
|
|
1953
|
+
NSString *needle = (NSString *)value;
|
|
1954
|
+
NSIndexSet *matches = [phones
|
|
1955
|
+
indexesOfObjectsPassingTest:
|
|
1956
|
+
^BOOL(CNLabeledValue<CNPhoneNumber *> *entry,
|
|
1957
|
+
NSUInteger idx,
|
|
1958
|
+
BOOL *stop) {
|
|
1959
|
+
(void)idx;
|
|
1960
|
+
(void)stop;
|
|
1961
|
+
return [[[entry value] stringValue] isEqualToString:needle];
|
|
1962
|
+
}];
|
|
1963
|
+
[phones removeObjectsAtIndexes:matches];
|
|
1964
|
+
}
|
|
1965
|
+
for (id value in elizaPayloadArray(payload, @"addPhones")) {
|
|
1966
|
+
if (![value isKindOfClass:[NSDictionary class]]) {
|
|
1967
|
+
continue;
|
|
1968
|
+
}
|
|
1969
|
+
CNLabeledValue<CNPhoneNumber *> *phone =
|
|
1970
|
+
elizaPayloadPhone((NSDictionary *)value);
|
|
1971
|
+
if (phone != nil) {
|
|
1972
|
+
[phones addObject:phone];
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
if ([payload objectForKey:@"phones"] != nil) {
|
|
1976
|
+
[phones removeAllObjects];
|
|
1977
|
+
for (id value in elizaPayloadArray(payload, @"phones")) {
|
|
1978
|
+
if (![value isKindOfClass:[NSDictionary class]]) {
|
|
1979
|
+
continue;
|
|
1980
|
+
}
|
|
1981
|
+
CNLabeledValue<CNPhoneNumber *> *phone =
|
|
1982
|
+
elizaPayloadPhone((NSDictionary *)value);
|
|
1983
|
+
if (phone != nil) {
|
|
1984
|
+
[phones addObject:phone];
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
[contact setPhoneNumbers:phones];
|
|
1989
|
+
|
|
1990
|
+
NSMutableArray<CNLabeledValue<NSString *> *> *emails =
|
|
1991
|
+
[[contact emailAddresses] mutableCopy];
|
|
1992
|
+
for (id value in elizaPayloadArray(payload, @"removeEmails")) {
|
|
1993
|
+
if (![value isKindOfClass:[NSString class]]) {
|
|
1994
|
+
continue;
|
|
1995
|
+
}
|
|
1996
|
+
NSString *needle = (NSString *)value;
|
|
1997
|
+
NSIndexSet *matches = [emails
|
|
1998
|
+
indexesOfObjectsPassingTest:
|
|
1999
|
+
^BOOL(CNLabeledValue<NSString *> *entry,
|
|
2000
|
+
NSUInteger idx,
|
|
2001
|
+
BOOL *stop) {
|
|
2002
|
+
(void)idx;
|
|
2003
|
+
(void)stop;
|
|
2004
|
+
return [[entry value] isEqualToString:needle];
|
|
2005
|
+
}];
|
|
2006
|
+
[emails removeObjectsAtIndexes:matches];
|
|
2007
|
+
}
|
|
2008
|
+
for (id value in elizaPayloadArray(payload, @"addEmails")) {
|
|
2009
|
+
if (![value isKindOfClass:[NSDictionary class]]) {
|
|
2010
|
+
continue;
|
|
2011
|
+
}
|
|
2012
|
+
CNLabeledValue<NSString *> *email =
|
|
2013
|
+
elizaPayloadEmail((NSDictionary *)value);
|
|
2014
|
+
if (email != nil) {
|
|
2015
|
+
[emails addObject:email];
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
if ([payload objectForKey:@"emails"] != nil) {
|
|
2019
|
+
[emails removeAllObjects];
|
|
2020
|
+
for (id value in elizaPayloadArray(payload, @"emails")) {
|
|
2021
|
+
if (![value isKindOfClass:[NSDictionary class]]) {
|
|
2022
|
+
continue;
|
|
2023
|
+
}
|
|
2024
|
+
CNLabeledValue<NSString *> *email =
|
|
2025
|
+
elizaPayloadEmail((NSDictionary *)value);
|
|
2026
|
+
if (email != nil) {
|
|
2027
|
+
[emails addObject:email];
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
[contact setEmailAddresses:emails];
|
|
2032
|
+
}
|
|
2033
|
+
|
|
2034
|
+
extern "C" char *addContactJson(const char *payloadJson) {
|
|
2035
|
+
@autoreleasepool {
|
|
2036
|
+
if (!elizaContactsHasAccess()) {
|
|
2037
|
+
return elizaCopyJson(elizaJsonError(
|
|
2038
|
+
@"permission", @"Apple Contacts access has not been granted."));
|
|
2039
|
+
}
|
|
2040
|
+
NSDictionary *payload = elizaParseJsonObject(payloadJson);
|
|
2041
|
+
if (payload == nil) {
|
|
2042
|
+
return elizaCopyJson(elizaJsonError(
|
|
2043
|
+
@"native_error", @"Invalid contact payload."));
|
|
2044
|
+
}
|
|
2045
|
+
CNMutableContact *contact = [[CNMutableContact alloc] init];
|
|
2046
|
+
elizaApplyContactPayload(contact, payload);
|
|
2047
|
+
CNSaveRequest *request = [[CNSaveRequest alloc] init];
|
|
2048
|
+
[request addContact:contact toContainerWithIdentifier:nil];
|
|
2049
|
+
CNContactStore *store = [[CNContactStore alloc] init];
|
|
2050
|
+
NSError *error = nil;
|
|
2051
|
+
if (![store executeSaveRequest:request error:&error]) {
|
|
2052
|
+
return elizaCopyJson(elizaJsonError(
|
|
2053
|
+
@"native_error",
|
|
2054
|
+
elizaErrorMessage(error, @"Failed to create Apple contact.")));
|
|
2055
|
+
}
|
|
2056
|
+
return elizaCopyJson(elizaJsonOk(@{@"id" : [contact identifier] ?: @""}));
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
extern "C" char *updateContactJson(const char *personId,
|
|
2061
|
+
const char *payloadJson) {
|
|
2062
|
+
@autoreleasepool {
|
|
2063
|
+
if (!elizaContactsHasAccess()) {
|
|
2064
|
+
return elizaCopyJson(elizaJsonError(
|
|
2065
|
+
@"permission", @"Apple Contacts access has not been granted."));
|
|
2066
|
+
}
|
|
2067
|
+
NSString *identifier = [elizaNSStringFromCString(personId)
|
|
2068
|
+
stringByTrimmingCharactersInSet:[NSCharacterSet
|
|
2069
|
+
whitespaceAndNewlineCharacterSet]];
|
|
2070
|
+
NSDictionary *payload = elizaParseJsonObject(payloadJson);
|
|
2071
|
+
if ([identifier length] == 0 || payload == nil) {
|
|
2072
|
+
return elizaCopyJson(elizaJsonError(
|
|
2073
|
+
@"native_error", @"Contact id and payload are required."));
|
|
2074
|
+
}
|
|
2075
|
+
CNContactStore *store = [[CNContactStore alloc] init];
|
|
2076
|
+
NSError *error = nil;
|
|
2077
|
+
CNContact *existing =
|
|
2078
|
+
[store unifiedContactWithIdentifier:identifier
|
|
2079
|
+
keysToFetch:elizaContactKeys()
|
|
2080
|
+
error:&error];
|
|
2081
|
+
if (existing == nil || error != nil) {
|
|
2082
|
+
return elizaCopyJson(elizaJsonError(
|
|
2083
|
+
@"not_found",
|
|
2084
|
+
elizaErrorMessage(error, @"Apple contact was not found.")));
|
|
2085
|
+
}
|
|
2086
|
+
CNMutableContact *mutableContact = [existing mutableCopy];
|
|
2087
|
+
elizaApplyContactPayload(mutableContact, payload);
|
|
2088
|
+
CNSaveRequest *request = [[CNSaveRequest alloc] init];
|
|
2089
|
+
[request updateContact:mutableContact];
|
|
2090
|
+
error = nil;
|
|
2091
|
+
if (![store executeSaveRequest:request error:&error]) {
|
|
2092
|
+
return elizaCopyJson(elizaJsonError(
|
|
2093
|
+
@"native_error",
|
|
2094
|
+
elizaErrorMessage(error, @"Failed to update Apple contact.")));
|
|
2095
|
+
}
|
|
2096
|
+
return elizaCopyJson(elizaJsonOk(nil));
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
|
|
2100
|
+
extern "C" char *deleteContactJson(const char *personId) {
|
|
2101
|
+
@autoreleasepool {
|
|
2102
|
+
if (!elizaContactsHasAccess()) {
|
|
2103
|
+
return elizaCopyJson(elizaJsonError(
|
|
2104
|
+
@"permission", @"Apple Contacts access has not been granted."));
|
|
2105
|
+
}
|
|
2106
|
+
NSString *identifier = [elizaNSStringFromCString(personId)
|
|
2107
|
+
stringByTrimmingCharactersInSet:[NSCharacterSet
|
|
2108
|
+
whitespaceAndNewlineCharacterSet]];
|
|
2109
|
+
if ([identifier length] == 0) {
|
|
2110
|
+
return elizaCopyJson(elizaJsonError(
|
|
2111
|
+
@"native_error", @"Contact id is required."));
|
|
2112
|
+
}
|
|
2113
|
+
CNContactStore *store = [[CNContactStore alloc] init];
|
|
2114
|
+
NSError *error = nil;
|
|
2115
|
+
CNContact *existing =
|
|
2116
|
+
[store unifiedContactWithIdentifier:identifier
|
|
2117
|
+
keysToFetch:elizaContactKeys()
|
|
2118
|
+
error:&error];
|
|
2119
|
+
if (existing == nil || error != nil) {
|
|
2120
|
+
return elizaCopyJson(elizaJsonError(
|
|
2121
|
+
@"not_found",
|
|
2122
|
+
elizaErrorMessage(error, @"Apple contact was not found.")));
|
|
2123
|
+
}
|
|
2124
|
+
CNMutableContact *mutableContact = [existing mutableCopy];
|
|
2125
|
+
CNSaveRequest *request = [[CNSaveRequest alloc] init];
|
|
2126
|
+
[request deleteContact:mutableContact];
|
|
2127
|
+
error = nil;
|
|
2128
|
+
if (![store executeSaveRequest:request error:&error]) {
|
|
2129
|
+
return elizaCopyJson(elizaJsonError(
|
|
2130
|
+
@"native_error",
|
|
2131
|
+
elizaErrorMessage(error, @"Failed to delete Apple contact.")));
|
|
2132
|
+
}
|
|
2133
|
+
return elizaCopyJson(elizaJsonOk(nil));
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
|
|
615
2137
|
extern "C" void freeNativeCString(char *value) {
|
|
616
2138
|
if (value != nullptr) {
|
|
617
2139
|
free(value);
|